1import{r as C,m as r,Mh as w,a5 as c,Mi as S,Mj as U}from"./main-BVeaUmEJ.js";import{g as Y,c as A}from"./customer-portal-button-B1kmK7Nc.js";import{a as t,b as i,c as f}from"./use-payment-Bf0Qq8HI.js";function H({metadata:m,currentPlan:h,currentSubscription:a,selectedInterval:v,showIntervalToggle:E=!0,className:_}){const[O,y]=C.useState(t.YEAR),l=v??O,g=Y(),d=h?.id??null,x=(e,s,M)=>{if(!d||e.isFree||h?.isFree)return{isCurrentPlan:d===e.id};const b=e.prices.find(n=>M===i.ONE_TIME?n.type===i.ONE_TIME:n.type===i.SUBSCRIPTION&&n.interval===s);if(a&&d===e.id&&b?.priceId){const n=a.priceId===b.priceId,R=a.interval===t.MONTH&&s===t.YEAR;return{isCurrentPlan:n,isUpgrade:!n&&R,isDowngrade:!n&&a.interval===t.YEAR&&s===t.MONTH}}const p=A(e.id,d);return{isCurrentPlan:p===0,isUpgrade:p>0,isDowngrade:p<0}},I=g.filter(e=>e.isFree&&!e.disabled),o=g.filter(e=>!e.isFree&&!e.disabled&&e.prices.some(s=>s.type===i.SUBSCRIPTION)),N=g.filter(e=>!e.isFree&&!e.disabled&&e.prices.some(s=>s.type===i.ONE_TIME)),T=o.some(e=>e.prices.some(s=>s.type===i.SUBSCRIPTION&&s.interval===t.MONTH)),P=o.some(e=>e.prices.some(s=>s.type===i.SUBSCRIPTION&&s.interval===t.YEAR)),u=I.length+o.length+N.length,j=E&&(T||P)&&o.length>0;return r.jsxs("div",{className:c("flex flex-col gap-12",_),children:[j&&r.jsx("div",{className:"flex justify-center",children:r.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-muted p-1 shadow-[inset_0_1px_3px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_3px_rgba(255,255,255,0.04)]",children:[T&&r.jsx("button",{type:"button",onClick:()=>y(t.MONTH),className:c("h-9 rounded-full px-4 text-sm font-medium transition-colors",l===t.MONTH?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:w()}),P&&r.jsxs("button",{type:"button",onClick:()=>y(t.YEAR),className:c("h-9 gap-2 rounded-full px-4 text-sm font-medium transition-colors",l===t.YEAR?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx("span",{children:S()}),r.jsx("span",{className:"inline-flex h-5 items-center rounded-md bg-accent-emerald-bg px-1.5 text-[11px] font-semibold text-accent-emerald",children:U()})]})]})}),r.jsxs("div",{className:c("grid gap-6",u===1&&"mx-auto w-full max-w-md grid-cols-1",u===2&&"mx-auto w-full max-w-2xl grid-cols-1 sm:grid-cols-2",u>=3&&"grid-cols-1 sm:grid-cols-2 xl:grid-cols-4"),children:[I.map(e=>r.jsx(f,{plan:e,metadata:m,...x(e)},e.id)),o.map(e=>r.jsx(f,{plan:e,interval:l,paymentType:i.SUBSCRIPTION,metadata:m,...x(e,l,i.SUBSCRIPTION)},e.id)),N.map(e=>r.jsx(f,{plan:e,paymentType:i.ONE_TIME,metadata:m,...x(e,void 0,i.ONE_TIME)},e.id))]})]})}export{H as P};
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.