%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/dist/assets/
Upload File :
Create Path :
Current File : //home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/dist/assets/PaketPage-B0t0jUgS.js

import{r as c,a as W,j as e}from"./index-BDMoG-ch.js";import{B as f}from"./Button-CLtEYZTH.js";import{C as L,a as K,b as S}from"./Card-DCk8Plvl.js";import{B as k}from"./Badge-BO45Wp4q.js";import{M as $}from"./Modal-DlRRXFzr.js";import{u as U}from"./useWallet-DdzO31a_.js";import{p as Y,d as G,f as _,g as b,h as N}from"./format-CjhWL3Ta.js";import"./index-CZPP6v8x.js";function J(){const[s,a]=c.useState([]),[m,u]=c.useState(null),[j,B]=c.useState([]),[M,o]=c.useState(!0),[v,g]=c.useState(null),n=c.useCallback(async()=>{try{const r=await W("/me/packages");a(r.catalog);const p=Date.now(),l=x=>new Date(x.expires_at).getTime()<=p,y=r.active&&!l(r.active)?r.active:null,C=r.purchases.map(x=>x.status==="active"&&l(x)?{...x,status:"expired"}:x);u(y),B(C),g(null)}catch(r){g(r instanceof Error?r.message:"Gagal memuat paket")}finally{o(!1)}},[]);c.useEffect(()=>{n()},[n]);const d=c.useCallback(async r=>{const p=await W(`/me/packages/${r}/buy`,{method:"POST"});return await n(),p},[n]),w=c.useCallback(async r=>{const p=await W(`/me/packages/${r}/claim`,{method:"POST"});return await n(),p},[n]);return{catalog:s,active:m,purchases:j,loading:M,error:v,buy:d,claim:w,refresh:n}}const q=1e4;function h(s){return s===null?"Unlimited":s.toLocaleString("id-ID")}function X(s){const a=new Date(s).getTime()-Date.now();return Math.max(0,Math.ceil(a/864e5))}function P({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("path",{d:"M12 6v13m0-13c0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.657 3 3 3 3h3m0-3c0-1.657 1.343-3 3-3s3 1.343 3 3c0 1.657-3 3-3 3h-3M5 11h14v8H5v-8z",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M5 15h14M5 8h14",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function I({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("path",{d:"m8.5 12.2 2.4 2.4 4.6-5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function A({className:s="h-5 w-5"}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:e.jsx("path",{d:"M13 3 5 13.5h6L11 21l8-10.5h-6L13 3z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})})}function D({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.5",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("path",{d:"M12 7v5l3.2 2",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})}function H({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.5",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("path",{d:"M12 7.5V12l3 2",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})}function R({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("path",{d:"M4 7.5A2.5 2.5 0 0 1 6.5 5H18a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6.5A2.5 2.5 0 0 1 4 16.5v-9z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),e.jsx("path",{d:"M15 12.5h3.5a1.5 1.5 0 0 1 0 3H15a1.5 1.5 0 0 1 0-3z",fill:"currentColor"})]})}function Z({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("path",{d:"M12 3.5 5 6v5.5c0 4.2 2.9 7.6 7 9 4.1-1.4 7-4.8 7-9V6l-7-2.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),e.jsx("path",{d:"m9 11.8 2.2 2.2 3.8-4.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}function E({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("path",{d:"M4 8.5 12 4l8 4.5v7L12 20l-8-4.5v-7z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),e.jsx("path",{d:"m4 8.5 8 4.5 8-4.5M12 13v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"})]})}function ee({className:s="h-5 w-5"}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:s,"aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.6"}),e.jsx("path",{d:"M12 8v5m0 3h.01",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function z({label:s,total:a,remaining:m}){if(a===null)return e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("span",{className:"text-slate-400",children:s}),e.jsx("span",{className:"font-semibold text-white",children:"Unlimited"})]});const u=Math.max(0,a-(m??0)),j=a>0?Math.min(100,u/a*100):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("span",{className:"text-slate-400",children:s}),e.jsxs("span",{className:"tabular-nums text-slate-400",children:["Terpakai"," ",e.jsx("span",{className:"font-semibold text-white",children:u.toLocaleString("id-ID")})," ","dari ",a.toLocaleString("id-ID")]})]}),e.jsx("div",{className:"mt-1.5 h-1.5 overflow-hidden rounded-full bg-white/[0.06]",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-400 to-teal-400",style:{width:`${j}%`}})}),e.jsxs("p",{className:"mt-1 text-right text-[10px] tabular-nums text-slate-500",children:[j.toFixed(0),"% terpakai"]})]})}function T({icon:s,label:a,value:m,sub:u}){return e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-white/[0.06] bg-white/[0.02] px-3 py-2.5",children:[e.jsx("span",{className:"shrink-0 text-slate-500",children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-slate-500",children:a}),e.jsx("p",{className:"truncate text-sm font-semibold tabular-nums text-white",children:m}),u&&e.jsx("p",{className:"text-[10px] text-slate-500",children:u})]})]})}function se({pkg:s,hasActive:a,claimed:m,onBuy:u,onClaim:j}){const B=Number(s.claim_free)===1,[M,o]=c.useState(!1),v=async()=>{const n="mercury-3";try{await navigator.clipboard.writeText(n),o(!0),window.setTimeout(()=>o(!1),1500)}catch{const d=document.createElement("textarea");d.value=n,document.body.appendChild(d),d.select();try{document.execCommand("copy"),o(!0),window.setTimeout(()=>o(!1),1500)}finally{document.body.removeChild(d)}}};if(B)return e.jsxs(L,{className:"relative flex flex-col overflow-hidden",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_80%_60%_at_50%_-10%,rgba(251,191,36,0.14),transparent)]"}),e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-amber-400 via-orange-400 to-emerald-400"}),e.jsx("div",{className:"absolute right-0 top-4 rounded-l-full bg-gradient-to-r from-amber-400 to-orange-400 px-3 py-1 text-[10px] font-bold uppercase tracking-wider text-ink-950 shadow-lg shadow-amber-500/20",children:"Gratis"}),e.jsxs(S,{className:"relative flex flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-start gap-3 pr-16",children:[e.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-amber-400/20 to-emerald-400/20 text-amber-300 ring-1 ring-amber-400/25",children:e.jsx(P,{})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-base font-semibold text-white",children:s.name}),s.description&&e.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-slate-400",children:s.description}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex w-fit items-center gap-1.5 rounded-full border border-amber-400/30 bg-amber-500/10 px-2.5 py-0.5 text-[10px] font-bold tracking-wide text-amber-200",children:[e.jsx("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:e.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),"Disarankan pakai model mercury-3"]}),e.jsx("button",{type:"button",onClick:v,"aria-label":"Salin ID model mercury-3",className:"inline-flex items-center gap-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-2.5 py-0.5 text-[10px] font-semibold text-slate-300 transition hover:bg-white/[0.07] hover:text-white",children:M?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"h-3 w-3 text-emerald-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.2,"aria-hidden":!0,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})}),"Tersalin"]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,"aria-hidden":!0,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"})}),"Salin"]})})]})]})]}),e.jsxs("div",{className:"mt-4 flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-extrabold tracking-tight text-transparent bg-clip-text bg-gradient-to-r from-amber-300 to-emerald-300",children:"Gratis"}),e.jsx("p",{className:"text-[11px] text-slate-500",children:N(s)})]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-slate-500",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),N(s)]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:[e.jsx(T,{icon:e.jsx(A,{className:"h-4.5 w-4.5"}),label:"Request",value:h(s.request_quota)}),e.jsx(T,{icon:e.jsx(D,{className:"h-4.5 w-4.5"}),label:"Token",value:h(s.token_quota)})]}),e.jsx("div",{className:"mt-4 flex-1"}),m?e.jsxs(f,{variant:"ghost",className:"w-full",disabled:!0,children:[e.jsx(I,{className:"h-4 w-4 text-emerald-400"}),"Sudah diklaim"]}):a?e.jsx(f,{variant:"ghost",className:"w-full",disabled:!0,children:"Tunggu paket aktif berakhir"}):e.jsxs(f,{className:"w-full bg-gradient-to-r from-amber-500 to-orange-500 text-white shadow-lg shadow-amber-500/20 hover:from-amber-400 hover:to-orange-400",onClick:()=>j(s),children:[e.jsx(P,{className:"h-4 w-4"}),"Klaim Gratis"]})]})]});const g=a;return e.jsxs(L,{className:"relative flex flex-col overflow-hidden",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-indigo-500"}),e.jsxs(S,{className:"flex flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-blue-500/10 text-blue-300 ring-1 ring-blue-400/20",children:e.jsx(E,{})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-base font-semibold text-white",children:s.name}),s.description&&e.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-slate-400",children:s.description})]})]}),e.jsxs("div",{className:"mt-4 flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-extrabold tracking-tight tabular-nums text-white",children:b(Number(s.price))}),e.jsx("p",{className:"text-[11px] text-slate-500",children:N(s)})]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-slate-500",children:[e.jsx(H,{className:"h-3.5 w-3.5"}),N(s)]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:[e.jsx(T,{icon:e.jsx(A,{className:"h-4.5 w-4.5"}),label:"Request",value:h(s.request_quota)}),e.jsx(T,{icon:e.jsx(D,{className:"h-4.5 w-4.5"}),label:"Token",value:h(s.token_quota)})]}),e.jsx("div",{className:"mt-4 flex-1"}),e.jsx(f,{className:"w-full",disabled:g,onClick:()=>u(s),children:g?"Sudah ada paket aktif":"Beli Paket"})]})]})}function oe(){const{catalog:s,active:a,purchases:m,loading:u,error:j,buy:B,claim:M}=J(),{data:o,refresh:v}=U(),[g,n]=c.useState(null),[d,w]=c.useState(null),[r,p]=c.useState(null),[l,y]=c.useState(null);c.useEffect(()=>{if(!d)return;const t=setTimeout(()=>w(null),5e3);return()=>clearTimeout(t)},[d]);const C=(t,i)=>w({id:Date.now(),type:t,text:i}),x=o?Y(o.wallet.balance):0,F=!!a,V=new Set(m.filter(t=>Number(t.package_price)===0).map(t=>t.package_id)),O=async t=>{n(t.id),w(null);try{const i=await B(t.id);await v(),y(null),C("success",`Paket "${i.user_package.package_name}" aktif! Berakhir ${_(i.user_package.expires_at)}.`)}catch(i){C("error",i instanceof Error?i.message:"Gagal membeli paket")}finally{n(null)}},Q=async t=>{n(t.id),w(null);try{const i=await M(t.id);await v(),p(null),C("success",`Paket gratis "${i.user_package.package_name}" berhasil diklaim! Aktif sampai ${_(i.user_package.expires_at)}.`)}catch(i){C("error",i instanceof Error?i.message:"Gagal mengklaim paket")}finally{n(null)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight text-white sm:text-2xl",children:"Paket"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Pilih paket kuota, atau klaim paket gratis langsung dari kartu."})]}),e.jsxs("div",{className:"panel flex items-center gap-3 px-4 py-2.5",children:[e.jsx(R,{className:"h-4.5 w-4.5 text-slate-400"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Saldo wallet"}),e.jsx("span",{className:"text-base font-bold tabular-nums text-white",children:o?G(o.wallet.balance):"…"})]})]}),d&&e.jsxs("div",{role:"alert",className:`flex items-start gap-3 rounded-xl border px-4 py-3 text-sm ${d.type==="success"?"border-emerald-500/25 bg-emerald-500/10 text-emerald-300":"border-red-500/25 bg-red-500/10 text-red-300"}`,children:[d.type==="success"?e.jsx(I,{className:"mt-0.5 h-4.5 w-4.5 shrink-0"}):e.jsx(ee,{className:"mt-0.5 h-4.5 w-4.5 shrink-0"}),e.jsx("span",{className:"flex-1 leading-relaxed",children:d.text}),e.jsx("button",{type:"button",onClick:()=>w(null),"aria-label":"Tutup notifikasi",className:"shrink-0 rounded-lg p-1 text-current opacity-60 transition hover:bg-white/[0.06] hover:opacity-100",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},d.id),a&&e.jsxs(L,{className:"relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-emerald-400 to-teal-400"}),e.jsx(K,{title:"Paket Aktif",subtitle:`${a.name} · berakhir ${_(a.expires_at)}`,action:e.jsx(k,{tone:"success",children:"Aktif"})}),e.jsx(S,{children:e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-400",children:[e.jsx(A,{className:"h-4 w-4 text-slate-500"}),"Request"]}),e.jsx("div",{className:"mt-2.5",children:e.jsx(z,{label:"Sisa request",total:a.request_quota,remaining:a.request_remaining})})]}),e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-400",children:[e.jsx(D,{className:"h-4 w-4 text-slate-500"}),"Token"]}),e.jsx("div",{className:"mt-2.5",children:e.jsx(z,{label:"Sisa token",total:a.token_quota,remaining:a.token_remaining})})]}),e.jsxs("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-400",children:[e.jsx(H,{className:"h-4 w-4 text-slate-500"}),"Masa Aktif"]}),e.jsxs("p",{className:"mt-2 text-2xl font-bold tabular-nums text-white",children:[X(a.expires_at)," hari"]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-slate-500",children:["berakhir ",_(a.expires_at)]})]}),e.jsxs("div",{className:"rounded-xl border border-emerald-500/20 bg-emerald-500/[0.06] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-emerald-300",children:[e.jsx(I,{className:"h-4 w-4"}),"Status"]}),e.jsxs("div",{className:"mt-2.5 space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-400",children:"Paket"}),e.jsx("span",{className:"truncate font-medium text-white",children:a.name})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-400",children:"Diklaim"}),e.jsx("span",{className:"tabular-nums text-slate-300",children:Number(a.package_price)===0?"Ya":b(Number(a.package_price))})]})]})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-semibold text-white",children:"Katalog Paket"}),u?e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:[...Array(3)].map((t,i)=>e.jsx("div",{className:"h-60 animate-pulse rounded-2xl border border-white/[0.04] bg-white/[0.02]"},i))}):j?e.jsx(L,{children:e.jsx(S,{children:e.jsx("p",{className:"text-sm text-red-300",children:j})})}):s.length===0?e.jsx(L,{children:e.jsx(S,{children:e.jsx("p",{className:"text-sm text-slate-500",children:"Belum ada paket tersedia."})})}):e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(t=>e.jsx(se,{pkg:t,hasActive:F,claimed:V.has(t.id),onBuy:i=>y(i),onClaim:i=>p(i)},t.id))})]}),e.jsxs(L,{children:[e.jsx(K,{title:"Riwayat",subtitle:"Paket yang dibeli atau diklaim"}),e.jsx(S,{className:"p-0",children:m.length===0?e.jsx("div",{className:"px-5 py-10 text-center text-sm text-slate-500",children:"Belum ada pembelian/klaim paket."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"divide-y divide-white/[0.04] md:hidden",children:m.map(t=>e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-white",children:t.name}),e.jsxs("p",{className:"mt-0.5 text-xs text-slate-500",children:[N(t)," ·"," ",Number(t.package_price)===0?"Klaim gratis":b(Number(t.package_price))]})]}),t.status==="active"?e.jsx(k,{tone:"success",children:"Aktif"}):t.status==="exhausted"?e.jsx(k,{tone:"warning",children:"Kuota Habis"}):e.jsx(k,{tone:"default",children:"Berakhir"})]}),e.jsxs("div",{className:"mt-2.5 grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-1.5",children:[e.jsx("p",{className:"text-[10px] text-slate-500",children:"Sisa Request"}),e.jsx("p",{className:"font-medium tabular-nums text-slate-300",children:h(t.request_remaining)})]}),e.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-1.5",children:[e.jsx("p",{className:"text-[10px] text-slate-500",children:"Sisa Token"}),e.jsx("p",{className:"font-medium tabular-nums text-slate-300",children:h(t.token_remaining)})]})]}),e.jsx("p",{className:"mt-2 text-[10px] tabular-nums text-slate-600",children:_(t.purchased_at)})]},t.id))}),e.jsx("div",{className:"hidden overflow-x-auto md:block",children:e.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/[0.06] bg-white/[0.02] text-[11px] uppercase tracking-wider text-slate-500",children:[e.jsx("th",{className:"px-5 py-3 font-semibold",children:"Paket"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Harga"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Sisa Request"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Sisa Token"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Status"}),e.jsx("th",{className:"px-5 py-3 text-right font-semibold",children:"Dibeli"})]})}),e.jsx("tbody",{children:m.map(t=>e.jsxs("tr",{className:"border-b border-white/[0.04] transition-colors last:border-0 hover:bg-white/[0.02]",children:[e.jsxs("td",{className:"px-5 py-3.5",children:[e.jsx("p",{className:"font-medium text-white",children:t.name}),e.jsx("p",{className:"text-[11px] text-slate-500",children:N(t)})]}),e.jsx("td",{className:"px-4 py-3.5 text-right font-medium tabular-nums text-slate-300",children:Number(t.package_price)===0?"Gratis":b(Number(t.package_price))}),e.jsx("td",{className:"px-4 py-3.5 text-right tabular-nums text-slate-400",children:h(t.request_remaining)}),e.jsx("td",{className:"px-4 py-3.5 text-right tabular-nums text-slate-400",children:h(t.token_remaining)}),e.jsx("td",{className:"px-4 py-3.5",children:t.status==="active"?e.jsx(k,{tone:"success",children:"Aktif"}):t.status==="exhausted"?e.jsx(k,{tone:"warning",children:"Kuota Habis"}):e.jsx(k,{tone:"default",children:"Berakhir"})}),e.jsx("td",{className:"px-5 py-3.5 text-right text-xs tabular-nums text-slate-500",children:_(t.purchased_at)})]},t.id))})]})})]})})]}),e.jsx($,{open:!!l,onClose:()=>y(null),title:"Konfirmasi Pembelian",subtitle:l?l.name:"",children:l&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-white/[0.06] bg-white/[0.02] p-3",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-blue-500/10 text-blue-300 ring-1 ring-blue-400/20",children:e.jsx(E,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-white",children:l.name}),e.jsxs("p",{className:"text-xs text-slate-500",children:[N(l)," ·"," ",h(l.request_quota)," request ·"," ",h(l.token_quota)," token"]})]}),e.jsx("p",{className:"ml-auto shrink-0 text-sm font-bold tabular-nums text-white",children:b(Number(l.price))})]}),e.jsxs("div",{className:"rounded-xl border border-amber-400/15 bg-amber-500/[0.06] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-semibold text-amber-200",children:[e.jsx(R,{className:"h-4 w-4"}),"Akan memotong saldo wallet"]}),e.jsxs("div",{className:"mt-2 space-y-1.5 text-xs text-slate-400",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Saldo saat ini"}),e.jsx("span",{className:"font-medium tabular-nums text-slate-300",children:o?G(o.wallet.balance):"…"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Dipotong"}),e.jsxs("span",{className:"font-semibold tabular-nums text-red-300",children:["−",b(Number(l.price))]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-white/[0.06] pt-1.5",children:[e.jsx("span",{children:"Sisa setelah pembelian"}),e.jsx("span",{className:"font-semibold tabular-nums text-emerald-300",children:x>=Number(l.price)?b(x-Number(l.price)):"—"})]})]}),x<Number(l.price)&&e.jsx("p",{className:"mt-2.5 rounded-lg bg-red-500/10 px-2.5 py-1.5 text-[11px] font-medium text-red-300",children:"Saldo tidak cukup — isi saldo dulu sebelum membeli."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(f,{variant:"ghost",className:"flex-1",onClick:()=>y(null),children:"Batal"}),e.jsxs(f,{className:"flex-1",isLoading:g===l.id,disabled:x<Number(l.price),onClick:()=>O(l),children:[e.jsx(E,{className:"h-4 w-4"}),"Konfirmasi Pembelian"]})]})]})}),e.jsx($,{open:!!r,onClose:()=>p(null),title:"Klaim Paket Gratis",subtitle:r?r.name:"",children:r&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-white/[0.06] bg-white/[0.02] p-3",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-amber-400/20 to-emerald-400/20 text-amber-300 ring-1 ring-amber-400/25",children:e.jsx(P,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-white",children:r.name}),e.jsxs("p",{className:"text-xs text-slate-500",children:[N(r)," ·"," ",h(r.request_quota)," request ·"," ",h(r.token_quota)," token"]})]})]}),e.jsxs("div",{className:"rounded-xl border border-amber-400/15 bg-amber-500/[0.06] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-semibold text-amber-200",children:[e.jsx(Z,{className:"h-4 w-4"}),"Syarat klaim"]}),e.jsx("ul",{className:"mt-2 space-y-1.5 text-xs leading-relaxed text-slate-400",children:e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"mt-0.5 h-1 w-1 shrink-0 rounded-full bg-amber-400"}),"Saldo wallet minimal ",b(q)," (tanpa potongan saldo)."]})}),x<q&&e.jsxs("p",{className:"mt-2.5 rounded-lg bg-red-500/10 px-2.5 py-1.5 text-[11px] font-medium text-red-300",children:["Saldo belum cukup — isi saldo minimal"," ",b(q),"."]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(f,{variant:"ghost",className:"flex-1",onClick:()=>p(null),children:"Batal"}),e.jsxs(f,{className:"flex-1 bg-gradient-to-r from-amber-500 to-orange-500 text-white shadow-lg shadow-amber-500/20 hover:from-amber-400 hover:to-orange-400",isLoading:g===r.id,disabled:x<q,onClick:()=>Q(r),children:[e.jsx(P,{className:"h-4 w-4"}),"Konfirmasi Klaim"]})]})]})})]})}export{oe as default};

Zerion Mini Shell 1.0