1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{r as m}from"./vendor-react-E98sgxjj.js";import{u as x}from"./vendor-query-bOUN_gKe.js";import{u as i,n as p,H as h}from"./index-BKzE8EQ8.js";import{du as c}from"./vendor-fa-Bn2dnpnC.js";import{C as f}from"./CoinTopUpModal-CAwRJTIr.js";function V(){const{t}=i("checkout"),[n,a]=m.useState(!1),{data:s,isLoading:o}=x({queryKey:["play-wallet-history"],queryFn:p.getWalletHistory}),d=()=>a(!1),l=s?.test_balance??0;return e.jsxs(e.Fragment,{children:[e.jsx(h,{children:e.jsx("title",{children:t("coins.walletTitle",{defaultValue:"Coins"})})}),e.jsxs("div",{className:"max-w-4xl mx-auto w-full px-4 md:px-8 pt-22 md:pt-8 pb-12",children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:t("coins.walletTitle",{defaultValue:"Coins"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:t("coins.walletSubtitle",{defaultValue:"One balance for every Tesana game."})}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(c,{icon:"coins",className:"text-amber-400 text-xl"}),e.jsx("div",{children:o?e.jsx("p",{className:"text-sm text-muted-foreground",children:t("coins.loading",{defaultValue:"Loadingâ¦"})}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-2xl font-semibold tabular-nums",children:(s?.balance??0).toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("coins.balance",{defaultValue:"You have {{count}} coins",count:s?.balance??0})})]})})]}),e.jsx("button",{onClick:()=>a(!0),className:"shrink-0 px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity",children:t("coins.buyCoins",{defaultValue:"Buy coins"})})]}),l>0&&e.jsx("p",{className:"text-xs text-muted-foreground mt-4 pt-4 border-t border-border",children:t("coins.testBalanceNote",{defaultValue:"Plus {{count}} test coins, spendable only in games you own.",count:l})})]}),e.jsx("h2",{className:"text-sm font-medium mb-3",children:t("coins.history",{defaultValue:"Recent activity"})}),o&&e.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:t("coins.loading",{defaultValue:"Loadingâ¦"})}),!o&&(s?.entries.length??0)===0&&e.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:t("coins.historyEmpty",{defaultValue:"Nothing yet. Buy coins and they will show up here."})}),!o&&(s?.entries.length??0)>0&&e.jsx("ul",{className:"rounded-lg border border-border divide-y divide-border",children:s?.entries.map((r,u)=>e.jsx(g,{entry:r},`${r.at}-${u}`))})]}),e.jsx(f,{isOpen:n,onClose:d,returnUrl:typeof window>"u"?"":window.location.href})]})}function g({entry:t}){const{t:n}=i("checkout"),a=t.kind==="purchase"?`${n("coins.purchaseLabel",{defaultValue:"Bought in game"})} â ${t.label}`:t.label,s=t.coins>0;return e.jsxs("li",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(c,{icon:s?"coins":"cart-shopping",className:s?"text-amber-400":"text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm truncate",children:a}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(t.at).toLocaleString()})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsxs("p",{className:s?"text-sm font-medium tabular-nums text-emerald-500":"text-sm font-medium tabular-nums text-muted-foreground",children:[s?"+":"",t.coins.toLocaleString()]}),parseFloat(t.amount_usd)>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["$",t.amount_usd]})]})]})}export{V 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.