@nexus-cross/dapp-ui 1.3.4 → 1.3.5-beta.1
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.cjs +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var yc=Object.create;var vo=Object.defineProperty;var kc=Object.getOwnPropertyDescriptor;var Sc=Object.getOwnPropertyNames;var Rc=Object.getPrototypeOf,Cc=Object.prototype.hasOwnProperty;var Tc=(e,t)=>{for(var n in t)vo(e,n,{get:t[n],enumerable:!0})},Ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Sc(t))!Cc.call(e,r)&&r!==n&&vo(e,r,{get:()=>t[r],enumerable:!(o=kc(t,r))||o.enumerable});return e};var U=(e,t,n)=>(n=e!=null?yc(Rc(e)):{},Ri(t||!e||!e.__esModule?vo(n,"default",{value:e,enumerable:!0}):n,e)),Nc=e=>Ri(vo({},"__esModule",{value:!0}),e);var kf={};Tc(kf,{APPLE_ICON:()=>uo,AppLauncher:()=>kr,AppLauncherContent:()=>Cr,AppLauncherTrigger:()=>Sr,BINANCE_ICON:()=>po,BridgeFlow:()=>no,CONNECTOR_REGISTRY:()=>Hn,CROSSX_ICON:()=>lo,ConnectButton:()=>li,ConnectorId:()=>Eo,DEFAULT_SKILLS_HREF:()=>ci,GOOGLE_ICON:()=>fo,METAMASK_ICON:()=>co,PORTFOLIO_SECTIONS:()=>Jn,SOCIAL_REGISTRY:()=>pr,SendFlow:()=>qn,SkillsButton:()=>di,TOKEN_STATS_QUERY_KEY:()=>$o,USER_BALANCE_QUERY_KEY:()=>Ho,WALLET_REGISTRY:()=>dr,WalletConnectModal:()=>si,WalletInfo:()=>yn,WalletPortfolio:()=>Jr,WalletPortfolioBody:()=>bn,announceAppLauncherUsage:()=>ko,resolveEnvironment:()=>Oe,useGlobalMenu:()=>Gn,useTokenBalance:()=>qt,useTokenStats:()=>Kt,useWalletDetect:()=>io});module.exports=Nc(kf);var Ic={};function Ci(e){try{return Ic.env?.[e]}catch{return}}function Ti(e){if(!(typeof process>"u"))return process.env?.[e]}function Oe(e){if(e)return Ni(e);let t=Ci("VITE_CROSSX_ENVIRONMENT")??Ci("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ti("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ti("CROSSX_ENVIRONMENT");return Ni(t)}function Ni(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var vr="1.3.
|
|
1
|
+
"use strict";var yc=Object.create;var vo=Object.defineProperty;var kc=Object.getOwnPropertyDescriptor;var Sc=Object.getOwnPropertyNames;var Rc=Object.getPrototypeOf,Cc=Object.prototype.hasOwnProperty;var Tc=(e,t)=>{for(var n in t)vo(e,n,{get:t[n],enumerable:!0})},Ri=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Sc(t))!Cc.call(e,r)&&r!==n&&vo(e,r,{get:()=>t[r],enumerable:!(o=kc(t,r))||o.enumerable});return e};var U=(e,t,n)=>(n=e!=null?yc(Rc(e)):{},Ri(t||!e||!e.__esModule?vo(n,"default",{value:e,enumerable:!0}):n,e)),Nc=e=>Ri(vo({},"__esModule",{value:!0}),e);var kf={};Tc(kf,{APPLE_ICON:()=>uo,AppLauncher:()=>kr,AppLauncherContent:()=>Cr,AppLauncherTrigger:()=>Sr,BINANCE_ICON:()=>po,BridgeFlow:()=>no,CONNECTOR_REGISTRY:()=>Hn,CROSSX_ICON:()=>lo,ConnectButton:()=>li,ConnectorId:()=>Eo,DEFAULT_SKILLS_HREF:()=>ci,GOOGLE_ICON:()=>fo,METAMASK_ICON:()=>co,PORTFOLIO_SECTIONS:()=>Jn,SOCIAL_REGISTRY:()=>pr,SendFlow:()=>qn,SkillsButton:()=>di,TOKEN_STATS_QUERY_KEY:()=>$o,USER_BALANCE_QUERY_KEY:()=>Ho,WALLET_REGISTRY:()=>dr,WalletConnectModal:()=>si,WalletInfo:()=>yn,WalletPortfolio:()=>Jr,WalletPortfolioBody:()=>bn,announceAppLauncherUsage:()=>ko,resolveEnvironment:()=>Oe,useGlobalMenu:()=>Gn,useTokenBalance:()=>qt,useTokenStats:()=>Kt,useWalletDetect:()=>io});module.exports=Nc(kf);var Ic={};function Ci(e){try{return Ic.env?.[e]}catch{return}}function Ti(e){if(!(typeof process>"u"))return process.env?.[e]}function Oe(e){if(e)return Ni(e);let t=Ci("VITE_CROSSX_ENVIRONMENT")??Ci("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ti("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ti("CROSSX_ENVIRONMENT");return Ni(t)}function Ni(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var vr="1.3.5";var yo="__nexusCrossAppLauncherRuntime";function Ec(){if(typeof window>"u")return null;let e=window;return e[yo]??(e[yo]={mode:"dapp-ui"}),e[yo]}function Lc(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??"unknown";console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${vr}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${vr} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function ko(e){let t=Ec();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),Lc(t))}var Nn=U(require("react"),1),Ii=U(require("@radix-ui/react-popover"),1),Ei=require("vaul");var So=require("react"),yr=(0,So.createContext)(null);function Ro(){let e=(0,So.useContext)(yr);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}var Co=require("react");function Tn(e){let[t,n]=(0,Co.useState)(!1);return(0,Co.useEffect)(()=>{let o=window.matchMedia(e);n(o.matches);let r=a=>n(a.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function Y(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}Y(`[data-theme=dark]{--al-bg: var(--ds-surface-default, #1e232e);--al-bg-hover: var(--ds-surface-medium, #252b39);--al-text: var(--ds-content-highest, #ffffff);--al-text-secondary: var(--ds-content-medium, #ffffffa6);--al-border: var(--ds-border-default, #ffffff12);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .7));--al-primary: #f3742e;--al-primary-hover: #ff8a4a;--al-primary-soft: #3a261f;--al-new-ribbon-bg: #ed0a72;--al-badge-bg: var(--ds-accent-primary-low, #123235);--al-badge-text: var(--ds-accent-primary-default, #00ceb2);--al-drawer-overlay: var(--ds-overlay-dim, #000000b3)}[data-theme=light]{--al-bg: var(--ds-surface-default, #ffffff);--al-bg-hover: var(--ds-surface-medium, #f5f7fa);--al-text: var(--ds-content-highest, #000000);--al-text-secondary: var(--ds-content-medium, #000000a6);--al-border: var(--ds-border-default, #00000012);--al-shadow: var(--ds-shadow-modal, 0px 4px 30px -1px rgba(0, 0, 0, .15));--al-primary: #f3742e;--al-primary-hover: #ff8a4a;--al-primary-soft: #fff1eb;--al-new-ribbon-bg: #ed0a72;--al-badge-bg: var(--ds-accent-primary-low, #e7f9f8);--al-badge-text: var(--ds-accent-primary-default, #00b4b7);--al-drawer-overlay: var(--ds-overlay-dim, #00000080)}
|
|
2
2
|
`);Y(`.al-trigger-btn{--at-bg: transparent;--at-bg-hover: #eaedf1;--at-color: var(--ds-content-high, rgba(0, 0, 0, .85));--at-border: none;--at-border-radius: 8px;--at-size: 36px;--at-padding: 0;--at-press-scale: .95;--at-transition: background-color .15s ease;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--at-size);height:var(--at-size);padding:var(--at-padding);border:var(--at-border);background:var(--at-bg);border-radius:var(--at-border-radius);color:var(--at-color);cursor:pointer;transition:var(--at-transition)}.al-trigger-btn:hover,.al-trigger-btn[data-state=open]{background:var(--at-bg-hover)}.al-trigger-btn:active:not(:disabled){background:var(--at-bg-hover);transform:scale(var(--at-press-scale))}.al-trigger-btn[data-theme=dark]{--at-color: var(--ds-content-high, rgba(255, 255, 255, .85));--at-bg-hover: #252b39}.al-trigger-btn[data-theme=light]{--at-color: var(--ds-content-high, rgba(0, 0, 0, .85))}
|
|
3
3
|
`);Y(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
|
|
4
4
|
`);Y(`.al-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;border-radius:24px;background:var(--al-bg);border:1px solid var(--al-popover-border, var(--al-border));box-shadow:var(--al-popover-shadow, var(--al-shadow));animation:al-fade-in .15s ease-out;max-height:80vh;overflow-x:hidden;overflow-y:auto;padding:20px 4px;box-sizing:border-box}.al-popover-content .al-menu{display:flex;flex-direction:column;width:424px;max-width:calc(100vw - 32px);padding:0 12px;box-sizing:border-box}.al-popover-content .al-grid{display:grid;grid-template-columns:repeat(4,100px);row-gap:12px;column-gap:0;justify-content:center;align-items:start}.al-popover-content .al-grid-item{position:relative;flex-direction:column;justify-content:flex-start;align-items:center;gap:6px;padding:12px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:8px;width:100%;overflow:visible}.al-popover-content .al-grid-item-icon{width:50px;height:50px;border-radius:10.125px;overflow:visible}.al-popover-content .al-grid-item-icon img{object-fit:cover}.al-popover-content .al-grid-item-label{font-family:Inter,sans-serif;font-size:12px;font-weight:500;line-height:1.1;letter-spacing:0;text-align:center;color:var(--al-text);max-width:100%;white-space:normal;overflow-wrap:anywhere}.al-popover-content .al-grid-item-text{flex-direction:column;align-items:center;justify-content:center;gap:2px;max-width:100%;min-height:26px}.al-popover-content .al-grid-item-status-text{font-size:10px;line-height:1.1}.al-popover-content .al-badge-list{display:none}.al-drawer-overlay{position:fixed;inset:0;z-index:100000;background:var(--al-drawer-overlay)}.al-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;background:var(--al-bg);overflow-x:hidden;overflow-y:hidden;display:flex;flex-direction:column;box-sizing:border-box}.al-drawer-body{flex:1;overflow-y:auto;overscroll-behavior-y:contain;min-height:0}.al-drawer-content .al-menu{display:flex;flex-direction:column;min-height:0}.al-drawer-content .al-grid{display:flex;flex-direction:column;grid-template-columns:none;max-width:100%;overflow:hidden;flex-shrink:0;gap:0;row-gap:0;column-gap:0;padding:8px 16px}.al-drawer-content .al-grid-item{width:100%;max-width:100%;gap:8px;padding:16px 12px;border-radius:8px;overflow:hidden;background:transparent}.al-drawer-content .al-grid-item:hover,.al-drawer-content .al-grid-item[data-active=true]{background:var(--al-bg-hover)}.al-drawer-content .al-grid-item-left{gap:8px;flex:1 1 auto;min-width:0;overflow:visible}.al-drawer-content .al-grid-item-icon{width:32px;height:32px;border-radius:6.75px;overflow:visible}.al-drawer-content .al-grid-item-icon img{width:100%;height:100%;object-fit:cover;border-radius:6.75px}.al-drawer-content .al-grid-item-label{font-size:16px;line-height:1.35;letter-spacing:0;font-weight:400}.al-drawer-content .al-grid-item[data-active=true] .al-grid-item-label{font-weight:500}.al-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:16px;flex-shrink:0}.al-drawer-title{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--al-text);margin:0}.al-drawer-close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border:none;background:transparent;border-radius:4px;cursor:pointer;color:var(--al-text-secondary);transition:opacity .15s ease}.al-drawer-close:hover{opacity:.7}.al-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:4px;padding:8px}.al-grid-item{display:flex;align-items:center;justify-content:flex-start;gap:10px;padding:16px 12px;border:none;background:var(--al-bg);border-radius:8px;cursor:pointer;transition:none;color:var(--al-text);text-align:left;font-family:Inter,sans-serif;flex-shrink:0}.al-grid-item:hover,.al-grid-item[data-active=true]{background:var(--al-bg-hover)!important}.al-grid-item-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:visible}.al-grid-item-text{display:flex;flex-direction:column;align-items:flex-start;gap:1px;max-width:100%;min-width:0}.al-grid-item-icon{display:flex;align-items:center;justify-content:center;position:relative;width:24px;height:24px;overflow:visible;border-radius:5px;flex-shrink:0}.al-grid-item-icon img{width:100%;height:100%;object-fit:contain;border-radius:inherit}.al-grid-item-label{font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:150%;letter-spacing:0;color:var(--al-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.al-grid-item-status-text{font-family:Inter,sans-serif;font-size:12px;font-weight:400;line-height:1.15;letter-spacing:0;color:var(--al-text);white-space:nowrap}.al-status-ribbon{position:absolute;top:-6px;right:-6px;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;box-sizing:border-box;border-radius:999px;color:#fff;font-family:Pretendard,Inter,sans-serif;font-size:12px;font-weight:800;line-height:1;pointer-events:none;box-shadow:0 1px 3px #0000002e}.al-status-ribbon-new{background:var(--al-new-ribbon-bg)}.al-badge{display:flex;padding:1px 4px 2px;justify-content:center;align-items:center;gap:2px;border-radius:3px;background:var(--al-badge-bg);color:var(--al-badge-text);font-family:Pretendard,Inter,sans-serif;font-size:10px;font-weight:600;line-height:150%;letter-spacing:0;white-space:nowrap;flex-shrink:0}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`);var Se=require("react/jsx-runtime"),sd={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function qn({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...a}){let i=Ba.useCallback(v=>{o?.(v),n?.(v)},[n,o]),d=ha({...a,onSuccess:o||n?i:void 0,onExit:t}),{step:c,status:f}=d,w=Mt(d.recipient.trim()),h=jt(d.amount,d.token.quantity.decimals),g="value"in h&&h.value<=d.balanceRaw,y=f==="submitting"||f==="confirming",b=c!=="result",m=sd[c]??"";return(0,Se.jsxs)("div",{className:de("sf-root",r),"data-step":c,children:[(0,Se.jsxs)("header",{className:"sf-header",children:[b?(0,Se.jsx)("button",{type:"button",className:"sf-header-btn",onClick:d.back,"aria-label":"Back",children:(0,Se.jsx)(dn,{size:24})}):(0,Se.jsx)("span",{className:"sf-header-btn","aria-hidden":!0}),(0,Se.jsx)("span",{className:"sf-header-title",children:m}),(0,Se.jsx)("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:(0,Se.jsx)(_t,{size:24})})]}),c==="token"&&(0,Se.jsx)(Fa,{flow:d}),c==="recipient"&&(0,Se.jsx)(Ea,{flow:d}),c==="amount"&&(0,Se.jsx)(ba,{flow:d}),c==="review"&&(0,Se.jsx)(Pa,{flow:d}),c==="result"&&(0,Se.jsx)(Aa,{flow:d}),(0,Se.jsxs)("footer",{className:"sf-footer","data-step":c,children:[c==="recipient"&&(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.submitRecipient,"data-disabled":!w||void 0,"aria-disabled":!w,children:"Next"}),c==="amount"&&(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.submitAmount,"data-disabled":!g||void 0,"aria-disabled":!g,children:"Next"}),c==="review"&&(0,Se.jsxs)("div",{className:"sf-footer-row",children:[(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:d.back,disabled:y,children:"Cancel"}),(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.confirmSend,disabled:y||!d.canSend||d.insufficientGas,children:y?"Sending...":"Send"})]}),c==="result"&&f==="success"&&(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(d.txHash||void 0),children:"All done"}),c==="result"&&f==="error"&&(0,Se.jsx)("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.retry,children:"Try Again"})]})]})}var _a=U(require("@radix-ui/react-popover"),1),Ma=require("vaul");var mn=require("react/jsx-runtime");function Oa({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:a}=Yt(),i=n!=null,l=e??!0,d=i?n:(0,mn.jsxs)("button",{type:"button",className:de("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[(0,mn.jsx)(Hi,{size:o?14:16}),(0,mn.jsx)("span",{className:"wi-trigger-address",children:dt(a)})]});return o?(0,mn.jsx)(Ma.Drawer.Trigger,{asChild:l,children:d}):(0,mn.jsx)(_a.Trigger,{asChild:l,children:d})}var z=U(require("react"),1),ir=U(require("@radix-ui/react-popover"),1),oo=require("vaul");var Bn=U(require("bignumber.js"),1);var Wa=require("@tanstack/react-query"),Da=require("react");var Ho="user-balance";async function ld(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),a=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!a.ok)throw new Error(`Failed to fetch token balance: ${a.status}`);let i=await a.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function qt(e,t,n=!0){let o=Ie[e],r=[o.cross,o.bsc],a=(0,Wa.useQueries)({queries:r.map(c=>({queryKey:[Ho,e,t,c],queryFn:async({signal:f})=>ld(await ae("walletServer",e),c,t,f),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),i=a.some(c=>c.isLoading),l=a.some(c=>c.isError);return{tokens:(0,Da.useMemo)(()=>{let c=[];for(let f of a)f.data&&c.push(...f.data);return c},[a]),isLoading:i,isError:l}}var Uo=require("@tanstack/react-query"),za=require("react");var cd="forge-holdings",dd="forge-token-image";async function pd(e,t,n){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let r=await o.json();if(!r.success)throw new Error("Forge holdings API error");return r.data.items}async function fd(e,t,n){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:n});if(!o.ok)return{address:t,image_url:""};let r=await o.json();return r.success?{address:t,image_url:r.data.token.image_url}:{address:t,image_url:""}}function Ga(e,t,n=!0){let{data:o,...r}=(0,Uo.useQuery)({queryKey:[cd,e,t],queryFn:async({signal:a})=>pd(await ae("bondingCurve",e),t,a),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:o??[],...r}}function Ha(e,t,n=!0){let o=(0,Uo.useQueries)({queries:t.map(a=>({queryKey:[dd,e,a],queryFn:async({signal:i})=>fd(await ae("bondingCurve",e),a,i),enabled:n,staleTime:1/0}))});return{imageMap:(0,za.useMemo)(()=>{let a=new Map;for(let i of o)i.data&&a.set(i.data.address,i.data.image_url);return a},[o])}}var Ua=require("@tanstack/react-query"),$a=require("react");var $o="token-stats";function Nt(e,t){return`${e}:${t.toLowerCase()}`}function Kt(e,t=!0){let{data:n,...o}=(0,Ua.useQuery)({queryKey:[$o,e],queryFn:async({signal:a})=>{let i=await ae("walletServer",e),l=await fetch(`${i}/v1/public/token/stats`,{cache:"no-store",signal:a});if(!l.ok)throw new Error(`Failed to fetch token stats: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token stats API error: ${d.code}`);return d},enabled:t,staleTime:3e4});return{statsMap:(0,$a.useMemo)(()=>{let a=new Map;if(!n?.data)return a;for(let i of n.data){let l=Nt(i.chain_id,i.address);a.set(l,i)}return a},[n]),...o}}var ja=require("@tanstack/react-query"),ud="crossd-apy",md="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function Va(){let{data:e,...t}=(0,ja.useQuery)({queryKey:[ud],queryFn:async({signal:n})=>{let o=await fetch(md,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch CROSSD overview: ${o.status}`);let r=await o.json();if(r.code!==200)throw new Error(`CROSSD overview API error: ${r.code}`);let a=parseFloat(r.data.est_last_epoch_apy);if(!Number.isFinite(a))throw new Error("CROSSD overview returned a non-numeric APY");return a*100},staleTime:6e4});return{apyPercent:e??null,...t}}var qa=require("@tanstack/react-query"),Ka=require("react");var gd="token-info";function Wr(e,t){return`${t.toLowerCase()}_${e}`}function Qa(e,t=!0){let{data:n,...o}=(0,qa.useQuery)({queryKey:[gd,e],queryFn:async({signal:a})=>{let i=await ae("walletServer",e),l=await fetch(`${i}/v1/public/token/info`,{cache:"no-store",signal:a});if(!l.ok)throw new Error(`Failed to fetch token info: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:1/0});return{categoryMap:(0,Ka.useMemo)(()=>{let a=new Map;if(!n?.data)return a;for(let i of n.data){let l=Wr(i.chain_id,i.address);a.set(l,i.category)}return a},[n]),...o}}var Ya=require("react"),jo=U(require("bignumber.js"),1);function Za(e,t,n){let{tokens:o,isLoading:r}=qt(e,t,n),{statsMap:a}=Kt(e,n);return(0,Ya.useMemo)(()=>{let i=new jo.default(0);for(let f of o){let w=a.get(Nt(f.chainId,f.address));if(!w)continue;let g=new jo.default(f.quantity.numeric).shiftedBy(-f.quantity.decimals).multipliedBy(new jo.default(w.price));g.isNaN()||(i=i.plus(g))}let l=i.toFixed(),{displayValue:d,isLowerBound:c}=Ji(l);return{totalUsd:l,displayValue:d,isLowerBound:c,isLoading:r}},[o,a,r])}var Bl=require("qrcode.react");function nt(e,t,n,o){if(!o||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let r;try{r=o(t,n)}catch(c){console.error("[dapp-ui] onOutlink threw:",c);return}let a=c=>{typeof window>"u"||window.open(c,"_blank","noopener,noreferrer")};if((c=>!!c&&(typeof c=="object"||typeof c=="function")&&typeof c.then=="function")(r)){let c=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,f=w=>{if(w===null){c?.close();return}let h=w??t;if(c)try{c.location.href=h}catch{c.close(),a(h)}else a(h)};r.then(f,w=>{console.error("[dapp-ui] onOutlink rejected:",w),c?.close()});return}let l=r;if(l===null)return;a(l??t)}var xn=U(require("react"),1),al=require("vaul");var An=require("react");var pt=U(require("bignumber.js"),1),hd=/^(\d{4}-\d{2}-\d{2})/;function Xa(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:a}of e.map(i=>({key:hd.exec(i.reference_date)?.[1],cumulative:i.cumulative_earned})).filter(i=>!!i.key&&i.cumulative!=null).sort((i,l)=>i.key<l.key?-1:i.key>l.key?1:0))t.set(r,a),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function Vo(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ja(e){return e.length<=13?e:`${e.slice(0,6)}...${e.slice(-4)}`}var bd="0xe00e8bf3";function es(e,t){let n=typeof e=="bigint"?e:BigInt(e);if(n<0n)throw new Error("poolId must be non-negative");if(t<0n)throw new Error("amount must be non-negative");let o=n.toString(16).padStart(64,"0"),r=t.toString(16).padStart(64,"0");return`${bd}${o}${r}`}function Dr(e){return!e||e<=0n?"0":new pt.default(e.toString()).shiftedBy(-9).toFormat(2,pt.default.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function ts(e){return!e||e<=0n?"0":new pt.default(e.toString()).toFormat(0,pt.default.ROUND_DOWN)}function ns(e){if(!e||e<=0n)return"0";let t=new pt.default(e.toString()).shiftedBy(-18),n=t.isLessThan(1e-4)?7:4;return t.toFormat(n,pt.default.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function It(e,t){let n=new pt.default(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,pt.default.ROUND_DOWN):n.toFormat(4,pt.default.ROUND_DOWN)}function zr(e){return It(e,0)}var Kn={rate:1,symbol:"$"};function Qn(e,t=Kn){let n=Number.isFinite(t.rate)&&t.rate>0?t.rate:1;return`${t.symbol||"$"}${e.times(n).toFormat(2,pt.default.ROUND_DOWN)}`}function en(e,t,n,o=Kn){let r=new pt.default(n||"0");if(!r.isFinite()||r.isLessThanOrEqualTo(0))return null;let a=new pt.default(e||"0").shiftedBy(-t).times(r);return a.isFinite()?Qn(a,o):null}var Yn=(0,An.createContext)(null);function je(){let e=(0,An.useContext)(Yn);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}function Wt(){let{conversionRatio:e,currencySymbol:t}=je();return(0,An.useMemo)(()=>({rate:typeof e=="number"&&e>0?e:Kn.rate,symbol:t||Kn.symbol}),[e,t])}var os=require("vaul");var Gr=require("react/jsx-runtime");function rs({asChild:e,children:t}){let{walletAddress:n}=je(),o=t!=null,r=e??!0,a=o?t:(0,Gr.jsx)("button",{type:"button",children:dt(n)});return(0,Gr.jsx)(os.Drawer.Trigger,{asChild:r,children:a})}var eo=require("vaul");var Ne=U(require("react"),1),rl=require("@tanstack/react-query");var qo=require("react"),Hr=(0,qo.createContext)(null);function is(){return(0,qo.useContext)(Hr)}var Ae=require("react/jsx-runtime");function as({size:e=22,className:t}){return(0,Ae.jsx)("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,Ae.jsx)("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ss({size:e=22,className:t}){return(0,Ae.jsxs)("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,Ae.jsx)("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ae.jsx)("path",{d:"M16.17 13.75a7.333 7.333 0 11-1.54-7.59L18.333 9.167",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ls({size:e=16,className:t}){return(0,Ae.jsxs)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,Ae.jsx)("path",{d:"M5.333 5.333V4a1.333 1.333 0 011.334-1.333h5.333A1.333 1.333 0 0113.333 4v5.333a1.333 1.333 0 01-1.333 1.334h-1.333",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ae.jsx)("path",{d:"M4 5.333h5.333c.737 0 1.334.597 1.334 1.334V12c0 .736-.597 1.333-1.334 1.333H4A1.333 1.333 0 012.667 12V6.667C2.667 5.93 3.263 5.333 4 5.333z",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cs({size:e=16,className:t}){return(0,Ae.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,Ae.jsx)("path",{d:"M13.333 4L6 11.333 2.667 8",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function ds({size:e=48,className:t}){return(0,Ae.jsxs)("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,Ae.jsx)("circle",{cx:"24",cy:"24",r:"24",fill:"currentColor"}),(0,Ae.jsx)("path",{d:"M14 24.5l6.6 6.6L34.5 17.5",stroke:"var(--wp-claim-success-mark, #ffffff)",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Et({size:e=12,className:t}){return(0,Ae.jsxs)("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[(0,Ae.jsx)("path",{d:"M5 2H2.5A1.5 1.5 0 0 0 1 3.5V9.5A1.5 1.5 0 0 0 2.5 11H8.5A1.5 1.5 0 0 0 10 9.5V7",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ae.jsx)("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Ae.jsx)("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}var Es=U(require("react"),1);var ps=require("@tanstack/react-query"),Ur=require("react");var wd="wp:reward-pools";function Pn(e,t=!0){let{data:n,...o}=(0,ps.useQuery)({queryKey:[wd,e],queryFn:async({signal:i})=>{let l=await ae("gameReward",e),d=await fetch(`${l}/v1/pools`,{cache:"no-store",signal:i});if(!d.ok)throw new Error(`Failed to fetch pools: ${d.status}`);let c=await d.json();if(c.code!==200)throw new Error(`Pools API error: ${c.code}`);return c},enabled:t,staleTime:0}),r=(0,Ur.useMemo)(()=>n?.data.pools.filter(i=>i.pool_type==="CrossPool")??[],[n]),a=(0,Ur.useMemo)(()=>n?.data.pools.filter(i=>i.pool_type==="GamePool")??[],[n]);return{crossPools:r,gamePools:a,allPools:n?.data.pools??[],...o}}var fs=require("@tanstack/react-query"),us=require("react");var xd="wp:user-deposits";function Ko(e,t,n=!0){let o=n&&!!t,{data:r,...a}=(0,fs.useQuery)({queryKey:[xd,e,t],queryFn:async({signal:l})=>{let d=await ae("gameReward",e),c=await fetch(`${d}/v1/users/${t}/deposits`,{cache:"no-store",signal:l});if(!c.ok)throw new Error(`Deposits fetch failed: ${c.status}`);let f=await c.json();if(f.code!==200)throw new Error(`Deposits API error: ${f.code}`);return f},enabled:o,staleTime:0});return{depositMap:(0,us.useMemo)(()=>{let l=new Map;if(!r?.data.user_deposits)return l;for(let d of r.data.user_deposits)l.set(d.pool_address.toLowerCase(),d);return l},[r]),deposits:r?.data.user_deposits??[],...a}}var xs=require("@tanstack/react-query"),vs=require("react");var ms={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},gs={dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://www.onechain.nexus/points"};var hs={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"};var $r={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},bs={dev:`${$r.dev}/portfolio`,stage:`${$r.stage}/portfolio`,production:`${$r.production}/portfolio`};var ws={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Dt={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",production:"https://contents.crosstoken.io/frontend/common/app-launcher/icons"};var vd="wp:token-info";function Qo(e,t=!0){let n=Ie[e].cross,{data:o,...r}=(0,xs.useQuery)({queryKey:[vd,e],queryFn:async({signal:d})=>{let c=await ae("walletServer",e),f=await fetch(`${c}/v1/public/token/info`,{cache:"no-store",signal:d});if(!f.ok)throw new Error(`Failed to fetch token info: ${f.status}`);let w=await f.json();if(w.code!==200)throw new Error(`Token info API error: ${w.code}`);return w},enabled:t,staleTime:300*1e3}),{byChainAddr:a,byChainSym:i}=(0,vs.useMemo)(()=>{let d=new Map,c=new Map;if(!o?.data)return{byChainAddr:d,byChainSym:c};for(let f of o.data){let w=f.address.toLowerCase();d.set(`${f.chain_id}:${w}`,f),d.set(w,f);let h=f.symbol.replace(/^t/,"").toUpperCase(),g=`${f.chain_id}:${h}`;c.has(g)||c.set(g,f),c.has(h)||c.set(h,f)}return{byChainAddr:d,byChainSym:c}},[o]);return{getTokenImage:(d,c)=>{let f=d.toLowerCase(),w=a.get(`${n}:${f}`);if(w?.image)return w.image;let h=a.get(f);if(h?.image)return h.image;if(c){let g=c.replace(/^t/,"").toUpperCase(),y=i.get(`${n}:${g}`);if(y?.image)return y.image;let b=i.get(g);if(b?.image)return b.image}return""},...r}}var ks=require("@tanstack/react-query"),Xn=require("react");var yd="0x70a08231",kd="0x18160ddd",Sd="0x313ce567",Rd=8e3;async function Cd(e,t,n,o){let r=new AbortController,a=setTimeout(()=>r.abort(),Rd);o&&o.addEventListener("abort",()=>r.abort(),{once:!0});let i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:r.signal}).finally(()=>clearTimeout(a));if(!i.ok)throw new Error(`RPC ${t} HTTP ${i.status}`);let l=await i.json();if(l.error)throw new Error(`RPC ${t}: ${l.error.message}`);if(l.result===void 0)throw new Error(`RPC ${t}: empty result`);return l.result}function Td(e){return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function Zn(e){if(!(!e||e==="0x"))try{return BigInt(e)}catch{return}}async function gn(e,t,n,o){try{return await Cd(e,"eth_call",[{to:t,data:n},"latest"],o)}catch{return}}async function Nd(e,t,n,o){let[r,a,i]=await Promise.all([gn(e,n,yd+Td(t),o),gn(e,n,kd,o),gn(e,n,Sd,o)]),l=Zn(r);if(l===void 0)return null;let d=Zn(i);return{balance:l,totalSupply:Zn(a),decimals:d!==void 0?Number(d):void 0}}async function jr(e,t){let n=Ie[e].cross,o=await ae("walletServer",e),r=await fetch(`${o}/v1/public/chain/info/${n}`,{cache:"no-store",signal:t});if(!r.ok)return;let a=await r.json();return("data"in a&&a.data!==void 0?Array.isArray(a.data)?a.data[0]:a.data:a)?.rpc||void 0}async function ys(e,t,n,o){if(!t||n.length===0)return{};let r;try{r=await jr(e,o)}catch{r=void 0}if(!r)return{};let a=await Promise.all(n.map(async l=>[l.toLowerCase(),await Nd(r,t,l,o)])),i={};for(let[l,d]of a)d&&(i[l]=d);return i}var Id="wp:withdraw-token-meta",Ed="0xc89039c5",Ld="0x95d89b41",Ad="0x313ce567";function Pd(e){if(!(!e||e==="0x"))try{let t=e.replace(/^0x/,""),n=Number(BigInt("0x"+t.slice(64,128)));if(!Number.isFinite(n)||n<=0||n>64)return;let o=t.slice(128,128+n*2),r="";for(let a=0;a<o.length;a+=2)r+=String.fromCharCode(parseInt(o.slice(a,a+2),16));return r||void 0}catch{return}}function Fd(e){if(!e||e==="0x")return;let n="0x"+e.replace(/^0x/,"").padStart(64,"0").slice(24,64);return/^0x[a-f0-9]{40}$/.test(n)&&n!=="0x0000000000000000000000000000000000000000"?n:void 0}async function Bd(e,t,n){if(t.length===0)return{};let o;try{o=await jr(e,n)}catch{o=void 0}if(!o)return{};let r=await Promise.all(t.map(async i=>{let l=Fd(await gn(o,i,Ed,n));if(!l)return[i.toLowerCase(),null];let[d,c]=await Promise.all([gn(o,l,Ld,n),gn(o,l,Ad,n)]),f=Pd(d),w=Zn(c);return f?[i.toLowerCase(),{tokenAddress:l,symbol:f,decimals:w!==void 0?Number(w):18}]:[i.toLowerCase(),null]})),a={};for(let[i,l]of r)l&&(a[i]=l);return a}function Yo(e,t,n=!0){let r=n&&!!t,{allPools:a,isLoading:i}=Pn(e,r),{deposits:l,isLoading:d}=Ko(e,t,r),c=(0,Xn.useMemo)(()=>{let m=new Map;for(let v of a)m.set(v.pool_address.toLowerCase(),v);return m},[a]),f=(0,Xn.useMemo)(()=>l.filter(m=>{try{return BigInt(m.deposited_amount||"0")>0n}catch{return!1}}),[l]),w=(0,Xn.useMemo)(()=>f.map(m=>m.pool_address.toLowerCase()).filter(m=>!c.has(m)).sort(),[f,c]),{data:h,isLoading:g}=(0,ks.useQuery)({queryKey:[Id,e,w],queryFn:({signal:m})=>Bd(e,w,m),enabled:r&&w.length>0,staleTime:1440*60*1e3});return{positions:(0,Xn.useMemo)(()=>{let m=[];for(let v of f){let R=v.pool_address.toLowerCase(),u=c.get(R);if(u){m.push({poolId:v.pool_id,poolAddress:v.pool_address,poolType:u.pool_type,tokenSymbol:u.deposit_token.symbol,tokenAddress:u.deposit_token.address,decimals:u.deposit_token.decimals,price:u.deposit_token.price,depositedRaw:v.deposited_amount});continue}let T=h?.[R];T&&m.push({poolId:v.pool_id,poolAddress:v.pool_address,poolType:"Unknown",tokenSymbol:T.symbol,tokenAddress:T.tokenAddress,decimals:T.decimals,depositedRaw:v.deposited_amount})}return m},[f,c,h]),isLoading:i||d||g}}var Vr=U(require("react"),1);var hn=require("react/jsx-runtime");function zt({sectionKey:e,title:t,icon:n,iconFit:o="cover",isEmpty:r,loading:a=!1,children:i}){let l=is();return Vr.useEffect(()=>{l?.report(e,{loading:a,empty:r})},[l,e,a,r]),Vr.useEffect(()=>()=>l?.unregister(e),[l,e]),r?null:(0,hn.jsxs)("div",{className:"wp-svc-card",children:[(0,hn.jsxs)("div",{className:"wp-svc-card-head",children:[(0,hn.jsx)("img",{className:"wp-svc-card-icon",src:n,alt:"",style:{objectFit:o}}),(0,hn.jsx)("span",{className:"wp-svc-card-title",children:t})]}),(0,hn.jsx)("div",{className:"wp-svc-items",children:i})]})}var xe=U(require("react"),1);var C=require("react/jsx-runtime"),_d=/^\d*\.?\d{0,2}$/,Md=[100n,1000n,2000n],Od=400;function Wd(e,t){if(t==="loading")return"Estimating...";if(!e||t==="error"||t==="unavailable")return"Wallet estimate";let n=e.maxFeePerGas??e.gasPrice;return!n||n<=0n||e.gasLimit<=0n?"Wallet estimate":`${ns(e.gasLimit*n)} CROSS`}function qr(e,t,n){return n==="loading"?"Estimating...":n==="error"||n==="unavailable"?"-":`${e} ${t}`.trim()}function Ss({position:e,size:t}){return e.icon?(0,C.jsx)("img",{src:e.icon,alt:"",width:t,height:t}):(0,C.jsx)("span",{children:e.tokenSymbol.slice(0,1)})}function Zo({open:e,status:t,positions:n,initialPoolAddress:o,walletAddress:r,txHash:a,error:i,copied:l=!1,estimateWithdraw:d,onClose:c,onConfirm:f,onCopyHash:w}){let[h,g]=xe.useState(void 0),[y,b]=xe.useState(""),[m,v]=xe.useState(null),[R,u]=xe.useState("idle"),T=xe.useRef(0),k=xe.useRef(void 0),N=xe.useRef(null);xe.useEffect(()=>()=>clearTimeout(k.current),[]);let S=xe.useMemo(()=>{let F=(h??o)?.toLowerCase();return n.find(ne=>ne.poolAddress.toLowerCase()===F)??n[0]??null},[n,h,o]),G=xe.useMemo(()=>{try{return BigInt(S?.depositedRaw??"0")}catch{return 0n}},[S?.depositedRaw]),O=S?.decimals??18,H=xe.useMemo(()=>{let F=jt(y,O);return"value"in F?F.value:null},[y,O]),B=H!==null&&H>G,le=t==="confirm"&&!!S&&H!==null&&H>0n&&!B,I=xe.useCallback(()=>{b(""),v(null),u(d?"idle":"unavailable"),T.current+=1,N.current=null},[]);xe.useEffect(()=>{e&&(g(o),I())},[e]);let ie=xe.useCallback(F=>{t==="confirm"&&(g(F.poolAddress),I())},[t,I]);xe.useEffect(()=>{if(!e||t!=="confirm"){clearTimeout(k.current);return}if(!d||!S){clearTimeout(k.current),u("unavailable");return}if(H===null||H<=0n||B){clearTimeout(k.current),T.current+=1,N.current=null,v(null),u("idle");return}let F=`${S.poolAddress.toLowerCase()}:${H.toString()}`;if(N.current===F)return;N.current=F,clearTimeout(k.current);let ne=T.current+1;T.current=ne,u("loading"),k.current=setTimeout(()=>{d(S,H).then(be=>{T.current===ne&&(v(be??null),u(be?"ready":"unavailable"))}).catch(()=>{T.current===ne&&(v(null),u("error"))})},Od)},[e,t,H,B,d,S]);let W=xe.useCallback(F=>{let ne=F.target.value.replace(/,/g,"");(ne===""||_d.test(ne))&&b(ne)},[]),q=xe.useCallback(F=>{b(jn(F.toString(),O))},[O]),ye=xe.useCallback(F=>{let ne=10n**BigInt(O),De=(H??0n)+F*ne;q(De>G?G:De)},[H,O,G,q]),te=xe.useCallback(()=>{q(G)},[G,q]);if(!e||!S)return null;let $=t==="submitting",he=Dr(m?.maxPriorityFeePerGas),fe=Dr(m?.maxFeePerGas??m?.gasPrice),j=ts(m?.gasLimit),Be=It(S.depositedRaw,O);return(0,C.jsx)("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:F=>{F.target===F.currentTarget&&!$&&c()},children:(0,C.jsxs)("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-withdraw-title","data-status":t,"data-vaul-no-drag":!0,children:[(0,C.jsx)("div",{className:"wp-claim-grabber","aria-hidden":!0,children:(0,C.jsx)("span",{})}),(0,C.jsxs)("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&a?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:(0,C.jsx)(ds,{})}),(0,C.jsxs)("div",{className:"wp-claim-copy",children:[(0,C.jsx)("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),(0,C.jsx)("p",{className:"wp-claim-desc",children:"Your withdrawal request has been submitted. Balances will update shortly after the transaction settles."})]}),(0,C.jsx)("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:(0,C.jsxs)("div",{className:"wp-claim-list-item",children:[(0,C.jsx)("span",{children:"Tx Hash"}),(0,C.jsxs)("button",{type:"button",className:"wp-claim-hash",onClick:w,"aria-label":"Copy transaction hash",children:[(0,C.jsx)("strong",{children:Ja(a)}),l?(0,C.jsx)(cs,{}):(0,C.jsx)(ls,{})]})]})})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{className:"wp-claim-heading",children:[(0,C.jsx)("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:t==="error"?"Withdraw Failed":"Withdraw"}),t==="error"&&(0,C.jsx)("p",{className:"wp-claim-error-message",children:i||"The withdraw request could not be completed."})]}),n.length>1&&(0,C.jsx)("div",{className:"wp-withdraw-token-list",role:"listbox","aria-label":"Withdrawable tokens",children:n.map(F=>{let ne=F.poolAddress.toLowerCase()===S.poolAddress.toLowerCase();return(0,C.jsxs)("button",{type:"button",role:"option","aria-selected":ne,className:"wp-withdraw-token","data-selected":ne||void 0,disabled:$,onClick:()=>ie(F),children:[(0,C.jsx)("span",{className:"wp-withdraw-token-icon","aria-hidden":!0,children:(0,C.jsx)(Ss,{position:F,size:28})}),(0,C.jsx)("span",{className:"wp-withdraw-token-symbol",children:F.tokenSymbol}),(0,C.jsx)("span",{className:"wp-withdraw-token-amount",children:It(F.depositedRaw,F.decimals)})]},F.poolAddress)})}),(0,C.jsxs)("div",{className:"wp-claim-reward-card","aria-label":"Deposited balance",children:[(0,C.jsx)("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:(0,C.jsx)(Ss,{position:S,size:28})}),(0,C.jsx)("strong",{className:"wp-claim-reward-symbol",children:S.tokenSymbol}),(0,C.jsx)("strong",{className:"wp-claim-reward-amount",children:Be})]}),(0,C.jsxs)("div",{className:"wp-withdraw-amount-card",children:[(0,C.jsxs)("div",{className:"wp-withdraw-amount-row",children:[(0,C.jsx)("input",{className:"wp-withdraw-input",type:"text",inputMode:"decimal",autoComplete:"off",placeholder:"0",value:y,disabled:$,onChange:W,"aria-label":`Withdraw amount (${S.tokenSymbol})`,"aria-invalid":B||void 0}),(0,C.jsx)("span",{className:"wp-withdraw-input-symbol",children:S.tokenSymbol})]}),B&&(0,C.jsx)("p",{className:"wp-claim-error-message",children:"Amount exceeds deposited balance."}),(0,C.jsxs)("div",{className:"wp-withdraw-quick-row",role:"group","aria-label":"Quick amounts",children:[Md.map(F=>(0,C.jsxs)("button",{type:"button",className:"wp-withdraw-quick",disabled:$,onClick:()=>ye(F),children:["+",F.toString()]},F.toString())),(0,C.jsx)("button",{type:"button",className:"wp-withdraw-quick",disabled:$,onClick:te,children:"MAX"})]})]}),(0,C.jsxs)("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:[(0,C.jsxs)("div",{className:"wp-claim-account-row",children:[(0,C.jsxs)("div",{className:"wp-claim-account",children:[(0,C.jsx)("span",{className:"wp-claim-account-avatar","aria-hidden":!0}),(0,C.jsxs)("strong",{children:[S.tokenSymbol," Pool"]})]}),(0,C.jsx)("span",{children:Vo(r)})]}),(0,C.jsx)("span",{className:"wp-claim-divider","aria-hidden":!0}),(0,C.jsxs)("div",{className:"wp-claim-detail-list",children:[(0,C.jsxs)("div",{className:"wp-claim-detail-row",children:[(0,C.jsx)("span",{children:"Est. Tx Fee"}),(0,C.jsx)("strong",{children:Wd(m,R)})]}),(0,C.jsxs)("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[(0,C.jsx)("span",{children:"Priority Fee Per Gas"}),(0,C.jsx)("strong",{children:qr(he,"Gwei",R)})]}),(0,C.jsxs)("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[(0,C.jsx)("span",{children:"Max Fee Per Gas"}),(0,C.jsx)("strong",{children:qr(fe,"Gwei",R)})]}),(0,C.jsxs)("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[(0,C.jsx)("span",{children:"Gas Limit"}),(0,C.jsx)("strong",{children:qr(j,"",R)})]})]})]})]}),(0,C.jsxs)("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&(0,C.jsx)("button",{type:"button",className:"wp-claim-secondary",onClick:c,children:t==="error"?"Close":"Cancel"}),(0,C.jsxs)("button",{type:"button",className:"wp-claim-primary",onClick:()=>{if(t==="success"){c();return}S&&H!==null&&H>0n&&!B&&f(S,H,m)},disabled:$||(t==="confirm"||t==="error")&&(H===null||H<=0n||B),children:[t==="success"&&"Done",t==="submitting"&&(0,C.jsx)("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}),t==="error"&&"Try Again",t==="confirm"&&"Withdraw Now"]})]})]}),(0,C.jsx)("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:(0,C.jsx)("span",{})})]})})}var Pe=U(require("react"),1),Ns=require("@tanstack/react-query");var Rs=require("@tanstack/react-query");var Dd="wp:reward-factory-info";function Cs(e,t=!0){let{data:n,...o}=(0,Rs.useQuery)({queryKey:[Dd,e],queryFn:async({signal:r})=>{let a=await ae("gameReward",e),i=await fetch(`${a}/v1/factory/info`,{cache:"no-store",signal:r});if(!i.ok)throw new Error(`Factory info fetch failed: ${i.status}`);let l=await i.json();if(l.code!==200)throw new Error(`Factory info API error: ${l.code}`);return l},enabled:t,staleTime:0});return{factoryInfo:n?.data??null,routerAddress:n?.data.router_address??"",...o}}var zd="wp:";function Ts(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function Xo(){let{env:e,walletAddress:t,sendTransaction:n,estimateGas:o}=je(),r=!!t,a=!!n,i=(0,Ns.useQueryClient)(),{routerAddress:l}=Cs(e,r&&a),d=Ts(l),[c,f]=Pe.useState(!1),[w,h]=Pe.useState(void 0),[g,y]=Pe.useState("confirm"),[b,m]=Pe.useState(),[v,R]=Pe.useState(""),[u,T]=Pe.useState(!1),k=Pe.useRef(void 0);Pe.useEffect(()=>()=>clearTimeout(k.current),[]);let N=Pe.useCallback((I,ie)=>d?{to:d,value:0n,data:es(I,ie),chainId:Ie[e].cross}:null,[e,d]),S=Pe.useCallback(()=>{i.invalidateQueries({predicate:I=>typeof I.queryKey[0]=="string"&&I.queryKey[0].startsWith(zd)})},[i]),G=Pe.useCallback(I=>{h(I),f(!0),y("confirm"),m(void 0),R(""),T(!1)},[]),O=Pe.useCallback(()=>{g!=="submitting"&&(f(!1),h(void 0),y("confirm"),m(void 0),R(""),T(!1),g==="success"&&S())},[g,S]),H=Pe.useCallback(async(I,ie)=>{if(!o)return null;let W=N(I.poolId,ie),q=Ts(t);return!W||!q?null:o({...W,from:q})},[N,o,t]),B=Pe.useCallback(async()=>{if(!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b),T(!0),clearTimeout(k.current),k.current=setTimeout(()=>T(!1),1400)}catch{T(!1)}},[b]),le=Pe.useCallback(async(I,ie,W)=>{if(!n){y("error"),R("Withdraw is not available for this wallet.");return}if(!d){y("error"),R("Withdraw contract address is not available.");return}try{y("submitting"),R("");let q=N(I.poolId,ie);if(!q){y("error"),R("Withdraw contract address is not available.");return}let ye=await n({...q,gas:W?.gasLimit&&W.gasLimit>0n?W.gasLimit:void 0,maxFeePerGas:W?.maxFeePerGas&&W.maxFeePerGas>0n?W.maxFeePerGas:void 0,maxPriorityFeePerGas:W?.maxPriorityFeePerGas&&W.maxPriorityFeePerGas>0n?W.maxPriorityFeePerGas:void 0});m(ye),y("success"),S()}catch(q){y("error"),R(q instanceof Error?q.message:"Failed to request withdraw.")}},[N,S,d,n]);return{canWithdrawInline:a,isOpen:c,initialPoolAddress:w,status:g,txHash:b,error:v,copied:u,hasEstimator:!!o,openWithdraw:G,closeWithdraw:O,estimateWithdraw:H,confirmWithdraw:le,copyHash:B}}var Jo=U(require("bignumber.js"),1),X=require("react/jsx-runtime"),Gd="CROSS Rewards";function Is(e){return new Jo.default(e||"0").isGreaterThan(0)}function Ls(){let{env:e,walletAddress:t,onOutlink:n}=je(),o=Wt(),r=!!t,{allPools:a,isLoading:i}=Pn(e,r),{depositMap:l,isLoading:d}=Ko(e,t,r),{getTokenImage:c}=Qo(e,r),f=Xo(),{positions:w}=Yo(e,t,r&&f.canWithdrawInline),h=Es.useMemo(()=>w.filter(m=>m.poolType==="CrossPool").map(m=>({...m,icon:c(m.tokenAddress,m.tokenSymbol)})),[w,c]),g=(m,v)=>`${ms[e]}/rewards/${m.pool_address}?action=${v}`,y=`${Dt[e]}/reward.png`,b=a.filter(m=>{let v=l.get(m.pool_address.toLowerCase()),R=v?.deposited_amount??"0",u=v?.claimable_reward??"0";return!(new Jo.default(R).isZero()&&new Jo.default(u).isZero())});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zt,{sectionKey:"rewards",title:Gd,icon:y,isEmpty:b.length===0,loading:i||d,children:b.map(m=>{let v=l.get(m.pool_address.toLowerCase()),R=v?.deposited_amount??"0",u=v?.claimable_reward??"0",T=g(m,"withdraw"),k=g(m,"claim"),N=c(m.deposit_token.address,m.deposit_token.symbol),S=m.reward_tokens[0],G=S?c(S.address,S.symbol):"",O=m.reward_tokens.map(te=>te.symbol),H=O.length>0?`${m.deposit_token.symbol}-${O.join("/")}`:m.deposit_token.symbol,B=S?It(u,S.decimals):"0",le=S?.symbol??"Reward",I=en(R,m.deposit_token.decimals,m.deposit_token.price,o),ie=S?en(u,S.decimals,S.price,o):null,W=!!v&&Is(u),q=!!v&&Is(R),ye=f.canWithdrawInline&&h.some(te=>te.poolAddress.toLowerCase()===m.pool_address.toLowerCase());return(0,X.jsxs)("article",{className:"wp-item","data-side":"reward",children:[(0,X.jsxs)("div",{className:"wp-item-body",children:[(0,X.jsxs)("div",{className:"wp-item-line",children:[(0,X.jsx)("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),(0,X.jsxs)("div",{className:"wp-svc-token",children:[(0,X.jsxs)("span",{className:"wp-token-stack","aria-hidden":!0,children:[N&&(0,X.jsx)("img",{className:"wp-svc-token-icon",src:N,alt:""}),G&&(0,X.jsx)("img",{className:"wp-svc-token-icon",src:G,alt:""})]}),(0,X.jsx)("span",{children:H})]})]}),(0,X.jsxs)("div",{className:"wp-item-line",children:[(0,X.jsx)("span",{className:"wp-item-label",children:"Deposited"}),(0,X.jsxs)("div",{className:"wp-svc-token wp-svc-token--amount",children:[N&&(0,X.jsx)("img",{className:"wp-svc-token-icon",src:N,alt:""}),(0,X.jsxs)("div",{className:"wp-svc-amount",children:[(0,X.jsx)("span",{className:"wp-svc-amount-main",children:It(R,m.deposit_token.decimals)}),I&&(0,X.jsx)("span",{className:"wp-item-usd",children:I})]})]})]}),(0,X.jsxs)("div",{className:"wp-item-line",children:[(0,X.jsxs)("span",{className:"wp-item-label",children:["Claimable (",le,")"]}),(0,X.jsxs)("div",{className:"wp-svc-token wp-svc-token--amount",children:[G&&(0,X.jsx)("img",{className:"wp-svc-token-icon",src:G,alt:""}),(0,X.jsxs)("div",{className:"wp-svc-amount",children:[(0,X.jsx)("span",{className:"wp-svc-amount-main",children:B}),ie&&(0,X.jsx)("span",{className:"wp-item-usd",children:ie})]})]})]})]}),(0,X.jsxs)("div",{className:"wp-item-tags",children:[ye?(0,X.jsx)("button",{type:"button",className:"wp-tag wp-tag--muted","data-disabled":!q||void 0,"aria-disabled":!q||void 0,onClick:()=>{q&&f.openWithdraw(m.pool_address)},children:(0,X.jsx)("span",{className:"wp-tag-label",children:"Withdraw"})}):(0,X.jsxs)("a",{className:"wp-tag wp-tag--muted",href:T,target:"_blank",rel:"noopener noreferrer",onClick:te=>nt(te,T,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:m,userDeposit:v}},n),children:[(0,X.jsx)("span",{className:"wp-tag-label",children:"Withdraw"}),(0,X.jsx)(Et,{size:12,className:"wp-tag-icon"})]}),(0,X.jsxs)("a",{className:"wp-tag wp-tag--mint","data-disabled":!W||void 0,"aria-disabled":!W||void 0,href:W?k:void 0,target:W?"_blank":void 0,rel:W?"noopener noreferrer":void 0,onClick:te=>{if(!W){te.preventDefault();return}nt(te,k,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:m,userDeposit:v}},n)},children:[(0,X.jsx)("span",{className:"wp-tag-label",children:"Claim"}),(0,X.jsx)(Et,{size:12,className:"wp-tag-icon"})]})]})]},m.pool_address)})}),(0,X.jsx)(Zo,{open:f.isOpen,status:f.status,positions:h,initialPoolAddress:f.initialPoolAddress,walletAddress:t,txHash:f.txHash,error:f.error,copied:f.copied,estimateWithdraw:f.hasEstimator?f.estimateWithdraw:void 0,onClose:f.closeWithdraw,onConfirm:f.confirmWithdraw,onCopyHash:f.copyHash})]})}var As=U(require("react"),1);var pe=require("react/jsx-runtime"),Hd="Points";function Ps(){let{env:e,walletAddress:t,onOutlink:n}=je(),o=Wt(),r=!!t,{getTokenImage:a}=Qo(e,r),i=Xo(),{positions:l,isLoading:d}=Yo(e,t,r),c=As.useMemo(()=>l.filter(h=>h.poolType!=="CrossPool").map(h=>({...h,icon:a(h.tokenAddress,h.tokenSymbol)})),[l,a]),f=`${Dt[e]}/point.png`,w=gs[e];return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(zt,{sectionKey:"points",title:Hd,icon:f,isEmpty:c.length===0,loading:d,children:c.map(h=>{let g=h.price?en(h.depositedRaw,h.decimals,h.price,o):null;return(0,pe.jsxs)("article",{className:"wp-item","data-side":"reward",children:[(0,pe.jsxs)("div",{className:"wp-item-body",children:[(0,pe.jsxs)("div",{className:"wp-item-line",children:[(0,pe.jsx)("span",{className:"wp-item-label",children:"Token"}),(0,pe.jsxs)("div",{className:"wp-svc-token",children:[h.icon&&(0,pe.jsx)("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),(0,pe.jsx)("span",{children:h.tokenSymbol})]})]}),(0,pe.jsxs)("div",{className:"wp-item-line",children:[(0,pe.jsx)("span",{className:"wp-item-label",children:"Deposited"}),(0,pe.jsxs)("div",{className:"wp-svc-token wp-svc-token--amount",children:[h.icon&&(0,pe.jsx)("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),(0,pe.jsxs)("div",{className:"wp-svc-amount",children:[(0,pe.jsx)("span",{className:"wp-svc-amount-main",children:It(h.depositedRaw,h.decimals)}),g&&(0,pe.jsx)("span",{className:"wp-item-usd",children:g})]})]})]})]}),(0,pe.jsx)("div",{className:"wp-item-tags",children:i.canWithdrawInline?(0,pe.jsx)("button",{type:"button",className:"wp-tag wp-tag--muted",onClick:()=>i.openWithdraw(h.poolAddress),children:(0,pe.jsx)("span",{className:"wp-tag-label",children:"Withdraw"})}):(0,pe.jsxs)("a",{className:"wp-tag wp-tag--muted",href:w,target:"_blank",rel:"noopener noreferrer",onClick:y=>nt(y,w,{category:"portfolio",origin:"portfolio-points",payload:{position:h}},n),children:[(0,pe.jsx)("span",{className:"wp-tag-label",children:"Withdraw"}),(0,pe.jsx)(Et,{size:12,className:"wp-tag-icon"})]})})]},h.poolAddress)})}),(0,pe.jsx)(Zo,{open:i.isOpen,status:i.status,positions:c,initialPoolAddress:i.initialPoolAddress,walletAddress:t,txHash:i.txHash,error:i.error,copied:i.copied,estimateWithdraw:i.hasEstimator?i.estimateWithdraw:void 0,onClose:i.closeWithdraw,onConfirm:i.confirmWithdraw,onCopyHash:i.copyHash})]})}var Qr=U(require("react"),1);var Fs=require("@tanstack/react-query");var Ud="wp:stake-info";function Bs(e,t,n=!0){let o=n&&!!t,{data:r,...a}=(0,Fs.useQuery)({queryKey:[Ud,e,t],queryFn:async({signal:l})=>{let d=await ae("posa",e),c=await fetch(`${d}/stake/${t}`,{cache:"no-store",signal:l});if(!c.ok)throw new Error(`Stake info fetch failed: ${c.status}`);let f=await c.json();if(f.code!==0&&f.code!==200)throw new Error(`Stake info API error: ${f.code}`);return f},enabled:o,staleTime:0});return{stakeInfo:r?.data,...a}}var _s=require("@tanstack/react-query");var $d="wp:stake-rewards",jd=31;function Ms(e,t,n=!0){let o=n&&!!t,{data:r,...a}=(0,_s.useQuery)({queryKey:[$d,e,t],queryFn:async({signal:i})=>{let l=await ae("posa",e),d=await fetch(`${l}/rewards/${t}?limit=${jd}`,{cache:"no-store",signal:i});if(!d.ok)throw new Error(`Stake rewards fetch failed: ${d.status}`);let c=await d.json();if(c.code!==0&&c.code!==200)throw new Error(`Stake rewards API error: ${c.code}`);return c.data?.data??[]},enabled:o,staleTime:0});return{latestReward:r?.[0]??null,aprAccrued:Xa(r),...a}}var Os=require("@tanstack/react-query"),Vd="wp:staking-onchain";function Ws(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...a}=(0,Os.useQuery)({queryKey:[Vd,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...a}}var Kr=require("react"),Gs=U(require("bignumber.js"),1);function Ds(e){return e?.trim().toUpperCase()==="CROSS"}function zs(e){return new Gs.default(e||"0").isGreaterThan(0)}function er(e,t,n=!0){let{allPools:o}=Pn(e,n),r=(0,Kr.useMemo)(()=>{for(let c of o)for(let f of[c.deposit_token,...c.reward_tokens])if(Ds(f?.symbol)&&zs(f.price))return f.price},[o]),a=n&&r===void 0,{tokens:i}=qt(e,t,a),{statsMap:l}=Kt(e,a),d=Ie[e].cross;return(0,Kr.useMemo)(()=>{if(r)return r;let c=i.find(f=>f.chainId===d&&Ds(f.symbol));if(c){let f=l.get(Nt(c.chainId,c.address));if(f&&zs(f.price))return f.price}return"0"},[r,i,l,d])}var Qt=U(require("bignumber.js"),1),Re=require("react/jsx-runtime"),qd="CROSS Staking";function Kd(e){if(!e)return"\u2014";let t=new Qt.default(e);return t.isFinite()?`${t.toFormat(2,Qt.default.ROUND_DOWN)}%`:"\u2014"}function Hs(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=je(),r=Wt(),a=!!t,{stakeInfo:i,isLoading:l}=Bs(e,t,a),{latestReward:d,aprAccrued:c,isLoading:f}=Ms(e,t,a),{onchain:w}=Ws(t,o,a),h=er(e,t,a),g=`${Dt[e]}/cross-staking.png`,y=bs[e],b=i?.total_stake??"0",m=Qr.useMemo(()=>w?new Qt.default(w.earnedWei.toString()).shiftedBy(-18).toString(10):d?.cumulative_earned??i?.rewards_earned??"0",[w,d,i]),v=Qr.useMemo(()=>w?new Qt.default(w.stakedWei.toString()).shiftedBy(-18):new Qt.default(b),[w,b]),R=c!==void 0?new Qt.default(c):void 0,u=i?.days_since_first_stake,T=R!==void 0&&R.isFinite()&&v.isGreaterThan(0)&&u!==null&&u!==void 0?R.div(v).times(365).div(Math.max(1,u)).times(100):void 0,k=!(new Qt.default(b).isZero()&&new Qt.default(m).isZero()),N=en(b,0,h,r),S=en(m,0,h,r);return(0,Re.jsx)(zt,{sectionKey:"staking",title:qd,icon:g,iconFit:"contain",isEmpty:!k,loading:l||f,children:(0,Re.jsxs)("article",{className:"wp-item","data-side":"stake",children:[(0,Re.jsxs)("div",{className:"wp-item-body",children:[(0,Re.jsxs)("div",{className:"wp-item-line",children:[(0,Re.jsx)("span",{className:"wp-item-label",children:"Staked"}),(0,Re.jsxs)("div",{className:"wp-svc-amount",children:[(0,Re.jsxs)("span",{className:"wp-svc-amount-main",children:[zr(b)," CROSS"]}),N&&(0,Re.jsx)("span",{className:"wp-item-usd",children:N})]})]}),(0,Re.jsxs)("div",{className:"wp-item-line",children:[(0,Re.jsx)("span",{className:"wp-item-label",children:"Rewards Earned"}),(0,Re.jsxs)("div",{className:"wp-svc-amount",children:[(0,Re.jsxs)("span",{className:"wp-svc-amount-main",children:[zr(m)," CROSS"]}),S&&(0,Re.jsx)("span",{className:"wp-item-usd",children:S})]})]}),(0,Re.jsxs)("div",{className:"wp-item-line",children:[(0,Re.jsx)("span",{className:"wp-item-label",children:"My APR"}),(0,Re.jsx)("span",{children:Kd(T?.toString(10))})]})]}),(0,Re.jsx)("div",{className:"wp-item-tags",children:(0,Re.jsxs)("a",{className:"wp-tag wp-tag--mint",href:y,target:"_blank",rel:"noopener noreferrer",onClick:G=>nt(G,y,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:i}},n),children:[(0,Re.jsx)("span",{className:"wp-tag-label",children:"Manage"}),(0,Re.jsx)(Et,{size:12,className:"wp-tag-icon"})]})})]})})}var Yr=U(require("react"),1);var Us=require("@tanstack/react-query");var Qd="wp:game-swap-pools";function $s(e,t,n=!0){let o=n&&!!t,{data:r,...a}=(0,Us.useQuery)({queryKey:[Qd,e,t],queryFn:async({signal:i})=>{let l=await ae("gameSwap",e),d=await fetch(`${l}/addresses/${t}/portfolio`,{cache:"no-store",signal:i});if(!d.ok)throw new Error(`Game-swap portfolio fetch failed: ${d.status}`);return(await d.json()).pools??[]},enabled:o,staleTime:0});return{pools:r??[],...a}}var js=require("@tanstack/react-query");var Yd="wp:game-swap-lp-balances";function Vs(e,t,n,o){let r=[...n].map(d=>d.toLowerCase()).sort(),a=!!t&&r.length>0,{data:i,...l}=(0,js.useQuery)({queryKey:[Yd,e,t,r,!!o],queryFn:async({signal:d})=>{let c=o?await o(r):await ys(e,t,r,d),f={};for(let[w,h]of Object.entries(c))f[w.toLowerCase()]=h;return f},enabled:a,staleTime:0});return{balances:i??{},...l}}var Gt=U(require("bignumber.js"),1),ge=require("react/jsx-runtime"),Zd="Gametoken LP",Ks=18,Xd=new Gt.default("0.0001");function qs(e){return e?.trim().toUpperCase()==="CROSS"}function Jd(e){return e&&e>0?e:Ks}function ep(e){let t=qs(e.token_a?.symbol)&&!qs(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Jd(t?e.token_a?.decimals:e.token_b?.decimals),r=new Gt.default(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Gt.default(0):r.times(2)}function tp(e,t,n){let o=e.token_a?.symbol?.trim()||"TOKEN",r=e.token_b?.symbol?.trim()||"CROSS",a=t?.decimals??Ks,i,l;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let d=new Gt.default(t.balance.toString()),c=new Gt.default(t.totalSupply.toString()),f=d.div(c);i=f.times(100);let w=f.times(ep(e));if(w.isGreaterThan(0)){let h=new Gt.default(e.quote_usd??e.cross_usd??"0");l=h.isGreaterThan(0)?Qn(w.times(h),n):`${w.toFormat(4,Gt.default.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:o,tokenBSymbol:r,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:a,sharePercent:i,valueText:l}}function Qs(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=je(),r=Wt(),a=!!t,{pools:i,isLoading:l}=$s(e,t,a),d=Yr.useMemo(()=>i.map(b=>b.pair_address).filter(Boolean),[i]),{balances:c,isLoading:f}=Vs(e,t,d,o),w=`${Dt[e]}/dex.png`,h=Object.keys(c).length>0,g=Yr.useMemo(()=>{let b=i.map(m=>tp(m,c[m.pair_address?.toLowerCase()],r));return h?b.filter(m=>m.lpAmountRaw?new Gt.default(m.lpAmountRaw).shiftedBy(-m.lpDecimals).isGreaterThanOrEqualTo(Xd):!1):b},[i,c,h,r]),y=b=>{let m=b.token_a?.address??b.pair_address;return`${ws[e]}/tokens/${m}?trade=deposit`};return(0,ge.jsx)(zt,{sectionKey:"gameSwap",title:Zd,icon:w,iconFit:"contain",isEmpty:g.length===0,loading:l||f,children:g.map(b=>{let{pool:m}=b,v=y(m),R=`${b.tokenASymbol} / ${b.tokenBSymbol}`,u=m.token_a?.logo_url,T=m.token_b?.logo_url;return(0,ge.jsxs)("article",{className:"wp-item","data-side":"game-swap",children:[(0,ge.jsxs)("div",{className:"wp-item-body",children:[(0,ge.jsxs)("div",{className:"wp-item-line",children:[(0,ge.jsx)("span",{className:"wp-item-label",children:"Pool"}),(0,ge.jsxs)("div",{className:"wp-svc-token",children:[(0,ge.jsxs)("span",{className:"wp-token-stack","aria-hidden":!0,children:[u&&(0,ge.jsx)("img",{className:"wp-svc-token-icon",src:u,alt:""}),T&&(0,ge.jsx)("img",{className:"wp-svc-token-icon",src:T,alt:""})]}),(0,ge.jsx)("span",{children:R})]})]}),b.lpAmountRaw!==void 0&&(0,ge.jsxs)("div",{className:"wp-item-line",children:[(0,ge.jsx)("span",{className:"wp-item-label",children:"My LP"}),(0,ge.jsxs)("span",{children:[It(b.lpAmountRaw,b.lpDecimals)," LP"]})]}),b.sharePercent!==void 0&&(0,ge.jsxs)("div",{className:"wp-item-line",children:[(0,ge.jsx)("span",{className:"wp-item-label",children:"Pool Share"}),(0,ge.jsxs)("span",{children:[b.sharePercent.toFormat(2,Gt.default.ROUND_DOWN),"%"]})]}),b.valueText!==void 0&&(0,ge.jsxs)("div",{className:"wp-item-line",children:[(0,ge.jsx)("span",{className:"wp-item-label",children:"Value"}),(0,ge.jsx)("span",{children:b.valueText})]})]}),(0,ge.jsx)("div",{className:"wp-item-tags",children:(0,ge.jsxs)("a",{className:"wp-tag wp-tag--mint",href:v,target:"_blank",rel:"noopener noreferrer",onClick:k=>nt(k,v,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:m}},n),children:[(0,ge.jsx)("span",{className:"wp-tag-label",children:"Manage"}),(0,ge.jsx)(Et,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}var tn=U(require("bignumber.js"),1),tl=require("react");var Ys=require("@tanstack/react-query");var np="wp:forge-pools";function Zs(e,t,n=!0){let o=n&&!!t,{data:r,...a}=(0,Ys.useQuery)({queryKey:[np,e,t],queryFn:async()=>{let l=await ae("bondingCurve",e),d=await fetch(`${l}/v1/users/${t}/pools`,{cache:"no-store"});if(!d.ok)throw new Error(`forge pools fetch failed: ${d.status}`);return(await d.json()).data?.items??[]},enabled:o,staleTime:0}),i=r??[];return{pools:i,isEmpty:i.length===0,...a}}var Xs=require("@tanstack/react-query"),Js=require("react");var op="wp:forge-token-detail";async function rp(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function el(e,t,n=!0){let o=(0,Xs.useQueries)({queries:t.map(i=>({queryKey:[op,e,i],queryFn:async()=>rp(await ae("bondingCurve",e),i),enabled:n&&!!i,staleTime:3e4}))}),r=(0,Js.useMemo)(()=>{let i=new Map;for(let l=0;l<o.length;l++){let d=o[l]?.data,c=t[l];d&&c&&i.set(c.toLowerCase(),d)}return i},[o,t]),a=o.some(i=>i.isLoading);return{detailMap:r,isLoading:a}}var ve=require("react/jsx-runtime"),ip="Forge",nl=18,ap="https://contents.crosstoken.io/wallet/token/images/FT.png";function sp(e){if(!e||e==="0")return"0";let t=new tn.default(e).shiftedBy(-nl);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,tn.default.ROUND_DOWN):t.toFormat(4,tn.default.ROUND_DOWN)}function lp(e){let t=Number(e);return!Number.isFinite(t)||t<=0?"0%":t>=1?`${(Math.floor(t*100)/100).toFixed(2)}%`:`${(Math.floor(t*1e4)/1e4).toFixed(4)}%`}function cp(e,t,n,o){let r=new tn.default(n||"0");if(!r.isGreaterThan(0))return null;let a=new tn.default(e.total_supply||"0"),i=new tn.default(e.lp_balance||"0"),l=new tn.default(t?.reserve_b||"0").shiftedBy(-nl);if(!a.isGreaterThan(0)||!i.isGreaterThan(0)||!l.isGreaterThan(0))return null;let d=l.times(2),f=i.div(a).times(d).times(r);return f.isFinite()?Qn(f,o):null}function ol(){let{env:e,walletAddress:t,onOutlink:n}=je(),o=Wt(),r=!!t,{pools:a,isEmpty:i,isLoading:l}=Zs(e,t,r),d=(0,tl.useMemo)(()=>a.map(g=>g.token.address),[a]),{detailMap:c}=el(e,d,r&&d.length>0),f=er(e,t,r),w=g=>`${hs[e]}/forge/token/${g.token.address}`,h=`${Dt[e]}/forge.png`;return(0,ve.jsx)(zt,{sectionKey:"forge",title:ip,icon:h,iconFit:"contain",isEmpty:i,loading:l,children:a.map(g=>{let y=c.get(g.token.address.toLowerCase()),b=y?.image_url||y?.image||g.token.image||ap,m=y?.symbol||g.token.symbol,v=w(g),R=cp(g,y,f,o);return(0,ve.jsxs)("a",{className:"wp-item","data-side":"lp",href:v,target:"_blank",rel:"noopener noreferrer",onClick:u=>nt(u,v,{category:"portfolio",origin:"portfolio-forge",payload:{pool:g,tokenDetail:y}},n),children:[(0,ve.jsxs)("div",{className:"wp-item-body",children:[(0,ve.jsxs)("div",{className:"wp-item-line",children:[(0,ve.jsx)("span",{className:"wp-item-label",children:"Asset"}),(0,ve.jsxs)("div",{className:"wp-svc-token",children:[(0,ve.jsx)("img",{className:"wp-svc-token-icon",src:b,alt:""}),(0,ve.jsx)("span",{children:m}),y?.name&&(0,ve.jsx)("span",{className:"wp-token-subtle",children:y.name})]})]}),(0,ve.jsxs)("div",{className:"wp-item-line",children:[(0,ve.jsx)("span",{className:"wp-item-label",children:"LP Balance"}),(0,ve.jsx)("div",{className:"wp-svc-token wp-svc-token--amount",children:(0,ve.jsxs)("div",{className:"wp-svc-amount",children:[(0,ve.jsx)("span",{className:"wp-svc-amount-main",children:sp(g.lp_balance)}),R&&(0,ve.jsx)("span",{className:"wp-item-usd",children:R})]})})]}),(0,ve.jsxs)("div",{className:"wp-item-line",children:[(0,ve.jsx)("span",{className:"wp-item-label",children:"Ownership"}),(0,ve.jsx)("span",{className:"wp-line-value",children:lp(g.pool_ownership)})]})]}),(0,ve.jsx)("div",{className:"wp-item-tags",children:(0,ve.jsxs)("span",{className:"wp-tag wp-tag--muted",children:[(0,ve.jsx)("span",{className:"wp-tag-label",children:"Withdraw"}),(0,ve.jsx)(Et,{size:12,className:"wp-tag-icon"})]})})]},g.pair_address)})})}var Jn=["rewards","points","staking","gameSwap","forge"];Y(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--ds-bg-default, #202530);--wp-header-bg: var(--ds-surface-default, #252b39);--wp-card: var(--ds-surface-medium, #252b39);--wp-control: #292f40;--wp-border: var(--ds-border-default, #292f40);--wp-panel-border: var(--ds-border-medium, rgba(255, 255, 255, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .28);--wp-text: var(--ds-content-highest, #ffffff);--wp-text-60: var(--ds-content-high, rgba(255, 255, 255, .85));--wp-text-40: var(--ds-content-medium, rgba(255, 255, 255, .65));--wp-text-30: var(--ds-content-low, rgba(255, 255, 255, .4));--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, rgba(0, 160, 162, .14));--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #9b8cef;--wp-claim-primary-text: #202530;--wp-claim-secondary-bg: var(--wp-control);--wp-claim-success: #00d4aa;--wp-claim-success-soft: rgba(0, 212, 170, .18);--wp-claim-error: #ff3aa3;--wp-claim-error-soft: rgba(255, 58, 163, .16)}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--ds-bg-dim, #f5f7fa);--wp-header-bg: var(--ds-surface-default, #ffffff);--wp-card: var(--ds-surface-default, #ffffff);--wp-control: var(--ds-surface-medium, #f5f7fa);--wp-border: var(--ds-border-default, rgba(0, 0, 0, .07));--wp-panel-border: var(--ds-border-medium, rgba(0, 0, 0, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .15);--wp-text: var(--ds-content-highest, #000000);--wp-text-60: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-text-40: var(--ds-content-medium, rgba(0, 0, 0, .65));--wp-text-30: var(--ds-content-low, rgba(0, 0, 0, .4));--wp-chrome-text: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-card-shadow: none;--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, #e7f9f8);--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;position:relative;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:73px;padding:24px;position:relative;border-bottom:1px solid var(--wp-border);background:var(--wp-header-bg);color:var(--wp-chrome-text);flex-shrink:0;box-sizing:border-box}.wp-fullscreen .wp-header{height:60px;min-height:60px;padding:11px 20px;border-bottom:none;background:transparent}.wp-fullscreen .wp-header-btn{width:22px;height:22px;color:var(--wp-chrome-text)}.wp-fullscreen .wp-header-btn:hover{color:var(--wp-chrome-text)}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wp-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wp-header-edge{display:flex;align-items:center;width:24px;min-width:24px}.wp-header-edge--right{justify-content:flex-end}.wp-header-edge--right .wp-header-btn{position:absolute;top:24px;right:24px}.wp-header-spacer{display:block;width:24px;height:24px}.wp-header-avatar{width:38px;height:38px;flex-shrink:0;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:var(--wp-header-avatar-bg)}.wp-header-avatar-img{width:30px;height:30px;object-fit:cover;display:block}.wp-fullscreen[data-theme=dark] .wp-header-avatar,.wp-embed[data-theme=dark] .wp-header-avatar{--wp-header-avatar-bg: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;text-align:center;color:var(--ds-content-highest, #000000);margin:0}.wp-header-account{flex:1;display:flex;align-items:center;gap:12px;min-width:0}.wp-header-account-meta{display:flex;flex-direction:column;justify-content:center;min-width:0;gap:2px}.wp-header-wallet-name{min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:1.4;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-btn{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;padding:0;border:0;background:transparent;cursor:pointer;font:inherit}.wp-header-address{min-width:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-copy{display:inline-flex;align-items:center;flex-shrink:0;color:var(--wp-text-40);transition:color .15s ease}.wp-header-address-btn:hover .wp-header-address-copy{color:var(--wp-text-60)}.wp-header-address-copy[data-copied=true]{color:var(--wp-mint)}.wp-top{flex-shrink:0;padding:0 16px 16px;display:flex;flex-direction:column;gap:16px}.wp-identity{display:flex;flex-direction:column;gap:8px}.wp-address{display:inline-flex;align-items:center;gap:8px}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40)}.wp-total{font-size:28px;font-weight:600;line-height:1.3;color:var(--wp-text);margin:0}.wp-asset{display:flex;flex-direction:column;gap:8px}.wp-asset-head{display:flex;align-items:center;gap:4px}.wp-asset-head-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-asset-head-icon{display:inline-flex;color:var(--wp-text-40)}.wp-bar{display:flex;height:20px;border-radius:4px;overflow:hidden}.wp-bar-seg{display:flex;align-items:center;justify-content:center;min-width:8px}.wp-bar-seg-pct{font-size:10px;font-weight:400;line-height:1.3;color:#fff;white-space:nowrap}.wp-legend{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}.wp-legend-item{display:flex;align-items:center;gap:4px}.wp-legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.wp-legend-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-tabs{flex-shrink:0;padding:8px 16px}.wp-tabs-inner{display:flex;align-items:center;padding:0 2px}.wp-tabs-list{display:flex;gap:20px;flex:1}.wp-tab{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:44px;padding-top:12px;background:transparent;border:none;cursor:pointer}.wp-tab-text{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text-30);white-space:nowrap}.wp-tab[data-active=true] .wp-tab-text{color:var(--wp-mint)}.wp-tab-bar{width:20px;height:4px;border-radius:2px;background:var(--wp-mint);opacity:0}.wp-tab[data-active=true] .wp-tab-bar{opacity:1}.wp-tabs-filter-wrap{position:relative;display:flex;align-items:center;width:44px;height:44px;flex-shrink:0}.wp-tabs-filter-grad{position:absolute;inset:0;background:linear-gradient(to left,var(--wp-bg) 74%,transparent);pointer-events:none}.wp-tabs-filter{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text-40)}.wp-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wp-border) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:var(--wp-border);border-radius:4px}.wp-body-inner{padding:16px 16px 32px;display:flex;flex-direction:column;gap:32px}.wp-fullscreen .wp-body-inner{padding-top:8px;gap:24px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-summary-head{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:4px}.wp-summary-label{font-size:14px;font-weight:400;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address{display:inline-flex;align-items:center;gap:8px;min-width:0}.wp-address-avatar{width:16px;height:16px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 68% 34%,#ff78d1 0 18%,transparent 19%),radial-gradient(circle at 34% 66%,#00d4aa 0 20%,transparent 21%),linear-gradient(135deg,#7346f3,#0488fc)}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40);flex-shrink:0}.wp-summary-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#019d921a;color:var(--wp-mint);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;white-space:nowrap}.wp-summary-estimate{position:relative;display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.wp-estimate-info{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wp-text-40);cursor:help}.wp-estimate-tooltip{position:absolute;top:calc(100% + 8px);left:0;right:auto;z-index:3;display:flex;flex-direction:column;gap:8px;width:min(280px,calc(100vw - 48px));padding:12px;border-radius:8px;background:var(--wp-tooltip-bg);box-shadow:0 12px 32px #0000003d;color:var(--wp-tooltip-text);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(-4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-estimate-tooltip-title{display:block;font-size:12px;font-weight:600;line-height:1.3}.wp-estimate-tooltip-group{display:flex;flex-direction:column;gap:4px}.wp-estimate-tooltip-item{display:block;color:#ffffffc7}.wp-estimate-tooltip-item:before{content:"- "}.wp-estimate-info:hover .wp-estimate-tooltip,.wp-estimate-info:focus .wp-estimate-tooltip,.wp-estimate-info:focus-visible .wp-estimate-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-total{font-family:var( --wp-total-font-family, Sora, Inter, system-ui, -apple-system, sans-serif );font-size:36px;font-weight:600;line-height:1.25;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px;width:100%}.wp-svc-card-head{display:flex;align-items:center;gap:6px}.wp-svc-card-icon{width:24px;height:24px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:20px;width:100%;padding:12px;border-radius:12px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:12px;border-top:0}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:12px;min-width:0}.wp-order-head{display:flex;align-items:center;width:100%}.wp-item-line{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:21px;min-width:0}.wp-item-label{flex-shrink:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-30);white-space:nowrap}.wp-line-value,.wp-order-side{min-width:0;overflow:hidden;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-order-side--buy{color:var(--wp-mint)}.wp-order-side--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;min-height:21px}.wp-svc-token>span{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:16px;height:16px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-token--amount{align-items:flex-start}.wp-svc-token--amount>.wp-svc-token-icon{margin-top:2.5px}.wp-token-stack{display:inline-flex;align-items:center;justify-content:flex-end;width:29px;min-width:29px;overflow:visible}.wp-token-stack .wp-svc-token-icon+.wp-svc-token-icon{margin-left:-3.5px}.wp-token-subtle,.wp-item-usd{color:var(--wp-text-30)!important}.wp-svc-amount{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:1px;min-width:0}.wp-svc-amount-main{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.wp-svc-amount .wp-item-usd{font-size:12px;font-weight:500;line-height:1.35}.wp-order-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-order-token .wp-svc-token-icon{width:32px;height:32px}.wp-order-token-meta{display:flex;min-width:0;flex-direction:column;justify-content:center}.wp-order-token-symbol{overflow:hidden;color:var(--wp-text-60);font-size:14px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-order-token-pair{overflow:hidden;color:var(--wp-text-30);font-size:12px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-item-tags{display:flex;align-items:stretch;gap:8px;width:100%}.wp-tag{appearance:none;display:inline-flex;flex:1 1 0;align-items:center;justify-content:center;gap:0;min-width:0;min-height:33px;padding:6px 10px;border-radius:6px;border:0;background:var(--wp-control);font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);text-align:center;text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease}a.wp-tag,button.wp-tag{cursor:pointer}.wp-tag:hover{background:var(--wp-control);transform:none}.wp-tag:focus-visible{outline:2px solid var(--wp-mint);outline-offset:2px}.wp-tag[aria-disabled=true],.wp-tag[data-disabled]{cursor:default;opacity:.48;pointer-events:none}.wp-tag-label{display:inline-flex;align-items:center}.wp-tag-icon{display:none}.wp-tag:hover .wp-tag-icon{transform:none}.wp-tag--mint{color:var(--wp-mint);background:var(--wp-accent-soft)}.wp-tag--mint:hover{background:var(--wp-accent-soft)}.wp-tag--muted{color:var(--wp-text-40)}.wp-body-inner[data-empty]{min-height:100%;box-sizing:border-box;justify-content:center}.wp-portfolio-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:280px;padding:32px 24px;text-align:center}.wp-portfolio-empty-icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;margin-bottom:6px;border-radius:50%;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);color:var(--wp-text-30)}.wp-portfolio-empty-title{margin:0;font-size:15px;font-weight:600;line-height:1.3;color:var(--wp-text-60)}.wp-portfolio-empty-desc{margin:0;font-size:13px;font-weight:400;line-height:1.4;color:var(--wp-text-30)}.wp-portfolio-loading{display:flex;align-items:center;justify-content:center;min-height:280px;padding:32px 24px}.wp-portfolio-spinner{width:22px;height:22px;border:2px solid var(--wp-border);border-top-color:var(--wp-mint);border-radius:50%;animation:wp-claim-spin .8s linear infinite}.wp-claim-overlay{position:absolute;inset:0;z-index:8;display:flex;align-items:flex-end;justify-content:center;background:#00000094;box-sizing:border-box}.wp-claim-sheet{display:flex;flex-direction:column;width:100%;max-width:375px;max-height:calc(100% - 24px);overflow:hidden;border-radius:24px 24px 0 0;background:var(--wp-bg);color:var(--wp-text);box-shadow:0 -18px 48px #00000042;animation:wp-claim-slide-up .22s ease-out}@keyframes wp-claim-slide-up{0%{transform:translateY(18px);opacity:0}to{transform:translateY(0);opacity:1}}.wp-claim-grabber{display:flex;align-items:flex-start;justify-content:center;height:38px;min-height:38px;padding-top:12px;box-sizing:border-box}.wp-claim-grabber span{display:block;width:52px;height:5px;border-radius:999px;background:var(--wp-control)}.wp-claim-content{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;padding:20px;box-sizing:border-box}.wp-claim-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;flex-shrink:0}.wp-claim-icon--success{background:var(--wp-claim-success-soft);color:var(--wp-claim-success)}.wp-claim-icon--pending{background:#9b8cef29;color:var(--wp-claim-primary)}.wp-claim-icon--error{background:var(--wp-claim-error-soft);color:var(--wp-claim-error);font-size:30px;font-weight:600;line-height:1}.wp-claim-icon--token{background:#00d4aa29}.wp-claim-icon--token img{width:48px;height:48px;border-radius:50%;object-fit:cover}.wp-claim-icon--token span{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--wp-mint);color:#101820;font-size:18px;font-weight:600}.wp-claim-spinner{width:36px;height:36px;border-radius:50%;border:3px solid rgba(155,140,239,.28);border-top-color:var(--wp-claim-primary);animation:wp-claim-spin .8s linear infinite}@keyframes wp-claim-spin{to{transform:rotate(360deg)}}.wp-claim-copy{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;text-align:center}.wp-claim-title{margin:0;font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text)}.wp-claim-desc{max-width:335px;margin:0;font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-40)}.wp-claim-heading{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.wp-claim-error-message{margin:0;color:var(--wp-claim-error);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0}.wp-claim-reward-card{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:60px;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-reward-token{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-claim-reward-token img{width:28px;height:28px;object-fit:cover}.wp-claim-reward-token span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-claim-reward-symbol{flex:1 1 auto;min-width:0;overflow:hidden;color:var(--wp-text);font-size:18px;font-weight:600;line-height:1.3;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-reward-amount{flex-shrink:0;color:var(--wp-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-account-row{display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;min-height:40px}.wp-claim-account-row>span{flex-shrink:0;color:var(--wp-text-40);font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account{display:flex;align-items:center;gap:8px;min-width:0}.wp-claim-account strong{overflow:hidden;color:var(--wp-text);font-size:15px;font-weight:600;line-height:1.6;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-account-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 30% 28%,#d87aff 0 12%,transparent 13%),radial-gradient(circle at 68% 28%,#f0a1ff 0 12%,transparent 13%),radial-gradient(circle at 32% 70%,#b561e7 0 13%,transparent 14%),radial-gradient(circle at 70% 70%,#d4a2ff 0 13%,transparent 14%),radial-gradient(circle at 50% 50%,#8c4fc4 0 18%,transparent 19%),#4a315f;box-shadow:inset 0 0 0 3.37px var(--wp-control)}.wp-claim-divider{display:block;width:100%;height:1px;background:var(--wp-border)}.wp-claim-detail-list{display:flex;flex-direction:column;gap:8px;width:100%}.wp-claim-detail-row{display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;min-height:20px}.wp-claim-detail-row>span{min-width:0;color:var(--wp-text-40);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-detail-row--sub>span:before{content:"";display:inline-block;width:3px;height:3px;margin:0 8px 3px;background:currentColor}.wp-claim-detail-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list{display:flex;flex-direction:column;gap:8px;width:100%;padding-bottom:8px}.wp-claim-list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-list-item>span{flex-shrink:0;font-size:14px;font-weight:400;line-height:1.3;color:var(--wp-text-40);white-space:nowrap}.wp-claim-list-item strong{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;overflow:hidden;color:var(--wp-text);font-size:14px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list-item img{width:16px;height:16px;border-radius:50%;flex-shrink:0}.wp-claim-hash{appearance:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);cursor:pointer;font:inherit}.wp-claim-hash svg{flex-shrink:0;color:var(--wp-text-60)}.wp-claim-gas-card{display:flex;flex-direction:column;gap:4px;width:100%;padding:14px 16px;border-radius:8px;border:1px solid var(--wp-border);background:var(--wp-card);box-sizing:border-box}.wp-claim-gas-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px}.wp-claim-gas-row>span{min-width:0;font-size:12px;font-weight:400;line-height:1.3;color:var(--wp-text-40)}.wp-claim-gas-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:12px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-gas-row--primary{min-height:32px}.wp-claim-gas-row--primary>span,.wp-claim-gas-row--primary strong{font-size:14px;color:var(--wp-text)}.wp-claim-fee-label{position:relative;display:inline-flex;align-items:center;text-decoration:underline dotted;text-underline-offset:3px;cursor:help;overflow:visible!important}.wp-claim-fee-tooltip{position:absolute;left:0;bottom:calc(100% + 8px);z-index:2;width:min(260px,calc(100vw - 64px));padding:10px 12px;border-radius:8px;background:var(--wp-tooltip-bg);color:var(--wp-tooltip-text);box-shadow:0 12px 32px #0000003d;font-size:11px;font-weight:400;line-height:1.4;text-align:left;text-decoration:none;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-claim-fee-label:hover .wp-claim-fee-tooltip,.wp-claim-fee-label:focus .wp-claim-fee-tooltip,.wp-claim-fee-label:focus-visible .wp-claim-fee-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-claim-actions{display:flex;align-items:center;gap:8px;width:100%}.wp-claim-primary,.wp-claim-secondary{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;height:52px;padding:0 24px;border:none;border-radius:40px;font-family:inherit;font-size:15px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap;cursor:pointer}.wp-claim-primary{background:var(--wp-claim-primary);color:var(--wp-claim-primary-text)}.wp-claim-primary:disabled{cursor:default;opacity:.72}.wp-claim-secondary{background:var(--wp-claim-secondary-bg, var(--wp-control));color:var(--wp-claim-primary)}.wp-claim-actions[data-count="2"] .wp-claim-primary{flex:1 1 0}.wp-claim-actions[data-count="2"] .wp-claim-secondary{flex:0 0 120px}.wp-claim-button-spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(32,37,48,.28);border-top-color:var(--wp-claim-primary-text);animation:wp-claim-spin .8s linear infinite}.wp-claim-home-indicator{display:flex;align-items:flex-end;justify-content:center;height:34px;min-height:34px;padding-bottom:8px;box-sizing:border-box}.wp-claim-home-indicator span{display:block;width:134px;height:5px;border-radius:16px;background:var(--wp-text-40)}@media(max-width:359px){.wp-header{gap:12px;padding:0 12px}.wp-total{font-size:24px}.wp-body-inner{padding:0 12px 128px;gap:20px}.wp-svc-items,.wp-claim-content{padding:18px 14px}.wp-item-line{gap:10px}.wp-svc-token>span{max-width:168px}}.wp-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.wi-drawer-content .wp-header,.wi-portfolio-body .wp-header{padding:16px}.wi-drawer-content .wp-header-edge--right .wp-header-btn,.wi-portfolio-body .wp-header-edge--right .wp-header-btn{top:16px;right:16px}.wp-withdraw-amount-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-withdraw-amount-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-input{flex:1 1 auto;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);font-family:inherit;font-size:24px;font-weight:600;line-height:1.3;letter-spacing:0;text-align:left;outline:none}.wp-withdraw-input::placeholder{color:var(--wp-text-30)}.wp-withdraw-input[aria-invalid=true]{color:var(--wp-claim-error)}.wp-withdraw-input-symbol{flex-shrink:0;color:var(--wp-text-40);font-size:15px;font-weight:600;line-height:1.3}.wp-withdraw-quick-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-quick{appearance:none;flex:1 1 0;min-width:0;height:32px;padding:0 10px;border:1px solid var(--wp-border);border-radius:999px;background:transparent;color:var(--wp-text-60);font-family:inherit;font-size:13px;font-weight:600;line-height:1;white-space:nowrap;cursor:pointer}.wp-withdraw-quick:hover:not(:disabled){border-color:var(--wp-claim-primary);color:var(--wp-claim-primary)}.wp-withdraw-quick:disabled{cursor:default;opacity:.5}.wp-withdraw-content{overflow-y:auto}.wp-withdraw-token-list{display:flex;flex-direction:column;gap:8px;width:100%;max-height:216px;overflow-y:auto}.wp-withdraw-token{appearance:none;display:flex;align-items:center;gap:10px;width:100%;min-height:52px;padding:10px 12px;border:1px solid var(--wp-border);border-radius:8px;background:var(--wp-card);color:var(--wp-text);font-family:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.wp-withdraw-token[data-selected]{border-color:var(--wp-claim-primary);box-shadow:inset 0 0 0 1px var(--wp-claim-primary)}.wp-withdraw-token:disabled{cursor:default;opacity:.6}.wp-withdraw-token-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-withdraw-token-icon img{width:28px;height:28px;object-fit:cover}.wp-withdraw-token-icon span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-withdraw-token-symbol{flex:1 1 auto;min-width:0;overflow:hidden;font-size:15px;font-weight:600;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}.wp-withdraw-token-amount{flex-shrink:0;color:var(--wp-text-40);font-size:13px;font-weight:500;line-height:1.3;white-space:nowrap}
|
|
8
8
|
`);var K=require("react/jsx-runtime"),Zr=15,dp="wp:";function bn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:a=!0,variant:i="embed",className:l,onOutlink:d,lpBalanceReader:c,stakingRewardsReader:f,sendTransaction:w,estimateGas:h,conversionRatio:g,currencySymbol:y,sections:b}){let m=Oe(e),v=Ne.useCallback(ee=>!b||b.includes(ee),[b]),R=!!n,u=(0,rl.useQueryClient)(),[T,k]=Ne.useState({}),N=Ne.useCallback((ee,ue)=>{k(_e=>{let Me=_e[ee];return Me&&Me.loading===ue.loading&&Me.empty===ue.empty?_e:{..._e,[ee]:ue}})},[]),S=Ne.useCallback(ee=>{k(ue=>{if(!(ee in ue))return ue;let _e={...ue};return delete _e[ee],_e})},[]),G=Ne.useMemo(()=>({report:N,unregister:S}),[N,S]),[O,H]=Ne.useState(Zr),[B,le]=Ne.useState(!1),[I,ie]=Ne.useState(!1),W=Ne.useRef(void 0),q=Ne.useCallback(()=>{u.invalidateQueries({predicate:ee=>typeof ee.queryKey[0]=="string"&&ee.queryKey[0].startsWith(dp)})},[u]),ye=Ne.useCallback(()=>{q(),le(!0),setTimeout(()=>le(!1),600),H(Zr)},[q]);Ne.useEffect(()=>{if(!R)return;let ee=setInterval(()=>{H(ue=>ue<=1?(ye(),Zr):ue-1)},1e3);return()=>clearInterval(ee)},[R,ye]);let te=Ne.useCallback(()=>{r?.()},[r]),$=R?Vt(m,n,{size:64}):void 0,he=Ne.useCallback(async()=>{if(!(I||!n))try{await navigator.clipboard.writeText(n),ie(!0),clearTimeout(W.current),W.current=setTimeout(()=>ie(!1),2e3)}catch{}},[n,I]);Ne.useEffect(()=>()=>clearTimeout(W.current),[]);let fe=Ne.useMemo(()=>({env:m,theme:t,open:!0,walletAddress:n,close:te,onOutlink:d,lpBalanceReader:c,stakingRewardsReader:f,sendTransaction:w,estimateGas:h,conversionRatio:g,currencySymbol:y}),[m,t,n,te,d,c,f,w,h,g,y]),j=Jn.filter(v),Be=j.length>0&&j.every(ee=>{let ue=T[ee];return!!ue&&!ue.loading}),F=Be&&j.every(ee=>T[ee]?.empty),ne=j.some(ee=>{let ue=T[ee];return!!ue&&!ue.empty}),be=j.length>0&&!Be&&!ne,De=(0,K.jsxs)(K.Fragment,{children:[a&&(0,K.jsxs)("div",{className:"wp-header",children:[(0,K.jsxs)("div",{className:"wp-header-account",children:[r&&(0,K.jsx)("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:r,children:(0,K.jsx)(as,{})}),(0,K.jsx)("span",{className:"wp-header-avatar","aria-hidden":!0,children:$&&(0,K.jsx)("img",{src:$,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&(0,K.jsxs)("div",{className:"wp-header-account-meta",children:[o&&(0,K.jsx)("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&(0,K.jsxs)("button",{type:"button",className:"wp-header-address-btn",onClick:he,"aria-label":"Copy wallet address",children:[(0,K.jsx)("span",{className:"wp-header-address",children:Vo(n)}),(0,K.jsx)("span",{className:"wp-header-address-copy","data-copied":I,children:I?(0,K.jsx)(cn,{size:14}):(0,K.jsx)(Un,{size:14})})]})]})]}),(0,K.jsxs)("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio",onClick:ye,children:[(0,K.jsx)(ss,{className:B?"wp-spin-once":void 0}),R&&(0,K.jsx)("span",{className:"wp-refresh-badge",children:O})]})]}),(0,K.jsx)("div",{className:"wp-body",children:(0,K.jsxs)("div",{className:"wp-body-inner","data-empty":F||void 0,children:[v("rewards")&&(0,K.jsx)(Ls,{}),v("points")&&(0,K.jsx)(Ps,{}),v("staking")&&(0,K.jsx)(Hs,{}),v("gameSwap")&&(0,K.jsx)(Qs,{}),v("forge")&&(0,K.jsx)(ol,{}),be&&(0,K.jsx)("div",{className:"wp-portfolio-loading",role:"status","aria-label":"Loading portfolio",children:(0,K.jsx)("span",{className:"wp-portfolio-spinner","aria-hidden":!0})}),F&&(0,K.jsxs)("div",{className:"wp-portfolio-empty",role:"status",children:[(0,K.jsx)("span",{className:"wp-portfolio-empty-icon","aria-hidden":!0,children:(0,K.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,K.jsx)("path",{d:"M20 7H5a2 2 0 0 1-2-2 2 2 0 0 1 2-2h13v4"}),(0,K.jsx)("path",{d:"M3 5v13a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1"}),(0,K.jsx)("circle",{cx:"16.5",cy:"13.5",r:"1",fill:"currentColor",stroke:"none"})]})}),(0,K.jsx)("p",{className:"wp-portfolio-empty-title",children:"No assets yet"}),(0,K.jsx)("p",{className:"wp-portfolio-empty-desc",children:"Assets you hold across CROSS services will appear here."})]})]})})]});return(0,K.jsx)(Yn.Provider,{value:fe,children:(0,K.jsx)(Hr.Provider,{value:G,children:i==="none"?De:(0,K.jsx)("div",{className:de(i==="fullscreen"?"wp-fullscreen":"wp-embed",l),"data-theme":t,children:De})})})}var wn=require("react/jsx-runtime");function il({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:l}=je();return(0,wn.jsxs)(eo.Drawer.Portal,{children:[(0,wn.jsx)(eo.Drawer.Overlay,{className:"wp-overlay"}),(0,wn.jsxs)(eo.Drawer.Content,{className:de("wp-fullscreen",e),"data-theme":n,children:[(0,wn.jsx)(eo.Drawer.Title,{className:"wp-sr-only",children:"Portfolio"}),(0,wn.jsx)(bn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:a,lpBalanceReader:i,stakingRewardsReader:l})]})]})}var Xr=require("react/jsx-runtime");function pp({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:l,sendTransaction:d,estimateGas:c,conversionRatio:f,currencySymbol:w,children:h}){let g=Oe(e),y=o!==void 0,[b,m]=xn.useState(!1),v=y?o:b,R=xn.useCallback(k=>{y||m(k),r?.(k)},[y,r]),u=xn.useCallback(()=>R(!1),[R]),T=xn.useMemo(()=>({env:g,theme:t,open:v,walletAddress:n,close:u,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:l,sendTransaction:d,estimateGas:c,conversionRatio:f,currencySymbol:w}),[g,t,v,n,u,a,i,l,d,c,f,w]);return(0,Xr.jsx)(Yn.Provider,{value:T,children:(0,Xr.jsx)(al.Drawer.Root,{direction:"bottom",open:v,onOpenChange:R,noBodyStyles:!0,children:h})})}var Jr=Object.assign(pp,{Trigger:rs,Content:il});var L=U(require("react"),1),vn=require("react-dom"),At=U(require("bignumber.js"),1);var ot=require("react/jsx-runtime");function sl({size:e=20,className:t}){return(0,ot.jsxs)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[(0,ot.jsx)("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),(0,ot.jsx)("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function ll({size:e=16,className:t}){return(0,ot.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ot.jsx)("path",{d:"M2.667 8a5.333 5.333 0 1 0 1.562-3.771L2.667 5.79M2.667 2.667v3.124h3.124M8 5.333V8l1.667 1",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function cl({size:e=16,className:t}){return(0,ot.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ot.jsx)("path",{d:"M2.667 4h4M9.333 4h4M6.667 2.667v2.666M2.667 12h4M9.333 12h4M9.333 10.667v2.666M2.667 8h1.666M7 8h6.333M4.333 6.667v2.666",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function dl({size:e=20,className:t}){return(0,ot.jsx)("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ot.jsx)("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function pl({size:e=16,className:t}){return(0,ot.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:(0,ot.jsx)("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function fl({size:e=12,className:t}){return(0,ot.jsx)("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,ot.jsx)("path",{d:"M3.5 2 1.5 4l2 2M1.5 4h9M8.5 10l2-2-2-2M10.5 8h-9",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})})}var P=U(require("react"),1);var ei=U(require("bignumber.js"),1);function ul(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ml(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,ei.default.ROUND_DOWN).toFixed()}function fp(e){return e.fromToken.symbol.toLowerCase()===e.toToken.symbol.toLowerCase()||e.fromToken.chainId===e.toToken.chainId&&e.fromToken.address.toLowerCase()===e.toToken.address.toLowerCase()}function up(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new ei.default(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:ul(t)&&ul(n)?e.lastChangedBy==="to"?{fromAmount:ml(r.multipliedBy(n).dividedBy(t))}:{toAmount:ml(r.multipliedBy(t).dividedBy(n))}:fp(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function gl({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):up(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var hl=15,mp=18,vl="cross_bridge_terms_accepted",gp=3600*24*365;function hp(e){let t=e.replace(/[^\d.]/g,""),n=t.indexOf(".");n!==-1&&(t=t.slice(0,n+1)+t.slice(n+1).replace(/\./g,""));let o=t.indexOf(".");if(o===-1)return t.slice(0,hl);let r=t.slice(0,o).slice(0,hl),a=t.slice(o+1).slice(0,mp);return`${r}.${a}`}function bp(){return typeof document>"u"?!1:document.cookie.split(";").map(e=>e.trim()).some(e=>e===`${vl}=true`)}function wp(){if(typeof document>"u")return;let e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=[`${vl}=true`,"Path=/",`Max-Age=${gp}`,"SameSite=Lax",e].filter(Boolean).join("; ")}function xp(e){let t=Number(e??"0");if(!Number.isFinite(t)||t<.1)return"1";let n=o=>Math.floor(o*100)/100;if(t<3){let o=n(t*3);return String(o<1?1:o)}return"10"}function bl(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function vp(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([bl(e.symbol),bl(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function Lt(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function tr(e){return e[0]}function ti(e,t,n,o){if(n&&!Lt(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??tr(e);let a=e.findIndex(l=>Lt(l,t)),i=a>=0?e[a+1]:void 0;return i&&!Lt(i,t)?i:e.find(l=>!Lt(l,t))??t}function wl({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}}function nr(e,t=0){if(!e||t>5)return[];if(typeof e=="string")return[e];if(!(e instanceof Error)&&typeof e!="object")return[String(e)];let n=e;return[...[e instanceof Error?e.name:n.name,e instanceof Error?e.message:n.message,n.shortMessage,n.details,n.code].filter(r=>typeof r=="string"||typeof r=="number").map(String),...nr(n.cause,t+1),...nr(n.data,t+1),...nr(n.error,t+1)]}function ni(e){let t=nr(e).join(" ").toLowerCase(),n=t.includes("signature_failed")&&(t.includes("\uD0C0\uC785 \uB370\uC774\uD130 \uC11C\uBA85\uC5D0 \uC2E4\uD328")||t.includes("typed data")||t.includes("signtypeddata"));return t.includes("4001")||t.includes("err_user_rejected")||t.includes("userrejectedrequesterror")||t.includes("user rejected")||t.includes("user denied")||t.includes("user cancelled")||t.includes("user canceled")||t.includes("rejected the request")||t.includes("request rejected")||t.includes("action_rejected")||t.includes("rejected by user")||n}function xl(e,t){return ni(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
|
|
9
9
|
`)[0]?.trim()||t}function yl(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:a,approveBridge:i,history:l=[],initialSlippage:d="1",termsUrl:c=In,getQuote:f,submitBridge:w,onSubmitted:h,onSuccess:g,onFailed:y,onExit:b}=e,m=P.useMemo(()=>gl({getQuote:f,submitBridge:w}),[f,w]),[v,R]=P.useState("form"),[u,T]=P.useState(n??tr(t)),[k,N]=P.useState(()=>ti(t,n??tr(t),o,r)),[S,G]=P.useState(""),[O,H]=P.useState(""),[B,le]=P.useState("from"),[I,ie]=P.useState(d),[W,q]=P.useState(null),ye=P.useMemo(()=>vp(u,k),[u,k]),te=P.useMemo(()=>ye?"1":I==="auto"?xp(W?.priceImpact):I,[ye,I,W?.priceImpact]),[$,he]=P.useState(""),[fe,j]=P.useState("idle"),[Be,F]=P.useState(""),[ne,be]=P.useState(null),[De,ee]=P.useState([]),[ue,_e]=P.useState(!1),[Me,$t]=P.useState(bp),[ze,Ee]=P.useState(null),[ft,Ge]=P.useState(!1),[Ve,Le]=P.useState(null),[Pt,wt]=P.useState(null),[Ft,st]=P.useState(!1),[xt,ut]=P.useState(!1),Ce=P.useRef(0),Bt=P.useRef(null),mt=P.useCallback(()=>{Bt.current&&(clearTimeout(Bt.current),Bt.current=null)},[]),qe=P.useCallback(D=>{mt(),wt(D)},[mt]);P.useEffect(()=>mt,[mt]),P.useEffect(()=>{let D=t.find(we=>Lt(we,u))??tr(t),Ue=D?r?.(D,t):void 0,Q=Ue?.find(we=>Lt(we,k))??(Ue?void 0:t.find(we=>Lt(we,k)))??ti(t,D,void 0,r);T(D),N(Q)},[r,t,u,k]);let He=P.useCallback((D,Ue)=>{let Q=hp(D);if(!Q){Ce.current+=1,G(""),H(""),le(Ue),q(null),he(""),j("idle");return}Ue==="from"?G(Q):H(Q),le(Ue),he("")},[]),Ke=P.useCallback(()=>{Ce.current+=1,G(""),H(""),le("from"),q(null),he(""),F(""),j("idle"),Ee(null),Ge(!1),Le(null),st(!1),qe(null)},[qe]),it=P.useCallback(D=>{Lt(D,u)||(T(D),N(ti(t,D,void 0,r)),Ke())},[u,r,Ke,t]),lt=P.useCallback(D=>{Lt(D,k)||Lt(D,u)||(N(D),Ke())},[u,Ke,k]),at=P.useMemo(()=>u?r?.(u,t)??t.filter(D=>!Lt(D,u)):[],[u,r,t]),gt=P.useCallback(()=>{u?.balance&&He(u.balance,"from")},[u?.balance,He]),vt=P.useCallback(()=>{!u||!k||(T(k),N(u),Ke())},[u,Ke,k]),Ze=P.useCallback(()=>{Ce.current+=1,G(""),H(""),le("from"),q(null),he(""),F("")},[]);P.useEffect(()=>{if(!u||!k)return;if(!S&&!O){q(null),he(""),j(Q=>Q==="quoting"?"idle":Q);return}let D=++Ce.current,Ue=wl({fromToken:u,toToken:k,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:I});j(Q=>Q==="submitting"?Q:m.canQuote?"quoting":"idle"),(async()=>{try{let Q=await m.getQuote(Ue);if(Ce.current!==D)return;Q.fromAmount!==void 0&&B==="to"&&G(Q.fromAmount),Q.toAmount!==void 0&&B==="from"&&H(Q.toAmount),q(Q.summary??null),he(Q.error??"")}catch(Q){if(Ce.current!==D)return;he(Q instanceof Error?Q.message:"Failed to quote bridge.")}finally{Ce.current===D&&j(Q=>Q==="quoting"?"idle":Q)}})()},[S,u,B,m,I,O,k]);let Xe=P.useCallback(()=>!u||!k?null:wl({fromToken:u,toToken:k,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:te}),[te,S,u,B,O,k]),Je=P.useCallback(async(D,Ue)=>{F(""),st(!1),Ge(!1),j("submitting");try{if(!Ue?.skipApprovalCheck&&a){let we=await a(D);if(we){Ee(we),Le(D),j("idle");return}}Ee(null),Le(null),qe("processing");let Q=await m.submitBridge(D);be(Q),j("success"),ee(we=>[{id:Q.txHash,timestamp:new Date().toISOString(),txHash:Q.txHash,fromToken:Q.fromToken,toToken:Q.toToken,fromAmount:Q.fromAmount,toAmount:Q.toAmount,summary:W??void 0,status:"pending"},...we.filter(go=>go.txHash!==Q.txHash)]),Ze(),ut(!0),qe(null),st(!0),h?.(Q),g?.(Q)}catch(Q){if(qe(null),ni(Q)){j("idle");return}let we=xl(Q,"Failed to submit bridge.");F(we),j("error"),y?.({message:we})}},[a,y,h,g,m,Ze,qe,W]),E=P.useCallback(async()=>{if($)return;let D=Xe();if(D){if(!Me){Le(D),_e(!0);return}await Je(D)}},[Xe,$,Je,Me]),oe=P.useCallback(async()=>{let D=Ve??Xe();D&&(wp(),$t(!0),_e(!1),await Je(D))},[Xe,Ve,Je]),Te=P.useCallback(()=>{_e(!1),Le(null)},[]),ct=P.useCallback(async()=>{if(!(fe==="submitting"||!ze||!Ve||!i)){F(""),j("submitting");try{await i(Ve,ze),Ee(null),j("idle"),Ge(!0)}catch(D){if(ni(D)){j("idle");return}let Ue=xl(D,"Failed to approve token.");F(Ue),j("error"),y?.({message:Ue})}}},[ze,i,y,Ve,Je,fe]),ht=P.useCallback(()=>{fe!=="submitting"&&(Ee(null),Ge(!1),Le(null),j("idle"))},[fe]),yt=P.useCallback(async()=>{if(fe==="submitting")return;let D=Ve??Xe();if(!D){Ge(!1),F("Bridge input is no longer available. Please try again."),j("error");return}Ge(!1),await Je(D,{skipApprovalCheck:!0})},[Xe,Ve,Je,fe]),Sn=P.useCallback(()=>{st(!1)},[]),kt=P.useCallback(D=>{R(D),D==="history"&&ut(!1)},[]),mo=P.useCallback(()=>{if(v==="history"){kt("form");return}b?.()},[b,kt,v]),on=P.useMemo(()=>[...l,...De.filter(D=>!l.some(Ue=>Ue.txHash===D.txHash))],[l,De]);return{step:v,setStep:kt,status:fe,error:Be,quoteError:$,fromToken:u,toToken:k,tokens:t,availableToTokens:at,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:I,effectiveSlippage:te,slippageLocked:ye,setSlippage:ie,summary:W,history:on,submitted:ne,canSubmit:m.canSubmit,termsOpen:ue,approvalInfo:ze,approvalSuccessOpen:ft,approveBridge:i,pendingSubmitInput:Ve,submitToast:Pt,successDialogOpen:Ft,dismissSuccessDialog:Sn,hasNewHistory:xt,termsUrl:c,setFromToken:T,setToToken:N,selectFromToken:it,selectToToken:lt,setAmount:He,setMax:gt,swapTokens:vt,submit:E,confirmTerms:oe,cancelTerms:Te,confirmApproval:ct,cancelApproval:ht,continueAfterApproval:yt,back:mo}}Y(`.bf-root{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .07));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));--bf-toast-bg: #1e232e;--bf-toast-color: rgba(255, 255, 255, .85);position:relative;display:flex;flex:1;min-height:0;flex-direction:column;overflow:hidden;background:var(--bf-bg);color:var(--ds-content-highest, #ffffff);font-family:inherit}[data-theme=dark].wi-popover-content .bf-root,[data-theme=dark].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #121212);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .1));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .05));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .85));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .7));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .5))}[data-theme=light].wi-popover-content .bf-root,[data-theme=light].wi-drawer-content .bf-root{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .05));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .7));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .5))}.bf-root[data-view=history]{background:var(--ds-bg-dim, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header{position:relative;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:24px;border-bottom:1px solid var(--bf-border);background:var(--ds-bg-default, var(--bf-bg));box-sizing:border-box}.bf-root[data-view=history] .bf-header{padding:24px;border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff)}.bf-header-btn{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.bf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-header .bf-header-btn:last-child{position:absolute;top:24px;right:24px}.bf-header-title{position:absolute;left:50%;transform:translate(-50%);font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--bf-text-high);white-space:nowrap}.bf-root[data-view=history] .bf-header-title{color:var(--ds-content-highest, #000000)}.bf-body,.bf-history-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;box-sizing:border-box}.bf-body{padding:24px}.bf-history-body{display:flex;flex-direction:column;gap:12px;padding:24px;background:var(--ds-bg-dim, #f5f7fa)}.bf-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.bf-chip{display:inline-flex;align-items:center;gap:4px;min-height:33px;padding:6px 8px;border:0;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-chip:hover:not(:disabled){color:var(--bf-text-high);background:var(--bf-surface-hover)}.bf-chip:disabled{cursor:default}.bf-chip-history{position:relative}.bf-chip-dot{position:absolute;top:4px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-swap-card{position:relative;display:flex;flex-direction:column;gap:12px;margin-bottom:12px}.bf-field-error{margin-top:-4px;color:var(--ds-system-red-default, #ff2b5f);font-size:13px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-amount-panel{display:flex;min-height:110px;flex-direction:column;gap:8px;padding:16px;border:1px solid transparent;border-radius:12px;background:var(--bf-surface);box-sizing:border-box;transition:border-color .2s ease}.bf-amount-panel:hover{border-color:var(--bf-border)}.bf-amount-head{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--bf-text-high);font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-balance{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;color:var(--bf-text-low);font-size:12px;white-space:nowrap}.bf-amount-main{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-amount-input-wrap{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}.bf-amount-input{width:100%;min-width:0;padding:0;border:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;outline:none}.bf-amount-input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-amount-usd{overflow:hidden;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis}.bf-token-pill{display:inline-flex;flex-shrink:0;align-items:center;gap:6px;min-height:33px;padding:6px 8px 6px 6px;border:1px solid var(--bf-border);border-radius:9999px;background:var(--bf-bg);color:var(--bf-text-high);font:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-token-pill:hover:not(:disabled):not([data-locked=true]){background:var(--bf-surface-hover)}.bf-token-pill:disabled{cursor:default;opacity:.6}.bf-token-pill[data-locked=true]{cursor:default}.bf-token-icon{position:relative;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font-size:11px;font-weight:700}.bf-token-icon[data-has-image=true]{background:transparent}.bf-token-icon img{width:100%;height:100%;border-radius:0;object-fit:cover}.bf-token-fallback{line-height:1}.bf-token-picker-overlay{--bf-bg: #1e232e;--bf-surface: rgba(255, 255, 255, .05);--bf-surface-hover: rgba(255, 255, 255, .08);--bf-border: rgba(255, 255, 255, .07);--bf-text-high: rgba(255, 255, 255, .85);--bf-text-medium: rgba(255, 255, 255, .65);--bf-text-low: rgba(255, 255, 255, .4);position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-token-picker-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-surface: rgba(18, 18, 18, .05);--bf-surface-hover: rgba(18, 18, 18, .08);--bf-border: rgba(18, 18, 18, .07);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-token-picker{display:flex;width:min(480px,calc(100vw - 48px));height:min(466px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);min-height:0;flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #0006;box-sizing:border-box}.bf-token-picker-handle{display:none}.bf-token-picker-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--bf-border);box-sizing:border-box}.bf-token-picker-head h3{margin:0;color:var(--bf-text-high);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-token-picker-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--bf-text-medium);cursor:pointer}.bf-token-picker-close:hover{color:var(--bf-text-high)}.bf-token-search{display:flex;min-height:48px;flex-shrink:0;align-items:center;gap:8px;margin:16px 24px;padding:12px 16px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, rgba(18, 18, 18, .05));color:var(--bf-text-low);box-sizing:border-box}.bf-token-search:focus-within{border-color:var(--ds-accent-primary-default, #00ceb2)}.bf-token-search input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--bf-text-high);font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-search input::placeholder{color:var(--bf-text-low)}.bf-token-list{display:flex;min-height:0;flex:1;flex-direction:column;gap:0;overflow-y:auto;overflow-x:hidden;padding:0 24px 24px;scrollbar-width:thin;box-sizing:border-box}.bf-token-row{position:relative;display:flex;width:100%;min-height:69px;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid transparent;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.bf-token-row:hover:not([data-selected=true]){background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-surface-medium, rgba(18, 18, 18, .05))}.bf-token-row-left{display:inline-flex;min-width:0;align-items:center;gap:16px}.bf-token-meta{display:flex;min-width:0;flex-direction:column}.bf-token-symbol{overflow:hidden;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-name{overflow:hidden;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.bf-token-row-right{display:flex;min-width:86px;max-width:42%;flex-shrink:0;flex-direction:column;align-items:flex-end}.bf-token-balance,.bf-token-price{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-token-balance{color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-token-price{color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-token-row[data-selected=true] .bf-token-symbol{color:var(--bf-text-high)}.bf-token-row[data-selected=true] .bf-token-balance{color:var(--bf-text-high);font-size:16px}.bf-token-row[data-selected=true] .bf-token-price{color:var(--bf-text-low);font-size:14px}.bf-token-empty{padding:32px 16px;color:var(--bf-text-low);font-size:14px;font-weight:500;line-height:1.5;text-align:center}.bf-slippage-overlay{position:fixed;inset:0;z-index:100002;display:flex;align-items:center;justify-content:center;padding:24px;background:#00000085;pointer-events:auto;box-sizing:border-box}.bf-slippage-dialog{display:flex;width:min(480px,calc(100vw - 48px));height:auto;min-height:min(316px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);flex-direction:column;overflow:hidden;border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:24px;background:var(--ds-surface-default, #ffffff);color:var(--ds-content-highest, #000000);box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));box-sizing:border-box}.bf-slippage-head{position:relative;display:flex;min-height:73px;flex-shrink:0;align-items:center;justify-content:flex-start;padding:24px 56px 24px 24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-slippage-head h3{margin:0;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;letter-spacing:0}.bf-slippage-close{position:absolute;top:24px;right:24px;display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-slippage-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-slippage-body{display:flex;flex:1;min-height:0;flex-direction:column;gap:24px;padding:24px;box-sizing:border-box}.bf-slippage-desc{margin:0;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-controls{display:flex;flex-direction:column;gap:12px;width:100%}.bf-slippage-presets{display:flex;gap:8px;width:100%}.bf-slippage-preset{appearance:none;display:inline-flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;padding:12px 8px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-preset:hover,.bf-slippage-preset[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7);background:var(--ds-accent-primary-low, #e7f9f8)}.bf-slippage-custom{display:flex;min-height:48px;align-items:center;gap:8px;padding:12px;border:1px solid transparent;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));box-sizing:border-box}.bf-slippage-custom:focus-within,.bf-slippage-custom[data-selected=true]{border-color:var(--ds-accent-primary-default, #00b4b7)}.bf-slippage-custom input{width:100%;min-width:0;padding:0;border:0;outline:0;background:transparent;color:var(--ds-content-high, rgba(0, 0, 0, .85));font:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-custom input::placeholder{color:var(--ds-content-lowest, rgba(0, 0, 0, .25))}.bf-slippage-custom span:not(.bf-sr-only){flex-shrink:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-apply{appearance:none;margin-top:auto;width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on-primary, #ffffff);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;box-sizing:border-box}.bf-slippage-apply:hover{filter:brightness(.96)}.bf-slippage-apply:disabled{cursor:not-allowed;opacity:.5;filter:none}.bf-slippage-message{margin:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-slippage-message[data-variant=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-slippage-message[data-variant=error]{color:var(--ds-system-red-default, #da0b2e)}.bf-action-modal-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-surface: var(--ds-surface-medium, rgba(255, 255, 255, .05));--bf-surface-hover: var(--ds-surface-high, rgba(255, 255, 255, .08));--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));--bf-text-low: var(--ds-content-low, rgba(255, 255, 255, .4));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#040912b8;pointer-events:auto;box-sizing:border-box}.bf-action-modal-overlay[data-theme=light]{--bf-bg: var(--ds-bg-default, #ffffff);--bf-surface: var(--ds-surface-medium, rgba(18, 18, 18, .05));--bf-surface-hover: var(--ds-surface-high, rgba(18, 18, 18, .1));--bf-border: var(--ds-border-default, rgba(18, 18, 18, .08));--bf-text-high: var(--ds-content-high, rgba(18, 18, 18, .85));--bf-text-medium: var(--ds-content-medium, rgba(18, 18, 18, .65));--bf-text-low: var(--ds-content-low, rgba(18, 18, 18, .4))}.bf-action-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;align-items:center;gap:24px;padding:48px 24px 24px;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:#fff;box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-action-modal h3{width:100%;margin:0;color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;text-align:center;letter-spacing:0}.bf-action-modal-desc{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-terms-check-row{display:grid;width:100%;min-height:56px;grid-template-columns:20px minmax(0,1fr);align-items:center;column-gap:12px;padding:14px 16px;border:none;border-radius:12px;background:var(--bf-surface);color:var(--bf-text-medium);font-size:16px;font-weight:700;line-height:1.4;box-sizing:border-box}.bf-terms-check-button{appearance:none;display:inline-flex;min-width:0;width:20px;height:20px;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;touch-action:manipulation}.bf-terms-copy{display:flex;width:100%;min-width:0;align-items:baseline;justify-content:space-between;column-gap:12px;row-gap:4px;flex-wrap:wrap}.bf-terms-label{min-width:0}.bf-terms-check-button:focus-visible .bf-terms-checkbox{outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-terms-checkbox{position:relative;display:inline-flex;width:20px;height:20px;align-items:center;justify-content:center;border:1px solid rgba(124,143,180,.72);border-radius:5px;background:transparent;box-sizing:border-box}.bf-terms-checkbox[data-checked=true]{border-color:var(--ds-accent-primary-default, #00ceb2);background:var(--ds-accent-primary-default, #00ceb2)}.bf-terms-checkbox[data-checked=true]:after{width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg) translate(1px,-1px)}.bf-terms-check-row a{position:relative;z-index:1;color:var(--ds-accent-primary-default, #00ceb2);font-size:14px;font-weight:700;text-decoration:none;white-space:nowrap}.bf-terms-privacy{max-width:380px;margin:0;color:var(--bf-text-low);font-size:15px;font-weight:500;line-height:1.45;text-align:center;letter-spacing:0}.bf-action-primary,.bf-action-secondary{display:inline-flex;width:100%;min-height:56px;align-items:center;justify-content:center;padding:14px 16px;border:0;border-radius:12px;font:inherit;font-size:18px;font-weight:700;line-height:1.4;letter-spacing:0;cursor:pointer}.bf-action-primary{background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000)}.bf-action-primary:disabled{cursor:not-allowed;opacity:.35}.bf-action-primary[aria-busy=true]{gap:8px;opacity:1}.bf-action-button-spinner{width:18px;height:18px;border:2px solid rgba(0,0,0,.22);border-top-color:currentColor;border-right-color:currentColor;border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-action-secondary{background:var(--bf-surface);color:var(--bf-text-low)}.bf-action-secondary:disabled{cursor:not-allowed;opacity:.5}.bf-approve-address-box{display:flex;width:100%;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--bf-border);border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-approve-address-box>span{color:var(--bf-text-low);font-size:14px;font-weight:700;line-height:1.4}.bf-approve-address-box>div{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:12px}.bf-approve-address-box strong{min-width:0;overflow:hidden;color:var(--bf-text-high);font-size:15px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.bf-copy-button{flex-shrink:0;min-width:48px;min-height:32px;padding:6px 10px;border:1px solid rgba(0,206,178,.65);border-radius:8px;background:transparent;color:var(--ds-accent-primary-default, #00ceb2);font:inherit;font-size:12px;font-weight:700;line-height:1.2;cursor:pointer}.bf-copy-button:disabled{cursor:not-allowed;opacity:.45}.bf-action-buttons{display:grid;width:100%;grid-template-columns:1fr 1fr;gap:12px}.bf-approval-success-modal{gap:28px}.bf-success-mark{position:relative;display:inline-flex;width:96px;height:96px;flex-shrink:0;align-items:center;justify-content:center;border:12px solid rgba(0,206,178,.12);border-radius:999px;background:#00ceb2a8;box-shadow:0 0 0 10px #00ceb20f;box-sizing:border-box}.bf-success-mark:after{width:34px;height:18px;border:solid #ffffff;border-width:0 0 6px 6px;content:"";transform:rotate(-45deg) translate(2px,-3px)}.bf-status-toast{position:absolute;right:16px;bottom:14px;left:16px;z-index:5;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--bf-toast-bg, #1e232e);color:var(--bf-toast-color, rgba(255, 255, 255, .85));box-shadow:0 8px 24px #0000003d;box-sizing:border-box}.bf-status-toast-icon{display:inline-flex;width:28px;height:28px;flex-shrink:0;align-items:center;justify-content:center;border-radius:999px}.bf-status-spinner{width:20px;height:20px;border:3px solid rgba(255,255,255,.18);border-top-color:var(--ds-accent-primary-default, #00ceb2);border-right-color:var(--ds-accent-primary-default, #00ceb2);border-radius:999px;animation:bf-loading-spin .9s linear infinite}.bf-status-check{position:relative;width:20px;height:20px;border-radius:999px;background:var(--ds-accent-primary-default, #00ceb2)}.bf-status-check:after{position:absolute;top:6px;left:5px;width:8px;height:4px;border:solid var(--ds-accent-primary-on, #000000);border-width:0 0 2px 2px;content:"";transform:rotate(-45deg)}.bf-status-toast-copy{display:flex;min-width:0;flex:1;flex-direction:column}.bf-status-toast-copy strong,.bf-status-toast-copy span{overflow:hidden;text-overflow:ellipsis}.bf-status-toast-copy strong{color:#fff;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-status-toast-copy span{color:var(--bf-toast-color, rgba(255, 255, 255, .85));font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em}.bf-status-toast[data-variant=success] .bf-status-toast-copy span{color:var(--ds-accent-primary-on-inverted, #00e8c9)}.bf-status-toast[data-variant=error]{border:1px solid rgba(255,43,95,.28);background:var(--bf-toast-bg, #1e232e)}.bf-status-toast[data-variant=error] .bf-status-toast-copy strong{color:#fff}.bf-status-error-mark{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;background:var(--ds-system-red-default, #ff2b5f);color:#fff;font-size:14px;font-weight:700;line-height:1}.bf-status-toast[data-variant=error] .bf-status-toast-copy span{color:#ffffffe0}.bf-success-overlay{--bf-bg: var(--ds-bg-default, #1e232e);--bf-border: var(--ds-border-default, rgba(255, 255, 255, .12));--bf-text-high: var(--ds-content-high, rgba(255, 255, 255, .92));--bf-text-medium: var(--ds-content-medium, rgba(255, 255, 255, .65));position:fixed;inset:0;z-index:100003;display:flex;align-items:center;justify-content:center;padding:24px;background:#000000b8;pointer-events:auto;box-sizing:border-box}.bf-success-overlay[data-theme=light]{--bf-bg: #ffffff;--bf-border: rgba(18, 18, 18, .08);--bf-text-high: rgba(18, 18, 18, .85);--bf-text-medium: rgba(18, 18, 18, .65);--bf-text-low: rgba(18, 18, 18, .4)}.bf-success-modal{display:flex;width:min(480px,calc(100vw - 48px));flex-direction:column;overflow:hidden;border:1px solid var(--bf-border);border-radius:24px;background:var(--bf-bg);color:var(--bf-text-high);box-shadow:0 24px 80px #00000073;box-sizing:border-box}.bf-success-head{display:flex;min-height:73px;align-items:center;justify-content:space-between;gap:16px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));box-sizing:border-box}.bf-success-head h3{min-width:0;margin:0;overflow:hidden;color:var(--ds-content-highest, #000000);font-size:20px;font-weight:600;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.bf-success-close{display:inline-flex;width:24px;height:24px;flex-shrink:0;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer}.bf-success-close:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-success-body{display:flex;flex-direction:column;align-items:center;gap:24px;padding:40px 24px 24px;box-sizing:border-box}.bf-success-copy{display:flex;width:100%;flex-direction:column;align-items:center;gap:4px;color:var(--bf-text-medium);text-align:center}.bf-success-copy strong{color:var(--bf-text-high);font-size:24px;font-weight:700;line-height:1.25;letter-spacing:0}.bf-success-copy span{color:var(--bf-text-medium);font-size:15px;font-weight:500;line-height:1.5;letter-spacing:0}.bf-success-route{display:flex;align-items:center;justify-content:center;gap:12px}.bf-success-route .bf-token-icon{width:48px!important;height:48px!important;background:transparent;font-size:18px}.bf-success-route-arrow{color:var(--bf-text-low);font-size:24px;font-weight:500;line-height:1}.bf-success-ok{display:inline-flex;width:100%;min-height:48px;align-items:center;justify-content:center;padding:12px;border:0;border-radius:12px;background:#00b4b7e0;color:#fff;font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}@media(max-width:767px){.bf-success-body{padding:40px 24px 24px}.bf-success-copy strong{font-size:22px}.bf-success-copy span{font-size:14px}.bf-success-mark{width:88px;height:88px}.bf-success-route .bf-token-icon{width:44px!important;height:44px!important}}@keyframes bf-loading-spin{to{transform:rotate(360deg)}}.bf-swap-toggle{position:absolute;top:100px;left:50%;z-index:1;display:inline-flex;width:32px;height:32px;align-items:center;justify-content:center;padding:0;border:0;border-radius:9999px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);box-shadow:0 1px 5px #0000001f;cursor:pointer}.bf-swap-card[data-has-from-error=true] .bf-swap-toggle{top:132px}.bf-details{display:flex;flex-direction:column;gap:24px}.bf-exchange-rate{display:flex;width:100%;align-items:center;justify-content:center;gap:4px;padding:0 0 24px;border:0;background:transparent;color:var(--bf-text-low);font:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-exchange-rate:hover{color:var(--bf-text-medium)}.bf-detail-section,.bf-history-card{display:flex;flex-direction:column;gap:12px;padding:0;border-radius:12px;background:transparent;box-sizing:border-box}.bf-liquidity{display:flex;flex-direction:column;gap:12px;padding:16px;border-radius:12px;background:var(--bf-surface);box-sizing:border-box}.bf-root[data-view=history] .bf-liquidity,.bf-root[data-view=history] .bf-detail-section,.bf-root[data-view=history] .bf-history-card{background:var(--ds-surface-default, #ffffff)}.bf-detail-section h3{margin:0;color:var(--bf-text-high);font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-tx-fee-section{gap:12px}.bf-tx-fee-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.bf-collapse-head{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;margin:0;padding:0;background:none;border:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.bf-detail-section[data-open=true] .bf-collapse-head{padding-bottom:12px;border-bottom:1px solid var(--bf-border)}.bf-collapse-chevron{flex-shrink:0;color:var(--bf-text-low);transition:transform .2s ease}.bf-detail-section[data-open=true] .bf-collapse-chevron{transform:rotate(180deg)}.bf-collapse-body{display:flex;flex-direction:column;gap:14px}.bf-root[data-view=history] .bf-detail-section[data-open=true] .bf-collapse-head{border-bottom-color:var(--ds-border-default, rgba(0, 0, 0, .07))}.bf-root[data-view=history] .bf-collapse-chevron{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-tx-fee-total{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0;color:var(--bf-text-medium);font-size:14px;font-weight:600;line-height:1.4;text-align:right}.bf-tx-fee-total>span[data-delegated=true]{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:currentColor}.bf-fee-delegated{display:inline-flex;align-items:center;justify-content:center;min-height:24px;padding:2px 8px;border-radius:6px;background:#379cff2e;color:#4eb3ff;font-size:10px;font-weight:500;line-height:1.3;white-space:nowrap}.bf-tx-fee-token{width:16px;height:16px;flex-shrink:0;border-radius:999px;object-fit:cover}.bf-info-card{gap:14px}.bf-info-section{display:flex;flex-direction:column;gap:10px}.bf-info-section+.bf-info-section{padding-top:2px}.bf-info-section h4{margin:0;color:var(--bf-text-high);font-size:14px;font-weight:600;line-height:1.5}.bf-root[data-view=history] .bf-detail-section h3,.bf-root[data-view=history] .bf-info-section h4{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.bf-info-rows{display:flex;flex-direction:column;gap:8px}.bf-info-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-liquidity-head{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.bf-info-label{display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--bf-text-low)}.bf-tree-marker{width:10px;flex-shrink:0;color:var(--bf-text-low)}.bf-info-value{min-width:0;color:var(--bf-text-medium);text-align:right}.bf-info-route,.bf-info-value-token{display:inline-flex;align-items:center;gap:4px}.bf-info-route .bf-token-icon,.bf-info-value-token .bf-token-icon{flex-shrink:0}.bf-info-route-arrow{color:var(--bf-text-medium)}.bf-root[data-view=history] .bf-info-route-arrow{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-root[data-view=history] .bf-info-label,.bf-root[data-view=history] .bf-liquidity-head,.bf-root[data-view=history] .bf-tree-marker{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-root[data-view=history] .bf-info-value{color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.bf-root[data-view=history] .bf-info-value[data-tone=accent]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-root[data-view=history] .bf-info-value[data-tone=warning]{color:var(--ds-system-orange-high, #e56f00)}.bf-liquidity-status{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:600;line-height:1.4;white-space:nowrap}.bf-liquidity-status:before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;flex-shrink:0}.bf-liquidity-status[data-status=normal],.bf-liquidity-status:not([data-status]){background:#00ceb21f;color:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=normal]:before,.bf-liquidity-status:not([data-status]):before{background:var(--ds-accent-primary-default, #00ceb2)}.bf-liquidity-status[data-status=low]{background:#e56f001f;color:#e56f00}.bf-liquidity-status[data-status=low]:before{background:#e56f00}.bf-liquidity-status[data-status=rebalancing]{background:#da0b2e1a;color:#da0b2e}.bf-liquidity-status[data-status=rebalancing]:before{background:#da0b2e}.bf-liquidity-track{height:8px;overflow:hidden;border-radius:999px;background:var(--bf-surface-hover)}.bf-liquidity-track span{display:block;height:100%;border-radius:inherit;background:var(--ds-accent-primary-default, #00ceb2)}.bf-error{padding:12px;border-radius:12px;background:#da0b2e1f;color:var(--ds-system-red-default, #da0b2e);font-size:13px;line-height:1.4}.bf-footer{display:flex;flex-shrink:0;flex-direction:column;align-items:center;gap:10px;padding:12px 24px 24px;background:var(--ds-bg-default, var(--bf-bg))}.bf-next{width:100%;min-height:48px;padding:12px;border:0;border-radius:12px;background:var(--ds-accent-primary-default, #00ceb2);color:var(--ds-accent-primary-on, #000000);font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer}.bf-next:disabled{cursor:default;opacity:.6}.bf-powered{display:inline-flex;align-items:center;gap:3px;color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-decoration:none}.bf-powered:focus-visible{border-radius:4px;outline:2px solid var(--ds-accent-primary-default, #00ceb2);outline-offset:2px}.bf-powered-brand{text-decoration:underline;text-underline-offset:2px}.bf-history-tabs{display:flex;align-items:center;gap:4px;width:100%}.bf-history-tab{position:relative;display:inline-flex;min-height:37px;align-items:center;justify-content:center;padding:8px 12px;border:0;background:transparent;color:var(--ds-content-lowest, rgba(0, 0, 0, .25));font:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;cursor:pointer}.bf-history-tab[data-active=true]{color:var(--ds-accent-primary-high, #00a0a2)}.bf-history-tab[data-active=true]:after{position:absolute;right:8px;bottom:0;left:8px;height:3px;border-radius:999px;background:var(--ds-accent-primary-high, #00a0a2);content:""}.bf-history-tab-dot{position:absolute;top:8px;right:4px;width:6px;height:6px;border-radius:999px;background:var(--ds-system-red-default, #da0b2e)}.bf-history-list{display:flex;flex-direction:column;gap:12px}.bf-history-item{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:12px;background:var(--ds-surface-default, #ffffff);box-sizing:border-box}.bf-history-item-head,.bf-history-meta,.bf-history-route,.bf-history-route-token{display:inline-flex;align-items:center}.bf-history-item-head{justify-content:space-between;gap:12px;width:100%}.bf-history-status{display:inline-flex;min-height:24px;align-items:center;justify-content:center;padding:3px 8px;border-radius:4px;background:var(--ds-system-orange-low, #fcf5e9);color:var(--ds-system-orange-high, #e56f00);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;white-space:nowrap}.bf-history-status[data-status=completed]{background:var(--ds-system-green-low, #e7f9f8);color:var(--ds-system-green-high, #00a0a2)}.bf-history-status[data-status=failed]{background:var(--ds-system-red-low, rgba(218, 11, 46, .12));color:var(--ds-system-red-default, #da0b2e)}.bf-history-time{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;text-align:right;white-space:nowrap}.bf-history-item-body{display:flex;flex-direction:column;gap:4px}.bf-history-amount{color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-meta{justify-content:space-between;gap:12px;min-width:0}.bf-history-usd{min-width:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route{justify-content:flex-end;gap:4px;min-width:0;color:var(--ds-content-high, rgba(0, 0, 0, .85));font-size:12px;font-weight:600;line-height:1.5;letter-spacing:0}.bf-history-route-token{gap:4px;min-width:0}.bf-history-route-token span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bf-history-route-arrow{flex-shrink:0;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.bf-empty{padding:32px 16px;text-align:center;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-size:14px}.bf-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:767px){.bf-token-picker-overlay{align-items:flex-end;padding:0}.bf-token-picker{width:100%;max-height:82dvh;min-height:min(520px,82dvh);border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}.bf-token-picker-handle{display:block;width:40px;height:4px;flex-shrink:0;align-self:center;margin:10px 0 0;border-radius:999px;background:#ffffff38}.bf-token-picker-head{min-height:55px;padding:12px 56px 16px 24px;border-bottom:0}.bf-token-picker-close{top:13px}.bf-token-search{margin:0 16px 12px}.bf-token-list{padding:0 16px 16px}.bf-slippage-overlay{align-items:flex-end;padding:0}.bf-slippage-dialog{width:100%;height:auto;min-height:316px;max-height:82dvh;border-right:0;border-bottom:0;border-left:0;border-radius:24px 24px 0 0}}.wi-drawer-content .bf-header{padding:16px}.wi-drawer-content .bf-header .bf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .bf-body,.wi-drawer-content .bf-history-body{padding:16px}
|
|
10
|
-
`);var s=require("react/jsx-runtime"),Nl=L.createContext(void 0);function Fn(){return L.useContext(Nl)}function yp(e){let[t,n]=L.useState(void 0);return L.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.closest("[data-theme]");n(i?.getAttribute("data-theme")??void 0)};r();let a=new MutationObserver(r);return a.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[e]),t}var kl=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],kp=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Sp(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Sl(e){let t=e.replace(/[^\d.]/g,""),[n="",...o]=t.split("."),r=o.join("");return o.length===0?n:`${n}.${r.slice(0,2)}`}function Rp(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Il(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Rl(e,t){let n=Number(e||"0"),o=t?.priceUsd??0;return`\u2248 $${(Number.isFinite(n)?n*o:0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})} USD`}function Cp(e,t=6){if(!e)return e;let[n,o=""]=e.split(".");if(!o)return n;let r=o.slice(0,t).replace(/0+$/,"");return r?`${n}.${r}`:n}function Tp(e,t){if(!t)return!1;let n=new At.default(e||"0"),o=new At.default(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Np(e){if(e.priceUsd===void 0)return null;let t=new At.default(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Ip(e){if(e.priceUsd===void 0)return null;let t=new At.default(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function El(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,At.default.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new At.default(o||"0").toFormat(0);return r?`${a}.${r}`:a}function Ep(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function Lp(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=o=>o.toString().padStart(2,"0");return[`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`].join(" ")}function Ap(e){let t=new At.default(e||"0");return!t.isFinite()||t.isNaN()?e||"0":El(t)}function Pp(e,t){if(t?.priceUsd===void 0)return null;let n=new At.default(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function rr(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function Fp(e,t){return t==="all"?!0:rr(e)===t}function Bp(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Cl(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function Ll(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function Al(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":Ll(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function Pl(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function or(e){return!e||e==="0"||Number(e)===0}function _p(e){let t=e.trim().toLowerCase();return t?t.startsWith("minimum ")?{from:e}:t.startsWith("available ")&&t.includes("or more")?{to:e}:t.includes("insufficient balance")||t.includes("not enough balance")||t.includes("exceeds balance")||t.includes("insufficient network fee")?{from:e}:t.includes("insufficient liquidity")||t.includes("not enough liquidity")?{to:e}:{}:{}}function Mp(e){let t=e.fromToken,n=e.toToken,o=Al(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!Pl(o),l=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${Cl(t.chainId)} \u2192 ${Cl(n.chainId)}`:"-"},{label:"Validator Fee",value:or(r)?"0":"Free",tone:or(r)?"default":"accent"},{label:"Network Fee",value:or(r)?"0":"Free",tone:or(r)?"default":"accent"}]:void 0,swapInfo:l?[t&&n?{label:"Route",value:"",routeTokens:[{symbol:t.symbol,iconUrl:t.iconUrl},{symbol:n.symbol,iconUrl:n.iconUrl}]}:{label:"Route",value:"-"},{label:"Price Impact",value:"0%"},{label:"In Amount",value:r,valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Swap Fee",value:"0",valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Out Amount",value:a,valueToken:n?{symbol:n.symbol,iconUrl:n.iconUrl}:void 0}]:void 0,txFee:[{label:"Priority Fee Per Gas",value:"0 Gwei"},{label:"Max Fee Per Gas",value:"0 Gwei"},{label:"Gas Limit",value:"0"}],txFeeInfo:{estTxFee:"0",isDelegateFee:!1}}}function to({token:e,size:t=20}){let n=e?.iconUrl;return(0,s.jsx)("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?(0,s.jsx)("img",{src:n,alt:"",width:t,height:t,draggable:!1}):(0,s.jsx)("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function Tl({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a,locked:i=!1}){return(0,s.jsxs)("section",{className:"bf-amount-panel",children:[(0,s.jsxs)("div",{className:"bf-amount-head",children:[(0,s.jsx)("span",{children:e}),(0,s.jsxs)("span",{className:"bf-balance",children:[Il(t?.balance??"0")," ",t?.symbol??""]})]}),(0,s.jsxs)("div",{className:"bf-amount-main",children:[(0,s.jsxs)("label",{className:"bf-amount-input-wrap",children:[(0,s.jsxs)("span",{className:"bf-sr-only",children:[e," amount"]}),(0,s.jsx)("input",{type:"text",inputMode:"decimal",value:n,onChange:l=>r(l.target.value),placeholder:"0",className:"bf-amount-input"}),(0,s.jsx)("span",{className:"bf-amount-usd",children:o})]}),(0,s.jsxs)("button",{type:"button",className:"bf-token-pill",onClick:i?void 0:a,disabled:!i&&!a,"data-locked":i?"true":void 0,"aria-label":`Select ${e.toLowerCase()} token`,children:[(0,s.jsx)(to,{token:t}),(0,s.jsx)("span",{children:t?.symbol??"Select"}),!i&&(0,s.jsx)(pn,{size:16})]})]})]})}function Op({flow:e,side:t,onClose:n}){let o=L.useId(),[r,a]=L.useState(""),[i,l]=L.useState(null),d=Fn(),c=t==="from"?e.fromToken:e.toToken;L.useEffect(()=>{l(document.body)},[]),L.useEffect(()=>{let g=y=>{y.key==="Escape"&&n()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let f=L.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),w=L.useMemo(()=>{let g=r.trim().toLowerCase();return g?f.filter(y=>y.symbol.toLowerCase().includes(g)||y.name.toLowerCase().includes(g)):f},[r,f]),h=L.useCallback(g=>{t==="from"?e.selectFromToken(g):e.selectToToken(g),n()},[e,n,t]);return i?(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-token-picker-overlay","data-theme":d,role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&n()},children:(0,s.jsxs)("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[(0,s.jsx)("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),(0,s.jsxs)("header",{className:"bf-token-picker-head",children:[(0,s.jsx)("h3",{id:o,children:"Select a token"}),(0,s.jsx)("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:(0,s.jsx)(_t,{size:24})})]}),(0,s.jsxs)("label",{className:"bf-token-search",children:[(0,s.jsx)(sl,{size:20}),(0,s.jsx)("span",{className:"bf-sr-only",children:"Search tokens"}),(0,s.jsx)("input",{value:r,onChange:g=>a(g.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),(0,s.jsxs)("div",{className:"bf-token-list",children:[w.map(g=>{let y=Ll(g,c),b=y?Ip(g):Np(g);return(0,s.jsxs)("button",{type:"button",className:"bf-token-row","data-selected":y?"true":"false",onClick:()=>h(g),children:[(0,s.jsxs)("span",{className:"bf-token-row-left",children:[(0,s.jsx)(to,{token:g,size:40}),(0,s.jsxs)("span",{className:"bf-token-meta",children:[(0,s.jsx)("span",{className:"bf-token-symbol",children:g.symbol}),!y&&(0,s.jsx)("span",{className:"bf-token-name",children:g.name})]})]}),(0,s.jsxs)("span",{className:"bf-token-row-right",children:[(0,s.jsxs)("span",{className:"bf-token-balance",children:[Il(g.balance),y?null:` ${g.symbol}`]}),b&&(0,s.jsx)("span",{className:"bf-token-price",children:b})]})]},Rp(g))}),w.length===0&&(0,s.jsx)("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i):null}function Wp({flow:e,onClose:t}){let n=L.useId(),[o,r]=L.useState(null),a=kl.find(b=>b.value===e.slippage),[i,l]=L.useState(e.slippage&&!a?e.slippage:""),d=i.trim()!==""&&i.trim()!==".",c=d?Number(i):NaN,f=Number.isFinite(c)&&c>50,w=Number.isFinite(c)&&c>5&&!f,h=b=>{e.setSlippage(b),t()},g=()=>{!d||f||(e.setSlippage(Sl(i)),t())};if(L.useEffect(()=>{r(document.body)},[]),L.useEffect(()=>{let b=m=>{m.key==="Escape"&&t()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t]),!o)return null;let y=Fn();return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-slippage-overlay","data-theme":y,role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:(0,s.jsxs)("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[(0,s.jsxs)("header",{className:"bf-slippage-head",children:[(0,s.jsx)("h3",{id:n,children:"Slippage Settings"}),(0,s.jsx)("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:(0,s.jsx)(_t,{size:24})})]}),(0,s.jsxs)("div",{className:"bf-slippage-body",children:[(0,s.jsx)("p",{className:"bf-slippage-desc",children:"The maximum price difference you are willing to accept before the transaction is reverted. Higher slippage increases the chance of execution but may result in a worse price."}),(0,s.jsxs)("div",{className:"bf-slippage-controls",children:[(0,s.jsx)("div",{className:"bf-slippage-presets",children:kl.map(b=>(0,s.jsx)("button",{type:"button",className:"bf-slippage-preset","data-selected":!d&&e.slippage===b.value?"true":"false",onClick:()=>h(b.value),children:b.label},b.value))}),(0,s.jsxs)("label",{className:"bf-slippage-custom","data-selected":d?"true":"false",children:[(0,s.jsx)("span",{className:"bf-sr-only",children:"Custom slippage percent"}),(0,s.jsx)("input",{value:i,onChange:b=>{l(Sl(b.target.value))},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),g())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"})]})]}),f?(0,s.jsx)("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):w?(0,s.jsx)("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,d&&(0,s.jsx)("button",{type:"button",className:"bf-slippage-apply",onClick:g,disabled:f,children:"Apply"})]})]})}),o)}function Dp({flow:e}){let t=L.useId(),[n,o]=L.useState(!1),[r,a]=L.useState(null),i=Fn();return L.useEffect(()=>{a(document.body)},[]),L.useEffect(()=>{let l=d=>{d.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e]),!r||!e.termsOpen?null:(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:l=>{l.target===l.currentTarget&&e.cancelTerms()},children:(0,s.jsxs)("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[(0,s.jsx)("h3",{id:t,children:"Agree to Terms of Service"}),(0,s.jsx)("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),(0,s.jsxs)("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[(0,s.jsx)("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,"aria-label":"Agree to Terms of Use",onClick:()=>o(l=>!l),children:(0,s.jsx)("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"bf-terms-copy",children:[(0,s.jsx)("span",{className:"bf-terms-label",children:"Agree to Terms of Use"}),e.termsUrl&&(0,s.jsx)("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]})]}),(0,s.jsx)("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),(0,s.jsx)("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,children:"Confirm"})]})}),r)}function zp({value:e,disabled:t=!1}){let[n,o]=L.useState(!1);return(0,s.jsx)("button",{type:"button",className:"bf-copy-button","aria-label":"Copy token address",disabled:t,onClick:()=>{t||navigator.clipboard?.writeText(e).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:n?"OK":"Copy"})}function Gp({flow:e,approval:t}){let n=L.useId(),[o,r]=L.useState(null),a=Fn();if(L.useEffect(()=>{r(document.body)},[]),L.useEffect(()=>{let d=c=>{e.status!=="submitting"&&c.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e]),!o)return null;let i=e.status==="submitting"||!e.approveBridge,l=e.status==="submitting";return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:(0,s.jsxs)("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[(0,s.jsxs)("h3",{id:n,children:["Approve ",t.token.symbol]}),(0,s.jsx)(to,{token:t.token,size:72}),(0,s.jsxs)("div",{className:"bf-approve-address-box",children:[(0,s.jsx)("span",{children:"Token Address"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:t.tokenAddress}),(0,s.jsx)(zp,{value:t.tokenAddress,disabled:l})]})]}),(0,s.jsxs)("div",{className:"bf-action-buttons",children:[(0,s.jsx)("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),(0,s.jsxs)("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":l,children:[l&&(0,s.jsx)("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),(0,s.jsx)("span",{children:l?"Approving...":"Approve"})]})]})]})}),o)}function Hp({flow:e}){let t=L.useId(),[n,o]=L.useState(null),r=Fn();if(L.useEffect(()=>{o(document.body)},[]),L.useEffect(()=>{if(!e.approvalSuccessOpen)return;let i=l=>{l.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.approvalSuccessOpen)return null;let a=e.status==="submitting";return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:(0,s.jsxs)("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[(0,s.jsx)("h3",{id:t,children:"Approval Success"}),(0,s.jsx)("span",{className:"bf-success-mark","aria-hidden":"true"}),(0,s.jsxs)("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",(0,s.jsx)("br",{}),"Please continue to the next step."]}),(0,s.jsxs)("div",{className:"bf-action-buttons",children:[(0,s.jsx)("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:a,children:"Cancel"}),(0,s.jsxs)("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,disabled:a,"aria-busy":a,children:[a&&(0,s.jsx)("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),(0,s.jsx)("span",{children:a?"Continuing...":"Continue"})]})]})]})}),n)}function Up({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=L.useState(!1),i=L.useMemo(()=>{let c=new At.default(e||"0"),f=new At.default(t||"0");return!c.isFinite()||!f.isFinite()||c.lte(0)||f.lte(0)?null:r?c.dividedBy(f):f.dividedBy(c)},[e,r,t]);if(!i||!n||!o||n.symbol===o.symbol)return null;let l=r?o.symbol:n.symbol,d=r?n.symbol:o.symbol;return(0,s.jsxs)("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(c=>!c),children:[(0,s.jsxs)("span",{children:["1 ",l]}),(0,s.jsx)(fl,{size:12}),(0,s.jsxs)("span",{children:[El(i)," ",d]})]})}function $p({flow:e}){return e.submitToast?(0,s.jsxs)("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[(0,s.jsx)("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:(0,s.jsx)("span",{className:"bf-status-spinner"})}),(0,s.jsxs)("span",{className:"bf-status-toast-copy",children:[(0,s.jsx)("strong",{children:"Transaction Processing"}),(0,s.jsx)("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function jp({message:e}){let[t,n]=L.useState(!1);return L.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:(0,s.jsxs)("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[(0,s.jsx)("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:(0,s.jsx)("span",{className:"bf-status-error-mark",children:"!"})}),(0,s.jsxs)("span",{className:"bf-status-toast-copy",children:[(0,s.jsx)("strong",{children:"Error"}),(0,s.jsx)("span",{children:e})]})]})}function Vp(e){switch(e){case"swap":case"deposit-swap":case"swap-withdraw":return"Swap Transaction Sent";case"bridge":return"Bridge Transaction Sent";case"swap-bridge":return"Swap & Bridge Transaction Sent";case"bridge-swap":return"Bridge & Swap Transaction Sent";default:return"Transaction Sent"}}function qp({flow:e}){let t=L.useId(),[n,o]=L.useState(null),r=e.submitted,a=Fn();return L.useEffect(()=>{o(document.body)},[]),L.useEffect(()=>{if(!e.successDialogOpen)return;let i=l=>{l.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.successDialogOpen||!r?null:(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:(0,s.jsx)("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:(0,s.jsxs)("div",{className:"bf-success-body",children:[(0,s.jsx)("span",{className:"bf-success-mark","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"bf-success-copy",children:[(0,s.jsx)("strong",{id:t,children:Vp(r.pathType)}),(0,s.jsx)("span",{children:"Please check the results in the history."})]}),(0,s.jsx)("div",{className:"bf-success-route","aria-hidden":"true",children:(r.routeTokens&&r.routeTokens.length>0?r.routeTokens:[{symbol:r.fromToken.symbol,iconUrl:r.fromToken.iconUrl},{symbol:r.toToken.symbol,iconUrl:r.toToken.iconUrl}]).map((i,l)=>(0,s.jsxs)(L.Fragment,{children:[l>0&&(0,s.jsx)("span",{className:"bf-success-route-arrow",children:"\u2192"}),(0,s.jsx)(oi,{token:i,size:43})]},`${i.symbol}-${l}`))}),(0,s.jsx)("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function oi({token:e,size:t=16}){let n=!!e.iconUrl;return(0,s.jsx)("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?(0,s.jsx)("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):(0,s.jsx)("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function Kp({row:e}){return e.routeTokens&&e.routeTokens.length>0?(0,s.jsx)("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>(0,s.jsxs)(L.Fragment,{children:[n>0&&(0,s.jsx)("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),(0,s.jsx)(oi,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?(0,s.jsxs)("span",{className:"bf-info-value-token",children:[(0,s.jsx)(oi,{token:e.valueToken}),(0,s.jsx)("span",{children:e.value})]}):(0,s.jsx)(s.Fragment,{children:e.value})}function Fl({rows:e}){return!e||e.length===0?null:(0,s.jsx)("div",{className:"bf-info-rows",children:e.map((t,n)=>(0,s.jsxs)("div",{className:"bf-info-row",children:[(0,s.jsxs)("span",{className:"bf-info-label",children:[(0,s.jsx)("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),(0,s.jsx)("span",{children:t.label})]}),(0,s.jsx)("span",{className:"bf-info-value","data-tone":t.tone??"default",children:(0,s.jsx)(Kp,{row:t})})]},`${t.label}-${t.value}`))})}function Qp(e,t,n){return e.pathType==="bridge"?"Bridge Info":Pl(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function Yp({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return(0,s.jsx)(s.Fragment,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?(0,s.jsxs)("div",{className:"bf-info-section",children:[o&&(0,s.jsx)("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),(0,s.jsx)(Fl,{rows:i})]},a):null})})}function Zp({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=Qp(e,t,n),[a,i]=L.useState(!0),[l,d]=L.useState(!0);return(0,s.jsxs)("div",{className:"bf-details",children:[e.liquidity&&(0,s.jsxs)("section",{className:"bf-liquidity",children:[(0,s.jsxs)("div",{className:"bf-liquidity-head",children:[(0,s.jsx)("span",{children:e.liquidity.label??"Available Liquidity"}),(0,s.jsx)("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),(0,s.jsx)("div",{className:"bf-liquidity-track",children:(0,s.jsx)("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&(0,s.jsxs)("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[(0,s.jsxs)("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(c=>!c),children:[(0,s.jsx)("h3",{children:r}),(0,s.jsx)(pn,{size:16,className:"bf-collapse-chevron"})]}),a&&(0,s.jsx)("div",{className:"bf-collapse-body",children:(0,s.jsx)(Yp,{summary:e})})]}),o&&(0,s.jsxs)("section",{className:"bf-detail-section bf-tx-fee-section","data-open":l?"true":"false",children:[(0,s.jsxs)("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":l,onClick:()=>d(c=>!c),children:[(0,s.jsx)("h3",{children:"Est. Tx Fee"}),(0,s.jsxs)("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&(0,s.jsx)("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&(0,s.jsx)("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),(0,s.jsx)("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:Cp(e.txFeeInfo?.estTxFee??"0")}),(0,s.jsx)(pn,{size:16,className:"bf-collapse-chevron"})]})]}),l&&(0,s.jsx)("div",{className:"bf-collapse-body",children:(0,s.jsx)(Fl,{rows:e.txFee})})]})]})}function Xp({item:e}){let t=rr(e),n=Pp(e.fromAmount,e.fromToken);return(0,s.jsxs)("article",{className:"bf-history-item",children:[(0,s.jsxs)("div",{className:"bf-history-item-head",children:[(0,s.jsx)("span",{className:"bf-history-status","data-status":t,children:Bp(t)}),(0,s.jsx)("time",{className:"bf-history-time",dateTime:e.timestamp,children:Lp(e.timestamp)})]}),(0,s.jsxs)("div",{className:"bf-history-item-body",children:[(0,s.jsxs)("strong",{className:"bf-history-amount",children:[Ap(e.fromAmount)," ",e.fromToken.symbol]}),(0,s.jsxs)("div",{className:"bf-history-meta",children:[(0,s.jsx)("span",{className:"bf-history-usd",children:n??Ep(e.txHash)}),(0,s.jsxs)("span",{className:"bf-history-route",children:[(0,s.jsxs)("span",{className:"bf-history-route-token",children:[(0,s.jsx)(to,{token:e.fromToken,size:16}),(0,s.jsx)("span",{children:e.fromToken.symbol})]}),(0,s.jsx)(pl,{size:16,className:"bf-history-route-arrow"}),(0,s.jsxs)("span",{className:"bf-history-route-token",children:[(0,s.jsx)(to,{token:e.toToken,size:16}),(0,s.jsx)("span",{children:e.toToken.symbol})]})]})]})]})]})}function Jp({flow:e}){let[t,n]=L.useState("all"),o=e.history.some(i=>rr(i)==="pending"),r=e.history.filter(i=>Fp(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return(0,s.jsxs)("main",{className:"bf-history-body",children:[(0,s.jsx)("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:kp.map(i=>(0,s.jsxs)("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[(0,s.jsx)("span",{children:i.label}),i.value==="pending"&&o&&(0,s.jsx)("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?(0,s.jsx)("div",{className:"bf-history-list",children:r.map(i=>(0,s.jsx)(Xp,{item:i},i.id||i.txHash))}):(0,s.jsx)("div",{className:"bf-empty",children:a})]})}function ef({flow:e,env:t}){let[n,o]=L.useState(null),[r,a]=L.useState(!1),[i,l]=L.useState(0),c=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??Mp(e):null,f=un("apps.json",t,u=>fn(u?.bridgePoweredBy?.url,t)),w=_p(e.quoteError),h=Tp(e.fromAmount,e.fromToken),g=h?"Insufficient balance":w.from,y=e.quoteError&&!w.from&&!w.to?e.quoteError:"",b=e.error||y,m=e.history.some(u=>rr(u)==="pending"),R=(c?.pathType??Al(e.fromToken,e.toToken))!=="bridge";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("main",{className:"bf-body",children:[(0,s.jsxs)("div",{className:"bf-toolbar",children:[(0,s.jsxs)("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[(0,s.jsx)(ll,{}),(0,s.jsx)("span",{children:"History"}),(m||e.hasNewHistory)&&(0,s.jsx)("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),R&&(0,s.jsxs)("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[(0,s.jsx)(cl,{}),(0,s.jsx)("span",{children:e.slippageLocked?"Auto 1%":Sp(e.slippage,e.effectiveSlippage)})]})]}),(0,s.jsxs)("div",{className:"bf-swap-card","data-has-from-error":g?"true":"false",children:[(0,s.jsx)(Tl,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Rl(e.fromAmount,e.fromToken),onAmountChange:u=>e.setAmount(u,"from"),onTokenClick:()=>o("from")}),g&&(0,s.jsx)("div",{className:"bf-field-error",children:g}),(0,s.jsx)("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),l(u=>u+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:(0,s.jsx)(dl,{size:22})}),(0,s.jsx)(Tl,{label:"To",token:e.toToken,amount:e.toAmount,usd:Rl(e.toAmount,e.toToken),onAmountChange:u=>e.setAmount(u,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),w.to&&(0,s.jsx)("div",{className:"bf-field-error",children:w.to})]}),(0,s.jsx)(Up,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),c&&(0,s.jsx)(Zp,{summary:c})]}),(0,s.jsxs)("footer",{className:"bf-footer",children:[(0,s.jsx)("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError||h,children:e.status==="submitting"?"Processing...":"Next"}),f&&(0,s.jsxs)("a",{className:"bf-powered",href:f,target:"_blank",rel:"noreferrer",children:["Powered by ",(0,s.jsx)("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&(0,s.jsx)(Op,{flow:e,side:n,onClose:()=>o(null)}),r&&(0,s.jsx)(Wp,{flow:e,onClose:()=>a(!1)}),(0,s.jsx)(Dp,{flow:e}),e.approvalInfo&&(0,s.jsx)(Gp,{flow:e,approval:e.approvalInfo}),(0,s.jsx)(Hp,{flow:e}),(0,s.jsx)($p,{flow:e}),(0,s.jsx)(jp,{message:e.submitToast?"":b}),(0,s.jsx)(qp,{flow:e})]})}function no({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=L.useMemo(()=>Oe(n),[n]),i=yl({...r,onExit:t}),l=L.useRef(null),d=yp(l),c=i.step==="history"?"History":"Swap & Bridge";return(0,s.jsx)(Nl.Provider,{value:d,children:(0,s.jsxs)("div",{ref:l,className:de("bf-root",o),"data-view":i.step,"data-status":i.status,children:[(0,s.jsxs)("header",{className:"bf-header",children:[(0,s.jsx)("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:(0,s.jsx)(dn,{size:24})}),(0,s.jsx)("span",{className:"bf-header-title",children:c}),(0,s.jsx)("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:(0,s.jsx)(_t,{size:24})})]}),i.step==="history"?(0,s.jsx)(Jp,{flow:i}):(0,s.jsx)(ef,{flow:i,env:a})]})})}var p=require("react/jsx-runtime"),tf="On-ramp is not available in your region.";function ri(e,t,n){let o=Ie[e],r=n.toUpperCase();if(t===o.cross&&r.includes("CROSSD"))return 0;if(t===o.cross&&r==="CROSS")return 1;if(t===o.bsc&&r==="CROSS")return 2}function nf(e){return parseInt(e.split(":")[1],10)}function of(e){if(typeof window>"u"||!e?.length)return!1;let{origin:t,pathname:n}=window.location,o=t+n;return e.some(r=>o===r||o.startsWith(`${r}/`))}function rf(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function af(e){let t=e.toLowerCase().replace(/^0x/,""),n=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(n.slice(0,4),16)%360,r=(o+60+parseInt(n.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${r} 80% 55%))`}function _l({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:a,isMobile:i,open:l,drawerDirection:d,modal:c,showBalance:f,showForgeToken:w,showGameToken:h,showQR:g,showBridge:y,qrLogoSrc:b,walletAddress:m,accountName:v,sendAccounts:R,profileImageUrl:u,preferredTokens:T,close:k,onSelectWallet:N,onCopyAddress:S,onBuy:G,onDisconnect:O,disconnectLabel:H,termsUrl:B,termsLabel:le,privacyUrl:I,privacyLabel:ie,portalStyle:W,navContent:q,navPosition:ye,footerContent:te,view:$,setView:he,selectedSendToken:fe,setSelectedSendToken:j,showPortfolio:Be,portfolioTitle:F,portfolioSections:ne,showTotalAssets:be,totalAssetsLabel:De,sendTransaction:ee,getTransactionReceipt:ue,estimateGas:_e,onOutlink:Me,lpBalanceReader:$t,stakingRewardsReader:ze,bridgeTokens:Ee,bridgeHistory:ft,getBridgeQuote:Ge,getBridgeToTokens:Ve,getBridgeApproval:Le,approveBridge:Pt,submitBridge:wt,onReceive:Ft,onSend:st,onBuyDisabledMessage:xt,onBridgeDisabledMessage:ut,onSendDisabledMessage:Ce}=Yt(),[Bt,mt]=z.useState(null),qe=z.useRef(void 0),He=z.useCallback(x=>{mt(x),clearTimeout(qe.current),qe.current=setTimeout(()=>mt(null),4e3)},[]);z.useEffect(()=>()=>clearTimeout(qe.current),[]);let Ke=!!xt,it=z.useCallback(()=>{if(Ke){He(xt);return}let x=G?.();x&&typeof x.then=="function"&&x.catch(()=>{He(xt??tf)})},[Ke,xt,G,He]),lt=!!ut,at=!!Ce,{tokens:gt,isLoading:vt}=qt(r,m,l&&f),{statsMap:Ze}=Kt(r,f),{apyPercent:Xe}=Va(),{categoryMap:Je}=Qa(r,f),E=f&&be,{displayValue:oe,isLowerBound:Te,isLoading:ct}=Za(r,m,l&&E),[ht,yt]=z.useState(!1),Sn=z.useRef(null),[kt,mo]=z.useState(0),{holdings:on,isLoading:D}=Ga(r,m,l&&f&&w),Ue=z.useMemo(()=>on.map(x=>x.token),[on]),{imageMap:Q}=Ha(r,Ue,w&&on.length>0),we=z.useMemo(()=>{let x=[],_=[],re=[],tt=new Map((T??[]).map((ce,Qe)=>[`${nf(ce.chainId)}:${ce.address.toLowerCase()}`,Qe]));for(let ce of gt){let Qe=ri(r,ce.chainId,ce.symbol)!==void 0,Rt=`${ce.chainId}:${ce.address.toLowerCase()}`,an=tt.get(Rt),xr=new Bn.default(ce.quantity.numeric).shiftedBy(-ce.quantity.decimals);if(Qe)x.push(ce);else if(an!==void 0)_.push(ce);else if(xr.isGreaterThan(0)){if(!h&&Je.get(Wr(ce.chainId,ce.address))==="game")continue;re.push(ce)}}return x.sort((ce,Qe)=>{let Rt=ri(r,ce.chainId,ce.symbol)??99,an=ri(r,Qe.chainId,Qe.symbol)??99;return Rt-an}),_.sort((ce,Qe)=>{let Rt=tt.get(`${ce.chainId}:${ce.address.toLowerCase()}`)??99,an=tt.get(`${Qe.chainId}:${Qe.address.toLowerCase()}`)??99;return Rt-an}),re.sort((ce,Qe)=>{let Rt=Ze.get(Nt(ce.chainId,ce.address)),an=Ze.get(Nt(Qe.chainId,Qe.address)),xr=new Bn.default(ce.quantity.numeric).shiftedBy(-ce.quantity.decimals).multipliedBy(Rt?.price??0);return new Bn.default(Qe.quantity.numeric).shiftedBy(-Qe.quantity.decimals).multipliedBy(an?.price??0).minus(xr).toNumber()}),[...x,..._,...re]},[gt,r,Ze,h,Je,T]),go=z.useMemo(()=>{if(!w)return[];let x=new Set(gt.map(_=>_.address.toLowerCase()));return[...on].filter(_=>!x.has(_.token.toLowerCase())).sort((_,re)=>{let tt=new Bn.default(_.value);return new Bn.default(re.value).minus(tt).toNumber()})},[on,w,gt]),rn=z.useRef(!1),[et,Mn]=z.useState(null),Rn=z.useRef(void 0),pi=et?.chainId??fe?.chainId??we[0]?.chainId??0,{transactionUrl:fr}=Po(r,pi,et?.txHash,!!(et?.txHash&&pi)),St=z.useCallback(x=>{rn.current=!0,he(x)},[he]),[ac,ur]=z.useState("recipient"),ho=z.useCallback(()=>{j(null),ur("recipient"),St("wallet")},[j,St]),mr=z.useCallback((x,_="recipient")=>{if(at){He(Ce);return}ur(_),j(x),St("send")},[at,Ce,He,j,St]),bo=un("apps.json",r,x=>fn(x?.gametokenBridge,r)),fi=un("apps.json",r,x=>x?.gametokenSites),sc=z.useCallback(()=>{if(lt){He(ut);return}if(bo){if(of(fi)){window.location.assign(bo);return}window.open(bo,"_blank","noopener,noreferrer")}},[lt,ut,bo,fi,He]),lc=z.useCallback(x=>{clearTimeout(Rn.current),j(null),St("wallet"),Mn({status:"pending",txHash:x.txHash,chainId:x.chainId,description:`${x.amount} ${x.tokenSymbol} to ${dt(x.recipient)}`})},[j,St]),cc=z.useCallback(x=>{let _=fe?.chainId;j(null),St("wallet"),!(!x||!_)&&(Mn(re=>({status:"success",txHash:x,chainId:_,description:re?.txHash===x?re.description:"Tap to see your transaction"})),clearTimeout(Rn.current),Rn.current=setTimeout(()=>Mn(null),5e3))},[fe?.chainId,j,St]),dc=z.useCallback(x=>{let _=x.txHash;_&&(Mn({status:"error",txHash:_,chainId:x.chainId,description:x.message}),clearTimeout(Rn.current),Rn.current=setTimeout(()=>Mn(null),5e3))},[]),On=z.useMemo(()=>{if(Ft)return Ft;if(g)return()=>St("qr")},[Ft,g,St]),gr=z.useMemo(()=>{if(st)return st;if(we.length===0)return;let x=we[0];return()=>mr(x,"token")},[st,we,mr]),pc=z.useCallback(()=>{if(at){He(Ce);return}gr?.()},[at,Ce,gr,He]);z.useEffect(()=>{l||(rn.current=!1,ur("recipient"))},[l]);let ui=z.useRef(null);z.useEffect(()=>{let x=ui.current;if(!x||!i)return;let _=re=>{re.pointerType==="touch"&&re.stopPropagation()};return x.addEventListener("pointerdown",_),()=>x.removeEventListener("pointerdown",_)},[i]);let[Cn,mi]=z.useState(!1),hr=z.useRef(void 0),[Wn,Dn]=z.useState(!1);z.useEffect(()=>{if(!Wn)return;let x=()=>Dn(!1),_=tt=>{tt.key==="Escape"&&Dn(!1)},re=setTimeout(()=>{document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",_,!0)},0);return()=>{clearTimeout(re),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",_,!0)}},[Wn]),z.useEffect(()=>{Dn(!1)},[m]),z.useEffect(()=>()=>clearTimeout(hr.current),[]),z.useEffect(()=>()=>clearTimeout(Rn.current),[]),z.useEffect(()=>{let x=Sn.current;if(!x||te===null){mo(0);return}let _=()=>{mo(x.offsetHeight)};if(_(),typeof ResizeObserver>"u")return;let re=new ResizeObserver(_);return re.observe(x),()=>re.disconnect()},[te]);let gi=z.useCallback(async()=>{if(!Cn)try{await navigator.clipboard.writeText(m),mi(!0),clearTimeout(hr.current),hr.current=setTimeout(()=>mi(!1),2e3),S?.(m,!0)}catch{S?.(m,!1)}},[m,S,Cn]),wo=z.useCallback(x=>{x.currentTarget.setAttribute("data-loaded","true")},[]),hi=z.useMemo(()=>({background:af(m)}),[m]),xo=z.useMemo(()=>u||Vt(r,m,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[u,r,m,a]),br=z.useMemo(()=>rf(oe),[oe]),bi=B||I?(0,p.jsxs)("div",{className:"wi-legal-links",children:[B&&(0,p.jsx)("a",{className:"wi-legal-link",href:B,target:"_blank",rel:"noopener noreferrer",onClick:x=>nt(x,B,{category:"terms",origin:"terms"},Me),children:le}),B&&I&&(0,p.jsx)("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),I&&(0,p.jsx)("a",{className:"wi-legal-link",href:I,target:"_blank",rel:"noopener noreferrer",onClick:x=>nt(x,I,{category:"privacy",origin:"privacy"},Me),children:ie})]}):null,wi=O?(0,p.jsxs)("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{O(),k()},children:[(0,p.jsx)(Ui,{size:16}),(0,p.jsx)("span",{className:"wi-disconnect-label",children:H})]}):null,fc=f&&!q?(0,p.jsxs)("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",Ke&&"wi-action-card--dimmed"),onClick:it,disabled:!G&&!Ke,"aria-disabled":Ke||void 0,"aria-label":"Buy",children:[(0,p.jsx)(Qi,{size:20}),(0,p.jsx)("span",{children:"Buy"})]}),y?(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",lt&&"wi-action-card--dimmed"),onClick:sc,"aria-disabled":lt||void 0,"aria-label":"Bridge",children:[(0,p.jsx)(Yi,{size:20}),(0,p.jsx)("span",{children:"Bridge"})]}):(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:On,disabled:!On,"aria-label":"Receive",children:[(0,p.jsx)(Lo,{size:20}),(0,p.jsx)("span",{children:"Receive"})]}),(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",at&&"wi-action-card--dimmed"),onClick:pc,disabled:!at&&!gr,"aria-disabled":at||void 0,"aria-label":"Send",children:[(0,p.jsx)(qi,{size:20}),(0,p.jsx)("span",{children:"Send"})]}),Be?(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:()=>St("portfolio"),"aria-label":"View portfolio",children:[(0,p.jsx)(Ki,{size:20}),(0,p.jsx)("span",{children:"Portfolio"})]}):y?(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:On,disabled:!On,"aria-label":"Receive",children:[(0,p.jsx)(Lo,{size:20}),(0,p.jsx)("span",{children:"Receive"})]}):null]}):null,uc=(0,p.jsxs)("div",{className:de("wi-view-inner",rn.current&&"wi-view-wallet"),children:[E&&(0,p.jsxs)("div",{className:"wi-total-section",children:[(0,p.jsxs)("div",{className:"wi-total-head",children:[(0,p.jsx)("span",{className:"wi-total-label",children:De}),(0,p.jsx)("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:x=>{x.stopPropagation(),yt(_=>!_)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),yt(_=>!_))},"aria-label":ht?"Show balance":"Hide balance",children:ht?(0,p.jsx)(ji,{}):(0,p.jsx)($i,{})})]}),(0,p.jsx)("div",{className:"wi-total-body",children:ct?(0,p.jsx)("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):(0,p.jsx)("div",{className:"wi-total-value","data-hidden":ht||void 0,children:ht?(0,p.jsx)("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):(0,p.jsxs)(p.Fragment,{children:[Te&&(0,p.jsx)("span",{className:"wi-total-lte",children:"\u2264"}),(0,p.jsx)("span",{className:"wi-total-currency",children:"$"}),(0,p.jsx)("span",{className:"wi-total-amount",children:br.main}),br.decimal&&(0,p.jsx)("span",{className:"wi-total-decimal",children:br.decimal})]})})})]}),ye==="top"&&(q?(0,p.jsx)("div",{className:"wi-nav-fixed",children:q}):fc),f&&(0,p.jsx)("div",{ref:ui,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:(0,p.jsxs)("div",{className:"wi-token-list",children:[vt&&Array.from({length:5},(x,_)=>(0,p.jsxs)("div",{className:"wi-skeleton-item",children:[(0,p.jsxs)("div",{className:"wi-skeleton-left",children:[(0,p.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,p.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,p.jsxs)("div",{className:"wi-skeleton-right",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},_)),!vt&&we.length===0&&!w&&(0,p.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),we.map(x=>{let _=Ze.get(Nt(x.chainId,x.address)),re=_?parseFloat(_.percent_change_24h):null,tt=re!==null&&re>=0,ce=Vn(r,x.chainId),Qe=xa(x.address);return(0,p.jsxs)("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>mr(x),"aria-label":`Send ${x.symbol}`,children:[(0,p.jsxs)("div",{className:"wi-token-left",children:[(0,p.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,p.jsx)("img",{src:x.icon_url,alt:x.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:wo,onError:Rt=>{Rt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ce&&(0,p.jsx)("img",{src:ce,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Rt=>{Rt.currentTarget.style.display="none"}})]}),(0,p.jsxs)("div",{className:"wi-token-info",children:[(0,p.jsxs)("span",{className:"wi-token-name-row",children:[(0,p.jsx)("span",{className:"wi-token-name",children:x.symbol}),Qe&&Xe!==null&&(0,p.jsx)("span",{className:"wi-token-apy",children:`APY ${Xe>=0?"+":"-"}${(Xe>=0?Math.floor:Math.ceil)(Math.abs(Xe)*100)/100}%`})]}),_&&(0,p.jsxs)("div",{className:"wi-token-price-row",children:[(0,p.jsx)("span",{className:"wi-token-price",children:Nr(_.price)}),(0,p.jsx)("span",{className:"wi-token-change","data-positive":tt,"data-zero":re===0||void 0,children:re!==null&&(re===0?"0%":`${tt?"+":"-"}${(tt?Math.floor:Math.ceil)(Math.abs(re)*100)/100}%`)})]})]})]}),(0,p.jsxs)("div",{className:"wi-token-right",children:[(0,p.jsx)("span",{className:"wi-token-balance",children:Xt(x.quantity.numeric,x.quantity.decimals)}),_&&(0,p.jsx)("span",{className:"wi-token-value",children:Xi(x.quantity.numeric,x.quantity.decimals,_.price)})]})]},`${x.address}-${x.chainId}`)}),w&&D&&Array.from({length:3},(x,_)=>(0,p.jsxs)("div",{className:"wi-skeleton-item",children:[(0,p.jsxs)("div",{className:"wi-skeleton-left",children:[(0,p.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,p.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,p.jsxs)("div",{className:"wi-skeleton-right",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${_}`)),w&&!D&&!vt&&we.length===0&&go.length===0&&(0,p.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),w&&go.map(x=>{let _=Q.get(x.token)||"",re=Vn(r,Ie[r].cross);return(0,p.jsxs)("div",{className:"wi-token-item",children:[(0,p.jsxs)("div",{className:"wi-token-left",children:[(0,p.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,p.jsx)("img",{src:_||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:x.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:wo,onError:tt=>{tt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),re&&(0,p.jsx)("img",{src:re,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:tt=>{tt.currentTarget.style.display="none"}})]}),(0,p.jsxs)("div",{className:"wi-token-info",children:[(0,p.jsx)("span",{className:"wi-token-name",children:x.token_name}),(0,p.jsx)("div",{className:"wi-token-price-row",children:(0,p.jsxs)("span",{className:"wi-token-price",children:[Xt(x.current_price,18)," CROSS"]})})]})]}),(0,p.jsxs)("div",{className:"wi-token-right",children:[(0,p.jsx)("span",{className:"wi-token-balance",children:Xt(x.balance,18)}),(0,p.jsx)("span",{className:"wi-token-value",children:Nr(x.current_value_usd)})]})]},`forge-${x.token}`)})]})}),ye==="bottom"&&q&&(0,p.jsx)("div",{className:"wi-nav-fixed",children:q}),wi&&(0,p.jsx)("div",{className:"wi-wallet-disconnect-row",children:wi})]},"wallet"),mc=Be?(0,p.jsx)("div",{className:de("wi-view-inner wi-portfolio-body",rn.current&&"wi-view-portfolio"),children:(0,p.jsx)(bn,{env:r,theme:a,walletAddress:m,showHeader:!1,onOutlink:Me,lpBalanceReader:$t,stakingRewardsReader:ze,sendTransaction:ee,estimateGas:_e,sections:ne})},"portfolio"):null,gc=fe?(0,p.jsx)("div",{className:de("wi-view-inner wi-send-body",rn.current&&"wi-view-send"),children:(0,p.jsx)(qn,{env:r,theme:a,walletAddress:m,accountName:v,accounts:R,initialStep:ac,token:fe,tokens:we,onTokenChange:j,sendTransaction:ee,getTransactionReceipt:ue,estimateGas:_e,getTokenPriceUsd:x=>{let _=Ze.get(Nt(x.chainId,x.address));if(!_?.price)return;let re=parseFloat(_.price);return Number.isFinite(re)?re:void 0},onClose:k,onBackToWallet:ho,onSubmitted:lc,onSuccess:cc,onFailed:dc,onOutlink:Me})},"send"):null,hc=z.useMemo(()=>Ee||we.map(x=>{let _=Ze.get(Nt(x.chainId,x.address)),re=_?.price?parseFloat(_.price):void 0;return{name:x.name,symbol:x.symbol,chainId:x.chainId,address:x.address,decimals:x.quantity.decimals,balance:jn(x.quantity.numeric,x.quantity.decimals),iconUrl:x.icon_url,priceUsd:Number.isFinite(re)?re:void 0}}),[Ee,Ze,we]),bc=(0,p.jsx)("div",{className:de("wi-view-inner wi-bridge-body",rn.current&&"wi-view-send"),children:(0,p.jsx)(no,{env:r,walletAddress:m,tokens:hc,history:ft,termsUrl:B,getQuote:Ge,getToTokens:Ve,getApproval:Le,approveBridge:Pt,submitBridge:wt,onClose:k,onBackToWallet:ho})},"bridge"),wr=!!N&&v?.trim().toLowerCase()!=="my wallet",xi=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("span",{className:"wi-receive-avatar",children:[(0,p.jsx)("span",{className:"wi-avatar-fallback",style:hi}),xo&&(0,p.jsx)("img",{src:xo,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:wo,onError:x=>{x.currentTarget.style.display="none"}})]}),(0,p.jsx)("span",{className:"wi-receive-account-name",children:v??"Account 1"}),wr&&(0,p.jsx)("span",{className:"wi-receive-chevron","data-open":Wn,"aria-hidden":"true",children:(0,p.jsx)(pn,{size:16})})]}),wc=(0,p.jsxs)("div",{className:de("wi-view-inner wi-qr-body",rn.current&&"wi-view-qr"),children:[(0,p.jsxs)("div",{className:"wi-receive-section",children:[wr?(0,p.jsx)("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{Dn(!0),N?.()},"aria-label":"Switch account",children:xi}):(0,p.jsx)("div",{className:"wi-receive-account",children:xi}),(0,p.jsxs)("div",{className:"wi-qr-block",children:[(0,p.jsxs)("div",{className:"wi-qr-box",children:[(0,p.jsx)(Bl.QRCodeSVG,{value:m,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&(0,p.jsx)("div",{className:"wi-qr-logo",children:(0,p.jsx)(Vi,{size:33})})]}),(0,p.jsx)("p",{className:"wi-qr-address",children:m})]}),(0,p.jsxs)("button",{type:"button",className:"wi-qr-copy-btn",onClick:gi,children:[(0,p.jsx)("span",{className:"wi-qr-copy-icon",children:Cn?(0,p.jsx)(cn,{size:16}):(0,p.jsx)(Un,{size:16})}),(0,p.jsx)("span",{className:"wi-qr-copy-text",children:Cn?"Copied!":"Copy address"})]})]}),bi&&(0,p.jsx)("div",{className:"wi-receive-footer",children:bi})]},"qr"),xc=$==="qr"||$==="portfolio"||$==="send"||$==="bridge",vi=te!==null?(0,p.jsx)("div",{className:"wi-builtin-footer",children:te}):null,yi=(0,p.jsxs)("div",{className:"wi-account-text",children:[wr?(0,p.jsxs)("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{Dn(!0),N?.()},"aria-label":"Switch account","aria-expanded":Wn,children:[(0,p.jsx)("span",{className:"wi-account-name",children:v??"Account 1"}),(0,p.jsx)("span",{className:"wi-account-switch","data-open":Wn,"aria-hidden":"true",children:(0,p.jsx)(pn,{size:20})})]}):(0,p.jsx)("div",{className:"wi-account-row",children:(0,p.jsx)("span",{className:"wi-account-name",children:v??"Account 1"})}),(0,p.jsxs)("button",{type:"button",className:"wi-address-row-btn",onClick:gi,"aria-label":"Copy address",children:[(0,p.jsx)("span",{className:"wi-account-address",children:dt(m)}),(0,p.jsx)("span",{className:"wi-account-copy","data-copied":Cn,children:Cn?(0,p.jsx)(cn,{size:12}):(0,p.jsx)(Un,{size:12})})]})]}),ki=(0,p.jsxs)(p.Fragment,{children:[o,$==="qr"?(0,p.jsx)("div",{className:"wi-sticky-header",children:(0,p.jsxs)("div",{className:"wi-header wi-header--receive",children:[(0,p.jsx)("button",{type:"button",className:"wi-header-back",onClick:ho,"aria-label":"Back",children:(0,p.jsx)(dn,{size:24})}),(0,p.jsx)("span",{className:"wi-receive-title",children:"Receive"}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]})}):$==="send"||$==="bridge"?null:xc?(0,p.jsxs)("div",{className:"wi-sticky-header",children:[(0,p.jsxs)("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[(0,p.jsx)("button",{type:"button",className:"wi-header-back",onClick:ho,"aria-label":"Back",children:(0,p.jsx)(dn,{size:24})}),(0,p.jsx)("div",{className:"wi-account-block wi-account-block--sub-account",children:yi}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]}),(0,p.jsx)("hr",{className:"wi-divider"})]}):(0,p.jsxs)("div",{className:"wi-sticky-header",children:[(0,p.jsxs)("div",{className:"wi-header wi-header--wallet",children:[(0,p.jsxs)("div",{className:"wi-account-block",children:[(0,p.jsxs)("div",{className:"wi-avatar",children:[(0,p.jsx)("div",{className:"wi-avatar-fallback",style:hi}),xo&&(0,p.jsx)("img",{src:xo,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:wo,onError:x=>{x.currentTarget.style.display="none"}})]}),yi]}),(0,p.jsxs)("div",{className:"wi-header-actions",children:[g&&y&&(0,p.jsx)("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:On,"aria-label":"Show QR code",children:(0,p.jsx)(Lo,{size:20})}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]})]}),(0,p.jsx)("hr",{className:"wi-divider"})]}),(0,p.jsxs)("div",{className:"wi-view-container",children:[$==="wallet"&&uc,$==="qr"&&wc,$==="portfolio"&&mc,$==="send"&&gc,$==="bridge"&&bc]}),$==="wallet"&&Bt&&(0,p.jsx)("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Bt}),$==="wallet"&&et&&(0,p.jsxs)("a",{className:"wi-send-toast",href:fr??"#",target:"_blank",rel:"noopener noreferrer",onClick:x=>{if(!fr){x.preventDefault();return}nt(x,fr,{category:"send",origin:"send-transaction",payload:{chainId:et.chainId,txHash:et.txHash}},Me)},children:[(0,p.jsx)("span",{className:"wi-send-toast-icon","data-status":et.status,"aria-hidden":!0,children:et.status==="pending"?(0,p.jsx)("span",{className:"wi-send-toast-spinner"}):et.status==="error"?(0,p.jsx)("span",{className:"wi-send-toast-error-dot"}):(0,p.jsx)(Zi,{size:20})}),(0,p.jsxs)("span",{className:"wi-send-toast-copy",children:[(0,p.jsx)("span",{className:"wi-send-toast-title",children:et.status==="pending"?"Sending...":et.status==="error"?"Send failed":"Send complete"}),(0,p.jsx)("span",{className:"wi-send-toast-desc",children:et.status==="pending"||et.status==="error"?et.description:"Tap to see your transaction"})]})]}),vi&&$!=="portfolio"&&$!=="send"&&(0,p.jsx)("div",{className:"wi-sticky-footer",children:(0,p.jsx)("div",{className:"wi-footer",ref:Sn,children:vi})})]}),Si={...W,...kt>0?{"--wi-footer-height":`${kt}px`}:null};return i?(0,p.jsxs)(oo.Drawer.Portal,{children:[c&&(0,p.jsx)(oo.Drawer.Overlay,{className:"wi-drawer-overlay"}),(0,p.jsxs)(oo.Drawer.Content,{className:de("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":d==="left"||d==="right"?!0:void 0,style:Si,"data-direction":d,"data-no-balance":!f||void 0,"data-has-footer":kt>0||void 0,"data-view":$,children:[(0,p.jsx)(oo.Drawer.Title,{className:"wi-sr-only",children:"My Wallet"}),ki]})]}):(0,p.jsxs)(p.Fragment,{children:[c&&l&&(0,p.jsx)("div",{className:"wi-drawer-overlay",onClick:k}),(0,p.jsx)(ir.Portal,{children:(0,p.jsx)(ir.Content,{align:e,sideOffset:t,className:de("wi-popover-content",n),"data-theme":a,style:Si,"data-no-balance":!f||void 0,"data-has-footer":kt>0||void 0,"data-view":$,children:ki})})]})}var Ml=U(require("react"),1);function Ol({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Yt();return Ml.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}var Wl=U(require("react"),1);function Dl({children:e}){let{setFooterContent:t}=Yt();return Wl.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}Y(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #121212);--wi-surface-default: var(--ds-surface-medium, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(255, 255, 255, .1));--wi-border-default: var(--ds-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--ds-border-medium, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--ds-content-highest, #ffffff);--wi-texticon-secondary: var(--ds-content-medium, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(255, 255, 255, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .4)}[data-theme=light].wi-popover-content,[data-theme=light].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #ffffff);--wi-surface-default: var(--ds-surface-medium, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(18, 18, 18, .1));--wi-border-default: var(--ds-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--ds-border-medium, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--ds-content-highest, #121212);--wi-texticon-secondary: var(--ds-content-medium, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(18, 18, 18, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
|
|
10
|
+
`);var s=require("react/jsx-runtime"),Nl=L.createContext(void 0);function Fn(){return L.useContext(Nl)}function yp(e){let[t,n]=L.useState(void 0);return L.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.closest("[data-theme]");n(i?.getAttribute("data-theme")??void 0)};r();let a=new MutationObserver(r);return a.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[e]),t}var kl=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],kp=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Sp(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Sl(e){let t=e.replace(/[^\d.]/g,""),[n="",...o]=t.split("."),r=o.join("");return o.length===0?n:`${n}.${r.slice(0,2)}`}function Rp(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Il(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Rl(e,t){let n=Number(e||"0"),o=t?.priceUsd??0;return`\u2248 $${(Number.isFinite(n)?n*o:0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})} USD`}function Cp(e,t=6){if(!e)return e;let[n,o=""]=e.split(".");if(!o)return n;let r=o.slice(0,t).replace(/0+$/,"");return r?`${n}.${r}`:n}function Tp(e,t){if(!t)return!1;let n=new At.default(e||"0"),o=new At.default(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Np(e){if(e.priceUsd===void 0)return null;let t=new At.default(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Ip(e){if(e.priceUsd===void 0)return null;let t=new At.default(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function El(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,At.default.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new At.default(o||"0").toFormat(0);return r?`${a}.${r}`:a}function Ep(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function Lp(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=o=>o.toString().padStart(2,"0");return[`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`].join(" ")}function Ap(e){let t=new At.default(e||"0");return!t.isFinite()||t.isNaN()?e||"0":El(t)}function Pp(e,t){if(t?.priceUsd===void 0)return null;let n=new At.default(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function rr(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function Fp(e,t){return t==="all"?!0:rr(e)===t}function Bp(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Cl(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function Ll(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function Al(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":Ll(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function Pl(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function or(e){return!e||e==="0"||Number(e)===0}function _p(e){let t=e.trim().toLowerCase();return t?t.startsWith("minimum ")?{from:e}:t.startsWith("available ")&&t.includes("or more")?{to:e}:t.includes("insufficient balance")||t.includes("not enough balance")||t.includes("exceeds balance")||t.includes("insufficient network fee")?{from:e}:t.includes("insufficient liquidity")||t.includes("not enough liquidity")?{to:e}:{}:{}}function Mp(e){let t=e.fromToken,n=e.toToken,o=Al(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!Pl(o),l=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${Cl(t.chainId)} \u2192 ${Cl(n.chainId)}`:"-"},{label:"Validator Fee",value:or(r)?"0":"Free",tone:or(r)?"default":"accent"},{label:"Network Fee",value:or(r)?"0":"Free",tone:or(r)?"default":"accent"}]:void 0,swapInfo:l?[t&&n?{label:"Route",value:"",routeTokens:[{symbol:t.symbol,iconUrl:t.iconUrl},{symbol:n.symbol,iconUrl:n.iconUrl}]}:{label:"Route",value:"-"},{label:"Price Impact",value:"0%"},{label:"In Amount",value:r,valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Swap Fee",value:"0",valueToken:t?{symbol:t.symbol,iconUrl:t.iconUrl}:void 0},{label:"Out Amount",value:a,valueToken:n?{symbol:n.symbol,iconUrl:n.iconUrl}:void 0}]:void 0,txFee:[{label:"Priority Fee Per Gas",value:"0 Gwei"},{label:"Max Fee Per Gas",value:"0 Gwei"},{label:"Gas Limit",value:"0"}],txFeeInfo:{estTxFee:"0",isDelegateFee:!1}}}function to({token:e,size:t=20}){let n=e?.iconUrl;return(0,s.jsx)("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?(0,s.jsx)("img",{src:n,alt:"",width:t,height:t,draggable:!1}):(0,s.jsx)("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function Tl({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a,locked:i=!1}){return(0,s.jsxs)("section",{className:"bf-amount-panel",children:[(0,s.jsxs)("div",{className:"bf-amount-head",children:[(0,s.jsx)("span",{children:e}),(0,s.jsxs)("span",{className:"bf-balance",children:[Il(t?.balance??"0")," ",t?.symbol??""]})]}),(0,s.jsxs)("div",{className:"bf-amount-main",children:[(0,s.jsxs)("label",{className:"bf-amount-input-wrap",children:[(0,s.jsxs)("span",{className:"bf-sr-only",children:[e," amount"]}),(0,s.jsx)("input",{type:"text",inputMode:"decimal",value:n,onChange:l=>r(l.target.value),placeholder:"0",className:"bf-amount-input"}),(0,s.jsx)("span",{className:"bf-amount-usd",children:o})]}),(0,s.jsxs)("button",{type:"button",className:"bf-token-pill",onClick:i?void 0:a,disabled:!i&&!a,"data-locked":i?"true":void 0,"aria-label":`Select ${e.toLowerCase()} token`,children:[(0,s.jsx)(to,{token:t}),(0,s.jsx)("span",{children:t?.symbol??"Select"}),!i&&(0,s.jsx)(pn,{size:16})]})]})]})}function Op({flow:e,side:t,onClose:n}){let o=L.useId(),[r,a]=L.useState(""),[i,l]=L.useState(null),d=Fn(),c=t==="from"?e.fromToken:e.toToken;L.useEffect(()=>{l(document.body)},[]),L.useEffect(()=>{let g=y=>{y.key==="Escape"&&n()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let f=L.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),w=L.useMemo(()=>{let g=r.trim().toLowerCase();return g?f.filter(y=>y.symbol.toLowerCase().includes(g)||y.name.toLowerCase().includes(g)):f},[r,f]),h=L.useCallback(g=>{t==="from"?e.selectFromToken(g):e.selectToToken(g),n()},[e,n,t]);return i?(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-token-picker-overlay","data-theme":d,role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&n()},children:(0,s.jsxs)("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[(0,s.jsx)("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),(0,s.jsxs)("header",{className:"bf-token-picker-head",children:[(0,s.jsx)("h3",{id:o,children:"Select a token"}),(0,s.jsx)("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:(0,s.jsx)(_t,{size:24})})]}),(0,s.jsxs)("label",{className:"bf-token-search",children:[(0,s.jsx)(sl,{size:20}),(0,s.jsx)("span",{className:"bf-sr-only",children:"Search tokens"}),(0,s.jsx)("input",{value:r,onChange:g=>a(g.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),(0,s.jsxs)("div",{className:"bf-token-list",children:[w.map(g=>{let y=Ll(g,c),b=y?Ip(g):Np(g);return(0,s.jsxs)("button",{type:"button",className:"bf-token-row","data-selected":y?"true":"false",onClick:()=>h(g),children:[(0,s.jsxs)("span",{className:"bf-token-row-left",children:[(0,s.jsx)(to,{token:g,size:40}),(0,s.jsxs)("span",{className:"bf-token-meta",children:[(0,s.jsx)("span",{className:"bf-token-symbol",children:g.symbol}),!y&&(0,s.jsx)("span",{className:"bf-token-name",children:g.name})]})]}),(0,s.jsxs)("span",{className:"bf-token-row-right",children:[(0,s.jsxs)("span",{className:"bf-token-balance",children:[Il(g.balance),y?null:` ${g.symbol}`]}),b&&(0,s.jsx)("span",{className:"bf-token-price",children:b})]})]},Rp(g))}),w.length===0&&(0,s.jsx)("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i):null}function Wp({flow:e,onClose:t}){let n=L.useId(),[o,r]=L.useState(null),a=kl.find(b=>b.value===e.slippage),[i,l]=L.useState(e.slippage&&!a?e.slippage:""),d=i.trim()!==""&&i.trim()!==".",c=d?Number(i):NaN,f=Number.isFinite(c)&&c>50,w=Number.isFinite(c)&&c>5&&!f,h=b=>{e.setSlippage(b),t()},g=()=>{!d||f||(e.setSlippage(Sl(i)),t())};if(L.useEffect(()=>{r(document.body)},[]),L.useEffect(()=>{let b=m=>{m.key==="Escape"&&t()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t]),!o)return null;let y=Fn();return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-slippage-overlay","data-theme":y,role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:(0,s.jsxs)("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[(0,s.jsxs)("header",{className:"bf-slippage-head",children:[(0,s.jsx)("h3",{id:n,children:"Slippage Settings"}),(0,s.jsx)("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:(0,s.jsx)(_t,{size:24})})]}),(0,s.jsxs)("div",{className:"bf-slippage-body",children:[(0,s.jsx)("p",{className:"bf-slippage-desc",children:"The maximum price difference you are willing to accept before the transaction is reverted. Higher slippage increases the chance of execution but may result in a worse price."}),(0,s.jsxs)("div",{className:"bf-slippage-controls",children:[(0,s.jsx)("div",{className:"bf-slippage-presets",children:kl.map(b=>(0,s.jsx)("button",{type:"button",className:"bf-slippage-preset","data-selected":!d&&e.slippage===b.value?"true":"false",onClick:()=>h(b.value),children:b.label},b.value))}),(0,s.jsxs)("label",{className:"bf-slippage-custom","data-selected":d?"true":"false",children:[(0,s.jsx)("span",{className:"bf-sr-only",children:"Custom slippage percent"}),(0,s.jsx)("input",{value:i,onChange:b=>{l(Sl(b.target.value))},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),g())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"})]})]}),f?(0,s.jsx)("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):w?(0,s.jsx)("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,d&&(0,s.jsx)("button",{type:"button",className:"bf-slippage-apply",onClick:g,disabled:f,children:"Apply"})]})]})}),o)}function Dp({flow:e}){let t=L.useId(),[n,o]=L.useState(!1),[r,a]=L.useState(null),i=Fn();return L.useEffect(()=>{a(document.body)},[]),L.useEffect(()=>{let l=d=>{d.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e]),!r||!e.termsOpen?null:(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:l=>{l.target===l.currentTarget&&e.cancelTerms()},children:(0,s.jsxs)("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[(0,s.jsx)("h3",{id:t,children:"Agree to Terms of Service"}),(0,s.jsx)("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),(0,s.jsxs)("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[(0,s.jsx)("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,"aria-label":"Agree to Terms of Use",onClick:()=>o(l=>!l),children:(0,s.jsx)("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"bf-terms-copy",children:[(0,s.jsx)("span",{className:"bf-terms-label",children:"Agree to Terms of Use"}),e.termsUrl&&(0,s.jsx)("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]})]}),(0,s.jsx)("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),(0,s.jsx)("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,children:"Confirm"})]})}),r)}function zp({value:e,disabled:t=!1}){let[n,o]=L.useState(!1);return(0,s.jsx)("button",{type:"button",className:"bf-copy-button","aria-label":"Copy token address",disabled:t,onClick:()=>{t||navigator.clipboard?.writeText(e).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:n?"OK":"Copy"})}function Gp({flow:e,approval:t}){let n=L.useId(),[o,r]=L.useState(null),a=Fn();if(L.useEffect(()=>{r(document.body)},[]),L.useEffect(()=>{let d=c=>{e.status!=="submitting"&&c.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e]),!o)return null;let i=e.status==="submitting"||!e.approveBridge,l=e.status==="submitting";return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:(0,s.jsxs)("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[(0,s.jsxs)("h3",{id:n,children:["Approve ",t.token.symbol]}),(0,s.jsx)(to,{token:t.token,size:72}),(0,s.jsxs)("div",{className:"bf-approve-address-box",children:[(0,s.jsx)("span",{children:"Token Address"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:t.tokenAddress}),(0,s.jsx)(zp,{value:t.tokenAddress,disabled:l})]})]}),(0,s.jsxs)("div",{className:"bf-action-buttons",children:[(0,s.jsx)("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),(0,s.jsxs)("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":l,children:[l&&(0,s.jsx)("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),(0,s.jsx)("span",{children:l?"Approving...":"Approve"})]})]})]})}),o)}function Hp({flow:e}){let t=L.useId(),[n,o]=L.useState(null),r=Fn();if(L.useEffect(()=>{o(document.body)},[]),L.useEffect(()=>{if(!e.approvalSuccessOpen)return;let i=l=>{l.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.approvalSuccessOpen)return null;let a=e.status==="submitting";return(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:(0,s.jsxs)("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[(0,s.jsx)("h3",{id:t,children:"Approval Success"}),(0,s.jsx)("span",{className:"bf-success-mark","aria-hidden":"true"}),(0,s.jsxs)("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",(0,s.jsx)("br",{}),"Please continue to the next step."]}),(0,s.jsxs)("div",{className:"bf-action-buttons",children:[(0,s.jsx)("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:a,children:"Cancel"}),(0,s.jsxs)("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,disabled:a,"aria-busy":a,children:[a&&(0,s.jsx)("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),(0,s.jsx)("span",{children:a?"Continuing...":"Continue"})]})]})]})}),n)}function Up({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=L.useState(!1),i=L.useMemo(()=>{let c=new At.default(e||"0"),f=new At.default(t||"0");return!c.isFinite()||!f.isFinite()||c.lte(0)||f.lte(0)?null:r?c.dividedBy(f):f.dividedBy(c)},[e,r,t]);if(!i||!n||!o||n.symbol===o.symbol)return null;let l=r?o.symbol:n.symbol,d=r?n.symbol:o.symbol;return(0,s.jsxs)("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(c=>!c),children:[(0,s.jsxs)("span",{children:["1 ",l]}),(0,s.jsx)(fl,{size:12}),(0,s.jsxs)("span",{children:[El(i)," ",d]})]})}function $p({flow:e}){return e.submitToast?(0,s.jsxs)("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[(0,s.jsx)("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:(0,s.jsx)("span",{className:"bf-status-spinner"})}),(0,s.jsxs)("span",{className:"bf-status-toast-copy",children:[(0,s.jsx)("strong",{children:"Transaction Processing"}),(0,s.jsx)("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function jp({message:e}){let[t,n]=L.useState(!1);return L.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:(0,s.jsxs)("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[(0,s.jsx)("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:(0,s.jsx)("span",{className:"bf-status-error-mark",children:"!"})}),(0,s.jsxs)("span",{className:"bf-status-toast-copy",children:[(0,s.jsx)("strong",{children:"Error"}),(0,s.jsx)("span",{children:e})]})]})}function Vp(e){switch(e){case"swap":case"deposit-swap":case"swap-withdraw":return"Swap Transaction Sent";case"bridge":return"Bridge Transaction Sent";case"swap-bridge":return"Swap & Bridge Transaction Sent";case"bridge-swap":return"Bridge & Swap Transaction Sent";default:return"Transaction Sent"}}function qp({flow:e}){let t=L.useId(),[n,o]=L.useState(null),r=e.submitted,a=Fn();return L.useEffect(()=>{o(document.body)},[]),L.useEffect(()=>{if(!e.successDialogOpen)return;let i=l=>{l.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.successDialogOpen||!r?null:(0,vn.createPortal)((0,s.jsx)("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:(0,s.jsx)("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:(0,s.jsxs)("div",{className:"bf-success-body",children:[(0,s.jsx)("span",{className:"bf-success-mark","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"bf-success-copy",children:[(0,s.jsx)("strong",{id:t,children:Vp(r.pathType)}),(0,s.jsx)("span",{children:"Please check the results in the history."})]}),(0,s.jsx)("div",{className:"bf-success-route","aria-hidden":"true",children:(r.routeTokens&&r.routeTokens.length>0?r.routeTokens:[{symbol:r.fromToken.symbol,iconUrl:r.fromToken.iconUrl},{symbol:r.toToken.symbol,iconUrl:r.toToken.iconUrl}]).map((i,l)=>(0,s.jsxs)(L.Fragment,{children:[l>0&&(0,s.jsx)("span",{className:"bf-success-route-arrow",children:"\u2192"}),(0,s.jsx)(oi,{token:i,size:43})]},`${i.symbol}-${l}`))}),(0,s.jsx)("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function oi({token:e,size:t=16}){let n=!!e.iconUrl;return(0,s.jsx)("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?(0,s.jsx)("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):(0,s.jsx)("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function Kp({row:e}){return e.routeTokens&&e.routeTokens.length>0?(0,s.jsx)("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>(0,s.jsxs)(L.Fragment,{children:[n>0&&(0,s.jsx)("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),(0,s.jsx)(oi,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?(0,s.jsxs)("span",{className:"bf-info-value-token",children:[(0,s.jsx)(oi,{token:e.valueToken}),(0,s.jsx)("span",{children:e.value})]}):(0,s.jsx)(s.Fragment,{children:e.value})}function Fl({rows:e}){return!e||e.length===0?null:(0,s.jsx)("div",{className:"bf-info-rows",children:e.map((t,n)=>(0,s.jsxs)("div",{className:"bf-info-row",children:[(0,s.jsxs)("span",{className:"bf-info-label",children:[(0,s.jsx)("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),(0,s.jsx)("span",{children:t.label})]}),(0,s.jsx)("span",{className:"bf-info-value","data-tone":t.tone??"default",children:(0,s.jsx)(Kp,{row:t})})]},`${t.label}-${t.value}`))})}function Qp(e,t,n){return e.pathType==="bridge"?"Bridge Info":Pl(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function Yp({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return(0,s.jsx)(s.Fragment,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?(0,s.jsxs)("div",{className:"bf-info-section",children:[o&&(0,s.jsx)("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),(0,s.jsx)(Fl,{rows:i})]},a):null})})}function Zp({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=Qp(e,t,n),[a,i]=L.useState(!0),[l,d]=L.useState(!0);return(0,s.jsxs)("div",{className:"bf-details",children:[e.liquidity&&(0,s.jsxs)("section",{className:"bf-liquidity",children:[(0,s.jsxs)("div",{className:"bf-liquidity-head",children:[(0,s.jsx)("span",{children:e.liquidity.label??"Available Liquidity"}),(0,s.jsx)("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),(0,s.jsx)("div",{className:"bf-liquidity-track",children:(0,s.jsx)("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&(0,s.jsxs)("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[(0,s.jsxs)("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(c=>!c),children:[(0,s.jsx)("h3",{children:r}),(0,s.jsx)(pn,{size:16,className:"bf-collapse-chevron"})]}),a&&(0,s.jsx)("div",{className:"bf-collapse-body",children:(0,s.jsx)(Yp,{summary:e})})]}),o&&(0,s.jsxs)("section",{className:"bf-detail-section bf-tx-fee-section","data-open":l?"true":"false",children:[(0,s.jsxs)("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":l,onClick:()=>d(c=>!c),children:[(0,s.jsx)("h3",{children:"Est. Tx Fee"}),(0,s.jsxs)("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&(0,s.jsx)("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&(0,s.jsx)("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),(0,s.jsx)("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:Cp(e.txFeeInfo?.estTxFee??"0")}),(0,s.jsx)(pn,{size:16,className:"bf-collapse-chevron"})]})]}),l&&(0,s.jsx)("div",{className:"bf-collapse-body",children:(0,s.jsx)(Fl,{rows:e.txFee})})]})]})}function Xp({item:e}){let t=rr(e),n=Pp(e.fromAmount,e.fromToken);return(0,s.jsxs)("article",{className:"bf-history-item",children:[(0,s.jsxs)("div",{className:"bf-history-item-head",children:[(0,s.jsx)("span",{className:"bf-history-status","data-status":t,children:Bp(t)}),(0,s.jsx)("time",{className:"bf-history-time",dateTime:e.timestamp,children:Lp(e.timestamp)})]}),(0,s.jsxs)("div",{className:"bf-history-item-body",children:[(0,s.jsxs)("strong",{className:"bf-history-amount",children:[Ap(e.fromAmount)," ",e.fromToken.symbol]}),(0,s.jsxs)("div",{className:"bf-history-meta",children:[(0,s.jsx)("span",{className:"bf-history-usd",children:n??Ep(e.txHash)}),(0,s.jsxs)("span",{className:"bf-history-route",children:[(0,s.jsxs)("span",{className:"bf-history-route-token",children:[(0,s.jsx)(to,{token:e.fromToken,size:16}),(0,s.jsx)("span",{children:e.fromToken.symbol})]}),(0,s.jsx)(pl,{size:16,className:"bf-history-route-arrow"}),(0,s.jsxs)("span",{className:"bf-history-route-token",children:[(0,s.jsx)(to,{token:e.toToken,size:16}),(0,s.jsx)("span",{children:e.toToken.symbol})]})]})]})]})]})}function Jp({flow:e}){let[t,n]=L.useState("all"),o=e.history.some(i=>rr(i)==="pending"),r=e.history.filter(i=>Fp(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return(0,s.jsxs)("main",{className:"bf-history-body",children:[(0,s.jsx)("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:kp.map(i=>(0,s.jsxs)("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[(0,s.jsx)("span",{children:i.label}),i.value==="pending"&&o&&(0,s.jsx)("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?(0,s.jsx)("div",{className:"bf-history-list",children:r.map(i=>(0,s.jsx)(Xp,{item:i},i.id||i.txHash))}):(0,s.jsx)("div",{className:"bf-empty",children:a})]})}function ef({flow:e,env:t}){let[n,o]=L.useState(null),[r,a]=L.useState(!1),[i,l]=L.useState(0),c=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??Mp(e):null,f=un("apps.json",t,u=>fn(u?.bridgePoweredBy?.url,t)),w=_p(e.quoteError),h=Tp(e.fromAmount,e.fromToken),g=h?"Insufficient balance":w.from,y=e.quoteError&&!w.from&&!w.to?e.quoteError:"",b=e.error||y,m=e.history.some(u=>rr(u)==="pending"),R=(c?.pathType??Al(e.fromToken,e.toToken))!=="bridge";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("main",{className:"bf-body",children:[(0,s.jsxs)("div",{className:"bf-toolbar",children:[(0,s.jsxs)("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[(0,s.jsx)(ll,{}),(0,s.jsx)("span",{children:"History"}),(m||e.hasNewHistory)&&(0,s.jsx)("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),R&&(0,s.jsxs)("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[(0,s.jsx)(cl,{}),(0,s.jsx)("span",{children:e.slippageLocked?"Auto 1%":Sp(e.slippage,e.effectiveSlippage)})]})]}),(0,s.jsxs)("div",{className:"bf-swap-card","data-has-from-error":g?"true":"false",children:[(0,s.jsx)(Tl,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Rl(e.fromAmount,e.fromToken),onAmountChange:u=>e.setAmount(u,"from"),onTokenClick:()=>o("from")}),g&&(0,s.jsx)("div",{className:"bf-field-error",children:g}),(0,s.jsx)("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),l(u=>u+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:(0,s.jsx)(dl,{size:22})}),(0,s.jsx)(Tl,{label:"To",token:e.toToken,amount:e.toAmount,usd:Rl(e.toAmount,e.toToken),onAmountChange:u=>e.setAmount(u,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),w.to&&(0,s.jsx)("div",{className:"bf-field-error",children:w.to})]}),(0,s.jsx)(Up,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),c&&(0,s.jsx)(Zp,{summary:c})]}),(0,s.jsxs)("footer",{className:"bf-footer",children:[(0,s.jsx)("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError||h,children:e.status==="submitting"?"Processing...":"Next"}),f&&(0,s.jsxs)("a",{className:"bf-powered",href:f,target:"_blank",rel:"noreferrer",children:["Powered by ",(0,s.jsx)("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&(0,s.jsx)(Op,{flow:e,side:n,onClose:()=>o(null)}),r&&(0,s.jsx)(Wp,{flow:e,onClose:()=>a(!1)}),(0,s.jsx)(Dp,{flow:e}),e.approvalInfo&&(0,s.jsx)(Gp,{flow:e,approval:e.approvalInfo}),(0,s.jsx)(Hp,{flow:e}),(0,s.jsx)($p,{flow:e}),(0,s.jsx)(jp,{message:e.submitToast?"":b}),(0,s.jsx)(qp,{flow:e})]})}function no({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=L.useMemo(()=>Oe(n),[n]),i=yl({...r,onExit:t}),l=L.useRef(null),d=yp(l),c=i.step==="history"?"History":"Swap & Bridge";return(0,s.jsx)(Nl.Provider,{value:d,children:(0,s.jsxs)("div",{ref:l,className:de("bf-root",o),"data-view":i.step,"data-status":i.status,children:[(0,s.jsxs)("header",{className:"bf-header",children:[(0,s.jsx)("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:(0,s.jsx)(dn,{size:24})}),(0,s.jsx)("span",{className:"bf-header-title",children:c}),(0,s.jsx)("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:(0,s.jsx)(_t,{size:24})})]}),i.step==="history"?(0,s.jsx)(Jp,{flow:i}):(0,s.jsx)(ef,{flow:i,env:a})]})})}var p=require("react/jsx-runtime"),tf="On-ramp is not available in your region.";function ri(e,t,n){let o=Ie[e],r=n.toUpperCase();if(t===o.cross&&r.includes("CROSSD"))return 0;if(t===o.cross&&r==="CROSS")return 1;if(t===o.bsc&&r==="CROSS")return 2}function nf(e){return parseInt(e.split(":")[1],10)}function of(e){if(typeof window>"u"||!e?.length)return!1;let{origin:t,pathname:n}=window.location,o=t+n;return e.some(r=>o===r||o.startsWith(`${r}/`))}function rf(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function af(e){let t=e.toLowerCase().replace(/^0x/,""),n=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(n.slice(0,4),16)%360,r=(o+60+parseInt(n.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${r} 80% 55%))`}function _l({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:a,isMobile:i,open:l,drawerDirection:d,modal:c,showBalance:f,showForgeToken:w,showGameToken:h,showQR:g,showBridge:y,qrLogoSrc:b,walletAddress:m,accountName:v,sendAccounts:R,profileImageUrl:u,preferredTokens:T,close:k,onSelectWallet:N,onCopyAddress:S,onBuy:G,onDisconnect:O,disconnectLabel:H,termsUrl:B,termsLabel:le,privacyUrl:I,privacyLabel:ie,portalStyle:W,navContent:q,navPosition:ye,footerContent:te,view:$,setView:he,selectedSendToken:fe,setSelectedSendToken:j,showPortfolio:Be,portfolioTitle:F,portfolioSections:ne,showTotalAssets:be,totalAssetsLabel:De,sendTransaction:ee,getTransactionReceipt:ue,estimateGas:_e,onOutlink:Me,lpBalanceReader:$t,stakingRewardsReader:ze,bridgeTokens:Ee,bridgeHistory:ft,getBridgeQuote:Ge,getBridgeToTokens:Ve,getBridgeApproval:Le,approveBridge:Pt,submitBridge:wt,onReceive:Ft,onSend:st,onBuyDisabledMessage:xt,onBridgeDisabledMessage:ut,onSendDisabledMessage:Ce}=Yt(),[Bt,mt]=z.useState(null),qe=z.useRef(void 0),He=z.useCallback(x=>{mt(x),clearTimeout(qe.current),qe.current=setTimeout(()=>mt(null),4e3)},[]);z.useEffect(()=>()=>clearTimeout(qe.current),[]);let Ke=!!xt,it=z.useCallback(()=>{if(Ke){He(xt);return}let x=G?.();x&&typeof x.then=="function"&&x.catch(()=>{He(xt??tf)})},[Ke,xt,G,He]),lt=!!ut,at=!!Ce,{tokens:gt,isLoading:vt}=qt(r,m,l&&f),{statsMap:Ze}=Kt(r,f),{apyPercent:Xe}=Va(),{categoryMap:Je}=Qa(r,f),E=f&&be,{displayValue:oe,isLowerBound:Te,isLoading:ct}=Za(r,m,l&&E),[ht,yt]=z.useState(!1),Sn=z.useRef(null),[kt,mo]=z.useState(0),{holdings:on,isLoading:D}=Ga(r,m,l&&f&&w),Ue=z.useMemo(()=>on.map(x=>x.token),[on]),{imageMap:Q}=Ha(r,Ue,w&&on.length>0),we=z.useMemo(()=>{let x=[],_=[],re=[],tt=new Map((T??[]).map((ce,Qe)=>[`${nf(ce.chainId)}:${ce.address.toLowerCase()}`,Qe]));for(let ce of gt){let Qe=ri(r,ce.chainId,ce.symbol)!==void 0,Rt=`${ce.chainId}:${ce.address.toLowerCase()}`,an=tt.get(Rt),xr=new Bn.default(ce.quantity.numeric).shiftedBy(-ce.quantity.decimals);if(Qe)x.push(ce);else if(an!==void 0)_.push(ce);else if(xr.isGreaterThan(0)){if(!h&&Je.get(Wr(ce.chainId,ce.address))==="game")continue;re.push(ce)}}return x.sort((ce,Qe)=>{let Rt=ri(r,ce.chainId,ce.symbol)??99,an=ri(r,Qe.chainId,Qe.symbol)??99;return Rt-an}),_.sort((ce,Qe)=>{let Rt=tt.get(`${ce.chainId}:${ce.address.toLowerCase()}`)??99,an=tt.get(`${Qe.chainId}:${Qe.address.toLowerCase()}`)??99;return Rt-an}),re.sort((ce,Qe)=>{let Rt=Ze.get(Nt(ce.chainId,ce.address)),an=Ze.get(Nt(Qe.chainId,Qe.address)),xr=new Bn.default(ce.quantity.numeric).shiftedBy(-ce.quantity.decimals).multipliedBy(Rt?.price??0);return new Bn.default(Qe.quantity.numeric).shiftedBy(-Qe.quantity.decimals).multipliedBy(an?.price??0).minus(xr).toNumber()}),[...x,..._,...re]},[gt,r,Ze,h,Je,T]),go=z.useMemo(()=>{if(!w)return[];let x=new Set(gt.map(_=>_.address.toLowerCase()));return[...on].filter(_=>!x.has(_.token.toLowerCase())).sort((_,re)=>{let tt=new Bn.default(_.value);return new Bn.default(re.value).minus(tt).toNumber()})},[on,w,gt]),rn=z.useRef(!1),[et,Mn]=z.useState(null),Rn=z.useRef(void 0),pi=et?.chainId??fe?.chainId??we[0]?.chainId??0,{transactionUrl:fr}=Po(r,pi,et?.txHash,!!(et?.txHash&&pi)),St=z.useCallback(x=>{rn.current=!0,he(x)},[he]),[ac,ur]=z.useState("recipient"),ho=z.useCallback(()=>{j(null),ur("recipient"),St("wallet")},[j,St]),mr=z.useCallback((x,_="recipient")=>{if(at){He(Ce);return}ur(_),j(x),St("send")},[at,Ce,He,j,St]),bo=un("apps.json",r,x=>fn(x?.gametokenBridge,r)),fi=un("apps.json",r,x=>x?.gametokenSites),sc=z.useCallback(()=>{if(lt){He(ut);return}if(bo){if(of(fi)){window.location.assign(bo);return}window.open(bo,"_blank","noopener,noreferrer")}},[lt,ut,bo,fi,He]),lc=z.useCallback(x=>{clearTimeout(Rn.current),j(null),St("wallet"),Mn({status:"pending",txHash:x.txHash,chainId:x.chainId,description:`${x.amount} ${x.tokenSymbol} to ${dt(x.recipient)}`})},[j,St]),cc=z.useCallback(x=>{let _=fe?.chainId;j(null),St("wallet"),!(!x||!_)&&(Mn(re=>({status:"success",txHash:x,chainId:_,description:re?.txHash===x?re.description:"Tap to see your transaction"})),clearTimeout(Rn.current),Rn.current=setTimeout(()=>Mn(null),5e3))},[fe?.chainId,j,St]),dc=z.useCallback(x=>{let _=x.txHash;_&&(Mn({status:"error",txHash:_,chainId:x.chainId,description:x.message}),clearTimeout(Rn.current),Rn.current=setTimeout(()=>Mn(null),5e3))},[]),On=z.useMemo(()=>{if(Ft)return Ft;if(g)return()=>St("qr")},[Ft,g,St]),gr=z.useMemo(()=>{if(st)return st;if(we.length===0)return;let x=we[0];return()=>mr(x,"token")},[st,we,mr]),pc=z.useCallback(()=>{if(at){He(Ce);return}gr?.()},[at,Ce,gr,He]);z.useEffect(()=>{l||(rn.current=!1,ur("recipient"))},[l]);let ui=z.useRef(null);z.useEffect(()=>{let x=ui.current;if(!x||!i)return;let _=re=>{re.pointerType==="touch"&&re.stopPropagation()};return x.addEventListener("pointerdown",_),()=>x.removeEventListener("pointerdown",_)},[i]);let[Cn,mi]=z.useState(!1),hr=z.useRef(void 0),[Wn,Dn]=z.useState(!1);z.useEffect(()=>{if(!Wn)return;let x=()=>Dn(!1),_=tt=>{tt.key==="Escape"&&Dn(!1)},re=setTimeout(()=>{document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",_,!0)},0);return()=>{clearTimeout(re),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",_,!0)}},[Wn]),z.useEffect(()=>{Dn(!1)},[m]),z.useEffect(()=>()=>clearTimeout(hr.current),[]),z.useEffect(()=>()=>clearTimeout(Rn.current),[]),z.useEffect(()=>{let x=Sn.current;if(!x||te===null){mo(0);return}let _=()=>{mo(x.offsetHeight)};if(_(),typeof ResizeObserver>"u")return;let re=new ResizeObserver(_);return re.observe(x),()=>re.disconnect()},[te]);let gi=z.useCallback(async()=>{if(!Cn)try{await navigator.clipboard.writeText(m),mi(!0),clearTimeout(hr.current),hr.current=setTimeout(()=>mi(!1),2e3),S?.(m,!0)}catch{S?.(m,!1)}},[m,S,Cn]),wo=z.useCallback(x=>{x.currentTarget.setAttribute("data-loaded","true")},[]),hi=z.useMemo(()=>({background:af(m)}),[m]),xo=z.useMemo(()=>u||Vt(r,m,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[u,r,m,a]),br=z.useMemo(()=>rf(oe),[oe]),bi=B||I?(0,p.jsxs)("div",{className:"wi-legal-links",children:[B&&(0,p.jsx)("a",{className:"wi-legal-link",href:B,target:"_blank",rel:"noopener noreferrer",onClick:x=>nt(x,B,{category:"terms",origin:"terms"},Me),children:le}),B&&I&&(0,p.jsx)("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),I&&(0,p.jsx)("a",{className:"wi-legal-link",href:I,target:"_blank",rel:"noopener noreferrer",onClick:x=>nt(x,I,{category:"privacy",origin:"privacy"},Me),children:ie})]}):null,wi=O?(0,p.jsxs)("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{O(),k()},children:[(0,p.jsx)(Ui,{size:16}),(0,p.jsx)("span",{className:"wi-disconnect-label",children:H})]}):null,fc=f&&!q?(0,p.jsxs)("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",Ke&&"wi-action-card--dimmed"),onClick:it,disabled:!G&&!Ke,"aria-disabled":Ke||void 0,"aria-label":"Buy",children:[(0,p.jsx)(Qi,{size:20}),(0,p.jsx)("span",{children:"Buy"})]}),y?(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",lt&&"wi-action-card--dimmed"),onClick:sc,"aria-disabled":lt||void 0,"aria-label":"Bridge",children:[(0,p.jsx)(Yi,{size:20}),(0,p.jsx)("span",{children:"Bridge"})]}):(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:On,disabled:!On,"aria-label":"Receive",children:[(0,p.jsx)(Lo,{size:20}),(0,p.jsx)("span",{children:"Receive"})]}),(0,p.jsxs)("button",{type:"button",className:de("wi-action-card",at&&"wi-action-card--dimmed"),onClick:pc,disabled:!at&&!gr,"aria-disabled":at||void 0,"aria-label":"Send",children:[(0,p.jsx)(qi,{size:20}),(0,p.jsx)("span",{children:"Send"})]}),Be?(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:()=>St("portfolio"),"aria-label":"View portfolio",children:[(0,p.jsx)(Ki,{size:20}),(0,p.jsx)("span",{children:"Portfolio"})]}):y?(0,p.jsxs)("button",{type:"button",className:"wi-action-card",onClick:On,disabled:!On,"aria-label":"Receive",children:[(0,p.jsx)(Lo,{size:20}),(0,p.jsx)("span",{children:"Receive"})]}):null]}):null,uc=(0,p.jsxs)("div",{className:de("wi-view-inner",rn.current&&"wi-view-wallet"),children:[E&&(0,p.jsxs)("div",{className:"wi-total-section",children:[(0,p.jsxs)("div",{className:"wi-total-head",children:[(0,p.jsx)("span",{className:"wi-total-label",children:De}),(0,p.jsx)("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:x=>{x.stopPropagation(),yt(_=>!_)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),yt(_=>!_))},"aria-label":ht?"Show balance":"Hide balance",children:ht?(0,p.jsx)(ji,{}):(0,p.jsx)($i,{})})]}),(0,p.jsx)("div",{className:"wi-total-body",children:ct?(0,p.jsx)("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):(0,p.jsx)("div",{className:"wi-total-value","data-hidden":ht||void 0,children:ht?(0,p.jsx)("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):(0,p.jsxs)(p.Fragment,{children:[Te&&(0,p.jsx)("span",{className:"wi-total-lte",children:"\u2264"}),(0,p.jsx)("span",{className:"wi-total-currency",children:"$"}),(0,p.jsx)("span",{className:"wi-total-amount",children:br.main}),br.decimal&&(0,p.jsx)("span",{className:"wi-total-decimal",children:br.decimal})]})})})]}),ye==="top"&&(q?(0,p.jsx)("div",{className:"wi-nav-fixed",children:q}):fc),f&&(0,p.jsx)("div",{ref:ui,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:(0,p.jsxs)("div",{className:"wi-token-list",children:[vt&&Array.from({length:5},(x,_)=>(0,p.jsxs)("div",{className:"wi-skeleton-item",children:[(0,p.jsxs)("div",{className:"wi-skeleton-left",children:[(0,p.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,p.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,p.jsxs)("div",{className:"wi-skeleton-right",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},_)),!vt&&we.length===0&&!w&&(0,p.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),we.map(x=>{let _=Ze.get(Nt(x.chainId,x.address)),re=_?parseFloat(_.percent_change_24h):null,tt=re!==null&&re>=0,ce=Vn(r,x.chainId),Qe=xa(x.address);return(0,p.jsxs)("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>mr(x),"aria-label":`Send ${x.symbol}`,children:[(0,p.jsxs)("div",{className:"wi-token-left",children:[(0,p.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,p.jsx)("img",{src:x.icon_url,alt:x.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:wo,onError:Rt=>{Rt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ce&&(0,p.jsx)("img",{src:ce,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Rt=>{Rt.currentTarget.style.display="none"}})]}),(0,p.jsxs)("div",{className:"wi-token-info",children:[(0,p.jsxs)("span",{className:"wi-token-name-row",children:[(0,p.jsx)("span",{className:"wi-token-name",children:x.symbol}),Qe&&Xe!==null&&(0,p.jsx)("span",{className:"wi-token-apy",children:`APR ${Xe>=0?"+":"-"}${(Xe>=0?Math.floor:Math.ceil)(Math.abs(Xe)*100)/100}%`})]}),_&&(0,p.jsxs)("div",{className:"wi-token-price-row",children:[(0,p.jsx)("span",{className:"wi-token-price",children:Nr(_.price)}),(0,p.jsx)("span",{className:"wi-token-change","data-positive":tt,"data-zero":re===0||void 0,children:re!==null&&(re===0?"0%":`${tt?"+":"-"}${(tt?Math.floor:Math.ceil)(Math.abs(re)*100)/100}%`)})]})]})]}),(0,p.jsxs)("div",{className:"wi-token-right",children:[(0,p.jsx)("span",{className:"wi-token-balance",children:Xt(x.quantity.numeric,x.quantity.decimals)}),_&&(0,p.jsx)("span",{className:"wi-token-value",children:Xi(x.quantity.numeric,x.quantity.decimals,_.price)})]})]},`${x.address}-${x.chainId}`)}),w&&D&&Array.from({length:3},(x,_)=>(0,p.jsxs)("div",{className:"wi-skeleton-item",children:[(0,p.jsxs)("div",{className:"wi-skeleton-left",children:[(0,p.jsx)("div",{className:"wi-skeleton-block wi-skeleton-icon"}),(0,p.jsxs)("div",{className:"wi-skeleton-lines",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),(0,p.jsxs)("div",{className:"wi-skeleton-right",children:[(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),(0,p.jsx)("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${_}`)),w&&!D&&!vt&&we.length===0&&go.length===0&&(0,p.jsx)("div",{className:"wi-empty",children:"No Tokens Found"}),w&&go.map(x=>{let _=Q.get(x.token)||"",re=Vn(r,Ie[r].cross);return(0,p.jsxs)("div",{className:"wi-token-item",children:[(0,p.jsxs)("div",{className:"wi-token-left",children:[(0,p.jsxs)("div",{className:"wi-token-icon-wrap",children:[(0,p.jsx)("img",{src:_||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:x.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:wo,onError:tt=>{tt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),re&&(0,p.jsx)("img",{src:re,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:tt=>{tt.currentTarget.style.display="none"}})]}),(0,p.jsxs)("div",{className:"wi-token-info",children:[(0,p.jsx)("span",{className:"wi-token-name",children:x.token_name}),(0,p.jsx)("div",{className:"wi-token-price-row",children:(0,p.jsxs)("span",{className:"wi-token-price",children:[Xt(x.current_price,18)," CROSS"]})})]})]}),(0,p.jsxs)("div",{className:"wi-token-right",children:[(0,p.jsx)("span",{className:"wi-token-balance",children:Xt(x.balance,18)}),(0,p.jsx)("span",{className:"wi-token-value",children:Nr(x.current_value_usd)})]})]},`forge-${x.token}`)})]})}),ye==="bottom"&&q&&(0,p.jsx)("div",{className:"wi-nav-fixed",children:q}),wi&&(0,p.jsx)("div",{className:"wi-wallet-disconnect-row",children:wi})]},"wallet"),mc=Be?(0,p.jsx)("div",{className:de("wi-view-inner wi-portfolio-body",rn.current&&"wi-view-portfolio"),children:(0,p.jsx)(bn,{env:r,theme:a,walletAddress:m,showHeader:!1,onOutlink:Me,lpBalanceReader:$t,stakingRewardsReader:ze,sendTransaction:ee,estimateGas:_e,sections:ne})},"portfolio"):null,gc=fe?(0,p.jsx)("div",{className:de("wi-view-inner wi-send-body",rn.current&&"wi-view-send"),children:(0,p.jsx)(qn,{env:r,theme:a,walletAddress:m,accountName:v,accounts:R,initialStep:ac,token:fe,tokens:we,onTokenChange:j,sendTransaction:ee,getTransactionReceipt:ue,estimateGas:_e,getTokenPriceUsd:x=>{let _=Ze.get(Nt(x.chainId,x.address));if(!_?.price)return;let re=parseFloat(_.price);return Number.isFinite(re)?re:void 0},onClose:k,onBackToWallet:ho,onSubmitted:lc,onSuccess:cc,onFailed:dc,onOutlink:Me})},"send"):null,hc=z.useMemo(()=>Ee||we.map(x=>{let _=Ze.get(Nt(x.chainId,x.address)),re=_?.price?parseFloat(_.price):void 0;return{name:x.name,symbol:x.symbol,chainId:x.chainId,address:x.address,decimals:x.quantity.decimals,balance:jn(x.quantity.numeric,x.quantity.decimals),iconUrl:x.icon_url,priceUsd:Number.isFinite(re)?re:void 0}}),[Ee,Ze,we]),bc=(0,p.jsx)("div",{className:de("wi-view-inner wi-bridge-body",rn.current&&"wi-view-send"),children:(0,p.jsx)(no,{env:r,walletAddress:m,tokens:hc,history:ft,termsUrl:B,getQuote:Ge,getToTokens:Ve,getApproval:Le,approveBridge:Pt,submitBridge:wt,onClose:k,onBackToWallet:ho})},"bridge"),wr=!!N&&v?.trim().toLowerCase()!=="my wallet",xi=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("span",{className:"wi-receive-avatar",children:[(0,p.jsx)("span",{className:"wi-avatar-fallback",style:hi}),xo&&(0,p.jsx)("img",{src:xo,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:wo,onError:x=>{x.currentTarget.style.display="none"}})]}),(0,p.jsx)("span",{className:"wi-receive-account-name",children:v??"Account 1"}),wr&&(0,p.jsx)("span",{className:"wi-receive-chevron","data-open":Wn,"aria-hidden":"true",children:(0,p.jsx)(pn,{size:16})})]}),wc=(0,p.jsxs)("div",{className:de("wi-view-inner wi-qr-body",rn.current&&"wi-view-qr"),children:[(0,p.jsxs)("div",{className:"wi-receive-section",children:[wr?(0,p.jsx)("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{Dn(!0),N?.()},"aria-label":"Switch account",children:xi}):(0,p.jsx)("div",{className:"wi-receive-account",children:xi}),(0,p.jsxs)("div",{className:"wi-qr-block",children:[(0,p.jsxs)("div",{className:"wi-qr-box",children:[(0,p.jsx)(Bl.QRCodeSVG,{value:m,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&(0,p.jsx)("div",{className:"wi-qr-logo",children:(0,p.jsx)(Vi,{size:33})})]}),(0,p.jsx)("p",{className:"wi-qr-address",children:m})]}),(0,p.jsxs)("button",{type:"button",className:"wi-qr-copy-btn",onClick:gi,children:[(0,p.jsx)("span",{className:"wi-qr-copy-icon",children:Cn?(0,p.jsx)(cn,{size:16}):(0,p.jsx)(Un,{size:16})}),(0,p.jsx)("span",{className:"wi-qr-copy-text",children:Cn?"Copied!":"Copy address"})]})]}),bi&&(0,p.jsx)("div",{className:"wi-receive-footer",children:bi})]},"qr"),xc=$==="qr"||$==="portfolio"||$==="send"||$==="bridge",vi=te!==null?(0,p.jsx)("div",{className:"wi-builtin-footer",children:te}):null,yi=(0,p.jsxs)("div",{className:"wi-account-text",children:[wr?(0,p.jsxs)("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{Dn(!0),N?.()},"aria-label":"Switch account","aria-expanded":Wn,children:[(0,p.jsx)("span",{className:"wi-account-name",children:v??"Account 1"}),(0,p.jsx)("span",{className:"wi-account-switch","data-open":Wn,"aria-hidden":"true",children:(0,p.jsx)(pn,{size:20})})]}):(0,p.jsx)("div",{className:"wi-account-row",children:(0,p.jsx)("span",{className:"wi-account-name",children:v??"Account 1"})}),(0,p.jsxs)("button",{type:"button",className:"wi-address-row-btn",onClick:gi,"aria-label":"Copy address",children:[(0,p.jsx)("span",{className:"wi-account-address",children:dt(m)}),(0,p.jsx)("span",{className:"wi-account-copy","data-copied":Cn,children:Cn?(0,p.jsx)(cn,{size:12}):(0,p.jsx)(Un,{size:12})})]})]}),ki=(0,p.jsxs)(p.Fragment,{children:[o,$==="qr"?(0,p.jsx)("div",{className:"wi-sticky-header",children:(0,p.jsxs)("div",{className:"wi-header wi-header--receive",children:[(0,p.jsx)("button",{type:"button",className:"wi-header-back",onClick:ho,"aria-label":"Back",children:(0,p.jsx)(dn,{size:24})}),(0,p.jsx)("span",{className:"wi-receive-title",children:"Receive"}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]})}):$==="send"||$==="bridge"?null:xc?(0,p.jsxs)("div",{className:"wi-sticky-header",children:[(0,p.jsxs)("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[(0,p.jsx)("button",{type:"button",className:"wi-header-back",onClick:ho,"aria-label":"Back",children:(0,p.jsx)(dn,{size:24})}),(0,p.jsx)("div",{className:"wi-account-block wi-account-block--sub-account",children:yi}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]}),(0,p.jsx)("hr",{className:"wi-divider"})]}):(0,p.jsxs)("div",{className:"wi-sticky-header",children:[(0,p.jsxs)("div",{className:"wi-header wi-header--wallet",children:[(0,p.jsxs)("div",{className:"wi-account-block",children:[(0,p.jsxs)("div",{className:"wi-avatar",children:[(0,p.jsx)("div",{className:"wi-avatar-fallback",style:hi}),xo&&(0,p.jsx)("img",{src:xo,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:wo,onError:x=>{x.currentTarget.style.display="none"}})]}),yi]}),(0,p.jsxs)("div",{className:"wi-header-actions",children:[g&&y&&(0,p.jsx)("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:On,"aria-label":"Show QR code",children:(0,p.jsx)(Lo,{size:20})}),(0,p.jsx)("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:(0,p.jsx)(_t,{size:24})})]})]}),(0,p.jsx)("hr",{className:"wi-divider"})]}),(0,p.jsxs)("div",{className:"wi-view-container",children:[$==="wallet"&&uc,$==="qr"&&wc,$==="portfolio"&&mc,$==="send"&&gc,$==="bridge"&&bc]}),$==="wallet"&&Bt&&(0,p.jsx)("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Bt}),$==="wallet"&&et&&(0,p.jsxs)("a",{className:"wi-send-toast",href:fr??"#",target:"_blank",rel:"noopener noreferrer",onClick:x=>{if(!fr){x.preventDefault();return}nt(x,fr,{category:"send",origin:"send-transaction",payload:{chainId:et.chainId,txHash:et.txHash}},Me)},children:[(0,p.jsx)("span",{className:"wi-send-toast-icon","data-status":et.status,"aria-hidden":!0,children:et.status==="pending"?(0,p.jsx)("span",{className:"wi-send-toast-spinner"}):et.status==="error"?(0,p.jsx)("span",{className:"wi-send-toast-error-dot"}):(0,p.jsx)(Zi,{size:20})}),(0,p.jsxs)("span",{className:"wi-send-toast-copy",children:[(0,p.jsx)("span",{className:"wi-send-toast-title",children:et.status==="pending"?"Sending...":et.status==="error"?"Send failed":"Send complete"}),(0,p.jsx)("span",{className:"wi-send-toast-desc",children:et.status==="pending"||et.status==="error"?et.description:"Tap to see your transaction"})]})]}),vi&&$!=="portfolio"&&$!=="send"&&(0,p.jsx)("div",{className:"wi-sticky-footer",children:(0,p.jsx)("div",{className:"wi-footer",ref:Sn,children:vi})})]}),Si={...W,...kt>0?{"--wi-footer-height":`${kt}px`}:null};return i?(0,p.jsxs)(oo.Drawer.Portal,{children:[c&&(0,p.jsx)(oo.Drawer.Overlay,{className:"wi-drawer-overlay"}),(0,p.jsxs)(oo.Drawer.Content,{className:de("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":d==="left"||d==="right"?!0:void 0,style:Si,"data-direction":d,"data-no-balance":!f||void 0,"data-has-footer":kt>0||void 0,"data-view":$,children:[(0,p.jsx)(oo.Drawer.Title,{className:"wi-sr-only",children:"My Wallet"}),ki]})]}):(0,p.jsxs)(p.Fragment,{children:[c&&l&&(0,p.jsx)("div",{className:"wi-drawer-overlay",onClick:k}),(0,p.jsx)(ir.Portal,{children:(0,p.jsx)(ir.Content,{align:e,sideOffset:t,className:de("wi-popover-content",n),"data-theme":a,style:Si,"data-no-balance":!f||void 0,"data-has-footer":kt>0||void 0,"data-view":$,children:ki})})]})}var Ml=U(require("react"),1);function Ol({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Yt();return Ml.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}var Wl=U(require("react"),1);function Dl({children:e}){let{setFooterContent:t}=Yt();return Wl.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}Y(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #121212);--wi-surface-default: var(--ds-surface-medium, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(255, 255, 255, .1));--wi-border-default: var(--ds-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--ds-border-medium, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--ds-content-highest, #ffffff);--wi-texticon-secondary: var(--ds-content-medium, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(255, 255, 255, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .4)}[data-theme=light].wi-popover-content,[data-theme=light].wi-drawer-content{--wi-primary: var(--ds-accent-primary-default, #019d92);--wi-secondary: var(--ds-system-red-default, #e70077);--wi-surface-bg: var(--ds-bg-default, #ffffff);--wi-surface-default: var(--ds-surface-medium, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--ds-surface-high, rgba(18, 18, 18, .1));--wi-border-default: var(--ds-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--ds-border-medium, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--ds-content-highest, #121212);--wi-texticon-secondary: var(--ds-content-medium, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--ds-content-low, rgba(18, 18, 18, .5));--wi-on-primary: var(--ds-accent-primary-on, #ffffff);--wi-error: var(--ds-system-red-default, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
|
|
11
11
|
`);Y(`.wi-trigger-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;border:1px solid rgba(255,255,255,.2);background:#1a2332;border-radius:9999px;cursor:pointer;color:#fff;font-family:inherit;font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.3125px;transition:opacity .15s ease}.wi-trigger-btn:hover{opacity:.85}.wi-trigger-btn[data-theme=light]{background:#f3f6f8;border-color:#1212121a;color:#121212}.wi-trigger-btn[data-mobile]{font-size:14px;padding:6px 12px;gap:6px;line-height:20px}.wi-trigger-address{white-space:nowrap}.wi-divider{height:1px;background:var(--wi-border-default);margin:0;border:none;flex-shrink:0}[data-theme=light] .wi-divider{background:#1212121a}[data-theme=dark] .wi-divider{background:#ffffff1a}
|
|
12
12
|
`);Y(`@keyframes wi-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes wi-shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}@keyframes wi-slide-in-right{0%{transform:translate(40px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes wi-slide-in-left{0%{transform:translate(-40px);opacity:0}to{transform:translate(0);opacity:1}}
|
|
13
13
|
`);Y(`.wi-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;width:393px;border-radius:24px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--wi-surface-bg);box-shadow:var(--ds-shadow-modal, var(--wi-shadow));animation:wi-fade-in .15s ease-out;height:600px;overflow:hidden;display:flex;flex-direction:column}.wi-popover-content[data-no-balance]{height:auto}.wi-popover-content[data-has-footer]:not([data-no-balance]){height:min(calc(600px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;max-height:100vh;background:var(--wi-surface-bg);overflow:hidden;display:flex;flex-direction:column;box-sizing:border-box}.wi-drawer-content[data-no-balance]{bottom:auto;max-height:none}.wi-drawer-content[data-no-balance][data-direction=bottom]{bottom:0;top:auto;border-radius:24px 24px 0 0}.wi-drawer-content[data-direction=left]{right:auto;left:0}.wi-drawer-content[data-direction=bottom]{top:0;left:0;right:0;width:100%;max-height:100dvh;margin:0 auto}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:100dvh}.wi-popover-content[data-view=qr]{max-height:calc(100dvh - 32px)}.wi-sticky-header{flex-shrink:0;position:relative}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px}.wi-header--wallet{align-items:flex-start;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--wallet+.wi-divider{display:none}.wi-header--sub-account{align-items:center}.wi-header--sub-account .wi-header-back{width:32px;height:38px}.wi-header--sub-account .wi-header-action{flex-shrink:0}.wi-account-block{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wi-account-block--sub-account{align-items:center}.wi-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:32px;height:32px;border-radius:50%;object-fit:cover;background:transparent}.wi-account-text{display:flex;flex-direction:column;gap:2px;min-width:0}.wi-account-row{display:flex;align-items:center;gap:8px;min-width:0}.wi-account-row--btn{padding:2px;margin:0;width:fit-content;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;border-radius:6px;transition:background-color .15s ease,opacity .15s ease}.wi-account-row--btn:hover{background:var(--wi-surface-subtle, rgba(255, 255, 255, .06))}.wi-account-row--btn:focus-visible{outline:2px solid var(--wi-primary, #00d5aa);outline-offset:2px}.wi-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px 0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));border-radius:4px;flex-shrink:0;transition:color .15s ease,transform .2s ease}.wi-account-switch[data-open=true]{transform:rotate(180deg)}.wi-account-row--btn:hover .wi-account-switch{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;text-align:left;min-width:0;transition:color .15s ease}.wi-address-row-btn:hover .wi-account-address,.wi-address-row-btn:hover .wi-account-copy{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-account-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-copy{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:color .15s ease}.wi-account-copy[data-copied=true]{color:var(--ds-system-green-high, #00a869)}.wi-header-actions{display:flex;align-items:center;gap:16px;flex-shrink:0;margin-top:-4px}.wi-header-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;border-radius:0;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header-action--qr{width:32px;height:32px;border-radius:8px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));transition:background-color .15s ease,color .15s ease}.wi-header-action--qr:hover{background:var(--ds-surface-high, rgba(0, 0, 0, .08));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header--receive{align-items:center;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--receive .wi-header-action,.wi-header--sub-account .wi-header-action{position:absolute;top:24px;right:24px}.wi-receive-title{position:absolute;left:50%;transform:translate(-50%);font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);text-align:center;pointer-events:none}.wi-header-info{flex:1;display:flex;flex-direction:column;gap:8px;min-width:0}.wi-header-title{font-family:inherit;font-size:16px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);margin:0}.wi-header-close{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:24px 24px 0;padding:0;flex-shrink:0;display:flex;flex-direction:column;gap:8px;border:none;background:transparent;border-radius:12px;color:inherit;font:inherit;text-align:left;width:auto}.wi-action-row{display:flex;align-items:flex-start;gap:8px;width:auto;margin:24px 24px 0}.wi-action-card{appearance:none;display:flex;flex:1 1 0;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border:none;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-align:center;cursor:pointer;transition:background-color .15s ease,color .15s ease}.wi-action-card:hover:not(:disabled){background:#2e3544!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}:root[data-ds-theme=light] .wi-action-card:hover:not(:disabled){background:#e4e8ef!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-action-card:disabled{cursor:default}.wi-action-card>svg{flex-shrink:0}.wi-action-card:not(:disabled){transition:background-color .15s ease,transform .1s ease}.wi-action-card:active:not(:disabled){transform:scale(.93)}.wi-total-head{display:flex;align-items:center;gap:4px}.wi-total-body{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.wi-total-label{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease;border-radius:4px}.wi-total-eye:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-total-eye:focus-visible{outline:1px solid var(--wi-texticon-secondary);outline-offset:2px}.wi-total-value{display:flex;align-items:baseline;gap:0;font-family:inherit;font-weight:600;line-height:1.25;color:var(--ds-content-highest, #000000);font-variant-numeric:tabular-nums;min-height:45px;white-space:nowrap}.wi-total-currency,.wi-total-amount,.wi-total-decimal{font-size:36px;color:var(--ds-content-highest, #000000)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:22px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:32px;color:var(--wi-texticon-secondary)}.wi-total-skeleton{border-radius:6px}.wi-scrollable-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:8px 0 0;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}.wi-drawer-content .wi-scrollable-body{touch-action:pan-y}[data-theme=light] .wi-scrollable-body{scrollbar-color:rgba(0,0,0,.12) transparent}.wi-scrollable-body::-webkit-scrollbar{width:4px}.wi-scrollable-body::-webkit-scrollbar-track{background:transparent}.wi-scrollable-body::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}.wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#0003}.wi-nav-fixed{flex-shrink:0;padding:0 24px}.wi-token-list{display:flex;flex-direction:column;gap:0;padding:8px 0}.wi-token-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 24px;border:none;background:transparent;text-align:left;font-family:inherit;width:100%;box-sizing:border-box}.wi-token-item--button{cursor:pointer;background:var(--ds-surface-default, #ffffff);transition:none}.wi-token-item--button:hover{background:#252b39!important}:root[data-ds-theme=light] .wi-token-item--button:hover{background:#eff3f8!important}button.wi-token-item:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px;border-radius:4px}.wi-token-left{display:flex;align-items:center;gap:16px;min-width:0}.wi-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.wi-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain;opacity:0;transition:opacity .2s ease}.wi-token-icon[data-loaded=true]{opacity:1}.wi-token-chain-badge{position:absolute;right:0;bottom:0;width:14px;height:14px;border-radius:50%;background:var(--wi-surface-bg);box-shadow:0 0 0 1.5px var(--wi-surface-bg);object-fit:contain}.wi-token-info{display:flex;flex-direction:column;min-width:0}.wi-token-name-row{display:flex;align-items:center;gap:6px;min-width:0}.wi-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-token-apy{flex-shrink:0;font-family:inherit;font-size:12px;font-weight:600;line-height:1;color:var(--ds-system-purple-high, #9b78ff);background:var(--ds-system-purple-low, #2e2854);padding:4px;border-radius:6px;white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:8px}.wi-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-token-change{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--ds-system-green-high, #00a0a2)}.wi-token-change[data-positive=false]{color:var(--ds-system-red-high, #a80927)}.wi-token-change[data-zero]{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-sticky-footer{flex-shrink:0}.wi-footer{padding:16px 24px 24px}.wi-builtin-footer{display:flex;flex-direction:column;gap:8px;align-items:stretch}.wi-wallet-disconnect-row{display:flex;justify-content:flex-end;flex-shrink:0;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-send-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:2;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);box-sizing:border-box;text-decoration:none}.wi-action-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:3;padding:12px 14px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);font-size:14px;line-height:1.4;text-align:center;box-sizing:border-box;animation:wi-action-toast-in .18s ease-out}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-action-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-action-toast{bottom:72px}@keyframes wi-action-toast-in{0%{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}.wi-action-card--dimmed{opacity:.4;cursor:pointer}.wi-action-card--dimmed:hover{opacity:.5}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-send-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-send-toast{bottom:72px}.wi-send-toast:hover{opacity:.92}.wi-send-toast-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;color:var(--ds-accent-primary-default, #00b4b7)}.wi-send-toast-spinner{width:18px;height:18px;border:2px solid rgba(0,232,201,.22);border-top-color:var(--ds-accent-primary-on-inverted, #00e8c9);border-radius:50%;animation:wi-send-toast-spin .8s linear infinite}.wi-send-toast-error-dot{width:18px;height:18px;border-radius:50%;background:var(--ds-system-red-default, #ff3358)}@keyframes wi-send-toast-spin{to{transform:rotate(360deg)}}.wi-send-toast-copy{display:flex;min-width:0;flex-direction:column}.wi-send-toast-title{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-inverted, #ffffff)}.wi-send-toast-desc{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-accent-primary-on-inverted, #00e8c9)}.wi-send-toast-icon[data-status=error]+.wi-send-toast-copy .wi-send-toast-desc{color:var(--ds-system-red-default, #ff3358)}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:16px;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:color .15s ease}.wi-disconnect-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-disconnect-label{white-space:nowrap}.wi-legal-links{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;flex-shrink:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-receive-avatar .wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-receive-avatar .wi-avatar-img{width:24px;height:24px}.wi-legal-link{color:var(--ds-content-low, rgba(0, 0, 0, .4));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.wi-legal-link:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-legal-sep{color:inherit}.wi-empty{display:flex;align-items:center;justify-content:center;padding:32px 0;font-family:inherit;font-size:16px;color:var(--wi-texticon-secondary)}.wi-skeleton-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-skeleton-left{display:flex;align-items:center;gap:12px}.wi-skeleton-block{border-radius:6px;background:var(--wi-border-default);position:relative;overflow:hidden}.wi-skeleton-block:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.06) 50%,transparent 100%);animation:wi-shimmer 1.5s ease-in-out infinite}[data-theme=light] .wi-skeleton-block:after{background:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.04) 50%,transparent 100%)}.wi-skeleton-icon{width:32px;height:32px;border-radius:50%;flex-shrink:0}.wi-skeleton-lines{display:flex;flex-direction:column;gap:6px}.wi-skeleton-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}.wi-header-back{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-back:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-view-container{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-popover-content[data-view=qr] .wi-view-container,.wi-drawer-content[data-view=qr] .wi-view-container{flex:1;min-height:0}.wi-view-inner{display:flex;flex-direction:column;flex:1;min-height:0}.wi-view-wallet{animation:wi-slide-in-left .25s ease-out}.wi-view-qr,.wi-view-portfolio{animation:wi-slide-in-right .25s ease-out}.wi-qr-body{flex:1;min-height:0;display:flex;flex-direction:column}.wi-portfolio-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-portfolio-body>.wp-embed{flex:1;min-height:0}.wi-portfolio-body .wp-body-inner{padding:16px 16px 32px;gap:32px}.wi-receive-section{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;padding:24px}.wi-receive-account{display:inline-flex;align-items:center;gap:8px;padding:4px 8px 4px 4px;border:0;background:var(--ds-surface-high, #edf1f2);border-radius:9999px;font-family:inherit;color:inherit}.wi-receive-account--btn{cursor:pointer;transition:none}.wi-receive-account--btn:hover{background:#2e3544}:root[data-ds-theme=light] .wi-receive-account--btn:hover{background:#e4e8ef}.wi-receive-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0}.wi-receive-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-account>svg{color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0}.wi-receive-chevron{display:inline-flex;align-items:center;color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0;transition:transform .2s ease}.wi-receive-chevron[data-open=true]{transform:rotate(180deg)}.wi-qr-block{display:flex;flex-direction:column;align-items:center;gap:16px}.wi-qr-box{position:relative;display:flex;align-items:center;justify-content:center;padding:10px;background:#fff;border-radius:6px;overflow:hidden}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:16px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;word-break:break-all;max-width:281px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:12px 16px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);border-radius:12px;cursor:pointer;transition:border-color .15s ease}.wi-qr-copy-btn:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.wi-qr-copy-icon{display:inline-flex;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-qr-copy-text{font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-footer{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-drawer-content .wi-header{padding:16px}.wi-drawer-content .wi-header--receive .wi-header-action,.wi-drawer-content .wi-header--sub-account .wi-header-action{top:16px;right:16px}.wi-drawer-content .wi-total-section,.wi-drawer-content .wi-action-row{margin:16px 16px 0}.wi-drawer-content .wi-nav-fixed{padding:0 16px}.wi-drawer-content .wi-token-item{padding:12px 16px}.wi-drawer-content .wi-wallet-disconnect-row{padding:16px}
|