module.exports=[5970,a=>{"use strict";var b=a.i(87924),c=a.i(72131);function d(){let[a,d]=(0,c.useState)(null),[e,f]=(0,c.useState)(!0);if((0,c.useEffect)(()=>{fetch("/api/admin/billing").then(a=>a.json()).then(d).catch(console.error).finally(()=>f(!1))},[]),e)return(0,b.jsx)("div",{className:"py-20 text-center text-white/30",children:"Loading..."});if(!a)return(0,b.jsx)("div",{className:"py-20 text-center text-red-400",children:"Failed to load"});let g=Object.values(a.breakdown).reduce((a,b)=>a+b,0);return(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold",children:"Billing & Revenue"}),(0,b.jsx)("p",{className:"text-sm text-white/50",children:"Revenue breakdown and subscriber management"})]}),(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-4",children:[(0,b.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-5",children:[(0,b.jsx)("p",{className:"text-xs font-semibold uppercase text-white/40",children:"MRR"}),(0,b.jsxs)("p",{className:"mt-2 text-4xl font-bold text-green-400",children:["$",a.mrr]}),(0,b.jsx)("p",{className:"text-xs text-white/30",children:"/month"})]}),["free","starter","pro"].map(c=>(0,b.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-5",children:[(0,b.jsx)("p",{className:"text-xs font-semibold uppercase text-white/40",children:c}),(0,b.jsx)("p",{className:"mt-2 text-3xl font-bold",children:a.breakdown[c]||0}),(0,b.jsxs)("p",{className:"text-xs text-white/30",children:[g>0?Math.round((a.breakdown[c]||0)/g*100):0,"% of users"]})]},c))]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-white/10",children:[(0,b.jsx)("div",{className:"border-b border-white/10 bg-white/5 px-5 py-3",children:(0,b.jsxs)("p",{className:"font-semibold",children:["Paying Subscribers (",a.subscribedUsers.length,")"]})}),0===a.subscribedUsers.length?(0,b.jsx)("div",{className:"px-5 py-8 text-center text-sm text-white/30",children:"No paying subscribers yet"}):(0,b.jsxs)("table",{className:"min-w-full text-sm",children:[(0,b.jsx)("thead",{className:"border-b border-white/5 text-left text-white/40",children:(0,b.jsxs)("tr",{children:[(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"User"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Plan"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Stripe ID"}),(0,b.jsx)("th",{className:"px-4 py-3 font-semibold",children:"Since"})]})}),(0,b.jsx)("tbody",{className:"divide-y divide-white/5",children:a.subscribedUsers.map(a=>(0,b.jsxs)("tr",{className:"hover:bg-white/5",children:[(0,b.jsxs)("td",{className:"px-4 py-3",children:[(0,b.jsx)("p",{className:"font-medium",children:a.name}),(0,b.jsx)("p",{className:"text-xs text-white/40",children:a.email})]}),(0,b.jsx)("td",{className:"px-4 py-3",children:(0,b.jsx)("span",{className:"rounded-full bg-[var(--color-bg-brand)]/20 px-2 py-0.5 text-xs text-[var(--color-accent-green-light)]",children:a.plan})}),(0,b.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-white/30",children:a.stripeCustomerId||"—"}),(0,b.jsx)("td",{className:"px-4 py-3 text-xs text-white/40",children:new Date(a.createdAt).toLocaleDateString()})]},a._id))})]})]})]})}a.s(["default",()=>d])}];

//# sourceMappingURL=src_app_%28admin%29_thisistheaeyesecretlogin_billing_page_tsx_a313cc03._.js.map