1import{j as e,C as y,d as U,u as A,a as P,b as k,L as R,z as v}from"./index-DHIoRbOo.js";import{u as L,r as i}from"./react-BoTORPqm.js";import{C as O}from"./CopyButton-BhyZzFyn.js";import{Q as M}from"./qr-code-BnairrMJ.js";import{A as W}from"./arrow-down-CiiJuq9D.js";import{M as F}from"./Modal-CX4ow3AW.js";import{i as S}from"./coins-BsF-WjHB.js";import{R as z}from"./refresh-cw-DdsGHlWK.js";import{P as D}from"./plus-BnvqraqR.js";import{C as B}from"./coins-RKJJm8Jp.js";import{Z as H}from"./zap-C4yAylDI.js";import"./forms-DOz1kXsi.js";const $={BTC:{color:"#F7931A",icon:"â¿",name:"Bitcoin"},ETH:{color:"#627EEA",icon:"Î",name:"Ethereum"},USDT_TRC20:{color:"#26A17B",icon:"â®",name:"USDT"},USDT_ERC20:{color:"#627EEA",icon:"â®",name:"USDT"},USDT_SOLANA:{color:"#9945FF",icon:"â®",name:"USDT"},USDT_BEP20:{color:"#F0B90B",icon:"â®",name:"USDT"},USDT_TON:{color:"#0098EA",icon:"â®",name:"USDT"},TON:{color:"#0098EA",icon:"T",name:"Toncoin"},BNB:{color:"#F0B90B",icon:"BNB",name:"BNB"},TRX:{color:"#EF0027",icon:"TRX",name:"Tron"},LTC:{color:"#345D9D",icon:"Å",name:"Litecoin"},DOGE:{color:"#C2A633",icon:"Ã",name:"Dogecoin"},BCH:{color:"#8DC351",icon:"BCH",name:"Bitcoin Cash"}},G={USDT_TRC20:"Tron (TRC20)",USDT_ERC20:"Ethereum (ERC20)",USDT_SOLANA:"Solana",USDT_BEP20:"BSC (BEP20)",USDT_TON:"TON"};function I(a){return $[a]||{color:"#a8a29e",icon:a.charAt(0),name:a}}function _({wallet:a,onClick:x,onQRCode:j,onConfigure:u,onWithdraw:g}){const{coin:h,address:p,balance:w,usdBalance:N,withdrawal_address:b,auto_withdraw:c,label:l,is_premium:n}=a,f=I(h.toUpperCase()),d=G[h.toUpperCase()],C=a.tree_balance??w,r=a.is_main!==!1&&a.parent_id==null,m=a.sub_wallet_count??0;return e.jsxs("div",{className:"card card-interactive",onClick:x,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{coin:h,size:36}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"title-sm",children:f.name}),n&&e.jsx("span",{className:"badge-warning text-[10px]",children:"PRO"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"font-mono text-xs text-subtle",children:h.toUpperCase()}),d&&e.jsx("span",{className:"badge-neutral text-[10px]",children:d.split(" ")[0]})]})]})]}),e.jsx("div",{className:"flex items-center gap-0.5",children:j&&e.jsx("button",{onClick:o=>{o.stopPropagation(),j()},className:"flex items-center justify-center min-w-[44px] min-h-[44px] rounded-full text-subtle hover:text-ink hover:bg-surface-light transition-colors",title:"QR code","aria-label":"Show QR code",children:e.jsx(M,{className:"w-4 h-4","aria-hidden":"true"})})})]}),l&&e.jsx("p",{className:"text-xs text-muted mb-3 truncate",title:l,children:l}),e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"stat-value text-2xl",children:C}),N!==void 0&&e.jsxs("p",{className:"font-mono text-sm text-subtle mt-0.5 tabular-nums",children:["â $",N.toLocaleString()," USD"]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2.5 bg-background rounded-xl border border-line shadow-well mb-3",children:[e.jsxs("span",{className:"text-xs font-mono tabular-nums text-muted truncate flex-1 select-all",children:[p.slice(0,12),"...",p.slice(-8)]}),e.jsx(O,{text:p})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r&&e.jsxs("span",{className:"badge-neutral text-[10px]",children:["Main",m>0?` · ${m} sub`:""]}),!r&&e.jsx("span",{className:"badge-neutral text-[10px]",children:"Sub"}),b&&e.jsx("span",{className:"badge-neutral text-[10px] max-w-[150px] overflow-hidden",title:b,children:e.jsxs("span",{className:"min-w-0 truncate tabular-nums",children:["â ",b.slice(0,8),"...",b.slice(-4)]})}),r&&c===1&&e.jsx("span",{className:"badge-success text-[10px]",children:"Auto"}),r&&c!==1&&e.jsx("span",{className:"badge-warning text-[10px]",children:"Manual"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-line",children:[g&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),g()},className:"btn-secondary flex-1 flex items-center justify-center gap-1.5 px-3 text-xs",children:[e.jsx(W,{className:"w-3.5 h-3.5","aria-hidden":"true"}),"Withdraw"]}),u&&e.jsxs("button",{onClick:o=>{o.stopPropagation(),u()},className:"btn-secondary flex-1 flex items-center justify-center gap-1.5 px-3 text-xs",children:[e.jsx(U,{className:"w-3.5 h-3.5","aria-hidden":"true"}),"Configure"]})]})]})}
1const q=["BTC","BNB","TRX","LTC","DOGE","BCH","DASH","TON","USDT_BEP20","USDT_SOLANA","USDC_SOLANA","USDT_TON"],Q=["USDT_TRC20","USDT_ERC20","ETH"];function re(){A({title:"Wallets",noindex:!0});const a=L(),{user:x}=P(),j=!!(x!=null&&x.subscription&&x.subscription!=="free"),[u,g]=i.useState([]),[h,p]=i.useState(!0),[w,N]=i.useState(!1),[b,c]=i.useState(!1),[l,n]=i.useState(""),[f,d]=i.useState(""),[C,r]=i.useState(""),m=i.useCallback(async()=>{var s;try{p(!0);const t=await k.get("/wallets");g(((s=t.data)==null?void 0:s.data)||[])}catch{g([])}finally{p(!1)}},[]);i.useEffect(()=>{m()},[m]);const o=u.filter(s=>!s.is_premium),T=u.filter(s=>s.is_premium),E=async()=>{if(!l){v.error("Please select a coin");return}if(!f){v.error("Withdrawal address is required");return}N(!0);try{await k.post("/wallets",{coin:l,label:C,withdrawal_address:f}),v.success(`${l} wallet generated`),c(!1),n(""),r(""),d(""),await m()}catch{}finally{N(!1)}};return h?e.jsx(R,{message:"Loading wallets..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow mb-2",children:"Balances"}),e.jsx("h1",{className:"title-md",children:"Wallets"}),e.jsx("p",{className:"text-muted mt-1 text-sm",children:"Manage your main wallets"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:m,className:"btn-secondary flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4","aria-hidden":"true"}),"Refresh"]}),e.jsxs("button",{onClick:()=>{n(""),r(""),d(""),c(!0)},className:"btn-primary flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4","aria-hidden":"true"}),"Create main wallet"]})]})]}),u.length===0?e.jsx("div",{className:"card",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[e.jsx(B,{className:"w-8 h-8 text-subtle mb-4","aria-hidden":"true"}),e.jsx("h3",{className:"title-sm mb-2",children:"No wallets yet"}),e.jsx("p",{className:"text-subtle text-center max-w-sm mb-6",children:"Create a main wallet to start receiving payments. You can add sub wallets under it."}),e.jsxs("button",{onClick:()=>{n(""),r(""),d(""),c(!0)},className:"btn-primary flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4","aria-hidden":"true"}),"Create your first wallet"]})]})}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow mb-1.5",children:"Included"}),e.jsxs("h2",{className:"title-sm mb-3 flex items-center gap-2",children:[e.jsx(B,{className:"w-[18px] h-[18px] text-muted","aria-hidden":"true"}),"Free coins"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(s=>e.jsx(_,{wallet:s,onClick:()=>a(`/wallets/${s.id}`)},s.id))})]}),T.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow mb-1.5",children:"Paid plan"}),e.jsxs("h2",{className:"title-sm mb-3 flex items-center gap-2",children:[e.jsx(H,{className:"w-[18px] h-[18px] text-gold","aria-hidden":"true"}),"Premium coins"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:T.map(s=>e.jsx(_,{wallet:s,onClick:()=>a(`/wallets/${s.id}`)},s.id))})]})]}),e.jsx(F,{isOpen:b,onClose:()=>{c(!1),n("")},title:"Create main wallet",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink mb-2",children:"Free coins"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 mb-4",children:q.map(s=>{const t=S(s);return e.jsxs("button",{onClick:()=>t&&n(s),disabled:!t,className:`flex items-center gap-2 min-h-[44px] px-3.5 py-2 rounded-full border font-mono text-sm font-medium transition-colors duration-150 ${l===s?"border-accent-600 bg-surface-light text-ink":t?"border-line-strong text-muted hover:text-ink hover:border-line-strong":"border-line text-faint cursor-not-allowed"}`,children:[e.jsx("span",{style:{opacity:t?1:.4},children:e.jsx(y,{coin:s,size:22})}),s,!t&&e.jsx("span",{className:"font-mono text-[10px] text-faint ml-auto",children:"Soon"})]},s)})}),e.jsx("label",{className:"block text-sm font-medium text-ink mb-2",children:"Premium coins"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Q.map(s=>{const t=j&&S(s);return e.jsxs("button",{onClick:()=>t&&n(s),disabled:!t,className:`flex items-center gap-2 min-h-[44px] px-3.5 py-2 rounded-full border font-mono text-sm font-medium transition-colors duration-150 ${l===s?"border-accent-600 bg-surface-light text-ink":t?"border-line-strong text-muted hover:text-ink hover:border-line-strong":"border-line text-faint cursor-not-allowed"}`,children:[e.jsx("span",{style:{opacity:t?1:.4},children:e.jsx(y,{coin:s,size:22})}),s.replace("USDT_","USDT "),S(s)?!t&&e.jsx("span",{className:"font-mono text-[10px] text-faint ml-auto",children:"Locked"}):e.jsx("span",{className:"font-mono text-[10px] text-faint ml-auto",children:"Soon"})]},s)})}),!j&&e.jsxs("p",{className:"text-xs text-subtle mt-2",children:["Premium coins require a paid subscription. ",e.jsx("a",{href:"/subscription",className:"text-gold hover:underline",children:"Upgrade"})," to access."]})]}),e.jsxs("div",{className:"border-t border-line pt-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Label (optional)"}),e.jsx("input",{type:"text",value:C,onChange:s=>r(s.target.value),placeholder:"e.g. Main wallet",className:"input-field"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-ink mb-1",children:["Withdrawal address ",e.jsx("span",{className:"text-red-700",children:"*"})]}),e.jsx("input",{type:"text",value:f,onChange:s=>d(s.target.value),placeholder:"External address where payments are forwarded",className:"input-field font-mono"}),e.jsx("p",{className:"text-xs text-subtle mt-1",children:"Required. Payments received on this wallet and its sub wallets will be sent here."})]})]}),l&&e.jsx("div",{className:"p-4 bg-background rounded-xl border border-line shadow-well",children:e.jsxs("p",{className:"text-sm text-muted",children:["A new ",e.jsx("span",{className:"font-mono text-ink font-medium",children:l}
1)," main wallet will be generated with its own API credentials."]})}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>{c(!1),n("")},className:"btn-secondary",children:"Cancel"}),e.jsx("button",{onClick:E,disabled:!l||!f||w,className:"btn-primary flex items-center gap-2",children:w?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"animate-spin w-4 h-4",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create wallet"})]})]})})]})}export{re 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.