1import{r as h,j as e}from"./react-vendor-Bc5vLt4e.js";import{u as X,a as Y,r as N,b as _,m as l}from"./main-DN5yyfMC.js";import{c as Z}from"./planPricing-CLnhbupC.js";import{r as ee,T as w,t as q,P as ae,aa as se,G as A,g as D,z as te}from"./icons-C_oI-rb1.js";import{L as F}from"./router-arZSJflo.js";const d=(c,t,j)=>({initial:{opacity:0,x:t,y:j,scale:.9},animate:{opacity:1,x:0,y:0,scale:1},transition:{type:"spring",stiffness:120,damping:16,delay:.12*c}});function oe(){const{token:c,user:t,loadMe:j}=X(),{t:a,fmtMoney:R,fmtNumber:m}=Y(),[s,T]=h.useState(null),[G,k]=h.useState(!0),[x,g]=h.useState(""),[S,M]=h.useState(!1),u=!!(t!=null&&t.billing_locked_by_partner);if(h.useEffect(()=>{if(!c){k(!1);return}let r=!1;return N("/api/user/stats",{headers:_(c)},1e4).then(n=>{r||(n.ok&&n.data?(T(n.data),g("")):g(a("sub.q.loadError")))}).catch(()=>{r||g(a("sub.q.loadError"))}).finally(()=>{r||k(!1)}),()=>{r=!0}},[c]),G)return e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsx(ee,{className:"w-8 h-8 text-accent animate-spin"})});const i=!(t!=null&&t.has_paid_subscription),o=!!((t==null?void 0:t.overage_enabled)??!0),Q=!!(t!=null&&t.paid_quota_block_active),B=Number((t==null?void 0:t.overage_price_try)??6),E=(t==null?void 0:t.trial_used_minutes)||0,b=(s==null?void 0:s.trial_quota)??100,H=Math.max(0,(s==null?void 0:s.trial_remaining_minutes)??b-E),J=Math.min(100,b>0?E/b*100:0),C=(s==null?void 0:s.trial_duration_days)??14,P=Math.max(0,(s==null?void 0:s.trial_days_remaining)??(t==null?void 0:t.trial_days_remaining)??C),y=(s==null?void 0:s.trial_status)??(t==null?void 0:t.trial_status)??"not_started",O=(s==null?void 0:s.trial_has_started)??(t==null?void 0:t.trial_has_started)??!1,U=Number((s==null?void 0:s.granted_test_minutes_remaining)??(t==null?void 0:t.granted_test_minutes_remaining)??0)>0||Number((s==null?void 0:s.granted_test_minutes_total)??(t==null?void 0:t.granted_test_minutes_total)??0)>0,f=u||U,L=r=>R(r,{maximumFractionDigits:2}),z=a("sub.overageUnit",{net:L(B),gross:L(Z(B))}),p=(r,n=0)=>a("sub.q.min",{n:m(r,{minimumFractionDigits:n,maximumFractionDigits:n})}),v=(s==null?void 0:s.monthly_minute_limit)??0,$=(s==null?void 0:s.used_minutes)??0,I=(s==null?void 0:s.remaining_minutes)??v,K=(s==null?void 0:s.usage_percent)??(v>0?$/v*100:0),V=async()=>{if(!c)return;const r=await N("/api/user/stats",{headers:_(c)},1e4);r.ok&&r.data&&(T(r.data),g(""))},W=async r=>{if(!(!c||!(t!=null&&t.has_paid_subscription)||u)){M(!0);try{const n=await N("/api/billing/subscription/overage-setting",{method:"PUT",headers:_(c),body:JSON.stringify({enabled:r})},15e3);if(!n.ok)throw new Error(n.error||a("sub.err.overage"));await j(),await V()}catch(n){g((n==null?void 0:n.message)||a("sub.err.overage"))}finally{M(!1)}}};return e.jsxs("div",{className:"space-y-4 sm:space-y-5 lg:space-y-6",children:[x&&e.jsxs(l.div,{className:"p-3.5 sm:p-4 rounded-xl border flex items-start gap-3",style:{background:"rgba(var(--warning-rgb), 0.10)",borderColor:"rgba(var(--warning-rgb), 0.25)"},...d(0,0,-20),children:[e.jsx(w,{className:"w-6 h-6 text-[var(--warning-base)]"}),e.jsxs("div",{children:[e.jsx("h3",{className:"t-heading font-bold",children:a("sub.q.delayedTitle")}),e.jsx("p",{className:"text-sm text-[var(--c-warning)]",children:x})]})]}),i&&y==="minutes_exhausted"&&e.jsxs(l.div,{className:"p-3.5 sm:p-4 rounded-xl border flex items-start gap-3",style:{background:"rgba(var(--warning-rgb), 0.10)",borderColor:"rgba(var(--warning-rgb), 0.25)"},...d(x?1:0,0,-20),children:[e.jsx(w,{className:"w-6 h-6 text-[var(--warning-base)]"}),e.jsxs("div",{children:[e.jsx("h3",{className:"t-heading font-bold",children:a("sub.q.trialMinutesExhaustedTitle",{n:m(b)})}),e.jsx("p",{className:"text-sm text-[var(--c-warning)]",children:a("sub.q.trialMinutesExhaustedBody")})]})]}),i&&y==="time_exhausted"&&e.jsxs(l.div,{className:"p-3.5 sm:p-4 rounded-xl border flex items-start gap-3",style:{background:"rgba(var(--warning-rgb), 0.10)",borderColor:"rgba(var(--warning-rgb), 0.25)"},...d(x?2:1,0,-20),children:[e.jsx(w,{className:"w-6 h-6 text-[var(--warning-base)]"}),e.jsxs("div",{children:[e.jsx("h3",{className:"t-heading font-bold",children:a("sub.q.trialTimeExhaustedTitle",{n:m(C)})}),e.jsx("p",{className:"text-sm text-[var(--c-warning)]",children:a("sub.q.trialTimeExhaustedBody")})]})]}),i&&y==="not_started"&&e.jsxs(l.div,{className:"p-3.5 sm:p-4 roun
1ded-xl border flex items-start gap-3",style:{background:"var(--c-accent-soft)",borderColor:"var(--c-accent-border)"},...d(x?3:2,0,-20),children:[e.jsx(q,{className:"w-6 h-6 text-accent"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold",style:{color:"var(--c-heading)"},children:a("sub.q.notStartedTitle")}),e.jsx("p",{className:"text-sm",style:{color:"var(--c-body)"},children:a("sub.q.notStartedBody")})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5 sm:grid-cols-3 sm:gap-4",children:[e.jsxs(l.div,{className:"p-4 sm:p-5 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(1,-60,-30),children:[e.jsx(q,{className:"w-5 h-5 text-accent mb-3"}),e.jsx("div",{className:"text-lg sm:text-2xl font-display font-bold t-heading",children:i?p(H,1):p(I)}),e.jsxs("div",{className:"t-muted text-xs mt-1",children:[a(i?f?"sub.q.remainingTestMin":"sub.q.remainingTrialMin":"sub.q.remainingPlanMin"),e.jsxs("span",{className:"opacity-60 ms-1",children:["/ ",p(i?b:v)]})]})]}),e.jsxs(l.div,{className:"p-4 sm:p-5 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(2,0,-50),children:[i?e.jsx(q,{className:"w-5 h-5 text-accent mb-3"}):e.jsx(ae,{className:"w-5 h-5 text-accent mb-3"}),e.jsx("div",{className:"text-lg sm:text-2xl font-display font-bold t-heading",children:i?a(P===1?"sub.q.days.one":"sub.q.days.other",{n:m(P)}):m((s==null?void 0:s.total_calls)??0)}),e.jsx("div",{className:"t-muted text-xs mt-1",children:i?a(O&&!f?"sub.q.trialTimeLeft":f?"sub.q.testUsageActive":"sub.q.trialUsageActive"):e.jsxs(e.Fragment,{children:[a("sub.q.totalCalls")," ",e.jsx("span",{className:"opacity-60",children:a("sub.q.allTime")})]})})]}),e.jsxs(l.div,{className:"col-span-2 p-4 sm:col-span-1 sm:p-5 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(3,60,-30),children:[e.jsx(se,{className:"w-5 h-5 text-accent mb-3"}),e.jsx("div",{className:"text-lg sm:text-2xl font-display font-bold t-heading",children:m((i?J:K)/100,{style:"percent",maximumFractionDigits:0})}),e.jsx("div",{className:"t-muted text-xs mt-1",children:i?a(O||U?f?"sub.q.testUsage":"sub.q.trialUsage":"sub.q.awaitingStart"):e.jsxs(e.Fragment,{children:[a("sub.q.usageSelected")," ",e.jsx("span",{className:"opacity-60",children:a("sub.q.usageSelectedMuted")})]})})]})]}),!i&&!u&&e.jsx(l.div,{className:"p-4 sm:p-6 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(4,-30,0),children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"t-heading font-semibold text-sm flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-accent"}),a(o?"sub.q.overageOnTitle":"sub.q.overageOffTitle")]}),e.jsx("p",{className:"t-muted text-sm mt-2",children:o?a("sub.q.overageOnBody",{unit:z}):a("sub.q.overageOffBody")}),Q&&e.jsx("p",{className:"mt-2 text-xs font-semibold text-[var(--c-warning)]",children:a("sub.q.blocked")})]}),e.jsx("button",{onClick:()=>{o&&!window.confirm(a("sub.q.confirmOff"))||W(!o)},disabled:S,className:`inline-flex items-center justify-center gap-2 rounded-xl px-4 py-3 text-sm font-semibold disabled:opacity-60 ${o?"text-[#fff]":"text-[var(--c-on-accent)]"}`,style:{background:o?"var(--danger-base)":"var(--accent)"},children:a(S?"sub.updating":o?"sub.overage.turnOff":"sub.overage.turnOn")})]})}),e.jsx(l.div,{className:"p-4 sm:p-6 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(5,-40,0),children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"t-heading font-semibold text-sm flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-accent"}),a("sub.q.subTitle")]}),e.jsx("p",{className:"t-muted text-sm mt-2",children:a(u?"sub.q.subPartner":"sub.q.subBody")})]}),u?null:e.jsxs(F,{to:"/dashboard/abonelik",className:"inline-flex items-center justify-center gap-2 rounded-xl px-4 py-3 text-sm font-semibold text-[#fff]",style:{background:"linear-gradient(135deg, var(--color-accent), var(--color-gold))"},children:[a("sub.q.manage"),e.jsx(D,{className:"w-4 h-4 rtl:-scale-x-100"})]})]})}),e.jsx(l.div,{className:"p-4 sm:p-6 rounded-2xl t-card t-shadow border border-[var(--c-border)]",...d(6,-80,0),children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"t-heading font-semibold text-sm flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-accent"}),a("sub.q.callsTitle")]}),e.jsx("p",{className:"t-muted text-sm mt-2",children:a("sub.q.callsBody")})]}),e.jsxs(F,{to:"/dashboard/cagrilar",className:"inline-flex items-center justify-center gap-2 rounded-xl px-4 py-3 text-sm font-semibold text-[#fff]",style:{background:"linear-gradient(135deg, var(--color-accent), var(--color-gold))"},children:[a("sub.q.viewCalls"),e.jsx(D,{className:"w-4 h-4 rtl:-scale-x-100"})]})]})})]})}export{oe 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.