(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,35785,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(18566);function l(){return(0,t.jsx)(r.Suspense,{fallback:(0,t.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading..."}),children:(0,t.jsx)(a,{})})}function a(){let e=(0,s.useSearchParams)(),l=e.get("success"),a=e.get("canceled"),[o,n]=(0,r.useState)(null);async function i(e){n(e);try{let t=await fetch("/api/billing/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:e})}),r=await t.json();r.url?window.location.href=r.url:alert(r.error)}catch{alert("Failed to create checkout")}n(null)}async function c(){n("portal");try{let e=await fetch("/api/billing/portal",{method:"POST"}),t=await e.json();t.url?window.location.href=t.url:alert(t.error)}catch{alert("Failed to open portal")}n(null)}return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Billing"}),(0,t.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Billing & subscriptions"}),(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Manage your plan, payment method, and invoices."})]}),l&&(0,t.jsx)("div",{className:"rounded-xl bg-green-50 px-4 py-3 text-sm text-green-700",children:"Payment successful! Your plan has been upgraded."}),a&&(0,t.jsx)("div",{className:"rounded-xl bg-yellow-50 px-4 py-3 text-sm text-yellow-700",children:"Checkout was canceled. No changes were made."}),(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-6 shadow-sm",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Starter"}),(0,t.jsxs)("p",{className:"mt-1 text-3xl font-bold",children:["$19",(0,t.jsx)("span",{className:"text-sm font-normal text-[var(--color-text-secondary)]",children:"/mo"})]}),(0,t.jsxs)("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-text-secondary)]",children:[(0,t.jsx)("li",{children:"10 bots + team seats"}),(0,t.jsx)("li",{children:"Knowledge base + lead capture"}),(0,t.jsx)("li",{children:"WhatsApp integration"})]}),(0,t.jsx)("button",{onClick:()=>i("starter"),disabled:"starter"===o,className:"mt-4 w-full rounded-xl bg-[var(--color-bg-brand)] py-2.5 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:"starter"===o?"Loading...":"Subscribe to Starter"})]}),(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-bg-brand)] bg-white p-6 shadow-card",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Pro"}),(0,t.jsxs)("p",{className:"mt-1 text-3xl font-bold",children:["$49",(0,t.jsx)("span",{className:"text-sm font-normal text-[var(--color-text-secondary)]",children:"/mo"})]}),(0,t.jsxs)("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-text-secondary)]",children:[(0,t.jsx)("li",{children:"Unlimited bots"}),(0,t.jsx)("li",{children:"Advanced analytics"}),(0,t.jsx)("li",{children:"Priority support"})]}),(0,t.jsx)("button",{onClick:()=>i("pro"),disabled:"pro"===o,className:"mt-4 w-full rounded-xl bg-[var(--color-bg-brand)] py-2.5 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:"pro"===o?"Loading...":"Subscribe to Pro"})]})]}),(0,t.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-6 shadow-sm",children:[(0,t.jsx)("p",{className:"font-semibold",children:"Manage existing subscription"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Update payment method, view invoices, or cancel via the Stripe Billing Portal."}),(0,t.jsx)("button",{onClick:c,disabled:"portal"===o,className:"mt-3 inline-flex items-center rounded-xl border border-[var(--color-border-subtle)] px-4 py-2 text-sm font-semibold transition hover:bg-[var(--color-bg-soft)] disabled:opacity-50",children:"portal"===o?"Loading...":"Open billing portal"})]})]})}e.s(["default",()=>l])}]);