1import{a as F,r as _,j as e,B as $,m as j,z as B,f as G,at as C,L as R,R as M,G as I,H as O,c as D}from"./main-BImpsluT.js";import{D as V}from"./dashboard-layout-Dzt4pQFV.js";import{b as W}from"./payment-jSC_dkex.js";import{I as q}from"./IconLoader2--3VUUmxB.js";import{B as J}from"./badge-BKSYEar2.js";import{C as o,a as d,b as m,d as u,c as x,e as h}from"./card-DGNb_koZ.js";import{f as y}from"./formatter-Ch4RMnre.js";import{u as K,g as Q}from"./use-payment-C4yLvMIR.js";import"./dashboard-header-BWQZc4Ci.js";import"./sidebar-DVApT7Go.js";import"./useRender-BSxwdxRH.js";import"./auth-middleware-Chlj6Zx2.js";import"./createServerFn-CBixcFYN.js";import"./useQuery-Cmc9kPwL.js";const X=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 7v5l3 3",key:"svg-1"}]],Y=F("outline","clock","Clock",X);const Z=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],ee=F("outline","refresh","Refresh",Z),k=j.pricing.customerPortal;function z({returnUrl:a,variant:p="default",size:n="default",className:c,children:N}){const[i,l]=_.useState(!1),r=async()=>{try{l(!0);const t=await W({data:{returnUrl:a}});t?.url?window.location.href=t.url:B.error(k.failed)}catch(t){console.error("Customer portal error:",t),B.error(k.failed)}finally{l(!1)}};return e.jsx($,{variant:p,size:n,className:c,onClick:r,disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 size-4 animate-spin"}),k.loading]}):N})}const s=j.settings.billing.card,f=D("w-full overflow-hidden pt-6 pb-0 flex flex-col"),g=D("mt-2 px-6 py-4 flex justify-end items-center bg-muted rounded-none");function se(){const{data:a,isPending:p}=G.useSession(),n=a?.user,{data:c,isLoading:N,error:i,refetch:l}=K(!!n?.id),r=c?.currentPlan??null,t=c?.subscription??null,P=r?.isLifetime??!1,A=Q(),U=Object.values(A),b=r?U.find(T=>T.id===r.id)??r:null,v=b?.isFree??!1,L=t?.currentPeriodStart?y(t.currentPeriodStart):null,S=t?.currentPeriodEnd?y(t.currentPeriodEnd):null,w=t?.trialEndDate?y(t.trialEndDate):null,H=_.useCallback(()=>l(),[l]);return N||p?e.jsxs(o,{className:f,children:[e.jsxs(d,{children:[e.jsx(m,{className:"text-lg font-semibold",children:s.currentPlan}),e.jsx(u,{children:s.currentPlanDescription})]}),e.jsxs(x,{className:"space-y-4 flex-1",children:[e.jsx("div",{className:"flex items-center justify-start space-x-4",children:e.jsx(C,{className:"h-8 w-1/5"})}),e.jsx("div",{className:"text-sm text-muted-foreground space-y-2",children:e.jsx(C,{className:"h-6 w-3/5"})})]}),e.jsx(h,{className:g,children:e.jsx(C,{className:"h-8 w-1/4"})})]}):i?e.jsxs(o,{className:f,children:[e.jsxs(d,{children:[e.jsx(m,{className:"text-lg font-semibold",children:s.currentPlan}),e.jsx(u,{children:s.currentPlanDescription})]}),e.jsx(x,{className:"space-y-4 flex-1",children:e.jsx("div",{className:"text-destructive text-sm",children:i?.message})}),e.jsx(h,{className:g,children:e.jsxs($,{variant:"outline",onClick:H,children:[e.jsx(ee,{className:"size-4 mr-1"}),s.retry]})})]}):b?e.jsxs(o,{className:f,children:[e.jsxs(d,{children:[e.jsx(m,{className:"text-lg font-semibold",children:s.currentPlan}),e.jsx(u,{children:s.currentPlanDescription})]}),e.jsxs(x,{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-start space-x-4",children:[e.jsx("div",{className:"text-3xl font-medium",children:b?.name??r?.id??s.free}),t&&(t.status==="trialing"||t.status==="active")&&e.jsx(J,{variant:"outline",className:D("text-xs border-transparent",t.status==="trialing"?"bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400":"bg-green-100 text-green-700 dark:bg-green-500/20 dark:text-green-400"),children:t.status==="trialing"?e.jsxs("span",{className:"flex items-center space-x-2",children:[e.jsx(Y,{className:"size-3 mr-1"}),s.statusTrial]}):e.jsxs("span",{className:"flex items-center space-x-2",children:[e.jsx(O,{className:"size-3 mr-1"}),s.statusActive]})})]}),v&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s.freePlanMessage}),P&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s.lifetimeMessage}),t&&e.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[L&&e.jsxs("div",{className:"text-muted-foreground",children:[s.periodStart," ",L]}),S&&e.jsxs("div",{className:"text-muted-foreground",children:[s.periodEnds," ",S,t.cancelAtPeriodEnd&&` ${s.cancelsAtPeriodEnd}`]}),t.status==="trialing"&&w&&e.jsxs("div",{className:"text-amber-600",children:[s.trialEnds," ",w]})]})]}),e.jsxs(h,{className:g,children:[v&&e.jsx(R,{to:M.Pricing,className:I({variant:"default"}),children:s.upgradePlan}),P&&n&&e.jsx(z,{returnUrl:void 0,children:s.manageBilling}),!v&&!P&&n&&e.jsx(z,{returnUrl:void 0,children:s.manageSubscription})]})]}):e.jsxs(o,{className:f,children:[e.jsxs(d,{children:[e.jsx(m,{className:"text-lg font-semibold",children:s.currentPlan}),e.jsx(u,{children:s.currentPlanDescription})]}),e.jsx(x,{children:e.jsx("div",{className:"text-sm text-muted-foreground",children:s.noPlan})}),e.jsx(h,{className:g,children:e.jsx(R,{to:M.Pricing,className:I({variant:"default"}),children:s.upgradePlan})})]})}const E=j.settings.billing;function ge(){const a=[{label:j.common.settings,isCurrentPage:!1},{label:E.breadcrumb,isCurrentPage:!0}];
1return e.jsx(V,{breadcrumbs:a,title:E.title,description:E.description,children:e.jsx("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2",children:e.jsx(se,{})})})}export{ge as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.