1import{j as e}from"./radix-ui-DHg0P0-S.js";import{a as p}from"./monaco-editor-qnYGAC4j.js";import{u as f,C as h,f as j,g,m as y,h as N,B as b,r as C}from"./app-CxedAqe5.js";import{B as n}from"./badge-krkS0PR_.js";import{S as v}from"./StatusBadge-CfyNa4hU.js";import{A,h as w,a as D,b as S,c as _,d as B,e as P,f as M,g as L}from"./alert-dialog-GWqdXFHq.js";import{C as T}from"./credit-card-BXkEkXEB.js";import{B as U}from"./banknote-DSQMP8AY.js";import{C as k}from"./calendar-CSGBsC1t.js";import{f as F}from"./format-D5ebMS61.js";import"./react-vendor-DFVNanZi.js";const Y=(a,s="USD",l="en-US")=>new Intl.NumberFormat(l,{style:"currency",currency:s}).format(a);function Q({subscription:a}){const{t:s,locale:l,isRtl:m}=f(),[o,d]=p.useState(!1),c={monthly:s("Monthly"),yearly:s("Yearly"),lifetime:s("Lifetime")},x={paypal:"PayPal",bank_transfer:s("Bank Transfer"),manual:s("Manual"),stripe:"Stripe"},u=()=>{d(!0),C.post(route("billing.cancel"),{},{onFinish:()=>d(!1)})},t=a.plan;return e.jsxs(h,{children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(g,{className:"flex items-center gap-2",children:[e.jsx(T,{className:"h-5 w-5"}),s("Current Subscription")]}),e.jsx(y,{children:s("Your active subscription details")})]}),e.jsx(v,{status:a.status})]})}),e.jsxs(N,{children:[e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("Plan")}),e.jsx("p",{className:"text-lg font-semibold",children:t?.name||s("Unknown Plan")}),e.jsxs("p",{className:"text-xl font-bold text-primary",children:[Y(a.amount,"USD",m?"ar-SA":l),e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["/",t?.billing_period==="lifetime"?"":c[t?.billing_period||"monthly"]?.toLowerCase()||s("month")]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("Billing Period")}),e.jsx(n,{variant:"secondary",className:"text-sm",children:c[t?.billing_period||"monthly"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("Payment Method")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:x[a.payment_method||""]||a.payment_method||s("Not specified")})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.billing_period==="lifetime"?s("Valid Until"):s("Next Renewal")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:a.renewal_at?F(new Date(a.renewal_at),"MMM d, yyyy"):t?.billing_period==="lifetime"?s("Lifetime Access"):s("Not set")})]})]})]}),t?.features&&t.features.length>0&&e.jsxs("div",{className:"mt-6 pt-6 border-t border-border",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-3",children:s("Plan Features")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:typeof t.features=="object"&&!Array.isArray(t.features)?Object.entries(t.features).map(([r,i])=>e.jsxs(n,{variant:"outline",children:[r,": ",String(i)]},r)):Array.isArray(t.features)?t.features.map((r,i)=>e.jsx(n,{variant:"outline",children:typeof r=="object"&&r!==null?r.name:r},i)):null})]}),a.status==="active"&&e.jsx("div",{className:"mt-6 pt-6 border-t border-border flex justify-end",children:e.jsxs(A,{children:[e.jsx(w,{asChild:!0,children:e.jsx(b,{variant:"destructive",size:"sm",children:s("Cancel Subscription")})}),e.jsxs(D,{children:[e.jsxs(S,{children:[e.jsx(_,{children:s("Cancel Subscription?")}),e.jsx(B,{children:s("Are you sure you want to cancel your subscription? Your plan benefits will remain active until the end of your current billing period.")})]}),e.jsxs(P,{children:[e.jsx(M,{children:s("Keep Subscription")}),e.jsx(L,{onClick:u,disabled:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s(o?"Cancelling...":"Yes, Cancel")})]})]})]})})]})]})}export{Q as default};
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.