@edgex-web/components 1.0.0-beta.6 → 1.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { o as e, C as i, D as t, n, p as r, L as p, o as d, S as L, T as h, W as D, y as g, r as u, A as w, h as W, w as C, G as m, q as E, z as A, v as O, F as T, t as M, E as S, u as l, j as f, x as P, m as _, k as c, I as v } from "./index-VjAiP2Y6.mjs";
1
+ import { o as e, C as i, D as t, n, p as r, L as p, o as d, S as L, T as h, W as D, y as g, r as u, A as w, h as W, w as C, G as m, q as E, z as A, v as O, F as T, t as M, E as S, u as l, j as f, x as P, m as _, k as c, I as v } from "./index-BJxeI_Vg.mjs";
2
2
  import "react";
3
3
  export {
4
4
  e as ChromeLoader,
package/dist/index.umd.js CHANGED
@@ -183,5 +183,5 @@ ${Ag(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
183
183
  ${c}
184
184
  ${s}
185
185
  `,children:[t,o&&A.jsx(ym,{ref:f,placement:h.placement||n})]})})})]})},ts="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",LS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:c,onClose:a})=>{const{t:l}=Nt(),u=r===N5,f=!u,p=(t||"").toUpperCase(),d=!(r===C5&&p==="USDC"),h=v.useMemo(()=>{if(!e)return!1;const C=Number(e.chainId);return!Number.isNaN(C)&&(C===42161||C===421614)},[e]),m=u,g=v.useMemo(()=>{var C;return(C=e==null?void 0:e.tokenList)==null?void 0:C.find(M=>M.token===t||M.symbol===t)},[e,t]),N=v.useMemo(()=>{const C=(t||"").toUpperCase();if(!m&&C==="USDC")return l("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const F=l(m?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return m&&(!h||C==="USDC")?String(F).split(`
186
- `)[0]:F},[l,t,e==null?void 0:e.chain,m,h]),x=(g==null?void 0:g.minDepositSize)||"10",P=v.useMemo(()=>{const C=g==null?void 0:g.depositFeeRate;if(C==null)return"";const M=String(C).trim();return M?`${M}%`:""},[g==null?void 0:g.depositFeeRate]);return A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&A.jsx("div",{className:"bg-white rounded-lg",children:A.jsx(Qh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&A.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[A.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),A.jsx(U3,{onCopy:()=>{c&&c(n)},text:n,children:A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[A.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),A.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),A.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[A.jsxs("div",{className:"flex items-start",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1",children:A.jsx("p",{className:"text-xs text-functional-orange-1",children:N})})]}),f&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:l("deposit.addressUpdatedNotice")})]})]}),A.jsxs("div",{className:"text-sm",children:[d&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.arrivalTime")}),A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),A.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:l("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),P&&A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("withdraw.feeRate")}),A.jsx(En,{content:l("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:P})})]}),A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d||P?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.minDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:[x," ",t]})]}),f&&p!=="USDC"&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.maxDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),A.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,accountType:r,accountId:o,key:s}),a()},children:l("deposit.title")})]})},ns=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return A.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},FS=(e,t)=>Number(e)>Number(t),jt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Pi=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return Pi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:jt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},RS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=jt(Math.max(0,s).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(e),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${jt(e)} ${n}`},jS=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},zS=(e,t,n)=>{if(!kh(e,n))return!1;try{const r=new Le(t||"0"),o=new Le("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},US=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&kh(e,n))try{const i=new Le(o),c=new Le("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Le(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Le.ROUND_DOWN).toString()}catch{return o}},vm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let rt=null;const wm=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(vm),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(rt={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{rt=null}),[a,u,l,f,p,d]),n?A.jsx(Cm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});wm.displayName="DepositManager";const xm=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.openDeposit(e||vm)},Em=()=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.closeDeposit()},Sm=e=>{rt&&rt.updateDepositOptions(e)},Ti=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.setDepositLoading(e)},_S=()=>rt?rt.isOpen():!1,Pm=()=>rt?rt.isLoading():!1,WS=()=>({openDeposit:xm,closeDeposit:Em,updateDepositOptions:Sm,setDepositLoading:Ti,isOpen:_S,isLoading:Pm}),VS=e=>{const{t}=Nt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=jS(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function HS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),g=a(),N=i({address:u,abi:Or,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=N!=null&&N.isSuccess?N.data:void 0,P=v.useMemo(()=>{if(d)return!0;if(!N.isSuccess||x===void 0||x===0n)return!1;try{const M=B6(String(Number(s||"0")||0),Number(f));return x>=M}catch{return!1}},[d,N.isSuccess,x,s,f]),C=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!g||!u||!p)return;const L=Nn(u),F=Nn(p);if((x||0n)>0n){const E=await m({abi:Or,address:L,functionName:"approve",args:[F,0n]});await g.waitForTransactionReceipt({hash:E})}const y=await m({abi:Or,address:L,functionName:"approve",args:[F,pf]});await g.waitForTransactionReceipt({hash:y}),N!=null&&N.refetch&&await N.refetch()}catch(M){console.error("[useApprove] onApprove failed:",M)}},[r,n,u,p,x,N,m,g,h]);return{approve:P,onApprove:C}}const GS=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},qS=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(M=>{const L=M.tokenAddress;if(!L)return!1;const F=L.toLowerCase();return!(L===P||F===C)})},[r]),[c,a]=v.useState({}),l=v.useCallback((P,C)=>{a(M=>({...M,[P]:C}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(P=>v.createElement(GS,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const P=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},C=i.map(L=>{const F=c[Nn(L.tokenAddress)],b=F==null?void 0:F.balance,y=b==null?void 0:b.data;return{address:Nn(L.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||L.decimals}}).filter(L=>L.address),M=C.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:C,baseTokenBalance:P,combinedData:M}},[u,c,i]),m=v.useCallback(async()=>h,[h]),g=v.useMemo(()=>{const P=(u==null?void 0:u.isLoading)||!1,C=Object.values(c).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return P||C},[u==null?void 0:u.isLoading,c]),N=v.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:N,multicallResult:h,validErcTokens:i,isLoading:g,queryComponents:d}},KS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:c,wagmiHooks:a,onChainChange:l,onDeposit:u})=>{const{t:f}=Nt(),p=a.useAccount(),d=t.tokenList.find(Z=>Z.token===n||Z.symbol===n),h=t.chainId,m=v.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const J=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(J)?J!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[g,N]=v.useState(""),[x,P]=v.useState(()=>m?"fast":"standard");v.useEffect(()=>{N("")},[n,t.chainId]),v.useEffect(()=>{P(m?"fast":"standard")},[t.chainId,m]);const{multicallResult:C,queryComponents:M}=qS({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),L=v.useMemo(()=>{var J;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const Z=C.combinedData[d.tokenAddress];return((J=Z==null?void 0:Z.balance)==null?void 0:J.formatted)||"0"},[d,C]),F="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",y=v.useMemo(()=>{var Z,J;return v5({chain:S5,transport:E5(t.rpcUrl||((Z=window==null?void 0:window.ENV)==null?void 0:Z.CHAIN_RPC_URL_42161)||((J=window==null?void 0:window.ENV)==null?void 0:J.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),E="1000000000000",{formatted:T}=P5({client:y,tokenAddress:F,holder:b,decimals:6,fallbackFormatted:E,pollingInterval:12e3}),[I,$]=v.useState(!1),{approve:D,onApprove:w}=HS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:g,wagmiHooks:a}),O=v.useCallback(async()=>{if(!I)try{$(!0),await w()}catch(Z){console.error("Approve failed:",Z)}finally{$(!1)}},[I,w]),k=v.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),S=v.useCallback(async()=>{l&&l(h)},[l,h]);v.useEffect(()=>{k&&S()},[k,S]);const{showLayerZeroTip:B,layerZeroTipKey:j}=v.useMemo(()=>{const Z=+t.chainId==42161||+t.chainId==421614,J=(n==null?void 0:n.toUpperCase())==="USDT",ie=new Le(g||"0"),re=new Le("200000");let be=!1,Y;if(Z&&J&&g)if(ie.gte(re))be=!0,Y="deposit.layerZeroDepositTipGte200k";else{const fe=T;if(typeof fe=="string"&&fe.length>0){const Oe=new Le(fe);!Oe.isNaN()&&ie.gte(Oe)&&(be=!0,Y="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:be,layerZeroTipKey:Y}},[t.chainId,n,g,T]),U=v.useCallback(()=>US(+t.chainId,L||"0",n,r),[L,t==null?void 0:t.chainId,n,r]),_=v.useMemo(()=>r!=="spot"&&zS(+t.chainId,g,n),[r,t==null?void 0:t.chainId,g,n]),G=v.useMemo(()=>"deposit.maxDepositSplitTip",[]),Q=v.useMemo(()=>{const Z=Number((t==null?void 0:t.blockTime)??0),J=Number((t==null?void 0:t.txConfirm)??0);return!Number.isFinite(Z)||!Number.isFinite(J)?0:Z*J/60},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),q=m&&x==="standard",W=q?20:Q,ee=v.useMemo(()=>{const Z=d==null?void 0:d.depositFeeRate;if(Z==null)return"";const J=String(Z).trim();return J?`${J}%`:""},[d==null?void 0:d.depositFeeRate]),ve=m&&x==="fast"&&!!ee,K=VS({isNetworkMismatch:k,depositAmount:g,approved:D,currentTokenBalance:L,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),oe=Z=>{const J=Z.target.value,ie=U(),re=Pi(J,ie);if(re.isValid)N(re.formattedValue),re.errorType;else return re.errorType==="exceed_balance",void 0},se=v.useCallback(async()=>{Ti(!0);try{u&&u({amount:g,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(Z){console.error("Deposit error:",Z),Ti(!1)}},[u,g,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return A.jsxs(A.Fragment,{children:[M,m&&A.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:A.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[A.jsx("button",{type:"button",onClick:()=>P("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),A.jsx("button",{type:"button",onClick:()=>P("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:g,onChange:oe,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:()=>{const Z=U();N(Z)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:f("deposit.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:RS(L||"0",g,n)})]})]}),!D&&FS(g||"0",0)&&A.jsxs("div",{className:"flex justify-center flex-col items-center",children:[A.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),A.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),A.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:I,children:I?A.jsx(ns,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(j||"deposit.layerZeroDepositTip")})]}),A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(G)})]}),_&&A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:!(_||B)&&A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),A.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),q?A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})}):A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:f("deposit.arrivaltimeTooltip1",{v:Q,v1:t==null?void 0:t.txConfirm})}),A.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})})})]}),ve&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),A.jsx(En,{content:f("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:ee})})]}),A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),A.jsx("span",{className:"text-sm text-text-primary font-medium",children:g?A.jsxs("span",{className:"flex items-center gap-1",children:[jt(i),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),jt((parseFloat(i)+parseFloat(g)).toString())," ",n]}):`${jt(i)} ${n}`})]})]}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${K.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:se,disabled:K.disabled||c,children:[(c||k)&&A.jsx(ns,{size:"xs"}),K.text]})]})},Tm=e=>e.toLocaleUpperCase()===hn?hn:Us,rs=e=>Tm(e.wallet)===hn,Dl=e=>Tm(e.wallet)===Us,Ai=e=>e?e==="perp"?Re.PERPETUAL:e==="perp-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bJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Cm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:c,wagmiHooks:a,onDeposit:l,onCopy:u,onChainChange:f,onTokenChange:p})=>{const{t:d}=Nt(),h=v.useMemo(()=>r.map(K=>({...K,key:Ai(K.key)})),[r]),m=v.useMemo(()=>Ai(i),[i]),g=v.useMemo(()=>h.some(K=>K.key===Re.PERPETUALV2),[h]),N=v.useMemo(()=>{var oe;if(!h||h.length===0)return m;const K=h.find(se=>se.key===m);return(K==null?void 0:K.key)||((oe=h[0])==null?void 0:oe.key)||m},[h,m]),[x,P]=v.useState(N),C=v.useCallback(K=>{var oe;return((oe=h.find(se=>se.key===K))==null?void 0:oe.chains)||[]},[h]),M=C(N),L=()=>{var re;if(!M||M.length===0)return{chainId:o||1,token:""};const K=o||((re=M[0])==null?void 0:re.chainId),oe=M.find(be=>be.chainId===K)||M[0],se=(oe==null?void 0:oe.tokenList)||[],Z=(s||"").toUpperCase();if(Z&&se.length>0){const be=se.find(Y=>(Y.token||Y.symbol||"").toUpperCase()===Z);if(be)return{chainId:oe.chainId,token:be.token||be.symbol||""}}if(Z)for(const be of M){const fe=((be==null?void 0:be.tokenList)||[]).find(ge=>(ge.token||ge.symbol||"").toUpperCase()===Z);if(fe)return{chainId:be.chainId,token:fe.token||fe.symbol||""}}const J=se.length>0?oe:M.find(be=>(be.tokenList||[]).length>0)||oe,ie=((J==null?void 0:J.tokenList)||[])[0];return{chainId:(J==null?void 0:J.chainId)||oe.chainId||1,token:(ie==null?void 0:ie.token)||(ie==null?void 0:ie.symbol)||""}},[{chainId:F,token:b}]=v.useState(()=>L()),[y,E]=v.useState(F),T=v.useMemo(()=>h.find(K=>K.key===x)||h[0],[h,x]),I=v.useMemo(()=>(T==null?void 0:T.chains)||[],[T]),$=v.useMemo(()=>{var J,ie;if(!T||!Dl(T.account)||!(x===Re.SPOT||x===Re.PERPETUALV2))return!1;const se=!!((J=T.walletOptions)!=null&&J.evm),Z=!!((ie=T.walletOptions)!=null&&ie.mpc);return se&&Z},[T,x]),D=v.useCallback(()=>{var K,oe;return(K=T==null?void 0:T.walletOptions)!=null&&K.evm?"evm":(oe=T==null?void 0:T.walletOptions)!=null&&oe.mpc||T!=null&&T.account&&rs(T.account)?"mpc":"evm"},[T]),[w,O]=v.useState(()=>$?null:D());v.useEffect(()=>{O($?null:D())},[x,$,D]);const k=v.useMemo(()=>{if(!T)return;if(!$)return T.account;if(!w)return;const K=T.walletOptions;return w==="mpc"?(K==null?void 0:K.mpc)||T.account:(K==null?void 0:K.evm)||T.account},[T,w,$]),S=v.useMemo(()=>k&&rs(k)?hn:Us,[k]),B=I.find(K=>K.chainId===y)||I[0],[j,U]=v.useState(b),_=v.useCallback(K=>{E(K),f==null||f(K)},[f]),G=v.useCallback(K=>{U(K),p==null||p(K)},[p]),Q=v.useMemo(()=>{const K=(j||"").toLowerCase();if(!K)return"0";const oe=(c==null?void 0:c[x])||(x===Re.PERPETUAL?c==null?void 0:c.perp:void 0),se=oe==null?void 0:oe[K];return typeof se=="string"&&se.length>0?se:"0"},[c,x,j]),[q,W]=v.useState(!1),ee=K=>{K.target===K.currentTarget?W(!0):W(!1)},ve=K=>{q&&K.target===K.currentTarget&&n(),W(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:ee,onMouseUp:ve,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:K=>{K.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(Dh,{selectedAccount:x,options:h.map(K=>({value:K.key,label:K.key===Re.SPOT?d("account.spot"):K.key===Re.PERPETUAL?d(g?"account.perpetual-v1":"account.perp"):K.key===Re.PERPETUALV2?d("account.perpetual-v2"):K.key})),onAccountChange:K=>{var fe,ge;const oe=K||x;P(oe);const se=C(oe);if(!se||se.length===0)return;const Z=se.find(Oe=>Oe.chainId===y),J=Z?Z.chainId:se[0].chainId;E(J),f==null||f(J);const ie=se.find(Oe=>Oe.chainId===J),re=(ie==null?void 0:ie.tokenList)||[],Y=re.some(Oe=>(Oe.symbol||Oe.token)===j)?j:((fe=re[0])==null?void 0:fe.symbol)||((ge=re[0])==null?void 0:ge.token)||"";Y&&(U(Y),p==null||p(Y))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:B,chainList:I,onChainChange:_,curSelectToken:j,onTokenChange:G,walletType:S,accountType:x}),$&&!w&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>O("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:d("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>O("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.externalWalletDesc")})]})})]}),(!$||w)&&A.jsxs(A.Fragment,{children:[k&&rs(k)&&A.jsx(LS,{address:k.smartWalletAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,onDeposit:l,onCopy:u,onClose:n}),k&&Dl(k)&&A.jsx(KS,{address:k.ethAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,platformBalance:Q,isLoading:t,wagmiHooks:a,onChainChange:_,onDeposit:l,onClose:n})]})]})})})}),document.body):null},ZS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=Nt(),h=v.useMemo(()=>{if(a==="spot"||!xn(r==null?void 0:r.chainId)){const L=new Le(e||"0").minus(s||"0");if(L.isNegative()||L.isZero())return"0";const F=Math.min(L.decimalPlaces()??0,18);return L.decimalPlaces(F,Le.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),m=v.useMemo(()=>o||"0",[o]),g=v.useMemo(()=>{const L=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Le(L||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),N=v.useMemo(()=>g==="0",[g]),x=v.useMemo(()=>{const L=(t||"").toUpperCase();return L==="USDT"||L==="USDC"},[t]),P=L=>{const F=L.target.value,y=Pi(F,m||"0");if(y.isValid)l(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},C=()=>{const L=m||"0",b=Pi(L,L).formattedValue;l(b),f==null||f(b)},M=()=>{const L=parseFloat(o||"0"),F=parseFloat(e||"0");if(F>0){const b=L-F,y=jt(Math.max(0,b).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(o||"0"),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${jt(o||"0")} ${t}`};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:C,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:d("withdraw.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:M()})]})]}),i==="mpc"&&(a==="spot"||!xn(r==null?void 0:r.chainId))?A.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:A.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:L=>u==null?void 0:u(L.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,A.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:xn(r==null?void 0:r.chainId)?A.jsxs(A.Fragment,{children:[A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),A.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),A.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[A.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[A.jsx(En,{content:A.jsxs("div",{children:[A.jsx("div",{children:d("withdraw.speedNote")}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.FAST,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.Medium,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.SLOW,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),A.jsx("div",{className:"flex items-center",children:A.jsx(Jo,{selectedLevel:xn(r==null?void 0:r.chainId)?Rt.SLOW:Rt.FAST,maxLevel:3})})]}),(a==="spot"||!xn(r==null?void 0:r.chainId))&&A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N||!x?A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:N?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):A.jsx(En,{className:"w-[320px] font-normal flex items-center justify-center",content:A.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!N&&` / ${g}%`]})]}),A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(xn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[jt(h)," ",t]})]})]})]})};let ot=null;const Bl={accountChains:[],defaultAccountType:""},Om=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(Bl),a=v.useCallback(h=>{c(h||Bl),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(ot={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{ot=null}),[a,u,l,f,p,d]),n?A.jsx(Dm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Om.displayName="WithdrawManager";const Im=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.openWithdraw(e||Bl)},$m=()=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.closeWithdraw()},km=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.updateWithdrawOptions(e)},Ni=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.setWithdrawLoading(e)},YS=()=>ot?ot.isOpen():!1,Mm=()=>ot?ot.isLoading():!1,XS=()=>({openWithdraw:Im,closeWithdraw:$m,updateWithdrawOptions:km,setWithdrawLoading:Ni,isOpen:YS,isLoading:Mm}),JS=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:c,fee:a="0.00",isLoading:l=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:m})=>{var be;const{t:g}=Nt(),N=v.useMemo(()=>e.map(Y=>({...Y,key:Ai(Y.key)})),[e]),x=v.useMemo(()=>Ai(o),[o]),P=v.useMemo(()=>N.some(Y=>Y.key===Re.PERPETUALV2),[N]),C=v.useMemo(()=>{var fe;if(!N||N.length===0)return x;const Y=N.find(ge=>ge.key===x);return(Y==null?void 0:Y.key)||((fe=N[0])==null?void 0:fe.key)||x},[N,x]),[M,L]=v.useState(C),F=v.useCallback(Y=>{var fe;return((fe=N.find(ge=>ge.key===Y))==null?void 0:fe.chains)||[]},[N]),b=v.useMemo(()=>N.find(Y=>Y.key===M)||N[0],[N,M]),y=v.useMemo(()=>(b==null?void 0:b.chains)||[],[b]),E=v.useMemo(()=>{var en,Ne;if(!b||!Dl(b.account)||!(M===Re.SPOT||M===Re.PERPETUALV2))return!1;const ge=!!((en=b.walletOptions)!=null&&en.evm),Oe=!!((Ne=b.walletOptions)!=null&&Ne.mpc);return ge&&Oe},[b,M]),T=v.useCallback(()=>{var Y,fe;return(Y=b==null?void 0:b.walletOptions)!=null&&Y.evm?"evm":(fe=b==null?void 0:b.walletOptions)!=null&&fe.mpc||b!=null&&b.account&&rs(b.account)?"mpc":"evm"},[b]),[I,$]=v.useState(()=>E?null:T());v.useEffect(()=>{$(E?null:T())},[M,E,T]);const D=v.useMemo(()=>{if(!b)return;if(!E)return b.account;if(!I)return;const Y=b.walletOptions;return I==="mpc"?(Y==null?void 0:Y.mpc)||b.account:(Y==null?void 0:Y.evm)||b.account},[b,E,I]),w=v.useMemo(()=>D&&rs(D)?"mpc":"evm",[D]),O=w==="mpc"?hn:Us,k=v.useMemo(()=>{if(!y||y.length===0)return{chainId:1,tokenSymbol:""};const Y=Ne=>{const je=Ne||[];if(!je.length)return"";const He="USDC".toUpperCase(),zn=je.find(Ut=>(Ut.token||Ut.symbol||"").toUpperCase()===He)||je[0];return zn.token||zn.symbol||""};if(n){const Ne=n==null?void 0:n.toUpperCase();for(const je of y){const lr=je.tokenList||[];let He;if(Ne&&(He=lr.find(zt=>(zt.token||zt.symbol||"").toUpperCase()===Ne)),He){const zt=He.token||He.symbol||n||"";return{chainId:je.chainId,tokenSymbol:zt}}}}if(t){const Ne=y.find(He=>He.chainId===t)||y[0],je=Ne.tokenList||[],lr=Y(je);return{chainId:Ne.chainId,tokenSymbol:lr}}const fe="USDC",ge=Ne=>Array.isArray(Ne.tokenList)&&Ne.tokenList.some(je=>(je.token||je.symbol||"").toUpperCase()===fe),Oe=y.find(ge)||y[0];if(!Oe)return{chainId:1,tokenSymbol:""};const en=Y(Oe.tokenList);return{chainId:Oe.chainId,tokenSymbol:en}},[y,t,n]),[S,B]=v.useState(()=>k.chainId),[j,U]=v.useState(()=>k.tokenSymbol),[_,G]=v.useState(r),[Q,q]=v.useState(""),W=v.useCallback(Y=>{B(Y),p==null||p(Y)},[p]),ee=v.useCallback(Y=>{U(Y),d==null||d(Y)},[d]),ve=v.useRef(!0),K=v.useRef(j),oe=v.useRef(S);v.useEffect(()=>{if(ve.current){ve.current=!1,K.current=j,oe.current=S;return}(K.current!==j||oe.current!==S)&&(G(""),K.current=j,oe.current=S)},[j,S]);const se=y&&y.length>0?y.find(Y=>Y.chainId===S)||y[0]:null,Z=(be=se==null?void 0:se.tokenList)==null?void 0:be.find(Y=>Y.token===j),J=v.useMemo(()=>{const Y=new Le(_||"0"),fe=new Le(a||"0"),ge=xn(S);return Z!=null&&Z.minWithdrawSize&&Y.lt(Z.minWithdrawSize)?{text:g("withdraw.minWithdrawParsed",{amount:Z.minWithdrawSize,token:Z.symbol||Z.token}),disabled:!0}:!_||Y.isZero()||!ge&&Y.isLessThan(fe)?{text:g("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&(!ge||M==="spot")&&!Q.trim()?{text:g("withdraw.invalidReceiverAddress"),disabled:!0}:{text:g("withdraw.confirmWithdraw"),disabled:!1}},[g,S,_,w,Q,a,M,Z]),ie=v.useMemo(()=>{const Y=(j||"").toLowerCase();if(!Y)return i||"0";const fe=(c==null?void 0:c[M])||(M===Re.PERPETUAL?c==null?void 0:c.perp:void 0),ge=fe==null?void 0:fe[Y];return typeof ge=="string"&&ge.length>0?ge:i||"0"},[c,M,j,i]),re=v.useCallback(async()=>{Ni(!0);try{if(u){const fe={amount:new Le(_||"0").toString(),chainId:S,tokenAddress:(Z==null?void 0:Z.tokenAddress)||"",coinId:(Z==null?void 0:Z.coinId)||"",tokenSymbol:j,accountType:M,selectedToken:Z};w==="mpc"&&(!xn(S)||M==="spot")&&(fe.receiverAddress=Q),u(fe)}}catch{Ni(!1)}},[u,M,Z,_,S,j,w,Q]);return!y||y.length===0?A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"No chains available"})}):se?A.jsxs(A.Fragment,{children:[A.jsx(Dh,{selectedAccount:M,options:N.map(Y=>({value:Y.key,label:Y.key===Re.SPOT?g("account.spot"):Y.key===Re.PERPETUAL?g(P?"account.perpetual-v1":"account.perp"):Y.key===Re.PERPETUALV2?g("account.perpetual-v2"):Y.key})),onAccountChange:Y=>{var zt,zn;const fe=Y||M;L(fe),m==null||m(fe);const ge=F(fe);if(!ge||ge.length===0)return;const Oe=ge.find(Ut=>Ut.chainId===S),en=Oe?Oe.chainId:ge[0].chainId;B(en),p==null||p(en);const Ne=ge.find(Ut=>Ut.chainId===en),je=(Ne==null?void 0:Ne.tokenList)||[],He=je.some(Ut=>(Ut.symbol||Ut.token)===j)?j:((zt=je[0])==null?void 0:zt.symbol)||((zn=je[0])==null?void 0:zn.token)||"";He&&(U(He),d==null||d(He))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:se,chainList:y,onChainChange:W,curSelectToken:j,onTokenChange:ee,walletType:O,txType:"withdraw"}),E&&!I&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>$("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5",alt:"EVM"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:g("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>$("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5",alt:"MPC"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.externalWalletDesc")})]})})]}),(!E||I)&&A.jsxs(A.Fragment,{children:[A.jsx(ZS,{withdrawAmount:_,curSelectToken:j,tokenInfo:Z,curSelectTokenData:{balance:Z==null?void 0:Z.balance,allowance:Z==null?void 0:Z.allowance},currentActiveChain:se,currentEquity:s||0,decimals:(Z==null?void 0:Z.decimals)||6,platformBalance:ie,fee:a,walletType:w,accountType:M,receiverAddress:Q,onWithdrawAmountChange:G,onReceiverAddressChange:q,onAmountChanged:h}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${J.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:re,disabled:J.disabled||l,children:[l&&A.jsx(ns,{size:"xs"}),J.text]})]})]}):A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Dm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a="",currentEquity:l=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})=>{const{t:P}=Nt(),[C,M]=v.useState(!1),L=b=>{b.target===b.currentTarget?M(!0):M(!1)},F=b=>{C&&b.target===b.currentTarget&&r(),M(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:L,onMouseUp:F,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(JS,{accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a,defaultAccountType:n,currentEquity:l,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=ns,le.ComponentProvider=ib,le.DEFAULT_LOCALE=ss,le.Deposit=Cm,le.DepositManager=wm,le.LOCALE_NAMES=rb,le.LoadingSpinner=ns,le.SUPPORTED_LOCALES=Oi,le.Tooltip=En,le.Withdraw=Dm,le.WithdrawManager=Om,le.closeDeposit=Em,le.closeWithdraw=$m,le.formatThousands=cb,le.isDepositLoading=Pm,le.isWithdrawLoading=Mm,le.openDeposit=xm,le.openWithdraw=Im,le.setDepositLoading=Ti,le.setWithdrawLoading=Ni,le.updateDepositOptions=Sm,le.updateWithdrawOptions=km,le.useComponentConfig=ql,le.useDeposit=T5,le.useDepositManager=WS,le.useTranslation=Nt,le.useWithdraw=A5,le.useWithdrawManager=XS,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
186
+ `)[0]:F},[l,t,e==null?void 0:e.chain,m,h]),x=(g==null?void 0:g.minDepositSize)||"10",P=v.useMemo(()=>{const C=g==null?void 0:g.depositFeeRate;if(C==null)return"";const M=String(C).trim();return M?`${M}%`:""},[g==null?void 0:g.depositFeeRate]);return A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&A.jsx("div",{className:"bg-white rounded-lg",children:A.jsx(Qh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&A.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[A.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),A.jsx(U3,{onCopy:()=>{c&&c(n)},text:n,children:A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[A.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),A.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),A.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[A.jsxs("div",{className:"flex items-start",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1",children:A.jsx("p",{className:"text-xs text-functional-orange-1",children:N})})]}),f&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:l("deposit.addressUpdatedNotice")})]})]}),A.jsxs("div",{className:"text-sm",children:[d&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.arrivalTime")}),A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),A.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:l("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),P&&A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("withdraw.feeRate")}),A.jsx(En,{content:l("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:P})})]}),A.jsxs("div",{className:`flex justify-between items-center h-[18px] ${d||P?"mt-1":"mt-4"}`,children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.minDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:[x," ",t]})]}),f&&p!=="USDC"&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[A.jsx("span",{className:"text-text-tertiary",children:l("deposit.maxDeposit")}),A.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),A.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,accountType:r,accountId:o,key:s}),a()},children:l("deposit.title")})]})},ns=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return A.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},FS=(e,t)=>Number(e)>Number(t),jt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Pi=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return Pi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:jt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},RS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=jt(Math.max(0,s).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(e),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${jt(e)} ${n}`},jS=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},zS=(e,t,n)=>{if(!kh(e,n))return!1;try{const r=new Le(t||"0"),o=new Le("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},US=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&kh(e,n))try{const i=new Le(o),c=new Le("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Le(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Le.ROUND_DOWN).toString()}catch{return o}},vm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let rt=null;const wm=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(vm),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(rt={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{rt=null}),[a,u,l,f,p,d]),n?A.jsx(Cm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});wm.displayName="DepositManager";const xm=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.openDeposit(e||vm)},Em=()=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.closeDeposit()},Sm=e=>{rt&&rt.updateDepositOptions(e)},Ti=e=>{if(!rt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}rt.setDepositLoading(e)},_S=()=>rt?rt.isOpen():!1,Pm=()=>rt?rt.isLoading():!1,WS=()=>({openDeposit:xm,closeDeposit:Em,updateDepositOptions:Sm,setDepositLoading:Ti,isOpen:_S,isLoading:Pm}),VS=e=>{const{t}=Nt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=jS(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function HS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),g=a(),N=i({address:u,abi:Or,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=N!=null&&N.isSuccess?N.data:void 0,P=v.useMemo(()=>{if(d)return!0;if(!N.isSuccess||x===void 0||x===0n)return!1;try{const M=B6(String(Number(s||"0")||0),Number(f));return x>=M}catch{return!1}},[d,N.isSuccess,x,s,f]),C=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!g||!u||!p)return;const L=Nn(u),F=Nn(p);if((x||0n)>0n){const E=await m({abi:Or,address:L,functionName:"approve",args:[F,0n]});await g.waitForTransactionReceipt({hash:E})}const y=await m({abi:Or,address:L,functionName:"approve",args:[F,pf]});await g.waitForTransactionReceipt({hash:y}),N!=null&&N.refetch&&await N.refetch()}catch(M){console.error("[useApprove] onApprove failed:",M)}},[r,n,u,p,x,N,m,g,h]);return{approve:P,onApprove:C}}const GS=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},qS=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",C="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(M=>{const L=M.tokenAddress;if(!L)return!1;const F=L.toLowerCase();return!(L===P||F===C)})},[r]),[c,a]=v.useState({}),l=v.useCallback((P,C)=>{a(M=>({...M,[P]:C}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(P=>v.createElement(GS,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const P=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},C=i.map(L=>{const F=c[Nn(L.tokenAddress)],b=F==null?void 0:F.balance,y=b==null?void 0:b.data;return{address:Nn(L.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||L.decimals}}).filter(L=>L.address),M=C.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:C,baseTokenBalance:P,combinedData:M}},[u,c,i]),m=v.useCallback(async()=>h,[h]),g=v.useMemo(()=>{const P=(u==null?void 0:u.isLoading)||!1,C=Object.values(c).some(M=>{var L;return(L=M.balance)==null?void 0:L.isLoading});return P||C},[u==null?void 0:u.isLoading,c]),N=v.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:N,multicallResult:h,validErcTokens:i,isLoading:g,queryComponents:d}},KS=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:c,wagmiHooks:a,onChainChange:l,onDeposit:u})=>{const{t:f}=Nt(),p=a.useAccount(),d=t.tokenList.find(Z=>Z.token===n||Z.symbol===n),h=t.chainId,m=v.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const J=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(J)?J!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[g,N]=v.useState(""),[x,P]=v.useState(()=>m?"fast":"standard");v.useEffect(()=>{N("")},[n,t.chainId]),v.useEffect(()=>{P(m?"fast":"standard")},[t.chainId,m]);const{multicallResult:C,queryComponents:M}=qS({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),L=v.useMemo(()=>{var J;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const Z=C.combinedData[d.tokenAddress];return((J=Z==null?void 0:Z.balance)==null?void 0:J.formatted)||"0"},[d,C]),F="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",y=v.useMemo(()=>{var Z,J;return v5({chain:S5,transport:E5(t.rpcUrl||((Z=window==null?void 0:window.ENV)==null?void 0:Z.CHAIN_RPC_URL_42161)||((J=window==null?void 0:window.ENV)==null?void 0:J.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),E="1000000000000",{formatted:T}=P5({client:y,tokenAddress:F,holder:b,decimals:6,fallbackFormatted:E,pollingInterval:12e3}),[I,$]=v.useState(!1),{approve:D,onApprove:w}=HS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:g,wagmiHooks:a}),O=v.useCallback(async()=>{if(!I)try{$(!0),await w()}catch(Z){console.error("Approve failed:",Z)}finally{$(!1)}},[I,w]),k=v.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),S=v.useCallback(async()=>{l&&l(h)},[l,h]);v.useEffect(()=>{k&&S()},[k,S]);const{showLayerZeroTip:B,layerZeroTipKey:j}=v.useMemo(()=>{const Z=+t.chainId==42161||+t.chainId==421614,J=(n==null?void 0:n.toUpperCase())==="USDT",ie=new Le(g||"0"),re=new Le("200000");let be=!1,Y;if(Z&&J&&g)if(ie.gte(re))be=!0,Y="deposit.layerZeroDepositTipGte200k";else{const fe=T;if(typeof fe=="string"&&fe.length>0){const Oe=new Le(fe);!Oe.isNaN()&&ie.gte(Oe)&&(be=!0,Y="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:be,layerZeroTipKey:Y}},[t.chainId,n,g,T]),U=v.useCallback(()=>US(+t.chainId,L||"0",n,r),[L,t==null?void 0:t.chainId,n,r]),_=v.useMemo(()=>r!=="spot"&&zS(+t.chainId,g,n),[r,t==null?void 0:t.chainId,g,n]),G=v.useMemo(()=>"deposit.maxDepositSplitTip",[]),Q=v.useMemo(()=>{const Z=Number((t==null?void 0:t.blockTime)??0),J=Number((t==null?void 0:t.txConfirm)??0);return!Number.isFinite(Z)||!Number.isFinite(J)?0:Z*J/60},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),q=m&&x==="standard",W=q?20:Q,ee=v.useMemo(()=>{const Z=d==null?void 0:d.depositFeeRate;if(Z==null)return"";const J=String(Z).trim();return J?`${J}%`:""},[d==null?void 0:d.depositFeeRate]),ve=m&&x==="fast"&&!!ee,K=VS({isNetworkMismatch:k,depositAmount:g,approved:D,currentTokenBalance:L,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),oe=Z=>{const J=Z.target.value,ie=U(),re=Pi(J,ie);if(re.isValid)N(re.formattedValue),re.errorType;else return re.errorType==="exceed_balance",void 0},se=v.useCallback(async()=>{Ti(!0);try{u&&u({amount:g,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(Z){console.error("Deposit error:",Z),Ti(!1)}},[u,g,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return A.jsxs(A.Fragment,{children:[M,m&&A.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:A.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[A.jsx("button",{type:"button",onClick:()=>P("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),A.jsx("button",{type:"button",onClick:()=>P("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:g,onChange:oe,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:()=>{const Z=U();N(Z)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:f("deposit.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:RS(L||"0",g,n)})]})]}),!D&&FS(g||"0",0)&&A.jsxs("div",{className:"flex justify-center flex-col items-center",children:[A.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),A.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),A.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:O,disabled:I,children:I?A.jsx(ns,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(j||"deposit.layerZeroDepositTip")})]}),A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(G)})]}),_&&A.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:!(_||B)&&A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),A.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),q?A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})}):A.jsx(En,{content:A.jsxs("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[A.jsx("p",{children:f("deposit.arrivaltimeTooltip1",{v:Q,v1:t==null?void 0:t.txConfirm})}),A.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:A.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})})})]}),ve&&A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),A.jsx(En,{content:f("deposit.feeRateTooltip"),placement:"top",children:A.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:ee})})]}),A.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[A.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),A.jsx("span",{className:"text-sm text-text-primary font-medium",children:g?A.jsxs("span",{className:"flex items-center gap-1",children:[jt(i),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),jt((parseFloat(i)+parseFloat(g)).toString())," ",n]}):`${jt(i)} ${n}`})]})]}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${K.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:se,disabled:K.disabled||c,children:[(c||k)&&A.jsx(ns,{size:"xs"}),K.text]})]})},Tm=e=>e.toLocaleUpperCase()===hn?hn:Us,rs=e=>Tm(e.wallet)===hn,Dl=e=>Tm(e.wallet)===Us,Ai=e=>e?e==="perp"?Re.PERPETUAL:e==="perp-v2"||e==="perp_v2"?Re.PERPETUALV2:e:"",Am="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7R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C2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Cm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:c,wagmiHooks:a,onDeposit:l,onCopy:u,onChainChange:f,onTokenChange:p})=>{const{t:d}=Nt(),h=v.useMemo(()=>r.map(K=>({...K,key:Ai(K.key)})),[r]),m=v.useMemo(()=>Ai(i),[i]),g=v.useMemo(()=>h.some(K=>K.key===Re.PERPETUALV2),[h]),N=v.useMemo(()=>{var oe;if(!h||h.length===0)return m;const K=h.find(se=>se.key===m);return(K==null?void 0:K.key)||((oe=h[0])==null?void 0:oe.key)||m},[h,m]),[x,P]=v.useState(N),C=v.useCallback(K=>{var oe;return((oe=h.find(se=>se.key===K))==null?void 0:oe.chains)||[]},[h]),M=C(N),L=()=>{var re;if(!M||M.length===0)return{chainId:o||1,token:""};const K=o||((re=M[0])==null?void 0:re.chainId),oe=M.find(be=>be.chainId===K)||M[0],se=(oe==null?void 0:oe.tokenList)||[],Z=(s||"").toUpperCase();if(Z&&se.length>0){const be=se.find(Y=>(Y.token||Y.symbol||"").toUpperCase()===Z);if(be)return{chainId:oe.chainId,token:be.token||be.symbol||""}}if(Z)for(const be of M){const fe=((be==null?void 0:be.tokenList)||[]).find(ge=>(ge.token||ge.symbol||"").toUpperCase()===Z);if(fe)return{chainId:be.chainId,token:fe.token||fe.symbol||""}}const J=se.length>0?oe:M.find(be=>(be.tokenList||[]).length>0)||oe,ie=((J==null?void 0:J.tokenList)||[])[0];return{chainId:(J==null?void 0:J.chainId)||oe.chainId||1,token:(ie==null?void 0:ie.token)||(ie==null?void 0:ie.symbol)||""}},[{chainId:F,token:b}]=v.useState(()=>L()),[y,E]=v.useState(F),T=v.useMemo(()=>h.find(K=>K.key===x)||h[0],[h,x]),I=v.useMemo(()=>(T==null?void 0:T.chains)||[],[T]),$=v.useMemo(()=>{var J,ie;if(!T||!Dl(T.account)||!(x===Re.SPOT||x===Re.PERPETUALV2))return!1;const se=!!((J=T.walletOptions)!=null&&J.evm),Z=!!((ie=T.walletOptions)!=null&&ie.mpc);return se&&Z},[T,x]),D=v.useCallback(()=>{var K,oe;return(K=T==null?void 0:T.walletOptions)!=null&&K.evm?"evm":(oe=T==null?void 0:T.walletOptions)!=null&&oe.mpc||T!=null&&T.account&&rs(T.account)?"mpc":"evm"},[T]),[w,O]=v.useState(()=>$?null:D());v.useEffect(()=>{O($?null:D())},[x,$,D]);const k=v.useMemo(()=>{if(!T)return;if(!$)return T.account;if(!w)return;const K=T.walletOptions;return w==="mpc"?(K==null?void 0:K.mpc)||T.account:(K==null?void 0:K.evm)||T.account},[T,w,$]),S=v.useMemo(()=>k&&rs(k)?hn:Us,[k]),B=I.find(K=>K.chainId===y)||I[0],[j,U]=v.useState(b),_=v.useCallback(K=>{E(K),f==null||f(K)},[f]),G=v.useCallback(K=>{U(K),p==null||p(K)},[p]),Q=v.useMemo(()=>{const K=(j||"").toLowerCase();if(!K)return"0";const oe=(c==null?void 0:c[x])||(x===Re.PERPETUAL?c==null?void 0:c.perp:void 0),se=oe==null?void 0:oe[K];return typeof se=="string"&&se.length>0?se:"0"},[c,x,j]),[q,W]=v.useState(!1),ee=K=>{K.target===K.currentTarget?W(!0):W(!1)},ve=K=>{q&&K.target===K.currentTarget&&n(),W(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:ee,onMouseUp:ve,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:K=>{K.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(Dh,{selectedAccount:x,options:h.map(K=>({value:K.key,label:K.key===Re.SPOT?d("account.spot"):K.key===Re.PERPETUAL?d(g?"account.perpetual-v1":"account.perp"):K.key===Re.PERPETUALV2?d("account.perpetual-v2"):K.key})),onAccountChange:K=>{var fe,ge;const oe=K||x;P(oe);const se=C(oe);if(!se||se.length===0)return;const Z=se.find(Oe=>Oe.chainId===y),J=Z?Z.chainId:se[0].chainId;E(J),f==null||f(J);const ie=se.find(Oe=>Oe.chainId===J),re=(ie==null?void 0:ie.tokenList)||[],Y=re.some(Oe=>(Oe.symbol||Oe.token)===j)?j:((fe=re[0])==null?void 0:fe.symbol)||((ge=re[0])==null?void 0:ge.token)||"";Y&&(U(Y),p==null||p(Y))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:B,chainList:I,onChainChange:_,curSelectToken:j,onTokenChange:G,walletType:S,accountType:x}),$&&!w&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>O("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:d("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>O("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.externalWalletDesc")})]})})]}),(!$||w)&&A.jsxs(A.Fragment,{children:[k&&rs(k)&&A.jsx(LS,{address:k.smartWalletAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,onDeposit:l,onCopy:u,onClose:n}),k&&Dl(k)&&A.jsx(KS,{address:k.ethAddress,currentActiveChain:B,selectedToken:j,accountType:x,accountId:k.accountId,accountKey:T==null?void 0:T.key,platformBalance:Q,isLoading:t,wagmiHooks:a,onChainChange:_,onDeposit:l,onClose:n})]})]})})})}),document.body):null},ZS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=Nt(),h=v.useMemo(()=>{if(a==="spot"||!xn(r==null?void 0:r.chainId)){const L=new Le(e||"0").minus(s||"0");if(L.isNegative()||L.isZero())return"0";const F=Math.min(L.decimalPlaces()??0,18);return L.decimalPlaces(F,Le.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),m=v.useMemo(()=>o||"0",[o]),g=v.useMemo(()=>{const L=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Le(L||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),N=v.useMemo(()=>g==="0",[g]),x=v.useMemo(()=>{const L=(t||"").toUpperCase();return L==="USDT"||L==="USDC"},[t]),P=L=>{const F=L.target.value,y=Pi(F,m||"0");if(y.isValid)l(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},C=()=>{const L=m||"0",b=Pi(L,L).formattedValue;l(b),f==null||f(b)},M=()=>{const L=parseFloat(o||"0"),F=parseFloat(e||"0");if(F>0){const b=L-F,y=jt(Math.max(0,b).toString());return A.jsxs("span",{className:"flex items-center gap-1",children:[jt(o||"0"),A.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${jt(o||"0")} ${t}`};return A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[A.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[A.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),A.jsx("button",{onClick:C,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),A.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),A.jsxs("div",{className:"flex justify-between items-center",children:[A.jsx(En,{content:d("withdraw.availableDesc"),children:A.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),A.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:M()})]})]}),i==="mpc"&&(a==="spot"||!xn(r==null?void 0:r.chainId))?A.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:A.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:L=>u==null?void 0:u(L.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,A.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:xn(r==null?void 0:r.chainId)?A.jsxs(A.Fragment,{children:[A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),A.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):A.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&A.jsxs("div",{className:"flex mb-4",children:[A.jsx("div",{className:"w-5",children:A.jsx("img",{src:ts,className:"w-4 h-4",alt:"Warning"})}),A.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),A.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[A.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[A.jsx(En,{content:A.jsxs("div",{children:[A.jsx("div",{children:d("withdraw.speedNote")}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.FAST,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.Medium,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),A.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[A.jsx(Jo,{selectedLevel:Rt.SLOW,maxLevel:3}),A.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),A.jsx("div",{className:"flex items-center",children:A.jsx(Jo,{selectedLevel:xn(r==null?void 0:r.chainId)?Rt.SLOW:Rt.FAST,maxLevel:3})})]}),(a==="spot"||!xn(r==null?void 0:r.chainId))&&A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N||!x?A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:N?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):A.jsx(En,{className:"w-[320px] font-normal flex items-center justify-center",content:A.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:A.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!N&&` / ${g}%`]})]}),A.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(xn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),A.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[jt(h)," ",t]})]})]})]})};let ot=null;const Bl={accountChains:[],defaultAccountType:""},Om=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(Bl),a=v.useCallback(h=>{c(h||Bl),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(ot={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{ot=null}),[a,u,l,f,p,d]),n?A.jsx(Dm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Om.displayName="WithdrawManager";const Im=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.openWithdraw(e||Bl)},$m=()=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.closeWithdraw()},km=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.updateWithdrawOptions(e)},Ni=e=>{if(!ot){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}ot.setWithdrawLoading(e)},YS=()=>ot?ot.isOpen():!1,Mm=()=>ot?ot.isLoading():!1,XS=()=>({openWithdraw:Im,closeWithdraw:$m,updateWithdrawOptions:km,setWithdrawLoading:Ni,isOpen:YS,isLoading:Mm}),JS=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:c,fee:a="0.00",isLoading:l=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:m})=>{var be;const{t:g}=Nt(),N=v.useMemo(()=>e.map(Y=>({...Y,key:Ai(Y.key)})),[e]),x=v.useMemo(()=>Ai(o),[o]),P=v.useMemo(()=>N.some(Y=>Y.key===Re.PERPETUALV2),[N]),C=v.useMemo(()=>{var fe;if(!N||N.length===0)return x;const Y=N.find(ge=>ge.key===x);return(Y==null?void 0:Y.key)||((fe=N[0])==null?void 0:fe.key)||x},[N,x]),[M,L]=v.useState(C),F=v.useCallback(Y=>{var fe;return((fe=N.find(ge=>ge.key===Y))==null?void 0:fe.chains)||[]},[N]),b=v.useMemo(()=>N.find(Y=>Y.key===M)||N[0],[N,M]),y=v.useMemo(()=>(b==null?void 0:b.chains)||[],[b]),E=v.useMemo(()=>{var en,Ne;if(!b||!Dl(b.account)||!(M===Re.SPOT||M===Re.PERPETUALV2))return!1;const ge=!!((en=b.walletOptions)!=null&&en.evm),Oe=!!((Ne=b.walletOptions)!=null&&Ne.mpc);return ge&&Oe},[b,M]),T=v.useCallback(()=>{var Y,fe;return(Y=b==null?void 0:b.walletOptions)!=null&&Y.evm?"evm":(fe=b==null?void 0:b.walletOptions)!=null&&fe.mpc||b!=null&&b.account&&rs(b.account)?"mpc":"evm"},[b]),[I,$]=v.useState(()=>E?null:T());v.useEffect(()=>{$(E?null:T())},[M,E,T]);const D=v.useMemo(()=>{if(!b)return;if(!E)return b.account;if(!I)return;const Y=b.walletOptions;return I==="mpc"?(Y==null?void 0:Y.mpc)||b.account:(Y==null?void 0:Y.evm)||b.account},[b,E,I]),w=v.useMemo(()=>D&&rs(D)?"mpc":"evm",[D]),O=w==="mpc"?hn:Us,k=v.useMemo(()=>{if(!y||y.length===0)return{chainId:1,tokenSymbol:""};const Y=Ne=>{const je=Ne||[];if(!je.length)return"";const He="USDC".toUpperCase(),zn=je.find(Ut=>(Ut.token||Ut.symbol||"").toUpperCase()===He)||je[0];return zn.token||zn.symbol||""};if(n){const Ne=n==null?void 0:n.toUpperCase();for(const je of y){const lr=je.tokenList||[];let He;if(Ne&&(He=lr.find(zt=>(zt.token||zt.symbol||"").toUpperCase()===Ne)),He){const zt=He.token||He.symbol||n||"";return{chainId:je.chainId,tokenSymbol:zt}}}}if(t){const Ne=y.find(He=>He.chainId===t)||y[0],je=Ne.tokenList||[],lr=Y(je);return{chainId:Ne.chainId,tokenSymbol:lr}}const fe="USDC",ge=Ne=>Array.isArray(Ne.tokenList)&&Ne.tokenList.some(je=>(je.token||je.symbol||"").toUpperCase()===fe),Oe=y.find(ge)||y[0];if(!Oe)return{chainId:1,tokenSymbol:""};const en=Y(Oe.tokenList);return{chainId:Oe.chainId,tokenSymbol:en}},[y,t,n]),[S,B]=v.useState(()=>k.chainId),[j,U]=v.useState(()=>k.tokenSymbol),[_,G]=v.useState(r),[Q,q]=v.useState(""),W=v.useCallback(Y=>{B(Y),p==null||p(Y)},[p]),ee=v.useCallback(Y=>{U(Y),d==null||d(Y)},[d]),ve=v.useRef(!0),K=v.useRef(j),oe=v.useRef(S);v.useEffect(()=>{if(ve.current){ve.current=!1,K.current=j,oe.current=S;return}(K.current!==j||oe.current!==S)&&(G(""),K.current=j,oe.current=S)},[j,S]);const se=y&&y.length>0?y.find(Y=>Y.chainId===S)||y[0]:null,Z=(be=se==null?void 0:se.tokenList)==null?void 0:be.find(Y=>Y.token===j),J=v.useMemo(()=>{const Y=new Le(_||"0"),fe=new Le(a||"0"),ge=xn(S);return Z!=null&&Z.minWithdrawSize&&Y.lt(Z.minWithdrawSize)?{text:g("withdraw.minWithdrawParsed",{amount:Z.minWithdrawSize,token:Z.symbol||Z.token}),disabled:!0}:!_||Y.isZero()||!ge&&Y.isLessThan(fe)?{text:g("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&(!ge||M==="spot")&&!Q.trim()?{text:g("withdraw.invalidReceiverAddress"),disabled:!0}:{text:g("withdraw.confirmWithdraw"),disabled:!1}},[g,S,_,w,Q,a,M,Z]),ie=v.useMemo(()=>{const Y=(j||"").toLowerCase();if(!Y)return i||"0";const fe=(c==null?void 0:c[M])||(M===Re.PERPETUAL?c==null?void 0:c.perp:void 0),ge=fe==null?void 0:fe[Y];return typeof ge=="string"&&ge.length>0?ge:i||"0"},[c,M,j,i]),re=v.useCallback(async()=>{Ni(!0);try{if(u){const fe={amount:new Le(_||"0").toString(),chainId:S,tokenAddress:(Z==null?void 0:Z.tokenAddress)||"",coinId:(Z==null?void 0:Z.coinId)||"",tokenSymbol:j,accountType:M,selectedToken:Z};w==="mpc"&&(!xn(S)||M==="spot")&&(fe.receiverAddress=Q),u(fe)}}catch{Ni(!1)}},[u,M,Z,_,S,j,w,Q]);return!y||y.length===0?A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"No chains available"})}):se?A.jsxs(A.Fragment,{children:[A.jsx(Dh,{selectedAccount:M,options:N.map(Y=>({value:Y.key,label:Y.key===Re.SPOT?g("account.spot"):Y.key===Re.PERPETUAL?g(P?"account.perpetual-v1":"account.perp"):Y.key===Re.PERPETUALV2?g("account.perpetual-v2"):Y.key})),onAccountChange:Y=>{var zt,zn;const fe=Y||M;L(fe),m==null||m(fe);const ge=F(fe);if(!ge||ge.length===0)return;const Oe=ge.find(Ut=>Ut.chainId===S),en=Oe?Oe.chainId:ge[0].chainId;B(en),p==null||p(en);const Ne=ge.find(Ut=>Ut.chainId===en),je=(Ne==null?void 0:Ne.tokenList)||[],He=je.some(Ut=>(Ut.symbol||Ut.token)===j)?j:((zt=je[0])==null?void 0:zt.symbol)||((zn=je[0])==null?void 0:zn.token)||"";He&&(U(He),d==null||d(He))},className:"w-full"}),A.jsx(Mh,{currentActiveChain:se,chainList:y,onChainChange:W,curSelectToken:j,onTokenChange:ee,walletType:O,txType:"withdraw"}),E&&!I&&A.jsxs("div",{className:"mb-4",children:[A.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),A.jsx("button",{type:"button",onClick:()=>$("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.connectedWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Am,className:"w-12 h-5",alt:"EVM"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.connectedWalletDesc")})]})}),A.jsxs("div",{className:"flex items-center my-2",children:[A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),A.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:g("deposit.or")}),A.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),A.jsx("button",{type:"button",onClick:()=>$("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:A.jsxs("div",{className:"flex flex-col gap-2",children:[A.jsxs("div",{className:"flex items-center justify-between gap-3",children:[A.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:g("withdraw.externalWalletTitle")}),A.jsx("div",{className:"flex items-center gap-1 shrink-0",children:A.jsx("img",{src:Nm,className:"w-12 h-5",alt:"MPC"})})]}),A.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:g("withdraw.externalWalletDesc")})]})})]}),(!E||I)&&A.jsxs(A.Fragment,{children:[A.jsx(ZS,{withdrawAmount:_,curSelectToken:j,tokenInfo:Z,curSelectTokenData:{balance:Z==null?void 0:Z.balance,allowance:Z==null?void 0:Z.allowance},currentActiveChain:se,currentEquity:s||0,decimals:(Z==null?void 0:Z.decimals)||6,platformBalance:ie,fee:a,walletType:w,accountType:M,receiverAddress:Q,onWithdrawAmountChange:G,onReceiverAddressChange:q,onAmountChanged:h}),A.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${J.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:re,disabled:J.disabled||l,children:[l&&A.jsx(ns,{size:"xs"}),J.text]})]})]}):A.jsx("div",{className:"text-center py-8",children:A.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Dm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a="",currentEquity:l=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})=>{const{t:P}=Nt(),[C,M]=v.useState(!1),L=b=>{b.target===b.currentTarget?M(!0):M(!1)},F=b=>{C&&b.target===b.currentTarget&&r(),M(!1)};return e?qe.createPortal(A.jsx("div",{className:"edgex-components",children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:A.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:L,onMouseUp:F,"aria-hidden":"true",children:A.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[A.jsxs("div",{className:"flex items-center justify-between mb-4",children:[A.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),A.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:A.jsx(x0,{className:"h-4 w-4"})})]}),A.jsx(JS,{accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a,defaultAccountType:n,currentEquity:l,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:g,onAmountChanged:N,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=ns,le.ComponentProvider=ib,le.DEFAULT_LOCALE=ss,le.Deposit=Cm,le.DepositManager=wm,le.LOCALE_NAMES=rb,le.LoadingSpinner=ns,le.SUPPORTED_LOCALES=Oi,le.Tooltip=En,le.Withdraw=Dm,le.WithdrawManager=Om,le.closeDeposit=Em,le.closeWithdraw=$m,le.formatThousands=cb,le.isDepositLoading=Pm,le.isWithdrawLoading=Mm,le.openDeposit=xm,le.openWithdraw=Im,le.setDepositLoading=Ti,le.setWithdrawLoading=Ni,le.updateDepositOptions=Sm,le.updateWithdrawOptions=km,le.useComponentConfig=ql,le.useDeposit=T5,le.useDepositManager=WS,le.useTranslation=Nt,le.useWithdraw=A5,le.useWithdrawManager=XS,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
187
187
  //# sourceMappingURL=index.umd.js.map