@edgex-web/components 0.2.0-beta.17 → 0.2.0-beta.19

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-Bs_1Js5W.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-BBxsNXOK.mjs";
2
2
  import "react";
3
3
  export {
4
4
  e as ChromeLoader,
package/dist/index.umd.js CHANGED
@@ -35,7 +35,9 @@ React keys must be passed directly to JSX without using spread:
35
35
  入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
36
36
  クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},Um={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
37
37
  Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
38
- За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},zm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
38
+ За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
39
+
40
+ Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},zm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
39
41
  充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
40
42
  跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},bi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],ku={"en-US":jm,"ja-JP":_m,"ru-RU":Um,"zh-CN":Rm,"zh-TW":zm},qo="en-US",Hm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},Wm=e=>bi.includes(e)?ku[e]:ku[qo],Vm=e=>bi.includes(e),Bu=x.createContext(null),Gm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||qo,o=Vm(r)?r:qo,s=Wm(o);return{...e,currentLocale:o,translations:s}},[e]);return k.jsx(Bu.Provider,{value:n,children:t})},Lu=()=>{const e=x.useContext(Bu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var qm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,gi=Math.ceil,ot=Math.floor,_e="[BigNumber Error] ",Fu=_e+"Number primitive has more than 15 significant digits: ",wt=1e14,ne=14,yi=9007199254740991,wi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],fn=1e7,Oe=1e9;function Du(e){var t,n,r,o=E.prototype={constructor:E,toString:null,valueOf:null},s=new E(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function E(b,g){var v,C,O,I,M,y,T,A,S=this;if(!(S instanceof E))return new E(b,g);if(g==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<l?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(I=0,M=b;M>=10;M/=10,I++);I>f?S.c=S.e=null:(S.e=I,S.c=[b]);return}A=String(b)}else{if(!qm.test(A=String(b)))return r(S,A,y);S.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(I=A.indexOf("."))>-1&&(A=A.replace(".","")),(M=A.search(/e/i))>0?(I<0&&(I=M),I+=+A.slice(M+1),A=A.substring(0,M)):I<0&&(I=A.length)}else{if(ye(g,2,w.length,"Base"),g==10&&$)return S=new E(b),F(S,i+S.e+1,c);if(A=String(b),y=typeof b=="number"){if(b*0!=0)return r(S,A,y,g);if(S.s=1/b<0?(A=A.slice(1),-1):1,E.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(Fu+b)}else S.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(v=w.slice(0,g),I=M=0,T=A.length;M<T;M++)if(v.indexOf(C=A.charAt(M))<0){if(C=="."){if(M>I){I=T;continue}}else if(!O&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){O=!0,M=-1,I=0;continue}return r(S,String(b),y,g)}y=!1,A=n(A,g,10,S.s),(I=A.indexOf("."))>-1?A=A.replace(".",""):I=A.length}for(M=0;A.charCodeAt(M)===48;M++);for(T=A.length;A.charCodeAt(--T)===48;);if(A=A.slice(M,++T)){if(T-=M,y&&E.DEBUG&&T>15&&(b>yi||b!==ot(b)))throw Error(Fu+S.s*b);if((I=I-M-1)>f)S.c=S.e=null;else if(I<l)S.c=[S.e=0];else{if(S.e=I,S.c=[],M=(I+1)%ne,I<0&&(M+=ne),M<T){for(M&&S.c.push(+A.slice(0,M)),T-=ne;M<T;)S.c.push(+A.slice(M,M+=ne));M=ne-(A=A.slice(M)).length}else M-=T;for(;M--;A+="0");S.c.push(+A)}}else S.c=[S.e=0]}E.clone=Du,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(b){var g,v;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(g="DECIMAL_PLACES")&&(v=b[g],ye(v,0,Oe,g),i=v),b.hasOwnProperty(g="ROUNDING_MODE")&&(v=b[g],ye(v,0,8,g),c=v),b.hasOwnProperty(g="EXPONENTIAL_AT")&&(v=b[g],v&&v.pop?(ye(v[0],-Oe,0,g),ye(v[1],0,Oe,g),a=v[0],u=v[1]):(ye(v,-Oe,Oe,g),a=-(u=v<0?-v:v))),b.hasOwnProperty(g="RANGE"))if(v=b[g],v&&v.pop)ye(v[0],-Oe,-1,g),ye(v[1],1,Oe,g),l=v[0],f=v[1];else if(ye(v,-Oe,Oe,g),v)l=-(f=v<0?-v:v);else throw Error(_e+g+" cannot be zero: "+v);if(b.hasOwnProperty(g="CRYPTO"))if(v=b[g],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=v;else throw p=!v,Error(_e+"crypto unavailable");else p=v;else throw Error(_e+g+" not true or false: "+v);if(b.hasOwnProperty(g="MODULO_MODE")&&(v=b[g],ye(v,0,9,g),d=v),b.hasOwnProperty(g="POW_PRECISION")&&(v=b[g],ye(v,0,Oe,g),h=v),b.hasOwnProperty(g="FORMAT"))if(v=b[g],typeof v=="object")m=v;else throw Error(_e+g+" not an object: "+v);if(b.hasOwnProperty(g="ALPHABET"))if(v=b[g],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))$=v.slice(0,10)=="0123456789",w=v;else throw Error(_e+g+" invalid: "+v)}else throw Error(_e+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:w}},E.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var g,v,C=b.c,O=b.e,I=b.s;e:if({}.toString.call(C)=="[object Array]"){if((I===1||I===-1)&&O>=-Oe&&O<=Oe&&O===ot(O)){if(C[0]===0){if(O===0&&C.length===1)return!0;break e}if(g=(O+1)%ne,g<1&&(g+=ne),String(C[0]).length==g){for(g=0;g<C.length;g++)if(v=C[g],v<0||v>=wt||v!==ot(v))break e;if(v!==0)return!0}}}else if(C===null&&O===null&&(I===null||I===1||I===-1))return!0;throw Error(_e+"Invalid BigNumber: "+b)},E.maximum=E.max=function(){return N(arguments,-1)},E.minimum=E.min=function(){return N(arguments,1)},E.random=function(){var b=9007199254740992,g=Math.random()*b&2097151?function(){return ot(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,O,I,M,y,T=0,A=[],S=new E(s);if(v==null?v=i:ye(v,0,Oe),M=gi(v/ne),p)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(M*=2));T<M;)y=C[T]*131072+(C[T+1]>>>11),y>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),C[T]=O[0],C[T+1]=O[1]):(A.push(y%1e14),T+=2);T=M/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(M*=7);T<M;)y=(C[T]&31)*281474976710656+C[T+1]*1099511627776+C[T+2]*4294967296+C[T+3]*16777216+(C[T+4]<<16)+(C[T+5]<<8)+C[T+6],y>=9e15?crypto.randomBytes(7).copy(C,T):(A.push(y%1e14),T+=7);T=M/7}else throw p=!1,Error(_e+"crypto unavailable");if(!p)for(;T<M;)y=g(),y<9e15&&(A[T++]=y%1e14);for(M=A[--T],v%=ne,M&&v&&(y=wi[ne-v],A[T]=ot(M/y)*y);A[T]===0;A.pop(),T--);if(T<0)A=[I=0];else{for(I=-1;A[0]===0;A.splice(0,1),I-=ne);for(T=1,y=A[0];y>=10;y/=10,T++);T<ne&&(I-=ne-T)}return S.e=I,S.c=A,S}}(),E.sum=function(){for(var b=1,g=arguments,v=new E(g[0]);b<g.length;)v=v.plus(g[b++]);return v},n=function(){var b="0123456789";function g(v,C,O,I){for(var M,y=[0],T,A=0,S=v.length;A<S;){for(T=y.length;T--;y[T]*=C);for(y[0]+=I.indexOf(v.charAt(A++)),M=0;M<y.length;M++)y[M]>O-1&&(y[M+1]==null&&(y[M+1]=0),y[M+1]+=y[M]/O|0,y[M]%=O)}return y.reverse()}return function(v,C,O,I,M){var y,T,A,S,L,j,z,_,W=v.indexOf("."),K=i,G=c;for(W>=0&&(S=h,h=0,v=v.replace(".",""),_=new E(C),j=_.pow(v.length-W),h=S,_.c=g(Vt(it(j.c),j.e,"0"),10,O,b),_.e=_.c.length),z=g(v,C,O,M?(y=w,b):(y=b,w)),A=S=z.length;z[--S]==0;z.pop());if(!z[0])return y.charAt(0);if(W<0?--A:(j.c=z,j.e=A,j.s=I,j=t(j,_,K,G,O),z=j.c,L=j.r,A=j.e),T=A+K+1,W=z[T],S=O/2,L=L||T<0||z[T+1]!=null,L=G<4?(W!=null||L)&&(G==0||G==(j.s<0?3:2)):W>S||W==S&&(G==4||L||G==6&&z[T-1]&1||G==(j.s<0?8:7)),T<1||!z[0])v=L?Vt(y.charAt(1),-K,y.charAt(0)):y.charAt(0);else{if(z.length=T,L)for(--O;++z[--T]>O;)z[T]=0,T||(++A,z=[1].concat(z));for(S=z.length;!z[--S];);for(W=0,v="";W<=S;v+=y.charAt(z[W++]));v=Vt(v,A,y.charAt(0))}return v}}(),t=function(){function b(C,O,I){var M,y,T,A,S=0,L=C.length,j=O%fn,z=O/fn|0;for(C=C.slice();L--;)T=C[L]%fn,A=C[L]/fn|0,M=z*T+A*j,y=j*T+M%fn*fn+S,S=(y/I|0)+(M/fn|0)+z*A,C[L]=y%I;return S&&(C=[S].concat(C)),C}function g(C,O,I,M){var y,T;if(I!=M)T=I>M?1:-1;else for(y=T=0;y<I;y++)if(C[y]!=O[y]){T=C[y]>O[y]?1:-1;break}return T}function v(C,O,I,M){for(var y=0;I--;)C[I]-=y,y=C[I]<O[I]?1:0,C[I]=y*M+C[I]-O[I];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,O,I,M,y){var T,A,S,L,j,z,_,W,K,G,H,Z,J,oe,me,ge,de,se=C.s==O.s?1:-1,pe=C.c,ee=O.c;if(!pe||!pe[0]||!ee||!ee[0])return new E(!C.s||!O.s||(pe?ee&&pe[0]==ee[0]:!ee)?NaN:pe&&pe[0]==0||!ee?se*0:se/0);for(W=new E(se),K=W.c=[],A=C.e-O.e,se=I+A+1,y||(y=wt,A=st(C.e/ne)-st(O.e/ne),se=se/ne|0),S=0;ee[S]==(pe[S]||0);S++);if(ee[S]>(pe[S]||0)&&A--,se<0)K.push(1),L=!0;else{for(oe=pe.length,ge=ee.length,S=0,se+=2,j=ot(y/(ee[0]+1)),j>1&&(ee=b(ee,j,y),pe=b(pe,j,y),ge=ee.length,oe=pe.length),J=ge,G=pe.slice(0,ge),H=G.length;H<ge;G[H++]=0);de=ee.slice(),de=[0].concat(de),me=ee[0],ee[1]>=y/2&&me++;do{if(j=0,T=g(ee,G,ge,H),T<0){if(Z=G[0],ge!=H&&(Z=Z*y+(G[1]||0)),j=ot(Z/me),j>1)for(j>=y&&(j=y-1),z=b(ee,j,y),_=z.length,H=G.length;g(z,G,_,H)==1;)j--,v(z,ge<_?de:ee,_,y),_=z.length,T=1;else j==0&&(T=j=1),z=ee.slice(),_=z.length;if(_<H&&(z=[0].concat(z)),v(G,z,H,y),H=G.length,T==-1)for(;g(ee,G,ge,H)<1;)j++,v(G,ge<H?de:ee,H,y),H=G.length}else T===0&&(j++,G=[0]);K[S++]=j,G[0]?G[H++]=pe[J]||0:(G=[pe[J]],H=1)}while((J++<oe||G[0]!=null)&&se--);L=G[0]!=null,K[0]||K.splice(0,1)}if(y==wt){for(S=1,se=K[0];se>=10;se/=10,S++);F(W,I+(W.e=S+A*ne-1)+1,M,L)}else W.e=A,W.r=+L;return W}}();function P(b,g,v,C){var O,I,M,y,T;if(v==null?v=c:ye(v,0,8),!b.c)return b.toString();if(O=b.c[0],M=b.e,g==null)T=it(b.c),T=C==1||C==2&&(M<=a||M>=u)?Yo(T,M):Vt(T,M,"0");else if(b=F(new E(b),g,v),I=b.e,T=it(b.c),y=T.length,C==1||C==2&&(g<=I||I<=a)){for(;y<g;T+="0",y++);T=Yo(T,I)}else if(g-=M+(C===2&&I>M),T=Vt(T,I,"0"),I+1>y){if(--g>0)for(T+=".";g--;T+="0");}else if(g+=I-y,g>0)for(I+1==y&&(T+=".");g--;T+="0");return b.s<0&&O?"-"+T:T}function N(b,g){for(var v,C,O=1,I=new E(b[0]);O<b.length;O++)C=new E(b[O]),(!C.s||(v=Nn(I,C))===g||v===0&&I.s===g)&&(I=C);return I}function B(b,g,v){for(var C=1,O=g.length;!g[--O];g.pop());for(O=g[0];O>=10;O/=10,C++);return(v=C+v*ne-1)>f?b.c=b.e=null:v<l?b.c=[b.e=0]:(b.e=v,b.c=g),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,M,y,T){var A,S=y?M:M.replace(O,"");if(C.test(S))I.s=isNaN(S)?null:S<0?-1:1;else{if(!y&&(S=S.replace(b,function(L,j,z){return A=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!T||T==A?j:L}),T&&(A=T,S=S.replace(g,"$1").replace(v,"0.$1")),M!=S))return new E(S,A);if(E.DEBUG)throw Error(_e+"Not a"+(T?" base "+T:"")+" number: "+M);I.s=null}I.c=I.e=null}}();function F(b,g,v,C){var O,I,M,y,T,A,S,L=b.c,j=wi;if(L){e:{for(O=1,y=L[0];y>=10;y/=10,O++);if(I=g-O,I<0)I+=ne,M=g,T=L[A=0],S=ot(T/j[O-M-1]%10);else if(A=gi((I+1)/ne),A>=L.length)if(C){for(;L.length<=A;L.push(0));T=S=0,O=1,I%=ne,M=I-ne+1}else break e;else{for(T=y=L[A],O=1;y>=10;y/=10,O++);I%=ne,M=I-ne+O,S=M<0?0:ot(T/j[O-M-1]%10)}if(C=C||g<0||L[A+1]!=null||(M<0?T:T%j[O-M-1]),C=v<4?(S||C)&&(v==0||v==(b.s<0?3:2)):S>5||S==5&&(v==4||C||v==6&&(I>0?M>0?T/j[O-M]:0:L[A-1])%10&1||v==(b.s<0?8:7)),g<1||!L[0])return L.length=0,C?(g-=b.e+1,L[0]=j[(ne-g%ne)%ne],b.e=-g||0):L[0]=b.e=0,b;if(I==0?(L.length=A,y=1,A--):(L.length=A+1,y=j[ne-I],L[A]=M>0?ot(T/j[O-M]%j[M])*y:0),C)for(;;)if(A==0){for(I=1,M=L[0];M>=10;M/=10,I++);for(M=L[0]+=y,y=1;M>=10;M/=10,y++);I!=y&&(b.e++,L[0]==wt&&(L[0]=1));break}else{if(L[A]+=y,L[A]!=wt)break;L[A--]=0,y=1}for(I=L.length;L[--I]===0;L.pop());}b.e>f?b.c=b.e=null:b.e<l&&(b.c=[b.e=0])}return b}function D(b){var g,v=b.e;return v===null?b.toString():(g=it(b.c),g=v<=a||v>=u?Yo(g,v):Vt(g,v,"0"),b.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var b=new E(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,g){return Nn(this,new E(b,g))},o.decimalPlaces=o.dp=function(b,g){var v,C,O,I=this;if(b!=null)return ye(b,0,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b+I.e+1,g);if(!(v=I.c))return null;if(C=((O=v.length-1)-st(this.e/ne))*ne,O=v[O])for(;O%10==0;O/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(b,g){return t(this,new E(b,g),i,c)},o.dividedToIntegerBy=o.idiv=function(b,g){return t(this,new E(b,g),0,1)},o.exponentiatedBy=o.pow=function(b,g){var v,C,O,I,M,y,T,A,S,L=this;if(b=new E(b),b.c&&!b.isInteger())throw Error(_e+"Exponent not an integer: "+D(b));if(g!=null&&(g=new E(g)),y=b.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!b.c||!b.c[0])return S=new E(Math.pow(+D(L),y?b.s*(2-Zo(b)):+D(b))),g?S.mod(g):S;if(T=b.s<0,g){if(g.c?!g.c[0]:!g.s)return new E(NaN);C=!T&&L.isInteger()&&g.isInteger(),C&&(L=L.mod(g))}else{if(b.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return I=L.s<0&&Zo(b)?-0:0,L.e>-1&&(I=1/I),new E(T?1/I:I);h&&(I=gi(h/ne+2))}for(y?(v=new E(.5),T&&(b.s=1),A=Zo(b)):(O=Math.abs(+D(b)),A=O%2),S=new E(s);;){if(A){if(S=S.times(L),!S.c)break;I?S.c.length>I&&(S.c.length=I):C&&(S=S.mod(g))}if(O){if(O=ot(O/2),O===0)break;A=O%2}else if(b=b.times(v),F(b,b.e+1,1),b.e>14)A=Zo(b);else{if(O=+D(b),O===0)break;A=O%2}L=L.times(L),I?L.c&&L.c.length>I&&(L.c.length=I):C&&(L=L.mod(g))}return C?S:(T&&(S=s.div(S)),g?S.mod(g):I?F(S,h,c,M):S)},o.integerValue=function(b){var g=new E(this);return b==null?b=c:ye(b,0,8),F(g,g.e+1,b)},o.isEqualTo=o.eq=function(b,g){return Nn(this,new E(b,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,g){return Nn(this,new E(b,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,g){return(g=Nn(this,new E(b,g)))===1||g===0},o.isInteger=function(){return!!this.c&&st(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(b,g){return Nn(this,new E(b,g))<0},o.isLessThanOrEqualTo=o.lte=function(b,g){return(g=Nn(this,new E(b,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,g){var v,C,O,I,M=this,y=M.s;if(b=new E(b,g),g=b.s,!y||!g)return new E(NaN);if(y!=g)return b.s=-g,M.plus(b);var T=M.e/ne,A=b.e/ne,S=M.c,L=b.c;if(!T||!A){if(!S||!L)return S?(b.s=-g,b):new E(L?M:NaN);if(!S[0]||!L[0])return L[0]?(b.s=-g,b):new E(S[0]?M:c==3?-0:0)}if(T=st(T),A=st(A),S=S.slice(),y=T-A){for((I=y<0)?(y=-y,O=S):(A=T,O=L),O.reverse(),g=y;g--;O.push(0));O.reverse()}else for(C=(I=(y=S.length)<(g=L.length))?y:g,y=g=0;g<C;g++)if(S[g]!=L[g]){I=S[g]<L[g];break}if(I&&(O=S,S=L,L=O,b.s=-b.s),g=(C=L.length)-(v=S.length),g>0)for(;g--;S[v++]=0);for(g=wt-1;C>y;){if(S[--C]<L[C]){for(v=C;v&&!S[--v];S[v]=g);--S[v],S[C]+=wt}S[C]-=L[C]}for(;S[0]==0;S.splice(0,1),--A);return S[0]?B(b,S,A):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,g){var v,C,O=this;return b=new E(b,g),!O.c||!b.s||b.c&&!b.c[0]?new E(NaN):!b.c||O.c&&!O.c[0]?new E(O):(d==9?(C=b.s,b.s=1,v=t(O,b,0,3),b.s=C,v.s*=C):v=t(O,b,0,d),b=O.minus(v.times(b)),!b.c[0]&&d==1&&(b.s=O.s),b)},o.multipliedBy=o.times=function(b,g){var v,C,O,I,M,y,T,A,S,L,j,z,_,W,K,G=this,H=G.c,Z=(b=new E(b,g)).c;if(!H||!Z||!H[0]||!Z[0])return!G.s||!b.s||H&&!H[0]&&!Z||Z&&!Z[0]&&!H?b.c=b.e=b.s=null:(b.s*=G.s,!H||!Z?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(C=st(G.e/ne)+st(b.e/ne),b.s*=G.s,T=H.length,L=Z.length,T<L&&(_=H,H=Z,Z=_,O=T,T=L,L=O),O=T+L,_=[];O--;_.push(0));for(W=wt,K=fn,O=L;--O>=0;){for(v=0,j=Z[O]%K,z=Z[O]/K|0,M=T,I=O+M;I>O;)A=H[--M]%K,S=H[M]/K|0,y=z*A+S*j,A=j*A+y%K*K+_[I]+v,v=(A/W|0)+(y/K|0)+z*S,_[I--]=A%W;_[I]=v}return v?++C:_.splice(0,1),B(b,_,C)},o.negated=function(){var b=new E(this);return b.s=-b.s||null,b},o.plus=function(b,g){var v,C=this,O=C.s;if(b=new E(b,g),g=b.s,!O||!g)return new E(NaN);if(O!=g)return b.s=-g,C.minus(b);var I=C.e/ne,M=b.e/ne,y=C.c,T=b.c;if(!I||!M){if(!y||!T)return new E(O/0);if(!y[0]||!T[0])return T[0]?b:new E(y[0]?C:O*0)}if(I=st(I),M=st(M),y=y.slice(),O=I-M){for(O>0?(M=I,v=T):(O=-O,v=y),v.reverse();O--;v.push(0));v.reverse()}for(O=y.length,g=T.length,O-g<0&&(v=T,T=y,y=v,g=O),O=0;g;)O=(y[--g]=y[g]+T[g]+O)/wt|0,y[g]=wt===y[g]?0:y[g]%wt;return O&&(y=[O].concat(y),++M),B(b,y,M)},o.precision=o.sd=function(b,g){var v,C,O,I=this;if(b!=null&&b!==!!b)return ye(b,1,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b,g);if(!(v=I.c))return null;if(O=v.length-1,C=O*ne+1,O=v[O]){for(;O%10==0;O/=10,C--);for(O=v[0];O>=10;O/=10,C++);}return b&&I.e+1>C&&(C=I.e+1),C},o.shiftedBy=function(b){return ye(b,-yi,yi),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,g,v,C,O,I=this,M=I.c,y=I.s,T=I.e,A=i+4,S=new E("0.5");if(y!==1||!M||!M[0])return new E(!y||y<0&&(!M||M[0])?NaN:M?I:1/0);if(y=Math.sqrt(+D(I)),y==0||y==1/0?(g=it(M),(g.length+T)%2==0&&(g+="0"),y=Math.sqrt(+g),T=st((T+1)/2)-(T<0||T%2),y==1/0?g="5e"+T:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+T),v=new E(g)):v=new E(y+""),v.c[0]){for(T=v.e,y=T+A,y<3&&(y=0);;)if(O=v,v=S.times(O.plus(t(I,O,A,1))),it(O.c).slice(0,y)===(g=it(v.c)).slice(0,y))if(v.e<T&&--y,g=g.slice(y-3,y+1),g=="9999"||!C&&g=="4999"){if(!C&&(F(O,O.e+i+2,0),O.times(O).eq(I))){v=O;break}A+=4,y+=4,C=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(F(v,v.e+i+2,1),b=!v.times(v).eq(I));break}}return F(v,v.e+i+1,c,b)},o.toExponential=function(b,g){return b!=null&&(ye(b,0,Oe),b++),P(this,b,g,1)},o.toFixed=function(b,g){return b!=null&&(ye(b,0,Oe),b=b+this.e+1),P(this,b,g)},o.toFormat=function(b,g,v){var C,O=this;if(v==null)b!=null&&g&&typeof g=="object"?(v=g,g=null):b&&typeof b=="object"?(v=b,b=g=null):v=m;else if(typeof v!="object")throw Error(_e+"Argument not an object: "+v);if(C=O.toFixed(b,g),O.c){var I,M=C.split("."),y=+v.groupSize,T=+v.secondaryGroupSize,A=v.groupSeparator||"",S=M[0],L=M[1],j=O.s<0,z=j?S.slice(1):S,_=z.length;if(T&&(I=y,y=T,T=I,_-=I),y>0&&_>0){for(I=_%y||y,S=z.substr(0,I);I<_;I+=y)S+=A+z.substr(I,y);T>0&&(S+=A+z.slice(I)),j&&(S="-"+S)}C=L?S+(v.decimalSeparator||"")+((T=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):S}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(b){var g,v,C,O,I,M,y,T,A,S,L,j,z=this,_=z.c;if(b!=null&&(y=new E(b),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+D(y));if(!_)return new E(z);for(g=new E(s),A=v=new E(s),C=T=new E(s),j=it(_),I=g.e=j.length-z.e-1,g.c[0]=wi[(M=I%ne)<0?ne+M:M],b=!b||y.comparedTo(g)>0?I>0?g:A:y,M=f,f=1/0,y=new E(j),T.c[0]=0;S=t(y,g,0,1),O=v.plus(S.times(C)),O.comparedTo(b)!=1;)v=C,C=O,A=T.plus(S.times(O=A)),T=O,g=y.minus(S.times(O=g)),y=O;return O=t(b.minus(v),C,0,1),T=T.plus(O.times(A)),v=v.plus(O.times(C)),T.s=A.s=z.s,I=I*2,L=t(A,C,I,c).minus(z).abs().comparedTo(t(T,v,I,c).minus(z).abs())<1?[A,C]:[T,v],f=M,L},o.toNumber=function(){return+D(this)},o.toPrecision=function(b,g){return b!=null&&ye(b,1,Oe),P(this,b,g,2)},o.toString=function(b){var g,v=this,C=v.s,O=v.e;return O===null?C?(g="Infinity",C<0&&(g="-"+g)):g="NaN":(b==null?g=O<=a||O>=u?Yo(it(v.c),O):Vt(it(v.c),O,"0"):b===10&&$?(v=F(new E(v),i+O+1,c),g=Vt(it(v.c),v.e,"0")):(ye(b,2,w.length,"Base"),g=n(Vt(it(v.c),O,"0"),10,b,C,!0)),C<0&&v.c[0]&&(g="-"+g)),g},o.valueOf=o.toJSON=function(){return D(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&E.set(e),E}function st(e){var t=e|0;return e>0||e===t?t:t-1}function it(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Nn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==ot(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Zo(e){var t=e.c.length-1;return st(e.e/ne)==t&&e.c[t]%2!=0}function Yo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Vt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Ie=Du();const Zm=(e,t=6)=>{try{const n=new Ie(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ie.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},vt=()=>{const{translations:e,currentLocale:t}=Lu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},Ym="1.1.0";let Ue=class Ou extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Ou?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Ou&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Ym}`].join(`
41
43
  `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Gt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Ru=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ju=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,_u=/^\(.+?\).*?$/,Uu=/^tuple(?<array>(\[(\d*)\])*)$/;function vi(e){let t=e.type;if(Uu.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=vi(s),o<n-1&&(t+=", ")}const r=Gt(Uu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,vi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function er(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=vi(o),r!==n-1&&(t+=", ")}return t}function Ko(e){var t;return e.type==="function"?`function ${e.name}(${er(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${er(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${er(e.inputs)})`:e.type==="error"?`error ${e.name}(${er(e.inputs)})`:e.type==="constructor"?`constructor(${er(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const zu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Km(e){return zu.test(e)}function Xm(e){return Gt(zu,e)}const Hu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Qm(e){return Hu.test(e)}function Jm(e){return Gt(Hu,e)}const Wu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function eb(e){return Wu.test(e)}function tb(e){return Gt(Wu,e)}const Vu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Xo(e){return Vu.test(e)}function nb(e){return Gt(Vu,e)}const Gu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function rb(e){return Gu.test(e)}function ob(e){return Gt(Gu,e)}const qu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function sb(e){return qu.test(e)}function ib(e){return Gt(qu,e)}const ab=/^receive\(\) external payable$/;function cb(e){return ab.test(e)}const Zu=new Set(["memory","indexed","storage","calldata"]),ub=new Set(["indexed"]),xi=new Set(["calldata","memory","storage"]);class lb extends Ue{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class fb extends Ue{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class db extends Ue{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class pb extends Ue{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class hb extends Ue{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class mb extends Ue{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class bb extends Ue{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class gb extends Ue{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class yb extends Ue{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class tr extends Ue{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class wb extends Ue{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class vb extends Ue{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class xb extends Ue{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Eb extends Ue{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Pb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Ei=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Pi(e,t={}){if(eb(e))return Sb(e,t);if(Qm(e))return $b(e,t);if(Km(e))return Ab(e,t);if(rb(e))return Tb(e,t);if(sb(e))return Ob(e);if(cb(e))return{type:"receive",stateMutability:"payable"};throw new wb({signature:e})}function Sb(e,t={}){const n=tb(e);if(!n)throw new tr({signature:e,type:"function"});const r=Qe(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(qt(r[c],{modifiers:xi,structs:t,type:"function"}));const i=[];if(n.returns){const c=Qe(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(qt(c[u],{modifiers:xi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function $b(e,t={}){const n=Jm(e);if(!n)throw new tr({signature:e,type:"event"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{modifiers:ub,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Ab(e,t={}){const n=Xm(e);if(!n)throw new tr({signature:e,type:"error"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Tb(e,t={}){const n=ob(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Ob(e){const t=ib(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Nb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Cb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ib=/^u?int$/;function qt(e,t){var f,p;const n=Pb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ei.has(n))return Ei.get(n);const r=_u.test(e),o=Gt(r?Cb:Nb,e);if(!o)throw new hb({param:e});if(o.name&&kb(o.name))throw new mb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=Qe(o.type),h=[],m=d.length;for(let w=0;w<m;w++)h.push(qt(d[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(Ib.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Yu(a))throw new db({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new bb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(xi.has(o.modifier)&&!Bb(a,!!o.array))throw new gb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ei.set(n,l),l}function Qe(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?Qe(c,[...t,n.trim()]):Qe(c,t,`${n}${i}`,r);case"(":return Qe(c,t,`${n}${i}`,r+1);case")":return Qe(c,t,`${n}${i}`,r-1);default:return Qe(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Eb({current:n,depth:r});return t.push(n.trim()),t}function Yu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ru.test(e)||ju.test(e)}const Mb=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function kb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ru.test(e)||ju.test(e)||Mb.test(e)}function Bb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Si(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!Xo(c))continue;const a=nb(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let p=0;p<f;p++){const h=u[p].trim();if(!h)continue;const m=qt(h,{type:"struct"});l.push(m)}if(!l.length)throw new vb({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Ku(a,t)}return r}const Lb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ku(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(_u.test(i.type))r.push(i);else{const a=Gt(Lb,i.type);if(!(a!=null&&a.type))throw new yb({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new xb({type:l});r.push({...i,type:`tuple${u??""}`,components:Ku(t[l]??[],t,new Set([...n,l]))})}else if(Yu(l))r.push(i);else throw new fb({type:l})}}return r}function Xu(e){const t=Si(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Xo(s)||n.push(Pi(s,t))}return n}function Qu(e){let t;if(typeof e=="string")t=Pi(e);else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Xo(s)){t=Pi(s,n);break}}}if(!t)throw new lb({signature:e});return t}function Ju(e){const t=[];if(typeof e=="string"){const n=Qe(e),r=n.length;for(let o=0;o<r;o++)t.push(qt(n[o],{modifiers:Zu}))}else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(Xo(s))continue;const i=Qe(s),c=i.length;for(let a=0;a<c;a++)t.push(qt(i[a],{modifiers:Zu,structs:n}))}}if(t.length===0)throw new pb({params:e});return t}function X(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function xt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Yb(e.type);return`${e.name}(${Qo(e.inputs,{includeName:t})})`}function Qo(e,{includeName:t=!1}={}){return e?e.map(n=>Fb(n,{includeName:t})).join(t?", ":","):""}function Fb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Qo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Et(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return Et(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const el="2.42.1";let Dr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${el}`},V=class Nu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Nu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Nu&&n.cause.docsPath||n.docsPath,s=(c=Dr.getDocsUrl)==null?void 0:c.call(Dr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Dr.version?[`Version: ${Dr.version}`]:[]].join(`
@@ -172,5 +174,6 @@ ${dg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
172
174
  relative
173
175
  ${c}
174
176
  ${s}
175
- `,children:[t,o&&k.jsx(am,{ref:f,placement:h.placement||n})]})})]})},Wo="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=",x4=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=vt(),a=x.useMemo(()=>{if(!e)return!1;const f=r===p5,p=Number(e.chainId),d=!Number.isNaN(p)&&(p===42161||p===421614),h=(t||"").toUpperCase()==="ETH";return f&&d&&h},[r,e,t]),u=x.useMemo(()=>{var f;return(f=e==null?void 0:e.tokenList)==null?void 0:f.find(p=>p.token===t||p.symbol===t)},[e,t]),l=(u==null?void 0:u.minDepositSize)||"10";return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(zh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(A3,{onCopy:()=>{s&&s(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.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")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:c(a?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),r===a0&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:[l," ",t]})]}),r===a0&&k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.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:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Vo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},E4=(e,t)=>Number(e)>Number(t),Mt=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"},fi=(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 fi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Mt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},P4=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Mt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Mt(e)} ${n}`},S4=(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)},$4=(e,t,n)=>{if(!xh(e,n))return!1;try{const r=new Ie(t||"0"),o=new Ie("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},A4=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&xh(e,n))try{const i=new Ie(o),c=new Ie("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Ie(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,Ie.ROUND_DOWN).toString()}catch{return o}},cm={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Ye=null;const um=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(cm),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ye={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ye=null}),[a,l,u,f,p,d]),n?k.jsx(mm,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,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});um.displayName="DepositManager";const lm=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.openDeposit(e||cm)},fm=()=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.closeDeposit()},dm=e=>{Ye&&Ye.updateDepositOptions(e)},di=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.setDepositLoading(e)},T4=()=>Ye?Ye.isOpen():!1,pm=()=>Ye?Ye.isLoading():!1,O4=()=>({openDeposit:lm,closeDeposit:fm,updateDepositOptions:dm,setDepositLoading:di,isOpen:T4,isLoading:pm}),N4=e=>{const{t}=vt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=a,f=S4(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<l?{text:t("deposit.minDepositParsed",{amount:l,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 C4(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),$=i({address:l,abi:yr,functionName:"allowance",args:[mn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),E=$!=null&&$.isSuccess?$.data:void 0,P=x.useMemo(()=>{if(d)return!0;if(!$.isSuccess||E===void 0||E===0n)return!1;try{const B=x6(String(Number(s||"0")||0),Number(f));return E>=B}catch{return!1}},[d,$.isSuccess,E,s,f]),N=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!p)return;const F=mn(l),D=mn(p);if((E||0n)>0n){const v=await m({abi:yr,address:F,functionName:"approve",args:[D,0n]});await w.waitForTransactionReceipt({hash:v})}const g=await m({abi:yr,address:F,functionName:"approve",args:[D,ef]});await w.waitForTransactionReceipt({hash:g}),$!=null&&$.refetch&&await $.refetch()}catch(B){console.error("[useApprove] onApprove failed:",B)}},[r,n,l,p,E,$,m,w,h]);return{approve:P,onApprove:N}}const I4=({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 x.useEffect(()=>{o(mn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},M4=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var E;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=x.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(B=>{const F=B.tokenAddress;if(!F)return!1;const D=F.toLowerCase();return!(F===P||D===N)})},[r]),[c,a]=x.useState({}),u=x.useCallback((P,N)=>{a(B=>({...B,[P]:N}))},[]),l=(E=o==null?void 0:o.useBalance)==null?void 0:E.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=x.useState(0),d=x.useMemo(()=>i.map(P=>x.createElement(I4,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const P=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const D=c[mn(F.tokenAddress)],b=D==null?void 0:D.balance,g=b==null?void 0:b.data;return{address:mn(F.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||F.decimals}}).filter(F=>F.address),B=N.reduce((F,D)=>({...F,[D.address]:{balance:D}}),{});return{balanceList:N,baseTokenBalance:P,combinedData:B}},[l,c,i]),m=x.useCallback(async()=>h,[h]),w=x.useMemo(()=>{const P=(l==null?void 0:l.isLoading)||!1,N=Object.values(c).some(B=>{var F;return(F=B.balance)==null?void 0:F.isLoading});return P||N},[l==null?void 0:l.isLoading,c]),$=x.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:$,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},k4=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=vt(),l=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=x.useState("");x.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:w}=M4({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),$=x.useMemo(()=>{var W;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((W=_==null?void 0:_.balance)==null?void 0:W.formatted)||"0"},[f,m]),E="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",P="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",N=x.useMemo(()=>{var _,W;return s5({chain:u5,transport:c5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),B="1000000000000",{formatted:F}=l5({client:N,tokenAddress:E,holder:P,decimals:6,fallbackFormatted:B,pollingInterval:12e3}),[D,b]=x.useState(!1),{approve:g,onApprove:v}=C4({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),C=x.useCallback(async()=>{if(!D)try{b(!0),await v()}catch(_){console.error("Approve failed:",_)}finally{b(!1)}},[D,v]),O=x.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),I=x.useCallback(async()=>{c&&c(p)},[c,p]);x.useEffect(()=>{O&&I()},[O,I]);const{showLayerZeroTip:M,layerZeroTipKey:y}=x.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,W=(n==null?void 0:n.toUpperCase())==="USDT",K=new Ie(d||"0"),G=new Ie("200000");let H=!1,Z;if(_&&W&&d)if(K.gte(G))H=!0,Z="deposit.layerZeroDepositTipGte200k";else{const J=F;if(typeof J=="string"&&J.length>0){const me=new Ie(J);!me.isNaN()&&K.gte(me)&&(H=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:H,layerZeroTipKey:Z}},[t.chainId,n,d,F]),T=x.useCallback(()=>A4(+t.chainId,$||"0",n,r),[$,t==null?void 0:t.chainId,n,r]),A=x.useMemo(()=>r!=="spot"&&$4(+t.chainId,d,n),[r,t==null?void 0:t.chainId,d,n]),S=x.useMemo(()=>"deposit.maxDepositSplitTip",[]),L=N4({isNetworkMismatch:O,depositAmount:d,approved:g,currentTokenBalance:$,selectedToken:n,showLayerZeroTip:M,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),j=_=>{const W=_.target.value,K=T(),G=fi(W,K);if(G.isValid)h(G.formattedValue),G.errorType;else return G.errorType==="exceed_balance",void 0},z=x.useCallback(async()=>{di(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),di(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return k.jsxs(k.Fragment,{children:[w,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:j,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const _=T();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:u("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:P4($||"0",d,n)})]})]}),!g&&E4(d||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:u("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.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:C,disabled:D,children:D?k.jsx(Vo,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),M&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(y||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),A&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(S)})]}),A&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(A||M)&&k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Mt((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${Mt(o)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${L.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:L.disabled||s,children:[(s||O)&&k.jsx(Vo,{size:"xs"}),L.text]})]})},hm=e=>e.toLocaleUpperCase()===Hn?Hn:sc,Eu=e=>hm(e.wallet)===Hn,B4=e=>hm(e.wallet)===sc,mm=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:u,wagmiHooks:l,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=vt(),[w,$]=x.useState(a),E=x.useCallback(A=>A==="spot"&&s&&s.length>0?s:o,[o,s]),P=E(a),[N,B]=x.useState(()=>{var A;return!P||P.length===0?1:i||((A=P[0])==null?void 0:A.chainId)||1}),F=x.useMemo(()=>E(w),[w,E]),D=F.find(A=>A.chainId===N)||F[0],[b,g]=x.useState(()=>{var _;if(!P||P.length===0)return"";const A=i||((_=P[0])==null?void 0:_.chainId),S=P.find(W=>W.chainId===A)||P[0],L=((S==null?void 0:S.tokenList)||[]).length>0?S:P.find(W=>(W.tokenList||[]).length>0),j=(L==null?void 0:L.tokenList)||[];if(c&&j.length>0){const W=c.toUpperCase(),K=j.find(G=>(G.token||G.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const z=j[0];return(z==null?void 0:z.token)||(z==null?void 0:z.symbol)||""}),v=x.useCallback(A=>{B(A),d==null||d(A)},[d]),C=x.useCallback(A=>{g(A),h==null||h(A)},[h]),O=x.useMemo(()=>{const A=(b||"").toLowerCase();if(!A)return"0";const S=w==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,L=S==null?void 0:S[A];return typeof L=="string"&&L.length>0?L:"0"},[u,w,b]),[I,M]=x.useState(!1),y=A=>{A.target===A.currentTarget?M(!0):M(!1)},T=A=>{I&&A.target===A.currentTarget&&n(),M(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:y,onMouseUp:T,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:A=>{A.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(Ph,{selectedAccount:w,onAccountChange:A=>{var H,Z;const S=A||"perpetual";$(S);const L=E(S);if(!L||L.length===0)return;const j=L.find(J=>J.chainId===N),z=j?j.chainId:L[0].chainId;B(z),d==null||d(z);const _=L.find(J=>J.chainId===z),W=(_==null?void 0:_.tokenList)||[],G=W.some(J=>(J.symbol||J.token)===b)?b:((H=W[0])==null?void 0:H.symbol)||((Z=W[0])==null?void 0:Z.token)||"";G&&(g(G),h==null||h(G))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:D,chainList:F,onChainChange:v,curSelectToken:b,onTokenChange:C,walletType:Eu(r)?Hn:sc,accountType:w}),Eu(r)&&k.jsx(x4,{address:r.smartWalletAddress,currentActiveChain:D,selectedToken:b,accountType:w,onDeposit:f,onCopy:p,onClose:n}),B4(r)&&k.jsx(k4,{address:r.ethAddress,currentActiveChain:D,selectedToken:b,accountType:w,platformBalance:O,isLoading:t,wagmiHooks:l,onChainChange:v,onDeposit:f,onClose:n})]})})}),document.body):null},L4=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},F4=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:l,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=vt(),h=x.useMemo(()=>{const F=L4(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const D=new Ie(e||"0").minus(s||"0").decimalPlaces(F,Ie.ROUND_DOWN);return D.isNegative()?"0.00":D.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=x.useMemo(()=>o||"0",[o]),w=x.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ie(F||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]),$=x.useMemo(()=>w==="0",[w]),E=x.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),P=F=>{const D=F.target.value,g=fi(D,m||"0");if(g.isValid)u(g.formattedValue),g.errorType;else return g.errorType==="exceed_balance",void 0;f==null||f(g.formattedValue)},N=()=>{const F=m||"0",b=fi(F,F).formattedValue;u(b),f==null||f(b)},B=()=>{const F=parseFloat(o||"0"),D=parseFloat(e||"0");if(D>0){const b=F-D,g=Mt(Math.max(0,b).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),g," ",t]})}return`${Mt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.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-none border-none p-0 h-full"}),k.jsx("button",{onClick:N,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:d("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:B()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>l==null?void 0:l(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),k.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")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Qn,{content:k.jsxs("div",{children:[k.jsx("div",{children:d("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.FAST,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.Medium,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.SLOW,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(Uo,{selectedLevel:ln(r==null?void 0:r.chainId)?It.SLOW:It.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[$||!E?k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:$?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):k.jsx(Qn,{className:"w-[320px] font-normal flex items-center justify-center",content:k.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:k.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")}`})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!$&&` / ${w}%`]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Mt(h)," ",t]})]})]})]})},D4=[];let Ke=null;const bm=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ke={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ke=null}),[a,l,u,f,p,d]),n?k.jsx(xm,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||D4,spotChains:i.spotChains,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});bm.displayName="WithdrawManager";const gm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},ym=()=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.closeWithdraw()},wm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.updateWithdrawOptions(e)},pi=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.setWithdrawLoading(e)},R4=()=>Ke?Ke.isOpen():!1,vm=()=>Ke?Ke.isLoading():!1,j4=()=>({openWithdraw:gm,closeWithdraw:ym,updateWithdrawOptions:wm,setWithdrawLoading:pi,isOpen:R4,isLoading:vm}),_4=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:u,fee:l="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:w,onAccountChange:$})=>{var H;const{t:E}=vt(),[P,N]=x.useState(i),B=x.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),F=x.useMemo(()=>B(P),[P,B]),D=x.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const Z=de=>{const se=de||[];if(!se.length)return"";const ee="USDC".toUpperCase(),On=se.find(gt=>(gt.token||gt.symbol||"").toUpperCase()===ee)||se[0];return On.token||On.symbol||""};if(o){const de=o==null?void 0:o.toUpperCase();for(const se of F){const pe=se.tokenList||[];let ee;if(de&&(ee=pe.find(Pe=>(Pe.token||Pe.symbol||"").toUpperCase()===de)),ee){const Pe=ee.token||ee.symbol||o||"";return{chainId:se.chainId,tokenSymbol:Pe}}}}if(r){const de=F.find(ee=>ee.chainId===r)||F[0],se=de.tokenList||[],pe=Z(se);return{chainId:de.chainId,tokenSymbol:pe}}const J="USDC",oe=de=>Array.isArray(de.tokenList)&&de.tokenList.some(se=>(se.token||se.symbol||"").toUpperCase()===J),me=F.find(oe)||F[0];if(!me)return{chainId:1,tokenSymbol:""};const ge=Z(me.tokenList);return{chainId:me.chainId,tokenSymbol:ge}},[F,r,o]),[b,g]=x.useState(()=>D.chainId),[v,C]=x.useState(()=>D.tokenSymbol),[O,I]=x.useState(s),[M,y]=x.useState(""),T=x.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),A=x.useCallback(Z=>{C(Z),m==null||m(Z)},[m]),S=x.useRef(!0),L=x.useRef(v),j=x.useRef(b);x.useEffect(()=>{if(S.current){S.current=!1,L.current=v,j.current=b;return}(L.current!==v||j.current!==b)&&(I(""),L.current=v,j.current=b)},[v,b]);const z=F&&F.length>0?F.find(Z=>Z.chainId===b)||F[0]:null,_=(H=z==null?void 0:z.tokenList)==null?void 0:H.find(Z=>Z.token===v),W=x.useMemo(()=>{const Z=new Ie(O||"0"),J=new Ie(l||"0"),oe=ln(b);return _!=null&&_.minWithdrawSize&&Z.lt(_.minWithdrawSize)?{text:E("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!O||Z.isZero()||!oe&&Z.isLessThan(J)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!oe||P==="spot")&&!M.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,b,O,e,M,l,P,_]),K=x.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=P==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,oe=J==null?void 0:J[Z];return typeof oe=="string"&&oe.length>0?oe:a||"0"},[u,P,v,a]),G=x.useCallback(async()=>{pi(!0);try{if(p){const J={amount:new Ie(O||"0").toString(),chainId:b,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:P,selectedToken:_};e==="mpc"&&(!ln(b)||P==="spot")&&(J.receiverAddress=M),p(J)}}catch{pi(!1)}},[p,P,_,O,b,v,e,M]);return!F||F.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?k.jsxs(k.Fragment,{children:[k.jsx(Ph,{selectedAccount:P,onAccountChange:Z=>{var Pe,On;const J=Z||"perpetual";N(J),$==null||$(J);const oe=B(J);if(!oe||oe.length===0)return;const me=oe.find(gt=>gt.chainId===b),ge=me?me.chainId:oe[0].chainId;g(ge),h==null||h(ge);const de=oe.find(gt=>gt.chainId===ge),se=(de==null?void 0:de.tokenList)||[],ee=se.some(gt=>(gt.symbol||gt.token)===v)?v:((Pe=se[0])==null?void 0:Pe.symbol)||((On=se[0])==null?void 0:On.token)||"";ee&&(C(ee),m==null||m(ee))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:z,chainList:F,onChainChange:T,curSelectToken:v,onTokenChange:A,walletType:"EVM",txType:"withdraw"}),k.jsx(F4,{withdrawAmount:O,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)||6,platformBalance:K,fee:l,walletType:e,accountType:P,receiverAddress:M,onWithdrawAmountChange:I,onReceiverAddressChange:y,onAmountChanged:w}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:W.disabled||f,children:[f&&k.jsx(Vo,{size:"xs"}),W.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},xm=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:w,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})=>{const{t:B}=vt(),[F,D]=x.useState(!1),b=v=>{v.target===v.currentTarget?D(!0):D(!1)},g=v=>{F&&v.target===v.currentTarget&&r(),D(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:b,onMouseUp:g,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:B("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(_4,{chains:i,spotChains:c,walletType:Eu(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:w,onClose:r,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})]})})}),document.body):null};re.ChromeLoader=Vo,re.ComponentProvider=Gm,re.DEFAULT_LOCALE=qo,re.Deposit=mm,re.DepositManager=um,re.LOCALE_NAMES=Hm,re.LoadingSpinner=Vo,re.SUPPORTED_LOCALES=bi,re.Tooltip=Qn,re.Withdraw=xm,re.WithdrawManager=bm,re.closeDeposit=fm,re.closeWithdraw=ym,re.formatThousands=Zm,re.isDepositLoading=pm,re.isWithdrawLoading=vm,re.openDeposit=lm,re.openWithdraw=gm,re.setDepositLoading=di,re.setWithdrawLoading=pi,re.updateDepositOptions=dm,re.updateWithdrawOptions=wm,re.useComponentConfig=Lu,re.useDeposit=f5,re.useDepositManager=O4,re.useTranslation=vt,re.useWithdraw=d5,re.useWithdrawManager=j4,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
177
+ `,children:[t,o&&k.jsx(am,{ref:f,placement:h.placement||n})]})})]})},Wo="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=",x4=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=vt(),a=r===p5,u=x.useMemo(()=>{if(!e)return!1;const d=Number(e.chainId);return!Number.isNaN(d)&&(d===42161||d===421614)},[e]),l=a,f=x.useMemo(()=>{var d;return(d=e==null?void 0:e.tokenList)==null?void 0:d.find(h=>h.token===t||h.symbol===t)},[e,t]),p=(f==null?void 0:f.minDepositSize)||"10";return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(zh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(A3,{onCopy:()=>{s&&s(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.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")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:(()=>{const h=c(l?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return l&&!u?String(h).split(`
178
+ `)[0]:h})()})})]}),r===a0&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:[p," ",t]})]}),r===a0&&k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.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:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Vo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},E4=(e,t)=>Number(e)>Number(t),Mt=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"},fi=(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 fi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Mt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},P4=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Mt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Mt(e)} ${n}`},S4=(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)},$4=(e,t,n)=>{if(!xh(e,n))return!1;try{const r=new Ie(t||"0"),o=new Ie("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},A4=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&xh(e,n))try{const i=new Ie(o),c=new Ie("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Ie(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,Ie.ROUND_DOWN).toString()}catch{return o}},cm={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Ye=null;const um=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(cm),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ye={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ye=null}),[a,l,u,f,p,d]),n?k.jsx(mm,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,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});um.displayName="DepositManager";const lm=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.openDeposit(e||cm)},fm=()=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.closeDeposit()},dm=e=>{Ye&&Ye.updateDepositOptions(e)},di=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.setDepositLoading(e)},T4=()=>Ye?Ye.isOpen():!1,pm=()=>Ye?Ye.isLoading():!1,O4=()=>({openDeposit:lm,closeDeposit:fm,updateDepositOptions:dm,setDepositLoading:di,isOpen:T4,isLoading:pm}),N4=e=>{const{t}=vt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=a,f=S4(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<l?{text:t("deposit.minDepositParsed",{amount:l,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 C4(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),$=i({address:l,abi:yr,functionName:"allowance",args:[mn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),E=$!=null&&$.isSuccess?$.data:void 0,P=x.useMemo(()=>{if(d)return!0;if(!$.isSuccess||E===void 0||E===0n)return!1;try{const B=x6(String(Number(s||"0")||0),Number(f));return E>=B}catch{return!1}},[d,$.isSuccess,E,s,f]),N=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!p)return;const F=mn(l),D=mn(p);if((E||0n)>0n){const v=await m({abi:yr,address:F,functionName:"approve",args:[D,0n]});await w.waitForTransactionReceipt({hash:v})}const g=await m({abi:yr,address:F,functionName:"approve",args:[D,ef]});await w.waitForTransactionReceipt({hash:g}),$!=null&&$.refetch&&await $.refetch()}catch(B){console.error("[useApprove] onApprove failed:",B)}},[r,n,l,p,E,$,m,w,h]);return{approve:P,onApprove:N}}const I4=({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 x.useEffect(()=>{o(mn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},M4=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var E;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=x.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(B=>{const F=B.tokenAddress;if(!F)return!1;const D=F.toLowerCase();return!(F===P||D===N)})},[r]),[c,a]=x.useState({}),u=x.useCallback((P,N)=>{a(B=>({...B,[P]:N}))},[]),l=(E=o==null?void 0:o.useBalance)==null?void 0:E.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=x.useState(0),d=x.useMemo(()=>i.map(P=>x.createElement(I4,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const P=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const D=c[mn(F.tokenAddress)],b=D==null?void 0:D.balance,g=b==null?void 0:b.data;return{address:mn(F.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||F.decimals}}).filter(F=>F.address),B=N.reduce((F,D)=>({...F,[D.address]:{balance:D}}),{});return{balanceList:N,baseTokenBalance:P,combinedData:B}},[l,c,i]),m=x.useCallback(async()=>h,[h]),w=x.useMemo(()=>{const P=(l==null?void 0:l.isLoading)||!1,N=Object.values(c).some(B=>{var F;return(F=B.balance)==null?void 0:F.isLoading});return P||N},[l==null?void 0:l.isLoading,c]),$=x.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:$,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},k4=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=vt(),l=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=x.useState("");x.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:w}=M4({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),$=x.useMemo(()=>{var W;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((W=_==null?void 0:_.balance)==null?void 0:W.formatted)||"0"},[f,m]),E="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",P="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",N=x.useMemo(()=>{var _,W;return s5({chain:u5,transport:c5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),B="1000000000000",{formatted:F}=l5({client:N,tokenAddress:E,holder:P,decimals:6,fallbackFormatted:B,pollingInterval:12e3}),[D,b]=x.useState(!1),{approve:g,onApprove:v}=C4({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),C=x.useCallback(async()=>{if(!D)try{b(!0),await v()}catch(_){console.error("Approve failed:",_)}finally{b(!1)}},[D,v]),O=x.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),I=x.useCallback(async()=>{c&&c(p)},[c,p]);x.useEffect(()=>{O&&I()},[O,I]);const{showLayerZeroTip:M,layerZeroTipKey:y}=x.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,W=(n==null?void 0:n.toUpperCase())==="USDT",K=new Ie(d||"0"),G=new Ie("200000");let H=!1,Z;if(_&&W&&d)if(K.gte(G))H=!0,Z="deposit.layerZeroDepositTipGte200k";else{const J=F;if(typeof J=="string"&&J.length>0){const me=new Ie(J);!me.isNaN()&&K.gte(me)&&(H=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:H,layerZeroTipKey:Z}},[t.chainId,n,d,F]),T=x.useCallback(()=>A4(+t.chainId,$||"0",n,r),[$,t==null?void 0:t.chainId,n,r]),A=x.useMemo(()=>r!=="spot"&&$4(+t.chainId,d,n),[r,t==null?void 0:t.chainId,d,n]),S=x.useMemo(()=>"deposit.maxDepositSplitTip",[]),L=N4({isNetworkMismatch:O,depositAmount:d,approved:g,currentTokenBalance:$,selectedToken:n,showLayerZeroTip:M,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),j=_=>{const W=_.target.value,K=T(),G=fi(W,K);if(G.isValid)h(G.formattedValue),G.errorType;else return G.errorType==="exceed_balance",void 0},z=x.useCallback(async()=>{di(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),di(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return k.jsxs(k.Fragment,{children:[w,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:j,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const _=T();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:u("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:P4($||"0",d,n)})]})]}),!g&&E4(d||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:u("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.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:C,disabled:D,children:D?k.jsx(Vo,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),M&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(y||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),A&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(S)})]}),A&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(A||M)&&k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:u("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Mt((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${Mt(o)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${L.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:L.disabled||s,children:[(s||O)&&k.jsx(Vo,{size:"xs"}),L.text]})]})},hm=e=>e.toLocaleUpperCase()===Hn?Hn:sc,Eu=e=>hm(e.wallet)===Hn,B4=e=>hm(e.wallet)===sc,mm=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:u,wagmiHooks:l,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=vt(),[w,$]=x.useState(a),E=x.useCallback(A=>A==="spot"&&s&&s.length>0?s:o,[o,s]),P=E(a),[N,B]=x.useState(()=>{var A;return!P||P.length===0?1:i||((A=P[0])==null?void 0:A.chainId)||1}),F=x.useMemo(()=>E(w),[w,E]),D=F.find(A=>A.chainId===N)||F[0],[b,g]=x.useState(()=>{var _;if(!P||P.length===0)return"";const A=i||((_=P[0])==null?void 0:_.chainId),S=P.find(W=>W.chainId===A)||P[0],L=((S==null?void 0:S.tokenList)||[]).length>0?S:P.find(W=>(W.tokenList||[]).length>0),j=(L==null?void 0:L.tokenList)||[];if(c&&j.length>0){const W=c.toUpperCase(),K=j.find(G=>(G.token||G.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const z=j[0];return(z==null?void 0:z.token)||(z==null?void 0:z.symbol)||""}),v=x.useCallback(A=>{B(A),d==null||d(A)},[d]),C=x.useCallback(A=>{g(A),h==null||h(A)},[h]),O=x.useMemo(()=>{const A=(b||"").toLowerCase();if(!A)return"0";const S=w==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,L=S==null?void 0:S[A];return typeof L=="string"&&L.length>0?L:"0"},[u,w,b]),[I,M]=x.useState(!1),y=A=>{A.target===A.currentTarget?M(!0):M(!1)},T=A=>{I&&A.target===A.currentTarget&&n(),M(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:y,onMouseUp:T,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:A=>{A.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(Ph,{selectedAccount:w,onAccountChange:A=>{var H,Z;const S=A||"perpetual";$(S);const L=E(S);if(!L||L.length===0)return;const j=L.find(J=>J.chainId===N),z=j?j.chainId:L[0].chainId;B(z),d==null||d(z);const _=L.find(J=>J.chainId===z),W=(_==null?void 0:_.tokenList)||[],G=W.some(J=>(J.symbol||J.token)===b)?b:((H=W[0])==null?void 0:H.symbol)||((Z=W[0])==null?void 0:Z.token)||"";G&&(g(G),h==null||h(G))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:D,chainList:F,onChainChange:v,curSelectToken:b,onTokenChange:C,walletType:Eu(r)?Hn:sc,accountType:w}),Eu(r)&&k.jsx(x4,{address:r.smartWalletAddress,currentActiveChain:D,selectedToken:b,accountType:w,onDeposit:f,onCopy:p,onClose:n}),B4(r)&&k.jsx(k4,{address:r.ethAddress,currentActiveChain:D,selectedToken:b,accountType:w,platformBalance:O,isLoading:t,wagmiHooks:l,onChainChange:v,onDeposit:f,onClose:n})]})})}),document.body):null},L4=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},F4=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:l,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=vt(),h=x.useMemo(()=>{const F=L4(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const D=new Ie(e||"0").minus(s||"0").decimalPlaces(F,Ie.ROUND_DOWN);return D.isNegative()?"0.00":D.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=x.useMemo(()=>o||"0",[o]),w=x.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ie(F||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]),$=x.useMemo(()=>w==="0",[w]),E=x.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),P=F=>{const D=F.target.value,g=fi(D,m||"0");if(g.isValid)u(g.formattedValue),g.errorType;else return g.errorType==="exceed_balance",void 0;f==null||f(g.formattedValue)},N=()=>{const F=m||"0",b=fi(F,F).formattedValue;u(b),f==null||f(b)},B=()=>{const F=parseFloat(o||"0"),D=parseFloat(e||"0");if(D>0){const b=F-D,g=Mt(Math.max(0,b).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),g," ",t]})}return`${Mt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.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-none border-none p-0 h-full"}),k.jsx("button",{onClick:N,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:d("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:B()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>l==null?void 0:l(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),k.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")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Qn,{content:k.jsxs("div",{children:[k.jsx("div",{children:d("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.FAST,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.Medium,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.SLOW,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(Uo,{selectedLevel:ln(r==null?void 0:r.chainId)?It.SLOW:It.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[$||!E?k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:$?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):k.jsx(Qn,{className:"w-[320px] font-normal flex items-center justify-center",content:k.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:k.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")}`})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!$&&` / ${w}%`]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Mt(h)," ",t]})]})]})]})},D4=[];let Ke=null;const bm=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ke={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ke=null}),[a,l,u,f,p,d]),n?k.jsx(xm,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||D4,spotChains:i.spotChains,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});bm.displayName="WithdrawManager";const gm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},ym=()=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.closeWithdraw()},wm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.updateWithdrawOptions(e)},pi=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.setWithdrawLoading(e)},R4=()=>Ke?Ke.isOpen():!1,vm=()=>Ke?Ke.isLoading():!1,j4=()=>({openWithdraw:gm,closeWithdraw:ym,updateWithdrawOptions:wm,setWithdrawLoading:pi,isOpen:R4,isLoading:vm}),_4=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:u,fee:l="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:w,onAccountChange:$})=>{var H;const{t:E}=vt(),[P,N]=x.useState(i),B=x.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),F=x.useMemo(()=>B(P),[P,B]),D=x.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const Z=de=>{const se=de||[];if(!se.length)return"";const ee="USDC".toUpperCase(),On=se.find(gt=>(gt.token||gt.symbol||"").toUpperCase()===ee)||se[0];return On.token||On.symbol||""};if(o){const de=o==null?void 0:o.toUpperCase();for(const se of F){const pe=se.tokenList||[];let ee;if(de&&(ee=pe.find(Pe=>(Pe.token||Pe.symbol||"").toUpperCase()===de)),ee){const Pe=ee.token||ee.symbol||o||"";return{chainId:se.chainId,tokenSymbol:Pe}}}}if(r){const de=F.find(ee=>ee.chainId===r)||F[0],se=de.tokenList||[],pe=Z(se);return{chainId:de.chainId,tokenSymbol:pe}}const J="USDC",oe=de=>Array.isArray(de.tokenList)&&de.tokenList.some(se=>(se.token||se.symbol||"").toUpperCase()===J),me=F.find(oe)||F[0];if(!me)return{chainId:1,tokenSymbol:""};const ge=Z(me.tokenList);return{chainId:me.chainId,tokenSymbol:ge}},[F,r,o]),[b,g]=x.useState(()=>D.chainId),[v,C]=x.useState(()=>D.tokenSymbol),[O,I]=x.useState(s),[M,y]=x.useState(""),T=x.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),A=x.useCallback(Z=>{C(Z),m==null||m(Z)},[m]),S=x.useRef(!0),L=x.useRef(v),j=x.useRef(b);x.useEffect(()=>{if(S.current){S.current=!1,L.current=v,j.current=b;return}(L.current!==v||j.current!==b)&&(I(""),L.current=v,j.current=b)},[v,b]);const z=F&&F.length>0?F.find(Z=>Z.chainId===b)||F[0]:null,_=(H=z==null?void 0:z.tokenList)==null?void 0:H.find(Z=>Z.token===v),W=x.useMemo(()=>{const Z=new Ie(O||"0"),J=new Ie(l||"0"),oe=ln(b);return _!=null&&_.minWithdrawSize&&Z.lt(_.minWithdrawSize)?{text:E("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!O||Z.isZero()||!oe&&Z.isLessThan(J)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!oe||P==="spot")&&!M.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,b,O,e,M,l,P,_]),K=x.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=P==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,oe=J==null?void 0:J[Z];return typeof oe=="string"&&oe.length>0?oe:a||"0"},[u,P,v,a]),G=x.useCallback(async()=>{pi(!0);try{if(p){const J={amount:new Ie(O||"0").toString(),chainId:b,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:P,selectedToken:_};e==="mpc"&&(!ln(b)||P==="spot")&&(J.receiverAddress=M),p(J)}}catch{pi(!1)}},[p,P,_,O,b,v,e,M]);return!F||F.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?k.jsxs(k.Fragment,{children:[k.jsx(Ph,{selectedAccount:P,onAccountChange:Z=>{var Pe,On;const J=Z||"perpetual";N(J),$==null||$(J);const oe=B(J);if(!oe||oe.length===0)return;const me=oe.find(gt=>gt.chainId===b),ge=me?me.chainId:oe[0].chainId;g(ge),h==null||h(ge);const de=oe.find(gt=>gt.chainId===ge),se=(de==null?void 0:de.tokenList)||[],ee=se.some(gt=>(gt.symbol||gt.token)===v)?v:((Pe=se[0])==null?void 0:Pe.symbol)||((On=se[0])==null?void 0:On.token)||"";ee&&(C(ee),m==null||m(ee))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:z,chainList:F,onChainChange:T,curSelectToken:v,onTokenChange:A,walletType:"EVM",txType:"withdraw"}),k.jsx(F4,{withdrawAmount:O,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)||6,platformBalance:K,fee:l,walletType:e,accountType:P,receiverAddress:M,onWithdrawAmountChange:I,onReceiverAddressChange:y,onAmountChanged:w}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:W.disabled||f,children:[f&&k.jsx(Vo,{size:"xs"}),W.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},xm=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:w,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})=>{const{t:B}=vt(),[F,D]=x.useState(!1),b=v=>{v.target===v.currentTarget?D(!0):D(!1)},g=v=>{F&&v.target===v.currentTarget&&r(),D(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:b,onMouseUp:g,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:B("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(_4,{chains:i,spotChains:c,walletType:Eu(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:w,onClose:r,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})]})})}),document.body):null};re.ChromeLoader=Vo,re.ComponentProvider=Gm,re.DEFAULT_LOCALE=qo,re.Deposit=mm,re.DepositManager=um,re.LOCALE_NAMES=Hm,re.LoadingSpinner=Vo,re.SUPPORTED_LOCALES=bi,re.Tooltip=Qn,re.Withdraw=xm,re.WithdrawManager=bm,re.closeDeposit=fm,re.closeWithdraw=ym,re.formatThousands=Zm,re.isDepositLoading=pm,re.isWithdrawLoading=vm,re.openDeposit=lm,re.openWithdraw=gm,re.setDepositLoading=di,re.setWithdrawLoading=pi,re.updateDepositOptions=dm,re.updateWithdrawOptions=wm,re.useComponentConfig=Lu,re.useDeposit=f5,re.useDepositManager=O4,re.useTranslation=vt,re.useWithdraw=d5,re.useWithdrawManager=j4,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
176
179
  //# sourceMappingURL=index.umd.js.map