@nexus-cross/dapp-ui 1.3.7-beta.1 → 1.3.7-beta.3

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.js CHANGED
@@ -1,22 +1,23 @@
1
- function ta(e){try{return import.meta.env?.[e]}catch{return}}function na(e){if(!(typeof process>"u"))return process.env?.[e]}function _e(e){if(e)return oa(e);let t=ta("VITE_CROSSX_ENVIRONMENT")??ta("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??na("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??na("CROSSX_ENVIRONMENT");return oa(t)}function oa(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var lo="1.3.5";var Bo="__nexusCrossAppLauncherRuntime";function Xc(){if(typeof window>"u")return null;let e=window;return e[Bo]??(e[Bo]={mode:"dapp-ui"}),e[Bo]}function Jc(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${lo}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${lo} \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 Vr(e){let t=Xc();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),Jc(t))}import{BrowserClient as ed,Scope as td,defaultStackParser as nd,linkedErrorsIntegration as od,makeFetchTransport as rd}from"@sentry/react";var id="https://5c82aeb32da33b5a0a14b7c5393992ca@o4511668907081728.ingest.de.sentry.io/4511705324126289",ad=`dapp-ui@${lo}`,On=null,ra=1;function ia(){return ra}function sd(e){switch(e){case"dev":return"dev";case"stage":return"stg";default:return"prod"}}function co(e){if(On)return On;if(typeof window>"u")return null;let t=sd(_e(e?.environment));typeof e?.analyticsSampleRate=="number"&&(ra=Math.min(1,Math.max(0,e.analyticsSampleRate)));let n=new ed({dsn:e?.dsn??id,transport:rd,stackParser:nd,integrations:[od()],environment:t,release:ad,enabled:e?.enabled??t==="prod"}),o=new td;return o.setClient(n),o.setTags({package:"dapp-ui",framework:"react",source:"dapp-ui"}),n.init(),On=o,On}function Mo(){return On}function Do(e,t){let n=On??co();if(n)return n.captureException(e,t?{captureContext:{extra:t}}:void 0)}import{Component as ld}from"react";var Oo=class extends ld{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,o){Do(n,{componentStack:o.componentStack??void 0,boundary:this.props.name??"dapp-ui"})}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function me(...e){return e.filter(Boolean).join(" ")}function aa(){return typeof window>"u"?!1:window.navigator.userAgent.includes("CROSSx")}var sa="__nexus_dapp_ui_uid",qr=null;function cd(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Array.from({length:32},()=>Math.floor(Math.random()*16).toString(16)).join("")}function Kr(){if(qr)return qr;let e=null;try{e=window.localStorage.getItem(sa)}catch{}if(!e||!e.startsWith("anon_")){e=`anon_${cd()}`;try{window.localStorage.setItem(sa,e)}catch{}}return qr=e,e}async function la(e){if(typeof crypto>"u"||!crypto.subtle)return null;try{let t=new TextEncoder().encode(e.trim().toLowerCase()),n=await crypto.subtle.digest("SHA-256",t);return`wallet_${Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("").slice(0,16)}`}catch{return null}}function dd(){let e=window.navigator.userAgent;return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|iphone|ipod|android/i.test(e)?"mobile":"desktop"}function pa(){return{host:window.location.hostname,device_type:dd(),is_cross_inapp:String(aa())}}var ca=!1;function Yr(){if(typeof window>"u")return null;let e=Mo()??co();return e?(ca||(ca=!0,e.setUser({id:Kr()})),e):null}function ua(){return Math.random()>=ia()}var da=0;function Wn(e){let t=Yr();if(!t)return;let n=++da;if(!e){t.setUser({id:Kr()});return}la(e).then(o=>{o&&n===da&&t.setUser({id:o})})}function Wo(e,t,n){let o=Yr();!o||ua()||o.captureMessage(`ui: ${e}_${t}`,"info",{captureContext:{tags:{...pa(),feature:e,action:t,...n}}})}function ve(e,t,n){let o=Yr();if(!o||ua())return;let r=n?.status??"success";o.captureMessage(`funnel: ${e}_${t}`,"info",{captureContext:{tags:{...pa(),flow:e,funnel_step:`${e}_${t}`,funnel_status:r,...r==="failure"?{failure_reason:n?.reason??"unknown"}:{},...n?.tags}}})}function bt(e){let t=e,n=String((t&&typeof t=="object"&&"message"in t?t.message:e)??"").toLowerCase();return t?.code===4001||/reject|denied|declin|cancel/i.test(n)?"user-rejected":/insufficient (funds|gas|balance)|exceeds balance/i.test(n)?"insufficient-gas":/timeout|timed out|deadline/i.test(n)?"timeout":/revert|execution failed/i.test(n)?"contract-reverted":/network|fetch|connection|disconnected|offline/i.test(n)?"network":"unknown"}import{useCallback as pd}from"react";import{jsx as ud}from"react/jsx-runtime";function he({feature:e,children:t}){let n=pd(o=>{let r=o.nativeEvent;if(r.__dappUiTracked)return;let a=o.target?.closest?.("[data-track]");if(!a)return;let s=a.getAttribute("data-track");if(!s)return;r.__dappUiTracked=!0;let c=a.getAttribute("data-track-id");Wo(e,s,c?{item_id:c}:void 0)},[e]);return ud("div",{style:{display:"contents"},onClick:n,children:t})}import*as Gn from"react";import*as fa from"@radix-ui/react-popover";import{Drawer as bd}from"vaul";import{createContext as fd,useContext as md}from"react";var Qr=fd(null);function Uo(){let e=md(Qr);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as gd,useEffect as hd}from"react";function Un(e){let[t,n]=gd(!1);return hd(()=>{let o=window.matchMedia(e);n(o.matches);let r=i=>n(i.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
- `);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
- `);Y(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
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}
5
- `);Y("");import{jsx as Zr}from"react/jsx-runtime";function ma({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=Un(`(max-width: ${n}px)`),[a,s]=Gn.useState(!1),c=Gn.useCallback(()=>s(!1),[]),l=_e(e),p=Gn.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:o,close:c}),[l,t,i,a,o,c]);return Zr(Qr.Provider,{value:p,children:i?Zr(bd.Root,{direction:"right",open:a,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Zr(fa.Root,{open:a,onOpenChange:s,children:r},"popover")})}import*as wa from"@radix-ui/react-popover";import{Drawer as xd}from"vaul";import{jsx as wt,jsxs as wd}from"react/jsx-runtime";function ga({size:e=18}){return wd("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[wt("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function ha(){return wt("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:wt("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ba(){return wt("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:wt("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as zn}from"react/jsx-runtime";function xa({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:i}=Uo(),a=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=a?t:zn("button",{type:"button",className:c,"data-theme":i,"data-track":"open",style:o,children:zn(ga,{size:18})});return r?zn(he,{feature:"app_launcher",children:zn(xd.Trigger,{asChild:s,children:l})}):zn(he,{feature:"app_launcher",children:zn(wa.Trigger,{asChild:s,children:l})})}import*as Cn from"react";import*as zo from"@radix-ui/react-popover";import{Drawer as $n}from"vaul";import{useQuery as kd}from"@tanstack/react-query";var va={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json"};var vd="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",yd="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Dt(e,t){return`${e==="production"?yd:vd}/${t}.png`}function ya(e){let t=e==="production"?"production":"stage";return{version:"0.0.1-fallback",items:[{id:"gametoken-cross",label:"Gametoken",description:"Trade game tokens easily using CROSS.",url:{dev:"https://stg.onechain.nexus/gametoken",stage:"https://stg.onechain.nexus/gametoken",production:"https://www.onechain.nexus/gametoken"},iconUrl:Dt(t,"game-token"),order:1e3,type:"gametoken",badge:null,isNew:!1,serviceStatus:"available"},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg.onechain.nexus/forge",stage:"https://stg.onechain.nexus/forge",production:"https://onechain.nexus/forge"},iconUrl:Dt(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0,serviceStatus:"available"},{id:"crossd",label:"Bridge",description:"The first decentralized exchange on the CROSS network.",url:{dev:"https://stg.crossdefi.io/swap-bridge",stage:"https://stg.crossdefi.io/swap-bridge",production:"https://www.crossdefi.io/swap-bridge"},iconUrl:Dt(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1,serviceStatus:"ending"},{id:"prediction",label:"Prediction",description:"Prediction market",url:{dev:"https://stg-prediction.crossdefi.io",stage:"https://stg-prediction.crossdefi.io",production:"https://prediction.crossdefi.io/"},iconUrl:Dt(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0,serviceStatus:"available"},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg.onechain.nexus/rewards",stage:"https://stg.onechain.nexus/rewards",production:"https://onechain.nexus/rewards"},iconUrl:Dt(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1,serviceStatus:"ending"},{id:"cross-staking",label:"Staking",description:"Stake CROSS and earn rewards.",url:{dev:"https://stg-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},iconUrl:Dt(t,"cross-staking"),order:7500,type:"cross-staking",badge:null,isNew:!0,serviceStatus:"available"},{id:"nft",label:"NFT",description:"Trade and collect NFTs in the CROSS ecosystem.",url:{dev:"https://stg.crossnft.io/",stage:"https://stg.crossnft.io/",production:"https://www.crossnft.io/"},iconUrl:Dt(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1,serviceStatus:"available"},{id:"play",label:"Quest",description:"Discover and play games on CROSS.",url:{dev:"https://stg.onechain.nexus/quest",stage:"https://stg.onechain.nexus/quest",production:"https://www.onechain.nexus/quest"},iconUrl:Dt(t,"play"),order:8500,type:"play",badge:null,isNew:!0,serviceStatus:"available"},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://stg.onechain.nexus/shop",stage:"https://stg.onechain.nexus/shop",production:"https://www.onechain.nexus/shop"},iconUrl:Dt(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1,serviceStatus:"available"},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.onechain.nexus",stage:"https://stg-explorer.onechain.nexus",production:"https://explorer.onechain.nexus"},iconUrl:Dt(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1,serviceStatus:"available"},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg.onechain.nexus/wave",stage:"https://stg.onechain.nexus/wave",production:"https://www.onechain.nexus/wave"},iconUrl:Dt(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1,serviceStatus:"available"}]}}function Go(e){let t=_e(e);return kd({queryKey:["global-menu",t],queryFn:async()=>{try{let n=await fetch(va[t],{cache:"no-store"});if(!n.ok)throw new Error(`Failed to fetch global menu: ${n.status}`);return n.json()}catch{return ya(t)}},staleTime:300*1e3,gcTime:600*1e3,retry:!1,refetchOnMount:!0})}function Xr(e){return e.serviceStatus==="ending"||e.serviceStatus==="comingSoon"?e.serviceStatus:"available"}function Sa(e,t){return typeof e=="string"?e:e[t]??e.production??e.stage??e.dev}function Ra(e){return[...e].sort((t,n)=>{let o=ka(t)-ka(n);return o!==0?o:t.order-n.order})}function ka(e){let t=Xr(e);return t==="comingSoon"?0:t==="ending"?2:1}import{jsx as Ae,jsxs as Hn}from"react/jsx-runtime";function Sd(e){return e.id==="cross-staking"||e.type==="cross-staking"}function Ta({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:i,domain:a,close:s}=Uo(),{data:c}=Go(o),l=Cn.useMemo(()=>Ra(c?.items??[]),[c?.items]),p=8,h=Cn.useRef(null),b=Cn.useCallback(x=>{h.current={x:x.clientX,y:x.clientY}},[]),u=typeof window<"u"?window.location.pathname:"",v=Cn.useCallback((x,C)=>{if(h.current){let S=x.clientX-h.current.x,N=x.clientY-h.current.y;if(h.current=null,Math.abs(S)>p||Math.abs(N)>p)return}let d=C.url[o]??C.url.production,k=Ca(d,a);if(!k)try{let S=new URL(d).pathname;if(u===S||u.startsWith(S+"/")){s();return}}catch{}k?window.open(d,"_blank","noopener,noreferrer"):window.location.href=d,s()},[o,a,s,u]),g=x=>{let C=x.url[o]??x.url.production,d=Ca(C,a),k=Xr(x),S=k==="ending",N=Sa(x.iconUrl,o),R=!1;if(!d)try{let E=new URL(C).pathname;R=u===E||u.startsWith(E+"/")}catch{R=!1}return Ae("button",{type:"button",className:"al-grid-item","data-track":"menu_item_click","data-track-id":x.id,"data-active":R||void 0,"data-service-status":k,onPointerDown:b,onClick:E=>v(E,x),children:Hn("div",{className:"al-grid-item-left",children:[Hn("div",{className:"al-grid-item-icon",children:[Ae("img",{src:N,alt:x.label,width:24,height:24,loading:"lazy"}),x.isNew&&Ae("span",{className:"al-status-ribbon al-status-ribbon-new",children:"N"})]}),Hn("span",{className:"al-grid-item-text",children:[Ae("span",{className:"al-grid-item-label",children:x.label}),S&&Ae("span",{className:"al-grid-item-status-text",children:"(End Soon)"}),x.badge&&!Sd(x)&&Ae("span",{className:"al-badge al-badge-list",children:x.badge})]})]})},x.id)},m=Ae("div",{className:"al-menu","data-theme":r,children:Ae("div",{className:"al-grid",children:l.map(g)})});return i?Ae(he,{feature:"app_launcher",children:Hn($n.Portal,{children:[Ae($n.Overlay,{className:"al-drawer-overlay"}),Hn($n.Content,{className:me("al-drawer-content",n),"data-theme":r,children:[Hn("div",{className:"al-drawer-header",children:[Ae($n.Close,{className:"al-drawer-close","data-track":"close",children:Ae(ha,{})}),Ae($n.Title,{className:"al-drawer-title",children:"CROSS Services"}),Ae($n.Close,{className:"al-drawer-close","data-track":"close",children:Ae(ba,{})})]}),Ae("div",{className:"al-drawer-body",children:m})]})]})}):Ae(he,{feature:"app_launcher",children:Ae(zo.Portal,{children:Ae(zo.Content,{align:e,sideOffset:t,className:me("al-popover-content",n),"data-theme":r,children:m})})})}function Ca(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Ye from"react";import*as uc from"@radix-ui/react-popover";import{Drawer as bm}from"vaul";import{createContext as Rd,useContext as Cd}from"react";var Jr=Rd(null);function un(){let e=Cd(Jr);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var ei=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(ei||{}),$o={crossx:{name:"CROSSx",iconUrl:"https://contents.crosstoken.io/wallet/token/images/tCROSS.svg"},"io.metamask":{name:"MetaMask",iconUrl:"https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg"},"com.binance.wallet":{name:"Binance Wallet",iconUrl:"https://public.bnbstatic.com/static/images/common/favicon.ico"}};import*as bs from"react";import{jsx as ae,jsxs as uo}from"react/jsx-runtime";function Na({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M12.6667 4.66667V2.66667C12.6667 2.48986 12.5964 2.32029 12.4714 2.19526C12.3464 2.07024 12.1768 2 12 2H3.33333C2.97971 2 2.64057 2.14048 2.39052 2.39052C2.14048 2.64057 2 2.97971 2 3.33333C2 3.68696 2.14048 4.02609 2.39052 4.27614C2.64057 4.52619 2.97971 4.66667 3.33333 4.66667H13.3333C13.5101 4.66667 13.6797 4.7369 13.8047 4.86193C13.9298 4.98695 14 5.15652 14 5.33333V8M14 8H12C11.6464 8 11.3072 8.14048 11.0572 8.39052C10.8071 8.64057 10.6667 8.97971 10.6667 9.33333C10.6667 9.68696 10.8071 10.0261 11.0572 10.2761C11.3072 10.5262 11.6464 10.6667 12 10.6667H14C14.1768 10.6667 14.3464 10.5964 14.4714 10.4714C14.5964 10.3464 14.6667 10.1768 14.6667 10V8.66667C14.6667 8.48986 14.5964 8.32029 14.4714 8.19526C14.3464 8.07024 14.1768 8 14 8Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M2 3.33325V12.6666C2 13.0202 2.14048 13.3593 2.39052 13.6094C2.64057 13.8594 2.97971 13.9999 3.33333 13.9999H13.3333C13.5101 13.9999 13.6797 13.9297 13.8047 13.8047C13.9298 13.6796 14 13.5101 14 13.3333V10.6666",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function po({size:e=16,className:t}){return ae("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M9.40284 17.0647H4.85156V4.84656H17.0697V9.39783H15.4407V6.47565H6.48066V15.4356H9.40284V17.0647ZM21.5192 12.5644H12.5592V21.5244H21.5192V12.5644ZM23.1483 10.9353V23.1535H10.9301V10.9353H23.1483Z",fill:"currentColor"})})}function Tn({size:e=16,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function jt({size:e=24,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ea({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M7.5 17.5H4.167A1.667 1.667 0 012.5 15.833V4.167A1.667 1.667 0 014.167 2.5H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M13.333 14.167L17.5 10l-4.167-4.167M17.5 10H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ho({size:e=20,className:t}){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:ae("path",{d:"M7.91305 10.8327C8.60341 10.8327 9.16305 11.3924 9.16305 12.0827V16.2458C9.16305 16.9361 8.60341 17.4958 7.91305 17.4958H3.75C3.05964 17.4958 2.5 16.9361 2.5 16.2458L2.5 12.0827C2.5 11.3924 3.05964 10.8327 3.75 10.8327H7.91305ZM14.1685 17.4958H12.5027V15.83H14.1685V17.4958ZM17.5 17.4958H15.8342V15.83H17.5V17.4958ZM4.16576 12.4985V15.83H7.49729V12.4985H4.16576ZM12.5027 15.83H10.8369V14.1642H12.5027V15.83ZM15.8342 15.83H14.1685V14.1642H15.8342V15.83ZM14.1685 14.1642H12.5027V12.4985H14.1685V14.1642ZM17.5 14.1642H15.8342V12.4985H17.5V14.1642ZM12.5027 12.4985H10.8369V10.8327H12.5027V12.4985ZM15.8342 12.4985H14.1685V10.8327H15.8342V12.4985ZM7.91305 2.50391C8.60341 2.50391 9.16305 3.06355 9.16305 3.75391V7.91696C9.16305 8.60731 8.60341 9.16696 7.91305 9.16696H3.75C3.05964 9.16696 2.5 8.60731 2.5 7.91696L2.5 3.75391C2.5 3.06355 3.05964 2.50391 3.75 2.50391L7.91305 2.50391ZM16.2419 2.50391C16.9322 2.50391 17.4919 3.06355 17.4919 3.75391V7.91696C17.4919 8.60731 16.9322 9.16696 16.2419 9.16696H12.0788C11.3885 9.16696 10.8288 8.60731 10.8288 7.91696V3.75391C10.8288 3.06355 11.3885 2.50391 12.0788 2.50391L16.2419 2.50391ZM4.16576 4.16967L4.16576 7.50119L7.49729 7.50119L7.49729 4.16967L4.16576 4.16967ZM12.4946 4.16967V7.50119H15.8261V4.16967H12.4946Z",fill:"currentColor",fillOpacity:1})})}function Nn({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function En({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ia({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M1.667 10S4.167 4.167 10 4.167 18.333 10 18.333 10 15.833 15.833 10 15.833 1.667 10 1.667 10z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pa({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M14.95 14.95A8.283 8.283 0 0110 16.667c-5.833 0-8.333-5.833-8.333-5.833a15.238 15.238 0 014.183-4.884m3.267-1.55A7.55 7.55 0 0110 4.167c5.833 0 8.333 5.833 8.333 5.833a15.28 15.28 0 01-1.783 2.633M11.767 11.767a2.5 2.5 0 11-3.534-3.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function La({size:e=42,className:t}){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:ae("path",{d:"M20.7314 2C31.0766 2 39.4628 10.3863 39.4629 20.7314C39.4629 31.0766 31.0766 39.4629 20.7314 39.4629C10.3863 39.4628 2 31.0766 2 20.7314C2.00007 10.3864 10.3864 2.00007 20.7314 2ZM20.5938 30.0586L21.1084 30.5732L21.623 30.0586V25.2471H21.1084C20.9344 25.2471 20.7626 25.235 20.5938 25.2158V30.0586ZM16.4834 24.6611L14.6514 26.4922L15.3799 27.2207L17.1797 25.4209L18.3193 24.2803C18.0487 24.0673 17.8025 23.8251 17.5869 23.5566L16.4834 24.6611ZM26.8691 27.2207L27.5967 26.4922L26.3516 25.2471H24.8955L26.8691 27.2207ZM11.2666 20.7314L11.7822 21.2471H16.624C16.6048 21.0781 16.5938 20.9065 16.5938 20.7324C16.5938 20.5585 16.6049 20.3866 16.624 20.2178H11.7812L11.2666 20.7314ZM20.5938 11.4053V16.2471C20.7626 16.2279 20.9345 16.2178 21.1084 16.2178H21.623V11.4053L21.1084 10.8906L20.5938 11.4053ZM14.6514 15.0029L16.4521 16.8027L17.5732 17.9238C17.7874 17.6546 18.0315 17.4104 18.3008 17.1963L15.3799 14.2754L14.6514 15.0029ZM25.0371 16.1074L24.9268 16.2178H26.3818L27.5957 15.0029L26.8682 14.2754L25.0371 16.1074Z",fill:"#019D92",stroke:"white",strokeWidth:4})})}function _a({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M9.19133 10.8077C9.04905 10.6657 8.87947 10.554 8.69283 10.4792L2.78881 8.11167C2.71832 8.08338 2.65816 8.03421 2.61642 7.97075C2.57468 7.90729 2.55335 7.83258 2.5553 7.75665C2.55724 7.68072 2.58237 7.6072 2.6273 7.54596C2.67224 7.48472 2.73483 7.4387 2.80668 7.41406L16.9525 2.5747C17.0185 2.55087 17.0899 2.54632 17.1583 2.56159C17.2268 2.57685 17.2895 2.6113 17.3391 2.66089C17.3887 2.71049 17.4231 2.77319 17.4384 2.84165C17.4536 2.9101 17.4491 2.9815 17.4253 3.04746L12.5859 17.1933C12.5613 17.2651 12.5152 17.3277 12.454 17.3727C12.3928 17.4176 12.3192 17.4427 12.2433 17.4447C12.1674 17.4466 12.0927 17.4253 12.0292 17.3835C11.9658 17.3418 11.9166 17.2817 11.8883 17.2112L9.52073 11.3056C9.44567 11.1191 9.33362 10.9498 9.19133 10.8077ZM9.19133 10.8077L17.3367 2.66404",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Aa({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M10.8333 14.1667V7.5M15 14.1667V4.16667M2.5 2.5V15.8333C2.5 16.2754 2.67559 16.6993 2.98816 17.0118C3.30072 17.3244 3.72464 17.5 4.16667 17.5H17.5M6.66667 14.1667V11.6667",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fa({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M6.6665 9.99984H13.3332M9.99984 6.6665V13.3332M18.3332 9.99984C18.3332 14.6022 14.6022 18.3332 9.99984 18.3332C5.39746 18.3332 1.6665 14.6022 1.6665 9.99984C1.6665 5.39746 5.39746 1.6665 9.99984 1.6665C14.6022 1.6665 18.3332 5.39746 18.3332 9.99984Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ba({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M6.667 2.5 3.333 5.833 6.667 9.167M3.333 5.833h13.334M13.333 17.5l3.334-3.333-3.334-3.334M16.667 14.167H3.333",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ma({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),ae("path",{d:"M6 10.2L8.6 12.8L14 7.2",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as U from"react";import In from"bignumber.js";function Td(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return t>0&&e.charCodeAt(t-1)===46&&t--,e.slice(0,t)}function fn(e,t){if(!e||e==="0")return"0.00";let n=new In(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,In.ROUND_DOWN)}function xt(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function ti(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let n=t>=1?2:4,o=Math.pow(10,n);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n})}`}function Da(e,t,n){let r=new In(e).shiftedBy(-t).multipliedBy(new In(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(In.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,In.ROUND_DOWN):r.decimalPlaces(4,In.ROUND_DOWN)).toFormat()}`}function Oa(e){if(e===""||e===null||e===void 0)return{displayValue:"0",isLowerBound:!1};let t=typeof e=="number"?e.toString():e;if(t==="0"||t==="0.0")return{displayValue:"0",isLowerBound:!1};let n=t;if(n.includes("e")||n.includes("E")){let a=Number(n);if(!Number.isFinite(a)||a===0)return{displayValue:"0",isLowerBound:!1};n=Td(a.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let a=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${a}`,isLowerBound:!1}}return r.length<4?{displayValue:`${o}.${r}`,isLowerBound:!1}:r.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${r.slice(0,4)}`,isLowerBound:!1}}import{useMemo as Pd}from"react";import{useQuery as Ld}from"@tanstack/react-query";var ye={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}},jn="https://terms.crosstoken.io/docs/cross-terms-of-use",jo="https://terms.crosstoken.io/docs/nexus-privacy-policy";import*as Vn from"react";var Nd={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher",production:"https://contents.crosstoken.io/frontend/common/app-launcher"},Ed=3e3;function Pn(e,t){if(e!=null)return typeof e=="object"&&!Array.isArray(e)&&("dev"in e||"stage"in e||"production"in e)?e[t]:e}var ni=new Map;function Wa(e,t){let n=`${Nd[t]}/${e}`,o=ni.get(n);return o||(o=(async()=>{let r=new AbortController,i=setTimeout(()=>r.abort(),Ed);try{let a=await fetch(n,{cache:"no-store",signal:r.signal});return a.ok?await a.json():null}catch{return null}finally{clearTimeout(i)}})().then(r=>(r===null&&ni.delete(n),r)),ni.set(n,o)),o}function Id(e){return typeof e=="string"&&e.startsWith("https://")}async function ce(e,t){let n=await Wa("endpoints.json",t),o=Pn(n?.apis?.[e],t);if(!Id(o))throw new Error(`[remote-config] endpoints.json missing or invalid api base: ${e} (${t})`);return o}function Ln(e,t,n){let[o,r]=Vn.useState(void 0),i=Vn.useRef(n);return i.current=n,Vn.useEffect(()=>{let a=!0;return Wa(e,t).then(s=>{if(!a)return;let c=i.current(s);c!==void 0&&r(c)}),()=>{a=!1}},[e,t]),o}var _d="send:chain-info";function Ad(e){if("data"in e&&e.data!==void 0){let t=e.data;if(Array.isArray(t)){let n=t[0];if(!n)throw new Error("Chain info payload is empty.");return n}return t}return e}function oi(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function Fd(e,t,n,o){if(o)return t===ye[e].cross?Ua(t,o):n?.explorer_url?oi(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Bd(e,t,o)}function Ua(e,t){return oi("https://explorer.onechain.nexus",String(e),"tx",t)}function Bd(e,t,n){let o=ye[e];if(t===o.cross)return Ua(t,n);if(t===o.bsc)return oi(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function Vo(e,t,n,o=!0){let r=Ld({queryKey:[_d,e,t],queryFn:async({signal:s})=>{let c=await ce("walletServer",e),l=await fetch(`${c}/v1/public/chain/info/${t}`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Failed to fetch chain info: ${l.status}`);let p=await l.json();if("code"in p&&p.code!==void 0&&p.code!==200)throw new Error(`Chain info API error: ${p.code}`);return Ad(p)},enabled:o,staleTime:3e5}),i=r.data;return{transactionUrl:Pd(()=>Fd(e,t,i,n),[t,i,e,n]),chainInfo:i,...r}}var Ga="0x0000000000000000000000000000000000000001";var Md="0xa9059cbb",Dd=/^0x[a-fA-F0-9]{40}$/,Od="nexus-cross:dapp-ui:send:recent:",za=10;function Wd(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function fo(e){return e.toLowerCase()}function Vt(e){return Dd.test(e)}function mn(e){return fo(e.address)===Ga}function ri(e){return`${Od}${e.toLowerCase()}`}function qn(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(ri(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Vt(o.address)&&typeof o.updatedAt=="number").slice(0,za):[]}catch{return[]}}function ii(e,t){if(typeof window>"u")return[];let n=fo(t),o=[{address:n,updatedAt:Date.now()},...qn(e).filter(r=>r.address!==n)].slice(0,za);try{window.localStorage.setItem(ri(e),JSON.stringify(o))}catch{return qn(e)}return o}function ai(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(ri(e))}catch{}}function _n(e,t){let n=e.trim();if(!n)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(n))return{error:"Enter a valid amount."};let[o="0",r=""]=n.split(".");if(r.length>t)return{error:`Max ${t} decimal places.`};let i=BigInt(o||"0"),a=r.padEnd(t,"0"),s=a?BigInt(a):0n,c=10n**BigInt(t),l=i*c+s;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Kn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let a=Wd(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function si(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Md}${n}${o}`}function qo(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,i=e%o;if(i===0n)return r.toString();let s=i.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(n,t)));return s=s.replace(/0+$/,""),s?`${r.toString()}.${s}`:r.toString()}function li(e,t){return qo(e,t,6)}function $a(e){return qo(e,9,2)}function Ha(e){return e.toLocaleString("en-US")}function Ko(e){return e===56||e===97}function Yo(e){return e.gasPrice??e.maxFeePerGas}function ja(e,t=!1){return t?Yo(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Qo(e,t=!1){if(t){let n=Yo(e);return n!==void 0?e.gasLimit*n:null}return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function Zo(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Va(e,t=0){if(t>4||e===null||e===void 0)return"";if(typeof e=="string")return e.toLowerCase();if(typeof e!="object")return"";let n=e,o=[];return typeof n.name=="string"&&o.push(n.name),typeof n.shortMessage=="string"&&o.push(n.shortMessage),typeof n.message=="string"&&o.push(n.message),typeof n.details=="string"&&o.push(n.details),n.cause!==void 0&&o.push(Va(n.cause,t+1)),o.join(`
6
- `).toLowerCase()}function Ud(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.shortMessage=="string")return t.shortMessage;if(typeof t.message=="string")return t.message}return""}function ci(e,t={},n="Failed to send transaction."){let o=Va(e);if(!o)return n;let r=t.nativeSymbol?.trim()||"gas token",i=t.networkName?.trim();if(o.includes("user rejected")||o.includes("userrejected")||o.includes("user denied")||o.includes("user cancelled")||o.includes("user canceled")||o.includes("action_rejected")||o.includes("rejected by user"))return"Transaction was cancelled.";if(o.includes("insufficientfunds")||o.includes("insufficient funds")||o.includes("exceeds the balance of the account")||o.includes("insufficient balance for transfer")){let a=i?` on ${i}`:"";return`Not enough ${r} to cover the gas fee.Please top up your ${r} balance and try again.`}return o.includes("transaction underpriced")||o.includes("replacement transaction underpriced")||o.includes("fee too low")?"Gas fee was too low for the network. Please try again.":o.includes("nonce too low")||o.includes("nonce has already been used")||o.includes("nonce too high")?"Pending transactions are out of order. Refresh the page and try again.":o.includes("execution reverted")||o.includes("contractfunctionrevertederror")||o.includes("contractfunctionexecutionerror")?"The transaction was rejected by the contract. The recipient or token may be invalid.":o.match(/chain \d+ is not configured/)?"This network is not registered in the app. Contact support.":o.includes("http request failed")||o.includes("failed to fetch")||o.includes("network request failed")||o.includes("timeout")||o.includes("econnreset")||o.includes("rpc error")||o.includes("429")?"Network connection failed. Check your internet and try again.":o.includes("estimategas")||o.includes("gas estimation failed")?"Could not estimate the gas fee. The recipient address or amount may be invalid.":Ud(e)||n}var Gd=2000000000n,zd=1000000000n;async function Xo(e,t,n){let o=new AbortController,r=setTimeout(()=>o.abort(),8e3),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:o.signal}).finally(()=>clearTimeout(r));if(!i.ok)throw new Error(`RPC ${t} HTTP ${i.status}`);let a=await i.json();if(a.error)throw new Error(`RPC ${t}: ${a.error.message}`);if(a.result===void 0)throw new Error(`RPC ${t}: empty result`);return a.result}function Jo(e){return BigInt(e)}function $d(e){return`0x${e.toString(16)}`}function Hd(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=$d(e.value)),e.data&&(t.data=e.data),t}function jd(e){return e===56||e===97}async function qa(e){try{let t=await Xo(e,"eth_gasPrice",[]);return{gasPrice:Jo(t)}}catch{return{gasPrice:Gd}}}async function Vd(e,t){let n=zd;try{let o=await Xo(e,"eth_maxPriorityFeePerGas",[]);n=Jo(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function qd(e,t){if(t)return qa(e);let n;try{n=(await Xo(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Vd(e,Jo(n)):qa(e)}async function Ka(e,t){let n=jd(t.chainId),o=Hd(t),[r,i]=await Promise.all([Xo(e,"eth_estimateGas",[o]),qd(e,n)]);return{gasLimit:Jo(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function Ya(e){let{estimateGas:t,sendTransaction:n,getTransactionReceipt:o}=e;return{canSend:!!n,canEstimateGas(r){return!!t||!!r},async estimateGas(r,i){if(t)return t(r);if(i)return Ka(i,r);throw new Error("Gas estimation is not available.")},async sendTransaction(r){if(!n)throw new Error("Sending is not available for this wallet.");return n(r)},getTransactionReceipt:o}}var Kd=1500,Yd=120;function Qa(e){return!!(e.token||e.recipient||e.amount)}function di({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},i=e.trim(),a=_n(t,n.quantity.decimals),s;return i?Vt(i)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in a?r.amount=a.error:(s=a.value,s>o&&(r.amount="Amount exceeds available balance.")),!mn(n)&&!Vt(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:i&&Vt(i)?i:void 0}}function pi({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return mn(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:fo(e.address),data:si(n,o),value:0n,chainId:e.chainId,from:r}}function Qd(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Zd=e=>new Promise(t=>setTimeout(t,e));async function Za({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=Kd,pollMaxAttempts:i=Yd}){let a=await e.sendTransaction(t);o(a);let{getTransactionReceipt:s}=e;if(!s)return"success";for(let c=0;c<i;c+=1){let l=await s({hash:a,chainId:n}).catch(()=>null);if(l)return Qd(l)?"reverted":"success";await Zd(r)}return"timeout"}var Xa=["token","recipient","amount","review"];function Ja(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:i="recipient",token:a,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:p,estimateGas:h,getTokenPriceUsd:b,onSubmitted:u,onSuccess:v,onFailed:g,onExit:m,onOutlink:x}=e,C=U.useMemo(()=>Ya({sendTransaction:l,getTransactionReceipt:p,estimateGas:h}),[l,p,h]),[d,k]=U.useState(a);U.useEffect(()=>{k(a)},[a.address,a.chainId]);let[S,N]=U.useState(i),[R,E]=U.useState(""),[D,H]=U.useState(""),[W,j]=U.useState({}),[I,te]=U.useState("idle"),[F,A]=U.useState(""),[ne,q]=U.useState(""),[M,de]=U.useState(null),[re,z]=U.useState(!1),[ke,Q]=U.useState(""),fe=U.useRef(0),[we,We]=U.useState(null),[K,be]=U.useState(""),[Be,Me]=U.useState(()=>qn(n)),At=U.useRef(new Set),ge=U.useCallback((P,Z)=>{At.current.has(P)||(At.current.add(P),ve("send",P,Z))},[]);U.useEffect(()=>{ge("opened"),i!=="token"&&ge("token_selected",{tags:{item_id:a.symbol}})},[ge,i,a.symbol]);let Ze=U.useMemo(()=>_e(t),[t]),{transactionUrl:rt,chainInfo:De}=Vo(Ze,d.chainId,F||void 0,!0),Le=De?.currency_symbol??"",Ue=De?.name??`Chain ID ${d.chainId}`,en=U.useRef({nativeSymbol:Le||void 0,networkName:Ue,tokenSymbol:d.symbol});en.current={nativeSymbol:Le||void 0,networkName:Ue,tokenSymbol:d.symbol};let it=U.useMemo(()=>BigInt(d.quantity.numeric||"0"),[d.quantity.numeric]),kt=U.useMemo(()=>fn(d.quantity.numeric,d.quantity.decimals),[d.quantity.numeric,d.quantity.decimals]),He=b?.(d),Ft=U.useMemo(()=>{if(He===void 0)return;let P=parseFloat(D.replace(/,/g,""));return Number.isFinite(P)?P*He:0},[D,He]);U.useEffect(()=>{H(""),j({})},[d.address,d.chainId]),U.useEffect(()=>{fe.current+=1,de(null),Q(""),z(!1)},[d.address,d.chainId,R,D]),U.useEffect(()=>{Me(qn(n))},[n]);let St=U.useCallback(P=>{E(P),j(Z=>({...Z,recipient:void 0}))},[]),Se=U.useCallback(P=>{H(P),j(Z=>({...Z,amount:void 0}))},[]),$t=U.useCallback(()=>{H(kt.replace(/,/g,"")),j(P=>({...P,amount:void 0}))},[kt]),Ht=U.useCallback(P=>{k(P),c?.(P),ge("token_selected",{tags:{item_id:P.symbol}}),N("recipient")},[c,ge]),at=U.useCallback(()=>N("token"),[]),je=U.useCallback(()=>{N(P=>{if(P==="result")return"review";if(P===i)return m?.(),P;let Z=Xa.indexOf(P);return Z<=0?(m?.(),P):Xa[Z-1]})},[i,m]),st=U.useCallback(()=>{let{errors:P}=di({recipient:R,amount:"1",token:d,balanceRaw:it});if(P.recipient){j(Z=>({...Z,recipient:P.recipient}));return}j(Z=>({...Z,recipient:void 0})),ge("recipient_entered"),N("amount")},[R,d,it,ge]),Xe=U.useCallback(P=>{E(P),j(Z=>({...Z,recipient:void 0})),ge("recipient_entered"),N("amount")},[ge]),Ve=U.useCallback(()=>{let P=di({recipient:R,amount:D,token:d,balanceRaw:it});j(P.errors),!(Qa(P.errors)||P.rawAmount===void 0||!P.recipient)&&(We(P.rawAmount),be(P.recipient),de(null),Q(""),te("idle"),ge("amount_entered"),N("review"))},[R,D,d,it,ge]);U.useEffect(()=>{if(S!=="review"||!K||we===null||M!==null||re||ke||!C.canEstimateGas(De?.rpc))return;let P=++fe.current;z(!0),Q(""),(async()=>{try{let Z=pi({token:d,walletAddress:n,recipient:K,rawAmount:we}),se=await C.estimateGas(Z,De?.rpc);if(fe.current!==P)return;de(se)}catch(Z){if(fe.current!==P)return;Q(ci(Z,en.current,"Failed to estimate gas."))}finally{fe.current===P&&z(!1)}})()},[S,K,we,M,re,ke,C,De?.rpc,d,n]);let Re=U.useMemo(()=>{if(!mn(d)||!M||we===null)return!1;let P=Qo(M,Ko(d.chainId));return P===null?!1:we+P>it},[d,M,we,it]),gt=U.useCallback(async()=>{if(!(!K||we===null)&&!Re){q(""),A(""),te("submitting"),ge("submitted");try{let P="",Z=await Za({repository:C,args:pi({token:d,walletAddress:n,recipient:K,rawAmount:we}),chainId:d.chainId,onSubmitted:se=>{P=se,A(se),te("confirming"),Me(ii(n,K)),u?.({txHash:se,chainId:d.chainId,amount:D,tokenSymbol:d.symbol,recipient:K})}});if(Z==="success")te("success"),ge("confirmed"),P&&v?v?.(P):N("result");else if(Z==="reverted"){let se="Transaction reverted on-chain.";te("error"),q(se),ge("confirmed",{status:"failure",reason:bt(new Error(se))}),P&&g?g({txHash:P,chainId:d.chainId,message:se}):N("result")}else{let se="Transaction receipt was not found. Please check again later.";te("error"),q(se),ge("confirmed",{status:"failure",reason:"timeout"}),P&&g?g({txHash:P,chainId:d.chainId,message:se}):N("result")}}catch(P){te("error"),ge("confirmed",{status:"failure",reason:bt(P)}),q(ci(P,{nativeSymbol:Le||void 0,networkName:Ue,tokenSymbol:d.symbol})),N("result")}}},[C,K,we,Re,d,D,n,u,v,g,Le,Ue,ge]),[lt,Je]=U.useState(!1),Rt=U.useRef(void 0);U.useEffect(()=>()=>clearTimeout(Rt.current),[]);let tn=U.useCallback(async()=>{if(F)try{await navigator.clipboard.writeText(F),Je(!0),clearTimeout(Rt.current),Rt.current=setTimeout(()=>Je(!1),2e3)}catch{}},[F]),pn=U.useCallback(()=>{if(!rt||!F)return;let P=ct=>{typeof window<"u"&&window.open(ct,"_blank","noopener,noreferrer")};if(!x){P(rt);return}let Z=x(rt,{category:"send",origin:"send-transaction",payload:{chainId:d.chainId,txHash:F}});if(Z&&typeof Z.then=="function"){let ct=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;Z.then(on=>{if(on===null){ct?.close();return}let ht=on??rt;if(ct)try{ct.location.href=ht}catch{ct.close(),P(ht)}else P(ht)});return}let se=Z;se!==null&&P(se??rt)},[x,d.chainId,rt,F]),nn=U.useCallback(()=>{q(""),A(""),te("idle"),de(null),Q(""),At.current.delete("submitted"),At.current.delete("confirmed"),N("review")},[]);return{step:S,status:I,token:d,tokens:s.length>0?s:[d],recipient:R,amount:D,amountUsd:Ft,fieldErrors:W,error:ne,txHash:F,gasEstimate:M,gasLoading:re,gasError:ke,insufficientGas:Re,reviewRawAmount:we,reviewRecipient:K,recentAddresses:Be,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Ze,transactionUrl:rt,networkName:Ue,nativeSymbol:Le,nativeDecimals:De?.currency_decimals??d.quantity.decimals,balanceRaw:it,balanceText:kt,priceUsd:He,canSelectToken:(s.length>0?s:[d]).length>1,canSend:C.canSend,getTokenPriceUsd:b,setRecipient:St,setAmount:Se,setMax:$t,selectToken:Ht,goToTokenSelect:at,selectRecipient:Xe,submitRecipient:st,submitAmount:Ve,confirmSend:gt,retry:nn,back:je,hashCopied:lt,copyHash:tn,openTransaction:pn}}import*as Ot from"react";import{jsx as mo,jsxs as ui}from"react/jsx-runtime";function es({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:i,token:a,setMax:s}=e,c=Ot.useRef(null),l=Ot.useCallback(()=>{requestAnimationFrame(()=>{let g=c.current;if(!g)return;let m=g.value.length;g.setSelectionRange(m,m)})},[]);Ot.useEffect(()=>{c.current?.focus(),l()},[l]),Ot.useEffect(()=>{t===""&&(b(!1),l())},[t,l]);let p=Ot.useMemo(()=>{let g=_n(t,a.quantity.decimals);return"value"in g&&g.value>i},[t,a.quantity.decimals,i]),[h,b]=Ot.useState(!1),u=!h&&t===""?"0.00":t,v=t.trim()===""||t.trim()==="0";return mo("div",{className:"sf-body sf-amount",children:ui("div",{className:"sf-amount-center",children:[mo("span",{className:"sf-amount-usd",children:o!==void 0?Zo(o):"\xA0"}),mo("div",{className:"sf-amount-input-wrap","data-over":p||void 0,"data-empty":v||void 0,onClick:()=>c.current?.focus(),children:mo("input",{ref:c,className:"sf-amount-input",value:u,onChange:g=>{let m=g.target.value;if(h)n(m);else if(t===""){if(m.length<4)return;b(!0);let x=m.startsWith("0.00")?m.slice(4):m;n(x)}else b(!0),n(m)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${a.symbol}`,size:1})}),ui("div",{className:"sf-amount-balance",children:[mo("span",{children:"Balance:"}),ui("button",{type:"button",className:"sf-amount-max",onClick:s,"data-track":"amount_max",children:[r," ",a.symbol]})]})]})})}import*as Wt from"react";var Jd=new Set(["0xff42c13d927a6b9265236619161accb227b6d452","0x9364ea6790f6e0ecfaa5164085f2a7de34ec55fb"].map(e=>e.toLowerCase()));function ns(e){return Jd.has(e.toLowerCase())}var ts={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function go(e,t){let n=ye[e];if(t===n.cross)return ts.cross;if(t===n.bsc)return ts.bsc}var ep={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function rn(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:i="png"}=n,a=ep[e],s=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${o}${s}`}import{jsx as Tt,jsxs as er}from"react/jsx-runtime";function os({size:e=20,className:t}){return er("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),Tt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function rs({size:e=20,className:t}){return Tt("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:Tt("path",{d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2M12 11v6M9 14h6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function is({size:e=20,className:t}){return er("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),Tt("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function as({size:e=16,className:t}){return Tt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:Tt("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ss({size:e=56,className:t}){return er("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),Tt("path",{d:"M17 28.5 24.2 35.5 39 20.5",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function ls({size:e=56,className:t}){return er("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),Tt("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as Fe,jsxs as qt}from"react/jsx-runtime";function cs(e,t){return e.name||`Account ${(e.index??t)+1}`}function ds(e){return e.trim().slice(0,1).toUpperCase()||"A"}function ps(e){return e.toLowerCase()}function us({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:i,walletAddress:a,resolvedEnv:s,selectRecipient:c}=e,l=Wt.useMemo(()=>i.filter(d=>d.address.toLowerCase()!==a.toLowerCase()),[i,a]),p=l.length>0,h=Wt.useMemo(()=>new Map(l.map((d,k)=>[ps(d.address),{account:d,index:k}])),[l]),[b,u]=Wt.useState("recent"),v=Wt.useRef(null);Wt.useEffect(()=>{v.current?.focus()},[]);let g="1A1A2E",m=Wt.useCallback(async()=>{try{let d=await navigator.clipboard.readText();d&&n(d.trim())}catch{}},[n]),x=t.trim().length>0,C=Vt(t.trim());return qt("div",{className:"sf-recipient",children:[qt("div",{className:"sf-recipient-top",children:[qt("div",{className:"sf-address-field","data-filled":x||void 0,"data-invalid":o.recipient||void 0,children:[Fe("textarea",{ref:v,className:"sf-address-input",value:t,onChange:d=>n(d.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:x?2:1}),x?Fe("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear","data-track":"recipient_clear",children:Fe(is,{size:20})}):Fe("button",{type:"button",className:"sf-address-action",onClick:m,"aria-label":"Paste from clipboard","data-track":"recipient_paste",children:Fe(rs,{size:20})})]}),o.recipient&&Fe("p",{className:"sf-field-error",role:"alert",children:o.recipient}),qt("div",{className:"sf-tabs",role:"tablist",children:[Fe("button",{type:"button",role:"tab",className:"sf-tab","data-active":b==="recent"||void 0,"aria-selected":b==="recent",onClick:()=>u("recent"),"data-track":"recipient_tab","data-track-id":"recent",children:"Recent"}),p&&Fe("button",{type:"button",role:"tab",className:"sf-tab","data-active":b==="account"||void 0,"aria-selected":b==="account",onClick:()=>u("account"),"data-track":"recipient_tab","data-track-id":"account",children:"My Account"})]})]}),Fe("div",{className:"sf-address-list",children:b==="account"&&p?l.map((d,k)=>{let S=cs(d,k),N=rn(s,d.address,{size:56,bg:g});return qt("button",{type:"button",className:"sf-address-row",onClick:()=>c(d.address),"data-track":"recipient_item",children:[qt("span",{className:"sf-address-avatar",children:[N&&Fe("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:R=>{R.currentTarget.style.display="none"}}),Fe("span",{className:"sf-address-avatar-fallback",children:ds(S)})]}),qt("span",{className:"sf-address-meta",children:[Fe("span",{className:"sf-address-name",children:S}),Fe("span",{className:"sf-address-value",children:xt(d.address)})]})]},d.address)}):r.length>0?r.map(d=>{let k=h.get(ps(d.address)),S=k?cs(k.account,k.index):xt(d.address),N=rn(s,d.address,{size:56,bg:g});return qt("button",{type:"button",className:"sf-address-row",onClick:()=>c(d.address),"data-track":"recipient_item",children:[qt("span",{className:"sf-address-avatar",children:[N&&Fe("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:R=>{R.currentTarget.style.display="none"}}),Fe("span",{className:"sf-address-avatar-fallback",children:ds(S)})]}),qt("span",{className:"sf-address-meta",children:[Fe("span",{className:"sf-address-name",children:S}),Fe("span",{className:"sf-address-value",children:xt(d.address)})]})]},d.address)}):Fe("div",{className:"sf-empty",children:"No send history"})}),x&&!C&&!o.recipient&&Fe("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as tt,jsxs as Yn}from"react/jsx-runtime";function ms({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:i,openTransaction:a}=e,s=t==="error",c=t==="success";return s?Yn("div",{className:"sf-body sf-result sf-result--error",children:[tt("span",{className:"sf-result-icon",children:tt(ls,{size:56})}),Yn("div",{className:"sf-result-copy",children:[tt("h3",{className:"sf-result-title",children:"Transaction Failed"}),tt("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&tt(fs,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]}):Yn("div",{className:"sf-body sf-result",children:[tt("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?tt(ss,{size:56}):tt("span",{className:"sf-result-spinner"})}),Yn("div",{className:"sf-result-copy",children:[tt("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),tt("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&tt(fs,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]})}function fs({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return Yn("div",{className:"sf-result-hash-card",children:[tt("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),Yn("div",{className:"sf-result-hash-row",children:[tt("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer","data-track":"tx_link_open",children:xt(e)}),tt("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash","data-track":"tx_hash_copy",children:t?tt(Tn,{size:16}):"Copy"})]})]})}import{jsx as Ce,jsxs as nt}from"react/jsx-runtime";var tr="\u2014";function gs({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:i,walletAddress:a,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:p,gasLoading:h,gasError:b,insufficientGas:u,error:v,resolvedEnv:g}=e,m=mn(t),x=n!==null?qo(n,t.quantity.decimals):"",C=r?.trim()||`Account ${(i[0]?.index??0)+1}`,d=rn(g,a,{size:56,bg:"1A1A2E"}),k=c||(m?t.symbol:""),S=Ko(t.chainId),N=p?ja(p,S):null,R=p?Qo(p,S):null,E=I=>I!==null&&k?`${li(I,l)} ${k}`:tr,D=I=>I!==void 0?`${$a(I)} Gwei`:tr,H=(()=>{if(!m||!p||R===null||n===null)return tr;let I=n+R;return`${li(I,l)} ${k||t.symbol}`})(),W=I=>h?"\u2026":I,j=[{label:"Est. Tx Fee",value:W(E(R))},...N==="dynamic"?[{label:"Max Priority Fee",value:W(D(p?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:W(D(p?.maxFeePerGas))}]:N==="legacy"?[{label:"Gas Price",value:W(D(p?Yo(p):void 0))}]:[],{label:"Gas Limit",value:W(p?Ha(p.gasLimit):tr)}];return nt("div",{className:"sf-body sf-review",children:[nt("div",{className:"sf-review-amount",children:[Ce("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:I=>{I.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),nt("span",{className:"sf-review-amount-value",children:[x,Ce("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),nt("div",{className:"sf-review-parties",children:[nt("div",{className:"sf-review-card sf-review-party",children:[Ce("span",{className:"sf-review-party-label",children:"From"}),nt("div",{className:"sf-review-party-head",children:[Ce("span",{className:"sf-review-party-avatar",children:d&&Ce("img",{src:d,alt:"",width:28,height:28,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}})}),Ce("span",{className:"sf-review-party-name",children:C})]}),Ce("span",{className:"sf-review-party-addr",children:a})]}),Ce("span",{className:"sf-review-arrow","aria-hidden":!0,children:Ce(as,{size:16})}),nt("div",{className:"sf-review-card sf-review-party",children:[Ce("span",{className:"sf-review-party-label",children:"To"}),Ce("span",{className:"sf-review-party-addr",children:o})]})]}),nt("section",{className:"sf-review-card",children:[Ce("h3",{className:"sf-review-section-title",children:"Summary"}),nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Network"}),Ce("span",{className:"sf-review-row-value",children:s})]}),j.map(I=>nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:I.label}),Ce("span",{className:"sf-review-row-value",children:I.value})]},I.label))]}),nt("section",{className:"sf-review-card",children:[Ce("h3",{className:"sf-review-section-title",children:"Total"}),nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Total Amount"}),nt("span",{className:"sf-review-row-value",children:[x," ",t.symbol]})]}),m&&nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),Ce("span",{className:"sf-review-row-value",children:W(H)})]})]}),u&&!b&&!v&&nt("div",{className:"sf-message sf-message--error",role:"alert",children:["Not enough ",k||t.symbol," to cover the amount plus the network fee. Reduce the amount and try again."]}),(b||v)&&Ce("div",{className:"sf-message sf-message--error",role:"alert",children:b||v})]})}import*as nr from"react";import{jsx as gn,jsxs as An}from"react/jsx-runtime";function hs({flow:e}){let[t,n]=nr.useState(""),o=t.trim().toLowerCase(),r=nr.useMemo(()=>o?e.tokens.filter(i=>i.symbol.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return An("div",{className:"sf-body sf-token-select",children:[An("div",{className:"sf-search",children:[gn(os,{size:20}),gn("input",{className:"sf-search-input",value:t,onChange:i=>n(i.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),An("div",{className:"sf-token-list",children:[r.map(i=>{let a=`${i.chainId}:${i.address.toLowerCase()}`,s=go(e.resolvedEnv,i.chainId),c=e.getTokenPriceUsd?.(i);return An("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(i),"data-track":"token_item","data-track-id":i.symbol,children:[An("span",{className:"sf-token-left",children:[An("span",{className:"sf-token-icon-wrap",children:[gn("img",{className:"sf-token-icon",src:i.icon_url,alt:"",width:40,height:40,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),s&&gn("img",{className:"sf-token-chain-badge",src:s,alt:"","aria-hidden":!0,width:16,height:16,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.style.display="none"}})]}),gn("span",{className:"sf-token-name",children:i.symbol})]}),An("span",{className:"sf-token-right",children:[gn("span",{className:"sf-token-balance",children:fn(i.quantity.numeric,i.quantity.decimals)}),c!==void 0&&gn("span",{className:"sf-token-price",children:Zo(c)})]})]},a)}),r.length===0&&gn("div",{className:"sf-empty",children:"No tokens found"})]})]})}Y(`.sf-root{display:flex;flex-direction:column;flex:1;min-height:0;font-family:inherit}.sf-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px;flex-shrink:0;position:relative;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.sf-header .sf-header-btn:last-child{position:absolute;top:24px;right:24px}.sf-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;filter:none;transition:color .15s ease}.sf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85));filter:none}.sf-header-title{position:absolute;left:50%;transform:translate(-50%);text-align:center;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);pointer-events:none}.sf-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .sf-body{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-body::-webkit-scrollbar{width:4px;height:4px}.sf-body::-webkit-scrollbar-track,.sf-body::-webkit-scrollbar-corner{background:transparent}.sf-body::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}.sf-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .sf-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .sf-body::-webkit-scrollbar-thumb:hover{background:#0003}.sf-empty{padding:32px 0;text-align:center;font-family:inherit;font-size:14px;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-field-error{margin:8px 24px 0;font-family:inherit;font-size:12px;line-height:1.5;color:var(--ds-system-red-default, #da0b2e)}.sf-message--error{margin:16px 0 0;padding:12px 16px;background:var(--ds-system-red-low, #ffeeee);color:var(--ds-system-red-high, #d20609);font-family:inherit;font-size:13px;line-height:1.5;border-radius:12px;width:100%;box-sizing:border-box}.sf-footer{display:flex;flex-shrink:0;padding:16px 24px 24px}.sf-footer:empty{display:none}.sf-footer-row{display:flex;gap:8px;width:100%}.sf-footer-row .sf-btn,.sf-footer-row .sf-btn--secondary{flex:1 1 0;min-width:0}.sf-footer>.sf-btn{width:100%}.sf-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:1;height:48px;padding:0 24px;border:none;border-radius:12px;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:background-color .15s ease,transform .1s ease}.sf-btn--primary{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff)}.sf-btn--primary:hover:not(:disabled):not([data-disabled]){background:var(--ds-accent-primary-high, #00a0a2)}.sf-btn--primary:active:not(:disabled):not([data-disabled]){transform:scale(.97)}.sf-btn--primary[data-disabled],.sf-btn--primary:disabled{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff);cursor:default;opacity:.5}.sf-btn--secondary{flex:0 0 120px;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-token-select{padding:0;display:flex;flex-direction:column}.sf-token-select .sf-search{margin:16px 24px}.sf-token-select .sf-token-list{width:100%;margin-top:0}.sf-search{display:flex;align-items:center;gap:8px;padding:12px 16px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-low, rgba(0, 0, 0, .4));box-sizing:border-box;transition:border-color .15s ease}.sf-search:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-search:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-search-input{flex:1;min-width:0;border:none;background:transparent;outline:none;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))}.sf-search-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-token-list{display:flex;flex-direction:column;margin-top:8px}.sf-token-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-token-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-token-left{display:flex;align-items:center;gap:16px;min-width:0}.sf-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.sf-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain}.sf-token-chain-badge{position:absolute;right:-2px;bottom:-2px;width:16px;height:16px;border-radius:50%;object-fit:cover}.sf-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}.sf-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.sf-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}.sf-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}.sf-recipient{display:flex;flex-direction:column;flex:1;min-height:0}.sf-recipient-top{display:flex;flex-direction:column;flex-shrink:0;padding:16px 24px 0}.sf-address-field{display:flex;align-items:center;gap:8px;padding:12px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);transition:border-color .15s ease;box-sizing:border-box}.sf-address-field:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-address-field:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-filled]{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-invalid]{border-color:var(--ds-system-red-default, #da0b2e)}.sf-address-input{flex:1;min-width:0;border:none;background:transparent;outline:none;resize:none;overflow:hidden;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));word-break:break-word;overflow-wrap:anywhere}.sf-address-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-address-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;border-radius:6px;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.sf-address-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-address-field[data-filled] .sf-address-action{border-radius:9999px}.sf-tabs{display:flex;gap:0;margin:16px 0 0}.sf-tab{position:relative;padding:8px 12px;border:none;background:transparent;cursor:pointer;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-tab[data-active]{color:var(--ds-accent-primary-high, #00a0a2)}.sf-tab[data-active]:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;border-radius:9999px;background:var(--ds-accent-primary-high, #00a0a2)}.sf-address-list{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;margin-top:8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent}[data-theme=light] .sf-address-list{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-address-list::-webkit-scrollbar{width:4px}.sf-address-list::-webkit-scrollbar-track{background:transparent}.sf-address-list::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}[data-theme=light] .sf-address-list::-webkit-scrollbar-thumb{background:#0000001f}.sf-address-row{display:flex;align-items:center;gap:16px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-address-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-address-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;flex-shrink:0;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:600}.sf-address-avatar img{position:absolute;inset:0;z-index:1;width:100%;height:100%;object-fit:cover}.sf-address-avatar-fallback{position:relative;z-index:0}.sf-address-meta{display:flex;flex-direction:column;min-width:0}.sf-address-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}.sf-address-value{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-drawer-content .sf-header{padding:16px}.wi-drawer-content .sf-header .sf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .sf-token-select{padding:0}.wi-drawer-content .sf-token-select .sf-search{margin:16px}.wi-drawer-content .sf-token-row{padding:12px 16px}.wi-drawer-content .sf-recipient-top{padding:16px 16px 0}.wi-drawer-content .sf-address-row{padding:12px 16px}.wi-drawer-content .sf-footer{padding:12px 16px 24px}.wi-drawer-content .sf-field-error,.wi-drawer-content .sf-message--error{margin:16px 0 0;width:auto}.sf-amount{display:flex;flex-direction:column}.sf-amount-center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;padding:64px 24px 48px;text-align:center}.sf-amount-usd{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));min-height:21px}.sf-amount-input-wrap{display:flex;justify-content:center;max-width:100%}.sf-amount-input{width:auto;max-width:100%;border:none;background:transparent;outline:none;text-align:center;font-family:inherit;font-size:40px;font-weight:700;line-height:1.25;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);field-sizing:content}.sf-amount-input-wrap[data-empty] .sf-amount-input,.sf-amount-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-input-wrap[data-over] .sf-amount-input{color:var(--ds-system-red-default, #da0b2e)}.sf-amount-balance{display:inline-flex;align-items:center;gap:4px;font-family:inherit;font-size:14px;font-weight:400;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-max{border:none;background:transparent;padding:0;cursor:pointer;font:inherit;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.sf-amount-max:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-drawer-content .sf-amount-center{padding:64px 16px 48px}.sf-review{display:flex;flex-direction:column;gap:16px;padding:24px}.sf-review-amount{display:flex;align-items:center;gap:12px;padding:0;background:transparent}.sf-review-amount-icon{width:40px;height:40px;border-radius:0;object-fit:contain;flex-shrink:0}.sf-review-amount-value{display:inline-flex;flex-direction:column;align-items:flex-start;gap:0;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);word-break:break-all}.sf-review-amount-symbol{font-size:12px;font-weight:400;line-height:1.5;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-parties{position:relative;display:flex;flex-direction:column;gap:0}.sf-review-arrow{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-4px auto;border-radius:50%;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-card{display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa)}.sf-review-party-label{font-family:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-party-head{display:flex;align-items:center;gap:8px}.sf-review-party-avatar{display:inline-flex;width:24px;height:24px;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);flex-shrink:0}.sf-review-party-avatar img{width:100%;height:100%;object-fit:cover}.sf-review-party-name{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-review-party-addr{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));word-break:break-all}.sf-review-section-title{margin:0 0 4px;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-review-row{display:flex;flex-direction:column;align-items:flex-start;gap:4px}.sf-review-row-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-row-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));text-align:left;word-break:break-all}.wi-drawer-content .sf-review{padding:16px}.sf-result{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:48px 24px;text-align:center}.sf-result-icon{display:inline-flex;align-items:center;justify-content:center;width:56px;height:56px}.sf-result-spinner{width:56px;height:56px;border-radius:50%;border:4px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-top-color:var(--ds-accent-primary-default, #00b4b7);animation:sf-spin .8s linear infinite}@keyframes sf-spin{to{transform:rotate(360deg)}}.sf-result-copy{display:flex;flex-direction:column;gap:8px}.sf-result-title{margin:0;font-family:inherit;font-size:18px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-result-desc{margin:0;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))}.sf-result-hash-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);text-align:left}.sf-result-hash-label{font-family:inherit;font-size:12px;font-weight:500;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.sf-result-hash-link{border:none;background:transparent;padding:0;cursor:pointer;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;color:var(--ds-accent-primary-high, #00a0a2)}.sf-result-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:28px;padding:0 10px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));border-radius:8px;background:var(--ds-surface-default, #ffffff);cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;color:var(--ds-content-high, rgba(0, 0, 0, .85))}
7
- `);import{jsx as Oe,jsxs as or}from"react/jsx-runtime";var tp={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function rr({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...i}){let a=bs.useCallback(x=>{o?.(x),n?.(x)},[n,o]),c=Ja({...i,onSuccess:o||n?a:void 0,onExit:t}),{step:l,status:p}=c,h=Vt(c.recipient.trim()),b=_n(c.amount,c.token.quantity.decimals),u="value"in b&&b.value<=c.balanceRaw,v=p==="submitting"||p==="confirming",g=l!=="result",m=tp[l]??"";return Oe(he,{feature:"send",children:or("div",{className:me("sf-root",r),"data-step":l,children:[or("header",{className:"sf-header",children:[g?Oe("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back","data-track":"back",children:Oe(Nn,{size:24})}):Oe("span",{className:"sf-header-btn","aria-hidden":!0}),Oe("span",{className:"sf-header-title",children:m}),Oe("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close","data-track":"close",children:Oe(jt,{size:24})})]}),l==="token"&&Oe(hs,{flow:c}),l==="recipient"&&Oe(us,{flow:c}),l==="amount"&&Oe(es,{flow:c}),l==="review"&&Oe(gs,{flow:c}),l==="result"&&Oe(ms,{flow:c}),or("footer",{className:"sf-footer","data-step":l,children:[l==="recipient"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitRecipient,"data-disabled":!h||void 0,"aria-disabled":!h,"data-track":"recipient_next",children:"Next"}),l==="amount"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!u||void 0,"aria-disabled":!u,"data-track":"amount_next",children:"Next"}),l==="review"&&or("div",{className:"sf-footer-row",children:[Oe("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:v,"data-track":"review_cancel",children:"Cancel"}),Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:v||!c.canSend||c.insufficientGas,"data-track":"review_send",children:v?"Sending...":"Send"})]}),l==="result"&&p==="success"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(c.txHash||void 0),"data-track":"result_ok",children:"All done"}),l==="result"&&p==="error"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,"data-track":"result_retry",children:"Try Again"})]})]})})}import*as ws from"@radix-ui/react-popover";import{Drawer as np}from"vaul";import{jsx as ir,jsxs as op}from"react/jsx-runtime";function xs({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:i}=un(),a=n!=null,s=e??!0,c=a?n:op("button",{type:"button",className:me("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[ir(Na,{size:o?14:16}),ir("span",{className:"wi-trigger-address",children:xt(i)})]});return o?ir(np.Trigger,{asChild:s,children:c}):ir(ws.Trigger,{asChild:s,children:c})}import*as $ from"react";import*as Nr from"@radix-ui/react-popover";import{Drawer as Tr}from"vaul";import ko from"bignumber.js";import{useQueries as rp}from"@tanstack/react-query";import{useMemo as ip}from"react";var fi="user-balance";async function ap(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),i=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!i.ok)throw new Error(`Failed to fetch token balance: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Token balance API error: ${a.code}`);return a.data}function hn(e,t,n=!0){let o=ye[e],r=[o.cross,o.bsc],i=rp({queries:r.map(l=>({queryKey:[fi,e,t,l],queryFn:async({signal:p})=>ap(await ce("walletServer",e),l,t,p),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),a=i.some(l=>l.isLoading),s=i.some(l=>l.isError);return{tokens:ip(()=>{let l=[];for(let p of i)p.data&&l.push(...p.data);return l},[i]),isLoading:a,isError:s}}import{useQuery as sp,useQueries as lp}from"@tanstack/react-query";import{useMemo as cp}from"react";var dp="forge-holdings",pp="forge-token-image";async function up(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 fp(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 vs(e,t,n=!0){let{data:o,...r}=sp({queryKey:[dp,e,t],queryFn:async({signal:i})=>up(await ce("bondingCurve",e),t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:o??[],...r}}function ys(e,t,n=!0){let o=lp({queries:t.map(i=>({queryKey:[pp,e,i],queryFn:async({signal:a})=>fp(await ce("bondingCurve",e),i,a),enabled:n,staleTime:1/0}))});return{imageMap:cp(()=>{let i=new Map;for(let a of o)a.data&&i.set(a.data.address,a.data.image_url);return i},[o])}}import{useQuery as mp}from"@tanstack/react-query";import{useMemo as gp}from"react";var mi="token-stats";function Ut(e,t){return`${e}:${t.toLowerCase()}`}function bn(e,t=!0){let{data:n,...o}=mp({queryKey:[mi,e],queryFn:async({signal:i})=>{let a=await ce("walletServer",e),s=await fetch(`${a}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token stats: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token stats API error: ${c.code}`);return c},enabled:t,staleTime:3e4});return{statsMap:gp(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=Ut(a.chain_id,a.address);i.set(s,a)}return i},[n]),...o}}import{useQuery as hp}from"@tanstack/react-query";var bp="crossd-apr",wp="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function ks(){let{data:e,...t}=hp({queryKey:[bp],queryFn:async({signal:n})=>{let o=await fetch(wp,{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 i=parseFloat(r.data.est_last_epoch_apy);if(!Number.isFinite(i))throw new Error("CROSSD overview returned a non-numeric APR");return i*100},staleTime:6e4});return{aprPercent:e??null,...t}}import{useQuery as xp}from"@tanstack/react-query";import{useMemo as vp}from"react";var yp="token-info";function gi(e,t){return`${t.toLowerCase()}_${e}`}function Ss(e,t=!0){let{data:n,...o}=xp({queryKey:[yp,e],queryFn:async({signal:i})=>{let a=await ce("walletServer",e),s=await fetch(`${a}/v1/public/token/info`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Token info API error: ${c.code}`);return c},enabled:t,staleTime:1/0});return{categoryMap:vp(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=gi(a.chain_id,a.address);i.set(s,a.category)}return i},[n]),...o}}import{useMemo as kp}from"react";import hi from"bignumber.js";function Rs(e,t,n){let{tokens:o,isLoading:r}=hn(e,t,n),{statsMap:i}=bn(e,n);return kp(()=>{let a=new hi(0);for(let p of o){let h=i.get(Ut(p.chainId,p.address));if(!h)continue;let u=new hi(p.quantity.numeric).shiftedBy(-p.quantity.decimals).multipliedBy(new hi(h.price));u.isNaN()||(a=a.plus(u))}let s=a.toFixed(),{displayValue:c,isLowerBound:l}=Oa(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,i,r])}import{QRCodeSVG as pm}from"qrcode.react";function Ge(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(l){console.error("[dapp-ui] onOutlink threw:",l);return}let i=l=>{typeof window>"u"||window.open(l,"_blank","noopener,noreferrer")};if((l=>!!l&&(typeof l=="object"||typeof l=="function")&&typeof l.then=="function")(r)){let l=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,p=h=>{if(h===null){l?.close();return}let b=h??t;if(l)try{l.location.href=b}catch{l.close(),i(b)}else i(b)};r.then(p,h=>{console.error("[dapp-ui] onOutlink rejected:",h),l?.close()});return}let s=r;if(s===null)return;i(s??t)}import*as Mn from"react";import{Drawer as xf}from"vaul";import{createContext as Cp,useContext as Tp,useMemo as Np}from"react";import Nt from"bignumber.js";var Sp=/^(\d{4}-\d{2}-\d{2})/;function Cs(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:i}of e.map(a=>({key:Sp.exec(a.reference_date)?.[1],cumulative:a.cumulative_earned})).filter(a=>!!a.key&&a.cumulative!=null).sort((a,s)=>a.key<s.key?-1:a.key>s.key?1:0))t.set(r,i),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function ar(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function sr(e){return e.length<=13?e:`${e.slice(0,6)}...${e.slice(-4)}`}function ho(e,t){let n=e.length+t.length;if(n>26)return"xs";if(n>18)return"sm"}function bi(e){return e?.toUpperCase()==="WCROSS"?"CROSS":e}var Rp="0xe00e8bf3";function Ts(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`${Rp}${o}${r}`}function Qn(e){return!e||e<=0n?"0":new Nt(e.toString()).shiftedBy(-9).toFormat(2,Nt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function lr(e){return!e||e<=0n?"0":new Nt(e.toString()).toFormat(0,Nt.ROUND_DOWN)}function cr(e){if(!e||e<=0n)return"0";let t=new Nt(e.toString()).shiftedBy(-18),n=t.isLessThan(1e-4)?7:4;return t.toFormat(n,Nt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function Kt(e,t){let n=new Nt(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,Nt.ROUND_DOWN):n.toFormat(4,Nt.ROUND_DOWN)}function wi(e){return Kt(e,0)}var bo={rate:1,symbol:"$"};function Fn(e,t=bo){let n=Number.isFinite(t.rate)&&t.rate>0?t.rate:1;return`${t.symbol||"$"}${e.times(n).toFormat(2,Nt.ROUND_DOWN)}`}function wn(e,t,n,o=bo){let r=new Nt(n||"0");if(!r.isFinite()||r.isLessThanOrEqualTo(0))return null;let i=new Nt(e||"0").shiftedBy(-t).times(r);return i.isFinite()?Fn(i,o):null}var wo=Cp(null);function Te(){let e=Tp(wo);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}function Et(){let{conversionRatio:e,currencySymbol:t}=Te();return Np(()=>({rate:typeof e=="number"&&e>0?e:bo.rate,symbol:t||bo.symbol}),[e,t])}import{Drawer as Ep}from"vaul";import{jsx as Ns}from"react/jsx-runtime";function Es({asChild:e,children:t}){let{walletAddress:n}=Te(),o=t!=null,r=e??!0,i=o?t:Ns("button",{type:"button",children:xt(n)});return Ns(Ep.Trigger,{asChild:r,children:i})}import{Drawer as vr}from"vaul";import*as Ee from"react";import{useQueryClient as hf}from"@tanstack/react-query";import{createContext as Ip,useContext as Pp}from"react";var xi=Ip(null);function Is(){return Pp(xi)}import{jsx as vt,jsxs as fr}from"react/jsx-runtime";function Ps({size:e=22,className:t}){return vt("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:vt("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ls({size:e=22,className:t}){return fr("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),vt("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 dr({size:e=16,className:t}){return fr("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("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"}),vt("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 pr({size:e=16,className:t}){return vt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:vt("path",{d:"M13.333 4L6 11.333 2.667 8",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function ur({size:e=48,className:t}){return fr("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("circle",{cx:"24",cy:"24",r:"24",fill:"currentColor"}),vt("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 yt({size:e=12,className:t}){return fr("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:[vt("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"}),vt("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),vt("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import{useQuery as Lp}from"@tanstack/react-query";import{useMemo as _s}from"react";var _p="wp:reward-pools";function Zn(e,t=!0){let{data:n,...o}=Lp({queryKey:[_p,e],queryFn:async({signal:a})=>{let s=await ce("gameReward",e),c=await fetch(`${s}/v1/pools`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Failed to fetch pools: ${c.status}`);let l=await c.json();if(l.code!==200)throw new Error(`Pools API error: ${l.code}`);return l},enabled:t,staleTime:0}),r=_s(()=>n?.data.pools.filter(a=>a.pool_type==="CrossPool")??[],[n]),i=_s(()=>n?.data.pools.filter(a=>a.pool_type==="GamePool")??[],[n]);return{crossPools:r,gamePools:i,allPools:n?.data.pools??[],...o}}import{useQuery as Ap}from"@tanstack/react-query";import{useMemo as Fp}from"react";var Bp="wp:user-deposits";function mr(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Ap({queryKey:[Bp,e,t],queryFn:async({signal:s})=>{let c=await ce("gameReward",e),l=await fetch(`${c}/v1/users/${t}/deposits`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Deposits fetch failed: ${l.status}`);let p=await l.json();if(p.code!==200)throw new Error(`Deposits API error: ${p.code}`);return p},enabled:o,staleTime:0});return{depositMap:Fp(()=>{let s=new Map;if(!r?.data.user_deposits)return s;for(let c of r.data.user_deposits)s.set(c.pool_address.toLowerCase(),c);return s},[r]),deposits:r?.data.user_deposits??[],...i}}import{useQuery as Mp}from"@tanstack/react-query";import{useMemo as Dp}from"react";var As={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Fs={dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://www.onechain.nexus/points"};var Bs={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"};var vi={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},Ms={dev:`${vi.dev}/portfolio`,stage:`${vi.stage}/portfolio`,production:`${vi.production}/portfolio`};var Ds={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},It={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"},gr={dev:"https://stg-swap-api.crossdefi.io",stage:"https://stg-swap-api.crossdefi.io",production:"https://swap-api.crossdefi.io"},Os={dev:"https://stg.crossdefi.io",stage:"https://stg.crossdefi.io",production:"https://www.crossdefi.io"},Ws={dev:"0x1Fa8C0bc5B754E82d55D60f0d6151903FD995b1B",stage:"0x1Fa8C0bc5B754E82d55D60f0d6151903FD995b1B",production:"0xEFd871aF7D695A0c1709e46b565761F4cd1Ef5ba"},Us={dev:"0xda37a3B60E6b97E8CB44b460130d40331efc566b",stage:"0xda37a3B60E6b97E8CB44b460130d40331efc566b",production:"0x731a104a4461ae45bfef520468b43c262d35e682"};var Op="wp:token-info";function Xn(e,t=!0){let n=ye[e].cross,{data:o,...r}=Mp({queryKey:[Op,e],queryFn:async({signal:l})=>{let p=await ce("walletServer",e),h=await fetch(`${p}/v1/public/token/info`,{cache:"no-store",signal:l});if(!h.ok)throw new Error(`Failed to fetch token info: ${h.status}`);let b=await h.json();if(b.code!==200)throw new Error(`Token info API error: ${b.code}`);return b},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:a}=Dp(()=>{let l=new Map,p=new Map;if(!o?.data)return{byChainAddr:l,byChainSym:p};for(let h of o.data){let b=h.address.toLowerCase();l.set(`${h.chain_id}:${b}`,h),l.set(b,h);let u=h.symbol.replace(/^t/,"").toUpperCase(),v=`${h.chain_id}:${u}`;p.has(v)||p.set(v,h),p.has(u)||p.set(u,h)}return{byChainAddr:l,byChainSym:p}},[o]);return{getTokenImage:(l,p,h)=>{let b=l.toLowerCase(),u=!!h?.chainOnly,v=i.get(`${n}:${b}`);if(v?.image)return v.image;if(!u){let g=i.get(b);if(g?.image)return g.image}if(p){let g=p.replace(/^t/,"").toUpperCase(),m=a.get(`${n}:${g}`);if(m?.image)return m.image;if(!u){let x=a.get(g);if(x?.image)return x.image}}return""},getTokenSymbol:(l,p,h)=>{let b=l.toLowerCase();return(i.get(`${n}:${b}`)??(h?.chainOnly?void 0:i.get(b)))?.symbol||p},...r}}import*as ki from"react";import{jsx as yi,jsxs as Gs}from"react/jsx-runtime";function Pt({sectionKey:e,title:t,icon:n,iconFit:o="cover",isEmpty:r,loading:i=!1,children:a}){let s=Is();return ki.useEffect(()=>{s?.report(e,{loading:i,empty:r})},[s,e,i,r]),ki.useEffect(()=>()=>s?.unregister(e),[s,e]),r?null:Gs("div",{className:"wp-svc-card",children:[Gs("div",{className:"wp-svc-card-head",children:[yi("img",{className:"wp-svc-card-icon",src:n,alt:"",style:{objectFit:o}}),yi("span",{className:"wp-svc-card-title",children:t})]}),yi("div",{className:"wp-svc-items",children:a})]})}import Si from"bignumber.js";import{jsx as Ke,jsxs as ot}from"react/jsx-runtime";var Wp="CROSS Rewards";function Up(e){return new Si(e||"0").isGreaterThan(0)}function zs(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{allPools:i,isLoading:a}=Zn(e,r),{depositMap:s,isLoading:c}=mr(e,t,r),{getTokenImage:l}=Xn(e,r),p=(u,v)=>`${As[e]}/rewards/${u.pool_address}?action=${v}`,h=`${It[e]}/reward.png`,b=i.filter(u=>{let v=s.get(u.pool_address.toLowerCase()),g=v?.deposited_amount??"0",m=v?.claimable_reward??"0";return!(new Si(g).isZero()&&new Si(m).isZero())});return Ke(Pt,{sectionKey:"rewards",title:Wp,icon:h,isEmpty:b.length===0,loading:a||c,children:b.map(u=>{let v=s.get(u.pool_address.toLowerCase()),g=v?.deposited_amount??"0",m=v?.claimable_reward??"0",x=p(u,"withdraw"),C=p(u,"claim"),d=l(u.deposit_token.address,u.deposit_token.symbol),k=u.reward_tokens[0],S=k?l(k.address,k.symbol):"",N=u.reward_tokens.map(I=>I.symbol),R=N.length>0?`${u.deposit_token.symbol}-${N.join("/")}`:u.deposit_token.symbol,E=k?Kt(m,k.decimals):"0",D=k?.symbol??"Reward",H=wn(g,u.deposit_token.decimals,u.deposit_token.price,o),W=k?wn(m,k.decimals,k.price,o):null,j=!!v&&Up(m);return ot("article",{className:"wp-item","data-side":"reward",children:[ot("div",{className:"wp-item-body",children:[ot("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),ot("div",{className:"wp-svc-token",children:[ot("span",{className:"wp-token-stack","aria-hidden":!0,children:[d&&Ke("img",{className:"wp-svc-token-icon",src:d,alt:""}),S&&Ke("img",{className:"wp-svc-token-icon",src:S,alt:""})]}),Ke("span",{children:R})]})]}),ot("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Deposited"}),ot("div",{className:"wp-svc-token wp-svc-token--amount",children:[d&&Ke("img",{className:"wp-svc-token-icon",src:d,alt:""}),ot("div",{className:"wp-svc-amount",children:[Ke("span",{className:"wp-svc-amount-main",children:Kt(g,u.deposit_token.decimals)}),H&&Ke("span",{className:"wp-item-usd",children:H})]})]})]}),ot("div",{className:"wp-item-line",children:[ot("span",{className:"wp-item-label",children:["Claimable (",D,")"]}),ot("div",{className:"wp-svc-token wp-svc-token--amount",children:[S&&Ke("img",{className:"wp-svc-token-icon",src:S,alt:""}),ot("div",{className:"wp-svc-amount",children:[Ke("span",{className:"wp-svc-amount-main",children:E}),W&&Ke("span",{className:"wp-item-usd",children:W})]})]})]})]}),ot("div",{className:"wp-item-tags",children:[ot("a",{className:"wp-tag wp-tag--muted",href:x,target:"_blank",rel:"noopener noreferrer","data-track":"rewards_withdraw_open",onClick:I=>Ge(I,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:v}},n),children:[Ke("span",{className:"wp-tag-label",children:"Withdraw"}),Ke(yt,{size:12,className:"wp-tag-icon"})]}),ot("a",{className:"wp-tag wp-tag--mint","data-disabled":!j||void 0,"aria-disabled":!j||void 0,href:j?C:void 0,target:j?"_blank":void 0,rel:j?"noopener noreferrer":void 0,onClick:I=>{if(!j){I.preventDefault();return}Ge(I,C,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:v}},n)},children:[Ke("span",{className:"wp-tag-label",children:"Claim"}),Ke(yt,{size:12,className:"wp-tag-icon"})]})]})]},u.pool_address)})})}import*as Qs from"react";import{useQuery as Kp}from"@tanstack/react-query";import{useMemo as hr}from"react";var Gp="0x70a08231",zp="0x18160ddd",$p="0x313ce567",Hp=8e3;async function jp(e,t,n,o){let r=new AbortController,i=setTimeout(()=>r.abort(),Hp);o&&o.addEventListener("abort",()=>r.abort(),{once:!0});let a=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(i));if(!a.ok)throw new Error(`RPC ${t} HTTP ${a.status}`);let s=await a.json();if(s.error)throw new Error(`RPC ${t}: ${s.error.message}`);if(s.result===void 0)throw new Error(`RPC ${t}: empty result`);return s.result}function Vp(e){return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function xo(e){if(!(!e||e==="0x"))try{return BigInt(e)}catch{return}}async function an(e,t,n,o,r){try{return await jp(e,"eth_call",[r?{from:r,to:t,data:n}:{to:t,data:n},"latest"],o)}catch{return}}async function qp(e,t,n,o){let[r,i,a]=await Promise.all([an(e,n,Gp+Vp(t),o),an(e,n,zp,o),an(e,n,$p,o)]),s=xo(r);if(s===void 0)return null;let c=xo(a);return{balance:s,totalSupply:xo(i),decimals:c!==void 0?Number(c):void 0}}async function vo(e,t){let n=ye[e].cross,o=await ce("walletServer",e),r=await fetch(`${o}/v1/public/chain/info/${n}`,{cache:"no-store",signal:t});if(!r.ok)return;let i=await r.json();return("data"in i&&i.data!==void 0?Array.isArray(i.data)?i.data[0]:i.data:i)?.rpc||void 0}async function $s(e,t,n,o){if(!t||n.length===0)return{};let r;try{r=await vo(e,o)}catch{r=void 0}if(!r)return{};let i=await Promise.all(n.map(async s=>[s.toLowerCase(),await qp(r,t,s,o)])),a={};for(let[s,c]of i)c&&(a[s]=c);return a}var Yp="wp:withdraw-token-meta",Qp="0xc89039c5",Zp="0x95d89b41",Xp="0x313ce567";function Jp(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 i=0;i<o.length;i+=2)r+=String.fromCharCode(parseInt(o.slice(i,i+2),16));return r||void 0}catch{return}}function eu(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 tu(e,t,n){if(t.length===0)return{};let o;try{o=await vo(e,n)}catch{o=void 0}if(!o)return{};let r=await Promise.all(t.map(async a=>{let s=eu(await an(o,a,Qp,n));if(!s)return[a.toLowerCase(),null];let[c,l]=await Promise.all([an(o,s,Zp,n),an(o,s,Xp,n)]),p=Jp(c),h=xo(l);return p?[a.toLowerCase(),{tokenAddress:s,symbol:p,decimals:h!==void 0?Number(h):18}]:[a.toLowerCase(),null]})),i={};for(let[a,s]of r)s&&(i[a]=s);return i}function Hs(e,t,n=!0){let r=n&&!!t,{allPools:i,isLoading:a}=Zn(e,r),{deposits:s,isLoading:c}=mr(e,t,r),l=hr(()=>{let m=new Map;for(let x of i)m.set(x.pool_address.toLowerCase(),x);return m},[i]),p=hr(()=>s.filter(m=>{try{return BigInt(m.deposited_amount||"0")>0n}catch{return!1}}),[s]),h=hr(()=>p.map(m=>m.pool_address.toLowerCase()).filter(m=>!l.has(m)).sort(),[p,l]),{data:b,isLoading:u}=Kp({queryKey:[Yp,e,h],queryFn:({signal:m})=>tu(e,h,m),enabled:r&&h.length>0,staleTime:1440*60*1e3});return{positions:hr(()=>{let m=[];for(let x of p){let C=x.pool_address.toLowerCase(),d=l.get(C);if(d){m.push({poolId:x.pool_id,poolAddress:x.pool_address,poolType:d.pool_type,tokenSymbol:d.deposit_token.symbol,tokenAddress:d.deposit_token.address,decimals:d.deposit_token.decimals,price:d.deposit_token.price,depositedRaw:x.deposited_amount});continue}let k=b?.[C];k&&m.push({poolId:x.pool_id,poolAddress:x.pool_address,poolType:"Unknown",tokenSymbol:k.symbol,tokenAddress:k.tokenAddress,decimals:k.decimals,depositedRaw:x.deposited_amount})}return m},[p,l,b]),isLoading:a||c||u}}import*as ze from"react";import{Fragment as js,jsx as ee,jsxs as Pe}from"react/jsx-runtime";var nu=400;function ou(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":`${cr(e.gasLimit*n)} CROSS`}function Ri(e,t,n){return n==="loading"?"Estimating...":n==="error"||n==="unavailable"?"-":`${e} ${t}`.trim()}function ru({position:e,size:t}){return e.icon?ee("img",{src:e.icon,alt:"",width:t,height:t}):ee("span",{children:e.tokenSymbol.slice(0,1)})}function Vs({open:e,status:t,positions:n,initialPoolAddress:o,walletAddress:r,txHash:i,error:a,copied:s=!1,estimateWithdraw:c,onClose:l,onConfirm:p,onCopyHash:h,trackFunnel:b}){let[u,v]=ze.useState(null),[g,m]=ze.useState("idle"),x=ze.useRef(0),C=ze.useRef(void 0),d=ze.useRef(null);ze.useEffect(()=>()=>clearTimeout(C.current),[]);let k=ze.useMemo(()=>{let I=o?.toLowerCase();return n.find(te=>te.poolAddress.toLowerCase()===I)??n[0]??null},[n,o]),S=ze.useMemo(()=>{try{return BigInt(k?.depositedRaw??"0")}catch{return 0n}},[k?.depositedRaw]),N=k?.decimals??18;ze.useEffect(()=>{!e||!k||b?.("position_selected")},[e,k,b]);let R=ze.useCallback(()=>{v(null),m(c?"idle":"unavailable"),x.current+=1,d.current=null},[]);if(ze.useEffect(()=>{e&&R()},[e,R]),ze.useEffect(()=>{if(!e||t!=="confirm"){clearTimeout(C.current);return}if(!c||!k){clearTimeout(C.current),m("unavailable");return}if(S<=0n){clearTimeout(C.current),x.current+=1,d.current=null,v(null),m("idle");return}let I=`${k.poolAddress.toLowerCase()}:${S.toString()}`;if(d.current===I)return;d.current=I,clearTimeout(C.current);let te=x.current+1;x.current=te,m("loading"),C.current=setTimeout(()=>{c(k,S).then(F=>{x.current===te&&(v(F??null),m(F?"ready":"unavailable"))}).catch(()=>{x.current===te&&(v(null),m("error"))})},nu)},[e,t,S,c,k]),!e||!k)return null;let E=t==="submitting",D=Qn(u?.maxPriorityFeePerGas),H=Qn(u?.maxFeePerGas??u?.gasPrice),W=lr(u?.gasLimit),j=Kt(k.depositedRaw,N);return ee("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:I=>{I.target===I.currentTarget&&!E&&l()},children:Pe("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-withdraw-title","aria-label":"Withdraw","data-status":t,"data-vaul-no-drag":!0,children:[ee("div",{className:"wp-claim-grabber","aria-hidden":!0,children:ee("span",{})}),Pe("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&i?Pe(js,{children:[ee("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:ee(ur,{})}),Pe("div",{className:"wp-claim-copy",children:[ee("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),ee("p",{className:"wp-claim-desc",children:"Your withdrawal request has been submitted. Balances will update shortly after the transaction settles."})]}),ee("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:Pe("div",{className:"wp-claim-list-item",children:[ee("span",{children:"Tx Hash"}),Pe("button",{type:"button",className:"wp-claim-hash",onClick:h,"aria-label":"Copy transaction hash","data-track":"withdraw_hash_copy",children:[ee("strong",{children:sr(i)}),s?ee(pr,{}):ee(dr,{})]})]})})]}):Pe(js,{children:[t==="error"&&Pe("div",{className:"wp-claim-heading",children:[ee("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Failed"}),ee("p",{className:"wp-claim-error-message",children:a||"The withdraw request could not be completed."})]}),Pe("div",{className:"wp-claim-reward-card","data-fit":ho(k.tokenSymbol,j),"aria-label":"Deposited balance",children:[ee("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:ee(ru,{position:k,size:28})}),ee("strong",{className:"wp-claim-reward-symbol",children:k.tokenSymbol}),ee("strong",{className:"wp-claim-reward-amount",children:j})]}),Pe("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:[Pe("div",{className:"wp-claim-account-row",children:[Pe("div",{className:"wp-claim-account",children:[ee("span",{className:"wp-claim-account-avatar","aria-hidden":!0}),Pe("strong",{children:[k.tokenSymbol," Pool"]})]}),ee("span",{children:ar(r)})]}),ee("span",{className:"wp-claim-divider","aria-hidden":!0}),Pe("div",{className:"wp-claim-detail-list",children:[Pe("div",{className:"wp-claim-detail-row",children:[ee("span",{children:"Est. Tx Fee"}),ee("strong",{children:ou(u,g)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[ee("span",{children:"Priority Fee Per Gas"}),ee("strong",{children:Ri(D,"Gwei",g)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[ee("span",{children:"Max Fee Per Gas"}),ee("strong",{children:Ri(H,"Gwei",g)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[ee("span",{children:"Gas Limit"}),ee("strong",{children:Ri(W,"",g)})]})]})]})]}),Pe("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&ee("button",{type:"button",className:"wp-claim-secondary","data-track":"withdraw_cancel",onClick:l,children:t==="error"?"Close":"Cancel"}),Pe("button",{type:"button",className:"wp-claim-primary","data-track":"withdraw_confirm",onClick:()=>{if(t==="success"){l();return}k&&S>0n&&p(k,S,u)},disabled:E||(t==="confirm"||t==="error")&&S<=0n,children:[t==="success"&&"Done",t==="submitting"&&ee("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}),t==="error"&&"Try Again",t==="confirm"&&"Withdraw Now"]})]})]}),ee("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:ee("span",{})})]})})}import*as Ne from"react";import{useQueryClient as su}from"@tanstack/react-query";import{useQuery as iu}from"@tanstack/react-query";var au="wp:reward-factory-info";function qs(e,t=!0){let{data:n,...o}=iu({queryKey:[au,e],queryFn:async({signal:r})=>{let i=await ce("gameReward",e),a=await fetch(`${i}/v1/factory/info`,{cache:"no-store",signal:r});if(!a.ok)throw new Error(`Factory info fetch failed: ${a.status}`);let s=await a.json();if(s.code!==200)throw new Error(`Factory info API error: ${s.code}`);return s},enabled:t,staleTime:0});return{factoryInfo:n?.data??null,routerAddress:n?.data.router_address??"",...o}}var lu="wp:";function Ks(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function Ys(e){let{env:t,walletAddress:n,sendTransaction:o,estimateGas:r}=Te(),i=!!n,a=!!o,s=su(),{routerAddress:c}=qs(t,i&&a),l=Ks(c),[p,h]=Ne.useState(!1),[b,u]=Ne.useState(void 0),[v,g]=Ne.useState("confirm"),[m,x]=Ne.useState(),[C,d]=Ne.useState(""),[k,S]=Ne.useState(!1),N=Ne.useRef(void 0);Ne.useEffect(()=>()=>clearTimeout(N.current),[]);let R=Ne.useRef(new Set),E=Ne.useCallback((A,ne)=>{R.current.has(A)||(R.current.add(A),ve("withdraw",A,{...ne,tags:{section:e,...ne?.tags}}))},[e]),D=Ne.useCallback((A,ne)=>l?{to:l,value:0n,data:Ts(A,ne),chainId:ye[t].cross}:null,[t,l]),H=Ne.useCallback(()=>{s.invalidateQueries({predicate:A=>typeof A.queryKey[0]=="string"&&A.queryKey[0].startsWith(lu)})},[s]),W=Ne.useCallback(A=>{u(A),h(!0),g("confirm"),x(void 0),d(""),S(!1),R.current=new Set,E("opened")},[E]),j=Ne.useCallback(()=>{v!=="submitting"&&(h(!1),u(void 0),g("confirm"),x(void 0),d(""),S(!1),v==="success"&&H())},[v,H]),I=Ne.useCallback(async(A,ne)=>{if(!r)return null;let q=D(A.poolId,ne),M=Ks(n);return!q||!M?null:r({...q,from:M})},[D,r,n]),te=Ne.useCallback(async()=>{if(!(!m||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(m),S(!0),clearTimeout(N.current),N.current=setTimeout(()=>S(!1),1400)}catch{S(!1)}},[m]),F=Ne.useCallback(async(A,ne,q)=>{if(!o){g("error"),d("Withdraw is not available for this wallet.");return}if(!l){g("error"),d("Withdraw contract address is not available.");return}try{g("submitting"),d("");let M=D(A.poolId,ne);if(!M){g("error"),d("Withdraw contract address is not available.");return}E("submitted");let de=await o({...M,gas:q?.gasLimit&&q.gasLimit>0n?q.gasLimit:void 0,maxFeePerGas:q?.maxFeePerGas&&q.maxFeePerGas>0n?q.maxFeePerGas:void 0,maxPriorityFeePerGas:q?.maxPriorityFeePerGas&&q.maxPriorityFeePerGas>0n?q.maxPriorityFeePerGas:void 0});x(de),g("success"),E("confirmed"),H()}catch(M){g("error"),d(M instanceof Error?M.message:"Failed to request withdraw."),E("confirmed",{status:"failure",reason:bt(M)})}},[D,H,l,o,E]);return{canWithdrawInline:a,isOpen:p,initialPoolAddress:b,status:v,txHash:m,error:C,copied:k,hasEstimator:!!r,openWithdraw:W,closeWithdraw:j,estimateWithdraw:I,confirmWithdraw:F,copyHash:te,trackFunnelOnce:E}}import{Fragment as du,jsx as dt,jsxs as sn}from"react/jsx-runtime";var cu="Points";function Zs(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{getTokenImage:i}=Xn(e,r),a=Ys("points"),{positions:s,isLoading:c}=Hs(e,t,r),l=Qs.useMemo(()=>s.filter(b=>b.poolType!=="CrossPool").map(b=>({...b,icon:i(b.tokenAddress,b.tokenSymbol)})),[s,i]),p=`${It[e]}/point.png`,h=Fs[e];return sn(du,{children:[dt(Pt,{sectionKey:"points",title:cu,icon:p,isEmpty:l.length===0,loading:c,children:l.map(b=>{let u=b.price?wn(b.depositedRaw,b.decimals,b.price,o):null;return sn("article",{className:"wp-item","data-side":"reward",children:[sn("div",{className:"wp-item-body",children:[sn("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Token"}),sn("div",{className:"wp-svc-token",children:[b.icon&&dt("img",{className:"wp-svc-token-icon",src:b.icon,alt:""}),dt("span",{children:b.tokenSymbol})]})]}),sn("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Deposited"}),sn("div",{className:"wp-svc-token wp-svc-token--amount",children:[b.icon&&dt("img",{className:"wp-svc-token-icon",src:b.icon,alt:""}),sn("div",{className:"wp-svc-amount",children:[dt("span",{className:"wp-svc-amount-main",children:Kt(b.depositedRaw,b.decimals)}),u&&dt("span",{className:"wp-item-usd",children:u})]})]})]})]}),dt("div",{className:"wp-item-tags",children:a.canWithdrawInline?dt("button",{type:"button",className:"wp-tag wp-tag--muted","data-track":"points_withdraw_open",onClick:()=>a.openWithdraw(b.poolAddress),children:dt("span",{className:"wp-tag-label",children:"Withdraw"})}):sn("a",{className:"wp-tag wp-tag--muted",href:h,target:"_blank",rel:"noopener noreferrer","data-track":"points_withdraw_open",onClick:v=>Ge(v,h,{category:"portfolio",origin:"portfolio-points",payload:{position:b}},n),children:[dt("span",{className:"wp-tag-label",children:"Withdraw"}),dt(yt,{size:12,className:"wp-tag-icon"})]})})]},b.poolAddress)})}),dt(Vs,{open:a.isOpen,status:a.status,positions:l,initialPoolAddress:a.initialPoolAddress,walletAddress:t,txHash:a.txHash,error:a.error,copied:a.copied,estimateWithdraw:a.hasEstimator?a.estimateWithdraw:void 0,onClose:a.closeWithdraw,onConfirm:a.confirmWithdraw,onCopyHash:a.copyHash,trackFunnel:a.trackFunnelOnce})]})}import*as Ci from"react";import{useQuery as pu}from"@tanstack/react-query";var uu="wp:stake-info";function Xs(e,t,n=!0){let o=n&&!!t,{data:r,...i}=pu({queryKey:[uu,e,t],queryFn:async({signal:s})=>{let c=await ce("posa",e),l=await fetch(`${c}/stake/${t}`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Stake info fetch failed: ${l.status}`);let p=await l.json();if(p.code!==0&&p.code!==200)throw new Error(`Stake info API error: ${p.code}`);return p},enabled:o,staleTime:0});return{stakeInfo:r?.data,...i}}import{useQuery as fu}from"@tanstack/react-query";var mu="wp:stake-rewards",gu=31;function Js(e,t,n=!0){let o=n&&!!t,{data:r,...i}=fu({queryKey:[mu,e,t],queryFn:async({signal:a})=>{let s=await ce("posa",e),c=await fetch(`${s}/rewards/${t}?limit=${gu}`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Stake rewards fetch failed: ${c.status}`);let l=await c.json();if(l.code!==0&&l.code!==200)throw new Error(`Stake rewards API error: ${l.code}`);return l.data?.data??[]},enabled:o,staleTime:0});return{latestReward:r?.[0]??null,aprAccrued:Cs(r),...i}}import{useQuery as hu}from"@tanstack/react-query";var bu="wp:staking-onchain";function el(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...i}=hu({queryKey:[bu,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...i}}import{useMemo as tl}from"react";import wu from"bignumber.js";function nl(e){return e?.trim().toUpperCase()==="CROSS"}function ol(e){return new wu(e||"0").isGreaterThan(0)}function br(e,t,n=!0){let{allPools:o}=Zn(e,n),r=tl(()=>{for(let l of o)for(let p of[l.deposit_token,...l.reward_tokens])if(nl(p?.symbol)&&ol(p.price))return p.price},[o]),i=n&&r===void 0,{tokens:a}=hn(e,t,i),{statsMap:s}=bn(e,i),c=ye[e].cross;return tl(()=>{if(r)return r;let l=a.find(p=>p.chainId===c&&nl(p.symbol));if(l){let p=s.get(Ut(l.chainId,l.address));if(p&&ol(p.price))return p.price}return"0"},[r,a,s,c])}import xn from"bignumber.js";import{jsx as Yt,jsxs as Qt}from"react/jsx-runtime";var xu="CROSS Staking";function vu(e){if(!e)return"\u2014";let t=new xn(e);return t.isFinite()?`${t.toFormat(2,xn.ROUND_DOWN)}%`:"\u2014"}function rl(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=Te(),r=Et(),i=!!t,{stakeInfo:a,isLoading:s}=Xs(e,t,i),{latestReward:c,aprAccrued:l,isLoading:p}=Js(e,t,i),{onchain:h}=el(t,o,i),b=br(e,t,i),u=`${It[e]}/cross-staking.png`,v=Ms[e],g=a?.total_stake??"0",m=Ci.useMemo(()=>h?new xn(h.earnedWei.toString()).shiftedBy(-18).toString(10):c?.cumulative_earned??a?.rewards_earned??"0",[h,c,a]),x=Ci.useMemo(()=>h?new xn(h.stakedWei.toString()).shiftedBy(-18):new xn(g),[h,g]),C=l!==void 0?new xn(l):void 0,d=a?.days_since_first_stake,k=C!==void 0&&C.isFinite()&&x.isGreaterThan(0)&&d!==null&&d!==void 0?C.div(x).times(365).div(Math.max(1,d)).times(100):void 0,S=!(new xn(g).isZero()&&new xn(m).isZero()),N=wn(g,0,b,r),R=wn(m,0,b,r);return Yt(Pt,{sectionKey:"staking",title:xu,icon:u,iconFit:"contain",isEmpty:!S,loading:s||p,children:Qt("article",{className:"wp-item","data-side":"stake",children:[Qt("div",{className:"wp-item-body",children:[Qt("div",{className:"wp-item-line",children:[Yt("span",{className:"wp-item-label",children:"Staked"}),Qt("div",{className:"wp-svc-amount",children:[Qt("span",{className:"wp-svc-amount-main",children:[wi(g)," CROSS"]}),N&&Yt("span",{className:"wp-item-usd",children:N})]})]}),Qt("div",{className:"wp-item-line",children:[Yt("span",{className:"wp-item-label",children:"Rewards Earned"}),Qt("div",{className:"wp-svc-amount",children:[Qt("span",{className:"wp-svc-amount-main",children:[wi(m)," CROSS"]}),R&&Yt("span",{className:"wp-item-usd",children:R})]})]}),Qt("div",{className:"wp-item-line",children:[Yt("span",{className:"wp-item-label",children:"My APR"}),Yt("span",{children:vu(k?.toString(10))})]})]}),Yt("div",{className:"wp-item-tags",children:Qt("a",{className:"wp-tag wp-tag--mint",href:v,target:"_blank",rel:"noopener noreferrer","data-track":"stake_outlink",onClick:E=>Ge(E,v,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:a}},n),children:[Yt("span",{className:"wp-tag-label",children:"Manage"}),Yt(yt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as Ti from"react";import{useQuery as yu}from"@tanstack/react-query";var ku="wp:game-swap-pools";function il(e,t,n=!0){let o=n&&!!t,{data:r,...i}=yu({queryKey:[ku,e,t],queryFn:async({signal:a})=>{let s=await ce("gameSwap",e),c=await fetch(`${s}/addresses/${t}/portfolio`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Game-swap portfolio fetch failed: ${c.status}`);return(await c.json()).pools??[]},enabled:o,staleTime:0});return{pools:r??[],...i}}import{useQuery as Su}from"@tanstack/react-query";var Ru="wp:game-swap-lp-balances";function al(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),i=!!t&&r.length>0,{data:a,...s}=Su({queryKey:[Ru,e,t,r,!!o],queryFn:async({signal:c})=>{let l=o?await o(r):await $s(e,t,r,c),p={};for(let[h,b]of Object.entries(l))p[h.toLowerCase()]=b;return p},enabled:i,staleTime:0});return{balances:a??{},...s}}import ln from"bignumber.js";import{jsx as Lt,jsxs as Gt}from"react/jsx-runtime";var Cu="Gametoken LP",ll=18,Tu=new ln("0.0001");function sl(e){return e?.trim().toUpperCase()==="CROSS"}function Nu(e){return e&&e>0?e:ll}function Eu(e){let t=sl(e.token_a?.symbol)&&!sl(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Nu(t?e.token_a?.decimals:e.token_b?.decimals),r=new ln(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new ln(0):r.times(2)}function Iu(e,t,n){let o=e.token_a?.symbol?.trim()||"TOKEN",r=e.token_b?.symbol?.trim()||"CROSS",i=t?.decimals??ll,a,s;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let c=new ln(t.balance.toString()),l=new ln(t.totalSupply.toString()),p=c.div(l);a=p.times(100);let h=p.times(Eu(e));if(h.isGreaterThan(0)){let b=new ln(e.quote_usd??e.cross_usd??"0");s=b.isGreaterThan(0)?Fn(h.times(b),n):`${h.toFormat(4,ln.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:o,tokenBSymbol:r,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:i,sharePercent:a,valueText:s}}function cl(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=Te(),r=Et(),i=!!t,{pools:a,isLoading:s}=il(e,t,i),c=Ti.useMemo(()=>a.map(g=>g.pair_address).filter(Boolean),[a]),{balances:l,isLoading:p}=al(e,t,c,o),h=`${It[e]}/dex.png`,b=Object.keys(l).length>0,u=Ti.useMemo(()=>{let g=a.map(m=>Iu(m,l[m.pair_address?.toLowerCase()],r));return b?g.filter(m=>m.lpAmountRaw?new ln(m.lpAmountRaw).shiftedBy(-m.lpDecimals).isGreaterThanOrEqualTo(Tu):!1):g},[a,l,b,r]),v=g=>{let m=g.token_a?.address??g.pair_address;return`${Ds[e]}/tokens/${m}?trade=deposit`};return Lt(Pt,{sectionKey:"gameSwap",title:Cu,icon:h,iconFit:"contain",isEmpty:u.length===0,loading:s||p,children:u.map(g=>{let{pool:m}=g,x=v(m),C=`${g.tokenASymbol} / ${g.tokenBSymbol}`,d=m.token_a?.logo_url,k=m.token_b?.logo_url;return Gt("article",{className:"wp-item","data-side":"game-swap",children:[Gt("div",{className:"wp-item-body",children:[Gt("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"Pool"}),Gt("div",{className:"wp-svc-token",children:[Gt("span",{className:"wp-token-stack","aria-hidden":!0,children:[d&&Lt("img",{className:"wp-svc-token-icon",src:d,alt:""}),k&&Lt("img",{className:"wp-svc-token-icon",src:k,alt:""})]}),Lt("span",{children:C})]})]}),g.lpAmountRaw!==void 0&&Gt("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"My LP"}),Gt("span",{children:[Kt(g.lpAmountRaw,g.lpDecimals)," LP"]})]}),g.sharePercent!==void 0&&Gt("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"Pool Share"}),Gt("span",{children:[g.sharePercent.toFormat(2,ln.ROUND_DOWN),"%"]})]}),g.valueText!==void 0&&Gt("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"Value"}),Lt("span",{children:g.valueText})]})]}),Lt("div",{className:"wp-item-tags",children:Gt("a",{className:"wp-tag wp-tag--mint",href:x,target:"_blank",rel:"noopener noreferrer","data-track":"gameswap_outlink","data-track-id":C,onClick:S=>Ge(S,x,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:m}},n),children:[Lt("span",{className:"wp-tag-label",children:"Manage"}),Lt(yt,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}import Bn from"bignumber.js";import{useMemo as Mu}from"react";import{useQuery as Pu}from"@tanstack/react-query";var Lu="wp:forge-pools";function dl(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Pu({queryKey:[Lu,e,t],queryFn:async()=>{let s=await ce("bondingCurve",e),c=await fetch(`${s}/v1/users/${t}/pools`,{cache:"no-store"});if(!c.ok)throw new Error(`forge pools fetch failed: ${c.status}`);return(await c.json()).data?.items??[]},enabled:o,staleTime:0}),a=r??[];return{pools:a,isEmpty:a.length===0,...i}}import{useQueries as _u}from"@tanstack/react-query";import{useMemo as Au}from"react";var Fu="wp:forge-token-detail";async function Bu(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function pl(e,t,n=!0){let o=_u({queries:t.map(a=>({queryKey:[Fu,e,a],queryFn:async()=>Bu(await ce("bondingCurve",e),a),enabled:n&&!!a,staleTime:3e4}))}),r=Au(()=>{let a=new Map;for(let s=0;s<o.length;s++){let c=o[s]?.data,l=t[s];c&&l&&a.set(l.toLowerCase(),c)}return a},[o,t]),i=o.some(a=>a.isLoading);return{detailMap:r,isLoading:i}}import{jsx as pt,jsxs as vn}from"react/jsx-runtime";var Du="Forge",ul=18,Ou="https://contents.crosstoken.io/wallet/token/images/FT.png";function Wu(e){if(!e||e==="0")return"0";let t=new Bn(e).shiftedBy(-ul);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Bn.ROUND_DOWN):t.toFormat(4,Bn.ROUND_DOWN)}function Uu(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 Gu(e,t,n,o){let r=new Bn(n||"0");if(!r.isGreaterThan(0))return null;let i=new Bn(e.total_supply||"0"),a=new Bn(e.lp_balance||"0"),s=new Bn(t?.reserve_b||"0").shiftedBy(-ul);if(!i.isGreaterThan(0)||!a.isGreaterThan(0)||!s.isGreaterThan(0))return null;let c=s.times(2),p=a.div(i).times(c).times(r);return p.isFinite()?Fn(p,o):null}function fl(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{pools:i,isEmpty:a,isLoading:s}=dl(e,t,r),c=Mu(()=>i.map(u=>u.token.address),[i]),{detailMap:l}=pl(e,c,r&&c.length>0),p=br(e,t,r),h=u=>`${Bs[e]}/forge/token/${u.token.address}`,b=`${It[e]}/forge.png`;return pt(Pt,{sectionKey:"forge",title:Du,icon:b,iconFit:"contain",isEmpty:a,loading:s,children:i.map(u=>{let v=l.get(u.token.address.toLowerCase()),g=v?.image_url||v?.image||u.token.image||Ou,m=v?.symbol||u.token.symbol,x=h(u),C=Gu(u,v,p,o);return vn("a",{className:"wp-item","data-side":"lp",href:x,target:"_blank",rel:"noopener noreferrer","data-track":"forge_outlink","data-track-id":m,onClick:d=>Ge(d,x,{category:"portfolio",origin:"portfolio-forge",payload:{pool:u,tokenDetail:v}},n),children:[vn("div",{className:"wp-item-body",children:[vn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"Asset"}),vn("div",{className:"wp-svc-token",children:[pt("img",{className:"wp-svc-token-icon",src:g,alt:""}),pt("span",{children:m}),v?.name&&pt("span",{className:"wp-token-subtle",children:v.name})]})]}),vn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"LP Balance"}),pt("div",{className:"wp-svc-token wp-svc-token--amount",children:vn("div",{className:"wp-svc-amount",children:[pt("span",{className:"wp-svc-amount-main",children:Wu(u.lp_balance)}),C&&pt("span",{className:"wp-item-usd",children:C})]})})]}),vn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"Ownership"}),pt("span",{className:"wp-line-value",children:Uu(u.pool_ownership)})]})]}),pt("div",{className:"wp-item-tags",children:vn("span",{className:"wp-tag wp-tag--muted",children:[pt("span",{className:"wp-tag-label",children:"Withdraw"}),pt(yt,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}import{useMemo as Tl}from"react";import ff from"bignumber.js";import{useQuery as zu}from"@tanstack/react-query";var $u="wp:crossd-positions";function Hu(e){let t=e??{};return(t.positions??t.data?.positions??[]).filter(o=>{if(!o?.token_id||!o.liquidity)return!1;try{return BigInt(o.liquidity)>0n}catch{return!1}})}function ml(e,t,n=!0){let o=n&&!!t,{data:r,...i}=zu({queryKey:[$u,e,t],queryFn:async()=>{let s=await fetch(`${gr[e]}/api/v1/positions?owner=${t}`,{cache:"no-store"});if(!s.ok)throw new Error(`crossd positions fetch failed: ${s.status}`);return Hu(await s.json())},enabled:o,staleTime:0}),a=r??[];return{positions:a,isEmpty:a.length===0,...i}}import{useQueries as ju}from"@tanstack/react-query";import{useMemo as Vu}from"react";var qu="wp:crossd-position-details";function Ku(e){let t=e??{},n=t.data??t;return n?.token_id||n?.pool?n:null}function gl(e,t,n=!0){let o=ju({queries:t.map(i=>({queryKey:[qu,e,i],queryFn:async()=>{let a=await fetch(`${gr[e]}/api/v1/positions/${i}`,{cache:"no-store"});if(!a.ok)throw new Error(`crossd position detail failed: ${a.status}`);return Ku(await a.json())},enabled:n&&!!i,staleTime:6e4}))});return{detailMap:Vu(()=>{let i=new Map;return o.forEach((a,s)=>{let c=a.data,l=t[s];c&&l&&i.set(l,c)}),i},[o,t])}}import*as cn from"react";import{Fragment as bl,jsx as J,jsxs as $e}from"react/jsx-runtime";var Yu=300*1e3,hl="https://contents.crosstoken.io/wallet/token/images/Cross.svg";function Qu(e,t){if(t)return"Estimating...";if(!e)return"Wallet estimate";let n=e.maxFeePerGas??e.gasPrice;return!n||n<=0n||e.gasLimit<=0n?"Wallet estimate":`${cr(e.gasLimit*n)} CROSS`}function Ni(e,t,n){return n?"Estimating...":`${e} ${t}`.trim()}function wl({open:e,status:t,target:n,token0Icon:o,token1Icon:r,token0Symbol:i,token1Symbol:a,txHash:s,error:c,copied:l=!1,hasEstimator:p,prepareWithdraw:h,confirmWithdraw:b,onClose:u,onCopyHash:v,trackFunnel:g}){let[m,x]=cn.useState(null),[C,d]=cn.useState(null),k=cn.useRef(0);cn.useEffect(()=>{if(!e||!n)return;let Q=++k.current;x(null),d(null),g?.("dialog_opened"),h().then(fe=>{k.current===Q&&(x(fe),d(fe?Date.now():null))})},[e,n]);let S=t==="submitting",N=t==="estimating"||t==="confirm"&&!m,R=cn.useCallback(async()=>{let Q=m,fe=!C||Date.now()-C>Yu;if(!Q||fe){let we=++k.current;if(Q=await h(),k.current!==we)return;x(Q),d(Q?Date.now():null)}Q&&await b(Q)},[m,C,h,b]);if(!e||!n)return null;let{position:E,detail:D}=n,H=D.pool?.token0,W=D.pool?.token1,j=i||H?.symbol||E.pool?.token0_symbol||"?",I=a||W?.symbol||E.pool?.token1_symbol||"?",te=H?.decimals??18,F=W?.decimals??18,A=o||H?.logo_url||hl,ne=r||W?.logo_url||hl,q=`${j}/${I}`,M=m?Kn(m.expectedAmount0.toString(),te):null,de=m?Kn(m.expectedAmount1.toString(),F):null,re=Qn(m?.estimate?.maxPriorityFeePerGas),z=Qn(m?.estimate?.maxFeePerGas??m?.estimate?.gasPrice),ke=lr(m?.estimate?.gasLimit);return J("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:Q=>{Q.target===Q.currentTarget&&!S&&u()},children:$e("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-crossd-withdraw-title","aria-label":"Withdraw position","data-status":t,"data-vaul-no-drag":!0,children:[J("div",{className:"wp-claim-grabber","aria-hidden":!0,children:J("span",{})}),$e("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&s?$e(bl,{children:[J("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:J(ur,{})}),$e("div",{className:"wp-claim-copy",children:[J("h3",{id:"wp-crossd-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),$e("p",{className:"wp-claim-desc",children:["Your ",q," position withdrawal has been submitted. Balances will update shortly after the transaction settles."]})]}),J("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:$e("div",{className:"wp-claim-list-item",children:[J("span",{children:"Tx Hash"}),$e("button",{type:"button",className:"wp-claim-hash",onClick:v,"aria-label":"Copy transaction hash","data-track":"crossd_withdraw_hash_copy",children:[J("strong",{children:sr(s)}),l?J(pr,{}):J(dr,{})]})]})})]}):$e(bl,{children:[t==="error"&&$e("div",{className:"wp-claim-heading",children:[J("h3",{id:"wp-crossd-withdraw-title",className:"wp-claim-title",children:"Withdraw Failed"}),J("p",{className:"wp-claim-error-message",children:c||"The withdraw request could not be completed."})]}),$e("div",{className:"wp-claim-reward-card","data-fit":ho(j,M??""),"aria-label":`Expected ${j}`,children:[J("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:J("img",{src:A,alt:"",width:28,height:28})}),J("strong",{className:"wp-claim-reward-symbol",children:j}),J("strong",{className:"wp-claim-reward-amount",children:M??"Estimating..."})]}),$e("div",{className:"wp-claim-reward-card","data-fit":ho(I,de??""),"aria-label":`Expected ${I}`,children:[J("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:J("img",{src:ne,alt:"",width:28,height:28})}),J("strong",{className:"wp-claim-reward-symbol",children:I}),J("strong",{className:"wp-claim-reward-amount",children:de??"Estimating..."})]}),p&&J("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:$e("div",{className:"wp-claim-detail-list",children:[$e("div",{className:"wp-claim-detail-row",children:[J("span",{children:"Est. Tx Fee"}),J("strong",{children:Qu(m?.estimate,N)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Priority Fee Per Gas"}),J("strong",{children:Ni(re,"Gwei",N)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Max Fee Per Gas"}),J("strong",{children:Ni(z,"Gwei",N)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Gas Limit"}),J("strong",{children:Ni(ke,"",N)})]})]})})]}),$e("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&J("button",{type:"button",className:"wp-claim-secondary","data-track":"crossd_withdraw_cancel",onClick:u,children:t==="error"?"Close":"Cancel"}),J("button",{type:"button",className:"wp-claim-primary","data-track":"crossd_withdraw_confirm",onClick:()=>{if(t==="success"){u();return}S||N||(g?.("confirm_clicked"),R())},disabled:S||N,children:t==="success"?"Done":S?J("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}):N?J("span",{className:"wp-claim-button-spinner","aria-label":"Estimating"}):t==="error"?"Retry":"Withdraw"})]})]}),J("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:J("span",{})})]})})}import*as xe from"react";import{useQueryClient as cf}from"@tanstack/react-query";var Zu="0x0c49ccbe",Xu="0xfc6f7865",Ju="0x49404b7c",ef="0xdf2ab5bb",tf="0xac9650d8",xl=(1n<<128n)-1n,yl=600n,nf=99n,of=100n;function Ei(e){return e*nf/of}function vl(e,t){return!!e&&!!t&&e.toLowerCase()===t.toLowerCase()}function ut(e,t){if(e<0n)throw new Error(`${t} must be non-negative`);let n=e.toString(16);if(n.length>64)throw new Error(`${t} exceeds uint256`);return n.padStart(64,"0")}function wr(e,t){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`${t} is not a valid address`);return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function Ii(e){return Zu+ut(e.tokenId,"tokenId")+ut(e.liquidity,"liquidity")+ut(e.amount0Min,"amount0Min")+ut(e.amount1Min,"amount1Min")+ut(e.deadline,"deadline")}function rf(e){return Xu+ut(e.tokenId,"tokenId")+wr(e.recipient,"recipient")+ut(e.amount0Max,"amount0Max")+ut(e.amount1Max,"amount1Max")}function af(e,t){return Ju+ut(e,"amountMinimum")+wr(t,"recipient")}function sf(e,t,n){return ef+wr(e,"token")+ut(t,"amountMinimum")+wr(n,"recipient")}function lf(e){if(e.length===0)throw new Error("multicall requires at least one call");let t=e.map(r=>{let i=r.replace(/^0x/,"");if(i.length%2!==0||!/^[0-9a-fA-F]*$/.test(i))throw new Error("multicall element must be valid hex bytes");let a=i.length%64===0?i:i.padEnd(i.length+(64-i.length%64),"0");return ut(BigInt(i.length/2),"callLength")+a.toLowerCase()}),n=BigInt(e.length)*32n,o=[];for(let r of t)o.push(ut(n,"callOffset")),n+=BigInt(r.length/2);return tf+ut(0x20n,"arrayOffset")+ut(BigInt(e.length),"arrayLength")+o.join("")+t.join("")}function kl(e){if(!e||e==="0x")return null;let t=e.replace(/^0x/,"");return t.length<128||!/^[0-9a-fA-F]+$/.test(t)?null:{amount0:BigInt(`0x${t.slice(0,64)}`),amount1:BigInt(`0x${t.slice(64,128)}`)}}function Sl(e){let t=vl(e.token0,e.wcrossAddress),n=vl(e.token1,e.wcrossAddress),o=t||n,r=[Ii({tokenId:e.tokenId,liquidity:e.liquidity,amount0Min:e.amount0Min,amount1Min:e.amount1Min,deadline:e.deadline}),rf({tokenId:e.tokenId,recipient:o?e.positionManagerAddress:e.owner,amount0Max:xl,amount1Max:xl})];return o&&(r.push(af(0n,e.owner)),r.push(sf(t?e.token1:e.token0,0n,e.owner))),lf(r)}async function Rl(e,t,n){let o;try{o=await vo(e,n)}catch{o=void 0}if(!o)return null;let r=Ii({tokenId:t.tokenId,liquidity:t.liquidity,amount0Min:0n,amount1Min:0n,deadline:t.deadline}),i=await an(o,t.positionManager,r,n,t.owner);return kl(i)}var df="wp:",pf=[1500,3e3,4500,6e3];function uf(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function Cl(){let{env:e,walletAddress:t,sendTransaction:n,estimateGas:o}=Te(),r=!!n,i=cf(),[a,s]=xe.useState(!1),[c,l]=xe.useState(null),[p,h]=xe.useState("confirm"),[b,u]=xe.useState(),[v,g]=xe.useState(""),[m,x]=xe.useState(!1),[C,d]=xe.useState(new Set),k=xe.useRef(void 0),S=xe.useRef([]),N=xe.useRef(0);xe.useEffect(()=>()=>{clearTimeout(k.current),S.current.forEach(clearTimeout)},[]);let R=xe.useRef(new Set),E=xe.useCallback((F,A)=>{R.current.has(F)||(R.current.add(F),ve("withdraw",F,{...A,tags:{section:"crossdPool",...A?.tags}}))},[]),D=xe.useCallback(()=>{let F=()=>i.invalidateQueries({predicate:A=>typeof A.queryKey[0]=="string"&&A.queryKey[0].startsWith(df)});F(),S.current.forEach(clearTimeout),S.current=pf.map(A=>setTimeout(F,A))},[i]),H=xe.useCallback(F=>{N.current+=1,l(F),s(!0),h("confirm"),u(void 0),g(""),x(!1),R.current=new Set,E("opened")},[E]),W=xe.useCallback(()=>{p!=="submitting"&&(N.current+=1,s(!1),l(null),h("confirm"),u(void 0),g(""),x(!1))},[p]),j=xe.useCallback(async()=>{let F=N.current,A=uf(t),ne=c?.position.token_id,q=c?.position.liquidity,M=c?.detail.pool?.token0?.address,de=c?.detail.pool?.token1?.address;if(!A||!ne||!q||!M||!de)return h("error"),g("Position data is incomplete. Please refresh and retry."),null;try{h("estimating"),g("");let re=BigInt(ne),z=BigInt(q),ke=BigInt(Math.floor(Date.now()/1e3))+yl,Q=Ws[e],fe=await Rl(e,{owner:A,positionManager:Q,tokenId:re,liquidity:z,deadline:ke});if(N.current!==F)return null;if(!fe)return h("error"),g("Failed to estimate withdrawal amounts. Please retry."),null;let we=Sl({tokenId:re,liquidity:z,amount0Min:Ei(fe.amount0),amount1Min:Ei(fe.amount1),deadline:ke,owner:A,positionManagerAddress:Q,token0:M,token1:de,wcrossAddress:Us[e]}),We={to:Q,value:0n,data:we,chainId:ye[e].cross},K=null;if(o){try{K=await o({...We,from:A})}catch{K=null}if(N.current!==F)return null}return h("confirm"),{tx:We,estimate:K,expectedAmount0:fe.amount0,expectedAmount1:fe.amount1}}catch(re){return N.current!==F||(h("error"),g(re instanceof Error?re.message:"Failed to prepare withdraw.")),null}},[e,o,c,t]),I=xe.useCallback(async F=>{if(!n){h("error"),g("Withdraw is not available for this wallet.");return}try{h("submitting"),g(""),E("submitted");let A=await n({...F.tx,gas:F.estimate?.gasLimit&&F.estimate.gasLimit>0n?F.estimate.gasLimit:void 0,maxFeePerGas:F.estimate?.maxFeePerGas&&F.estimate.maxFeePerGas>0n?F.estimate.maxFeePerGas:void 0,maxPriorityFeePerGas:F.estimate?.maxPriorityFeePerGas&&F.estimate.maxPriorityFeePerGas>0n?F.estimate.maxPriorityFeePerGas:void 0});u(A),h("success");let ne=c?.position.token_id;ne&&d(q=>{let M=new Set(q);return M.add(ne),M}),E("confirmed"),D()}catch(A){h("error"),g(A instanceof Error?A.message:"Failed to request withdraw."),E("confirmed",{status:"failure",reason:bt(A)})}},[D,n,c,E]),te=xe.useCallback(async()=>{if(!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b),x(!0),clearTimeout(k.current),k.current=setTimeout(()=>x(!1),1400)}catch{x(!1)}},[b]);return{canWithdrawInline:r,isOpen:a,target:c,withdrawnTokenIds:C,status:p,txHash:b,error:v,copied:m,hasEstimator:!!o,openWithdraw:H,closeWithdraw:W,prepareWithdraw:j,confirmWithdraw:I,copyHash:te,trackFunnelOnce:E}}import{Fragment as gf,jsx as ft,jsxs as yn}from"react/jsx-runtime";var mf="CROSSD Pool",Nl="https://contents.crosstoken.io/wallet/token/images/Cross.svg";function El(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{positions:i,isLoading:a}=ml(e,t,r),s=Cl(),c=Tl(()=>i.filter(R=>!R.token_id||!s.withdrawnTokenIds.has(R.token_id)),[i,s.withdrawnTokenIds]),l=Tl(()=>c.map(R=>R.token_id).filter(R=>!!R),[c]),{detailMap:p}=gl(e,l,r&&l.length>0),h=`${Os[e]}/pool`,b=`${It[e]}/crossd.png`,{getTokenImage:u,getTokenSymbol:v}=Xn(e,r),g={chainOnly:!0},m=(R,E)=>bi(v(R?.address??"",R?.symbol??E,g))??"?",x=(R,E)=>{let D=R?.symbol??E,H=bi(D);return H==="CROSS"?u("","CROSS",g)||Nl:u(R?.address??"",H,g)||R?.logo_url||Nl},C=s.target?.detail.pool,d=x(C?.token0,s.target?.position.pool?.token0_symbol),k=x(C?.token1,s.target?.position.pool?.token1_symbol),S=m(C?.token0,s.target?.position.pool?.token0_symbol),N=m(C?.token1,s.target?.position.pool?.token1_symbol);return yn(gf,{children:[ft(Pt,{sectionKey:"crossdPool",title:mf,icon:b,iconFit:"contain",isEmpty:c.length===0,loading:a,children:c.map(R=>{let E=R.token_id?p.get(R.token_id):void 0,D=`${m(E?.pool?.token0,R.pool?.token0_symbol)}/${m(E?.pool?.token1,R.pool?.token1_symbol)}`,H=R.pool?.fee_tier_percentage,W=x(E?.pool?.token0,R.pool?.token0_symbol),j=x(E?.pool?.token1,R.pool?.token1_symbol),I=Fn(new ff(R.position_value_usd??"0"),o),te=s.canWithdrawInline&&!!E?.pool?.token0?.address&&!!E?.pool?.token1?.address;return yn("article",{className:"wp-item","data-side":"crossd",children:[yn("div",{className:"wp-item-body",children:[yn("div",{className:"wp-item-line",children:[ft("span",{className:"wp-item-label",children:"Pool"}),yn("div",{className:"wp-svc-token",children:[yn("span",{className:"wp-token-stack","aria-hidden":!0,children:[ft("img",{className:"wp-svc-token-icon",src:W,alt:""}),ft("img",{className:"wp-svc-token-icon",src:j,alt:""})]}),ft("span",{children:D}),H&&ft("span",{className:"wp-token-subtle",children:H})]})]}),yn("div",{className:"wp-item-line",children:[ft("span",{className:"wp-item-label",children:"Position Value"}),ft("span",{className:"wp-line-value",children:I})]})]}),ft("div",{className:"wp-item-tags",children:te?ft("button",{type:"button",className:"wp-tag wp-tag--muted","data-track":"crossd_pool_withdraw_open","data-track-id":D,onClick:()=>{E&&s.openWithdraw({position:R,detail:E})},children:ft("span",{className:"wp-tag-label",children:"Withdraw"})}):yn("a",{className:"wp-tag wp-tag--muted",href:h,target:"_blank",rel:"noopener noreferrer","data-track":"crossd_pool_outlink","data-track-id":D,onClick:F=>Ge(F,h,{category:"portfolio",origin:"portfolio-crossd-pool",payload:{position:R,detail:E}},n),children:[ft("span",{className:"wp-tag-label",children:"Withdraw"}),ft(yt,{size:12,className:"wp-tag-icon"})]})})]},R.token_id)})}),ft(wl,{open:s.isOpen,status:s.status,target:s.target,token0Icon:d,token1Icon:k,token0Symbol:S,token1Symbol:N,txHash:s.txHash,error:s.error,copied:s.copied,hasEstimator:s.hasEstimator,prepareWithdraw:s.prepareWithdraw,confirmWithdraw:s.confirmWithdraw,onClose:s.closeWithdraw,onCopyHash:s.copyHash,trackFunnel:s.trackFunnelOnce})]})}var xr=["rewards","points","staking","gameSwap","forge","crossdPool"];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-reward-card[data-fit=sm] .wp-claim-reward-symbol{font-size:14px}.wp-claim-reward-card[data-fit=sm] .wp-claim-reward-amount{font-size:16px}.wp-claim-reward-card[data-fit=xs] .wp-claim-reward-symbol{font-size:12px}.wp-claim-reward-card[data-fit=xs] .wp-claim-reward-amount{font-size:13px}.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
- `);import{Fragment as wf,jsx as pe,jsxs as dn}from"react/jsx-runtime";var Pi=15,bf="wp:";function Jn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:i=!0,variant:a="embed",className:s,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:p,sendTransaction:h,estimateGas:b,conversionRatio:u,currencySymbol:v,sections:g}){let m=_e(e),x=Ee.useCallback(K=>!g||g.includes(K),[g]),C=!!n,d=hf(),[k,S]=Ee.useState({}),N=Ee.useCallback((K,be)=>{S(Be=>{let Me=Be[K];return Me&&Me.loading===be.loading&&Me.empty===be.empty?Be:{...Be,[K]:be}})},[]),R=Ee.useCallback(K=>{S(be=>{if(!(K in be))return be;let Be={...be};return delete Be[K],Be})},[]),E=Ee.useMemo(()=>({report:N,unregister:R}),[N,R]),[D,H]=Ee.useState(Pi),[W,j]=Ee.useState(!1),[I,te]=Ee.useState(!1),F=Ee.useRef(void 0),A=Ee.useCallback(()=>{d.invalidateQueries({predicate:K=>typeof K.queryKey[0]=="string"&&K.queryKey[0].startsWith(bf)})},[d]),ne=Ee.useCallback(()=>{A(),j(!0),setTimeout(()=>j(!1),600),H(Pi)},[A]);Ee.useEffect(()=>{if(!C)return;let K=setInterval(()=>{H(be=>be<=1?(ne(),Pi):be-1)},1e3);return()=>clearInterval(K)},[C,ne]);let q=Ee.useCallback(()=>{r?.()},[r]),M=C?rn(m,n,{size:64}):void 0,de=Ee.useCallback(async()=>{if(!(I||!n))try{await navigator.clipboard.writeText(n),te(!0),clearTimeout(F.current),F.current=setTimeout(()=>te(!1),2e3)}catch{}},[n,I]);Ee.useEffect(()=>()=>clearTimeout(F.current),[]);let re=Ee.useMemo(()=>({env:m,theme:t,open:!0,walletAddress:n,close:q,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:p,sendTransaction:h,estimateGas:b,conversionRatio:u,currencySymbol:v}),[m,t,n,q,c,l,p,h,b,u,v]),z=xr.filter(x),ke=z.length>0&&z.every(K=>{let be=k[K];return!!be&&!be.loading}),Q=ke&&z.every(K=>k[K]?.empty),fe=z.some(K=>{let be=k[K];return!!be&&!be.empty}),we=z.length>0&&!ke&&!fe,We=dn(wf,{children:[i&&dn("div",{className:"wp-header",children:[dn("div",{className:"wp-header-account",children:[r&&pe("button",{type:"button",className:"wp-header-btn","aria-label":"Back","data-track":"back",onClick:r,children:pe(Ps,{})}),pe("span",{className:"wp-header-avatar","aria-hidden":!0,children:M&&pe("img",{src:M,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&dn("div",{className:"wp-header-account-meta",children:[o&&pe("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&dn("button",{type:"button",className:"wp-header-address-btn",onClick:de,"aria-label":"Copy wallet address","data-track":"address_copy",children:[pe("span",{className:"wp-header-address",children:ar(n)}),pe("span",{className:"wp-header-address-copy","data-copied":I,children:I?pe(Tn,{size:14}):pe(po,{size:14})})]})]})]}),dn("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio","data-track":"refresh",onClick:ne,children:[pe(Ls,{className:W?"wp-spin-once":void 0}),C&&pe("span",{className:"wp-refresh-badge",children:D})]})]}),pe("div",{className:"wp-body",children:dn("div",{className:"wp-body-inner","data-empty":Q||void 0,children:[x("rewards")&&pe(zs,{}),x("points")&&pe(Zs,{}),x("staking")&&pe(rl,{}),x("gameSwap")&&pe(cl,{}),x("forge")&&pe(fl,{}),x("crossdPool")&&pe(El,{}),we&&pe("div",{className:"wp-portfolio-loading",role:"status","aria-label":"Loading portfolio",children:pe("span",{className:"wp-portfolio-spinner","aria-hidden":!0})}),Q&&dn("div",{className:"wp-portfolio-empty",role:"status",children:[pe("span",{className:"wp-portfolio-empty-icon","aria-hidden":!0,children:dn("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[pe("path",{d:"M20 7H5a2 2 0 0 1-2-2 2 2 0 0 1 2-2h13v4"}),pe("path",{d:"M3 5v13a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1"}),pe("circle",{cx:"16.5",cy:"13.5",r:"1",fill:"currentColor",stroke:"none"})]})}),pe("p",{className:"wp-portfolio-empty-title",children:"No assets yet"}),pe("p",{className:"wp-portfolio-empty-desc",children:"Assets you hold across CROSS services will appear here."})]})]})})]});return pe(wo.Provider,{value:re,children:pe(xi.Provider,{value:E,children:pe(he,{feature:"wallet_portfolio",children:a==="none"?We:pe("div",{className:me(a==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:We})})})})}import{jsx as Li,jsxs as Il}from"react/jsx-runtime";function Pl({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s}=Te();return Il(vr.Portal,{children:[Li(vr.Overlay,{className:"wp-overlay"}),Il(vr.Content,{className:me("wp-fullscreen",e),"data-theme":n,children:[Li(vr.Title,{className:"wp-sr-only",children:"Portfolio"}),Li(Jn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s})]})]})}import{jsx as Ll}from"react/jsx-runtime";function vf({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:p,currencySymbol:h,children:b}){let u=_e(e),v=o!==void 0,[g,m]=Mn.useState(!1),x=v?o:g,C=Mn.useCallback(S=>{v||m(S),r?.(S)},[v,r]),d=Mn.useCallback(()=>C(!1),[C]),k=Mn.useMemo(()=>({env:u,theme:t,open:x,walletAddress:n,close:d,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:p,currencySymbol:h}),[u,t,x,n,d,i,a,s,c,l,p,h]);return Ll(wo.Provider,{value:k,children:Ll(xf.Root,{direction:"bottom",open:x,onOpenChange:C,noBodyStyles:!0,children:b})})}var _l=Object.assign(vf,{Trigger:Es,Content:Pl});import*as B from"react";import{createPortal as eo}from"react-dom";import Zt from"bignumber.js";import{jsx as _t,jsxs as yf}from"react/jsx-runtime";function Al({size:e=20,className:t}){return yf("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:[_t("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),_t("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function Fl({size:e=16,className:t}){return _t("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_t("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 Bl({size:e=16,className:t}){return _t("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_t("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 Ml({size:e=20,className:t}){return _t("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_t("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Dl({size:e=16,className:t}){return _t("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:_t("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ol({size:e=12,className:t}){return _t("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_t("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"})})}import*as L from"react";import Gl from"bignumber.js";function Wl(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ul(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,Gl.ROUND_DOWN).toFixed()}function kf(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 Sf(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new Gl(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Wl(t)&&Wl(n)?e.lastChangedBy==="to"?{fromAmount:Ul(r.multipliedBy(n).dividedBy(t))}:{toAmount:Ul(r.multipliedBy(t).dividedBy(n))}:kf(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function zl({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):Sf(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var $l=15,Rf=18,ql="cross_bridge_terms_accepted",Cf=3600*24*365;function Tf(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,$l);let r=t.slice(0,o).slice(0,$l),i=t.slice(o+1).slice(0,Rf);return`${r}.${i}`}function Nf(){return typeof document>"u"?!1:document.cookie.split(";").map(e=>e.trim()).some(e=>e===`${ql}=true`)}function Ef(){if(typeof document>"u")return;let e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=[`${ql}=true`,"Path=/",`Max-Age=${Cf}`,"SameSite=Lax",e].filter(Boolean).join("; ")}function If(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 Hl(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function Pf(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([Hl(e.symbol),Hl(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function zt(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function yr(e){return e[0]}function _i(e,t,n,o){if(n&&!zt(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??yr(e);let i=e.findIndex(s=>zt(s,t)),a=i>=0?e[i+1]:void 0;return a&&!zt(a,t)?a:e.find(s=>!zt(s,t))??t}function jl({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:i}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:i}}function kr(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),...kr(n.cause,t+1),...kr(n.data,t+1),...kr(n.error,t+1)]}function Ai(e){let t=kr(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 Vl(e,t){return Ai(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
9
- `)[0]?.trim()||t}function Kl(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:i,approveBridge:a,history:s=[],initialSlippage:c="1",termsUrl:l=jn,getQuote:p,submitBridge:h,onSubmitted:b,onSuccess:u,onFailed:v,onExit:g}=e,m=L.useMemo(()=>zl({getQuote:p,submitBridge:h}),[p,h]),[x,C]=L.useState("form"),[d,k]=L.useState(n??yr(t)),[S,N]=L.useState(()=>_i(t,n??yr(t),o,r)),[R,E]=L.useState(""),[D,H]=L.useState(""),[W,j]=L.useState("from"),[I,te]=L.useState(c),[F,A]=L.useState(null),ne=L.useMemo(()=>Pf(d,S),[d,S]),q=L.useMemo(()=>ne?"1":I==="auto"?If(F?.priceImpact):I,[ne,I,F?.priceImpact]),[M,de]=L.useState(""),[re,z]=L.useState("idle"),[ke,Q]=L.useState(""),[fe,we]=L.useState(null),[We,K]=L.useState([]),[be,Be]=L.useState(!1),[Me,At]=L.useState(Nf),[ge,Ze]=L.useState(null),[rt,De]=L.useState(!1),[Le,Ue]=L.useState(null),[en,it]=L.useState(null),[kt,He]=L.useState(!1),[Ft,St]=L.useState(!1),Se=L.useRef(0),$t=L.useRef(null),Ht=L.useRef(!1),at=L.useRef(!1),je=L.useRef(!1),st=L.useRef(!1),Xe=L.useRef(!1);L.useEffect(()=>{Ht.current||(Ht.current=!0,ve("bridge","opened"))},[]);let Ve=L.useCallback(()=>{$t.current&&(clearTimeout($t.current),$t.current=null)},[]),Re=L.useCallback(O=>{Ve(),it(O)},[Ve]);L.useEffect(()=>Ve,[Ve]),L.useEffect(()=>{let O=t.find(Ie=>zt(Ie,d))??yr(t),le=O?r?.(O,t):void 0,V=le?.find(Ie=>zt(Ie,S))??(le?void 0:t.find(Ie=>zt(Ie,S)))??_i(t,O,void 0,r);k(O),N(V)},[r,t,d,S]);let gt=L.useCallback((O,le)=>{let V=Tf(O);if(!V){Se.current+=1,E(""),H(""),j(le),A(null),de(""),z("idle");return}le==="from"?E(V):H(V),j(le),de(""),!je.current&&Number(V)>0&&(je.current=!0,ve("bridge","amount_entered"))},[]),lt=L.useCallback(()=>{Se.current+=1,E(""),H(""),j("from"),A(null),de(""),Q(""),z("idle"),Ze(null),De(!1),Ue(null),He(!1),Re(null)},[Re]),Je=L.useCallback(O=>{zt(O,d)||(at.current||(at.current=!0,ve("bridge","token_selected",{tags:{item_id:`from:${O.symbol}`}})),k(O),N(_i(t,O,void 0,r)),lt())},[d,r,lt,t]),Rt=L.useCallback(O=>{zt(O,S)||zt(O,d)||(at.current||(at.current=!0,ve("bridge","token_selected",{tags:{item_id:`to:${O.symbol}`}})),N(O),lt())},[d,lt,S]),tn=L.useMemo(()=>d?r?.(d,t)??t.filter(O=>!zt(O,d)):[],[d,r,t]),pn=L.useCallback(()=>{d?.balance&&gt(d.balance,"from")},[d?.balance,gt]),nn=L.useCallback(()=>{!d||!S||(k(S),N(d),lt())},[d,lt,S]),P=L.useCallback(()=>{Se.current+=1,E(""),H(""),j("from"),A(null),de(""),Q("")},[]);L.useEffect(()=>{if(!d||!S)return;if(!R&&!D){A(null),de(""),z(V=>V==="quoting"?"idle":V);return}let O=++Se.current,le=jl({fromToken:d,toToken:S,fromAmount:R,toAmount:D,lastChangedBy:W,slippage:I});z(V=>V==="submitting"?V:m.canQuote?"quoting":"idle"),(async()=>{try{let V=await m.getQuote(le);if(Se.current!==O)return;V.fromAmount!==void 0&&W==="to"&&E(V.fromAmount),V.toAmount!==void 0&&W==="from"&&H(V.toAmount),A(V.summary??null),de(V.error??"")}catch(V){if(Se.current!==O)return;de(V instanceof Error?V.message:"Failed to quote bridge.")}finally{Se.current===O&&z(V=>V==="quoting"?"idle":V)}})()},[R,d,W,m,I,D,S]);let Z=L.useCallback(()=>!d||!S?null:jl({fromToken:d,toToken:S,fromAmount:R,toAmount:D,lastChangedBy:W,slippage:q}),[q,R,d,W,D,S]),se=L.useCallback(async(O,le)=>{Q(""),He(!1),De(!1),z("submitting");try{if(!le?.skipApprovalCheck&&i){let Ie=await i(O);if(Ie){Ze(Ie),Ue(O),z("idle");return}}Ze(null),Ue(null),Re("processing");let V=await m.submitBridge(O);we(V),z("success"),K(Ie=>[{id:V.txHash,timestamp:new Date().toISOString(),txHash:V.txHash,fromToken:V.fromToken,toToken:V.toToken,fromAmount:V.fromAmount,toAmount:V.toAmount,summary:F??void 0,status:"pending"},...Ie.filter(Po=>Po.txHash!==V.txHash)]),P(),St(!0),Re(null),He(!0),ve("bridge","confirmed"),st.current=!1,Xe.current=!1,b?.(V),u?.(V)}catch(V){if(Re(null),ve("bridge","confirmed",{status:"failure",reason:bt(V)}),st.current=!1,Xe.current=!1,Ai(V)){z("idle");return}let Ie=Vl(V,"Failed to submit bridge.");Q(Ie),z("error"),v?.({message:Ie})}},[i,v,b,u,m,P,Re,F]),ct=L.useCallback(async()=>{if(M)return;let O=Z();if(O){if(st.current||(st.current=!0,ve("bridge","submitted")),!Me){Ue(O),Be(!0);return}await se(O)}},[Z,M,se,Me]),on=L.useCallback(async()=>{let O=Le??Z();O&&(Ef(),At(!0),Be(!1),await se(O))},[Z,Le,se]),ht=L.useCallback(()=>{Be(!1),Ue(null)},[]),No=L.useCallback(async()=>{if(!(re==="submitting"||!ge||!Le||!a)){Q(""),z("submitting");try{await a(Le,ge),Xe.current||(Xe.current=!0,ve("bridge","approved")),Ze(null),z("idle"),De(!0)}catch(O){if(Ai(O)){z("idle");return}let le=Vl(O,"Failed to approve token.");Q(le),z("error"),v?.({message:le})}}},[ge,a,v,Le,se,re]),Sn=L.useCallback(()=>{re!=="submitting"&&(Ze(null),De(!1),Ue(null),z("idle"))},[re]),Eo=L.useCallback(async()=>{if(re==="submitting")return;let O=Le??Z();if(!O){De(!1),Q("Bridge input is no longer available. Please try again."),z("error");return}De(!1),await se(O,{skipApprovalCheck:!0})},[Z,Le,se,re]),Dr=L.useCallback(()=>{He(!1)},[]),ro=L.useCallback(O=>{C(O),O==="history"&&St(!1)},[]),Ct=L.useCallback(()=>{if(x==="history"){ro("form");return}g?.()},[g,ro,x]),Io=L.useMemo(()=>[...s,...We.filter(O=>!s.some(le=>le.txHash===O.txHash))],[s,We]);return{step:x,setStep:ro,status:re,error:ke,quoteError:M,fromToken:d,toToken:S,tokens:t,availableToTokens:tn,fromAmount:R,toAmount:D,lastChangedBy:W,slippage:I,effectiveSlippage:q,slippageLocked:ne,setSlippage:te,summary:F,history:Io,submitted:fe,canSubmit:m.canSubmit,termsOpen:be,approvalInfo:ge,approvalSuccessOpen:rt,approveBridge:a,pendingSubmitInput:Le,submitToast:en,successDialogOpen:kt,dismissSuccessDialog:Dr,hasNewHistory:Ft,termsUrl:l,setFromToken:k,setToToken:N,selectFromToken:Je,selectToToken:Rt,setAmount:gt,setMax:pn,swapTokens:nn,submit:ct,confirmTerms:on,cancelTerms:ht,confirmApproval:No,cancelApproval:Sn,continueAfterApproval:Eo,back:Ct}}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
- `);import{Fragment as Bi,jsx as f,jsxs as T}from"react/jsx-runtime";var ec=B.createContext(void 0);function to(){return B.useContext(ec)}function Lf(e){let[t,n]=B.useState(void 0);return B.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let a=o.closest("[data-theme]");n(a?.getAttribute("data-theme")??void 0)};r();let i=new MutationObserver(r);return i.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>i.disconnect()},[e]),t}var Yl=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],_f=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Af(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Ql(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 Ff(e){return`${e.chainId}:${e.address.toLowerCase()}`}function tc(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Zl(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 Bf(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 Mf(e,t){if(!t)return!1;let n=new Zt(e||"0"),o=new Zt(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Df(e){if(e.priceUsd===void 0)return null;let t=new Zt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Of(e){if(e.priceUsd===void 0)return null;let t=new Zt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function nc(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,Zt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),i=new Zt(o||"0").toFormat(0);return r?`${i}.${r}`:i}function Wf(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function Uf(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 Gf(e){let t=new Zt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":nc(t)}function zf(e,t){if(t?.priceUsd===void 0)return null;let n=new Zt(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 $f(e,t){return t==="all"?!0:Rr(e)===t}function Hf(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Xl(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function oc(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function rc(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":oc(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function ic(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function Sr(e){return!e||e==="0"||Number(e)===0}function jf(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 Vf(e){let t=e.fromToken,n=e.toToken,o=rc(t,n),r=e.fromAmount||"0",i=e.toAmount||"0",a=o!==void 0&&!ic(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:a?[{label:"Route",value:t&&n?`${Xl(t.chainId)} \u2192 ${Xl(n.chainId)}`:"-"},{label:"Validator Fee",value:Sr(r)?"0":"Free",tone:Sr(r)?"default":"accent"},{label:"Network Fee",value:Sr(r)?"0":"Free",tone:Sr(r)?"default":"accent"}]:void 0,swapInfo:s?[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:i,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 yo({token:e,size:t=20}){let n=e?.iconUrl;return f("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?f("img",{src:n,alt:"",width:t,height:t,draggable:!1}):f("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function Jl({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:i,locked:a=!1}){return T("section",{className:"bf-amount-panel",children:[T("div",{className:"bf-amount-head",children:[f("span",{children:e}),T("span",{className:"bf-balance",children:[tc(t?.balance??"0")," ",t?.symbol??""]})]}),T("div",{className:"bf-amount-main",children:[T("label",{className:"bf-amount-input-wrap",children:[T("span",{className:"bf-sr-only",children:[e," amount"]}),f("input",{type:"text",inputMode:"decimal",value:n,onChange:s=>r(s.target.value),placeholder:"0",className:"bf-amount-input"}),f("span",{className:"bf-amount-usd",children:o})]}),T("button",{type:"button",className:"bf-token-pill",onClick:a?void 0:i,disabled:!a&&!i,"data-locked":a?"true":void 0,"data-track":a?void 0:"token_select_open","data-track-id":e.toLowerCase(),"aria-label":`Select ${e.toLowerCase()} token`,children:[f(yo,{token:t}),f("span",{children:t?.symbol??"Select"}),!a&&f(En,{size:16})]})]})]})}function qf({flow:e,side:t,onClose:n}){let o=B.useId(),[r,i]=B.useState(""),[a,s]=B.useState(null),c=to(),l=t==="from"?e.fromToken:e.toToken;B.useEffect(()=>{s(document.body)},[]),B.useEffect(()=>{let u=v=>{v.key==="Escape"&&n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let p=B.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),h=B.useMemo(()=>{let u=r.trim().toLowerCase();return u?p.filter(v=>v.symbol.toLowerCase().includes(u)||v.name.toLowerCase().includes(u)):p},[r,p]),b=B.useCallback(u=>{t==="from"?e.selectFromToken(u):e.selectToToken(u),n()},[e,n,t]);return a?eo(f("div",{className:"bf-token-picker-overlay","data-theme":c,role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&n()},children:T("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[f("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),T("header",{className:"bf-token-picker-head",children:[f("h3",{id:o,children:"Select a token"}),f("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:f(jt,{size:24})})]}),T("label",{className:"bf-token-search",children:[f(Al,{size:20}),f("span",{className:"bf-sr-only",children:"Search tokens"}),f("input",{value:r,onChange:u=>i(u.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),T("div",{className:"bf-token-list",children:[h.map(u=>{let v=oc(u,l),g=v?Of(u):Df(u);return T("button",{type:"button",className:"bf-token-row","data-selected":v?"true":"false",onClick:()=>b(u),children:[T("span",{className:"bf-token-row-left",children:[f(yo,{token:u,size:40}),T("span",{className:"bf-token-meta",children:[f("span",{className:"bf-token-symbol",children:u.symbol}),!v&&f("span",{className:"bf-token-name",children:u.name})]})]}),T("span",{className:"bf-token-row-right",children:[T("span",{className:"bf-token-balance",children:[tc(u.balance),v?null:` ${u.symbol}`]}),g&&f("span",{className:"bf-token-price",children:g})]})]},Ff(u))}),h.length===0&&f("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),a):null}function Kf({flow:e,onClose:t}){let n=B.useId(),[o,r]=B.useState(null),i=Yl.find(g=>g.value===e.slippage),[a,s]=B.useState(e.slippage&&!i?e.slippage:""),c=a.trim()!==""&&a.trim()!==".",l=c?Number(a):NaN,p=Number.isFinite(l)&&l>50,h=Number.isFinite(l)&&l>5&&!p,b=g=>{e.setSlippage(g),t()},u=()=>{!c||p||(e.setSlippage(Ql(a)),t())};if(B.useEffect(()=>{r(document.body)},[]),B.useEffect(()=>{let g=m=>{m.key==="Escape"&&t()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t]),!o)return null;let v=to();return eo(f("div",{className:"bf-slippage-overlay","data-theme":v,role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:T("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[T("header",{className:"bf-slippage-head",children:[f("h3",{id:n,children:"Slippage Settings"}),f("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:f(jt,{size:24})})]}),T("div",{className:"bf-slippage-body",children:[f("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."}),T("div",{className:"bf-slippage-controls",children:[f("div",{className:"bf-slippage-presets",children:Yl.map(g=>f("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===g.value?"true":"false",onClick:()=>b(g.value),children:g.label},g.value))}),T("label",{className:"bf-slippage-custom","data-selected":c?"true":"false",children:[f("span",{className:"bf-sr-only",children:"Custom slippage percent"}),f("input",{value:a,onChange:g=>{s(Ql(g.target.value))},onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),u())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),f("span",{"aria-hidden":"true",children:"%"})]})]}),p?f("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):h?f("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,c&&f("button",{type:"button",className:"bf-slippage-apply",onClick:u,disabled:p,children:"Apply"})]})]})}),o)}function Yf({flow:e}){let t=B.useId(),[n,o]=B.useState(!1),[r,i]=B.useState(null),a=to();return B.useEffect(()=>{i(document.body)},[]),B.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:eo(f("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:T("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[f("h3",{id:t,children:"Agree to Terms of Service"}),f("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),T("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[f("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,"aria-label":"Agree to Terms of Use","data-track":"terms_check",onClick:()=>o(s=>!s),children:f("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"})}),T("div",{className:"bf-terms-copy",children:[f("span",{className:"bf-terms-label",children:"Agree to Terms of Use"}),e.termsUrl&&f("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]})]}),f("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),f("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,"data-track":"terms_confirm",children:"Confirm"})]})}),r)}function Qf({value:e,disabled:t=!1}){let[n,o]=B.useState(!1);return f("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 Zf({flow:e,approval:t}){let n=B.useId(),[o,r]=B.useState(null),i=to();if(B.useEffect(()=>{r(document.body)},[]),B.useEffect(()=>{let c=l=>{e.status!=="submitting"&&l.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]),!o)return null;let a=e.status==="submitting"||!e.approveBridge,s=e.status==="submitting";return eo(f("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",children:T("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[T("h3",{id:n,children:["Approve ",t.token.symbol]}),f(yo,{token:t.token,size:72}),T("div",{className:"bf-approve-address-box",children:[f("span",{children:"Token Address"}),T("div",{children:[f("strong",{children:t.tokenAddress}),f(Qf,{value:t.tokenAddress,disabled:s})]})]}),T("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),T("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:a,"aria-busy":s,"data-track":"approve_confirm",children:[s&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function Xf({flow:e}){let t=B.useId(),[n,o]=B.useState(null),r=to();if(B.useEffect(()=>{o(document.body)},[]),B.useEffect(()=>{if(!e.approvalSuccessOpen)return;let a=s=>{s.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.approvalSuccessOpen)return null;let i=e.status==="submitting";return eo(f("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:T("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[f("h3",{id:t,children:"Approval Success"}),f("span",{className:"bf-success-mark","aria-hidden":"true"}),T("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",f("br",{}),"Please continue to the next step."]}),T("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:i,children:"Cancel"}),T("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,disabled:i,"aria-busy":i,children:[i&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:i?"Continuing...":"Continue"})]})]})]})}),n)}function Jf({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,i]=B.useState(!1),a=B.useMemo(()=>{let l=new Zt(e||"0"),p=new Zt(t||"0");return!l.isFinite()||!p.isFinite()||l.lte(0)||p.lte(0)?null:r?l.dividedBy(p):p.dividedBy(l)},[e,r,t]);if(!a||!n||!o||n.symbol===o.symbol)return null;let s=r?o.symbol:n.symbol,c=r?n.symbol:o.symbol;return T("button",{type:"button",className:"bf-exchange-rate",onClick:()=>i(l=>!l),"data-track":"rate_reverse",children:[T("span",{children:["1 ",s]}),f(Ol,{size:12}),T("span",{children:[nc(a)," ",c]})]})}function em({flow:e}){return e.submitToast?T("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[f("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:f("span",{className:"bf-status-spinner"})}),T("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Transaction Processing"}),f("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function tm({message:e}){let[t,n]=B.useState(!1);return B.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:T("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[f("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:f("span",{className:"bf-status-error-mark",children:"!"})}),T("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Error"}),f("span",{children:e})]})]})}function nm(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 om({flow:e}){let t=B.useId(),[n,o]=B.useState(null),r=e.submitted,i=to();return B.useEffect(()=>{o(document.body)},[]),B.useEffect(()=>{if(!e.successDialogOpen)return;let a=s=>{s.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.successDialogOpen||!r?null:eo(f("div",{className:"bf-success-overlay","data-theme":i,role:"presentation",children:f("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:T("div",{className:"bf-success-body",children:[f("span",{className:"bf-success-mark","aria-hidden":"true"}),T("div",{className:"bf-success-copy",children:[f("strong",{id:t,children:nm(r.pathType)}),f("span",{children:"Please check the results in the history."})]}),f("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((a,s)=>T(B.Fragment,{children:[s>0&&f("span",{className:"bf-success-route-arrow",children:"\u2192"}),f(Fi,{token:a,size:43})]},`${a.symbol}-${s}`))}),f("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,"data-track":"success_ok",children:"OK"})]})})}),n)}function Fi({token:e,size:t=16}){let n=!!e.iconUrl;return f("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?f("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):f("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function rm({row:e}){return e.routeTokens&&e.routeTokens.length>0?f("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>T(B.Fragment,{children:[n>0&&f("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),f(Fi,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?T("span",{className:"bf-info-value-token",children:[f(Fi,{token:e.valueToken}),f("span",{children:e.value})]}):f(Bi,{children:e.value})}function ac({rows:e}){return!e||e.length===0?null:f("div",{className:"bf-info-rows",children:e.map((t,n)=>T("div",{className:"bf-info-row",children:[T("span",{className:"bf-info-label",children:[f("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),f("span",{children:t.label})]}),f("span",{className:"bf-info-value","data-tone":t.tone??"default",children:f(rm,{row:t})})]},`${t.label}-${t.value}`))})}function im(e,t,n){return e.pathType==="bridge"?"Bridge Info":ic(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function am({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return f(Bi,{children:r.map(i=>{let a=i==="swap"?e.swapInfo:e.bridgeInfo;return a?.length?T("div",{className:"bf-info-section",children:[o&&f("h4",{children:i==="swap"?"Swap Info":"Bridge Info"}),f(ac,{rows:a})]},i):null})})}function sm({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=im(e,t,n),[i,a]=B.useState(!0),[s,c]=B.useState(!0);return T("div",{className:"bf-details",children:[e.liquidity&&T("section",{className:"bf-liquidity",children:[T("div",{className:"bf-liquidity-head",children:[f("span",{children:e.liquidity.label??"Available Liquidity"}),f("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),f("div",{className:"bf-liquidity-track",children:f("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&T("section",{className:"bf-detail-section bf-info-card","data-open":i?"true":"false",children:[T("button",{type:"button",className:"bf-collapse-head","aria-expanded":i,onClick:()=>a(l=>!l),"data-track":"details_toggle",children:[f("h3",{children:r}),f(En,{size:16,className:"bf-collapse-chevron"})]}),i&&f("div",{className:"bf-collapse-body",children:f(am,{summary:e})})]}),o&&T("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[T("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>c(l=>!l),"data-track":"details_toggle",children:[f("h3",{children:"Est. Tx Fee"}),T("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&f("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&f("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),f("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:Bf(e.txFeeInfo?.estTxFee??"0")}),f(En,{size:16,className:"bf-collapse-chevron"})]})]}),s&&f("div",{className:"bf-collapse-body",children:f(ac,{rows:e.txFee})})]})]})}function lm({item:e}){let t=Rr(e),n=zf(e.fromAmount,e.fromToken);return T("article",{className:"bf-history-item",children:[T("div",{className:"bf-history-item-head",children:[f("span",{className:"bf-history-status","data-status":t,children:Hf(t)}),f("time",{className:"bf-history-time",dateTime:e.timestamp,children:Uf(e.timestamp)})]}),T("div",{className:"bf-history-item-body",children:[T("strong",{className:"bf-history-amount",children:[Gf(e.fromAmount)," ",e.fromToken.symbol]}),T("div",{className:"bf-history-meta",children:[f("span",{className:"bf-history-usd",children:n??Wf(e.txHash)}),T("span",{className:"bf-history-route",children:[T("span",{className:"bf-history-route-token",children:[f(yo,{token:e.fromToken,size:16}),f("span",{children:e.fromToken.symbol})]}),f(Dl,{size:16,className:"bf-history-route-arrow"}),T("span",{className:"bf-history-route-token",children:[f(yo,{token:e.toToken,size:16}),f("span",{children:e.toToken.symbol})]})]})]})]})]})}function cm({flow:e}){let[t,n]=B.useState("all"),o=e.history.some(a=>Rr(a)==="pending"),r=e.history.filter(a=>$f(a,t)),i=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return T("main",{className:"bf-history-body",children:[f("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:_f.map(a=>T("button",{type:"button",className:"bf-history-tab","data-active":t===a.value?"true":"false",onClick:()=>n(a.value),"data-track":"history_filter","data-track-id":a.value,children:[f("span",{children:a.label}),a.value==="pending"&&o&&f("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},a.value))}),r.length>0?f("div",{className:"bf-history-list",children:r.map(a=>f(lm,{item:a},a.id||a.txHash))}):f("div",{className:"bf-empty",children:i})]})}function dm({flow:e,env:t}){let[n,o]=B.useState(null),[r,i]=B.useState(!1),[a,s]=B.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??Vf(e):null,p=Ln("apps.json",t,d=>Pn(d?.bridgePoweredBy?.url,t)),h=jf(e.quoteError),b=Mf(e.fromAmount,e.fromToken),u=b?"Insufficient balance":h.from,v=e.quoteError&&!h.from&&!h.to?e.quoteError:"",g=e.error||v,m=e.history.some(d=>Rr(d)==="pending"),C=(l?.pathType??rc(e.fromToken,e.toToken))!=="bridge";return T(Bi,{children:[T("main",{className:"bf-body",children:[T("div",{className:"bf-toolbar",children:[T("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),"data-track":"history_open",children:[f(Fl,{}),f("span",{children:"History"}),(m||e.hasNewHistory)&&f("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),C&&T("button",{type:"button",className:"bf-chip",onClick:()=>i(!0),"data-track":"slippage_open",disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[f(Bl,{}),f("span",{children:e.slippageLocked?"Auto 1%":Af(e.slippage,e.effectiveSlippage)})]})]}),T("div",{className:"bf-swap-card","data-has-from-error":u?"true":"false",children:[f(Jl,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Zl(e.fromAmount,e.fromToken),onAmountChange:d=>e.setAmount(d,"from"),onTokenClick:()=>o("from")}),u&&f("div",{className:"bf-field-error",children:u}),f("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(d=>d+360)},"data-track":"token_swap",style:{transform:`translateX(-50%) rotate(${a}deg)`,transition:"transform 0.2s ease"},children:f(Ml,{size:22})}),f(Jl,{label:"To",token:e.toToken,amount:e.toAmount,usd:Zl(e.toAmount,e.toToken),onAmountChange:d=>e.setAmount(d,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),h.to&&f("div",{className:"bf-field-error",children:h.to})]}),f(Jf,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&f(sm,{summary:l})]}),T("footer",{className:"bf-footer",children:[f("button",{type:"button",className:"bf-next",onClick:e.submit,"data-track":"next",disabled:e.status==="submitting"||!!e.quoteError||b,children:e.status==="submitting"?"Processing...":"Next"}),p&&T("a",{className:"bf-powered",href:p,target:"_blank",rel:"noreferrer",children:["Powered by ",f("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&f(qf,{flow:e,side:n,onClose:()=>o(null)}),r&&f(Kf,{flow:e,onClose:()=>i(!1)}),f(Yf,{flow:e}),e.approvalInfo&&f(Zf,{flow:e,approval:e.approvalInfo}),f(Xf,{flow:e}),f(em,{flow:e}),f(tm,{message:e.submitToast?"":g}),f(om,{flow:e})]})}function Cr({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let i=B.useMemo(()=>_e(n),[n]),a=Kl({...r,onExit:t}),s=B.useRef(null),c=Lf(s),l=a.step==="history"?"History":"Swap & Bridge";return f(he,{feature:"bridge",children:f(ec.Provider,{value:c,children:T("div",{ref:s,className:me("bf-root",o),"data-view":a.step,"data-status":a.status,children:[T("header",{className:"bf-header",children:[f("button",{type:"button",className:"bf-header-btn",onClick:a.back,"aria-label":"Back",children:f(Nn,{size:24})}),f("span",{className:"bf-header-title",children:l}),f("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:f(jt,{size:24})})]}),a.step==="history"?f(cm,{flow:a}):f(dm,{flow:a,env:i})]})})})}import{Fragment as Di,jsx as w,jsxs as _}from"react/jsx-runtime";var um="On-ramp is not available in your region.";function Mi(e,t,n){let o=ye[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 fm(e){return parseInt(e.split(":")[1],10)}function mm(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 gm(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function hm(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 sc({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:i,isMobile:a,open:s,drawerDirection:c,modal:l,showBalance:p,showForgeToken:h,showGameToken:b,showQR:u,showBridge:v,qrLogoSrc:g,walletAddress:m,accountName:x,sendAccounts:C,profileImageUrl:d,preferredTokens:k,close:S,onSelectWallet:N,onCopyAddress:R,onBuy:E,onDisconnect:D,disconnectLabel:H,termsUrl:W,termsLabel:j,privacyUrl:I,privacyLabel:te,portalStyle:F,navContent:A,navPosition:ne,footerContent:q,view:M,setView:de,selectedSendToken:re,setSelectedSendToken:z,showPortfolio:ke,portfolioTitle:Q,portfolioSections:fe,showTotalAssets:we,totalAssetsLabel:We,sendTransaction:K,getTransactionReceipt:be,estimateGas:Be,onOutlink:Me,lpBalanceReader:At,stakingRewardsReader:ge,bridgeTokens:Ze,bridgeHistory:rt,getBridgeQuote:De,getBridgeToTokens:Le,getBridgeApproval:Ue,approveBridge:en,submitBridge:it,onReceive:kt,onSend:He,onBuyDisabledMessage:Ft,onBridgeDisabledMessage:St,onSendDisabledMessage:Se}=un(),[$t,Ht]=$.useState(null),at=$.useRef(void 0),je=$.useCallback(y=>{Ht(y),clearTimeout(at.current),at.current=setTimeout(()=>Ht(null),4e3)},[]);$.useEffect(()=>()=>clearTimeout(at.current),[]);let st=!!Ft,Xe=$.useCallback(()=>{if(st){je(Ft);return}let y=E?.();y&&typeof y.then=="function"&&y.catch(()=>{je(Ft??um)})},[st,Ft,E,je]),Ve=!!St,Re=!!Se,{tokens:gt,isLoading:lt}=hn(r,m,s&&p),{statsMap:Je}=bn(r,p),{aprPercent:Rt}=ks(),{categoryMap:tn}=Ss(r,p),pn=p&&we,{displayValue:nn,isLowerBound:P,isLoading:Z}=Rs(r,m,s&&pn),[se,ct]=$.useState(!1),on=$.useRef(null),[ht,No]=$.useState(0),{holdings:Sn,isLoading:Eo}=vs(r,m,s&&p&&h),Dr=$.useMemo(()=>Sn.map(y=>y.token),[Sn]),{imageMap:ro}=ys(r,Dr,h&&Sn.length>0),Ct=$.useMemo(()=>{let y=[],G=[],ie=[],et=new Map((k??[]).map((ue,qe)=>[`${fm(ue.chainId)}:${ue.address.toLowerCase()}`,qe]));for(let ue of gt){let qe=Mi(r,ue.chainId,ue.symbol)!==void 0,Mt=`${ue.chainId}:${ue.address.toLowerCase()}`,Rn=et.get(Mt),jr=new ko(ue.quantity.numeric).shiftedBy(-ue.quantity.decimals);if(qe)y.push(ue);else if(Rn!==void 0)G.push(ue);else if(jr.isGreaterThan(0)){if(!b&&tn.get(gi(ue.chainId,ue.address))==="game")continue;ie.push(ue)}}return y.sort((ue,qe)=>{let Mt=Mi(r,ue.chainId,ue.symbol)??99,Rn=Mi(r,qe.chainId,qe.symbol)??99;return Mt-Rn}),G.sort((ue,qe)=>{let Mt=et.get(`${ue.chainId}:${ue.address.toLowerCase()}`)??99,Rn=et.get(`${qe.chainId}:${qe.address.toLowerCase()}`)??99;return Mt-Rn}),ie.sort((ue,qe)=>{let Mt=Je.get(Ut(ue.chainId,ue.address)),Rn=Je.get(Ut(qe.chainId,qe.address)),jr=new ko(ue.quantity.numeric).shiftedBy(-ue.quantity.decimals).multipliedBy(Mt?.price??0);return new ko(qe.quantity.numeric).shiftedBy(-qe.quantity.decimals).multipliedBy(Rn?.price??0).minus(jr).toNumber()}),[...y,...G,...ie]},[gt,r,Je,b,tn,k]),Io=$.useMemo(()=>{if(!h)return[];let y=new Set(gt.map(G=>G.address.toLowerCase()));return[...Sn].filter(G=>!y.has(G.token.toLowerCase())).sort((G,ie)=>{let et=new ko(G.value);return new ko(ie.value).minus(et).toNumber()})},[Sn,h,gt]),O=$.useRef(!1),[le,V]=$.useState(null),Ie=$.useRef(void 0),Po=le?.chainId??re?.chainId??Ct[0]?.chainId??0,{transactionUrl:Or}=Vo(r,Po,le?.txHash,!!(le?.txHash&&Po)),Bt=$.useCallback(y=>{O.current=!0,de(y)},[de]),[Dc,Wr]=$.useState("recipient"),Lo=$.useCallback(()=>{z(null),Wr("recipient"),Bt("wallet")},[z,Bt]),Ur=$.useCallback((y,G="recipient")=>{if(Re){je(Se);return}Wr(G),z(y),Bt("send")},[Re,Se,je,z,Bt]),_o=Ln("apps.json",r,y=>Pn(y?.gametokenBridge,r)),$i=Ln("apps.json",r,y=>y?.gametokenSites),Oc=$.useCallback(()=>{if(Ve){je(St);return}if(_o){if(mm($i)){window.location.assign(_o);return}window.open(_o,"_blank","noopener,noreferrer")}},[Ve,St,_o,$i,je]),Wc=$.useCallback(y=>{clearTimeout(Ie.current),z(null),Bt("wallet"),V({status:"pending",txHash:y.txHash,chainId:y.chainId,description:`${y.amount} ${y.tokenSymbol} to ${xt(y.recipient)}`})},[z,Bt]),Uc=$.useCallback(y=>{let G=re?.chainId;z(null),Bt("wallet"),!(!y||!G)&&(V(ie=>({status:"success",txHash:y,chainId:G,description:ie?.txHash===y?ie.description:"Tap to see your transaction"})),clearTimeout(Ie.current),Ie.current=setTimeout(()=>V(null),5e3))},[re?.chainId,z,Bt]),Gc=$.useCallback(y=>{let G=y.txHash;G&&(V({status:"error",txHash:G,chainId:y.chainId,description:y.message}),clearTimeout(Ie.current),Ie.current=setTimeout(()=>V(null),5e3))},[]),io=$.useMemo(()=>{if(kt)return kt;if(u)return()=>Bt("qr")},[kt,u,Bt]),Gr=$.useMemo(()=>{if(He)return He;if(Ct.length===0)return;let y=Ct[0];return()=>Ur(y,"token")},[He,Ct,Ur]),zc=$.useCallback(()=>{if(Re){je(Se);return}Gr?.()},[Re,Se,Gr,je]);$.useEffect(()=>{s||(O.current=!1,Wr("recipient"))},[s]);let Hi=$.useRef(null);$.useEffect(()=>{let y=Hi.current;if(!y||!a)return;let G=ie=>{ie.pointerType==="touch"&&ie.stopPropagation()};return y.addEventListener("pointerdown",G),()=>y.removeEventListener("pointerdown",G)},[a]);let[Dn,ji]=$.useState(!1),zr=$.useRef(void 0),[ao,so]=$.useState(!1);$.useEffect(()=>{if(!ao)return;let y=()=>so(!1),G=et=>{et.key==="Escape"&&so(!1)},ie=setTimeout(()=>{document.addEventListener("mousedown",y,!0),document.addEventListener("keydown",G,!0)},0);return()=>{clearTimeout(ie),document.removeEventListener("mousedown",y,!0),document.removeEventListener("keydown",G,!0)}},[ao]),$.useEffect(()=>{so(!1)},[m]),$.useEffect(()=>()=>clearTimeout(zr.current),[]),$.useEffect(()=>()=>clearTimeout(Ie.current),[]),$.useEffect(()=>{let y=on.current;if(!y||q===null){No(0);return}let G=()=>{No(y.offsetHeight)};if(G(),typeof ResizeObserver>"u")return;let ie=new ResizeObserver(G);return ie.observe(y),()=>ie.disconnect()},[q]);let Vi=$.useCallback(async()=>{if(!Dn)try{await navigator.clipboard.writeText(m),ji(!0),clearTimeout(zr.current),zr.current=setTimeout(()=>ji(!1),2e3),R?.(m,!0)}catch{R?.(m,!1)}},[m,R,Dn]),Ao=$.useCallback(y=>{y.currentTarget.setAttribute("data-loaded","true")},[]),qi=$.useMemo(()=>({background:hm(m)}),[m]),Fo=$.useMemo(()=>d||rn(r,m,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[d,r,m,i]),$r=$.useMemo(()=>gm(nn),[nn]),Ki=W||I?_("div",{className:"wi-legal-links",children:[W&&w("a",{className:"wi-legal-link",href:W,target:"_blank",rel:"noopener noreferrer","data-track":"terms_link",onClick:y=>Ge(y,W,{category:"terms",origin:"terms"},Me),children:j}),W&&I&&w("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),I&&w("a",{className:"wi-legal-link",href:I,target:"_blank",rel:"noopener noreferrer","data-track":"privacy_link",onClick:y=>Ge(y,I,{category:"privacy",origin:"privacy"},Me),children:te})]}):null,Yi=D?_("button",{type:"button",className:"wi-disconnect-btn","data-track":"disconnect",onClick:()=>{D(),S()},children:[w(Ea,{size:16}),w("span",{className:"wi-disconnect-label",children:H})]}):null,$c=p&&!A?_("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[_("button",{type:"button",className:me("wi-action-card",st&&"wi-action-card--dimmed"),onClick:Xe,disabled:!E&&!st,"aria-disabled":st||void 0,"aria-label":"Buy","data-track":"buy",children:[w(Fa,{size:20}),w("span",{children:"Buy"})]}),v?_("button",{type:"button",className:me("wi-action-card",Ve&&"wi-action-card--dimmed"),onClick:Oc,"aria-disabled":Ve||void 0,"aria-label":"Bridge","data-track":"bridge_open",children:[w(Ba,{size:20}),w("span",{children:"Bridge"})]}):_("button",{type:"button",className:"wi-action-card",onClick:io,disabled:!io,"aria-label":"Receive","data-track":"receive",children:[w(Ho,{size:20}),w("span",{children:"Receive"})]}),_("button",{type:"button",className:me("wi-action-card",Re&&"wi-action-card--dimmed"),onClick:zc,disabled:!Re&&!Gr,"aria-disabled":Re||void 0,"aria-label":"Send","data-track":"send_open",children:[w(_a,{size:20}),w("span",{children:"Send"})]}),ke?_("button",{type:"button",className:"wi-action-card",onClick:()=>Bt("portfolio"),"aria-label":"View portfolio","data-track":"portfolio_open",children:[w(Aa,{size:20}),w("span",{children:"Portfolio"})]}):v?_("button",{type:"button",className:"wi-action-card",onClick:io,disabled:!io,"aria-label":"Receive","data-track":"receive",children:[w(Ho,{size:20}),w("span",{children:"Receive"})]}):null]}):null,Hc=_("div",{className:me("wi-view-inner",O.current&&"wi-view-wallet"),children:[pn&&_("div",{className:"wi-total-section",children:[_("div",{className:"wi-total-head",children:[w("span",{className:"wi-total-label",children:We}),w("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:y=>{y.stopPropagation(),ct(G=>!G)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),ct(G=>!G))},"aria-label":se?"Show balance":"Hide balance","data-track":"balance_toggle",children:se?w(Pa,{}):w(Ia,{})})]}),w("div",{className:"wi-total-body",children:Z?w("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):w("div",{className:"wi-total-value","data-hidden":se||void 0,children:se?w("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):_(Di,{children:[P&&w("span",{className:"wi-total-lte",children:"\u2264"}),w("span",{className:"wi-total-currency",children:"$"}),w("span",{className:"wi-total-amount",children:$r.main}),$r.decimal&&w("span",{className:"wi-total-decimal",children:$r.decimal})]})})})]}),ne==="top"&&(A?w("div",{className:"wi-nav-fixed",children:A}):$c),p&&w("div",{ref:Hi,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:_("div",{className:"wi-token-list",children:[lt&&Array.from({length:5},(y,G)=>_("div",{className:"wi-skeleton-item",children:[_("div",{className:"wi-skeleton-left",children:[w("div",{className:"wi-skeleton-block wi-skeleton-icon"}),_("div",{className:"wi-skeleton-lines",children:[w("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),w("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),_("div",{className:"wi-skeleton-right",children:[w("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),w("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},G)),!lt&&Ct.length===0&&!h&&w("div",{className:"wi-empty",children:"No Tokens Found"}),Ct.map(y=>{let G=Je.get(Ut(y.chainId,y.address)),ie=G?parseFloat(G.percent_change_24h):null,et=ie!==null&&ie>=0,ue=go(r,y.chainId),qe=ns(y.address);return _("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Ur(y),"aria-label":`Send ${y.symbol}`,"data-track":"token_send","data-track-id":y.symbol,children:[_("div",{className:"wi-token-left",children:[_("div",{className:"wi-token-icon-wrap",children:[w("img",{src:y.icon_url,alt:y.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Ao,onError:Mt=>{Mt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ue&&w("img",{src:ue,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Mt=>{Mt.currentTarget.style.display="none"}})]}),_("div",{className:"wi-token-info",children:[_("span",{className:"wi-token-name-row",children:[w("span",{className:"wi-token-name",children:y.symbol}),qe&&Rt!==null&&w("span",{className:"wi-token-apr",children:`APR ${Rt>=0?"+":"-"}${(Rt>=0?Math.floor:Math.ceil)(Math.abs(Rt)*100)/100}%`})]}),G&&_("div",{className:"wi-token-price-row",children:[w("span",{className:"wi-token-price",children:ti(G.price)}),w("span",{className:"wi-token-change","data-positive":et,"data-zero":ie===0||void 0,children:ie!==null&&(ie===0?"0%":`${et?"+":"-"}${(et?Math.floor:Math.ceil)(Math.abs(ie)*100)/100}%`)})]})]})]}),_("div",{className:"wi-token-right",children:[w("span",{className:"wi-token-balance",children:fn(y.quantity.numeric,y.quantity.decimals)}),G&&w("span",{className:"wi-token-value",children:Da(y.quantity.numeric,y.quantity.decimals,G.price)})]})]},`${y.address}-${y.chainId}`)}),h&&Eo&&Array.from({length:3},(y,G)=>_("div",{className:"wi-skeleton-item",children:[_("div",{className:"wi-skeleton-left",children:[w("div",{className:"wi-skeleton-block wi-skeleton-icon"}),_("div",{className:"wi-skeleton-lines",children:[w("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),w("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),_("div",{className:"wi-skeleton-right",children:[w("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),w("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${G}`)),h&&!Eo&&!lt&&Ct.length===0&&Io.length===0&&w("div",{className:"wi-empty",children:"No Tokens Found"}),h&&Io.map(y=>{let G=ro.get(y.token)||"",ie=go(r,ye[r].cross);return _("div",{className:"wi-token-item",children:[_("div",{className:"wi-token-left",children:[_("div",{className:"wi-token-icon-wrap",children:[w("img",{src:G||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:y.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Ao,onError:et=>{et.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ie&&w("img",{src:ie,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:et=>{et.currentTarget.style.display="none"}})]}),_("div",{className:"wi-token-info",children:[w("span",{className:"wi-token-name",children:y.token_name}),w("div",{className:"wi-token-price-row",children:_("span",{className:"wi-token-price",children:[fn(y.current_price,18)," CROSS"]})})]})]}),_("div",{className:"wi-token-right",children:[w("span",{className:"wi-token-balance",children:fn(y.balance,18)}),w("span",{className:"wi-token-value",children:ti(y.current_value_usd)})]})]},`forge-${y.token}`)})]})}),ne==="bottom"&&A&&w("div",{className:"wi-nav-fixed",children:A}),Yi&&w("div",{className:"wi-wallet-disconnect-row",children:Yi})]},"wallet"),jc=ke?w("div",{className:me("wi-view-inner wi-portfolio-body",O.current&&"wi-view-portfolio"),children:w(Jn,{env:r,theme:i,walletAddress:m,showHeader:!1,onOutlink:Me,lpBalanceReader:At,stakingRewardsReader:ge,sendTransaction:K,estimateGas:Be,sections:fe})},"portfolio"):null,Vc=re?w("div",{className:me("wi-view-inner wi-send-body",O.current&&"wi-view-send"),children:w(rr,{env:r,theme:i,walletAddress:m,accountName:x,accounts:C,initialStep:Dc,token:re,tokens:Ct,onTokenChange:z,sendTransaction:K,getTransactionReceipt:be,estimateGas:Be,getTokenPriceUsd:y=>{let G=Je.get(Ut(y.chainId,y.address));if(!G?.price)return;let ie=parseFloat(G.price);return Number.isFinite(ie)?ie:void 0},onClose:S,onBackToWallet:Lo,onSubmitted:Wc,onSuccess:Uc,onFailed:Gc,onOutlink:Me})},"send"):null,qc=$.useMemo(()=>Ze||Ct.map(y=>{let G=Je.get(Ut(y.chainId,y.address)),ie=G?.price?parseFloat(G.price):void 0;return{name:y.name,symbol:y.symbol,chainId:y.chainId,address:y.address,decimals:y.quantity.decimals,balance:Kn(y.quantity.numeric,y.quantity.decimals),iconUrl:y.icon_url,priceUsd:Number.isFinite(ie)?ie:void 0}}),[Ze,Je,Ct]),Kc=w("div",{className:me("wi-view-inner wi-bridge-body",O.current&&"wi-view-send"),children:w(Cr,{env:r,walletAddress:m,tokens:qc,history:rt,termsUrl:W,getQuote:De,getToTokens:Le,getApproval:Ue,approveBridge:en,submitBridge:it,onClose:S,onBackToWallet:Lo})},"bridge"),Hr=!!N&&x?.trim().toLowerCase()!=="my wallet",Qi=_(Di,{children:[_("span",{className:"wi-receive-avatar",children:[w("span",{className:"wi-avatar-fallback",style:qi}),Fo&&w("img",{src:Fo,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:Ao,onError:y=>{y.currentTarget.style.display="none"}})]}),w("span",{className:"wi-receive-account-name",children:x??"Account 1"}),Hr&&w("span",{className:"wi-receive-chevron","data-open":ao,"aria-hidden":"true",children:w(En,{size:16})})]}),Yc=_("div",{className:me("wi-view-inner wi-qr-body",O.current&&"wi-view-qr"),children:[_("div",{className:"wi-receive-section",children:[Hr?w("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{so(!0),N?.()},"aria-label":"Switch account",children:Qi}):w("div",{className:"wi-receive-account",children:Qi}),_("div",{className:"wi-qr-block",children:[_("div",{className:"wi-qr-box",children:[w(pm,{value:m,size:180,level:"H",marginSize:2,...g&&{imageSettings:{src:g,height:33,width:33,excavate:!0}}}),!g&&w("div",{className:"wi-qr-logo",children:w(La,{size:33})})]}),w("p",{className:"wi-qr-address",children:m})]}),_("button",{type:"button",className:"wi-qr-copy-btn",onClick:Vi,"data-track":"address_copy",children:[w("span",{className:"wi-qr-copy-icon",children:Dn?w(Tn,{size:16}):w(po,{size:16})}),w("span",{className:"wi-qr-copy-text",children:Dn?"Copied!":"Copy address"})]})]}),Ki&&w("div",{className:"wi-receive-footer",children:Ki})]},"qr"),Qc=M==="qr"||M==="portfolio"||M==="send"||M==="bridge",Zi=q!==null?w("div",{className:"wi-builtin-footer",children:q}):null,Xi=_("div",{className:"wi-account-text",children:[Hr?_("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{so(!0),N?.()},"aria-label":"Switch account","aria-expanded":ao,children:[w("span",{className:"wi-account-name",children:x??"Account 1"}),w("span",{className:"wi-account-switch","data-open":ao,"aria-hidden":"true",children:w(En,{size:20})})]}):w("div",{className:"wi-account-row",children:w("span",{className:"wi-account-name",children:x??"Account 1"})}),_("button",{type:"button",className:"wi-address-row-btn",onClick:Vi,"aria-label":"Copy address","data-track":"address_copy",children:[w("span",{className:"wi-account-address",children:xt(m)}),w("span",{className:"wi-account-copy","data-copied":Dn,children:Dn?w(Tn,{size:12}):w(po,{size:12})})]})]}),Ji=_(Di,{children:[o,M==="qr"?w("div",{className:"wi-sticky-header",children:_("div",{className:"wi-header wi-header--receive",children:[w("button",{type:"button",className:"wi-header-back",onClick:Lo,"aria-label":"Back",children:w(Nn,{size:24})}),w("span",{className:"wi-receive-title",children:"Receive"}),w("button",{type:"button",className:"wi-header-action",onClick:S,"aria-label":"Close",children:w(jt,{size:24})})]})}):M==="send"||M==="bridge"?null:Qc?_("div",{className:"wi-sticky-header",children:[_("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[w("button",{type:"button",className:"wi-header-back",onClick:Lo,"aria-label":"Back",children:w(Nn,{size:24})}),w("div",{className:"wi-account-block wi-account-block--sub-account",children:Xi}),w("button",{type:"button",className:"wi-header-action",onClick:S,"aria-label":"Close",children:w(jt,{size:24})})]}),w("hr",{className:"wi-divider"})]}):_("div",{className:"wi-sticky-header",children:[_("div",{className:"wi-header wi-header--wallet",children:[_("div",{className:"wi-account-block",children:[_("div",{className:"wi-avatar",children:[w("div",{className:"wi-avatar-fallback",style:qi}),Fo&&w("img",{src:Fo,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:Ao,onError:y=>{y.currentTarget.style.display="none"}})]}),Xi]}),_("div",{className:"wi-header-actions",children:[u&&v&&w("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:io,"aria-label":"Show QR code","data-track":"receive",children:w(Ho,{size:20})}),w("button",{type:"button",className:"wi-header-action",onClick:S,"aria-label":"Close",children:w(jt,{size:24})})]})]}),w("hr",{className:"wi-divider"})]}),_("div",{className:"wi-view-container",children:[M==="wallet"&&Hc,M==="qr"&&Yc,M==="portfolio"&&jc,M==="send"&&Vc,M==="bridge"&&Kc]}),M==="wallet"&&$t&&w("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:$t}),M==="wallet"&&le&&_("a",{className:"wi-send-toast",href:Or??"#",target:"_blank",rel:"noopener noreferrer",onClick:y=>{if(!Or){y.preventDefault();return}Ge(y,Or,{category:"send",origin:"send-transaction",payload:{chainId:le.chainId,txHash:le.txHash}},Me)},children:[w("span",{className:"wi-send-toast-icon","data-status":le.status,"aria-hidden":!0,children:le.status==="pending"?w("span",{className:"wi-send-toast-spinner"}):le.status==="error"?w("span",{className:"wi-send-toast-error-dot"}):w(Ma,{size:20})}),_("span",{className:"wi-send-toast-copy",children:[w("span",{className:"wi-send-toast-title",children:le.status==="pending"?"Sending...":le.status==="error"?"Send failed":"Send complete"}),w("span",{className:"wi-send-toast-desc",children:le.status==="pending"||le.status==="error"?le.description:"Tap to see your transaction"})]})]}),Zi&&M!=="portfolio"&&M!=="send"&&w("div",{className:"wi-sticky-footer",children:w("div",{className:"wi-footer",ref:on,children:Zi})})]}),ea={...F,...ht>0?{"--wi-footer-height":`${ht}px`}:null};return a?w(he,{feature:"wallet_info",children:_(Tr.Portal,{children:[l&&w(Tr.Overlay,{className:"wi-drawer-overlay"}),_(Tr.Content,{className:me("wi-drawer-content",n),"data-theme":i,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:ea,"data-direction":c,"data-no-balance":!p||void 0,"data-has-footer":ht>0||void 0,"data-view":M,children:[w(Tr.Title,{className:"wi-sr-only",children:"My Wallet"}),Ji]})]})}):_(he,{feature:"wallet_info",children:[l&&s&&w("div",{className:"wi-drawer-overlay",onClick:S}),w(Nr.Portal,{children:w(Nr.Content,{align:e,sideOffset:t,className:me("wi-popover-content",n),"data-theme":i,style:ea,"data-no-balance":!p||void 0,"data-has-footer":ht>0||void 0,"data-view":M,children:Ji})})]})}import*as lc from"react";function cc({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=un();return lc.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as dc from"react";function pc({children:e}){let{setFooterContent:t}=un();return dc.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
- `);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
- `);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
- `);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-apr{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}
14
- `);Y(`.wi-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}
15
- `);import{jsx as Oi}from"react/jsx-runtime";function wm({env:e,theme:t="dark",mobileBreakpoint:n=768,drawerDirection:o,modal:r,showBalance:i=!1,showForgeToken:a=!1,showGameToken:s=!0,showQR:c=!0,showBridge:l=!0,qrLogoSrc:p,walletAddress:h,accountName:b,sendAccounts:u,profileImageUrl:v,connectorId:g,connectorName:m,connectorIconUrl:x,preferredTokens:C=[],onSelectWallet:d,onCopyAddress:k,onBuy:S,onBuyDisabledMessage:N,onBridgeDisabledMessage:R,onSendDisabledMessage:E,onDisconnect:D,disconnectLabel:H="Disconnect",termsUrl:W=jn,termsLabel:j="Terms of Service",privacyUrl:I=jo,privacyLabel:te="Privacy Policy",open:F,onOpenChange:A,showPortfolio:ne=!1,portfolioTitle:q="My Portfolio",portfolioSections:M,showTotalAssets:de=!0,totalAssetsLabel:re="Total Assets USD",sendTransaction:z,getTransactionReceipt:ke,estimateGas:Q,onOutlink:fe,lpBalanceReader:we,stakingRewardsReader:We,bridgeTokens:K,bridgeHistory:be,getBridgeQuote:Be,getBridgeToTokens:Me,getBridgeApproval:At,approveBridge:ge,submitBridge:Ze,onReceive:rt,onBridge:De,onSend:Le,style:Ue,children:en}){let it=_e(e),kt=g?$o[g]:void 0,He=m??kt?.name,Ft=x??kt?.iconUrl,St=Un(`(max-width: ${n}px)`),Se=o??(i?"right":"bottom"),$t=Se==="left"||Se==="right",Ht=r??!1,at=F!==void 0,[je,st]=Ye.useState(!1),Xe=at?F:je,Ve=Ye.useCallback(ht=>{at||st(ht),A?.(ht)},[at,A]),Re=Ye.useCallback(()=>Ve(!1),[Ve]),[gt,lt]=Ye.useState(null),[Je,Rt]=Ye.useState("top"),[tn,pn]=Ye.useState(null),[nn,P]=Ye.useState("wallet"),[Z,se]=Ye.useState(null);Ye.useEffect(()=>{Xe||(P("wallet"),se(null))},[Xe]),Ye.useEffect(()=>{Wn(h)},[h]);let ct=Ye.useCallback(()=>{ai(h),D?.()},[D,h]),on=Ye.useMemo(()=>({env:it,theme:t,isMobile:St,open:Xe,drawerDirection:Se,modal:Ht,showBalance:i,showForgeToken:a,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:p,walletAddress:h,accountName:b,sendAccounts:u,profileImageUrl:v,connectorName:He,connectorIconUrl:Ft,preferredTokens:C,close:Re,onSelectWallet:d,onCopyAddress:k,onBuy:S,onBuyDisabledMessage:N,onBridgeDisabledMessage:R,onSendDisabledMessage:E,onDisconnect:D?ct:void 0,disconnectLabel:H,termsUrl:W,termsLabel:j,privacyUrl:I,privacyLabel:te,portalStyle:Ue,navContent:gt,navPosition:Je,setNavContent:lt,setNavPosition:Rt,footerContent:tn,setFooterContent:pn,view:nn,setView:P,selectedSendToken:Z,setSelectedSendToken:se,showPortfolio:ne,portfolioTitle:q,portfolioSections:M,showTotalAssets:de,totalAssetsLabel:re,sendTransaction:z,getTransactionReceipt:ke,estimateGas:Q,onOutlink:fe,lpBalanceReader:we,stakingRewardsReader:We,bridgeTokens:K,bridgeHistory:be,getBridgeQuote:Be,getBridgeToTokens:Me,getBridgeApproval:At,approveBridge:ge,submitBridge:Ze,onReceive:rt,onBridge:De,onSend:Le}),[it,t,St,Xe,Se,Ht,i,a,s,c,l,p,h,b,u,v,He,Ft,C,Re,d,k,S,N,R,E,D,ct,H,W,j,I,te,Ue,gt,Je,tn,nn,Z,ne,q,M,de,re,z,ke,Q,fe,we,We,K,be,Be,Me,At,ge,Ze,rt,De,Le]);return Oi(Jr.Provider,{value:on,children:St?Oi(bm.Root,{direction:Se,open:Xe,onOpenChange:Ve,handleOnly:$t,noBodyStyles:!0,repositionInputs:!1,children:en},"drawer"):Oi(uc.Root,{open:Xe,onOpenChange:Ve,children:en},"popover")})}var no=Object.assign(wm,{Trigger:xs,Content:sc,Nav:cc,Footer:pc});import*as Jt from"react";import*as Ic from"@radix-ui/react-dialog";import{Drawer as Nm}from"vaul";import{createContext as xm,useContext as vm}from"react";var Er=xm(null);function So(){let e=vm(Er);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as fc,useEffect as ym,useCallback as km}from"react";function Ir(){let[e,t]=fc([]),[n,o]=fc(!0);ym(()=>{if(typeof window>"u"){o(!1);return}let i=[],a=c=>{let{info:l}=c.detail;l?.rdns&&!i.some(p=>p.rdns===l.rdns)&&(i.push({rdns:l.rdns,name:l.name,icon:l.icon}),t([...i]))};window.addEventListener("eip6963:announceProvider",a),window.addEventListener("eip6963:crossAnnounceProvider",a),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let s=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),window.removeEventListener("eip6963:crossAnnounceProvider",a),clearTimeout(s)}},[]);let r=km(i=>e.some(a=>a.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as mc from"@radix-ui/react-dialog";import{Drawer as Sm}from"vaul";import{jsx as Wi}from"react/jsx-runtime";function gc({asChild:e,children:t}){let{isMobile:n}=So(),o=n?Sm.Trigger:mc.Trigger;return Wi(he,{feature:"wallet_connect",children:Wi(o,{asChild:e??t!=null,children:t??Wi("button",{type:"button","data-track":"open",children:"Connect Wallet"})})})}import{useEffect as Rm}from"react";import*as Xt from"@radix-ui/react-dialog";import{Drawer as Lr}from"vaul";import{jsx as oe,jsxs as kn}from"react/jsx-runtime";function Pr(){return kn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),oe("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z",fill:"black"})]})}function hc(){return kn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[kn("g",{clipPath:"url(#clip0_1331_27065)",children:[oe("path",{d:"M37.2488 38.4674L28.6626 35.8175L22.1876 39.8295L17.6699 39.8274L11.191 35.8175L2.60875 38.4674L-0.00195312 29.3328L2.60875 19.1947L-0.00195312 10.6234L2.60875 0L16.0192 8.30453H23.838L37.2488 0L39.8595 10.6234L37.2488 19.1947L39.8595 29.3328L37.2488 38.4674Z",fill:"#FF5C16"}),oe("path",{d:"M2.60938 0L16.0201 8.31037L15.4868 14.0137L2.60938 0ZM11.1919 29.3366L17.0925 33.9956L11.1919 35.8175V29.3366ZM16.6209 21.6342L15.4868 14.0175L8.22768 19.1971L8.22374 19.195V19.1988L8.24628 24.5302L11.1899 21.6345L16.6209 21.6342ZM37.2477 0L23.837 8.31037L24.3685 14.0137L37.2477 0ZM28.6654 29.3366L22.7646 33.9956L28.6654 35.8175V29.3366ZM31.6313 19.1985V19.1947L31.6297 19.1968L24.3705 14.0175L23.2364 21.6342H28.6651L31.6108 24.5296L31.6313 19.1985Z",fill:"#FF5C16"}),oe("path",{d:"M11.191 35.8175L2.60875 38.4674L-0.00195312 29.3366H11.191V35.8175ZM16.62 21.6321L18.2595 32.6435L15.9873 26.5208L8.24368 24.5296L11.189 21.6324H16.62V21.6321ZM28.6662 35.8175L37.2488 38.4674L39.8595 29.3366H28.6662V35.8175ZM23.2375 21.6321L21.598 32.6435L23.8699 26.5208L31.6138 24.5296L28.6665 21.6324H23.2375V21.6321Z",fill:"#E34807"}),oe("path",{d:"M-0.00195312 29.3328L2.60875 19.1947H8.22284L8.2434 24.5278L15.9876 26.519L18.2595 32.6414L17.0916 33.9897L11.191 29.3307H-0.00195312V29.3328ZM39.8595 29.3328L37.2488 19.1947H31.6344L31.6138 24.5278L23.8702 26.519L21.598 32.6414L22.7657 33.9897L28.6665 29.3307H39.8595V29.3328ZM23.838 8.30444H16.0192L15.4882 14.0078L18.2597 32.6355H21.598L24.3713 14.0078L23.838 8.30444Z",fill:"#FF8D5D"}),oe("path",{d:"M2.60875 0L-0.00195312 10.6234L2.60875 19.1947H8.22284L15.4859 14.0137L2.60875 0ZM14.9975 23.8438H12.4541L11.0693 25.2508L15.9893 26.515L14.9975 23.842V23.8438ZM37.2488 0L39.8595 10.6234L37.2488 19.1947H31.6344L24.3716 14.0137L37.2488 0ZM24.8637 23.8438H27.4107L28.7955 25.2526L23.8699 26.5191L24.8637 23.8418V23.8438ZM22.1857 36.1956L22.7659 33.9936L21.598 32.6453H18.2572L17.0896 33.9936L17.6696 36.1956",fill:"#661800"}),oe("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),oe("path",{d:"M11.1914 35.8131L17.672 39.8289V36.193L17.0917 33.9912L11.1914 35.8131ZM28.6649 35.8131L22.1841 39.8289V36.193L22.7644 33.9912L28.6649 35.8131Z",fill:"#E7EBF6"})]}),oe("defs",{children:oe("clipPath",{id:"clip0_1331_27065",children:oe("rect",{width:"40",height:"40",fill:"white"})})})]})}function bc(){return kn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),oe("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),oe("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),oe("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),oe("path",{d:"M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z",fill:"#F3BA2F"})]})}function wc(){return kn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[oe("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),oe("path",{d:"M89.1233 136.695V59.7551H118.481V140.524L74.5862 184.774L30.4787 140.524V107.55H59.9073V136.695L74.5862 151.303L89.1233 136.695Z",fill:"white"}),oe("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),oe("path",{d:"M199.534 59.9334C202.562 60.0484 208.427 60.4824 212.031 63.6902C215.635 66.898 216.937 71.0498 216.937 73.1199V104.017L198.767 114.828L216.937 125.561V172.713C216.937 174.511 216.405 178.276 211.034 181.377C205.664 184.477 202.613 184.969 201.758 184.827H143.949C141.879 184.904 136.712 184.182 132.602 180.686C128.493 177.19 128.462 175.216 128.462 173.515V125.561L146.173 114.828L128.462 104.017V71.1268C128.462 69.721 130.109 65.7781 133.237 63.5701C137.147 60.8101 141.112 59.9334 144.409 59.9334H199.534ZM158.3 122.264V166.221H187.033V122.264H158.3ZM158.3 107.794H187.033V78.5272H158.3V107.794Z",fill:"white"})]})}function xc(){return kn("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[kn("g",{clipPath:"url(#clip0_1185_7785)",children:[oe("path",{d:"M14 28C21.75 28 28 21.75 28 14C28 6.25 21.75 0 14 0C6.25 0 0 6.25 0 14C0 21.75 6.25 28 14 28Z",fill:"#EB0029"}),oe("path",{d:"M19.4975 8.36232L6 6L13.103 23L23 11.5311L19.4975 8.36232ZM19.2801 9.4034L21.3449 11.27L15.6975 12.2424L19.2801 9.4034ZM14.4714 12.0479L8.51876 7.35252L18.247 9.05524L14.4714 12.0479ZM14.0467 12.8782L13.0765 20.5098L7.84385 7.98492L14.0467 12.8782ZM14.9454 13.2835L21.1983 12.2064L14.026 20.518L14.9454 13.2835Z",fill:"white"})]}),oe("defs",{children:oe("clipPath",{id:"clip0_1185_7785",children:oe("rect",{width:"28",height:"28",fill:"white"})})})]})}function vc(){return kn("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[oe("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"}),oe("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"}),oe("path",{fill:"#4CAF50",d:"M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"}),oe("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"})]})}function yc(){return oe("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:oe("path",{d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function kc(){return oe("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:oe("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ui={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Pr},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Pr,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Pr,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",visibility:"desktop-only"},metamask:{id:"metamask",name:"MetaMask",description:"Browser extension approval is required",icon:hc,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:bc},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:wc,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:xc,badge:"For SHOP"}};function Gi(e){return Ui[e]}var zi={google:{id:"google",name:"Google",icon:vc},apple:{id:"apple",name:"Apple",icon:yc}};function Sc(e){return zi[e]}import{Fragment as Nc,jsx as X,jsxs as Qe}from"react/jsx-runtime";function Rc(e,t){ve("connect","wallet_selected",{tags:{item_id:e}});let n=t?.();n instanceof Promise&&n.then(()=>ve("connect","connected"),o=>ve("connect","connected",{status:"failure",reason:bt(o)}))}function Cm({wallet:e,detected:t,onConnect:n}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}n()},r=e.icon,i=e.featured===!0;return Qe("button",{type:"button",className:me("wcm-wallet-item",i&&"wcm-wallet-item--featured"),"data-track":"wallet_item_click","data-track-id":e.id,onClick:o,children:[Qe("div",{className:"wcm-wallet-item-left",children:[X("div",{className:"wcm-wallet-icon",children:X(r,{})}),Qe("div",{className:"wcm-wallet-name-row",children:[X("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&X("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?X("span",{className:"wcm-installed-label",children:"Installed"}):X("span",{className:"wcm-install-btn",children:"Install"}))]})}function Tm({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return Qe("button",{type:"button",className:"wcm-social-item","data-provider":e.id,"data-track":"social_provider_click","data-track-id":e.id,onClick:t,"aria-label":o,children:[X("span",{className:"wcm-social-icon",children:X(n,{})}),X("span",{className:"wcm-social-name",children:o})]})}function Cc(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:i,isDetected:a,close:s,isMobile:c}=So(),l=t.filter(b=>{let u=Gi(b).visibility;return!u||u==="always"?!0:u==="desktop-only"?!c:u==="mobile-only"?c:!0}),p=o.length>0,h=l.length>0;return Qe(Nc,{children:[Qe("div",{className:"wcm-header",children:[Qe("div",{className:"wcm-header-text",children:[X("h2",{className:"wcm-title",children:"CROSS Wallet"}),!c&&X("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),X("button",{type:"button",className:"wcm-close-btn","data-track":"close",onClick:s,"aria-label":"Close",children:X(kc,{})})]}),Qe("div",{className:"wcm-body",children:[p&&Qe(Nc,{children:[!c&&Qe("div",{className:"wcm-section-header",children:[X("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),X("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),X("div",{className:"wcm-social-grid",children:o.map(b=>{let u=Sc(b);return X(Tm,{social:u,onSignIn:()=>{Rc(b,n[b]),s()}},b)})}),h&&Qe("div",{className:"wcm-separator",children:[X("div",{className:"wcm-separator-line"}),X("span",{className:"wcm-separator-text",children:"Other Wallets"}),X("div",{className:"wcm-separator-line"})]})]}),h&&X("div",{className:"wcm-wallet-list",children:l.map(b=>{let u=Gi(b),v=u.rdns?a(u.rdns):!1;return X(Cm,{wallet:u,detected:v,onConnect:()=>{Rc(b,e[b]),s()}},b)})}),Qe("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",X(Tc,{href:r,track:"terms_link",children:"Terms of Service"})," ","and consent to its"," ",X(Tc,{href:i,track:"privacy_link",children:"Privacy Policy"}),"."]})]})]})}function Tc({href:e,track:t,children:n}){return e?X("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer","data-track":t,children:n}):X("span",{className:"wcm-terms-link",children:n})}function Ec({className:e}){let{isMobile:t,theme:n,portalStyle:o,open:r}=So();return Rm(()=>{r&&ve("connect","opened")},[r]),t?X(he,{feature:"wallet_connect",children:Qe(Lr.Portal,{children:[X(Lr.Overlay,{className:"wcm-overlay"}),Qe(Lr.Content,{className:me("wcm-drawer-content",e),"data-theme":n,style:o,children:[X(Lr.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X("div",{className:"wcm-drawer-handle"}),X("div",{className:"wcm-drawer-body",children:X(Cc,{})})]})]})}):X(he,{feature:"wallet_connect",children:Qe(Xt.Portal,{children:[X(Xt.Overlay,{className:"wcm-overlay"}),Qe(Xt.Content,{className:me("wcm-dialog-content",e),"data-theme":n,style:o,children:[X(Xt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X(Xt.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),X("div",{className:"wcm-dialog-body",children:X(Cc,{})})]})]})})}Y(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:var(--ds-overlay-dim, rgba(0, 0, 0, .5));-webkit-backdrop-filter:var(--ds-bg-blur-7, blur(3.5px));backdrop-filter:var(--ds-bg-blur-7, blur(3.5px))}.wcm-dialog-content{-webkit-font-smoothing:antialiased;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:100001;width:var(--wcm-dialog-width, 480px);max-height:90vh;overflow:hidden;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-radius:24px;box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));outline:none;animation:wcm-dialog-show .2s ease-out;font-family:inherit}.wcm-dialog-content[data-state=closed]{animation:wcm-dialog-hide .15s ease-in}.wcm-dialog-body,.wcm-drawer-body{scrollbar-width:thin;scrollbar-color:var(--ds-border-medium, rgba(0, 0, 0, .18)) transparent}.wcm-dialog-body::-webkit-scrollbar,.wcm-drawer-body::-webkit-scrollbar{width:4px}.wcm-dialog-body::-webkit-scrollbar-track,.wcm-drawer-body::-webkit-scrollbar-track{background:transparent}.wcm-dialog-body::-webkit-scrollbar-thumb,.wcm-drawer-body::-webkit-scrollbar-thumb{background:var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:4px}.wcm-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;bottom:0;left:0;right:0;z-index:100001;width:100%;max-width:var(--wcm-drawer-max-width, none);min-width:var(--wcm-drawer-min-width, 0);max-height:85dvh;margin:0 auto;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-top-left-radius:16px;border-top-right-radius:16px;outline:none;font-family:inherit;box-sizing:border-box}.wcm-drawer-content[data-vaul-drawer-direction=right]{inset:0 0 0 auto;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:16px 0 0 16px}.wcm-drawer-content[data-vaul-drawer-direction=left]{inset:0 auto 0 0;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:0 16px 16px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 16px 16px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--ds-border-medium, rgba(0, 0, 0, .18));margin:12px auto 8px;flex-shrink:0}.wcm-drawer-content[data-vaul-drawer-direction=left] .wcm-drawer-handle,.wcm-drawer-content[data-vaul-drawer-direction=right] .wcm-drawer-handle{display:none}.wcm-dialog-body,.wcm-drawer-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.wcm-drawer-body{overscroll-behavior:contain}.wcm-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-header-text{display:flex;flex-direction:column;gap:4px;min-width:0}.wcm-title{font-family:Inter,sans-serif;font-weight:600;font-size:20px;line-height:1.25;letter-spacing:0;color:var(--ds-content-highest, #000000);margin:0}.wcm-subtitle{font-family:Inter,sans-serif;font-weight:400;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));margin:0}.wcm-close-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;border:none;background:transparent;color:var(--ds-content-low, #00000066);cursor:pointer;padding:0;transition:opacity .15s ease}.wcm-close-btn:hover{opacity:.6}.wcm-close-btn>svg{width:24px;height:24px}.wcm-divider{display:none}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:24px}.wcm-section-header{display:flex;align-items:center;gap:8px;width:100%}.wcm-section-title{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1;letter-spacing:0;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-recommended-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-low, #e7f9f8);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-high, #00a0a2);white-space:nowrap}.wcm-social-grid{display:grid;gap:8px;width:100%}.wcm-dialog-body .wcm-social-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wcm-drawer-body .wcm-social-grid{grid-template-columns:1fr}.wcm-social-item{display:flex;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;transition:none;font-family:inherit;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-social-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-social-item:hover{background:#eff3f8!important}.wcm-social-item[data-provider=apple] .wcm-social-icon{color:#000}[data-theme=dark] .wcm-social-item[data-provider=apple] .wcm-social-icon{color:#fff}.wcm-dialog-body .wcm-social-item{flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px}.wcm-drawer-body .wcm-social-item{flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;padding:16px}.wcm-social-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.wcm-social-icon>svg{width:32px;height:32px}.wcm-social-name{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:12px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-separator-text{font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-wallet-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:20px 16px;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;text-align:left;transition:none;font-family:inherit}.wcm-wallet-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-wallet-item:hover{background:#eff3f8!important}.wcm-wallet-item-left{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:28px;height:28px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg,.wcm-wallet-icon>img{width:28px;height:28px;border-radius:0;object-fit:cover}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px;min-width:0}.wcm-wallet-name{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-system-purple-low, #f5f3ff);border:.5px solid var(--ds-system-purple-default, #7e54f4);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-system-purple-high, #7346f3);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-default, #00b4b7);border-radius:6px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-on, #ffffff);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-terms{font-family:Inter,sans-serif;font-weight:400;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;margin:0}.wcm-terms-link{color:var(--ds-accent-primary-high, #00a0a2);text-decoration:none}.wcm-terms-link:hover{text-decoration:underline}.wcm-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}
16
- `);Y(`@keyframes wcm-overlay-show{0%{opacity:0}to{opacity:1}}@keyframes wcm-overlay-hide{0%{opacity:1}to{opacity:0}}@keyframes wcm-dialog-show{0%{opacity:0;transform:translate(-50%,-48%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes wcm-dialog-hide{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-48%) scale(.96)}}
17
- `);import{jsx as Ro}from"react/jsx-runtime";var Em={};function Im({wallets:e,socialProviders:t=Em,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:i=768,drawerDirection:a="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:p,open:h,onOpenChange:b,children:u}){let v=Un(`(max-width: ${i}px)`),[g,m]=Jt.useState(!1),x=h!==void 0,C=x?h:g,d=Jt.useCallback(W=>{x||m(W),b?.(W)},[x,b]),k=Jt.useCallback(()=>d(!1),[d]),{isDetected:S}=Ir(),N=Jt.useMemo(()=>Object.keys(e),[e]),R=Jt.useMemo(()=>Object.keys(t),[t]),E=Jt.useMemo(()=>{let W={};return s&&(W["--wcm-dialog-width"]=s),c&&(W["--wcm-drawer-max-width"]=c),l&&(W["--wcm-drawer-min-width"]=l),{...W,...p}},[s,c,l,p]),D=Jt.useMemo(()=>({theme:r,isMobile:v,open:C,setOpen:d,close:k,wallets:e,activeWalletIds:N,socialProviders:t,activeSocialIds:R,termsUrl:n??jn,privacyUrl:o??jo,isDetected:S,portalStyle:E}),[r,v,C,d,k,e,N,t,R,n,o,S,E]),H=Ro("div",{"data-theme":r,style:E,children:u});return v?Ro(Er.Provider,{value:D,children:Ro(Nm.Root,{direction:a,open:C,onOpenChange:d,noBodyStyles:!0,children:H},"drawer")}):Ro(Er.Provider,{value:D,children:Ro(Ic.Root,{open:C,onOpenChange:d,children:H})})}var Pc=Object.assign(Im,{Trigger:gc,Content:Ec});import*as _c from"react";Y(`.cb-button{--cb-bg: var(--ds-accent-primary-default, #00b4b7);--cb-bg-hover: var(--cb-bg);--cb-color: var(--ds-accent-primary-on-primary, #ffffff);--cb-border: none;--cb-radius: 8px;--cb-height: 36px;--cb-padding: 8px 16px;--cb-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-font-size: 14px;--cb-font-weight: 500;--cb-line-height: 1.5;--cb-letter-spacing: -.01em;--cb-gap: 8px;--cb-transition: opacity .15s;--cb-loading-opacity: .7;--cb-press-scale: .95;--cb-icon-size: 18px;--cb-spinner-size: 18px;--cb-spinner-thumb: currentColor;--cb-spinner-track: color-mix(in srgb, currentColor 20%, transparent)}.cb-pill{--cb-pill-bg: var(--ds-surface-default, #ffffff);--cb-pill-bg-hover: var(--cb-pill-bg);--cb-pill-color: var(--ds-content-high, rgba(0, 0, 0, .85));--cb-pill-border: 1px solid var(--ds-border-default, rgba(0, 0, 0, .07));--cb-pill-border-hover: 1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));--cb-pill-radius: 8px;--cb-pill-height: 36px;--cb-pill-padding: 1px 13px;--cb-pill-press-scale: .95;--cb-pill-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-pill-font-size: 14px;--cb-pill-font-weight: 500;--cb-pill-line-height: 1.5;--cb-pill-gap: 8px;--cb-pill-icon-size: 18px;--cb-pill-icon-placeholder-bg: var(--ds-surface-medium, #f5f7fa);--cb-pill-address-font: Inter, system-ui, -apple-system, sans-serif;--cb-pill-address-font-size: 14px;--cb-pill-address-letter-spacing: -.01em}
18
- `);Y(`.cb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-height);gap:var(--cb-gap);padding:var(--cb-padding);border-radius:var(--cb-radius);border:var(--cb-border);background:var(--cb-bg);color:var(--cb-color);font-family:var(--cb-font-family);font-size:var(--cb-font-size);font-weight:var(--cb-font-weight);line-height:var(--cb-line-height);letter-spacing:var(--cb-letter-spacing);cursor:pointer;transition:var(--cb-transition)}.cb-button:hover:not(:disabled){background:var(--cb-bg-hover)}.cb-button:active:not(:disabled){transform:scale(var(--cb-press-scale))}.cb-button:disabled,.cb-button[aria-busy=true]{cursor:default;opacity:var(--cb-loading-opacity)}.cb-spinner{display:inline-block;width:var(--cb-spinner-size);height:var(--cb-spinner-size);border:2px solid var(--cb-spinner-track);border-top-color:var(--cb-spinner-thumb);border-radius:50%;animation:cb-spin .6s linear infinite;flex-shrink:0}.cb-button-icon{width:var(--cb-icon-size);height:var(--cb-icon-size);flex-shrink:0}.cb-button-label{white-space:nowrap}.cb-pill{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-pill-height);gap:var(--cb-pill-gap);padding:var(--cb-pill-padding);border-radius:var(--cb-pill-radius);border:var(--cb-pill-border);background:var(--cb-pill-bg);color:var(--cb-pill-color);font-family:var(--cb-pill-font-family);font-size:var(--cb-pill-font-size);font-weight:var(--cb-pill-font-weight);line-height:var(--cb-pill-line-height);cursor:pointer}.cb-pill:hover{background:var(--cb-pill-bg-hover)}.cb-pill:active:not(:disabled){transform:scale(var(--cb-pill-press-scale))}.cb-pill-icon{width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;object-fit:contain;flex-shrink:0;background:transparent}[data-theme=dark] .cb-pill-icon[data-provider=apple]{filter:invert(1)}.cb-pill-icon-placeholder{display:inline-block;width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;background:var(--cb-pill-icon-placeholder-bg);flex-shrink:0}.cb-pill-address{font-family:var(--cb-pill-address-font);font-size:var(--cb-pill-address-font-size);letter-spacing:var(--cb-pill-address-letter-spacing);white-space:nowrap}@media(max-width:767.98px){.cb-button,.cb-pill{width:36px;min-width:36px;padding:0}.cb-button{height:36px}.cb-button-label,.cb-pill-address{display:none}}@keyframes cb-spin{to{transform:rotate(360deg)}}
19
- `);var Pm='<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>',Lm='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',_m='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',Am='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',Fm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function Co(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var _r=Co(Pm),Ar=Co(Lm),Fr=Co(_m),Br=Co(Am),Mr=Co(Fm);import{jsx as mt,jsxs as To}from"react/jsx-runtime";function Ac({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:i,onConnect:a,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:p,onBuyDisabledMessage:h,label:b="Connect Wallet",connectingLabel:u="Connecting...",disconnectLabel:v,className:g,theme:m="dark",env:x,showBalance:C=!0,showPortfolio:d,drawerDirection:k,modal:S,connectorId:N,style:R,walletInfoStyle:E,sendTransaction:D,getTransactionReceipt:H,estimateGas:W,onReceive:j,onBridge:I,onSend:te,bridgeTokens:F,bridgeHistory:A,getBridgeQuote:ne,getBridgeToTokens:q,getBridgeApproval:M,approveBridge:de,submitBridge:re}){let z=g?`cb-button ${g}`:"cb-button",ke=g?`cb-pill ${g}`:"cb-pill";if(_c.useEffect(()=>{Wn(t)},[t]),e)return To("button",{type:"button",disabled:!0,className:z,style:R,"aria-busy":"true",children:[mt("span",{className:"cb-spinner","aria-hidden":"true"}),mt("span",{className:"cb-button-label",children:u})]});if(t){let Q=o??Om(n),fe=n?Mm[n]:void 0;return mt(he,{feature:"connect_button",children:To(no,{env:x,theme:m,drawerDirection:k,modal:S,showBalance:C,showPortfolio:d,walletAddress:t,accountName:r,sendAccounts:i,connectorId:N,onSelectWallet:l,onCopyAddress:c?(we,We)=>{We&&c()}:void 0,onDisconnect:s,disconnectLabel:v,style:E,sendTransaction:D,getTransactionReceipt:H,estimateGas:W,onReceive:j,onBridge:I,onBuy:p,onBuyDisabledMessage:h,onSend:te,bridgeTokens:F,bridgeHistory:A,getBridgeQuote:ne,getBridgeToTokens:q,getBridgeApproval:M,approveBridge:de,submitBridge:re,children:[mt(no.Trigger,{asChild:!0,children:To("button",{type:"button",className:ke,"data-track":"wallet_pill_open",style:R,"aria-label":`Connected with ${Q}: ${Lc(t)}`,children:[fe?mt("img",{src:fe,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):mt("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),mt("span",{className:"cb-pill-address",children:Lc(t)})]})}),mt(no.Content,{align:"end",sideOffset:8})]})})}return mt(he,{feature:"connect_button",children:To("button",{type:"button",onClick:a,className:z,"data-track":"connect_click",style:R,"aria-label":typeof b=="string"?b:"Connect Wallet",children:[mt(Bm,{}),mt("span",{className:"cb-button-label",children:b})]})})}function Bm(){return To("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[mt("path",{d:"M3.75 5.25H14.25C15.0784 5.25 15.75 5.92157 15.75 6.75V13.5C15.75 14.3284 15.0784 15 14.25 15H3.75C2.92157 15 2.25 14.3284 2.25 13.5V4.5C2.25 3.67157 2.92157 3 3.75 3H13.5",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),mt("path",{d:"M12 9.75H15.75V12.75H12C11.1716 12.75 10.5 12.0784 10.5 11.25C10.5 10.4216 11.1716 9.75 12 9.75Z",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),mt("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var Mm={google:Br,apple:Mr,cross:_r,metamask:Ar,binance:Fr},Dm={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Om(e){return e?Dm[e]:"Wallet"}function Lc(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Fc from"react";Y(`.sb-button{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-border-hover: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-color: var(--ds-content-medium, rgba(0, 0, 0, .65));--sb-color-hover: var(--ds-content-high, rgba(0, 0, 0, .85));--sb-radius: 8px;--sb-height: 36px;--sb-padding: 1px 11px;--sb-gap: 4px;--sb-font-size: 14px;--sb-font-weight: 500;--sb-line-height: 21px;--sb-letter-spacing: 0;--sb-blur: 0px;--sb-border-width: 1px;--sb-icon-size: 18px;--sb-icon-hover-rotation: 180deg;--sb-spinner-size: 18px;--sb-spinner-thumb: currentColor;--sb-spinner-track: color-mix(in srgb, currentColor 20%, transparent);--sb-disabled-opacity: .6;--sb-press-scale: .95;--sb-hover-duration: .2s;--sb-icon-duration: .3s;--sb-easing: ease}.sb-button[data-theme=dark]{--sb-bg: var(--ds-surface-default, #1e232e);--sb-border: var(--ds-border-default, #ffffff12);--sb-border-hover: var(--ds-border-medium, #ffffff2e);--sb-color: var(--ds-content-medium, #ffffffa6);--sb-color-hover: var(--ds-content-high, #ffffffd9)}.sb-button[data-theme=light]{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, #00000012);--sb-border-hover: var(--ds-border-medium, #0000002e);--sb-color: var(--ds-content-medium, #000000a6);--sb-color-hover: var(--ds-content-high, #000000d9)}
20
- `);Y(`.sb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--sb-height);gap:var(--sb-gap);padding:var(--sb-padding);border-radius:var(--sb-radius);border:var(--sb-border-width) solid var(--sb-border);background:var(--sb-bg);backdrop-filter:blur(var(--sb-blur));-webkit-backdrop-filter:blur(var(--sb-blur));color:var(--sb-color);font-family:Inter,system-ui,-apple-system,sans-serif;font-weight:var(--sb-font-weight);font-size:var(--sb-font-size);line-height:var(--sb-line-height);letter-spacing:var(--sb-letter-spacing);cursor:pointer;transition:border-color var(--sb-hover-duration) var(--sb-easing),color var(--sb-hover-duration) var(--sb-easing)}@media(hover:hover){.sb-button:hover:not(:disabled){border-color:var(--sb-border-hover);color:var(--sb-color-hover)}.sb-button:hover:not(:disabled) .sb-button-icon{transform:rotate(var(--sb-icon-hover-rotation))}}.sb-button:active:not(:disabled){transform:scale(var(--sb-press-scale))}.sb-button:disabled,.sb-button[aria-busy=true]{cursor:default;opacity:var(--sb-disabled-opacity)}.sb-button-icon{width:var(--sb-icon-size);height:var(--sb-icon-size);flex-shrink:0;color:inherit;transition:transform var(--sb-icon-duration) var(--sb-easing),color var(--sb-icon-duration) var(--sb-easing)}.sb-spinner{display:inline-block;width:var(--sb-spinner-size);height:var(--sb-spinner-size);border:2px solid var(--sb-spinner-track);border-top-color:var(--sb-spinner-thumb);border-radius:50%;animation:sb-spin .6s linear infinite;flex-shrink:0}.sb-label{white-space:nowrap}@keyframes sb-spin{to{transform:rotate(360deg)}}
21
- `);import{jsx as oo,jsxs as Um}from"react/jsx-runtime";var Bc="https://www.onechain.nexus/skills";function Mc({label:e="Skills",href:t,onClick:n,className:o,style:r,theme:i,disabled:a=!1,isLoading:s=!1,loadingLabel:c="Loading...",openInNewTab:l=!1,type:p="button"}){let[h,b]=Fc.useState(!1),u=_e(),v=Ln("apps.json",u,S=>Pn(S?.skills,u)),g=t??v,m=async S=>{if(g&&!n){l?window.open(g,"_blank","noopener,noreferrer"):window.location.href=g;return}if(n)try{b(!0),await n()}finally{b(!1)}},x=a||s||h,C=s||h,d=C?c:e,k=o?`sb-button ${o}`:"sb-button";return oo(he,{feature:"skills",children:Um("button",{type:p,onClick:m,disabled:x,className:k,"data-theme":i,"data-track":"click",style:r,"aria-busy":C,children:[C?oo("span",{className:"sb-spinner","aria-hidden":"true"}):oo(Wm,{}),oo("span",{className:"sb-label",children:d})]})})}function Wm(){return oo("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:oo("path",{d:"M15.5879 3.95142C16.0211 2.78097 17.6761 2.78099 18.1094 3.95142L19.6221 8.03833C20.6569 10.8348 22.8618 13.0396 25.6582 14.0745L29.7451 15.5872C30.9157 16.0204 30.9157 17.6754 29.7451 18.1086L25.6582 19.6213C22.8618 20.6562 20.657 22.861 19.6221 25.6575L18.1094 29.7444C17.6762 30.9149 16.0211 30.9149 15.5879 29.7444L14.0752 25.6575C13.0403 22.861 10.8355 20.6562 8.03906 19.6213L3.95215 18.1086C2.78172 17.6754 2.7817 16.0204 3.95215 15.5872L8.03906 14.0745C10.8355 13.0396 13.0403 10.8348 14.0752 8.03833L15.5879 3.95142Z",stroke:"currentColor",strokeWidth:"1.93556"})})}Vr({mode:"dapp-ui"});export{Mr as APPLE_ICON,ma as AppLauncher,Ta as AppLauncherContent,xa as AppLauncherTrigger,Fr as BINANCE_ICON,Cr as BridgeFlow,$o as CONNECTOR_REGISTRY,_r as CROSSX_ICON,Ac as ConnectButton,ei as ConnectorId,Bc as DEFAULT_SKILLS_HREF,Oo as DappUiErrorBoundary,Br as GOOGLE_ICON,Ar as METAMASK_ICON,xr as PORTFOLIO_SECTIONS,zi as SOCIAL_REGISTRY,rr as SendFlow,Mc as SkillsButton,mi as TOKEN_STATS_QUERY_KEY,fi as USER_BALANCE_QUERY_KEY,Ui as WALLET_REGISTRY,Pc as WalletConnectModal,no as WalletInfo,_l as WalletPortfolio,Jn as WalletPortfolioBody,Vr as announceAppLauncherUsage,Do as captureDappUiException,Mo as getDappUiSentryScope,co as initDappUiSentry,bt as normalizeFailureReason,_e as resolveEnvironment,Wn as setDappUiAnalyticsUser,Wo as trackDappUiEvent,ve as trackDappUiFunnel,Go as useGlobalMenu,hn as useTokenBalance,bn as useTokenStats,Ir as useWalletDetect};
1
+ function na(e){try{return import.meta.env?.[e]}catch{return}}function oa(e){if(!(typeof process>"u"))return process.env?.[e]}function Ae(e){if(e)return ra(e);let t=na("VITE_CROSSX_ENVIRONMENT")??na("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??oa("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??oa("CROSSX_ENVIRONMENT");return ra(t)}function ra(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var lo="1.3.7-beta.3";var Mo="__nexusCrossAppLauncherRuntime";function Jc(){if(typeof window>"u")return null;let e=window;return e[Mo]??(e[Mo]={mode:"dapp-ui"}),e[Mo]}function ed(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${lo}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${lo} \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 qr(e){let t=Jc();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),ed(t))}import{BrowserClient as td,Scope as nd,defaultStackParser as od,linkedErrorsIntegration as rd,makeFetchTransport as id}from"@sentry/react";var ad="https://5c82aeb32da33b5a0a14b7c5393992ca@o4511668907081728.ingest.de.sentry.io/4511705324126289",sd=`dapp-ui@${lo}`,Wn=null,ia=1;function aa(){return ia}function ld(e){switch(e){case"dev":return"dev";case"stage":return"stg";default:return"prod"}}function co(e){if(Wn)return Wn;if(typeof window>"u")return null;let t=ld(Ae(e?.environment));typeof e?.analyticsSampleRate=="number"&&(ia=Math.min(1,Math.max(0,e.analyticsSampleRate)));let n=new td({dsn:e?.dsn??ad,transport:id,stackParser:od,integrations:[rd()],environment:t,release:sd,enabled:e?.enabled??t==="prod"}),o=new nd;return o.setClient(n),o.setTags({package:"dapp-ui",framework:"react",source:"dapp-ui"}),n.init(),Wn=o,Wn}function Do(){return Wn}function Oo(e,t){let n=Wn??co();if(n)return n.captureException(e,t?{captureContext:{extra:t}}:void 0)}import{Component as cd}from"react";var Wo=class extends cd{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,o){Oo(n,{componentStack:o.componentStack??void 0,boundary:this.props.name??"dapp-ui"})}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function me(...e){return e.filter(Boolean).join(" ")}function sa(){return typeof window>"u"?!1:window.navigator.userAgent.includes("CROSSx")}var la="__nexus_dapp_ui_uid",Kr=null;function dd(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Array.from({length:32},()=>Math.floor(Math.random()*16).toString(16)).join("")}function Yr(){if(Kr)return Kr;let e=null;try{e=window.localStorage.getItem(la)}catch{}if(!e||!e.startsWith("anon_")){e=`anon_${dd()}`;try{window.localStorage.setItem(la,e)}catch{}}return Kr=e,e}async function ca(e){if(typeof crypto>"u"||!crypto.subtle)return null;try{let t=new TextEncoder().encode(e.trim().toLowerCase()),n=await crypto.subtle.digest("SHA-256",t);return`wallet_${Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("").slice(0,16)}`}catch{return null}}function pd(){let e=window.navigator.userAgent;return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|iphone|ipod|android/i.test(e)?"mobile":"desktop"}function ua(){return{host:window.location.hostname,device_type:pd(),is_cross_inapp:String(sa())}}var da=!1;function Qr(){if(typeof window>"u")return null;let e=Do()??co();return e?(da||(da=!0,e.setUser({id:Yr()})),e):null}function fa(){return Math.random()>=aa()}var pa=0;function Un(e){let t=Qr();if(!t)return;let n=++pa;if(!e){t.setUser({id:Yr()});return}ca(e).then(o=>{o&&n===pa&&t.setUser({id:o})})}function Uo(e,t,n){let o=Qr();!o||fa()||o.captureMessage(`ui: ${e}_${t}`,"info",{captureContext:{tags:{...ua(),feature:e,action:t,...n}}})}function ve(e,t,n){let o=Qr();if(!o||fa())return;let r=n?.status??"success";o.captureMessage(`funnel: ${e}_${t}`,"info",{captureContext:{tags:{...ua(),flow:e,funnel_step:`${e}_${t}`,funnel_status:r,...r==="failure"?{failure_reason:n?.reason??"unknown"}:{},...n?.tags}}})}function bt(e){let t=e,n=String((t&&typeof t=="object"&&"message"in t?t.message:e)??"").toLowerCase();return t?.code===4001||/reject|denied|declin|cancel/i.test(n)?"user-rejected":/insufficient (funds|gas|balance)|exceeds balance/i.test(n)?"insufficient-gas":/timeout|timed out|deadline/i.test(n)?"timeout":/revert|execution failed/i.test(n)?"contract-reverted":/network|fetch|connection|disconnected|offline/i.test(n)?"network":"unknown"}import{useCallback as ud}from"react";import{jsx as fd}from"react/jsx-runtime";function be({feature:e,children:t}){let n=ud(o=>{let r=o.nativeEvent;if(r.__dappUiTracked)return;let a=o.target?.closest?.("[data-track]");if(!a)return;let s=a.getAttribute("data-track");if(!s)return;r.__dappUiTracked=!0;let l=a.getAttribute("data-track-id");Uo(e,s,l?{item_id:l}:void 0)},[e]);return fd("div",{style:{display:"contents"},onClick:n,children:t})}import*as zn from"react";import*as ma from"@radix-ui/react-popover";import{Drawer as wd}from"vaul";import{createContext as md,useContext as gd}from"react";var Zr=md(null);function Go(){let e=gd(Zr);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as hd,useEffect as bd}from"react";function Gn(e){let[t,n]=hd(!1);return bd(()=>{let o=window.matchMedia(e);n(o.matches);let r=i=>n(i.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function Q(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))}Q(`[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
+ `);Q(`.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
+ `);Q(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
+ `);Q(`.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}
5
+ `);Q("");import{jsx as Xr}from"react/jsx-runtime";function ga({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=Gn(`(max-width: ${n}px)`),[a,s]=zn.useState(!1),l=zn.useCallback(()=>s(!1),[]),c=Ae(e),u=zn.useMemo(()=>({env:c,theme:t,isMobile:i,open:a,domain:o,close:l}),[c,t,i,a,o,l]);return Xr(Zr.Provider,{value:u,children:i?Xr(wd.Root,{direction:"right",open:a,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Xr(ma.Root,{open:a,onOpenChange:s,children:r},"popover")})}import*as xa from"@radix-ui/react-popover";import{Drawer as vd}from"vaul";import{jsx as wt,jsxs as xd}from"react/jsx-runtime";function ha({size:e=18}){return xd("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[wt("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),wt("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function ba(){return wt("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:wt("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function wa(){return wt("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:wt("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as $n}from"react/jsx-runtime";function va({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:i}=Go(),a=t!=null,s=e??!0,l=n?`al-trigger-btn ${n}`:"al-trigger-btn",c=a?t:$n("button",{type:"button",className:l,"data-theme":i,"data-track":"open",style:o,children:$n(ha,{size:18})});return r?$n(be,{feature:"app_launcher",children:$n(vd.Trigger,{asChild:s,children:c})}):$n(be,{feature:"app_launcher",children:$n(xa.Trigger,{asChild:s,children:c})})}import*as Tn from"react";import*as $o from"@radix-ui/react-popover";import{Drawer as Hn}from"vaul";import{useQuery as Sd}from"@tanstack/react-query";var ya={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher-v2.json"};var yd="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",kd="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Ot(e,t){return`${e==="production"?kd:yd}/${t}.png`}function ka(e){let t=e==="production"?"production":"stage";return{version:"0.0.1-fallback",items:[{id:"gametoken-cross",label:"Gametoken",description:"Trade game tokens easily using CROSS.",url:{dev:"https://stg.onechain.nexus/gametoken",stage:"https://stg.onechain.nexus/gametoken",production:"https://www.onechain.nexus/gametoken"},iconUrl:Ot(t,"game-token"),order:1e3,type:"gametoken",badge:null,isNew:!1,serviceStatus:"available"},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg.onechain.nexus/forge",stage:"https://stg.onechain.nexus/forge",production:"https://onechain.nexus/forge"},iconUrl:Ot(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0,serviceStatus:"available"},{id:"crossd",label:"Bridge",description:"The first decentralized exchange on the CROSS network.",url:{dev:"https://stg.crossdefi.io/swap-bridge",stage:"https://stg.crossdefi.io/swap-bridge",production:"https://www.crossdefi.io/swap-bridge"},iconUrl:Ot(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1,serviceStatus:"ending"},{id:"prediction",label:"Prediction",description:"Prediction market",url:{dev:"https://stg-prediction.crossdefi.io",stage:"https://stg-prediction.crossdefi.io",production:"https://prediction.crossdefi.io/"},iconUrl:Ot(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0,serviceStatus:"available"},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg.onechain.nexus/rewards",stage:"https://stg.onechain.nexus/rewards",production:"https://onechain.nexus/rewards"},iconUrl:Ot(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1,serviceStatus:"ending"},{id:"cross-staking",label:"Staking",description:"Stake CROSS and earn rewards.",url:{dev:"https://stg-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},iconUrl:Ot(t,"cross-staking"),order:7500,type:"cross-staking",badge:null,isNew:!0,serviceStatus:"available"},{id:"nft",label:"NFT",description:"Trade and collect NFTs in the CROSS ecosystem.",url:{dev:"https://stg.crossnft.io/",stage:"https://stg.crossnft.io/",production:"https://www.crossnft.io/"},iconUrl:Ot(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1,serviceStatus:"available"},{id:"play",label:"Quest",description:"Discover and play games on CROSS.",url:{dev:"https://stg.onechain.nexus/quest",stage:"https://stg.onechain.nexus/quest",production:"https://www.onechain.nexus/quest"},iconUrl:Ot(t,"play"),order:8500,type:"play",badge:null,isNew:!0,serviceStatus:"available"},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://stg.onechain.nexus/shop",stage:"https://stg.onechain.nexus/shop",production:"https://www.onechain.nexus/shop"},iconUrl:Ot(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1,serviceStatus:"available"},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.onechain.nexus",stage:"https://stg-explorer.onechain.nexus",production:"https://explorer.onechain.nexus"},iconUrl:Ot(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1,serviceStatus:"available"},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg.onechain.nexus/wave",stage:"https://stg.onechain.nexus/wave",production:"https://www.onechain.nexus/wave"},iconUrl:Ot(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1,serviceStatus:"available"}]}}function zo(e){let t=Ae(e);return Sd({queryKey:["global-menu",t],queryFn:async()=>{try{let n=await fetch(ya[t],{cache:"no-store"});if(!n.ok)throw new Error(`Failed to fetch global menu: ${n.status}`);return n.json()}catch{return ka(t)}},staleTime:300*1e3,gcTime:600*1e3,retry:!1,refetchOnMount:!0})}function Jr(e){return e.serviceStatus==="ending"||e.serviceStatus==="comingSoon"?e.serviceStatus:"available"}function Ra(e,t){return typeof e=="string"?e:e[t]??e.production??e.stage??e.dev}function Ca(e){return[...e].sort((t,n)=>{let o=Sa(t)-Sa(n);return o!==0?o:t.order-n.order})}function Sa(e){let t=Jr(e);return t==="comingSoon"?0:t==="ending"?2:1}import{jsx as Fe,jsxs as jn}from"react/jsx-runtime";function Rd(e){return e.id==="cross-staking"||e.type==="cross-staking"}function Na({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:i,domain:a,close:s}=Go(),{data:l}=zo(o),c=Tn.useMemo(()=>Ca(l?.items??[]),[l?.items]),u=8,g=Tn.useRef(null),h=Tn.useCallback(m=>{g.current={x:m.clientX,y:m.clientY}},[]),d=typeof window<"u"?window.location.pathname:"",x=Tn.useCallback((m,S)=>{if(g.current){let k=m.clientX-g.current.x,C=m.clientY-g.current.y;if(g.current=null,Math.abs(k)>u||Math.abs(C)>u)return}let p=S.url[o]??S.url.production,R=Ta(p,a);if(!R)try{let k=new URL(p).pathname;if(d===k||d.startsWith(k+"/")){s();return}}catch{}R?window.open(p,"_blank","noopener,noreferrer"):window.location.href=p,s()},[o,a,s,d]),w=m=>{let S=m.url[o]??m.url.production,p=Ta(S,a),R=Jr(m),k=R==="ending",C=Ra(m.iconUrl,o),E=!1;if(!p)try{let T=new URL(S).pathname;E=d===T||d.startsWith(T+"/")}catch{E=!1}return Fe("button",{type:"button",className:"al-grid-item","data-track":"menu_item_click","data-track-id":m.id,"data-active":E||void 0,"data-service-status":R,onPointerDown:h,onClick:T=>x(T,m),children:jn("div",{className:"al-grid-item-left",children:[jn("div",{className:"al-grid-item-icon",children:[Fe("img",{src:C,alt:m.label,width:24,height:24,loading:"lazy"}),m.isNew&&Fe("span",{className:"al-status-ribbon al-status-ribbon-new",children:"N"})]}),jn("span",{className:"al-grid-item-text",children:[Fe("span",{className:"al-grid-item-label",children:m.label}),k&&Fe("span",{className:"al-grid-item-status-text",children:"(End Soon)"}),m.badge&&!Rd(m)&&Fe("span",{className:"al-badge al-badge-list",children:m.badge})]})]})},m.id)},v=Fe("div",{className:"al-menu","data-theme":r,children:Fe("div",{className:"al-grid",children:c.map(w)})});return i?Fe(be,{feature:"app_launcher",children:jn(Hn.Portal,{children:[Fe(Hn.Overlay,{className:"al-drawer-overlay"}),jn(Hn.Content,{className:me("al-drawer-content",n),"data-theme":r,children:[jn("div",{className:"al-drawer-header",children:[Fe(Hn.Close,{className:"al-drawer-close","data-track":"close",children:Fe(ba,{})}),Fe(Hn.Title,{className:"al-drawer-title",children:"CROSS Services"}),Fe(Hn.Close,{className:"al-drawer-close","data-track":"close",children:Fe(wa,{})})]}),Fe("div",{className:"al-drawer-body",children:v})]})]})}):Fe(be,{feature:"app_launcher",children:Fe($o.Portal,{children:Fe($o.Content,{align:e,sideOffset:t,className:me("al-popover-content",n),"data-theme":r,children:v})})})}function Ta(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Ye from"react";import*as fc from"@radix-ui/react-popover";import{Drawer as xm}from"vaul";import{createContext as Cd,useContext as Td}from"react";var ei=Cd(null);function un(){let e=Td(ei);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var ti=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(ti||{}),Ho={crossx:{name:"CROSSx",iconUrl:"https://contents.crosstoken.io/wallet/token/images/tCROSS.svg"},"io.metamask":{name:"MetaMask",iconUrl:"https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg"},"com.binance.wallet":{name:"Binance Wallet",iconUrl:"https://public.bnbstatic.com/static/images/common/favicon.ico"}};import*as ws from"react";import{jsx as ae,jsxs as uo}from"react/jsx-runtime";function Ea({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M12.6667 4.66667V2.66667C12.6667 2.48986 12.5964 2.32029 12.4714 2.19526C12.3464 2.07024 12.1768 2 12 2H3.33333C2.97971 2 2.64057 2.14048 2.39052 2.39052C2.14048 2.64057 2 2.97971 2 3.33333C2 3.68696 2.14048 4.02609 2.39052 4.27614C2.64057 4.52619 2.97971 4.66667 3.33333 4.66667H13.3333C13.5101 4.66667 13.6797 4.7369 13.8047 4.86193C13.9298 4.98695 14 5.15652 14 5.33333V8M14 8H12C11.6464 8 11.3072 8.14048 11.0572 8.39052C10.8071 8.64057 10.6667 8.97971 10.6667 9.33333C10.6667 9.68696 10.8071 10.0261 11.0572 10.2761C11.3072 10.5262 11.6464 10.6667 12 10.6667H14C14.1768 10.6667 14.3464 10.5964 14.4714 10.4714C14.5964 10.3464 14.6667 10.1768 14.6667 10V8.66667C14.6667 8.48986 14.5964 8.32029 14.4714 8.19526C14.3464 8.07024 14.1768 8 14 8Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M2 3.33325V12.6666C2 13.0202 2.14048 13.3593 2.39052 13.6094C2.64057 13.8594 2.97971 13.9999 3.33333 13.9999H13.3333C13.5101 13.9999 13.6797 13.9297 13.8047 13.8047C13.9298 13.6796 14 13.5101 14 13.3333V10.6666",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function po({size:e=16,className:t}){return ae("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M9.40284 17.0647H4.85156V4.84656H17.0697V9.39783H15.4407V6.47565H6.48066V15.4356H9.40284V17.0647ZM21.5192 12.5644H12.5592V21.5244H21.5192V12.5644ZM23.1483 10.9353V23.1535H10.9301V10.9353H23.1483Z",fill:"currentColor"})})}function Nn({size:e=16,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vt({size:e=24,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ia({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M7.5 17.5H4.167A1.667 1.667 0 012.5 15.833V4.167A1.667 1.667 0 014.167 2.5H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M13.333 14.167L17.5 10l-4.167-4.167M17.5 10H7.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function jo({size:e=20,className:t}){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:ae("path",{d:"M7.91305 10.8327C8.60341 10.8327 9.16305 11.3924 9.16305 12.0827V16.2458C9.16305 16.9361 8.60341 17.4958 7.91305 17.4958H3.75C3.05964 17.4958 2.5 16.9361 2.5 16.2458L2.5 12.0827C2.5 11.3924 3.05964 10.8327 3.75 10.8327H7.91305ZM14.1685 17.4958H12.5027V15.83H14.1685V17.4958ZM17.5 17.4958H15.8342V15.83H17.5V17.4958ZM4.16576 12.4985V15.83H7.49729V12.4985H4.16576ZM12.5027 15.83H10.8369V14.1642H12.5027V15.83ZM15.8342 15.83H14.1685V14.1642H15.8342V15.83ZM14.1685 14.1642H12.5027V12.4985H14.1685V14.1642ZM17.5 14.1642H15.8342V12.4985H17.5V14.1642ZM12.5027 12.4985H10.8369V10.8327H12.5027V12.4985ZM15.8342 12.4985H14.1685V10.8327H15.8342V12.4985ZM7.91305 2.50391C8.60341 2.50391 9.16305 3.06355 9.16305 3.75391V7.91696C9.16305 8.60731 8.60341 9.16696 7.91305 9.16696H3.75C3.05964 9.16696 2.5 8.60731 2.5 7.91696L2.5 3.75391C2.5 3.06355 3.05964 2.50391 3.75 2.50391L7.91305 2.50391ZM16.2419 2.50391C16.9322 2.50391 17.4919 3.06355 17.4919 3.75391V7.91696C17.4919 8.60731 16.9322 9.16696 16.2419 9.16696H12.0788C11.3885 9.16696 10.8288 8.60731 10.8288 7.91696V3.75391C10.8288 3.06355 11.3885 2.50391 12.0788 2.50391L16.2419 2.50391ZM4.16576 4.16967L4.16576 7.50119L7.49729 7.50119L7.49729 4.16967L4.16576 4.16967ZM12.4946 4.16967V7.50119H15.8261V4.16967H12.4946Z",fill:"currentColor",fillOpacity:1})})}function En({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function In({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pa({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M1.667 10S4.167 4.167 10 4.167 18.333 10 18.333 10 15.833 15.833 10 15.833 1.667 10 1.667 10z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function La({size:e=16,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("path",{d:"M14.95 14.95A8.283 8.283 0 0110 16.667c-5.833 0-8.333-5.833-8.333-5.833a15.238 15.238 0 014.183-4.884m3.267-1.55A7.55 7.55 0 0110 4.167c5.833 0 8.333 5.833 8.333 5.833a15.28 15.28 0 01-1.783 2.633M11.767 11.767a2.5 2.5 0 11-3.534-3.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ae("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _a({size:e=42,className:t}){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:ae("path",{d:"M20.7314 2C31.0766 2 39.4628 10.3863 39.4629 20.7314C39.4629 31.0766 31.0766 39.4629 20.7314 39.4629C10.3863 39.4628 2 31.0766 2 20.7314C2.00007 10.3864 10.3864 2.00007 20.7314 2ZM20.5938 30.0586L21.1084 30.5732L21.623 30.0586V25.2471H21.1084C20.9344 25.2471 20.7626 25.235 20.5938 25.2158V30.0586ZM16.4834 24.6611L14.6514 26.4922L15.3799 27.2207L17.1797 25.4209L18.3193 24.2803C18.0487 24.0673 17.8025 23.8251 17.5869 23.5566L16.4834 24.6611ZM26.8691 27.2207L27.5967 26.4922L26.3516 25.2471H24.8955L26.8691 27.2207ZM11.2666 20.7314L11.7822 21.2471H16.624C16.6048 21.0781 16.5938 20.9065 16.5938 20.7324C16.5938 20.5585 16.6049 20.3866 16.624 20.2178H11.7812L11.2666 20.7314ZM20.5938 11.4053V16.2471C20.7626 16.2279 20.9345 16.2178 21.1084 16.2178H21.623V11.4053L21.1084 10.8906L20.5938 11.4053ZM14.6514 15.0029L16.4521 16.8027L17.5732 17.9238C17.7874 17.6546 18.0315 17.4104 18.3008 17.1963L15.3799 14.2754L14.6514 15.0029ZM25.0371 16.1074L24.9268 16.2178H26.3818L27.5957 15.0029L26.8682 14.2754L25.0371 16.1074Z",fill:"#019D92",stroke:"white",strokeWidth:4})})}function Aa({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M9.19133 10.8077C9.04905 10.6657 8.87947 10.554 8.69283 10.4792L2.78881 8.11167C2.71832 8.08338 2.65816 8.03421 2.61642 7.97075C2.57468 7.90729 2.55335 7.83258 2.5553 7.75665C2.55724 7.68072 2.58237 7.6072 2.6273 7.54596C2.67224 7.48472 2.73483 7.4387 2.80668 7.41406L16.9525 2.5747C17.0185 2.55087 17.0899 2.54632 17.1583 2.56159C17.2268 2.57685 17.2895 2.6113 17.3391 2.66089C17.3887 2.71049 17.4231 2.77319 17.4384 2.84165C17.4536 2.9101 17.4491 2.9815 17.4253 3.04746L12.5859 17.1933C12.5613 17.2651 12.5152 17.3277 12.454 17.3727C12.3928 17.4176 12.3192 17.4427 12.2433 17.4447C12.1674 17.4466 12.0927 17.4253 12.0292 17.3835C11.9658 17.3418 11.9166 17.2817 11.8883 17.2112L9.52073 11.3056C9.44567 11.1191 9.33362 10.9498 9.19133 10.8077ZM9.19133 10.8077L17.3367 2.66404",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fa({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M10.8333 14.1667V7.5M15 14.1667V4.16667M2.5 2.5V15.8333C2.5 16.2754 2.67559 16.6993 2.98816 17.0118C3.30072 17.3244 3.72464 17.5 4.16667 17.5H17.5M6.66667 14.1667V11.6667",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ba({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M6.6665 9.99984H13.3332M9.99984 6.6665V13.3332M18.3332 9.99984C18.3332 14.6022 14.6022 18.3332 9.99984 18.3332C5.39746 18.3332 1.6665 14.6022 1.6665 9.99984C1.6665 5.39746 5.39746 1.6665 9.99984 1.6665C14.6022 1.6665 18.3332 5.39746 18.3332 9.99984Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ma({size:e=20,className:t}){return ae("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ae("path",{d:"M6.667 2.5 3.333 5.833 6.667 9.167M3.333 5.833h13.334M13.333 17.5l3.334-3.333-3.334-3.334M16.667 14.167H3.333",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Da({size:e=20,className:t}){return uo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ae("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),ae("path",{d:"M6 10.2L8.6 12.8L14 7.2",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as G from"react";import Pn from"bignumber.js";function Nd(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return t>0&&e.charCodeAt(t-1)===46&&t--,e.slice(0,t)}function fn(e,t){if(!e||e==="0")return"0.00";let n=new Pn(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,Pn.ROUND_DOWN)}function xt(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function ni(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let n=t>=1?2:4,o=Math.pow(10,n);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n})}`}function Oa(e,t,n){let r=new Pn(e).shiftedBy(-t).multipliedBy(new Pn(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Pn.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Pn.ROUND_DOWN):r.decimalPlaces(4,Pn.ROUND_DOWN)).toFormat()}`}function Wa(e){if(e===""||e===null||e===void 0)return{displayValue:"0",isLowerBound:!1};let t=typeof e=="number"?e.toString():e;if(t==="0"||t==="0.0")return{displayValue:"0",isLowerBound:!1};let n=t;if(n.includes("e")||n.includes("E")){let a=Number(n);if(!Number.isFinite(a)||a===0)return{displayValue:"0",isLowerBound:!1};n=Nd(a.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let a=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${a}`,isLowerBound:!1}}return r.length<4?{displayValue:`${o}.${r}`,isLowerBound:!1}:r.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${r.slice(0,4)}`,isLowerBound:!1}}import{useMemo as Ld}from"react";import{useQuery as _d}from"@tanstack/react-query";var ye={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}},Vn="https://terms.crosstoken.io/docs/cross-terms-of-use",Vo="https://terms.crosstoken.io/docs/nexus-privacy-policy";import*as qn from"react";var Ed={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher",production:"https://contents.crosstoken.io/frontend/common/app-launcher"},Id=3e3;function Ln(e,t){if(e!=null)return typeof e=="object"&&!Array.isArray(e)&&("dev"in e||"stage"in e||"production"in e)?e[t]:e}var oi=new Map;function Ua(e,t){let n=`${Ed[t]}/${e}`,o=oi.get(n);return o||(o=(async()=>{let r=new AbortController,i=setTimeout(()=>r.abort(),Id);try{let a=await fetch(n,{cache:"no-store",signal:r.signal});return a.ok?await a.json():null}catch{return null}finally{clearTimeout(i)}})().then(r=>(r===null&&oi.delete(n),r)),oi.set(n,o)),o}function Pd(e){return typeof e=="string"&&e.startsWith("https://")}async function ce(e,t){let n=await Ua("endpoints.json",t),o=Ln(n?.apis?.[e],t);if(!Pd(o))throw new Error(`[remote-config] endpoints.json missing or invalid api base: ${e} (${t})`);return o}function _n(e,t,n){let[o,r]=qn.useState(void 0),i=qn.useRef(n);return i.current=n,qn.useEffect(()=>{let a=!0;return Ua(e,t).then(s=>{if(!a)return;let l=i.current(s);l!==void 0&&r(l)}),()=>{a=!1}},[e,t]),o}var Ad="send:chain-info";function Fd(e){if("data"in e&&e.data!==void 0){let t=e.data;if(Array.isArray(t)){let n=t[0];if(!n)throw new Error("Chain info payload is empty.");return n}return t}return e}function ri(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function Bd(e,t,n,o){if(o)return t===ye[e].cross?Ga(t,o):n?.explorer_url?ri(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Md(e,t,o)}function Ga(e,t){return ri("https://explorer.onechain.nexus",String(e),"tx",t)}function Md(e,t,n){let o=ye[e];if(t===o.cross)return Ga(t,n);if(t===o.bsc)return ri(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function qo(e,t,n,o=!0){let r=_d({queryKey:[Ad,e,t],queryFn:async({signal:s})=>{let l=await ce("walletServer",e),c=await fetch(`${l}/v1/public/chain/info/${t}`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Failed to fetch chain info: ${c.status}`);let u=await c.json();if("code"in u&&u.code!==void 0&&u.code!==200)throw new Error(`Chain info API error: ${u.code}`);return Fd(u)},enabled:o,staleTime:3e5}),i=r.data;return{transactionUrl:Ld(()=>Bd(e,t,i,n),[t,i,e,n]),chainInfo:i,...r}}var za="0x0000000000000000000000000000000000000001";var Dd="0xa9059cbb",Od=/^0x[a-fA-F0-9]{40}$/,Wd="nexus-cross:dapp-ui:send:recent:",$a=10;function Ud(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function fo(e){return e.toLowerCase()}function qt(e){return Od.test(e)}function mn(e){return fo(e.address)===za}function ii(e){return`${Wd}${e.toLowerCase()}`}function Kn(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(ii(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&qt(o.address)&&typeof o.updatedAt=="number").slice(0,$a):[]}catch{return[]}}function ai(e,t){if(typeof window>"u")return[];let n=fo(t),o=[{address:n,updatedAt:Date.now()},...Kn(e).filter(r=>r.address!==n)].slice(0,$a);try{window.localStorage.setItem(ii(e),JSON.stringify(o))}catch{return Kn(e)}return o}function si(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(ii(e))}catch{}}function An(e,t){let n=e.trim();if(!n)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(n))return{error:"Enter a valid amount."};let[o="0",r=""]=n.split(".");if(r.length>t)return{error:`Max ${t} decimal places.`};let i=BigInt(o||"0"),a=r.padEnd(t,"0"),s=a?BigInt(a):0n,l=10n**BigInt(t),c=i*l+s;return c<=0n?{error:"Amount must be greater than 0."}:{value:c}}function Yn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,i=n%o;if(i===0n)return r.toString();let a=Ud(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function li(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Dd}${n}${o}`}function Ko(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,i=e%o;if(i===0n)return r.toString();let s=i.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(n,t)));return s=s.replace(/0+$/,""),s?`${r.toString()}.${s}`:r.toString()}function ci(e,t){return Ko(e,t,6)}function Ha(e){return Ko(e,9,2)}function ja(e){return e.toLocaleString("en-US")}function Yo(e){return e===56||e===97}function Qo(e){return e.gasPrice??e.maxFeePerGas}function Va(e,t=!1){return t?Qo(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Zo(e,t=!1){if(t){let n=Qo(e);return n!==void 0?e.gasLimit*n:null}return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function Xo(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function qa(e,t=0){if(t>4||e===null||e===void 0)return"";if(typeof e=="string")return e.toLowerCase();if(typeof e!="object")return"";let n=e,o=[];return typeof n.name=="string"&&o.push(n.name),typeof n.shortMessage=="string"&&o.push(n.shortMessage),typeof n.message=="string"&&o.push(n.message),typeof n.details=="string"&&o.push(n.details),n.cause!==void 0&&o.push(qa(n.cause,t+1)),o.join(`
6
+ `).toLowerCase()}function Gd(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.shortMessage=="string")return t.shortMessage;if(typeof t.message=="string")return t.message}return""}function di(e,t={},n="Failed to send transaction."){let o=qa(e);if(!o)return n;let r=t.nativeSymbol?.trim()||"gas token",i=t.networkName?.trim();if(o.includes("user rejected")||o.includes("userrejected")||o.includes("user denied")||o.includes("user cancelled")||o.includes("user canceled")||o.includes("action_rejected")||o.includes("rejected by user"))return"Transaction was cancelled.";if(o.includes("insufficientfunds")||o.includes("insufficient funds")||o.includes("exceeds the balance of the account")||o.includes("insufficient balance for transfer")){let a=i?` on ${i}`:"";return`Not enough ${r} to cover the gas fee.Please top up your ${r} balance and try again.`}return o.includes("transaction underpriced")||o.includes("replacement transaction underpriced")||o.includes("fee too low")?"Gas fee was too low for the network. Please try again.":o.includes("nonce too low")||o.includes("nonce has already been used")||o.includes("nonce too high")?"Pending transactions are out of order. Refresh the page and try again.":o.includes("execution reverted")||o.includes("contractfunctionrevertederror")||o.includes("contractfunctionexecutionerror")?"The transaction was rejected by the contract. The recipient or token may be invalid.":o.match(/chain \d+ is not configured/)?"This network is not registered in the app. Contact support.":o.includes("http request failed")||o.includes("failed to fetch")||o.includes("network request failed")||o.includes("timeout")||o.includes("econnreset")||o.includes("rpc error")||o.includes("429")?"Network connection failed. Check your internet and try again.":o.includes("estimategas")||o.includes("gas estimation failed")?"Could not estimate the gas fee. The recipient address or amount may be invalid.":Gd(e)||n}var zd=2000000000n,$d=1000000000n;async function Jo(e,t,n){let o=new AbortController,r=setTimeout(()=>o.abort(),8e3),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:o.signal}).finally(()=>clearTimeout(r));if(!i.ok)throw new Error(`RPC ${t} HTTP ${i.status}`);let a=await i.json();if(a.error)throw new Error(`RPC ${t}: ${a.error.message}`);if(a.result===void 0)throw new Error(`RPC ${t}: empty result`);return a.result}function er(e){return BigInt(e)}function Hd(e){return`0x${e.toString(16)}`}function jd(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Hd(e.value)),e.data&&(t.data=e.data),t}function Vd(e){return e===56||e===97}async function Ka(e){try{let t=await Jo(e,"eth_gasPrice",[]);return{gasPrice:er(t)}}catch{return{gasPrice:zd}}}async function qd(e,t){let n=$d;try{let o=await Jo(e,"eth_maxPriorityFeePerGas",[]);n=er(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Kd(e,t){if(t)return Ka(e);let n;try{n=(await Jo(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?qd(e,er(n)):Ka(e)}async function Ya(e,t){let n=Vd(t.chainId),o=jd(t),[r,i]=await Promise.all([Jo(e,"eth_estimateGas",[o]),Kd(e,n)]);return{gasLimit:er(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function Qa(e){let{estimateGas:t,sendTransaction:n,getTransactionReceipt:o}=e;return{canSend:!!n,canEstimateGas(r){return!!t||!!r},async estimateGas(r,i){if(t)return t(r);if(i)return Ya(i,r);throw new Error("Gas estimation is not available.")},async sendTransaction(r){if(!n)throw new Error("Sending is not available for this wallet.");return n(r)},getTransactionReceipt:o}}var Yd=1500,Qd=120;function Za(e){return!!(e.token||e.recipient||e.amount)}function pi({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},i=e.trim(),a=An(t,n.quantity.decimals),s;return i?qt(i)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in a?r.amount=a.error:(s=a.value,s>o&&(r.amount="Amount exceeds available balance.")),!mn(n)&&!qt(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:i&&qt(i)?i:void 0}}function ui({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return mn(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:fo(e.address),data:li(n,o),value:0n,chainId:e.chainId,from:r}}function Zd(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Xd=e=>new Promise(t=>setTimeout(t,e));async function Xa({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=Yd,pollMaxAttempts:i=Qd}){let a=await e.sendTransaction(t);o(a);let{getTransactionReceipt:s}=e;if(!s)return"success";for(let l=0;l<i;l+=1){let c=await s({hash:a,chainId:n}).catch(()=>null);if(c)return Zd(c)?"reverted":"success";await Xd(r)}return"timeout"}var Ja=["token","recipient","amount","review"];function es(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:i="recipient",token:a,tokens:s=[],onTokenChange:l,sendTransaction:c,getTransactionReceipt:u,estimateGas:g,getTokenPriceUsd:h,onSubmitted:d,onSuccess:x,onFailed:w,onExit:v,onOutlink:m}=e,S=G.useMemo(()=>Qa({sendTransaction:c,getTransactionReceipt:u,estimateGas:g}),[c,u,g]),[p,R]=G.useState(a);G.useEffect(()=>{R(a)},[a.address,a.chainId]);let[k,C]=G.useState(i),[E,T]=G.useState(""),[I,U]=G.useState(""),[M,V]=G.useState({}),[L,Y]=G.useState("idle"),[F,_]=G.useState(""),[ne,q]=G.useState(""),[O,de]=G.useState(null),[re,$]=G.useState(!1),[ke,fe]=G.useState(""),ee=G.useRef(0),[ge,Le]=G.useState(null),[K,we]=G.useState(""),[Me,De]=G.useState(()=>Kn(n)),Ft=G.useRef(new Set),he=G.useCallback((P,Z)=>{Ft.current.has(P)||(Ft.current.add(P),ve("send",P,Z))},[]);G.useEffect(()=>{he("opened"),i!=="token"&&he("token_selected",{tags:{item_id:a.symbol}})},[he,i,a.symbol]);let Ze=G.useMemo(()=>Ae(t),[t]),{transactionUrl:rt,chainInfo:Oe}=qo(Ze,p.chainId,F||void 0,!0),_e=Oe?.currency_symbol??"",Ue=Oe?.name??`Chain ID ${p.chainId}`,en=G.useRef({nativeSymbol:_e||void 0,networkName:Ue,tokenSymbol:p.symbol});en.current={nativeSymbol:_e||void 0,networkName:Ue,tokenSymbol:p.symbol};let it=G.useMemo(()=>BigInt(p.quantity.numeric||"0"),[p.quantity.numeric]),kt=G.useMemo(()=>fn(p.quantity.numeric,p.quantity.decimals),[p.quantity.numeric,p.quantity.decimals]),He=h?.(p),Bt=G.useMemo(()=>{if(He===void 0)return;let P=parseFloat(I.replace(/,/g,""));return Number.isFinite(P)?P*He:0},[I,He]);G.useEffect(()=>{U(""),V({})},[p.address,p.chainId]),G.useEffect(()=>{ee.current+=1,de(null),fe(""),$(!1)},[p.address,p.chainId,E,I]),G.useEffect(()=>{De(Kn(n))},[n]);let St=G.useCallback(P=>{T(P),V(Z=>({...Z,recipient:void 0}))},[]),Se=G.useCallback(P=>{U(P),V(Z=>({...Z,amount:void 0}))},[]),Ht=G.useCallback(()=>{U(kt.replace(/,/g,"")),V(P=>({...P,amount:void 0}))},[kt]),jt=G.useCallback(P=>{R(P),l?.(P),he("token_selected",{tags:{item_id:P.symbol}}),C("recipient")},[l,he]),at=G.useCallback(()=>C("token"),[]),je=G.useCallback(()=>{C(P=>{if(P==="result")return"review";if(P===i)return v?.(),P;let Z=Ja.indexOf(P);return Z<=0?(v?.(),P):Ja[Z-1]})},[i,v]),st=G.useCallback(()=>{let{errors:P}=pi({recipient:E,amount:"1",token:p,balanceRaw:it});if(P.recipient){V(Z=>({...Z,recipient:P.recipient}));return}V(Z=>({...Z,recipient:void 0})),he("recipient_entered"),C("amount")},[E,p,it,he]),Xe=G.useCallback(P=>{T(P),V(Z=>({...Z,recipient:void 0})),he("recipient_entered"),C("amount")},[he]),Ve=G.useCallback(()=>{let P=pi({recipient:E,amount:I,token:p,balanceRaw:it});V(P.errors),!(Za(P.errors)||P.rawAmount===void 0||!P.recipient)&&(Le(P.rawAmount),we(P.recipient),de(null),fe(""),Y("idle"),he("amount_entered"),C("review"))},[E,I,p,it,he]);G.useEffect(()=>{if(k!=="review"||!K||ge===null||O!==null||re||ke||!S.canEstimateGas(Oe?.rpc))return;let P=++ee.current;$(!0),fe(""),(async()=>{try{let Z=ui({token:p,walletAddress:n,recipient:K,rawAmount:ge}),se=await S.estimateGas(Z,Oe?.rpc);if(ee.current!==P)return;de(se)}catch(Z){if(ee.current!==P)return;fe(di(Z,en.current,"Failed to estimate gas."))}finally{ee.current===P&&$(!1)}})()},[k,K,ge,O,re,ke,S,Oe?.rpc,p,n]);let Re=G.useMemo(()=>{if(!mn(p)||!O||ge===null)return!1;let P=Zo(O,Yo(p.chainId));return P===null?!1:ge+P>it},[p,O,ge,it]),gt=G.useCallback(async()=>{if(!(!K||ge===null)&&!Re){q(""),_(""),Y("submitting"),he("submitted");try{let P="",Z=await Xa({repository:S,args:ui({token:p,walletAddress:n,recipient:K,rawAmount:ge}),chainId:p.chainId,onSubmitted:se=>{P=se,_(se),Y("confirming"),De(ai(n,K)),d?.({txHash:se,chainId:p.chainId,amount:I,tokenSymbol:p.symbol,recipient:K})}});if(Z==="success")Y("success"),he("confirmed"),P&&x?x?.(P):C("result");else if(Z==="reverted"){let se="Transaction reverted on-chain.";Y("error"),q(se),he("confirmed",{status:"failure",reason:bt(new Error(se))}),P&&w?w({txHash:P,chainId:p.chainId,message:se}):C("result")}else{let se="Transaction receipt was not found. Please check again later.";Y("error"),q(se),he("confirmed",{status:"failure",reason:"timeout"}),P&&w?w({txHash:P,chainId:p.chainId,message:se}):C("result")}}catch(P){Y("error"),he("confirmed",{status:"failure",reason:bt(P)}),q(di(P,{nativeSymbol:_e||void 0,networkName:Ue,tokenSymbol:p.symbol})),C("result")}}},[S,K,ge,Re,p,I,n,d,x,w,_e,Ue,he]),[lt,Je]=G.useState(!1),Rt=G.useRef(void 0);G.useEffect(()=>()=>clearTimeout(Rt.current),[]);let tn=G.useCallback(async()=>{if(F)try{await navigator.clipboard.writeText(F),Je(!0),clearTimeout(Rt.current),Rt.current=setTimeout(()=>Je(!1),2e3)}catch{}},[F]),pn=G.useCallback(()=>{if(!rt||!F)return;let P=ct=>{typeof window<"u"&&window.open(ct,"_blank","noopener,noreferrer")};if(!m){P(rt);return}let Z=m(rt,{category:"send",origin:"send-transaction",payload:{chainId:p.chainId,txHash:F}});if(Z&&typeof Z.then=="function"){let ct=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;Z.then(on=>{if(on===null){ct?.close();return}let ht=on??rt;if(ct)try{ct.location.href=ht}catch{ct.close(),P(ht)}else P(ht)});return}let se=Z;se!==null&&P(se??rt)},[m,p.chainId,rt,F]),nn=G.useCallback(()=>{q(""),_(""),Y("idle"),de(null),fe(""),Ft.current.delete("submitted"),Ft.current.delete("confirmed"),C("review")},[]);return{step:k,status:L,token:p,tokens:s.length>0?s:[p],recipient:E,amount:I,amountUsd:Bt,fieldErrors:M,error:ne,txHash:F,gasEstimate:O,gasLoading:re,gasError:ke,insufficientGas:Re,reviewRawAmount:ge,reviewRecipient:K,recentAddresses:Me,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Ze,transactionUrl:rt,networkName:Ue,nativeSymbol:_e,nativeDecimals:Oe?.currency_decimals??p.quantity.decimals,balanceRaw:it,balanceText:kt,priceUsd:He,canSelectToken:(s.length>0?s:[p]).length>1,canSend:S.canSend,getTokenPriceUsd:h,setRecipient:St,setAmount:Se,setMax:Ht,selectToken:jt,goToTokenSelect:at,selectRecipient:Xe,submitRecipient:st,submitAmount:Ve,confirmSend:gt,retry:nn,back:je,hashCopied:lt,copyHash:tn,openTransaction:pn}}import*as Wt from"react";import{jsx as mo,jsxs as fi}from"react/jsx-runtime";function ts({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:i,token:a,setMax:s}=e,l=Wt.useRef(null),c=Wt.useCallback(()=>{requestAnimationFrame(()=>{let w=l.current;if(!w)return;let v=w.value.length;w.setSelectionRange(v,v)})},[]);Wt.useEffect(()=>{l.current?.focus(),c()},[c]),Wt.useEffect(()=>{t===""&&(h(!1),c())},[t,c]);let u=Wt.useMemo(()=>{let w=An(t,a.quantity.decimals);return"value"in w&&w.value>i},[t,a.quantity.decimals,i]),[g,h]=Wt.useState(!1),d=!g&&t===""?"0.00":t,x=t.trim()===""||t.trim()==="0";return mo("div",{className:"sf-body sf-amount",children:fi("div",{className:"sf-amount-center",children:[mo("span",{className:"sf-amount-usd",children:o!==void 0?Xo(o):"\xA0"}),mo("div",{className:"sf-amount-input-wrap","data-over":u||void 0,"data-empty":x||void 0,onClick:()=>l.current?.focus(),children:mo("input",{ref:l,className:"sf-amount-input",value:d,onChange:w=>{let v=w.target.value;if(g)n(v);else if(t===""){if(v.length<4)return;h(!0);let m=v.startsWith("0.00")?v.slice(4):v;n(m)}else h(!0),n(v)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${a.symbol}`,size:1})}),fi("div",{className:"sf-amount-balance",children:[mo("span",{children:"Balance:"}),fi("button",{type:"button",className:"sf-amount-max",onClick:s,"data-track":"amount_max",children:[r," ",a.symbol]})]})]})})}import*as Ut from"react";var ep=new Set(["0xff42c13d927a6b9265236619161accb227b6d452","0x9364ea6790f6e0ecfaa5164085f2a7de34ec55fb"].map(e=>e.toLowerCase()));function os(e){return ep.has(e.toLowerCase())}var ns={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function go(e,t){let n=ye[e];if(t===n.cross)return ns.cross;if(t===n.bsc)return ns.bsc}var tp={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function rn(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:i="png"}=n,a=tp[e],s=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${o}${s}`}import{jsx as Tt,jsxs as tr}from"react/jsx-runtime";function rs({size:e=20,className:t}){return tr("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),Tt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function is({size:e=20,className:t}){return Tt("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:Tt("path",{d:"M9 2h6a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2M12 11v6M9 14h6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function as({size:e=20,className:t}){return tr("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),Tt("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function ss({size:e=16,className:t}){return Tt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:Tt("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ls({size:e=56,className:t}){return tr("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),Tt("path",{d:"M17 28.5 24.2 35.5 39 20.5",stroke:"var(--ds-accent-primary-on, #ffffff)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function cs({size:e=56,className:t}){return tr("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Tt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),Tt("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as Be,jsxs as Kt}from"react/jsx-runtime";function ds(e,t){return e.name||`Account ${(e.index??t)+1}`}function ps(e){return e.trim().slice(0,1).toUpperCase()||"A"}function us(e){return e.toLowerCase()}function fs({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:i,walletAddress:a,resolvedEnv:s,selectRecipient:l}=e,c=Ut.useMemo(()=>i.filter(p=>p.address.toLowerCase()!==a.toLowerCase()),[i,a]),u=c.length>0,g=Ut.useMemo(()=>new Map(c.map((p,R)=>[us(p.address),{account:p,index:R}])),[c]),[h,d]=Ut.useState("recent"),x=Ut.useRef(null);Ut.useEffect(()=>{x.current?.focus()},[]);let w="1A1A2E",v=Ut.useCallback(async()=>{try{let p=await navigator.clipboard.readText();p&&n(p.trim())}catch{}},[n]),m=t.trim().length>0,S=qt(t.trim());return Kt("div",{className:"sf-recipient",children:[Kt("div",{className:"sf-recipient-top",children:[Kt("div",{className:"sf-address-field","data-filled":m||void 0,"data-invalid":o.recipient||void 0,children:[Be("textarea",{ref:x,className:"sf-address-input",value:t,onChange:p=>n(p.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:m?2:1}),m?Be("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear","data-track":"recipient_clear",children:Be(as,{size:20})}):Be("button",{type:"button",className:"sf-address-action",onClick:v,"aria-label":"Paste from clipboard","data-track":"recipient_paste",children:Be(is,{size:20})})]}),o.recipient&&Be("p",{className:"sf-field-error",role:"alert",children:o.recipient}),Kt("div",{className:"sf-tabs",role:"tablist",children:[Be("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="recent"||void 0,"aria-selected":h==="recent",onClick:()=>d("recent"),"data-track":"recipient_tab","data-track-id":"recent",children:"Recent"}),u&&Be("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="account"||void 0,"aria-selected":h==="account",onClick:()=>d("account"),"data-track":"recipient_tab","data-track-id":"account",children:"My Account"})]})]}),Be("div",{className:"sf-address-list",children:h==="account"&&u?c.map((p,R)=>{let k=ds(p,R),C=rn(s,p.address,{size:56,bg:w});return Kt("button",{type:"button",className:"sf-address-row",onClick:()=>l(p.address),"data-track":"recipient_item",children:[Kt("span",{className:"sf-address-avatar",children:[C&&Be("img",{src:C,alt:"",width:40,height:40,draggable:!1,onError:E=>{E.currentTarget.style.display="none"}}),Be("span",{className:"sf-address-avatar-fallback",children:ps(k)})]}),Kt("span",{className:"sf-address-meta",children:[Be("span",{className:"sf-address-name",children:k}),Be("span",{className:"sf-address-value",children:xt(p.address)})]})]},p.address)}):r.length>0?r.map(p=>{let R=g.get(us(p.address)),k=R?ds(R.account,R.index):xt(p.address),C=rn(s,p.address,{size:56,bg:w});return Kt("button",{type:"button",className:"sf-address-row",onClick:()=>l(p.address),"data-track":"recipient_item",children:[Kt("span",{className:"sf-address-avatar",children:[C&&Be("img",{src:C,alt:"",width:40,height:40,draggable:!1,onError:E=>{E.currentTarget.style.display="none"}}),Be("span",{className:"sf-address-avatar-fallback",children:ps(k)})]}),Kt("span",{className:"sf-address-meta",children:[Be("span",{className:"sf-address-name",children:k}),Be("span",{className:"sf-address-value",children:xt(p.address)})]})]},p.address)}):Be("div",{className:"sf-empty",children:"No send history"})}),m&&!S&&!o.recipient&&Be("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as tt,jsxs as Qn}from"react/jsx-runtime";function gs({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:i,openTransaction:a}=e,s=t==="error",l=t==="success";return s?Qn("div",{className:"sf-body sf-result sf-result--error",children:[tt("span",{className:"sf-result-icon",children:tt(cs,{size:56})}),Qn("div",{className:"sf-result-copy",children:[tt("h3",{className:"sf-result-title",children:"Transaction Failed"}),tt("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&tt(ms,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]}):Qn("div",{className:"sf-body sf-result",children:[tt("span",{className:"sf-result-icon","data-pending":!l||void 0,children:l?tt(ls,{size:56}):tt("span",{className:"sf-result-spinner"})}),Qn("div",{className:"sf-result-copy",children:[tt("h3",{className:"sf-result-title",children:l?"Transaction Complete":"Transaction in Progress"}),tt("p",{className:"sf-result-desc",children:l?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&tt(ms,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]})}function ms({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return Qn("div",{className:"sf-result-hash-card",children:[tt("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),Qn("div",{className:"sf-result-hash-row",children:[tt("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer","data-track":"tx_link_open",children:xt(e)}),tt("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash","data-track":"tx_hash_copy",children:t?tt(Nn,{size:16}):"Copy"})]})]})}import{jsx as Ce,jsxs as nt}from"react/jsx-runtime";var nr="\u2014";function hs({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:i,walletAddress:a,networkName:s,nativeSymbol:l,nativeDecimals:c,gasEstimate:u,gasLoading:g,gasError:h,insufficientGas:d,error:x,resolvedEnv:w}=e,v=mn(t),m=n!==null?Ko(n,t.quantity.decimals):"",S=r?.trim()||`Account ${(i[0]?.index??0)+1}`,p=rn(w,a,{size:56,bg:"1A1A2E"}),R=l||(v?t.symbol:""),k=Yo(t.chainId),C=u?Va(u,k):null,E=u?Zo(u,k):null,T=L=>L!==null&&R?`${ci(L,c)} ${R}`:nr,I=L=>L!==void 0?`${Ha(L)} Gwei`:nr,U=(()=>{if(!v||!u||E===null||n===null)return nr;let L=n+E;return`${ci(L,c)} ${R||t.symbol}`})(),M=L=>g?"\u2026":L,V=[{label:"Est. Tx Fee",value:M(T(E))},...C==="dynamic"?[{label:"Max Priority Fee",value:M(I(u?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:M(I(u?.maxFeePerGas))}]:C==="legacy"?[{label:"Gas Price",value:M(I(u?Qo(u):void 0))}]:[],{label:"Gas Limit",value:M(u?ja(u.gasLimit):nr)}];return nt("div",{className:"sf-body sf-review",children:[nt("div",{className:"sf-review-amount",children:[Ce("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:L=>{L.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),nt("span",{className:"sf-review-amount-value",children:[m,Ce("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),nt("div",{className:"sf-review-parties",children:[nt("div",{className:"sf-review-card sf-review-party",children:[Ce("span",{className:"sf-review-party-label",children:"From"}),nt("div",{className:"sf-review-party-head",children:[Ce("span",{className:"sf-review-party-avatar",children:p&&Ce("img",{src:p,alt:"",width:28,height:28,draggable:!1,onError:L=>{L.currentTarget.style.display="none"}})}),Ce("span",{className:"sf-review-party-name",children:S})]}),Ce("span",{className:"sf-review-party-addr",children:a})]}),Ce("span",{className:"sf-review-arrow","aria-hidden":!0,children:Ce(ss,{size:16})}),nt("div",{className:"sf-review-card sf-review-party",children:[Ce("span",{className:"sf-review-party-label",children:"To"}),Ce("span",{className:"sf-review-party-addr",children:o})]})]}),nt("section",{className:"sf-review-card",children:[Ce("h3",{className:"sf-review-section-title",children:"Summary"}),nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Network"}),Ce("span",{className:"sf-review-row-value",children:s})]}),V.map(L=>nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:L.label}),Ce("span",{className:"sf-review-row-value",children:L.value})]},L.label))]}),nt("section",{className:"sf-review-card",children:[Ce("h3",{className:"sf-review-section-title",children:"Total"}),nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Total Amount"}),nt("span",{className:"sf-review-row-value",children:[m," ",t.symbol]})]}),v&&nt("div",{className:"sf-review-row",children:[Ce("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),Ce("span",{className:"sf-review-row-value",children:M(U)})]})]}),d&&!h&&!x&&nt("div",{className:"sf-message sf-message--error",role:"alert",children:["Not enough ",R||t.symbol," to cover the amount plus the network fee. Reduce the amount and try again."]}),(h||x)&&Ce("div",{className:"sf-message sf-message--error",role:"alert",children:h||x})]})}import*as or from"react";import{jsx as gn,jsxs as Fn}from"react/jsx-runtime";function bs({flow:e}){let[t,n]=or.useState(""),o=t.trim().toLowerCase(),r=or.useMemo(()=>o?e.tokens.filter(i=>i.symbol.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return Fn("div",{className:"sf-body sf-token-select",children:[Fn("div",{className:"sf-search",children:[gn(rs,{size:20}),gn("input",{className:"sf-search-input",value:t,onChange:i=>n(i.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),Fn("div",{className:"sf-token-list",children:[r.map(i=>{let a=`${i.chainId}:${i.address.toLowerCase()}`,s=go(e.resolvedEnv,i.chainId),l=e.getTokenPriceUsd?.(i);return Fn("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(i),"data-track":"token_item","data-track-id":i.symbol,children:[Fn("span",{className:"sf-token-left",children:[Fn("span",{className:"sf-token-icon-wrap",children:[gn("img",{className:"sf-token-icon",src:i.icon_url,alt:"",width:40,height:40,loading:"lazy",draggable:!1,onError:c=>{c.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),s&&gn("img",{className:"sf-token-chain-badge",src:s,alt:"","aria-hidden":!0,width:16,height:16,loading:"lazy",draggable:!1,onError:c=>{c.currentTarget.style.display="none"}})]}),gn("span",{className:"sf-token-name",children:i.symbol})]}),Fn("span",{className:"sf-token-right",children:[gn("span",{className:"sf-token-balance",children:fn(i.quantity.numeric,i.quantity.decimals)}),l!==void 0&&gn("span",{className:"sf-token-price",children:Xo(l)})]})]},a)}),r.length===0&&gn("div",{className:"sf-empty",children:"No tokens found"})]})]})}Q(`.sf-root{display:flex;flex-direction:column;flex:1;min-height:0;font-family:inherit}.sf-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px;flex-shrink:0;position:relative;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.sf-header .sf-header-btn:last-child{position:absolute;top:24px;right:24px}.sf-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;filter:none;transition:color .15s ease}.sf-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85));filter:none}.sf-header-title{position:absolute;left:50%;transform:translate(-50%);text-align:center;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);pointer-events:none}.sf-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .sf-body{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-body::-webkit-scrollbar{width:4px;height:4px}.sf-body::-webkit-scrollbar-track,.sf-body::-webkit-scrollbar-corner{background:transparent}.sf-body::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}.sf-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .sf-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .sf-body::-webkit-scrollbar-thumb:hover{background:#0003}.sf-empty{padding:32px 0;text-align:center;font-family:inherit;font-size:14px;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-field-error{margin:8px 24px 0;font-family:inherit;font-size:12px;line-height:1.5;color:var(--ds-system-red-default, #da0b2e)}.sf-message--error{margin:16px 0 0;padding:12px 16px;background:var(--ds-system-red-low, #ffeeee);color:var(--ds-system-red-high, #d20609);font-family:inherit;font-size:13px;line-height:1.5;border-radius:12px;width:100%;box-sizing:border-box}.sf-footer{display:flex;flex-shrink:0;padding:16px 24px 24px}.sf-footer:empty{display:none}.sf-footer-row{display:flex;gap:8px;width:100%}.sf-footer-row .sf-btn,.sf-footer-row .sf-btn--secondary{flex:1 1 0;min-width:0}.sf-footer>.sf-btn{width:100%}.sf-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:1;height:48px;padding:0 24px;border:none;border-radius:12px;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:background-color .15s ease,transform .1s ease}.sf-btn--primary{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff)}.sf-btn--primary:hover:not(:disabled):not([data-disabled]){background:var(--ds-accent-primary-high, #00a0a2)}.sf-btn--primary:active:not(:disabled):not([data-disabled]){transform:scale(.97)}.sf-btn--primary[data-disabled],.sf-btn--primary:disabled{background:var(--ds-accent-primary-default, #00b4b7);color:var(--ds-accent-primary-on, #ffffff);cursor:default;opacity:.5}.sf-btn--secondary{flex:0 0 120px;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-token-select{padding:0;display:flex;flex-direction:column}.sf-token-select .sf-search{margin:16px 24px}.sf-token-select .sf-token-list{width:100%;margin-top:0}.sf-search{display:flex;align-items:center;gap:8px;padding:12px 16px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-low, rgba(0, 0, 0, .4));box-sizing:border-box;transition:border-color .15s ease}.sf-search:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-search:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-search-input{flex:1;min-width:0;border:none;background:transparent;outline:none;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))}.sf-search-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-token-list{display:flex;flex-direction:column;margin-top:8px}.sf-token-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-token-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-token-left{display:flex;align-items:center;gap:16px;min-width:0}.sf-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.sf-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain}.sf-token-chain-badge{position:absolute;right:-2px;bottom:-2px;width:16px;height:16px;border-radius:50%;object-fit:cover}.sf-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}.sf-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.sf-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}.sf-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}.sf-recipient{display:flex;flex-direction:column;flex:1;min-height:0}.sf-recipient-top{display:flex;flex-direction:column;flex-shrink:0;padding:16px 24px 0}.sf-address-field{display:flex;align-items:center;gap:8px;padding:12px;border-radius:12px;border:1.5px solid transparent;background:var(--ds-surface-medium, #f5f7fa);transition:border-color .15s ease;box-sizing:border-box}.sf-address-field:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.sf-address-field:focus-within{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-filled]{border-color:var(--ds-accent-primary-default, #00b4b7)}.sf-address-field[data-invalid]{border-color:var(--ds-system-red-default, #da0b2e)}.sf-address-input{flex:1;min-width:0;border:none;background:transparent;outline:none;resize:none;overflow:hidden;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));word-break:break-word;overflow-wrap:anywhere}.sf-address-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-address-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;padding:0;border:none;background:transparent;border-radius:6px;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease}.sf-address-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-address-field[data-filled] .sf-address-action{border-radius:9999px}.sf-tabs{display:flex;gap:0;margin:16px 0 0}.sf-tab{position:relative;padding:8px 12px;border:none;background:transparent;cursor:pointer;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-tab[data-active]{color:var(--ds-accent-primary-high, #00a0a2)}.sf-tab[data-active]:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:3px;border-radius:9999px;background:var(--ds-accent-primary-high, #00a0a2)}.sf-address-list{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;margin-top:8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent}[data-theme=light] .sf-address-list{scrollbar-color:rgba(0,0,0,.12) transparent}.sf-address-list::-webkit-scrollbar{width:4px}.sf-address-list::-webkit-scrollbar-track{background:transparent}.sf-address-list::-webkit-scrollbar-thumb{border-radius:4px;background:#ffffff26}[data-theme=light] .sf-address-list::-webkit-scrollbar-thumb{background:#0000001f}.sf-address-row{display:flex;align-items:center;gap:16px;width:100%;padding:12px 24px;border:none;background:transparent;cursor:pointer;text-align:left;font-family:inherit;border-radius:0;box-sizing:border-box;transition:background-color .15s ease}.sf-address-row:hover{background:var(--ds-surface-medium, rgba(0, 0, 0, .04))}.sf-address-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;flex-shrink:0;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);color:var(--ds-content-medium, rgba(0, 0, 0, .65));font-size:14px;font-weight:600}.sf-address-avatar img{position:absolute;inset:0;z-index:1;width:100%;height:100%;object-fit:cover}.sf-address-avatar-fallback{position:relative;z-index:0}.sf-address-meta{display:flex;flex-direction:column;min-width:0}.sf-address-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}.sf-address-value{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-drawer-content .sf-header{padding:16px}.wi-drawer-content .sf-header .sf-header-btn:last-child{top:16px;right:16px}.wi-drawer-content .sf-token-select{padding:0}.wi-drawer-content .sf-token-select .sf-search{margin:16px}.wi-drawer-content .sf-token-row{padding:12px 16px}.wi-drawer-content .sf-recipient-top{padding:16px 16px 0}.wi-drawer-content .sf-address-row{padding:12px 16px}.wi-drawer-content .sf-footer{padding:12px 16px 24px}.wi-drawer-content .sf-field-error,.wi-drawer-content .sf-message--error{margin:16px 0 0;width:auto}.sf-amount{display:flex;flex-direction:column}.sf-amount-center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px;padding:64px 24px 48px;text-align:center}.sf-amount-usd{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));min-height:21px}.sf-amount-input-wrap{display:flex;justify-content:center;max-width:100%}.sf-amount-input{width:auto;max-width:100%;border:none;background:transparent;outline:none;text-align:center;font-family:inherit;font-size:40px;font-weight:700;line-height:1.25;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);field-sizing:content}.sf-amount-input-wrap[data-empty] .sf-amount-input,.sf-amount-input::placeholder{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-input-wrap[data-over] .sf-amount-input{color:var(--ds-system-red-default, #da0b2e)}.sf-amount-balance{display:inline-flex;align-items:center;gap:4px;font-family:inherit;font-size:14px;font-weight:400;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.sf-amount-max{border:none;background:transparent;padding:0;cursor:pointer;font:inherit;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.sf-amount-max:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-drawer-content .sf-amount-center{padding:64px 16px 48px}.sf-review{display:flex;flex-direction:column;gap:16px;padding:24px}.sf-review-amount{display:flex;align-items:center;gap:12px;padding:0;background:transparent}.sf-review-amount-icon{width:40px;height:40px;border-radius:0;object-fit:contain;flex-shrink:0}.sf-review-amount-value{display:inline-flex;flex-direction:column;align-items:flex-start;gap:0;font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);word-break:break-all}.sf-review-amount-symbol{font-size:12px;font-weight:400;line-height:1.5;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-parties{position:relative;display:flex;flex-direction:column;gap:0}.sf-review-arrow{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin:-4px auto;border-radius:50%;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-card{display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa)}.sf-review-party-label{font-family:inherit;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-party-head{display:flex;align-items:center;gap:8px}.sf-review-party-avatar{display:inline-flex;width:24px;height:24px;border-radius:50%;overflow:hidden;background:var(--ds-surface-high, #edf1f2);flex-shrink:0}.sf-review-party-avatar img{width:100%;height:100%;object-fit:cover}.sf-review-party-name{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.sf-review-party-addr{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));word-break:break-all}.sf-review-section-title{margin:0 0 4px;font-family:inherit;font-size:16px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-review-row{display:flex;flex-direction:column;align-items:flex-start;gap:4px}.sf-review-row-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-review-row-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));text-align:left;word-break:break-all}.wi-drawer-content .sf-review{padding:16px}.sf-result{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:48px 24px;text-align:center}.sf-result-icon{display:inline-flex;align-items:center;justify-content:center;width:56px;height:56px}.sf-result-spinner{width:56px;height:56px;border-radius:50%;border:4px solid var(--ds-border-medium, rgba(0, 0, 0, .18));border-top-color:var(--ds-accent-primary-default, #00b4b7);animation:sf-spin .8s linear infinite}@keyframes sf-spin{to{transform:rotate(360deg)}}.sf-result-copy{display:flex;flex-direction:column;gap:8px}.sf-result-title{margin:0;font-family:inherit;font-size:18px;font-weight:600;letter-spacing:-.01em;color:var(--ds-content-highest, #000000)}.sf-result-desc{margin:0;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))}.sf-result-hash-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);text-align:left}.sf-result-hash-label{font-family:inherit;font-size:12px;font-weight:500;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.sf-result-hash-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.sf-result-hash-link{border:none;background:transparent;padding:0;cursor:pointer;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;color:var(--ds-accent-primary-high, #00a0a2)}.sf-result-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:44px;height:28px;padding:0 10px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));border-radius:8px;background:var(--ds-surface-default, #ffffff);cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;color:var(--ds-content-high, rgba(0, 0, 0, .85))}
7
+ `);import{jsx as We,jsxs as rr}from"react/jsx-runtime";var np={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function ir({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...i}){let a=ws.useCallback(m=>{o?.(m),n?.(m)},[n,o]),l=es({...i,onSuccess:o||n?a:void 0,onExit:t}),{step:c,status:u}=l,g=qt(l.recipient.trim()),h=An(l.amount,l.token.quantity.decimals),d="value"in h&&h.value<=l.balanceRaw,x=u==="submitting"||u==="confirming",w=c!=="result",v=np[c]??"";return We(be,{feature:"send",children:rr("div",{className:me("sf-root",r),"data-step":c,children:[rr("header",{className:"sf-header",children:[w?We("button",{type:"button",className:"sf-header-btn",onClick:l.back,"aria-label":"Back","data-track":"back",children:We(En,{size:24})}):We("span",{className:"sf-header-btn","aria-hidden":!0}),We("span",{className:"sf-header-title",children:v}),We("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close","data-track":"close",children:We(Vt,{size:24})})]}),c==="token"&&We(bs,{flow:l}),c==="recipient"&&We(fs,{flow:l}),c==="amount"&&We(ts,{flow:l}),c==="review"&&We(hs,{flow:l}),c==="result"&&We(gs,{flow:l}),rr("footer",{className:"sf-footer","data-step":c,children:[c==="recipient"&&We("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:l.submitRecipient,"data-disabled":!g||void 0,"aria-disabled":!g,"data-track":"recipient_next",children:"Next"}),c==="amount"&&We("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:l.submitAmount,"data-disabled":!d||void 0,"aria-disabled":!d,"data-track":"amount_next",children:"Next"}),c==="review"&&rr("div",{className:"sf-footer-row",children:[We("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:l.back,disabled:x,"data-track":"review_cancel",children:"Cancel"}),We("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:l.confirmSend,disabled:x||!l.canSend||l.insufficientGas,"data-track":"review_send",children:x?"Sending...":"Send"})]}),c==="result"&&u==="success"&&We("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(l.txHash||void 0),"data-track":"result_ok",children:"All done"}),c==="result"&&u==="error"&&We("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:l.retry,"data-track":"result_retry",children:"Try Again"})]})]})})}import*as xs from"@radix-ui/react-popover";import{Drawer as op}from"vaul";import{jsx as ar,jsxs as rp}from"react/jsx-runtime";function vs({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:i}=un(),a=n!=null,s=e??!0,l=a?n:rp("button",{type:"button",className:me("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[ar(Ea,{size:o?14:16}),ar("span",{className:"wi-trigger-address",children:xt(i)})]});return o?ar(op.Trigger,{asChild:s,children:l}):ar(xs.Trigger,{asChild:s,children:l})}import*as H from"react";import*as Er from"@radix-ui/react-popover";import{Drawer as Nr}from"vaul";import So from"bignumber.js";import{useQueries as ip}from"@tanstack/react-query";import{useMemo as ap}from"react";var mi="user-balance";async function sp(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),i=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!i.ok)throw new Error(`Failed to fetch token balance: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Token balance API error: ${a.code}`);return a.data}function hn(e,t,n=!0){let o=ye[e],r=[o.cross,o.bsc],i=ip({queries:r.map(c=>({queryKey:[mi,e,t,c],queryFn:async({signal:u})=>sp(await ce("walletServer",e),c,t,u),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),a=i.some(c=>c.isLoading),s=i.some(c=>c.isError);return{tokens:ap(()=>{let c=[];for(let u of i)u.data&&c.push(...u.data);return c},[i]),isLoading:a,isError:s}}import{useQuery as lp,useQueries as cp}from"@tanstack/react-query";import{useMemo as dp}from"react";var pp="forge-holdings",up="forge-token-image";async function fp(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 mp(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 ys(e,t,n=!0){let{data:o,...r}=lp({queryKey:[pp,e,t],queryFn:async({signal:i})=>fp(await ce("bondingCurve",e),t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:o??[],...r}}function ks(e,t,n=!0){let o=cp({queries:t.map(i=>({queryKey:[up,e,i],queryFn:async({signal:a})=>mp(await ce("bondingCurve",e),i,a),enabled:n,staleTime:1/0}))});return{imageMap:dp(()=>{let i=new Map;for(let a of o)a.data&&i.set(a.data.address,a.data.image_url);return i},[o])}}import{useQuery as gp}from"@tanstack/react-query";import{useMemo as hp}from"react";var gi="token-stats";function Gt(e,t){return`${e}:${t.toLowerCase()}`}function bn(e,t=!0){let{data:n,...o}=gp({queryKey:[gi,e],queryFn:async({signal:i})=>{let a=await ce("walletServer",e),s=await fetch(`${a}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token stats: ${s.status}`);let l=await s.json();if(l.code!==200)throw new Error(`Token stats API error: ${l.code}`);return l},enabled:t,staleTime:3e4});return{statsMap:hp(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=Gt(a.chain_id,a.address);i.set(s,a)}return i},[n]),...o}}import{useQuery as bp}from"@tanstack/react-query";var wp="crossd-apr",xp="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function Ss(){let{data:e,...t}=bp({queryKey:[wp],queryFn:async({signal:n})=>{let o=await fetch(xp,{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 i=parseFloat(r.data.est_last_epoch_apy);if(!Number.isFinite(i))throw new Error("CROSSD overview returned a non-numeric APR");return i*100},staleTime:6e4});return{aprPercent:e??null,...t}}import{useQuery as vp}from"@tanstack/react-query";import{useMemo as yp}from"react";var kp="token-info";function hi(e,t){return`${t.toLowerCase()}_${e}`}function Rs(e,t=!0){let{data:n,...o}=vp({queryKey:[kp,e],queryFn:async({signal:i})=>{let a=await ce("walletServer",e),s=await fetch(`${a}/v1/public/token/info`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let l=await s.json();if(l.code!==200)throw new Error(`Token info API error: ${l.code}`);return l},enabled:t,staleTime:1/0});return{categoryMap:yp(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=hi(a.chain_id,a.address);i.set(s,a.category)}return i},[n]),...o}}import{useMemo as Sp}from"react";import bi from"bignumber.js";function Cs(e,t,n){let{tokens:o,isLoading:r}=hn(e,t,n),{statsMap:i}=bn(e,n);return Sp(()=>{let a=new bi(0);for(let u of o){let g=i.get(Gt(u.chainId,u.address));if(!g)continue;let d=new bi(u.quantity.numeric).shiftedBy(-u.quantity.decimals).multipliedBy(new bi(g.price));d.isNaN()||(a=a.plus(d))}let s=a.toFixed(),{displayValue:l,isLowerBound:c}=Wa(s);return{totalUsd:s,displayValue:l,isLowerBound:c,isLoading:r}},[o,i,r])}import{QRCodeSVG as fm}from"qrcode.react";function Ge(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 i=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,u=g=>{if(g===null){c?.close();return}let h=g??t;if(c)try{c.location.href=h}catch{c.close(),i(h)}else i(h)};r.then(u,g=>{console.error("[dapp-ui] onOutlink rejected:",g),c?.close()});return}let s=r;if(s===null)return;i(s??t)}import*as Dn from"react";import{Drawer as yf}from"vaul";import{createContext as Np,useContext as Ep,useMemo as Ip}from"react";import Nt from"bignumber.js";var Rp=/^(\d{4}-\d{2}-\d{2})/;function Ts(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:i}of e.map(a=>({key:Rp.exec(a.reference_date)?.[1],cumulative:a.cumulative_earned})).filter(a=>!!a.key&&a.cumulative!=null).sort((a,s)=>a.key<s.key?-1:a.key>s.key?1:0))t.set(r,i),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function sr(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function lr(e){return e.length<=13?e:`${e.slice(0,6)}...${e.slice(-4)}`}function ho(e,t){let n=e.length+t.length;if(n>26)return"xs";if(n>18)return"sm"}function wi(e){return e?.toUpperCase()==="WCROSS"?"CROSS":e}var Cp=["Request Arguments:","Details:","Docs:","Version:","Contract Call:"];function bo(e,t){console.error("[wallet-portfolio] withdraw failed:",e);let o=e instanceof Error?e.message:"";for(let i of Cp){let a=o.indexOf(i);a>=0&&(o=o.slice(0,a))}return o.split(`
8
+ `).map(i=>i.trim()).find(i=>i.length>0)||t}var Tp="0xe00e8bf3";function Ns(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`${Tp}${o}${r}`}function Zn(e){return!e||e<=0n?"0":new Nt(e.toString()).shiftedBy(-9).toFormat(2,Nt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function cr(e){return!e||e<=0n?"0":new Nt(e.toString()).toFormat(0,Nt.ROUND_DOWN)}function dr(e){if(!e||e<=0n)return"0";let t=new Nt(e.toString()).shiftedBy(-18),n=t.isLessThan(1e-4)?7:4;return t.toFormat(n,Nt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function Yt(e,t){let n=new Nt(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,Nt.ROUND_DOWN):n.toFormat(4,Nt.ROUND_DOWN)}function xi(e){return Yt(e,0)}var wo={rate:1,symbol:"$"};function Bn(e,t=wo){let n=Number.isFinite(t.rate)&&t.rate>0?t.rate:1;return`${t.symbol||"$"}${e.times(n).toFormat(2,Nt.ROUND_DOWN)}`}function wn(e,t,n,o=wo){let r=new Nt(n||"0");if(!r.isFinite()||r.isLessThanOrEqualTo(0))return null;let i=new Nt(e||"0").shiftedBy(-t).times(r);return i.isFinite()?Bn(i,o):null}var xo=Np(null);function Te(){let e=Ep(xo);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}function Et(){let{conversionRatio:e,currencySymbol:t}=Te();return Ip(()=>({rate:typeof e=="number"&&e>0?e:wo.rate,symbol:t||wo.symbol}),[e,t])}import{Drawer as Pp}from"vaul";import{jsx as Es}from"react/jsx-runtime";function Is({asChild:e,children:t}){let{walletAddress:n}=Te(),o=t!=null,r=e??!0,i=o?t:Es("button",{type:"button",children:xt(n)});return Es(Pp.Trigger,{asChild:r,children:i})}import{Drawer as yr}from"vaul";import*as Ee from"react";import{useQueryClient as wf}from"@tanstack/react-query";import{createContext as Lp,useContext as _p}from"react";var vi=Lp(null);function Ps(){return _p(vi)}import{jsx as vt,jsxs as mr}from"react/jsx-runtime";function Ls({size:e=22,className:t}){return vt("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:vt("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function _s({size:e=22,className:t}){return mr("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),vt("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 pr({size:e=16,className:t}){return mr("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("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"}),vt("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 ur({size:e=16,className:t}){return vt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:vt("path",{d:"M13.333 4L6 11.333 2.667 8",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function fr({size:e=48,className:t}){return mr("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[vt("circle",{cx:"24",cy:"24",r:"24",fill:"currentColor"}),vt("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 yt({size:e=12,className:t}){return mr("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:[vt("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"}),vt("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),vt("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import{useQuery as Ap}from"@tanstack/react-query";import{useMemo as As}from"react";var Fp="wp:reward-pools";function Xn(e,t=!0){let{data:n,...o}=Ap({queryKey:[Fp,e],queryFn:async({signal:a})=>{let s=await ce("gameReward",e),l=await fetch(`${s}/v1/pools`,{cache:"no-store",signal:a});if(!l.ok)throw new Error(`Failed to fetch pools: ${l.status}`);let c=await l.json();if(c.code!==200)throw new Error(`Pools API error: ${c.code}`);return c},enabled:t,staleTime:0}),r=As(()=>n?.data.pools.filter(a=>a.pool_type==="CrossPool")??[],[n]),i=As(()=>n?.data.pools.filter(a=>a.pool_type==="GamePool")??[],[n]);return{crossPools:r,gamePools:i,allPools:n?.data.pools??[],...o}}import{useQuery as Bp}from"@tanstack/react-query";import{useMemo as Mp}from"react";var Dp="wp:user-deposits";function gr(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Bp({queryKey:[Dp,e,t],queryFn:async({signal:s})=>{let l=await ce("gameReward",e),c=await fetch(`${l}/v1/users/${t}/deposits`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Deposits fetch failed: ${c.status}`);let u=await c.json();if(u.code!==200)throw new Error(`Deposits API error: ${u.code}`);return u},enabled:o,staleTime:0});return{depositMap:Mp(()=>{let s=new Map;if(!r?.data.user_deposits)return s;for(let l of r.data.user_deposits)s.set(l.pool_address.toLowerCase(),l);return s},[r]),deposits:r?.data.user_deposits??[],...i}}import{useQuery as Op}from"@tanstack/react-query";import{useMemo as Wp}from"react";var Fs={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Bs={dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://www.onechain.nexus/points"};var Ms={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"};var yi={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},Ds={dev:`${yi.dev}/portfolio`,stage:`${yi.stage}/portfolio`,production:`${yi.production}/portfolio`};var Os={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},It={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"},hr={dev:"https://stg-swap-api.crossdefi.io",stage:"https://stg-swap-api.crossdefi.io",production:"https://swap-api.crossdefi.io"},Ws={dev:"https://stg.crossdefi.io",stage:"https://stg.crossdefi.io",production:"https://www.crossdefi.io"},Us={dev:"0x1Fa8C0bc5B754E82d55D60f0d6151903FD995b1B",stage:"0x1Fa8C0bc5B754E82d55D60f0d6151903FD995b1B",production:"0xEFd871aF7D695A0c1709e46b565761F4cd1Ef5ba"},Gs={dev:"0xda37a3B60E6b97E8CB44b460130d40331efc566b",stage:"0xda37a3B60E6b97E8CB44b460130d40331efc566b",production:"0x731a104a4461ae45bfef520468b43c262d35e682"};var Up="wp:token-info",Gp="0x0000000000000000000000000000000000000001";function Qt(e,t=!0){let n=ye[e].cross,{data:o,...r}=Op({queryKey:[Up,e],queryFn:async({signal:u})=>{let g=await ce("walletServer",e),h=await fetch(`${g}/v1/public/token/info`,{cache:"no-store",signal:u});if(!h.ok)throw new Error(`Failed to fetch token info: ${h.status}`);let d=await h.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:a}=Wp(()=>{let u=new Map,g=new Map;if(!o?.data)return{byChainAddr:u,byChainSym:g};for(let h of o.data){let d=h.address.toLowerCase();u.set(`${h.chain_id}:${d}`,h),u.set(d,h);let x=h.symbol.replace(/^t/,"").toUpperCase(),w=`${h.chain_id}:${x}`;g.has(w)||g.set(w,h),g.has(x)||g.set(x,h)}return{byChainAddr:u,byChainSym:g}},[o]);return{getTokenImage:(u,g,h)=>{let d=u.toLowerCase(),x=!!h?.chainOnly,w=i.get(`${n}:${d}`);if(w?.image)return w.image;if(!x){let v=i.get(d);if(v?.image)return v.image}if(g){let v=g.replace(/^t/,"").toUpperCase(),m=a.get(`${n}:${v}`);if(m?.image)return m.image;if(!x){let S=a.get(v);if(S?.image)return S.image}}return""},getTokenSymbol:(u,g,h)=>{let d=u.toLowerCase();return(i.get(`${n}:${d}`)??(h?.chainOnly?void 0:i.get(d)))?.symbol||g},getNativeToken:()=>i.get(`${n}:${Gp}`),...r}}import*as Si from"react";import{jsx as ki,jsxs as zs}from"react/jsx-runtime";function Pt({sectionKey:e,title:t,icon:n,iconFit:o="cover",isEmpty:r,loading:i=!1,children:a}){let s=Ps();return Si.useEffect(()=>{s?.report(e,{loading:i,empty:r})},[s,e,i,r]),Si.useEffect(()=>()=>s?.unregister(e),[s,e]),r?null:zs("div",{className:"wp-svc-card",children:[zs("div",{className:"wp-svc-card-head",children:[ki("img",{className:"wp-svc-card-icon",src:n,alt:"",style:{objectFit:o}}),ki("span",{className:"wp-svc-card-title",children:t})]}),ki("div",{className:"wp-svc-items",children:a})]})}import Ri from"bignumber.js";import{jsx as Ke,jsxs as ot}from"react/jsx-runtime";var zp="CROSS Rewards";function $p(e){return new Ri(e||"0").isGreaterThan(0)}function $s(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{allPools:i,isLoading:a}=Xn(e,r),{depositMap:s,isLoading:l}=gr(e,t,r),{getTokenImage:c}=Qt(e,r),u=(d,x)=>`${Fs[e]}/gametoken/tokens/${d.deposit_token.address}?mode=rewards${x==="withdraw"?"&trade=withdraw":""}`,g=`${It[e]}/reward.png`,h=i.filter(d=>{let x=s.get(d.pool_address.toLowerCase()),w=x?.deposited_amount??"0",v=x?.claimable_reward??"0";return!(new Ri(w).isZero()&&new Ri(v).isZero())});return Ke(Pt,{sectionKey:"rewards",title:zp,icon:g,isEmpty:h.length===0,loading:a||l,children:h.map(d=>{let x=s.get(d.pool_address.toLowerCase()),w=x?.deposited_amount??"0",v=x?.claimable_reward??"0",m=u(d,"withdraw"),S=u(d,"claim"),p=c(d.deposit_token.address,d.deposit_token.symbol),R=d.reward_tokens[0],k=R?c(R.address,R.symbol):"",C=d.reward_tokens.map(L=>L.symbol),E=C.length>0?`${d.deposit_token.symbol}-${C.join("/")}`:d.deposit_token.symbol,T=R?Yt(v,R.decimals):"0",I=R?.symbol??"Reward",U=wn(w,d.deposit_token.decimals,d.deposit_token.price,o),M=R?wn(v,R.decimals,R.price,o):null,V=!!x&&$p(v);return ot("article",{className:"wp-item","data-side":"reward",children:[ot("div",{className:"wp-item-body",children:[ot("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),ot("div",{className:"wp-svc-token",children:[ot("span",{className:"wp-token-stack","aria-hidden":!0,children:[p&&Ke("img",{className:"wp-svc-token-icon",src:p,alt:""}),k&&Ke("img",{className:"wp-svc-token-icon",src:k,alt:""})]}),Ke("span",{children:E})]})]}),ot("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Deposited"}),ot("div",{className:"wp-svc-token wp-svc-token--amount",children:[p&&Ke("img",{className:"wp-svc-token-icon",src:p,alt:""}),ot("div",{className:"wp-svc-amount",children:[Ke("span",{className:"wp-svc-amount-main",children:Yt(w,d.deposit_token.decimals)}),U&&Ke("span",{className:"wp-item-usd",children:U})]})]})]}),ot("div",{className:"wp-item-line",children:[ot("span",{className:"wp-item-label",children:["Claimable (",I,")"]}),ot("div",{className:"wp-svc-token wp-svc-token--amount",children:[k&&Ke("img",{className:"wp-svc-token-icon",src:k,alt:""}),ot("div",{className:"wp-svc-amount",children:[Ke("span",{className:"wp-svc-amount-main",children:T}),M&&Ke("span",{className:"wp-item-usd",children:M})]})]})]})]}),ot("div",{className:"wp-item-tags",children:[ot("a",{className:"wp-tag wp-tag--muted",href:m,target:"_blank",rel:"noopener noreferrer","data-track":"rewards_withdraw_open",onClick:L=>Ge(L,m,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:x}},n),children:[Ke("span",{className:"wp-tag-label",children:"Withdraw"}),Ke(yt,{size:12,className:"wp-tag-icon"})]}),ot("a",{className:"wp-tag wp-tag--mint","data-disabled":!V||void 0,"aria-disabled":!V||void 0,href:V?S:void 0,target:V?"_blank":void 0,rel:V?"noopener noreferrer":void 0,onClick:L=>{if(!V){L.preventDefault();return}Ge(L,S,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:x}},n)},children:[Ke("span",{className:"wp-tag-label",children:"Claim"}),Ke(yt,{size:12,className:"wp-tag-icon"})]})]})]},d.pool_address)})})}import*as Zs from"react";import{useQuery as Zp}from"@tanstack/react-query";import{useMemo as br}from"react";var Hp="0x70a08231",jp="0x18160ddd",Vp="0x313ce567",qp=8e3;async function Kp(e,t,n,o){let r=new AbortController,i=setTimeout(()=>r.abort(),qp);o&&o.addEventListener("abort",()=>r.abort(),{once:!0});let a=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(i));if(!a.ok)throw new Error(`RPC ${t} HTTP ${a.status}`);let s=await a.json();if(s.error)throw new Error(`RPC ${t}: ${s.error.message}`);if(s.result===void 0)throw new Error(`RPC ${t}: empty result`);return s.result}function Yp(e){return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function vo(e){if(!(!e||e==="0x"))try{return BigInt(e)}catch{return}}async function an(e,t,n,o,r){try{return await Kp(e,"eth_call",[r?{from:r,to:t,data:n}:{to:t,data:n},"latest"],o)}catch{return}}async function Qp(e,t,n,o){let[r,i,a]=await Promise.all([an(e,n,Hp+Yp(t),o),an(e,n,jp,o),an(e,n,Vp,o)]),s=vo(r);if(s===void 0)return null;let l=vo(a);return{balance:s,totalSupply:vo(i),decimals:l!==void 0?Number(l):void 0}}async function yo(e,t){let n=ye[e].cross,o=await ce("walletServer",e),r=await fetch(`${o}/v1/public/chain/info/${n}`,{cache:"no-store",signal:t});if(!r.ok)return;let i=await r.json();return("data"in i&&i.data!==void 0?Array.isArray(i.data)?i.data[0]:i.data:i)?.rpc||void 0}async function Hs(e,t,n,o){if(!t||n.length===0)return{};let r;try{r=await yo(e,o)}catch{r=void 0}if(!r)return{};let i=await Promise.all(n.map(async s=>[s.toLowerCase(),await Qp(r,t,s,o)])),a={};for(let[s,l]of i)l&&(a[s]=l);return a}var Xp="wp:withdraw-token-meta",Jp="0xc89039c5",eu="0x95d89b41",tu="0x313ce567";function nu(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 i=0;i<o.length;i+=2)r+=String.fromCharCode(parseInt(o.slice(i,i+2),16));return r||void 0}catch{return}}function ou(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 ru(e,t,n){if(t.length===0)return{};let o;try{o=await yo(e,n)}catch{o=void 0}if(!o)return{};let r=await Promise.all(t.map(async a=>{let s=ou(await an(o,a,Jp,n));if(!s)return[a.toLowerCase(),null];let[l,c]=await Promise.all([an(o,s,eu,n),an(o,s,tu,n)]),u=nu(l),g=vo(c);return u?[a.toLowerCase(),{tokenAddress:s,symbol:u,decimals:g!==void 0?Number(g):18}]:[a.toLowerCase(),null]})),i={};for(let[a,s]of r)s&&(i[a]=s);return i}function js(e,t,n=!0){let r=n&&!!t,{allPools:i,isLoading:a}=Xn(e,r),{deposits:s,isLoading:l}=gr(e,t,r),c=br(()=>{let v=new Map;for(let m of i)v.set(m.pool_address.toLowerCase(),m);return v},[i]),u=br(()=>s.filter(v=>{try{return BigInt(v.deposited_amount||"0")>0n}catch{return!1}}),[s]),g=br(()=>u.map(v=>v.pool_address.toLowerCase()).filter(v=>!c.has(v)).sort(),[u,c]),{data:h,isLoading:d}=Zp({queryKey:[Xp,e,g],queryFn:({signal:v})=>ru(e,g,v),enabled:r&&g.length>0,staleTime:1440*60*1e3});return{positions:br(()=>{let v=[];for(let m of u){let S=m.pool_address.toLowerCase(),p=c.get(S);if(p){v.push({poolId:m.pool_id,poolAddress:m.pool_address,poolType:p.pool_type,tokenSymbol:p.deposit_token.symbol,tokenAddress:p.deposit_token.address,decimals:p.deposit_token.decimals,price:p.deposit_token.price,depositedRaw:m.deposited_amount});continue}let R=h?.[S];R&&v.push({poolId:m.pool_id,poolAddress:m.pool_address,poolType:"Unknown",tokenSymbol:R.symbol,tokenAddress:R.tokenAddress,decimals:R.decimals,depositedRaw:m.deposited_amount})}return v},[u,c,h]),isLoading:a||l||d}}import*as ze from"react";import{Fragment as Vs,jsx as te,jsxs as Pe}from"react/jsx-runtime";var iu=400;function au(e,t,n){if(t==="loading")return"Estimating...";if(!e||t==="error"||t==="unavailable")return"Wallet estimate";let o=e.maxFeePerGas??e.gasPrice;return!o||o<=0n||e.gasLimit<=0n?"Wallet estimate":`${dr(e.gasLimit*o)} ${n??""}`.trim()}function Ci(e,t,n){return n==="loading"?"Estimating...":n==="error"||n==="unavailable"?"-":`${e} ${t}`.trim()}function su({position:e,size:t}){return e.icon?te("img",{src:e.icon,alt:"",width:t,height:t}):te("span",{children:e.tokenSymbol.slice(0,1)})}function qs({open:e,status:t,positions:n,initialPoolAddress:o,walletAddress:r,txHash:i,error:a,copied:s=!1,estimateWithdraw:l,onClose:c,onConfirm:u,onCopyHash:g,trackFunnel:h,nativeSymbol:d}){let[x,w]=ze.useState(null),[v,m]=ze.useState("idle"),S=ze.useRef(0),p=ze.useRef(void 0),R=ze.useRef(null);ze.useEffect(()=>()=>clearTimeout(p.current),[]);let k=ze.useMemo(()=>{let Y=o?.toLowerCase();return n.find(F=>F.poolAddress.toLowerCase()===Y)??n[0]??null},[n,o]),C=ze.useMemo(()=>{try{return BigInt(k?.depositedRaw??"0")}catch{return 0n}},[k?.depositedRaw]),E=k?.decimals??18;ze.useEffect(()=>{!e||!k||h?.("position_selected")},[e,k,h]);let T=ze.useCallback(()=>{w(null),m(l?"idle":"unavailable"),S.current+=1,R.current=null},[]);if(ze.useEffect(()=>{e&&T()},[e,T]),ze.useEffect(()=>{if(!e||t!=="confirm"){clearTimeout(p.current);return}if(!l||!k){clearTimeout(p.current),m("unavailable");return}if(C<=0n){clearTimeout(p.current),S.current+=1,R.current=null,w(null),m("idle");return}let Y=`${k.poolAddress.toLowerCase()}:${C.toString()}`;if(R.current===Y)return;R.current=Y,clearTimeout(p.current);let F=S.current+1;S.current=F,m("loading"),p.current=setTimeout(()=>{l(k,C).then(_=>{S.current===F&&(w(_??null),m(_?"ready":"unavailable"))}).catch(()=>{S.current===F&&(w(null),m("error"))})},iu)},[e,t,C,l,k]),!e||!k)return null;let I=t==="submitting",U=Zn(x?.maxPriorityFeePerGas),M=Zn(x?.maxFeePerGas??x?.gasPrice),V=cr(x?.gasLimit),L=Yt(k.depositedRaw,E);return te("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:Y=>{Y.target===Y.currentTarget&&!I&&c()},children:Pe("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-withdraw-title","aria-label":"Withdraw","data-status":t,"data-vaul-no-drag":!0,children:[te("div",{className:"wp-claim-grabber","aria-hidden":!0,children:te("span",{})}),Pe("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&i?Pe(Vs,{children:[te("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:te(fr,{})}),Pe("div",{className:"wp-claim-copy",children:[te("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),te("p",{className:"wp-claim-desc",children:"Your withdrawal request has been submitted. Balances will update shortly after the transaction settles."})]}),te("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:Pe("div",{className:"wp-claim-list-item",children:[te("span",{children:"Tx Hash"}),Pe("button",{type:"button",className:"wp-claim-hash",onClick:g,"aria-label":"Copy transaction hash","data-track":"withdraw_hash_copy",children:[te("strong",{children:lr(i)}),s?te(ur,{}):te(pr,{})]})]})})]}):Pe(Vs,{children:[t==="error"&&Pe("div",{className:"wp-claim-heading",children:[te("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Failed"}),te("p",{className:"wp-claim-error-message",children:a||"The withdraw request could not be completed."})]}),Pe("div",{className:"wp-claim-reward-card","data-fit":ho(k.tokenSymbol,L),"aria-label":"Deposited balance",children:[te("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:te(su,{position:k,size:28})}),te("strong",{className:"wp-claim-reward-symbol",children:k.tokenSymbol}),te("strong",{className:"wp-claim-reward-amount",children:L})]}),Pe("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:[Pe("div",{className:"wp-claim-account-row",children:[Pe("div",{className:"wp-claim-account",children:[te("span",{className:"wp-claim-account-avatar","aria-hidden":!0}),Pe("strong",{children:[k.tokenSymbol," Pool"]})]}),te("span",{children:sr(r)})]}),te("span",{className:"wp-claim-divider","aria-hidden":!0}),Pe("div",{className:"wp-claim-detail-list",children:[Pe("div",{className:"wp-claim-detail-row",children:[te("span",{children:"Est. Tx Fee"}),te("strong",{children:au(x,v,d)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[te("span",{children:"Priority Fee Per Gas"}),te("strong",{children:Ci(U,"Gwei",v)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[te("span",{children:"Max Fee Per Gas"}),te("strong",{children:Ci(M,"Gwei",v)})]}),Pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[te("span",{children:"Gas Limit"}),te("strong",{children:Ci(V,"",v)})]})]})]})]}),Pe("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&te("button",{type:"button",className:"wp-claim-secondary","data-track":"withdraw_cancel",onClick:c,children:t==="error"?"Close":"Cancel"}),Pe("button",{type:"button",className:"wp-claim-primary","data-track":"withdraw_confirm",onClick:()=>{if(t==="success"){c();return}k&&C>0n&&u(k,C,x)},disabled:I||(t==="confirm"||t==="error")&&C<=0n,children:[t==="success"&&"Done",t==="submitting"&&te("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}),t==="error"&&"Try Again",t==="confirm"&&"Withdraw Now"]})]})]}),te("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:te("span",{})})]})})}import*as Ne from"react";import{useQueryClient as du}from"@tanstack/react-query";import{useQuery as lu}from"@tanstack/react-query";var cu="wp:reward-factory-info";function Ks(e,t=!0){let{data:n,...o}=lu({queryKey:[cu,e],queryFn:async({signal:r})=>{let i=await ce("gameReward",e),a=await fetch(`${i}/v1/factory/info`,{cache:"no-store",signal:r});if(!a.ok)throw new Error(`Factory info fetch failed: ${a.status}`);let s=await a.json();if(s.code!==200)throw new Error(`Factory info API error: ${s.code}`);return s},enabled:t,staleTime:0});return{factoryInfo:n?.data??null,routerAddress:n?.data.router_address??"",...o}}var pu="wp:";function Ys(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function Qs(e){let{env:t,walletAddress:n,sendTransaction:o,estimateGas:r}=Te(),i=!!n,a=!!o,s=du(),{routerAddress:l}=Ks(t,i&&a),c=Ys(l),[u,g]=Ne.useState(!1),[h,d]=Ne.useState(void 0),[x,w]=Ne.useState("confirm"),[v,m]=Ne.useState(),[S,p]=Ne.useState(""),[R,k]=Ne.useState(!1),C=Ne.useRef(void 0);Ne.useEffect(()=>()=>clearTimeout(C.current),[]);let E=Ne.useRef(new Set),T=Ne.useCallback((_,ne)=>{E.current.has(_)||(E.current.add(_),ve("withdraw",_,{...ne,tags:{section:e,...ne?.tags}}))},[e]),I=Ne.useCallback((_,ne)=>c?{to:c,value:0n,data:Ns(_,ne),chainId:ye[t].cross}:null,[t,c]),U=Ne.useCallback(()=>{s.invalidateQueries({predicate:_=>typeof _.queryKey[0]=="string"&&_.queryKey[0].startsWith(pu)})},[s]),M=Ne.useCallback(_=>{d(_),g(!0),w("confirm"),m(void 0),p(""),k(!1),E.current=new Set,T("opened")},[T]),V=Ne.useCallback(()=>{x!=="submitting"&&(g(!1),d(void 0),w("confirm"),m(void 0),p(""),k(!1),x==="success"&&U())},[x,U]),L=Ne.useCallback(async(_,ne)=>{if(!r)return null;let q=I(_.poolId,ne),O=Ys(n);return!q||!O?null:r({...q,from:O})},[I,r,n]),Y=Ne.useCallback(async()=>{if(!(!v||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(v),k(!0),clearTimeout(C.current),C.current=setTimeout(()=>k(!1),1400)}catch{k(!1)}},[v]),F=Ne.useCallback(async(_,ne,q)=>{if(!o){w("error"),p("Withdraw is not available for this wallet.");return}if(!c){w("error"),p("Withdraw contract address is not available.");return}try{w("submitting"),p("");let O=I(_.poolId,ne);if(!O){w("error"),p("Withdraw contract address is not available.");return}T("submitted");let de=await o({...O,gas:q?.gasLimit&&q.gasLimit>0n?q.gasLimit:void 0,maxFeePerGas:q?.maxFeePerGas&&q.maxFeePerGas>0n?q.maxFeePerGas:void 0,maxPriorityFeePerGas:q?.maxPriorityFeePerGas&&q.maxPriorityFeePerGas>0n?q.maxPriorityFeePerGas:void 0});m(de),w("success"),T("confirmed"),U()}catch(O){w("error"),p(bo(O,"Failed to request withdraw.")),T("confirmed",{status:"failure",reason:bt(O)})}},[I,U,c,o,T]);return{canWithdrawInline:a,isOpen:u,initialPoolAddress:h,status:x,txHash:v,error:S,copied:R,hasEstimator:!!r,openWithdraw:M,closeWithdraw:V,estimateWithdraw:L,confirmWithdraw:F,copyHash:Y,trackFunnelOnce:T}}import{Fragment as fu,jsx as dt,jsxs as sn}from"react/jsx-runtime";var uu="Points";function Xs(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{getTokenImage:i,getNativeToken:a}=Qt(e,r),s=Qs("points"),{positions:l,isLoading:c}=js(e,t,r),u=Zs.useMemo(()=>l.filter(d=>d.poolType!=="CrossPool").map(d=>({...d,icon:i(d.tokenAddress,d.tokenSymbol)})),[l,i]),g=`${It[e]}/point.png`,h=Bs[e];return sn(fu,{children:[dt(Pt,{sectionKey:"points",title:uu,icon:g,isEmpty:u.length===0,loading:c,children:u.map(d=>{let x=d.price?wn(d.depositedRaw,d.decimals,d.price,o):null;return sn("article",{className:"wp-item","data-side":"reward",children:[sn("div",{className:"wp-item-body",children:[sn("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Token"}),sn("div",{className:"wp-svc-token",children:[d.icon&&dt("img",{className:"wp-svc-token-icon",src:d.icon,alt:""}),dt("span",{children:d.tokenSymbol})]})]}),sn("div",{className:"wp-item-line",children:[dt("span",{className:"wp-item-label",children:"Deposited"}),sn("div",{className:"wp-svc-token wp-svc-token--amount",children:[d.icon&&dt("img",{className:"wp-svc-token-icon",src:d.icon,alt:""}),sn("div",{className:"wp-svc-amount",children:[dt("span",{className:"wp-svc-amount-main",children:Yt(d.depositedRaw,d.decimals)}),x&&dt("span",{className:"wp-item-usd",children:x})]})]})]})]}),dt("div",{className:"wp-item-tags",children:s.canWithdrawInline?dt("button",{type:"button",className:"wp-tag wp-tag--muted","data-track":"points_withdraw_open",onClick:()=>s.openWithdraw(d.poolAddress),children:dt("span",{className:"wp-tag-label",children:"Withdraw"})}):sn("a",{className:"wp-tag wp-tag--muted",href:h,target:"_blank",rel:"noopener noreferrer","data-track":"points_withdraw_open",onClick:w=>Ge(w,h,{category:"portfolio",origin:"portfolio-points",payload:{position:d}},n),children:[dt("span",{className:"wp-tag-label",children:"Withdraw"}),dt(yt,{size:12,className:"wp-tag-icon"})]})})]},d.poolAddress)})}),dt(qs,{open:s.isOpen,status:s.status,positions:u,initialPoolAddress:s.initialPoolAddress,walletAddress:t,txHash:s.txHash,error:s.error,copied:s.copied,estimateWithdraw:s.hasEstimator?s.estimateWithdraw:void 0,onClose:s.closeWithdraw,onConfirm:s.confirmWithdraw,onCopyHash:s.copyHash,trackFunnel:s.trackFunnelOnce,nativeSymbol:a()?.symbol})]})}import*as Ti from"react";import{useQuery as mu}from"@tanstack/react-query";var gu="wp:stake-info";function Js(e,t,n=!0){let o=n&&!!t,{data:r,...i}=mu({queryKey:[gu,e,t],queryFn:async({signal:s})=>{let l=await ce("posa",e),c=await fetch(`${l}/stake/${t}`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Stake info fetch failed: ${c.status}`);let u=await c.json();if(u.code!==0&&u.code!==200)throw new Error(`Stake info API error: ${u.code}`);return u},enabled:o,staleTime:0});return{stakeInfo:r?.data,...i}}import{useQuery as hu}from"@tanstack/react-query";var bu="wp:stake-rewards",wu=31;function el(e,t,n=!0){let o=n&&!!t,{data:r,...i}=hu({queryKey:[bu,e,t],queryFn:async({signal:a})=>{let s=await ce("posa",e),l=await fetch(`${s}/rewards/${t}?limit=${wu}`,{cache:"no-store",signal:a});if(!l.ok)throw new Error(`Stake rewards fetch failed: ${l.status}`);let c=await l.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:Ts(r),...i}}import{useQuery as xu}from"@tanstack/react-query";var vu="wp:staking-onchain";function tl(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...i}=xu({queryKey:[vu,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...i}}import{useMemo as nl}from"react";import yu from"bignumber.js";function ol(e){return e?.trim().toUpperCase()==="CROSS"}function rl(e){return new yu(e||"0").isGreaterThan(0)}function wr(e,t,n=!0){let{allPools:o}=Xn(e,n),r=nl(()=>{for(let c of o)for(let u of[c.deposit_token,...c.reward_tokens])if(ol(u?.symbol)&&rl(u.price))return u.price},[o]),i=n&&r===void 0,{tokens:a}=hn(e,t,i),{statsMap:s}=bn(e,i),l=ye[e].cross;return nl(()=>{if(r)return r;let c=a.find(u=>u.chainId===l&&ol(u.symbol));if(c){let u=s.get(Gt(c.chainId,c.address));if(u&&rl(u.price))return u.price}return"0"},[r,a,s,l])}import vn from"bignumber.js";import{jsx as Lt,jsxs as xn}from"react/jsx-runtime";function ku(e){if(!e)return"\u2014";let t=new vn(e);return t.isFinite()?`${t.toFormat(2,vn.ROUND_DOWN)}%`:"\u2014"}function il(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=Te(),r=Et(),i=!!t,{stakeInfo:a,isLoading:s}=Js(e,t,i),{latestReward:l,aprAccrued:c,isLoading:u}=el(e,t,i),{onchain:g}=tl(t,o,i),h=wr(e,t,i),{getNativeToken:d}=Qt(e,i),x=d()?.symbol,w=[x,"Staking"].filter(Boolean).join(" "),v=`${It[e]}/cross-staking.png`,m=Ds[e],S=a?.total_stake??"0",p=Ti.useMemo(()=>g?new vn(g.earnedWei.toString()).shiftedBy(-18).toString(10):l?.cumulative_earned??a?.rewards_earned??"0",[g,l,a]),R=Ti.useMemo(()=>g?new vn(g.stakedWei.toString()).shiftedBy(-18):new vn(S),[g,S]),k=c!==void 0?new vn(c):void 0,C=a?.days_since_first_stake,E=k!==void 0&&k.isFinite()&&R.isGreaterThan(0)&&C!==null&&C!==void 0?k.div(R).times(365).div(Math.max(1,C)).times(100):void 0,T=!(new vn(S).isZero()&&new vn(p).isZero()),I=wn(S,0,h,r),U=wn(p,0,h,r);return Lt(Pt,{sectionKey:"staking",title:w,icon:v,iconFit:"contain",isEmpty:!T,loading:s||u,children:xn("article",{className:"wp-item","data-side":"stake",children:[xn("div",{className:"wp-item-body",children:[xn("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"Staked"}),xn("div",{className:"wp-svc-amount",children:[Lt("span",{className:"wp-svc-amount-main",children:`${xi(S)} ${x??""}`.trim()}),I&&Lt("span",{className:"wp-item-usd",children:I})]})]}),xn("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"Rewards Earned"}),xn("div",{className:"wp-svc-amount",children:[Lt("span",{className:"wp-svc-amount-main",children:`${xi(p)} ${x??""}`.trim()}),U&&Lt("span",{className:"wp-item-usd",children:U})]})]}),xn("div",{className:"wp-item-line",children:[Lt("span",{className:"wp-item-label",children:"My APR"}),Lt("span",{children:ku(E?.toString(10))})]})]}),Lt("div",{className:"wp-item-tags",children:xn("a",{className:"wp-tag wp-tag--mint",href:m,target:"_blank",rel:"noopener noreferrer","data-track":"stake_outlink",onClick:M=>Ge(M,m,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:a}},n),children:[Lt("span",{className:"wp-tag-label",children:"Manage"}),Lt(yt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as Ni from"react";import{useQuery as Su}from"@tanstack/react-query";var Ru="wp:game-swap-pools";function al(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Su({queryKey:[Ru,e,t],queryFn:async({signal:a})=>{let s=await ce("gameSwap",e),l=await fetch(`${s}/addresses/${t}/portfolio`,{cache:"no-store",signal:a});if(!l.ok)throw new Error(`Game-swap portfolio fetch failed: ${l.status}`);return(await l.json()).pools??[]},enabled:o,staleTime:0});return{pools:r??[],...i}}import{useQuery as Cu}from"@tanstack/react-query";var Tu="wp:game-swap-lp-balances";function sl(e,t,n,o){let r=[...n].map(l=>l.toLowerCase()).sort(),i=!!t&&r.length>0,{data:a,...s}=Cu({queryKey:[Tu,e,t,r,!!o],queryFn:async({signal:l})=>{let c=o?await o(r):await Hs(e,t,r,l),u={};for(let[g,h]of Object.entries(c))u[g.toLowerCase()]=h;return u},enabled:i,staleTime:0});return{balances:a??{},...s}}import ln from"bignumber.js";import{jsx as _t,jsxs as zt}from"react/jsx-runtime";var Nu="Gametoken LP",cl=18,Eu=new ln("0.0001");function ll(e){return e?.trim().toUpperCase()==="CROSS"}function Iu(e){return e&&e>0?e:cl}function Pu(e){let t=ll(e.token_a?.symbol)&&!ll(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Iu(t?e.token_a?.decimals:e.token_b?.decimals),r=new ln(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new ln(0):r.times(2)}function Lu(e,t,n,o){let r=e.token_a?.symbol?.trim()||"TOKEN",i=e.token_b?.symbol?.trim()||o||"?",a=t?.decimals??cl,s,l;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let c=new ln(t.balance.toString()),u=new ln(t.totalSupply.toString()),g=c.div(u);s=g.times(100);let h=g.times(Pu(e));if(h.isGreaterThan(0)){let d=new ln(e.quote_usd??e.cross_usd??"0");l=d.isGreaterThan(0)?Bn(h.times(d),n):`${h.toFormat(4,ln.ROUND_DOWN)} ${o??""}`.trim()}}return{pool:e,tokenASymbol:r,tokenBSymbol:i,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:a,sharePercent:s,valueText:l}}function dl(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=Te(),r=Et(),i=!!t,{pools:a,isLoading:s}=al(e,t,i),l=Ni.useMemo(()=>a.map(m=>m.pair_address).filter(Boolean),[a]),{balances:c,isLoading:u}=sl(e,t,l,o),{getNativeToken:g}=Qt(e,i),h=g()?.symbol,d=`${It[e]}/dex.png`,x=Object.keys(c).length>0,w=Ni.useMemo(()=>{let m=a.map(S=>Lu(S,c[S.pair_address?.toLowerCase()],r,h));return x?m.filter(S=>S.lpAmountRaw?new ln(S.lpAmountRaw).shiftedBy(-S.lpDecimals).isGreaterThanOrEqualTo(Eu):!1):m},[a,c,x,r,h]),v=m=>{let S=m.token_a?.address??m.pair_address;return`${Os[e]}/gametoken/tokens/${S}?trade=deposit`};return _t(Pt,{sectionKey:"gameSwap",title:Nu,icon:d,iconFit:"contain",isEmpty:w.length===0,loading:s||u,children:w.map(m=>{let{pool:S}=m,p=v(S),R=`${m.tokenASymbol} / ${m.tokenBSymbol}`,k=S.token_a?.logo_url,C=S.token_b?.logo_url;return zt("article",{className:"wp-item","data-side":"game-swap",children:[zt("div",{className:"wp-item-body",children:[zt("div",{className:"wp-item-line",children:[_t("span",{className:"wp-item-label",children:"Pool"}),zt("div",{className:"wp-svc-token",children:[zt("span",{className:"wp-token-stack","aria-hidden":!0,children:[k&&_t("img",{className:"wp-svc-token-icon",src:k,alt:""}),C&&_t("img",{className:"wp-svc-token-icon",src:C,alt:""})]}),_t("span",{children:R})]})]}),m.lpAmountRaw!==void 0&&zt("div",{className:"wp-item-line",children:[_t("span",{className:"wp-item-label",children:"My LP"}),zt("span",{children:[Yt(m.lpAmountRaw,m.lpDecimals)," LP"]})]}),m.sharePercent!==void 0&&zt("div",{className:"wp-item-line",children:[_t("span",{className:"wp-item-label",children:"Pool Share"}),zt("span",{children:[m.sharePercent.toFormat(2,ln.ROUND_DOWN),"%"]})]}),m.valueText!==void 0&&zt("div",{className:"wp-item-line",children:[_t("span",{className:"wp-item-label",children:"Value"}),_t("span",{children:m.valueText})]})]}),_t("div",{className:"wp-item-tags",children:zt("a",{className:"wp-tag wp-tag--mint",href:p,target:"_blank",rel:"noopener noreferrer","data-track":"gameswap_outlink","data-track-id":R,onClick:E=>Ge(E,p,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:S}},n),children:[_t("span",{className:"wp-tag-label",children:"Manage"}),_t(yt,{size:12,className:"wp-tag-icon"})]})})]},S.pair_address)})})}import Mn from"bignumber.js";import{useMemo as Ou}from"react";import{useQuery as _u}from"@tanstack/react-query";var Au="wp:forge-pools";function pl(e,t,n=!0){let o=n&&!!t,{data:r,...i}=_u({queryKey:[Au,e,t],queryFn:async()=>{let s=await ce("bondingCurve",e),l=await fetch(`${s}/v1/users/${t}/pools`,{cache:"no-store"});if(!l.ok)throw new Error(`forge pools fetch failed: ${l.status}`);return(await l.json()).data?.items??[]},enabled:o,staleTime:0}),a=r??[];return{pools:a,isEmpty:a.length===0,...i}}import{useQueries as Fu}from"@tanstack/react-query";import{useMemo as Bu}from"react";var Mu="wp:forge-token-detail";async function Du(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function ul(e,t,n=!0){let o=Fu({queries:t.map(a=>({queryKey:[Mu,e,a],queryFn:async()=>Du(await ce("bondingCurve",e),a),enabled:n&&!!a,staleTime:3e4}))}),r=Bu(()=>{let a=new Map;for(let s=0;s<o.length;s++){let l=o[s]?.data,c=t[s];l&&c&&a.set(c.toLowerCase(),l)}return a},[o,t]),i=o.some(a=>a.isLoading);return{detailMap:r,isLoading:i}}import{jsx as pt,jsxs as yn}from"react/jsx-runtime";var Wu="Forge",fl=18,Uu="https://contents.crosstoken.io/wallet/token/images/FT.png";function Gu(e){if(!e||e==="0")return"0";let t=new Mn(e).shiftedBy(-fl);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Mn.ROUND_DOWN):t.toFormat(4,Mn.ROUND_DOWN)}function zu(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 $u(e,t,n,o){let r=new Mn(n||"0");if(!r.isGreaterThan(0))return null;let i=new Mn(e.total_supply||"0"),a=new Mn(e.lp_balance||"0"),s=new Mn(t?.reserve_b||"0").shiftedBy(-fl);if(!i.isGreaterThan(0)||!a.isGreaterThan(0)||!s.isGreaterThan(0))return null;let l=s.times(2),u=a.div(i).times(l).times(r);return u.isFinite()?Bn(u,o):null}function ml(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{pools:i,isEmpty:a,isLoading:s}=pl(e,t,r),l=Ou(()=>i.map(d=>d.token.address),[i]),{detailMap:c}=ul(e,l,r&&l.length>0),u=wr(e,t,r),g=d=>`${Ms[e]}/forge/token/${d.token.address}`,h=`${It[e]}/forge.png`;return pt(Pt,{sectionKey:"forge",title:Wu,icon:h,iconFit:"contain",isEmpty:a,loading:s,children:i.map(d=>{let x=c.get(d.token.address.toLowerCase()),w=x?.image_url||x?.image||d.token.image||Uu,v=x?.symbol||d.token.symbol,m=g(d),S=$u(d,x,u,o);return yn("a",{className:"wp-item","data-side":"lp",href:m,target:"_blank",rel:"noopener noreferrer","data-track":"forge_outlink","data-track-id":v,onClick:p=>Ge(p,m,{category:"portfolio",origin:"portfolio-forge",payload:{pool:d,tokenDetail:x}},n),children:[yn("div",{className:"wp-item-body",children:[yn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"Asset"}),yn("div",{className:"wp-svc-token",children:[pt("img",{className:"wp-svc-token-icon",src:w,alt:""}),pt("span",{children:v}),x?.name&&pt("span",{className:"wp-token-subtle",children:x.name})]})]}),yn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"LP Balance"}),pt("div",{className:"wp-svc-token wp-svc-token--amount",children:yn("div",{className:"wp-svc-amount",children:[pt("span",{className:"wp-svc-amount-main",children:Gu(d.lp_balance)}),S&&pt("span",{className:"wp-item-usd",children:S})]})})]}),yn("div",{className:"wp-item-line",children:[pt("span",{className:"wp-item-label",children:"Ownership"}),pt("span",{className:"wp-line-value",children:zu(d.pool_ownership)})]})]}),pt("div",{className:"wp-item-tags",children:yn("span",{className:"wp-tag wp-tag--muted",children:[pt("span",{className:"wp-tag-label",children:"Withdraw"}),pt(yt,{size:12,className:"wp-tag-icon"})]})})]},d.pair_address)})})}import{useMemo as Nl}from"react";import gf from"bignumber.js";import{useQuery as Hu}from"@tanstack/react-query";var ju="wp:crossd-positions";function Vu(e){let t=e??{};return(t.positions??t.data?.positions??[]).filter(o=>{if(!o?.token_id||!o.liquidity)return!1;try{return BigInt(o.liquidity)>0n}catch{return!1}})}function gl(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Hu({queryKey:[ju,e,t],queryFn:async()=>{let s=await fetch(`${hr[e]}/api/v1/positions?owner=${t}`,{cache:"no-store"});if(!s.ok)throw new Error(`crossd positions fetch failed: ${s.status}`);return Vu(await s.json())},enabled:o,staleTime:0}),a=r??[];return{positions:a,isEmpty:a.length===0,...i}}import{useQueries as qu}from"@tanstack/react-query";import{useMemo as Ku}from"react";var Yu="wp:crossd-position-details";function Qu(e){let t=e??{},n=t.data??t;return n?.token_id||n?.pool?n:null}function hl(e,t,n=!0){let o=qu({queries:t.map(i=>({queryKey:[Yu,e,i],queryFn:async()=>{let a=await fetch(`${hr[e]}/api/v1/positions/${i}`,{cache:"no-store"});if(!a.ok)throw new Error(`crossd position detail failed: ${a.status}`);return Qu(await a.json())},enabled:n&&!!i,staleTime:6e4}))});return{detailMap:Ku(()=>{let i=new Map;return o.forEach((a,s)=>{let l=a.data,c=t[s];l&&c&&i.set(c,l)}),i},[o,t])}}import*as cn from"react";import{Fragment as wl,jsx as J,jsxs as $e}from"react/jsx-runtime";var Zu=300*1e3,bl="https://contents.crosstoken.io/wallet/token/images/Cross.svg";function Xu(e,t,n){if(t)return"Estimating...";if(!e)return"Wallet estimate";let o=e.maxFeePerGas??e.gasPrice;return!o||o<=0n||e.gasLimit<=0n?"Wallet estimate":`${dr(e.gasLimit*o)} ${n??""}`.trim()}function Ei(e,t,n){return n?"Estimating...":`${e} ${t}`.trim()}function xl({open:e,status:t,target:n,token0Icon:o,token1Icon:r,token0Symbol:i,token1Symbol:a,nativeSymbol:s,txHash:l,error:c,copied:u=!1,hasEstimator:g,prepareWithdraw:h,confirmWithdraw:d,onClose:x,onCopyHash:w,trackFunnel:v}){let[m,S]=cn.useState(null),[p,R]=cn.useState(null),k=cn.useRef(0);cn.useEffect(()=>{if(!e||!n)return;let ee=++k.current;S(null),R(null),v?.("dialog_opened"),h().then(ge=>{k.current===ee&&(S(ge),R(ge?Date.now():null))})},[e,n]);let C=t==="submitting",E=t==="estimating"||t==="confirm"&&!m,T=cn.useCallback(async()=>{let ee=m,ge=!p||Date.now()-p>Zu;if(!ee||ge){let Le=++k.current;if(ee=await h(),k.current!==Le)return;S(ee),R(ee?Date.now():null)}ee&&await d(ee)},[m,p,h,d]);if(!e||!n)return null;let{position:I,detail:U}=n,M=U.pool?.token0,V=U.pool?.token1,L=i||M?.symbol||I.pool?.token0_symbol||"?",Y=a||V?.symbol||I.pool?.token1_symbol||"?",F=M?.decimals??18,_=V?.decimals??18,ne=o||M?.logo_url||bl,q=r||V?.logo_url||bl,O=`${L}/${Y}`,de=m?Yn(m.expectedAmount0.toString(),F):null,re=m?Yn(m.expectedAmount1.toString(),_):null,$=Zn(m?.estimate?.maxPriorityFeePerGas),ke=Zn(m?.estimate?.maxFeePerGas??m?.estimate?.gasPrice),fe=cr(m?.estimate?.gasLimit);return J("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:ee=>{ee.target===ee.currentTarget&&!C&&x()},children:$e("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-crossd-withdraw-title","aria-label":"Withdraw position","data-status":t,"data-vaul-no-drag":!0,children:[J("div",{className:"wp-claim-grabber","aria-hidden":!0,children:J("span",{})}),$e("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&l?$e(wl,{children:[J("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:J(fr,{})}),$e("div",{className:"wp-claim-copy",children:[J("h3",{id:"wp-crossd-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),$e("p",{className:"wp-claim-desc",children:["Your ",O," position withdrawal has been submitted. Balances will update shortly after the transaction settles."]})]}),J("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:$e("div",{className:"wp-claim-list-item",children:[J("span",{children:"Tx Hash"}),$e("button",{type:"button",className:"wp-claim-hash",onClick:w,"aria-label":"Copy transaction hash","data-track":"crossd_withdraw_hash_copy",children:[J("strong",{children:lr(l)}),u?J(ur,{}):J(pr,{})]})]})})]}):$e(wl,{children:[t==="error"&&$e("div",{className:"wp-claim-heading",children:[J("h3",{id:"wp-crossd-withdraw-title",className:"wp-claim-title",children:"Withdraw Failed"}),J("p",{className:"wp-claim-error-message",children:c||"The withdraw request could not be completed."})]}),$e("div",{className:"wp-claim-reward-card","data-fit":ho(L,de??""),"aria-label":`Expected ${L}`,children:[J("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:J("img",{src:ne,alt:"",width:28,height:28})}),J("strong",{className:"wp-claim-reward-symbol",children:L}),J("strong",{className:"wp-claim-reward-amount",children:de??"Estimating..."})]}),$e("div",{className:"wp-claim-reward-card","data-fit":ho(Y,re??""),"aria-label":`Expected ${Y}`,children:[J("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:J("img",{src:q,alt:"",width:28,height:28})}),J("strong",{className:"wp-claim-reward-symbol",children:Y}),J("strong",{className:"wp-claim-reward-amount",children:re??"Estimating..."})]}),g&&J("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:$e("div",{className:"wp-claim-detail-list",children:[$e("div",{className:"wp-claim-detail-row",children:[J("span",{children:"Est. Tx Fee"}),J("strong",{children:Xu(m?.estimate,E,s)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Priority Fee Per Gas"}),J("strong",{children:Ei($,"Gwei",E)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Max Fee Per Gas"}),J("strong",{children:Ei(ke,"Gwei",E)})]}),$e("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[J("span",{children:"Gas Limit"}),J("strong",{children:Ei(fe,"",E)})]})]})})]}),$e("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&J("button",{type:"button",className:"wp-claim-secondary","data-track":"crossd_withdraw_cancel",onClick:x,children:t==="error"?"Close":"Cancel"}),J("button",{type:"button",className:"wp-claim-primary","data-track":"crossd_withdraw_confirm",onClick:()=>{if(t==="success"){x();return}C||E||(v?.("confirm_clicked"),T())},disabled:C||E,children:t==="success"?"Done":C?J("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}):E?J("span",{className:"wp-claim-button-spinner","aria-label":"Estimating"}):t==="error"?"Retry":"Withdraw"})]})]}),J("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:J("span",{})})]})})}import*as xe from"react";import{useQueryClient as pf}from"@tanstack/react-query";var Ju="0x0c49ccbe",ef="0xfc6f7865",tf="0x49404b7c",nf="0xdf2ab5bb",of="0xac9650d8",vl=(1n<<128n)-1n,kl=600n,rf=99n,af=100n;function Ii(e){return e*rf/af}function yl(e,t){return!!e&&!!t&&e.toLowerCase()===t.toLowerCase()}function ut(e,t){if(e<0n)throw new Error(`${t} must be non-negative`);let n=e.toString(16);if(n.length>64)throw new Error(`${t} exceeds uint256`);return n.padStart(64,"0")}function xr(e,t){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`${t} is not a valid address`);return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function Pi(e){return Ju+ut(e.tokenId,"tokenId")+ut(e.liquidity,"liquidity")+ut(e.amount0Min,"amount0Min")+ut(e.amount1Min,"amount1Min")+ut(e.deadline,"deadline")}function sf(e){return ef+ut(e.tokenId,"tokenId")+xr(e.recipient,"recipient")+ut(e.amount0Max,"amount0Max")+ut(e.amount1Max,"amount1Max")}function lf(e,t){return tf+ut(e,"amountMinimum")+xr(t,"recipient")}function cf(e,t,n){return nf+xr(e,"token")+ut(t,"amountMinimum")+xr(n,"recipient")}function df(e){if(e.length===0)throw new Error("multicall requires at least one call");let t=e.map(r=>{let i=r.replace(/^0x/,"");if(i.length%2!==0||!/^[0-9a-fA-F]*$/.test(i))throw new Error("multicall element must be valid hex bytes");let a=i.length%64===0?i:i.padEnd(i.length+(64-i.length%64),"0");return ut(BigInt(i.length/2),"callLength")+a.toLowerCase()}),n=BigInt(e.length)*32n,o=[];for(let r of t)o.push(ut(n,"callOffset")),n+=BigInt(r.length/2);return of+ut(0x20n,"arrayOffset")+ut(BigInt(e.length),"arrayLength")+o.join("")+t.join("")}function Sl(e){if(!e||e==="0x")return null;let t=e.replace(/^0x/,"");return t.length<128||!/^[0-9a-fA-F]+$/.test(t)?null:{amount0:BigInt(`0x${t.slice(0,64)}`),amount1:BigInt(`0x${t.slice(64,128)}`)}}function Rl(e){let t=yl(e.token0,e.wcrossAddress),n=yl(e.token1,e.wcrossAddress),o=t||n,r=[Pi({tokenId:e.tokenId,liquidity:e.liquidity,amount0Min:e.amount0Min,amount1Min:e.amount1Min,deadline:e.deadline}),sf({tokenId:e.tokenId,recipient:o?e.positionManagerAddress:e.owner,amount0Max:vl,amount1Max:vl})];return o&&(r.push(lf(0n,e.owner)),r.push(cf(t?e.token1:e.token0,0n,e.owner))),df(r)}async function Cl(e,t,n){let o;try{o=await yo(e,n)}catch{o=void 0}if(!o)return null;let r=Pi({tokenId:t.tokenId,liquidity:t.liquidity,amount0Min:0n,amount1Min:0n,deadline:t.deadline}),i=await an(o,t.positionManager,r,n,t.owner);return Sl(i)}var uf="wp:",ff=[1500,3e3,4500,6e3];function mf(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function Tl(){let{env:e,walletAddress:t,sendTransaction:n,estimateGas:o}=Te(),r=!!n,i=pf(),[a,s]=xe.useState(!1),[l,c]=xe.useState(null),[u,g]=xe.useState("confirm"),[h,d]=xe.useState(),[x,w]=xe.useState(""),[v,m]=xe.useState(!1),[S,p]=xe.useState(new Set),R=xe.useRef(void 0),k=xe.useRef([]),C=xe.useRef(0);xe.useEffect(()=>()=>{clearTimeout(R.current),k.current.forEach(clearTimeout)},[]);let E=xe.useRef(new Set),T=xe.useCallback((F,_)=>{E.current.has(F)||(E.current.add(F),ve("withdraw",F,{..._,tags:{section:"crossdPool",..._?.tags}}))},[]),I=xe.useCallback(()=>{let F=()=>i.invalidateQueries({predicate:_=>typeof _.queryKey[0]=="string"&&_.queryKey[0].startsWith(uf)});F(),k.current.forEach(clearTimeout),k.current=ff.map(_=>setTimeout(F,_))},[i]),U=xe.useCallback(F=>{C.current+=1,c(F),s(!0),g("confirm"),d(void 0),w(""),m(!1),E.current=new Set,T("opened")},[T]),M=xe.useCallback(()=>{u!=="submitting"&&(C.current+=1,s(!1),c(null),g("confirm"),d(void 0),w(""),m(!1))},[u]),V=xe.useCallback(async()=>{let F=C.current,_=mf(t),ne=l?.position.token_id,q=l?.position.liquidity,O=l?.detail.pool?.token0?.address,de=l?.detail.pool?.token1?.address;if(!_||!ne||!q||!O||!de)return g("error"),w("Position data is incomplete. Please refresh and retry."),null;try{g("estimating"),w("");let re=BigInt(ne),$=BigInt(q),ke=BigInt(Math.floor(Date.now()/1e3))+kl,fe=Us[e],ee=await Cl(e,{owner:_,positionManager:fe,tokenId:re,liquidity:$,deadline:ke});if(C.current!==F)return null;if(!ee)return g("error"),w("Failed to estimate withdrawal amounts. Please retry."),null;let ge=Rl({tokenId:re,liquidity:$,amount0Min:Ii(ee.amount0),amount1Min:Ii(ee.amount1),deadline:ke,owner:_,positionManagerAddress:fe,token0:O,token1:de,wcrossAddress:Gs[e]}),Le={to:fe,value:0n,data:ge,chainId:ye[e].cross},K=null;if(o){try{K=await o({...Le,from:_})}catch{K=null}if(C.current!==F)return null}return g("confirm"),{tx:Le,estimate:K,expectedAmount0:ee.amount0,expectedAmount1:ee.amount1}}catch(re){return C.current!==F||(g("error"),w(bo(re,"Failed to prepare withdraw."))),null}},[e,o,l,t]),L=xe.useCallback(async F=>{if(!n){g("error"),w("Withdraw is not available for this wallet.");return}try{g("submitting"),w(""),T("submitted");let _=await n({...F.tx,gas:F.estimate?.gasLimit&&F.estimate.gasLimit>0n?F.estimate.gasLimit:void 0,maxFeePerGas:F.estimate?.maxFeePerGas&&F.estimate.maxFeePerGas>0n?F.estimate.maxFeePerGas:void 0,maxPriorityFeePerGas:F.estimate?.maxPriorityFeePerGas&&F.estimate.maxPriorityFeePerGas>0n?F.estimate.maxPriorityFeePerGas:void 0});d(_),g("success");let ne=l?.position.token_id;ne&&p(q=>{let O=new Set(q);return O.add(ne),O}),T("confirmed"),I()}catch(_){g("error"),w(bo(_,"Failed to request withdraw.")),T("confirmed",{status:"failure",reason:bt(_)})}},[I,n,l,T]),Y=xe.useCallback(async()=>{if(!(!h||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(h),m(!0),clearTimeout(R.current),R.current=setTimeout(()=>m(!1),1400)}catch{m(!1)}},[h]);return{canWithdrawInline:r,isOpen:a,target:l,withdrawnTokenIds:S,status:u,txHash:h,error:x,copied:v,hasEstimator:!!o,openWithdraw:U,closeWithdraw:M,prepareWithdraw:V,confirmWithdraw:L,copyHash:Y,trackFunnelOnce:T}}import{Fragment as bf,jsx as ft,jsxs as kn}from"react/jsx-runtime";var hf="ONEusd Pool",El="https://contents.crosstoken.io/wallet/token/images/Cross.svg";function Il(){let{env:e,walletAddress:t,onOutlink:n}=Te(),o=Et(),r=!!t,{positions:i,isLoading:a}=gl(e,t,r),s=Tl(),l=Nl(()=>i.filter(T=>!T.token_id||!s.withdrawnTokenIds.has(T.token_id)),[i,s.withdrawnTokenIds]),c=Nl(()=>l.map(T=>T.token_id).filter(T=>!!T),[l]),{detailMap:u}=hl(e,c,r&&c.length>0),g=`${Ws[e]}/pool`,{getTokenImage:h,getTokenSymbol:d,getNativeToken:x}=Qt(e,r),w=h("","ONEUSD",{chainOnly:!0})||`${It[e]}/crossd.png`,v={chainOnly:!0},m=(T,I)=>{let U=wi(d(T?.address??"",T?.symbol??I,v));return U==="CROSS"?x()?.symbol??"?":U??"?"},S=(T,I)=>{let U=T?.symbol??I,M=wi(U);return M==="CROSS"?x()?.image||El:h(T?.address??"",M,v)||T?.logo_url||El},p=s.target?.detail.pool,R=S(p?.token0,s.target?.position.pool?.token0_symbol),k=S(p?.token1,s.target?.position.pool?.token1_symbol),C=m(p?.token0,s.target?.position.pool?.token0_symbol),E=m(p?.token1,s.target?.position.pool?.token1_symbol);return kn(bf,{children:[ft(Pt,{sectionKey:"crossdPool",title:hf,icon:w,iconFit:"contain",isEmpty:l.length===0,loading:a,children:l.map(T=>{let I=T.token_id?u.get(T.token_id):void 0,U=`${m(I?.pool?.token0,T.pool?.token0_symbol)}/${m(I?.pool?.token1,T.pool?.token1_symbol)}`,M=T.pool?.fee_tier_percentage,V=S(I?.pool?.token0,T.pool?.token0_symbol),L=S(I?.pool?.token1,T.pool?.token1_symbol),Y=Bn(new gf(T.position_value_usd??"0"),o),F=s.canWithdrawInline&&!!I?.pool?.token0?.address&&!!I?.pool?.token1?.address;return kn("article",{className:"wp-item","data-side":"crossd",children:[kn("div",{className:"wp-item-body",children:[kn("div",{className:"wp-item-line",children:[ft("span",{className:"wp-item-label",children:"Pool"}),kn("div",{className:"wp-svc-token",children:[kn("span",{className:"wp-token-stack","aria-hidden":!0,children:[ft("img",{className:"wp-svc-token-icon",src:V,alt:""}),ft("img",{className:"wp-svc-token-icon",src:L,alt:""})]}),ft("span",{children:U}),M&&ft("span",{className:"wp-token-subtle",children:M})]})]}),kn("div",{className:"wp-item-line",children:[ft("span",{className:"wp-item-label",children:"Position Value"}),ft("span",{className:"wp-line-value",children:Y})]})]}),ft("div",{className:"wp-item-tags",children:F?ft("button",{type:"button",className:"wp-tag wp-tag--muted","data-track":"crossd_pool_withdraw_open","data-track-id":U,onClick:()=>{I&&s.openWithdraw({position:T,detail:I})},children:ft("span",{className:"wp-tag-label",children:"Withdraw"})}):kn("a",{className:"wp-tag wp-tag--muted",href:g,target:"_blank",rel:"noopener noreferrer","data-track":"crossd_pool_outlink","data-track-id":U,onClick:_=>Ge(_,g,{category:"portfolio",origin:"portfolio-crossd-pool",payload:{position:T,detail:I}},n),children:[ft("span",{className:"wp-tag-label",children:"Withdraw"}),ft(yt,{size:12,className:"wp-tag-icon"})]})})]},T.token_id)})}),ft(xl,{open:s.isOpen,status:s.status,target:s.target,token0Icon:R,token1Icon:k,token0Symbol:C,token1Symbol:E,nativeSymbol:x()?.symbol,txHash:s.txHash,error:s.error,copied:s.copied,hasEstimator:s.hasEstimator,prepareWithdraw:s.prepareWithdraw,confirmWithdraw:s.confirmWithdraw,onClose:s.closeWithdraw,onCopyHash:s.copyHash,trackFunnel:s.trackFunnelOnce})]})}var vr=["rewards","points","staking","gameSwap","forge","crossdPool"];Q(`.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-item[data-side=reward] .wp-svc-token-icon{border-radius:0;object-fit:contain}.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-reward-card[data-fit=sm] .wp-claim-reward-symbol{font-size:14px}.wp-claim-reward-card[data-fit=sm] .wp-claim-reward-amount{font-size:16px}.wp-claim-reward-card[data-fit=xs] .wp-claim-reward-symbol{font-size:12px}.wp-claim-reward-card[data-fit=xs] .wp-claim-reward-amount{font-size:13px}.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}
9
+ `);import{Fragment as vf,jsx as pe,jsxs as dn}from"react/jsx-runtime";var Li=15,xf="wp:";function Jn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:i=!0,variant:a="embed",className:s,onOutlink:l,lpBalanceReader:c,stakingRewardsReader:u,sendTransaction:g,estimateGas:h,conversionRatio:d,currencySymbol:x,sections:w}){let v=Ae(e),m=Ee.useCallback(K=>!w||w.includes(K),[w]),S=!!n,p=wf(),[R,k]=Ee.useState({}),C=Ee.useCallback((K,we)=>{k(Me=>{let De=Me[K];return De&&De.loading===we.loading&&De.empty===we.empty?Me:{...Me,[K]:we}})},[]),E=Ee.useCallback(K=>{k(we=>{if(!(K in we))return we;let Me={...we};return delete Me[K],Me})},[]),T=Ee.useMemo(()=>({report:C,unregister:E}),[C,E]),[I,U]=Ee.useState(Li),[M,V]=Ee.useState(!1),[L,Y]=Ee.useState(!1),F=Ee.useRef(void 0),_=Ee.useCallback(()=>{p.invalidateQueries({predicate:K=>typeof K.queryKey[0]=="string"&&K.queryKey[0].startsWith(xf)})},[p]),ne=Ee.useCallback(()=>{_(),V(!0),setTimeout(()=>V(!1),600),U(Li)},[_]);Ee.useEffect(()=>{if(!S)return;let K=setInterval(()=>{U(we=>we<=1?(ne(),Li):we-1)},1e3);return()=>clearInterval(K)},[S,ne]);let q=Ee.useCallback(()=>{r?.()},[r]),O=S?rn(v,n,{size:64}):void 0,de=Ee.useCallback(async()=>{if(!(L||!n))try{await navigator.clipboard.writeText(n),Y(!0),clearTimeout(F.current),F.current=setTimeout(()=>Y(!1),2e3)}catch{}},[n,L]);Ee.useEffect(()=>()=>clearTimeout(F.current),[]);let re=Ee.useMemo(()=>({env:v,theme:t,open:!0,walletAddress:n,close:q,onOutlink:l,lpBalanceReader:c,stakingRewardsReader:u,sendTransaction:g,estimateGas:h,conversionRatio:d,currencySymbol:x}),[v,t,n,q,l,c,u,g,h,d,x]),$=vr.filter(m),ke=$.length>0&&$.every(K=>{let we=R[K];return!!we&&!we.loading}),fe=ke&&$.every(K=>R[K]?.empty),ee=$.some(K=>{let we=R[K];return!!we&&!we.empty}),ge=$.length>0&&!ke&&!ee,Le=dn(vf,{children:[i&&dn("div",{className:"wp-header",children:[dn("div",{className:"wp-header-account",children:[r&&pe("button",{type:"button",className:"wp-header-btn","aria-label":"Back","data-track":"back",onClick:r,children:pe(Ls,{})}),pe("span",{className:"wp-header-avatar","aria-hidden":!0,children:O&&pe("img",{src:O,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&dn("div",{className:"wp-header-account-meta",children:[o&&pe("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&dn("button",{type:"button",className:"wp-header-address-btn",onClick:de,"aria-label":"Copy wallet address","data-track":"address_copy",children:[pe("span",{className:"wp-header-address",children:sr(n)}),pe("span",{className:"wp-header-address-copy","data-copied":L,children:L?pe(Nn,{size:14}):pe(po,{size:14})})]})]})]}),dn("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio","data-track":"refresh",onClick:ne,children:[pe(_s,{className:M?"wp-spin-once":void 0}),S&&pe("span",{className:"wp-refresh-badge",children:I})]})]}),pe("div",{className:"wp-body",children:dn("div",{className:"wp-body-inner","data-empty":fe||void 0,children:[m("rewards")&&pe($s,{}),m("points")&&pe(Xs,{}),m("staking")&&pe(il,{}),m("gameSwap")&&pe(dl,{}),m("forge")&&pe(ml,{}),m("crossdPool")&&pe(Il,{}),ge&&pe("div",{className:"wp-portfolio-loading",role:"status","aria-label":"Loading portfolio",children:pe("span",{className:"wp-portfolio-spinner","aria-hidden":!0})}),fe&&dn("div",{className:"wp-portfolio-empty",role:"status",children:[pe("span",{className:"wp-portfolio-empty-icon","aria-hidden":!0,children:dn("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[pe("path",{d:"M20 7H5a2 2 0 0 1-2-2 2 2 0 0 1 2-2h13v4"}),pe("path",{d:"M3 5v13a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1"}),pe("circle",{cx:"16.5",cy:"13.5",r:"1",fill:"currentColor",stroke:"none"})]})}),pe("p",{className:"wp-portfolio-empty-title",children:"No assets yet"}),pe("p",{className:"wp-portfolio-empty-desc",children:"Assets you hold across CROSS services will appear here."})]})]})})]});return pe(xo.Provider,{value:re,children:pe(vi.Provider,{value:T,children:pe(be,{feature:"wallet_portfolio",children:a==="none"?Le:pe("div",{className:me(a==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:Le})})})})}import{jsx as _i,jsxs as Pl}from"react/jsx-runtime";function Ll({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s}=Te();return Pl(yr.Portal,{children:[_i(yr.Overlay,{className:"wp-overlay"}),Pl(yr.Content,{className:me("wp-fullscreen",e),"data-theme":n,children:[_i(yr.Title,{className:"wp-sr-only",children:"Portfolio"}),_i(Jn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s})]})]})}import{jsx as _l}from"react/jsx-runtime";function kf({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:l,estimateGas:c,conversionRatio:u,currencySymbol:g,children:h}){let d=Ae(e),x=o!==void 0,[w,v]=Dn.useState(!1),m=x?o:w,S=Dn.useCallback(k=>{x||v(k),r?.(k)},[x,r]),p=Dn.useCallback(()=>S(!1),[S]),R=Dn.useMemo(()=>({env:d,theme:t,open:m,walletAddress:n,close:p,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:l,estimateGas:c,conversionRatio:u,currencySymbol:g}),[d,t,m,n,p,i,a,s,l,c,u,g]);return _l(xo.Provider,{value:R,children:_l(yf.Root,{direction:"bottom",open:m,onOpenChange:S,noBodyStyles:!0,children:h})})}var Al=Object.assign(kf,{Trigger:Is,Content:Ll});import*as D from"react";import{createPortal as eo}from"react-dom";import Zt from"bignumber.js";import{jsx as At,jsxs as Sf}from"react/jsx-runtime";function Fl({size:e=20,className:t}){return Sf("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:[At("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),At("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function Bl({size:e=16,className:t}){return At("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:At("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 Ml({size:e=16,className:t}){return At("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:At("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 At("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:At("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ol({size:e=16,className:t}){return At("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:At("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function Wl({size:e=12,className:t}){return At("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:At("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"})})}import*as A from"react";import zl from"bignumber.js";function Ul(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Gl(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,zl.ROUND_DOWN).toFixed()}function Rf(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 Cf(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new zl(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Ul(t)&&Ul(n)?e.lastChangedBy==="to"?{fromAmount:Gl(r.multipliedBy(n).dividedBy(t))}:{toAmount:Gl(r.multipliedBy(t).dividedBy(n))}:Rf(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function $l({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):Cf(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var Hl=15,Tf=18,Kl="cross_bridge_terms_accepted",Nf=3600*24*365;function Ef(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),i=t.slice(o+1).slice(0,Tf);return`${r}.${i}`}function If(){return typeof document>"u"?!1:document.cookie.split(";").map(e=>e.trim()).some(e=>e===`${Kl}=true`)}function Pf(){if(typeof document>"u")return;let e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=[`${Kl}=true`,"Path=/",`Max-Age=${Nf}`,"SameSite=Lax",e].filter(Boolean).join("; ")}function Lf(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 jl(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function _f(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([jl(e.symbol),jl(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function $t(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function kr(e){return e[0]}function Ai(e,t,n,o){if(n&&!$t(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??kr(e);let i=e.findIndex(s=>$t(s,t)),a=i>=0?e[i+1]:void 0;return a&&!$t(a,t)?a:e.find(s=>!$t(s,t))??t}function Vl({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:i}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:i}}function Sr(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),...Sr(n.cause,t+1),...Sr(n.data,t+1),...Sr(n.error,t+1)]}function Fi(e){let t=Sr(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 ql(e,t){return Fi(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
10
+ `)[0]?.trim()||t}function Yl(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:i,approveBridge:a,history:s=[],initialSlippage:l="1",termsUrl:c=Vn,getQuote:u,submitBridge:g,onSubmitted:h,onSuccess:d,onFailed:x,onExit:w}=e,v=A.useMemo(()=>$l({getQuote:u,submitBridge:g}),[u,g]),[m,S]=A.useState("form"),[p,R]=A.useState(n??kr(t)),[k,C]=A.useState(()=>Ai(t,n??kr(t),o,r)),[E,T]=A.useState(""),[I,U]=A.useState(""),[M,V]=A.useState("from"),[L,Y]=A.useState(l),[F,_]=A.useState(null),ne=A.useMemo(()=>_f(p,k),[p,k]),q=A.useMemo(()=>ne?"1":L==="auto"?Lf(F?.priceImpact):L,[ne,L,F?.priceImpact]),[O,de]=A.useState(""),[re,$]=A.useState("idle"),[ke,fe]=A.useState(""),[ee,ge]=A.useState(null),[Le,K]=A.useState([]),[we,Me]=A.useState(!1),[De,Ft]=A.useState(If),[he,Ze]=A.useState(null),[rt,Oe]=A.useState(!1),[_e,Ue]=A.useState(null),[en,it]=A.useState(null),[kt,He]=A.useState(!1),[Bt,St]=A.useState(!1),Se=A.useRef(0),Ht=A.useRef(null),jt=A.useRef(!1),at=A.useRef(!1),je=A.useRef(!1),st=A.useRef(!1),Xe=A.useRef(!1);A.useEffect(()=>{jt.current||(jt.current=!0,ve("bridge","opened"))},[]);let Ve=A.useCallback(()=>{Ht.current&&(clearTimeout(Ht.current),Ht.current=null)},[]),Re=A.useCallback(W=>{Ve(),it(W)},[Ve]);A.useEffect(()=>Ve,[Ve]),A.useEffect(()=>{let W=t.find(Ie=>$t(Ie,p))??kr(t),le=W?r?.(W,t):void 0,j=le?.find(Ie=>$t(Ie,k))??(le?void 0:t.find(Ie=>$t(Ie,k)))??Ai(t,W,void 0,r);R(W),C(j)},[r,t,p,k]);let gt=A.useCallback((W,le)=>{let j=Ef(W);if(!j){Se.current+=1,T(""),U(""),V(le),_(null),de(""),$("idle");return}le==="from"?T(j):U(j),V(le),de(""),!je.current&&Number(j)>0&&(je.current=!0,ve("bridge","amount_entered"))},[]),lt=A.useCallback(()=>{Se.current+=1,T(""),U(""),V("from"),_(null),de(""),fe(""),$("idle"),Ze(null),Oe(!1),Ue(null),He(!1),Re(null)},[Re]),Je=A.useCallback(W=>{$t(W,p)||(at.current||(at.current=!0,ve("bridge","token_selected",{tags:{item_id:`from:${W.symbol}`}})),R(W),C(Ai(t,W,void 0,r)),lt())},[p,r,lt,t]),Rt=A.useCallback(W=>{$t(W,k)||$t(W,p)||(at.current||(at.current=!0,ve("bridge","token_selected",{tags:{item_id:`to:${W.symbol}`}})),C(W),lt())},[p,lt,k]),tn=A.useMemo(()=>p?r?.(p,t)??t.filter(W=>!$t(W,p)):[],[p,r,t]),pn=A.useCallback(()=>{p?.balance&&gt(p.balance,"from")},[p?.balance,gt]),nn=A.useCallback(()=>{!p||!k||(R(k),C(p),lt())},[p,lt,k]),P=A.useCallback(()=>{Se.current+=1,T(""),U(""),V("from"),_(null),de(""),fe("")},[]);A.useEffect(()=>{if(!p||!k)return;if(!E&&!I){_(null),de(""),$(j=>j==="quoting"?"idle":j);return}let W=++Se.current,le=Vl({fromToken:p,toToken:k,fromAmount:E,toAmount:I,lastChangedBy:M,slippage:L});$(j=>j==="submitting"?j:v.canQuote?"quoting":"idle"),(async()=>{try{let j=await v.getQuote(le);if(Se.current!==W)return;j.fromAmount!==void 0&&M==="to"&&T(j.fromAmount),j.toAmount!==void 0&&M==="from"&&U(j.toAmount),_(j.summary??null),de(j.error??"")}catch(j){if(Se.current!==W)return;de(j instanceof Error?j.message:"Failed to quote bridge.")}finally{Se.current===W&&$(j=>j==="quoting"?"idle":j)}})()},[E,p,M,v,L,I,k]);let Z=A.useCallback(()=>!p||!k?null:Vl({fromToken:p,toToken:k,fromAmount:E,toAmount:I,lastChangedBy:M,slippage:q}),[q,E,p,M,I,k]),se=A.useCallback(async(W,le)=>{fe(""),He(!1),Oe(!1),$("submitting");try{if(!le?.skipApprovalCheck&&i){let Ie=await i(W);if(Ie){Ze(Ie),Ue(W),$("idle");return}}Ze(null),Ue(null),Re("processing");let j=await v.submitBridge(W);ge(j),$("success"),K(Ie=>[{id:j.txHash,timestamp:new Date().toISOString(),txHash:j.txHash,fromToken:j.fromToken,toToken:j.toToken,fromAmount:j.fromAmount,toAmount:j.toAmount,summary:F??void 0,status:"pending"},...Ie.filter(Lo=>Lo.txHash!==j.txHash)]),P(),St(!0),Re(null),He(!0),ve("bridge","confirmed"),st.current=!1,Xe.current=!1,h?.(j),d?.(j)}catch(j){if(Re(null),ve("bridge","confirmed",{status:"failure",reason:bt(j)}),st.current=!1,Xe.current=!1,Fi(j)){$("idle");return}let Ie=ql(j,"Failed to submit bridge.");fe(Ie),$("error"),x?.({message:Ie})}},[i,x,h,d,v,P,Re,F]),ct=A.useCallback(async()=>{if(O)return;let W=Z();if(W){if(st.current||(st.current=!0,ve("bridge","submitted")),!De){Ue(W),Me(!0);return}await se(W)}},[Z,O,se,De]),on=A.useCallback(async()=>{let W=_e??Z();W&&(Pf(),Ft(!0),Me(!1),await se(W))},[Z,_e,se]),ht=A.useCallback(()=>{Me(!1),Ue(null)},[]),Eo=A.useCallback(async()=>{if(!(re==="submitting"||!he||!_e||!a)){fe(""),$("submitting");try{await a(_e,he),Xe.current||(Xe.current=!0,ve("bridge","approved")),Ze(null),$("idle"),Oe(!0)}catch(W){if(Fi(W)){$("idle");return}let le=ql(W,"Failed to approve token.");fe(le),$("error"),x?.({message:le})}}},[he,a,x,_e,se,re]),Rn=A.useCallback(()=>{re!=="submitting"&&(Ze(null),Oe(!1),Ue(null),$("idle"))},[re]),Io=A.useCallback(async()=>{if(re==="submitting")return;let W=_e??Z();if(!W){Oe(!1),fe("Bridge input is no longer available. Please try again."),$("error");return}Oe(!1),await se(W,{skipApprovalCheck:!0})},[Z,_e,se,re]),Or=A.useCallback(()=>{He(!1)},[]),ro=A.useCallback(W=>{S(W),W==="history"&&St(!1)},[]),Ct=A.useCallback(()=>{if(m==="history"){ro("form");return}w?.()},[w,ro,m]),Po=A.useMemo(()=>[...s,...Le.filter(W=>!s.some(le=>le.txHash===W.txHash))],[s,Le]);return{step:m,setStep:ro,status:re,error:ke,quoteError:O,fromToken:p,toToken:k,tokens:t,availableToTokens:tn,fromAmount:E,toAmount:I,lastChangedBy:M,slippage:L,effectiveSlippage:q,slippageLocked:ne,setSlippage:Y,summary:F,history:Po,submitted:ee,canSubmit:v.canSubmit,termsOpen:we,approvalInfo:he,approvalSuccessOpen:rt,approveBridge:a,pendingSubmitInput:_e,submitToast:en,successDialogOpen:kt,dismissSuccessDialog:Or,hasNewHistory:Bt,termsUrl:c,setFromToken:R,setToToken:C,selectFromToken:Je,selectToToken:Rt,setAmount:gt,setMax:pn,swapTokens:nn,submit:ct,confirmTerms:on,cancelTerms:ht,confirmApproval:Eo,cancelApproval:Rn,continueAfterApproval:Io,back:Ct}}Q(`.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}
11
+ `);import{Fragment as Mi,jsx as f,jsxs as N}from"react/jsx-runtime";var tc=D.createContext(void 0);function to(){return D.useContext(tc)}function Af(e){let[t,n]=D.useState(void 0);return D.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let a=o.closest("[data-theme]");n(a?.getAttribute("data-theme")??void 0)};r();let i=new MutationObserver(r);return i.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>i.disconnect()},[e]),t}var Ql=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],Ff=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Bf(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Zl(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 Mf(e){return`${e.chainId}:${e.address.toLowerCase()}`}function nc(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Xl(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 Df(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 Of(e,t){if(!t)return!1;let n=new Zt(e||"0"),o=new Zt(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Wf(e){if(e.priceUsd===void 0)return null;let t=new Zt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Uf(e){if(e.priceUsd===void 0)return null;let t=new Zt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function oc(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,Zt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),i=new Zt(o||"0").toFormat(0);return r?`${i}.${r}`:i}function Gf(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function zf(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 $f(e){let t=new Zt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":oc(t)}function Hf(e,t){if(t?.priceUsd===void 0)return null;let n=new Zt(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function Cr(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function jf(e,t){return t==="all"?!0:Cr(e)===t}function Vf(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Jl(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function rc(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function ic(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":rc(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function ac(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function Rr(e){return!e||e==="0"||Number(e)===0}function qf(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 Kf(e){let t=e.fromToken,n=e.toToken,o=ic(t,n),r=e.fromAmount||"0",i=e.toAmount||"0",a=o!==void 0&&!ac(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:a?[{label:"Route",value:t&&n?`${Jl(t.chainId)} \u2192 ${Jl(n.chainId)}`:"-"},{label:"Validator Fee",value:Rr(r)?"0":"Free",tone:Rr(r)?"default":"accent"},{label:"Network Fee",value:Rr(r)?"0":"Free",tone:Rr(r)?"default":"accent"}]:void 0,swapInfo:s?[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:i,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 ko({token:e,size:t=20}){let n=e?.iconUrl;return f("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?f("img",{src:n,alt:"",width:t,height:t,draggable:!1}):f("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function ec({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:i,locked:a=!1}){return N("section",{className:"bf-amount-panel",children:[N("div",{className:"bf-amount-head",children:[f("span",{children:e}),N("span",{className:"bf-balance",children:[nc(t?.balance??"0")," ",t?.symbol??""]})]}),N("div",{className:"bf-amount-main",children:[N("label",{className:"bf-amount-input-wrap",children:[N("span",{className:"bf-sr-only",children:[e," amount"]}),f("input",{type:"text",inputMode:"decimal",value:n,onChange:s=>r(s.target.value),placeholder:"0",className:"bf-amount-input"}),f("span",{className:"bf-amount-usd",children:o})]}),N("button",{type:"button",className:"bf-token-pill",onClick:a?void 0:i,disabled:!a&&!i,"data-locked":a?"true":void 0,"data-track":a?void 0:"token_select_open","data-track-id":e.toLowerCase(),"aria-label":`Select ${e.toLowerCase()} token`,children:[f(ko,{token:t}),f("span",{children:t?.symbol??"Select"}),!a&&f(In,{size:16})]})]})]})}function Yf({flow:e,side:t,onClose:n}){let o=D.useId(),[r,i]=D.useState(""),[a,s]=D.useState(null),l=to(),c=t==="from"?e.fromToken:e.toToken;D.useEffect(()=>{s(document.body)},[]),D.useEffect(()=>{let d=x=>{x.key==="Escape"&&n()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n]);let u=D.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),g=D.useMemo(()=>{let d=r.trim().toLowerCase();return d?u.filter(x=>x.symbol.toLowerCase().includes(d)||x.name.toLowerCase().includes(d)):u},[r,u]),h=D.useCallback(d=>{t==="from"?e.selectFromToken(d):e.selectToToken(d),n()},[e,n,t]);return a?eo(f("div",{className:"bf-token-picker-overlay","data-theme":l,role:"presentation",onMouseDown:d=>{d.target===d.currentTarget&&n()},children:N("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[f("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),N("header",{className:"bf-token-picker-head",children:[f("h3",{id:o,children:"Select a token"}),f("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:f(Vt,{size:24})})]}),N("label",{className:"bf-token-search",children:[f(Fl,{size:20}),f("span",{className:"bf-sr-only",children:"Search tokens"}),f("input",{value:r,onChange:d=>i(d.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),N("div",{className:"bf-token-list",children:[g.map(d=>{let x=rc(d,c),w=x?Uf(d):Wf(d);return N("button",{type:"button",className:"bf-token-row","data-selected":x?"true":"false",onClick:()=>h(d),children:[N("span",{className:"bf-token-row-left",children:[f(ko,{token:d,size:40}),N("span",{className:"bf-token-meta",children:[f("span",{className:"bf-token-symbol",children:d.symbol}),!x&&f("span",{className:"bf-token-name",children:d.name})]})]}),N("span",{className:"bf-token-row-right",children:[N("span",{className:"bf-token-balance",children:[nc(d.balance),x?null:` ${d.symbol}`]}),w&&f("span",{className:"bf-token-price",children:w})]})]},Mf(d))}),g.length===0&&f("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),a):null}function Qf({flow:e,onClose:t}){let n=D.useId(),[o,r]=D.useState(null),i=Ql.find(w=>w.value===e.slippage),[a,s]=D.useState(e.slippage&&!i?e.slippage:""),l=a.trim()!==""&&a.trim()!==".",c=l?Number(a):NaN,u=Number.isFinite(c)&&c>50,g=Number.isFinite(c)&&c>5&&!u,h=w=>{e.setSlippage(w),t()},d=()=>{!l||u||(e.setSlippage(Zl(a)),t())};if(D.useEffect(()=>{r(document.body)},[]),D.useEffect(()=>{let w=v=>{v.key==="Escape"&&t()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[t]),!o)return null;let x=to();return eo(f("div",{className:"bf-slippage-overlay","data-theme":x,role:"presentation",onMouseDown:w=>{w.target===w.currentTarget&&t()},children:N("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[N("header",{className:"bf-slippage-head",children:[f("h3",{id:n,children:"Slippage Settings"}),f("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:f(Vt,{size:24})})]}),N("div",{className:"bf-slippage-body",children:[f("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."}),N("div",{className:"bf-slippage-controls",children:[f("div",{className:"bf-slippage-presets",children:Ql.map(w=>f("button",{type:"button",className:"bf-slippage-preset","data-selected":!l&&e.slippage===w.value?"true":"false",onClick:()=>h(w.value),children:w.label},w.value))}),N("label",{className:"bf-slippage-custom","data-selected":l?"true":"false",children:[f("span",{className:"bf-sr-only",children:"Custom slippage percent"}),f("input",{value:a,onChange:w=>{s(Zl(w.target.value))},onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),d())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),f("span",{"aria-hidden":"true",children:"%"})]})]}),u?f("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):g?f("p",{className:"bf-slippage-message","data-variant":"warning",children:"Your transaction may be frontrun due to high slippage."}):null,l&&f("button",{type:"button",className:"bf-slippage-apply",onClick:d,disabled:u,children:"Apply"})]})]})}),o)}function Zf({flow:e}){let t=D.useId(),[n,o]=D.useState(!1),[r,i]=D.useState(null),a=to();return D.useEffect(()=>{i(document.body)},[]),D.useEffect(()=>{let s=l=>{l.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:eo(f("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:N("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[f("h3",{id:t,children:"Agree to Terms of Service"}),f("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),N("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[f("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,"aria-label":"Agree to Terms of Use","data-track":"terms_check",onClick:()=>o(s=>!s),children:f("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"})}),N("div",{className:"bf-terms-copy",children:[f("span",{className:"bf-terms-label",children:"Agree to Terms of Use"}),e.termsUrl&&f("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]})]}),f("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),f("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,"data-track":"terms_confirm",children:"Confirm"})]})}),r)}function Xf({value:e,disabled:t=!1}){let[n,o]=D.useState(!1);return f("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 Jf({flow:e,approval:t}){let n=D.useId(),[o,r]=D.useState(null),i=to();if(D.useEffect(()=>{r(document.body)},[]),D.useEffect(()=>{let l=c=>{e.status!=="submitting"&&c.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e]),!o)return null;let a=e.status==="submitting"||!e.approveBridge,s=e.status==="submitting";return eo(f("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",children:N("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[N("h3",{id:n,children:["Approve ",t.token.symbol]}),f(ko,{token:t.token,size:72}),N("div",{className:"bf-approve-address-box",children:[f("span",{children:"Token Address"}),N("div",{children:[f("strong",{children:t.tokenAddress}),f(Xf,{value:t.tokenAddress,disabled:s})]})]}),N("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),N("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:a,"aria-busy":s,"data-track":"approve_confirm",children:[s&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function em({flow:e}){let t=D.useId(),[n,o]=D.useState(null),r=to();if(D.useEffect(()=>{o(document.body)},[]),D.useEffect(()=>{if(!e.approvalSuccessOpen)return;let a=s=>{s.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.approvalSuccessOpen)return null;let i=e.status==="submitting";return eo(f("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:N("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[f("h3",{id:t,children:"Approval Success"}),f("span",{className:"bf-success-mark","aria-hidden":"true"}),N("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",f("br",{}),"Please continue to the next step."]}),N("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:i,children:"Cancel"}),N("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,disabled:i,"aria-busy":i,children:[i&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:i?"Continuing...":"Continue"})]})]})]})}),n)}function tm({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,i]=D.useState(!1),a=D.useMemo(()=>{let c=new Zt(e||"0"),u=new Zt(t||"0");return!c.isFinite()||!u.isFinite()||c.lte(0)||u.lte(0)?null:r?c.dividedBy(u):u.dividedBy(c)},[e,r,t]);if(!a||!n||!o||n.symbol===o.symbol)return null;let s=r?o.symbol:n.symbol,l=r?n.symbol:o.symbol;return N("button",{type:"button",className:"bf-exchange-rate",onClick:()=>i(c=>!c),"data-track":"rate_reverse",children:[N("span",{children:["1 ",s]}),f(Wl,{size:12}),N("span",{children:[oc(a)," ",l]})]})}function nm({flow:e}){return e.submitToast?N("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[f("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:f("span",{className:"bf-status-spinner"})}),N("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Transaction Processing"}),f("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function om({message:e}){let[t,n]=D.useState(!1);return D.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:N("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[f("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:f("span",{className:"bf-status-error-mark",children:"!"})}),N("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Error"}),f("span",{children:e})]})]})}function rm(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 im({flow:e}){let t=D.useId(),[n,o]=D.useState(null),r=e.submitted,i=to();return D.useEffect(()=>{o(document.body)},[]),D.useEffect(()=>{if(!e.successDialogOpen)return;let a=s=>{s.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.successDialogOpen||!r?null:eo(f("div",{className:"bf-success-overlay","data-theme":i,role:"presentation",children:f("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:N("div",{className:"bf-success-body",children:[f("span",{className:"bf-success-mark","aria-hidden":"true"}),N("div",{className:"bf-success-copy",children:[f("strong",{id:t,children:rm(r.pathType)}),f("span",{children:"Please check the results in the history."})]}),f("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((a,s)=>N(D.Fragment,{children:[s>0&&f("span",{className:"bf-success-route-arrow",children:"\u2192"}),f(Bi,{token:a,size:43})]},`${a.symbol}-${s}`))}),f("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,"data-track":"success_ok",children:"OK"})]})})}),n)}function Bi({token:e,size:t=16}){let n=!!e.iconUrl;return f("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?f("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):f("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function am({row:e}){return e.routeTokens&&e.routeTokens.length>0?f("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>N(D.Fragment,{children:[n>0&&f("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),f(Bi,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?N("span",{className:"bf-info-value-token",children:[f(Bi,{token:e.valueToken}),f("span",{children:e.value})]}):f(Mi,{children:e.value})}function sc({rows:e}){return!e||e.length===0?null:f("div",{className:"bf-info-rows",children:e.map((t,n)=>N("div",{className:"bf-info-row",children:[N("span",{className:"bf-info-label",children:[f("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),f("span",{children:t.label})]}),f("span",{className:"bf-info-value","data-tone":t.tone??"default",children:f(am,{row:t})})]},`${t.label}-${t.value}`))})}function sm(e,t,n){return e.pathType==="bridge"?"Bridge Info":ac(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function lm({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return f(Mi,{children:r.map(i=>{let a=i==="swap"?e.swapInfo:e.bridgeInfo;return a?.length?N("div",{className:"bf-info-section",children:[o&&f("h4",{children:i==="swap"?"Swap Info":"Bridge Info"}),f(sc,{rows:a})]},i):null})})}function cm({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=sm(e,t,n),[i,a]=D.useState(!0),[s,l]=D.useState(!0);return N("div",{className:"bf-details",children:[e.liquidity&&N("section",{className:"bf-liquidity",children:[N("div",{className:"bf-liquidity-head",children:[f("span",{children:e.liquidity.label??"Available Liquidity"}),f("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),f("div",{className:"bf-liquidity-track",children:f("span",{style:{width:`${e.liquidity.percentage??50}%`}})})]}),(t||n)&&N("section",{className:"bf-detail-section bf-info-card","data-open":i?"true":"false",children:[N("button",{type:"button",className:"bf-collapse-head","aria-expanded":i,onClick:()=>a(c=>!c),"data-track":"details_toggle",children:[f("h3",{children:r}),f(In,{size:16,className:"bf-collapse-chevron"})]}),i&&f("div",{className:"bf-collapse-body",children:f(lm,{summary:e})})]}),o&&N("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[N("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>l(c=>!c),"data-track":"details_toggle",children:[f("h3",{children:"Est. Tx Fee"}),N("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&f("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&f("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),f("span",{"data-delegated":e.txFeeInfo?.isDelegateFee&&Number(e.txFeeInfo?.estTxFee)>0?"true":void 0,children:Df(e.txFeeInfo?.estTxFee??"0")}),f(In,{size:16,className:"bf-collapse-chevron"})]})]}),s&&f("div",{className:"bf-collapse-body",children:f(sc,{rows:e.txFee})})]})]})}function dm({item:e}){let t=Cr(e),n=Hf(e.fromAmount,e.fromToken);return N("article",{className:"bf-history-item",children:[N("div",{className:"bf-history-item-head",children:[f("span",{className:"bf-history-status","data-status":t,children:Vf(t)}),f("time",{className:"bf-history-time",dateTime:e.timestamp,children:zf(e.timestamp)})]}),N("div",{className:"bf-history-item-body",children:[N("strong",{className:"bf-history-amount",children:[$f(e.fromAmount)," ",e.fromToken.symbol]}),N("div",{className:"bf-history-meta",children:[f("span",{className:"bf-history-usd",children:n??Gf(e.txHash)}),N("span",{className:"bf-history-route",children:[N("span",{className:"bf-history-route-token",children:[f(ko,{token:e.fromToken,size:16}),f("span",{children:e.fromToken.symbol})]}),f(Ol,{size:16,className:"bf-history-route-arrow"}),N("span",{className:"bf-history-route-token",children:[f(ko,{token:e.toToken,size:16}),f("span",{children:e.toToken.symbol})]})]})]})]})]})}function pm({flow:e}){let[t,n]=D.useState("all"),o=e.history.some(a=>Cr(a)==="pending"),r=e.history.filter(a=>jf(a,t)),i=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return N("main",{className:"bf-history-body",children:[f("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:Ff.map(a=>N("button",{type:"button",className:"bf-history-tab","data-active":t===a.value?"true":"false",onClick:()=>n(a.value),"data-track":"history_filter","data-track-id":a.value,children:[f("span",{children:a.label}),a.value==="pending"&&o&&f("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},a.value))}),r.length>0?f("div",{className:"bf-history-list",children:r.map(a=>f(dm,{item:a},a.id||a.txHash))}):f("div",{className:"bf-empty",children:i})]})}function um({flow:e,env:t}){let[n,o]=D.useState(null),[r,i]=D.useState(!1),[a,s]=D.useState(0),c=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??Kf(e):null,u=_n("apps.json",t,p=>Ln(p?.bridgePoweredBy?.url,t)),g=qf(e.quoteError),h=Of(e.fromAmount,e.fromToken),d=h?"Insufficient balance":g.from,x=e.quoteError&&!g.from&&!g.to?e.quoteError:"",w=e.error||x,v=e.history.some(p=>Cr(p)==="pending"),S=(c?.pathType??ic(e.fromToken,e.toToken))!=="bridge";return N(Mi,{children:[N("main",{className:"bf-body",children:[N("div",{className:"bf-toolbar",children:[N("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),"data-track":"history_open",children:[f(Bl,{}),f("span",{children:"History"}),(v||e.hasNewHistory)&&f("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),S&&N("button",{type:"button",className:"bf-chip",onClick:()=>i(!0),"data-track":"slippage_open",disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[f(Ml,{}),f("span",{children:e.slippageLocked?"Auto 1%":Bf(e.slippage,e.effectiveSlippage)})]})]}),N("div",{className:"bf-swap-card","data-has-from-error":d?"true":"false",children:[f(ec,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Xl(e.fromAmount,e.fromToken),onAmountChange:p=>e.setAmount(p,"from"),onTokenClick:()=>o("from")}),d&&f("div",{className:"bf-field-error",children:d}),f("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(p=>p+360)},"data-track":"token_swap",style:{transform:`translateX(-50%) rotate(${a}deg)`,transition:"transform 0.2s ease"},children:f(Dl,{size:22})}),f(ec,{label:"To",token:e.toToken,amount:e.toAmount,usd:Xl(e.toAmount,e.toToken),onAmountChange:p=>e.setAmount(p,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),g.to&&f("div",{className:"bf-field-error",children:g.to})]}),f(tm,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),c&&f(cm,{summary:c})]}),N("footer",{className:"bf-footer",children:[f("button",{type:"button",className:"bf-next",onClick:e.submit,"data-track":"next",disabled:e.status==="submitting"||!!e.quoteError||h,children:e.status==="submitting"?"Processing...":"Next"}),u&&N("a",{className:"bf-powered",href:u,target:"_blank",rel:"noreferrer",children:["Powered by ",f("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&f(Yf,{flow:e,side:n,onClose:()=>o(null)}),r&&f(Qf,{flow:e,onClose:()=>i(!1)}),f(Zf,{flow:e}),e.approvalInfo&&f(Jf,{flow:e,approval:e.approvalInfo}),f(em,{flow:e}),f(nm,{flow:e}),f(om,{message:e.submitToast?"":w}),f(im,{flow:e})]})}function Tr({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let i=D.useMemo(()=>Ae(n),[n]),a=Yl({...r,onExit:t}),s=D.useRef(null),l=Af(s),c=a.step==="history"?"History":"Swap & Bridge";return f(be,{feature:"bridge",children:f(tc.Provider,{value:l,children:N("div",{ref:s,className:me("bf-root",o),"data-view":a.step,"data-status":a.status,children:[N("header",{className:"bf-header",children:[f("button",{type:"button",className:"bf-header-btn",onClick:a.back,"aria-label":"Back",children:f(En,{size:24})}),f("span",{className:"bf-header-title",children:c}),f("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:f(Vt,{size:24})})]}),a.step==="history"?f(pm,{flow:a}):f(um,{flow:a,env:i})]})})})}import{Fragment as Oi,jsx as b,jsxs as B}from"react/jsx-runtime";var mm="On-ramp is not available in your region.";function Di(e,t,n){let o=ye[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 gm(e){return parseInt(e.split(":")[1],10)}function hm(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 bm(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function wm(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 lc({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:i,isMobile:a,open:s,drawerDirection:l,modal:c,showBalance:u,showForgeToken:g,showGameToken:h,showQR:d,showBridge:x,qrLogoSrc:w,walletAddress:v,accountName:m,sendAccounts:S,profileImageUrl:p,preferredTokens:R,close:k,onSelectWallet:C,onCopyAddress:E,onBuy:T,onDisconnect:I,disconnectLabel:U,termsUrl:M,termsLabel:V,privacyUrl:L,privacyLabel:Y,portalStyle:F,navContent:_,navPosition:ne,footerContent:q,view:O,setView:de,selectedSendToken:re,setSelectedSendToken:$,showPortfolio:ke,portfolioTitle:fe,portfolioSections:ee,showTotalAssets:ge,totalAssetsLabel:Le,sendTransaction:K,getTransactionReceipt:we,estimateGas:Me,onOutlink:De,lpBalanceReader:Ft,stakingRewardsReader:he,bridgeTokens:Ze,bridgeHistory:rt,getBridgeQuote:Oe,getBridgeToTokens:_e,getBridgeApproval:Ue,approveBridge:en,submitBridge:it,onReceive:kt,onSend:He,onBuyDisabledMessage:Bt,onBridgeDisabledMessage:St,onSendDisabledMessage:Se}=un(),[Ht,jt]=H.useState(null),at=H.useRef(void 0),je=H.useCallback(y=>{jt(y),clearTimeout(at.current),at.current=setTimeout(()=>jt(null),4e3)},[]);H.useEffect(()=>()=>clearTimeout(at.current),[]);let st=!!Bt,Xe=H.useCallback(()=>{if(st){je(Bt);return}let y=T?.();y&&typeof y.then=="function"&&y.catch(()=>{je(Bt??mm)})},[st,Bt,T,je]),Ve=!!St,Re=!!Se,{tokens:gt,isLoading:lt}=hn(r,v,s&&u),{statsMap:Je}=bn(r,u),{aprPercent:Rt}=Ss(),{categoryMap:tn}=Rs(r,u),pn=u&&ge,{displayValue:nn,isLowerBound:P,isLoading:Z}=Cs(r,v,s&&pn),[se,ct]=H.useState(!1),on=H.useRef(null),[ht,Eo]=H.useState(0),{holdings:Rn,isLoading:Io}=ys(r,v,s&&u&&g),Or=H.useMemo(()=>Rn.map(y=>y.token),[Rn]),{imageMap:ro}=ks(r,Or,g&&Rn.length>0),Ct=H.useMemo(()=>{let y=[],z=[],ie=[],et=new Map((R??[]).map((ue,qe)=>[`${gm(ue.chainId)}:${ue.address.toLowerCase()}`,qe]));for(let ue of gt){let qe=Di(r,ue.chainId,ue.symbol)!==void 0,Dt=`${ue.chainId}:${ue.address.toLowerCase()}`,Cn=et.get(Dt),Vr=new So(ue.quantity.numeric).shiftedBy(-ue.quantity.decimals);if(qe)y.push(ue);else if(Cn!==void 0)z.push(ue);else if(Vr.isGreaterThan(0)){if(!h&&tn.get(hi(ue.chainId,ue.address))==="game")continue;ie.push(ue)}}return y.sort((ue,qe)=>{let Dt=Di(r,ue.chainId,ue.symbol)??99,Cn=Di(r,qe.chainId,qe.symbol)??99;return Dt-Cn}),z.sort((ue,qe)=>{let Dt=et.get(`${ue.chainId}:${ue.address.toLowerCase()}`)??99,Cn=et.get(`${qe.chainId}:${qe.address.toLowerCase()}`)??99;return Dt-Cn}),ie.sort((ue,qe)=>{let Dt=Je.get(Gt(ue.chainId,ue.address)),Cn=Je.get(Gt(qe.chainId,qe.address)),Vr=new So(ue.quantity.numeric).shiftedBy(-ue.quantity.decimals).multipliedBy(Dt?.price??0);return new So(qe.quantity.numeric).shiftedBy(-qe.quantity.decimals).multipliedBy(Cn?.price??0).minus(Vr).toNumber()}),[...y,...z,...ie]},[gt,r,Je,h,tn,R]),Po=H.useMemo(()=>{if(!g)return[];let y=new Set(gt.map(z=>z.address.toLowerCase()));return[...Rn].filter(z=>!y.has(z.token.toLowerCase())).sort((z,ie)=>{let et=new So(z.value);return new So(ie.value).minus(et).toNumber()})},[Rn,g,gt]),W=H.useRef(!1),[le,j]=H.useState(null),Ie=H.useRef(void 0),Lo=le?.chainId??re?.chainId??Ct[0]?.chainId??0,{transactionUrl:Wr}=qo(r,Lo,le?.txHash,!!(le?.txHash&&Lo)),Mt=H.useCallback(y=>{W.current=!0,de(y)},[de]),[Oc,Ur]=H.useState("recipient"),_o=H.useCallback(()=>{$(null),Ur("recipient"),Mt("wallet")},[$,Mt]),Gr=H.useCallback((y,z="recipient")=>{if(Re){je(Se);return}Ur(z),$(y),Mt("send")},[Re,Se,je,$,Mt]),Ao=_n("apps.json",r,y=>Ln(y?.gametokenBridge,r)),Hi=_n("apps.json",r,y=>y?.gametokenSites),Wc=H.useCallback(()=>{if(Ve){je(St);return}if(Ao){if(hm(Hi)){window.location.assign(Ao);return}window.open(Ao,"_blank","noopener,noreferrer")}},[Ve,St,Ao,Hi,je]),Uc=H.useCallback(y=>{clearTimeout(Ie.current),$(null),Mt("wallet"),j({status:"pending",txHash:y.txHash,chainId:y.chainId,description:`${y.amount} ${y.tokenSymbol} to ${xt(y.recipient)}`})},[$,Mt]),Gc=H.useCallback(y=>{let z=re?.chainId;$(null),Mt("wallet"),!(!y||!z)&&(j(ie=>({status:"success",txHash:y,chainId:z,description:ie?.txHash===y?ie.description:"Tap to see your transaction"})),clearTimeout(Ie.current),Ie.current=setTimeout(()=>j(null),5e3))},[re?.chainId,$,Mt]),zc=H.useCallback(y=>{let z=y.txHash;z&&(j({status:"error",txHash:z,chainId:y.chainId,description:y.message}),clearTimeout(Ie.current),Ie.current=setTimeout(()=>j(null),5e3))},[]),io=H.useMemo(()=>{if(kt)return kt;if(d)return()=>Mt("qr")},[kt,d,Mt]),zr=H.useMemo(()=>{if(He)return He;if(Ct.length===0)return;let y=Ct[0];return()=>Gr(y,"token")},[He,Ct,Gr]),$c=H.useCallback(()=>{if(Re){je(Se);return}zr?.()},[Re,Se,zr,je]);H.useEffect(()=>{s||(W.current=!1,Ur("recipient"))},[s]);let ji=H.useRef(null);H.useEffect(()=>{let y=ji.current;if(!y||!a)return;let z=ie=>{ie.pointerType==="touch"&&ie.stopPropagation()};return y.addEventListener("pointerdown",z),()=>y.removeEventListener("pointerdown",z)},[a]);let[On,Vi]=H.useState(!1),$r=H.useRef(void 0),[ao,so]=H.useState(!1);H.useEffect(()=>{if(!ao)return;let y=()=>so(!1),z=et=>{et.key==="Escape"&&so(!1)},ie=setTimeout(()=>{document.addEventListener("mousedown",y,!0),document.addEventListener("keydown",z,!0)},0);return()=>{clearTimeout(ie),document.removeEventListener("mousedown",y,!0),document.removeEventListener("keydown",z,!0)}},[ao]),H.useEffect(()=>{so(!1)},[v]),H.useEffect(()=>()=>clearTimeout($r.current),[]),H.useEffect(()=>()=>clearTimeout(Ie.current),[]),H.useEffect(()=>{let y=on.current;if(!y||q===null){Eo(0);return}let z=()=>{Eo(y.offsetHeight)};if(z(),typeof ResizeObserver>"u")return;let ie=new ResizeObserver(z);return ie.observe(y),()=>ie.disconnect()},[q]);let qi=H.useCallback(async()=>{if(!On)try{await navigator.clipboard.writeText(v),Vi(!0),clearTimeout($r.current),$r.current=setTimeout(()=>Vi(!1),2e3),E?.(v,!0)}catch{E?.(v,!1)}},[v,E,On]),Fo=H.useCallback(y=>{y.currentTarget.setAttribute("data-loaded","true")},[]),Ki=H.useMemo(()=>({background:wm(v)}),[v]),Bo=H.useMemo(()=>p||rn(r,v,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[p,r,v,i]),Hr=H.useMemo(()=>bm(nn),[nn]),Yi=M||L?B("div",{className:"wi-legal-links",children:[M&&b("a",{className:"wi-legal-link",href:M,target:"_blank",rel:"noopener noreferrer","data-track":"terms_link",onClick:y=>Ge(y,M,{category:"terms",origin:"terms"},De),children:V}),M&&L&&b("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),L&&b("a",{className:"wi-legal-link",href:L,target:"_blank",rel:"noopener noreferrer","data-track":"privacy_link",onClick:y=>Ge(y,L,{category:"privacy",origin:"privacy"},De),children:Y})]}):null,Qi=I?B("button",{type:"button",className:"wi-disconnect-btn","data-track":"disconnect",onClick:()=>{I(),k()},children:[b(Ia,{size:16}),b("span",{className:"wi-disconnect-label",children:U})]}):null,Hc=u&&!_?B("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[B("button",{type:"button",className:me("wi-action-card",st&&"wi-action-card--dimmed"),onClick:Xe,disabled:!T&&!st,"aria-disabled":st||void 0,"aria-label":"Buy","data-track":"buy",children:[b(Ba,{size:20}),b("span",{children:"Buy"})]}),x?B("button",{type:"button",className:me("wi-action-card",Ve&&"wi-action-card--dimmed"),onClick:Wc,"aria-disabled":Ve||void 0,"aria-label":"Bridge","data-track":"bridge_open",children:[b(Ma,{size:20}),b("span",{children:"Bridge"})]}):B("button",{type:"button",className:"wi-action-card",onClick:io,disabled:!io,"aria-label":"Receive","data-track":"receive",children:[b(jo,{size:20}),b("span",{children:"Receive"})]}),B("button",{type:"button",className:me("wi-action-card",Re&&"wi-action-card--dimmed"),onClick:$c,disabled:!Re&&!zr,"aria-disabled":Re||void 0,"aria-label":"Send","data-track":"send_open",children:[b(Aa,{size:20}),b("span",{children:"Send"})]}),ke?B("button",{type:"button",className:"wi-action-card",onClick:()=>Mt("portfolio"),"aria-label":"View portfolio","data-track":"portfolio_open",children:[b(Fa,{size:20}),b("span",{children:"Portfolio"})]}):x?B("button",{type:"button",className:"wi-action-card",onClick:io,disabled:!io,"aria-label":"Receive","data-track":"receive",children:[b(jo,{size:20}),b("span",{children:"Receive"})]}):null]}):null,jc=B("div",{className:me("wi-view-inner",W.current&&"wi-view-wallet"),children:[pn&&B("div",{className:"wi-total-section",children:[B("div",{className:"wi-total-head",children:[b("span",{className:"wi-total-label",children:Le}),b("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:y=>{y.stopPropagation(),ct(z=>!z)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),ct(z=>!z))},"aria-label":se?"Show balance":"Hide balance","data-track":"balance_toggle",children:se?b(La,{}):b(Pa,{})})]}),b("div",{className:"wi-total-body",children:Z?b("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):b("div",{className:"wi-total-value","data-hidden":se||void 0,children:se?b("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):B(Oi,{children:[P&&b("span",{className:"wi-total-lte",children:"\u2264"}),b("span",{className:"wi-total-currency",children:"$"}),b("span",{className:"wi-total-amount",children:Hr.main}),Hr.decimal&&b("span",{className:"wi-total-decimal",children:Hr.decimal})]})})})]}),ne==="top"&&(_?b("div",{className:"wi-nav-fixed",children:_}):Hc),u&&b("div",{ref:ji,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:B("div",{className:"wi-token-list",children:[lt&&Array.from({length:5},(y,z)=>B("div",{className:"wi-skeleton-item",children:[B("div",{className:"wi-skeleton-left",children:[b("div",{className:"wi-skeleton-block wi-skeleton-icon"}),B("div",{className:"wi-skeleton-lines",children:[b("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),b("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),B("div",{className:"wi-skeleton-right",children:[b("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),b("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},z)),!lt&&Ct.length===0&&!g&&b("div",{className:"wi-empty",children:"No Tokens Found"}),Ct.map(y=>{let z=Je.get(Gt(y.chainId,y.address)),ie=z?parseFloat(z.percent_change_24h):null,et=ie!==null&&ie>=0,ue=go(r,y.chainId),qe=os(y.address);return B("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Gr(y),"aria-label":`Send ${y.symbol}`,"data-track":"token_send","data-track-id":y.symbol,children:[B("div",{className:"wi-token-left",children:[B("div",{className:"wi-token-icon-wrap",children:[b("img",{src:y.icon_url,alt:y.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Fo,onError:Dt=>{Dt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ue&&b("img",{src:ue,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Dt=>{Dt.currentTarget.style.display="none"}})]}),B("div",{className:"wi-token-info",children:[B("span",{className:"wi-token-name-row",children:[b("span",{className:"wi-token-name",children:y.symbol}),qe&&Rt!==null&&b("span",{className:"wi-token-apr",children:`APR ${Rt>=0?"+":"-"}${(Rt>=0?Math.floor:Math.ceil)(Math.abs(Rt)*100)/100}%`})]}),z&&B("div",{className:"wi-token-price-row",children:[b("span",{className:"wi-token-price",children:ni(z.price)}),b("span",{className:"wi-token-change","data-positive":et,"data-zero":ie===0||void 0,children:ie!==null&&(ie===0?"0%":`${et?"+":"-"}${(et?Math.floor:Math.ceil)(Math.abs(ie)*100)/100}%`)})]})]})]}),B("div",{className:"wi-token-right",children:[b("span",{className:"wi-token-balance",children:fn(y.quantity.numeric,y.quantity.decimals)}),z&&b("span",{className:"wi-token-value",children:Oa(y.quantity.numeric,y.quantity.decimals,z.price)})]})]},`${y.address}-${y.chainId}`)}),g&&Io&&Array.from({length:3},(y,z)=>B("div",{className:"wi-skeleton-item",children:[B("div",{className:"wi-skeleton-left",children:[b("div",{className:"wi-skeleton-block wi-skeleton-icon"}),B("div",{className:"wi-skeleton-lines",children:[b("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),b("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),B("div",{className:"wi-skeleton-right",children:[b("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),b("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${z}`)),g&&!Io&&!lt&&Ct.length===0&&Po.length===0&&b("div",{className:"wi-empty",children:"No Tokens Found"}),g&&Po.map(y=>{let z=ro.get(y.token)||"",ie=go(r,ye[r].cross);return B("div",{className:"wi-token-item",children:[B("div",{className:"wi-token-left",children:[B("div",{className:"wi-token-icon-wrap",children:[b("img",{src:z||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:y.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Fo,onError:et=>{et.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ie&&b("img",{src:ie,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:et=>{et.currentTarget.style.display="none"}})]}),B("div",{className:"wi-token-info",children:[b("span",{className:"wi-token-name",children:y.token_name}),b("div",{className:"wi-token-price-row",children:B("span",{className:"wi-token-price",children:[fn(y.current_price,18)," CROSS"]})})]})]}),B("div",{className:"wi-token-right",children:[b("span",{className:"wi-token-balance",children:fn(y.balance,18)}),b("span",{className:"wi-token-value",children:ni(y.current_value_usd)})]})]},`forge-${y.token}`)})]})}),ne==="bottom"&&_&&b("div",{className:"wi-nav-fixed",children:_}),Qi&&b("div",{className:"wi-wallet-disconnect-row",children:Qi})]},"wallet"),Vc=ke?b("div",{className:me("wi-view-inner wi-portfolio-body",W.current&&"wi-view-portfolio"),children:b(Jn,{env:r,theme:i,walletAddress:v,showHeader:!1,onOutlink:De,lpBalanceReader:Ft,stakingRewardsReader:he,sendTransaction:K,estimateGas:Me,sections:ee})},"portfolio"):null,qc=re?b("div",{className:me("wi-view-inner wi-send-body",W.current&&"wi-view-send"),children:b(ir,{env:r,theme:i,walletAddress:v,accountName:m,accounts:S,initialStep:Oc,token:re,tokens:Ct,onTokenChange:$,sendTransaction:K,getTransactionReceipt:we,estimateGas:Me,getTokenPriceUsd:y=>{let z=Je.get(Gt(y.chainId,y.address));if(!z?.price)return;let ie=parseFloat(z.price);return Number.isFinite(ie)?ie:void 0},onClose:k,onBackToWallet:_o,onSubmitted:Uc,onSuccess:Gc,onFailed:zc,onOutlink:De})},"send"):null,Kc=H.useMemo(()=>Ze||Ct.map(y=>{let z=Je.get(Gt(y.chainId,y.address)),ie=z?.price?parseFloat(z.price):void 0;return{name:y.name,symbol:y.symbol,chainId:y.chainId,address:y.address,decimals:y.quantity.decimals,balance:Yn(y.quantity.numeric,y.quantity.decimals),iconUrl:y.icon_url,priceUsd:Number.isFinite(ie)?ie:void 0}}),[Ze,Je,Ct]),Yc=b("div",{className:me("wi-view-inner wi-bridge-body",W.current&&"wi-view-send"),children:b(Tr,{env:r,walletAddress:v,tokens:Kc,history:rt,termsUrl:M,getQuote:Oe,getToTokens:_e,getApproval:Ue,approveBridge:en,submitBridge:it,onClose:k,onBackToWallet:_o})},"bridge"),jr=!!C&&m?.trim().toLowerCase()!=="my wallet",Zi=B(Oi,{children:[B("span",{className:"wi-receive-avatar",children:[b("span",{className:"wi-avatar-fallback",style:Ki}),Bo&&b("img",{src:Bo,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:Fo,onError:y=>{y.currentTarget.style.display="none"}})]}),b("span",{className:"wi-receive-account-name",children:m??"Account 1"}),jr&&b("span",{className:"wi-receive-chevron","data-open":ao,"aria-hidden":"true",children:b(In,{size:16})})]}),Qc=B("div",{className:me("wi-view-inner wi-qr-body",W.current&&"wi-view-qr"),children:[B("div",{className:"wi-receive-section",children:[jr?b("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{so(!0),C?.()},"aria-label":"Switch account",children:Zi}):b("div",{className:"wi-receive-account",children:Zi}),B("div",{className:"wi-qr-block",children:[B("div",{className:"wi-qr-box",children:[b(fm,{value:v,size:180,level:"H",marginSize:2,...w&&{imageSettings:{src:w,height:33,width:33,excavate:!0}}}),!w&&b("div",{className:"wi-qr-logo",children:b(_a,{size:33})})]}),b("p",{className:"wi-qr-address",children:v})]}),B("button",{type:"button",className:"wi-qr-copy-btn",onClick:qi,"data-track":"address_copy",children:[b("span",{className:"wi-qr-copy-icon",children:On?b(Nn,{size:16}):b(po,{size:16})}),b("span",{className:"wi-qr-copy-text",children:On?"Copied!":"Copy address"})]})]}),Yi&&b("div",{className:"wi-receive-footer",children:Yi})]},"qr"),Zc=O==="qr"||O==="portfolio"||O==="send"||O==="bridge",Xi=q!==null?b("div",{className:"wi-builtin-footer",children:q}):null,Ji=B("div",{className:"wi-account-text",children:[jr?B("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{so(!0),C?.()},"aria-label":"Switch account","aria-expanded":ao,children:[b("span",{className:"wi-account-name",children:m??"Account 1"}),b("span",{className:"wi-account-switch","data-open":ao,"aria-hidden":"true",children:b(In,{size:20})})]}):b("div",{className:"wi-account-row",children:b("span",{className:"wi-account-name",children:m??"Account 1"})}),B("button",{type:"button",className:"wi-address-row-btn",onClick:qi,"aria-label":"Copy address","data-track":"address_copy",children:[b("span",{className:"wi-account-address",children:xt(v)}),b("span",{className:"wi-account-copy","data-copied":On,children:On?b(Nn,{size:12}):b(po,{size:12})})]})]}),ea=B(Oi,{children:[o,O==="qr"?b("div",{className:"wi-sticky-header",children:B("div",{className:"wi-header wi-header--receive",children:[b("button",{type:"button",className:"wi-header-back",onClick:_o,"aria-label":"Back",children:b(En,{size:24})}),b("span",{className:"wi-receive-title",children:"Receive"}),b("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:b(Vt,{size:24})})]})}):O==="send"||O==="bridge"?null:Zc?B("div",{className:"wi-sticky-header",children:[B("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[b("button",{type:"button",className:"wi-header-back",onClick:_o,"aria-label":"Back",children:b(En,{size:24})}),b("div",{className:"wi-account-block wi-account-block--sub-account",children:Ji}),b("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:b(Vt,{size:24})})]}),b("hr",{className:"wi-divider"})]}):B("div",{className:"wi-sticky-header",children:[B("div",{className:"wi-header wi-header--wallet",children:[B("div",{className:"wi-account-block",children:[B("div",{className:"wi-avatar",children:[b("div",{className:"wi-avatar-fallback",style:Ki}),Bo&&b("img",{src:Bo,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:Fo,onError:y=>{y.currentTarget.style.display="none"}})]}),Ji]}),B("div",{className:"wi-header-actions",children:[d&&x&&b("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:io,"aria-label":"Show QR code","data-track":"receive",children:b(jo,{size:20})}),b("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:b(Vt,{size:24})})]})]}),b("hr",{className:"wi-divider"})]}),B("div",{className:"wi-view-container",children:[O==="wallet"&&jc,O==="qr"&&Qc,O==="portfolio"&&Vc,O==="send"&&qc,O==="bridge"&&Yc]}),O==="wallet"&&Ht&&b("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Ht}),O==="wallet"&&le&&B("a",{className:"wi-send-toast",href:Wr??"#",target:"_blank",rel:"noopener noreferrer",onClick:y=>{if(!Wr){y.preventDefault();return}Ge(y,Wr,{category:"send",origin:"send-transaction",payload:{chainId:le.chainId,txHash:le.txHash}},De)},children:[b("span",{className:"wi-send-toast-icon","data-status":le.status,"aria-hidden":!0,children:le.status==="pending"?b("span",{className:"wi-send-toast-spinner"}):le.status==="error"?b("span",{className:"wi-send-toast-error-dot"}):b(Da,{size:20})}),B("span",{className:"wi-send-toast-copy",children:[b("span",{className:"wi-send-toast-title",children:le.status==="pending"?"Sending...":le.status==="error"?"Send failed":"Send complete"}),b("span",{className:"wi-send-toast-desc",children:le.status==="pending"||le.status==="error"?le.description:"Tap to see your transaction"})]})]}),Xi&&O!=="portfolio"&&O!=="send"&&b("div",{className:"wi-sticky-footer",children:b("div",{className:"wi-footer",ref:on,children:Xi})})]}),ta={...F,...ht>0?{"--wi-footer-height":`${ht}px`}:null};return a?b(be,{feature:"wallet_info",children:B(Nr.Portal,{children:[c&&b(Nr.Overlay,{className:"wi-drawer-overlay"}),B(Nr.Content,{className:me("wi-drawer-content",n),"data-theme":i,"data-vaul-no-drag":l==="left"||l==="right"?!0:void 0,style:ta,"data-direction":l,"data-no-balance":!u||void 0,"data-has-footer":ht>0||void 0,"data-view":O,children:[b(Nr.Title,{className:"wi-sr-only",children:"My Wallet"}),ea]})]})}):B(be,{feature:"wallet_info",children:[c&&s&&b("div",{className:"wi-drawer-overlay",onClick:k}),b(Er.Portal,{children:b(Er.Content,{align:e,sideOffset:t,className:me("wi-popover-content",n),"data-theme":i,style:ta,"data-no-balance":!u||void 0,"data-has-footer":ht>0||void 0,"data-view":O,children:ea})})]})}import*as cc from"react";function dc({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=un();return cc.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as pc from"react";function uc({children:e}){let{setFooterContent:t}=un();return pc.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}Q(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--ds-system-orange-default, #f0640d);--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-system-orange-default, #f0640d);--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)}
12
+ `);Q(`.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}
13
+ `);Q(`@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}}
14
+ `);Q(`.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-apr{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}
15
+ `);Q(`.wi-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}
16
+ `);import{jsx as Wi}from"react/jsx-runtime";function vm({env:e,theme:t="dark",mobileBreakpoint:n=768,drawerDirection:o,modal:r,showBalance:i=!1,showForgeToken:a=!1,showGameToken:s=!0,showQR:l=!0,showBridge:c=!0,qrLogoSrc:u,walletAddress:g,accountName:h,sendAccounts:d,profileImageUrl:x,connectorId:w,connectorName:v,connectorIconUrl:m,preferredTokens:S=[],onSelectWallet:p,onCopyAddress:R,onBuy:k,onBuyDisabledMessage:C,onBridgeDisabledMessage:E,onSendDisabledMessage:T,onDisconnect:I,disconnectLabel:U="Disconnect",termsUrl:M=Vn,termsLabel:V="Terms of Service",privacyUrl:L=Vo,privacyLabel:Y="Privacy Policy",open:F,onOpenChange:_,showPortfolio:ne=!1,portfolioTitle:q="My Portfolio",portfolioSections:O,showTotalAssets:de=!0,totalAssetsLabel:re="Total Assets USD",sendTransaction:$,getTransactionReceipt:ke,estimateGas:fe,onOutlink:ee,lpBalanceReader:ge,stakingRewardsReader:Le,bridgeTokens:K,bridgeHistory:we,getBridgeQuote:Me,getBridgeToTokens:De,getBridgeApproval:Ft,approveBridge:he,submitBridge:Ze,onReceive:rt,onBridge:Oe,onSend:_e,style:Ue,children:en}){let it=Ae(e),kt=w?Ho[w]:void 0,He=v??kt?.name,Bt=m??kt?.iconUrl,St=Gn(`(max-width: ${n}px)`),Se=o??(i?"right":"bottom"),Ht=Se==="left"||Se==="right",jt=r??!1,at=F!==void 0,[je,st]=Ye.useState(!1),Xe=at?F:je,Ve=Ye.useCallback(ht=>{at||st(ht),_?.(ht)},[at,_]),Re=Ye.useCallback(()=>Ve(!1),[Ve]),[gt,lt]=Ye.useState(null),[Je,Rt]=Ye.useState("top"),[tn,pn]=Ye.useState(null),[nn,P]=Ye.useState("wallet"),[Z,se]=Ye.useState(null);Ye.useEffect(()=>{Xe||(P("wallet"),se(null))},[Xe]),Ye.useEffect(()=>{Un(g)},[g]);let ct=Ye.useCallback(()=>{si(g),I?.()},[I,g]),on=Ye.useMemo(()=>({env:it,theme:t,isMobile:St,open:Xe,drawerDirection:Se,modal:jt,showBalance:i,showForgeToken:a,showGameToken:s,showQR:l,showBridge:c,qrLogoSrc:u,walletAddress:g,accountName:h,sendAccounts:d,profileImageUrl:x,connectorName:He,connectorIconUrl:Bt,preferredTokens:S,close:Re,onSelectWallet:p,onCopyAddress:R,onBuy:k,onBuyDisabledMessage:C,onBridgeDisabledMessage:E,onSendDisabledMessage:T,onDisconnect:I?ct:void 0,disconnectLabel:U,termsUrl:M,termsLabel:V,privacyUrl:L,privacyLabel:Y,portalStyle:Ue,navContent:gt,navPosition:Je,setNavContent:lt,setNavPosition:Rt,footerContent:tn,setFooterContent:pn,view:nn,setView:P,selectedSendToken:Z,setSelectedSendToken:se,showPortfolio:ne,portfolioTitle:q,portfolioSections:O,showTotalAssets:de,totalAssetsLabel:re,sendTransaction:$,getTransactionReceipt:ke,estimateGas:fe,onOutlink:ee,lpBalanceReader:ge,stakingRewardsReader:Le,bridgeTokens:K,bridgeHistory:we,getBridgeQuote:Me,getBridgeToTokens:De,getBridgeApproval:Ft,approveBridge:he,submitBridge:Ze,onReceive:rt,onBridge:Oe,onSend:_e}),[it,t,St,Xe,Se,jt,i,a,s,l,c,u,g,h,d,x,He,Bt,S,Re,p,R,k,C,E,T,I,ct,U,M,V,L,Y,Ue,gt,Je,tn,nn,Z,ne,q,O,de,re,$,ke,fe,ee,ge,Le,K,we,Me,De,Ft,he,Ze,rt,Oe,_e]);return Wi(ei.Provider,{value:on,children:St?Wi(xm.Root,{direction:Se,open:Xe,onOpenChange:Ve,handleOnly:Ht,noBodyStyles:!0,repositionInputs:!1,children:en},"drawer"):Wi(fc.Root,{open:Xe,onOpenChange:Ve,children:en},"popover")})}var no=Object.assign(vm,{Trigger:vs,Content:lc,Nav:dc,Footer:uc});import*as Jt from"react";import*as Pc from"@radix-ui/react-dialog";import{Drawer as Im}from"vaul";import{createContext as ym,useContext as km}from"react";var Ir=ym(null);function Ro(){let e=km(Ir);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as mc,useEffect as Sm,useCallback as Rm}from"react";function Pr(){let[e,t]=mc([]),[n,o]=mc(!0);Sm(()=>{if(typeof window>"u"){o(!1);return}let i=[],a=l=>{let{info:c}=l.detail;c?.rdns&&!i.some(u=>u.rdns===c.rdns)&&(i.push({rdns:c.rdns,name:c.name,icon:c.icon}),t([...i]))};window.addEventListener("eip6963:announceProvider",a),window.addEventListener("eip6963:crossAnnounceProvider",a),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let s=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),window.removeEventListener("eip6963:crossAnnounceProvider",a),clearTimeout(s)}},[]);let r=Rm(i=>e.some(a=>a.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as gc from"@radix-ui/react-dialog";import{Drawer as Cm}from"vaul";import{jsx as Ui}from"react/jsx-runtime";function hc({asChild:e,children:t}){let{isMobile:n}=Ro(),o=n?Cm.Trigger:gc.Trigger;return Ui(be,{feature:"wallet_connect",children:Ui(o,{asChild:e??t!=null,children:t??Ui("button",{type:"button","data-track":"open",children:"Connect Wallet"})})})}import{useEffect as Tm}from"react";import*as Xt from"@radix-ui/react-dialog";import{Drawer as _r}from"vaul";import{jsx as oe,jsxs as Sn}from"react/jsx-runtime";function Lr(){return Sn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),oe("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z",fill:"black"})]})}function bc(){return Sn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[Sn("g",{clipPath:"url(#clip0_1331_27065)",children:[oe("path",{d:"M37.2488 38.4674L28.6626 35.8175L22.1876 39.8295L17.6699 39.8274L11.191 35.8175L2.60875 38.4674L-0.00195312 29.3328L2.60875 19.1947L-0.00195312 10.6234L2.60875 0L16.0192 8.30453H23.838L37.2488 0L39.8595 10.6234L37.2488 19.1947L39.8595 29.3328L37.2488 38.4674Z",fill:"#FF5C16"}),oe("path",{d:"M2.60938 0L16.0201 8.31037L15.4868 14.0137L2.60938 0ZM11.1919 29.3366L17.0925 33.9956L11.1919 35.8175V29.3366ZM16.6209 21.6342L15.4868 14.0175L8.22768 19.1971L8.22374 19.195V19.1988L8.24628 24.5302L11.1899 21.6345L16.6209 21.6342ZM37.2477 0L23.837 8.31037L24.3685 14.0137L37.2477 0ZM28.6654 29.3366L22.7646 33.9956L28.6654 35.8175V29.3366ZM31.6313 19.1985V19.1947L31.6297 19.1968L24.3705 14.0175L23.2364 21.6342H28.6651L31.6108 24.5296L31.6313 19.1985Z",fill:"#FF5C16"}),oe("path",{d:"M11.191 35.8175L2.60875 38.4674L-0.00195312 29.3366H11.191V35.8175ZM16.62 21.6321L18.2595 32.6435L15.9873 26.5208L8.24368 24.5296L11.189 21.6324H16.62V21.6321ZM28.6662 35.8175L37.2488 38.4674L39.8595 29.3366H28.6662V35.8175ZM23.2375 21.6321L21.598 32.6435L23.8699 26.5208L31.6138 24.5296L28.6665 21.6324H23.2375V21.6321Z",fill:"#E34807"}),oe("path",{d:"M-0.00195312 29.3328L2.60875 19.1947H8.22284L8.2434 24.5278L15.9876 26.519L18.2595 32.6414L17.0916 33.9897L11.191 29.3307H-0.00195312V29.3328ZM39.8595 29.3328L37.2488 19.1947H31.6344L31.6138 24.5278L23.8702 26.519L21.598 32.6414L22.7657 33.9897L28.6665 29.3307H39.8595V29.3328ZM23.838 8.30444H16.0192L15.4882 14.0078L18.2597 32.6355H21.598L24.3713 14.0078L23.838 8.30444Z",fill:"#FF8D5D"}),oe("path",{d:"M2.60875 0L-0.00195312 10.6234L2.60875 19.1947H8.22284L15.4859 14.0137L2.60875 0ZM14.9975 23.8438H12.4541L11.0693 25.2508L15.9893 26.515L14.9975 23.842V23.8438ZM37.2488 0L39.8595 10.6234L37.2488 19.1947H31.6344L24.3716 14.0137L37.2488 0ZM24.8637 23.8438H27.4107L28.7955 25.2526L23.8699 26.5191L24.8637 23.8418V23.8438ZM22.1857 36.1956L22.7659 33.9936L21.598 32.6453H18.2572L17.0896 33.9936L17.6696 36.1956",fill:"#661800"}),oe("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),oe("path",{d:"M11.1914 35.8131L17.672 39.8289V36.193L17.0917 33.9912L11.1914 35.8131ZM28.6649 35.8131L22.1841 39.8289V36.193L22.7644 33.9912L28.6649 35.8131Z",fill:"#E7EBF6"})]}),oe("defs",{children:oe("clipPath",{id:"clip0_1331_27065",children:oe("rect",{width:"40",height:"40",fill:"white"})})})]})}function wc(){return Sn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[oe("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),oe("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),oe("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),oe("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),oe("path",{d:"M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z",fill:"#F3BA2F"})]})}function xc(){return Sn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[oe("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),oe("path",{d:"M89.1233 136.695V59.7551H118.481V140.524L74.5862 184.774L30.4787 140.524V107.55H59.9073V136.695L74.5862 151.303L89.1233 136.695Z",fill:"white"}),oe("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),oe("path",{d:"M199.534 59.9334C202.562 60.0484 208.427 60.4824 212.031 63.6902C215.635 66.898 216.937 71.0498 216.937 73.1199V104.017L198.767 114.828L216.937 125.561V172.713C216.937 174.511 216.405 178.276 211.034 181.377C205.664 184.477 202.613 184.969 201.758 184.827H143.949C141.879 184.904 136.712 184.182 132.602 180.686C128.493 177.19 128.462 175.216 128.462 173.515V125.561L146.173 114.828L128.462 104.017V71.1268C128.462 69.721 130.109 65.7781 133.237 63.5701C137.147 60.8101 141.112 59.9334 144.409 59.9334H199.534ZM158.3 122.264V166.221H187.033V122.264H158.3ZM158.3 107.794H187.033V78.5272H158.3V107.794Z",fill:"white"})]})}function vc(){return Sn("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Sn("g",{clipPath:"url(#clip0_1185_7785)",children:[oe("path",{d:"M14 28C21.75 28 28 21.75 28 14C28 6.25 21.75 0 14 0C6.25 0 0 6.25 0 14C0 21.75 6.25 28 14 28Z",fill:"#EB0029"}),oe("path",{d:"M19.4975 8.36232L6 6L13.103 23L23 11.5311L19.4975 8.36232ZM19.2801 9.4034L21.3449 11.27L15.6975 12.2424L19.2801 9.4034ZM14.4714 12.0479L8.51876 7.35252L18.247 9.05524L14.4714 12.0479ZM14.0467 12.8782L13.0765 20.5098L7.84385 7.98492L14.0467 12.8782ZM14.9454 13.2835L21.1983 12.2064L14.026 20.518L14.9454 13.2835Z",fill:"white"})]}),oe("defs",{children:oe("clipPath",{id:"clip0_1185_7785",children:oe("rect",{width:"28",height:"28",fill:"white"})})})]})}function yc(){return Sn("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[oe("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"}),oe("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"}),oe("path",{fill:"#4CAF50",d:"M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"}),oe("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"})]})}function kc(){return oe("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:oe("path",{d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Sc(){return oe("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:oe("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Gi={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Lr},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Lr,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Lr,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",visibility:"desktop-only"},metamask:{id:"metamask",name:"MetaMask",description:"Browser extension approval is required",icon:bc,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:wc},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:xc,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:vc,badge:"For SHOP"}};function zi(e){return Gi[e]}var $i={google:{id:"google",name:"Google",icon:yc},apple:{id:"apple",name:"Apple",icon:kc}};function Rc(e){return $i[e]}import{Fragment as Ec,jsx as X,jsxs as Qe}from"react/jsx-runtime";function Cc(e,t){ve("connect","wallet_selected",{tags:{item_id:e}});let n=t?.();n instanceof Promise&&n.then(()=>ve("connect","connected"),o=>ve("connect","connected",{status:"failure",reason:bt(o)}))}function Nm({wallet:e,detected:t,onConnect:n}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}n()},r=e.icon,i=e.featured===!0;return Qe("button",{type:"button",className:me("wcm-wallet-item",i&&"wcm-wallet-item--featured"),"data-track":"wallet_item_click","data-track-id":e.id,onClick:o,children:[Qe("div",{className:"wcm-wallet-item-left",children:[X("div",{className:"wcm-wallet-icon",children:X(r,{})}),Qe("div",{className:"wcm-wallet-name-row",children:[X("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&X("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?X("span",{className:"wcm-installed-label",children:"Installed"}):X("span",{className:"wcm-install-btn",children:"Install"}))]})}function Em({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return Qe("button",{type:"button",className:"wcm-social-item","data-provider":e.id,"data-track":"social_provider_click","data-track-id":e.id,onClick:t,"aria-label":o,children:[X("span",{className:"wcm-social-icon",children:X(n,{})}),X("span",{className:"wcm-social-name",children:o})]})}function Tc(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:i,isDetected:a,close:s,isMobile:l}=Ro(),c=t.filter(h=>{let d=zi(h).visibility;return!d||d==="always"?!0:d==="desktop-only"?!l:d==="mobile-only"?l:!0}),u=o.length>0,g=c.length>0;return Qe(Ec,{children:[Qe("div",{className:"wcm-header",children:[Qe("div",{className:"wcm-header-text",children:[X("h2",{className:"wcm-title",children:"CROSS Wallet"}),!l&&X("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),X("button",{type:"button",className:"wcm-close-btn","data-track":"close",onClick:s,"aria-label":"Close",children:X(Sc,{})})]}),Qe("div",{className:"wcm-body",children:[u&&Qe(Ec,{children:[!l&&Qe("div",{className:"wcm-section-header",children:[X("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),X("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),X("div",{className:"wcm-social-grid",children:o.map(h=>{let d=Rc(h);return X(Em,{social:d,onSignIn:()=>{Cc(h,n[h]),s()}},h)})}),g&&Qe("div",{className:"wcm-separator",children:[X("div",{className:"wcm-separator-line"}),X("span",{className:"wcm-separator-text",children:"Other Wallets"}),X("div",{className:"wcm-separator-line"})]})]}),g&&X("div",{className:"wcm-wallet-list",children:c.map(h=>{let d=zi(h),x=d.rdns?a(d.rdns):!1;return X(Nm,{wallet:d,detected:x,onConnect:()=>{Cc(h,e[h]),s()}},h)})}),Qe("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",X(Nc,{href:r,track:"terms_link",children:"Terms of Service"})," ","and consent to its"," ",X(Nc,{href:i,track:"privacy_link",children:"Privacy Policy"}),"."]})]})]})}function Nc({href:e,track:t,children:n}){return e?X("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer","data-track":t,children:n}):X("span",{className:"wcm-terms-link",children:n})}function Ic({className:e}){let{isMobile:t,theme:n,portalStyle:o,open:r}=Ro();return Tm(()=>{r&&ve("connect","opened")},[r]),t?X(be,{feature:"wallet_connect",children:Qe(_r.Portal,{children:[X(_r.Overlay,{className:"wcm-overlay"}),Qe(_r.Content,{className:me("wcm-drawer-content",e),"data-theme":n,style:o,children:[X(_r.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X("div",{className:"wcm-drawer-handle"}),X("div",{className:"wcm-drawer-body",children:X(Tc,{})})]})]})}):X(be,{feature:"wallet_connect",children:Qe(Xt.Portal,{children:[X(Xt.Overlay,{className:"wcm-overlay"}),Qe(Xt.Content,{className:me("wcm-dialog-content",e),"data-theme":n,style:o,children:[X(Xt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X(Xt.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),X("div",{className:"wcm-dialog-body",children:X(Tc,{})})]})]})})}Q(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:var(--ds-overlay-dim, rgba(0, 0, 0, .5));-webkit-backdrop-filter:var(--ds-bg-blur-7, blur(3.5px));backdrop-filter:var(--ds-bg-blur-7, blur(3.5px))}.wcm-dialog-content{-webkit-font-smoothing:antialiased;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:100001;width:var(--wcm-dialog-width, 480px);max-height:90vh;overflow:hidden;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-radius:24px;box-shadow:var(--ds-shadow-modal, 0 4px 30px -1px rgba(0, 0, 0, .15));outline:none;animation:wcm-dialog-show .2s ease-out;font-family:inherit}.wcm-dialog-content[data-state=closed]{animation:wcm-dialog-hide .15s ease-in}.wcm-dialog-body,.wcm-drawer-body{scrollbar-width:thin;scrollbar-color:var(--ds-border-medium, rgba(0, 0, 0, .18)) transparent}.wcm-dialog-body::-webkit-scrollbar,.wcm-drawer-body::-webkit-scrollbar{width:4px}.wcm-dialog-body::-webkit-scrollbar-track,.wcm-drawer-body::-webkit-scrollbar-track{background:transparent}.wcm-dialog-body::-webkit-scrollbar-thumb,.wcm-drawer-body::-webkit-scrollbar-thumb{background:var(--ds-border-medium, rgba(0, 0, 0, .18));border-radius:4px}.wcm-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;bottom:0;left:0;right:0;z-index:100001;width:100%;max-width:var(--wcm-drawer-max-width, none);min-width:var(--wcm-drawer-min-width, 0);max-height:85dvh;margin:0 auto;display:flex;flex-direction:column;background:var(--ds-surface-default, #ffffff);border:1px solid var(--ds-border-default, #00000012);border-top-left-radius:16px;border-top-right-radius:16px;outline:none;font-family:inherit;box-sizing:border-box}.wcm-drawer-content[data-vaul-drawer-direction=right]{inset:0 0 0 auto;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:16px 0 0 16px}.wcm-drawer-content[data-vaul-drawer-direction=left]{inset:0 auto 0 0;max-height:100vh;width:var(--wcm-drawer-max-width, 400px);max-width:100vw;border-radius:0 16px 16px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 16px 16px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--ds-border-medium, rgba(0, 0, 0, .18));margin:12px auto 8px;flex-shrink:0}.wcm-drawer-content[data-vaul-drawer-direction=left] .wcm-drawer-handle,.wcm-drawer-content[data-vaul-drawer-direction=right] .wcm-drawer-handle{display:none}.wcm-dialog-body,.wcm-drawer-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.wcm-drawer-body{overscroll-behavior:contain}.wcm-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:24px;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-header-text{display:flex;flex-direction:column;gap:4px;min-width:0}.wcm-title{font-family:Inter,sans-serif;font-weight:600;font-size:20px;line-height:1.25;letter-spacing:0;color:var(--ds-content-highest, #000000);margin:0}.wcm-subtitle{font-family:Inter,sans-serif;font-weight:400;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));margin:0}.wcm-close-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;border:none;background:transparent;color:var(--ds-content-low, #00000066);cursor:pointer;padding:0;transition:opacity .15s ease}.wcm-close-btn:hover{opacity:.6}.wcm-close-btn>svg{width:24px;height:24px}.wcm-divider{display:none}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:24px}.wcm-section-header{display:flex;align-items:center;gap:8px;width:100%}.wcm-section-title{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1;letter-spacing:0;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-recommended-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-low, #e7f9f8);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-high, #00a0a2);white-space:nowrap}.wcm-social-grid{display:grid;gap:8px;width:100%}.wcm-dialog-body .wcm-social-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.wcm-drawer-body .wcm-social-grid{grid-template-columns:1fr}.wcm-social-item{display:flex;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;transition:none;font-family:inherit;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wcm-social-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-social-item:hover{background:#eff3f8!important}.wcm-social-item[data-provider=apple] .wcm-social-icon{color:#000}[data-theme=dark] .wcm-social-item[data-provider=apple] .wcm-social-icon{color:#fff}.wcm-dialog-body .wcm-social-item{flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px}.wcm-drawer-body .wcm-social-item{flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;padding:16px}.wcm-social-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.wcm-social-icon>svg{width:32px;height:32px}.wcm-social-name{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:12px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--ds-border-default, rgba(0, 0, 0, .07))}.wcm-separator-text{font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-wallet-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:20px 16px;background:var(--ds-surface-medium, #f5f7fa);border:none;border-radius:12px;cursor:pointer;text-align:left;transition:none;font-family:inherit}.wcm-wallet-item:hover{background:#2e3544!important}:root[data-ds-theme=light] .wcm-wallet-item:hover{background:#eff3f8!important}.wcm-wallet-item-left{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:28px;height:28px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg,.wcm-wallet-icon>img{width:28px;height:28px;border-radius:0;object-fit:cover}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px;min-width:0}.wcm-wallet-name{font-family:Inter,sans-serif;font-weight:600;font-size:16px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-system-purple-low, #f5f3ff);border:.5px solid var(--ds-system-purple-default, #7e54f4);border-radius:9999px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-system-purple-high, #7346f3);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;background:var(--ds-accent-primary-default, #00b4b7);border-radius:6px;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-accent-primary-on, #ffffff);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-family:Inter,sans-serif;font-weight:500;font-size:12px;line-height:1;letter-spacing:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wcm-terms{font-family:Inter,sans-serif;font-weight:400;font-size:12px;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;margin:0}.wcm-terms-link{color:var(--ds-accent-primary-high, #00a0a2);text-decoration:none}.wcm-terms-link:hover{text-decoration:underline}.wcm-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}
17
+ `);Q(`@keyframes wcm-overlay-show{0%{opacity:0}to{opacity:1}}@keyframes wcm-overlay-hide{0%{opacity:1}to{opacity:0}}@keyframes wcm-dialog-show{0%{opacity:0;transform:translate(-50%,-48%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes wcm-dialog-hide{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-48%) scale(.96)}}
18
+ `);import{jsx as Co}from"react/jsx-runtime";var Pm={};function Lm({wallets:e,socialProviders:t=Pm,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:i=768,drawerDirection:a="bottom",dialogWidth:s,drawerMaxWidth:l,drawerMinWidth:c,style:u,open:g,onOpenChange:h,children:d}){let x=Gn(`(max-width: ${i}px)`),[w,v]=Jt.useState(!1),m=g!==void 0,S=m?g:w,p=Jt.useCallback(M=>{m||v(M),h?.(M)},[m,h]),R=Jt.useCallback(()=>p(!1),[p]),{isDetected:k}=Pr(),C=Jt.useMemo(()=>Object.keys(e),[e]),E=Jt.useMemo(()=>Object.keys(t),[t]),T=Jt.useMemo(()=>{let M={};return s&&(M["--wcm-dialog-width"]=s),l&&(M["--wcm-drawer-max-width"]=l),c&&(M["--wcm-drawer-min-width"]=c),{...M,...u}},[s,l,c,u]),I=Jt.useMemo(()=>({theme:r,isMobile:x,open:S,setOpen:p,close:R,wallets:e,activeWalletIds:C,socialProviders:t,activeSocialIds:E,termsUrl:n??Vn,privacyUrl:o??Vo,isDetected:k,portalStyle:T}),[r,x,S,p,R,e,C,t,E,n,o,k,T]),U=Co("div",{"data-theme":r,style:T,children:d});return x?Co(Ir.Provider,{value:I,children:Co(Im.Root,{direction:a,open:S,onOpenChange:p,noBodyStyles:!0,children:U},"drawer")}):Co(Ir.Provider,{value:I,children:Co(Pc.Root,{open:S,onOpenChange:p,children:U})})}var Lc=Object.assign(Lm,{Trigger:hc,Content:Ic});import*as Ac from"react";Q(`.cb-button{--cb-bg: var(--ds-accent-primary-default, #00b4b7);--cb-bg-hover: var(--cb-bg);--cb-color: var(--ds-accent-primary-on-primary, #ffffff);--cb-border: none;--cb-radius: 8px;--cb-height: 36px;--cb-padding: 8px 16px;--cb-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-font-size: 14px;--cb-font-weight: 500;--cb-line-height: 1.5;--cb-letter-spacing: -.01em;--cb-gap: 8px;--cb-transition: opacity .15s;--cb-loading-opacity: .7;--cb-press-scale: .95;--cb-icon-size: 18px;--cb-spinner-size: 18px;--cb-spinner-thumb: currentColor;--cb-spinner-track: color-mix(in srgb, currentColor 20%, transparent)}.cb-pill{--cb-pill-bg: var(--ds-surface-default, #ffffff);--cb-pill-bg-hover: var(--cb-pill-bg);--cb-pill-color: var(--ds-content-high, rgba(0, 0, 0, .85));--cb-pill-border: 1px solid var(--ds-border-default, rgba(0, 0, 0, .07));--cb-pill-border-hover: 1px solid var(--ds-border-medium, rgba(0, 0, 0, .18));--cb-pill-radius: 8px;--cb-pill-height: 36px;--cb-pill-padding: 1px 13px;--cb-pill-press-scale: .95;--cb-pill-font-family: Inter, system-ui, -apple-system, sans-serif;--cb-pill-font-size: 14px;--cb-pill-font-weight: 500;--cb-pill-line-height: 1.5;--cb-pill-gap: 8px;--cb-pill-icon-size: 18px;--cb-pill-icon-placeholder-bg: var(--ds-surface-medium, #f5f7fa);--cb-pill-address-font: Inter, system-ui, -apple-system, sans-serif;--cb-pill-address-font-size: 14px;--cb-pill-address-letter-spacing: -.01em}
19
+ `);Q(`.cb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-height);gap:var(--cb-gap);padding:var(--cb-padding);border-radius:var(--cb-radius);border:var(--cb-border);background:var(--cb-bg);color:var(--cb-color);font-family:var(--cb-font-family);font-size:var(--cb-font-size);font-weight:var(--cb-font-weight);line-height:var(--cb-line-height);letter-spacing:var(--cb-letter-spacing);cursor:pointer;transition:var(--cb-transition)}.cb-button:hover:not(:disabled){background:var(--cb-bg-hover)}.cb-button:active:not(:disabled){transform:scale(var(--cb-press-scale))}.cb-button:disabled,.cb-button[aria-busy=true]{cursor:default;opacity:var(--cb-loading-opacity)}.cb-spinner{display:inline-block;width:var(--cb-spinner-size);height:var(--cb-spinner-size);border:2px solid var(--cb-spinner-track);border-top-color:var(--cb-spinner-thumb);border-radius:50%;animation:cb-spin .6s linear infinite;flex-shrink:0}.cb-button-icon{width:var(--cb-icon-size);height:var(--cb-icon-size);flex-shrink:0}.cb-button-label{white-space:nowrap}.cb-pill{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--cb-pill-height);gap:var(--cb-pill-gap);padding:var(--cb-pill-padding);border-radius:var(--cb-pill-radius);border:var(--cb-pill-border);background:var(--cb-pill-bg);color:var(--cb-pill-color);font-family:var(--cb-pill-font-family);font-size:var(--cb-pill-font-size);font-weight:var(--cb-pill-font-weight);line-height:var(--cb-pill-line-height);cursor:pointer}.cb-pill:hover{background:var(--cb-pill-bg-hover)}.cb-pill:active:not(:disabled){transform:scale(var(--cb-pill-press-scale))}.cb-pill-icon{width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;object-fit:contain;flex-shrink:0;background:transparent}[data-theme=dark] .cb-pill-icon[data-provider=apple]{filter:invert(1)}.cb-pill-icon-placeholder{display:inline-block;width:var(--cb-pill-icon-size);height:var(--cb-pill-icon-size);border-radius:50%;background:var(--cb-pill-icon-placeholder-bg);flex-shrink:0}.cb-pill-address{font-family:var(--cb-pill-address-font);font-size:var(--cb-pill-address-font-size);letter-spacing:var(--cb-pill-address-letter-spacing);white-space:nowrap}@media(max-width:767.98px){.cb-button,.cb-pill{width:36px;min-width:36px;padding:0}.cb-button{height:36px}.cb-button-label,.cb-pill-address{display:none}}@keyframes cb-spin{to{transform:rotate(360deg)}}
20
+ `);var _m='<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>',Am='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',Fm='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',Bm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',Mm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function To(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var Ar=To(_m),Fr=To(Am),Br=To(Fm),Mr=To(Bm),Dr=To(Mm);import{jsx as mt,jsxs as No}from"react/jsx-runtime";function Fc({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:i,onConnect:a,onDisconnect:s,onCopy:l,onSelectWallet:c,onBuy:u,onBuyDisabledMessage:g,label:h="Connect Wallet",connectingLabel:d="Connecting...",disconnectLabel:x,className:w,theme:v="dark",env:m,showBalance:S=!0,showPortfolio:p,drawerDirection:R,modal:k,connectorId:C,style:E,walletInfoStyle:T,sendTransaction:I,getTransactionReceipt:U,estimateGas:M,onReceive:V,onBridge:L,onSend:Y,bridgeTokens:F,bridgeHistory:_,getBridgeQuote:ne,getBridgeToTokens:q,getBridgeApproval:O,approveBridge:de,submitBridge:re}){let $=w?`cb-button ${w}`:"cb-button",ke=w?`cb-pill ${w}`:"cb-pill";if(Ac.useEffect(()=>{Un(t)},[t]),e)return No("button",{type:"button",disabled:!0,className:$,style:E,"aria-busy":"true",children:[mt("span",{className:"cb-spinner","aria-hidden":"true"}),mt("span",{className:"cb-button-label",children:d})]});if(t){let fe=o??Um(n),ee=n?Om[n]:void 0;return mt(be,{feature:"connect_button",children:No(no,{env:m,theme:v,drawerDirection:R,modal:k,showBalance:S,showPortfolio:p,walletAddress:t,accountName:r,sendAccounts:i,connectorId:C,onSelectWallet:c,onCopyAddress:l?(ge,Le)=>{Le&&l()}:void 0,onDisconnect:s,disconnectLabel:x,style:T,sendTransaction:I,getTransactionReceipt:U,estimateGas:M,onReceive:V,onBridge:L,onBuy:u,onBuyDisabledMessage:g,onSend:Y,bridgeTokens:F,bridgeHistory:_,getBridgeQuote:ne,getBridgeToTokens:q,getBridgeApproval:O,approveBridge:de,submitBridge:re,children:[mt(no.Trigger,{asChild:!0,children:No("button",{type:"button",className:ke,"data-track":"wallet_pill_open",style:E,"aria-label":`Connected with ${fe}: ${_c(t)}`,children:[ee?mt("img",{src:ee,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):mt("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),mt("span",{className:"cb-pill-address",children:_c(t)})]})}),mt(no.Content,{align:"end",sideOffset:8})]})})}return mt(be,{feature:"connect_button",children:No("button",{type:"button",onClick:a,className:$,"data-track":"connect_click",style:E,"aria-label":typeof h=="string"?h:"Connect Wallet",children:[mt(Dm,{}),mt("span",{className:"cb-button-label",children:h})]})})}function Dm(){return No("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[mt("path",{d:"M3.75 5.25H14.25C15.0784 5.25 15.75 5.92157 15.75 6.75V13.5C15.75 14.3284 15.0784 15 14.25 15H3.75C2.92157 15 2.25 14.3284 2.25 13.5V4.5C2.25 3.67157 2.92157 3 3.75 3H13.5",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),mt("path",{d:"M12 9.75H15.75V12.75H12C11.1716 12.75 10.5 12.0784 10.5 11.25C10.5 10.4216 11.1716 9.75 12 9.75Z",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),mt("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var Om={google:Mr,apple:Dr,cross:Ar,metamask:Fr,binance:Br},Wm={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Um(e){return e?Wm[e]:"Wallet"}function _c(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Bc from"react";Q(`.sb-button{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-border-hover: var(--ds-border-default, rgba(0, 0, 0, .07));--sb-color: var(--ds-content-medium, rgba(0, 0, 0, .65));--sb-color-hover: var(--ds-content-high, rgba(0, 0, 0, .85));--sb-radius: 8px;--sb-height: 36px;--sb-padding: 1px 11px;--sb-gap: 4px;--sb-font-size: 14px;--sb-font-weight: 500;--sb-line-height: 21px;--sb-letter-spacing: 0;--sb-blur: 0px;--sb-border-width: 1px;--sb-icon-size: 18px;--sb-icon-hover-rotation: 180deg;--sb-spinner-size: 18px;--sb-spinner-thumb: currentColor;--sb-spinner-track: color-mix(in srgb, currentColor 20%, transparent);--sb-disabled-opacity: .6;--sb-press-scale: .95;--sb-hover-duration: .2s;--sb-icon-duration: .3s;--sb-easing: ease}.sb-button[data-theme=dark]{--sb-bg: var(--ds-surface-default, #1e232e);--sb-border: var(--ds-border-default, #ffffff12);--sb-border-hover: var(--ds-border-medium, #ffffff2e);--sb-color: var(--ds-content-medium, #ffffffa6);--sb-color-hover: var(--ds-content-high, #ffffffd9)}.sb-button[data-theme=light]{--sb-bg: var(--ds-surface-default, #ffffff);--sb-border: var(--ds-border-default, #00000012);--sb-border-hover: var(--ds-border-medium, #0000002e);--sb-color: var(--ds-content-medium, #000000a6);--sb-color-hover: var(--ds-content-high, #000000d9)}
21
+ `);Q(`.sb-button{-webkit-font-smoothing:antialiased;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;height:var(--sb-height);gap:var(--sb-gap);padding:var(--sb-padding);border-radius:var(--sb-radius);border:var(--sb-border-width) solid var(--sb-border);background:var(--sb-bg);backdrop-filter:blur(var(--sb-blur));-webkit-backdrop-filter:blur(var(--sb-blur));color:var(--sb-color);font-family:Inter,system-ui,-apple-system,sans-serif;font-weight:var(--sb-font-weight);font-size:var(--sb-font-size);line-height:var(--sb-line-height);letter-spacing:var(--sb-letter-spacing);cursor:pointer;transition:border-color var(--sb-hover-duration) var(--sb-easing),color var(--sb-hover-duration) var(--sb-easing)}@media(hover:hover){.sb-button:hover:not(:disabled){border-color:var(--sb-border-hover);color:var(--sb-color-hover)}.sb-button:hover:not(:disabled) .sb-button-icon{transform:rotate(var(--sb-icon-hover-rotation))}}.sb-button:active:not(:disabled){transform:scale(var(--sb-press-scale))}.sb-button:disabled,.sb-button[aria-busy=true]{cursor:default;opacity:var(--sb-disabled-opacity)}.sb-button-icon{width:var(--sb-icon-size);height:var(--sb-icon-size);flex-shrink:0;color:inherit;transition:transform var(--sb-icon-duration) var(--sb-easing),color var(--sb-icon-duration) var(--sb-easing)}.sb-spinner{display:inline-block;width:var(--sb-spinner-size);height:var(--sb-spinner-size);border:2px solid var(--sb-spinner-track);border-top-color:var(--sb-spinner-thumb);border-radius:50%;animation:sb-spin .6s linear infinite;flex-shrink:0}.sb-label{white-space:nowrap}@keyframes sb-spin{to{transform:rotate(360deg)}}
22
+ `);import{jsx as oo,jsxs as zm}from"react/jsx-runtime";var Mc="https://www.onechain.nexus/skills";function Dc({label:e="Skills",href:t,onClick:n,className:o,style:r,theme:i,disabled:a=!1,isLoading:s=!1,loadingLabel:l="Loading...",openInNewTab:c=!1,type:u="button"}){let[g,h]=Bc.useState(!1),d=Ae(),x=_n("apps.json",d,k=>Ln(k?.skills,d)),w=t??x,v=async k=>{if(w&&!n){c?window.open(w,"_blank","noopener,noreferrer"):window.location.href=w;return}if(n)try{h(!0),await n()}finally{h(!1)}},m=a||s||g,S=s||g,p=S?l:e,R=o?`sb-button ${o}`:"sb-button";return oo(be,{feature:"skills",children:zm("button",{type:u,onClick:v,disabled:m,className:R,"data-theme":i,"data-track":"click",style:r,"aria-busy":S,children:[S?oo("span",{className:"sb-spinner","aria-hidden":"true"}):oo(Gm,{}),oo("span",{className:"sb-label",children:p})]})})}function Gm(){return oo("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:oo("path",{d:"M15.5879 3.95142C16.0211 2.78097 17.6761 2.78099 18.1094 3.95142L19.6221 8.03833C20.6569 10.8348 22.8618 13.0396 25.6582 14.0745L29.7451 15.5872C30.9157 16.0204 30.9157 17.6754 29.7451 18.1086L25.6582 19.6213C22.8618 20.6562 20.657 22.861 19.6221 25.6575L18.1094 29.7444C17.6762 30.9149 16.0211 30.9149 15.5879 29.7444L14.0752 25.6575C13.0403 22.861 10.8355 20.6562 8.03906 19.6213L3.95215 18.1086C2.78172 17.6754 2.7817 16.0204 3.95215 15.5872L8.03906 14.0745C10.8355 13.0396 13.0403 10.8348 14.0752 8.03833L15.5879 3.95142Z",stroke:"currentColor",strokeWidth:"1.93556"})})}qr({mode:"dapp-ui"});export{Dr as APPLE_ICON,ga as AppLauncher,Na as AppLauncherContent,va as AppLauncherTrigger,Br as BINANCE_ICON,Tr as BridgeFlow,Ho as CONNECTOR_REGISTRY,Ar as CROSSX_ICON,Fc as ConnectButton,ti as ConnectorId,Mc as DEFAULT_SKILLS_HREF,Wo as DappUiErrorBoundary,Mr as GOOGLE_ICON,Fr as METAMASK_ICON,vr as PORTFOLIO_SECTIONS,$i as SOCIAL_REGISTRY,ir as SendFlow,Dc as SkillsButton,gi as TOKEN_STATS_QUERY_KEY,mi as USER_BALANCE_QUERY_KEY,Gi as WALLET_REGISTRY,Lc as WalletConnectModal,no as WalletInfo,Al as WalletPortfolio,Jn as WalletPortfolioBody,qr as announceAppLauncherUsage,Oo as captureDappUiException,Do as getDappUiSentryScope,co as initDappUiSentry,bt as normalizeFailureReason,Ae as resolveEnvironment,Un as setDappUiAnalyticsUser,Uo as trackDappUiEvent,ve as trackDappUiFunnel,zo as useGlobalMenu,hn as useTokenBalance,bn as useTokenStats,Pr as useWalletDetect};
22
23
  //# sourceMappingURL=index.js.map