@nexus-cross/dapp-ui 1.3.5-beta.1 → 1.3.5-beta.2

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,21 +1,22 @@
1
- function Ri(e){try{return import.meta.env?.[e]}catch{return}}function Ci(e){if(!(typeof process>"u"))return process.env?.[e]}function _e(e){if(e)return Ti(e);let t=Ri("VITE_CROSSX_ENVIRONMENT")??Ri("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ci("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Ci("CROSSX_ENVIRONMENT");return Ti(t)}function Ti(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var vr="1.3.5";var ho="__nexusCrossAppLauncherRuntime";function Jl(){if(typeof window>"u")return null;let e=window;return e[ho]??(e[ho]={mode:"dapp-ui"}),e[ho]}function ec(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??"unknown";console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${vr}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${vr} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function yr(e){let t=Jl();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),ec(t))}import*as Ln from"react";import*as Ni from"@radix-ui/react-popover";import{Drawer as ic}from"vaul";import{createContext as tc,useContext as nc}from"react";var kr=tc(null);function bo(){let e=nc(kr);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as oc,useEffect as rc}from"react";function En(e){let[t,n]=oc(!1);return rc(()=>{let o=window.matchMedia(e);n(o.matches);let r=a=>n(a.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function K(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))}K(`[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
- `);K(`.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
- `);K(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
- `);K(`.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
- `);K("");import{jsx as Sr}from"react/jsx-runtime";function Ii({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let a=En(`(max-width: ${n}px)`),[i,s]=Ln.useState(!1),c=Ln.useCallback(()=>s(!1),[]),l=_e(e),d=Ln.useMemo(()=>({env:l,theme:t,isMobile:a,open:i,domain:o,close:c}),[l,t,a,i,o,c]);return Sr(kr.Provider,{value:d,children:a?Sr(ic.Root,{direction:"right",open:i,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Sr(Ni.Root,{open:i,onOpenChange:s,children:r},"popover")})}import*as Pi from"@radix-ui/react-popover";import{Drawer as sc}from"vaul";import{jsx as st,jsxs as ac}from"react/jsx-runtime";function Ei({size:e=18}){return ac("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[st("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),st("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function Li(){return st("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:st("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai(){return st("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:st("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as wo}from"react/jsx-runtime";function Fi({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:a}=bo(),i=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=i?t:wo("button",{type:"button",className:c,"data-theme":a,style:o,children:wo(Ei,{size:18})});return r?wo(sc.Trigger,{asChild:s,children:l}):wo(Pi.Trigger,{asChild:s,children:l})}import*as gn from"react";import*as vo from"@radix-ui/react-popover";import{Drawer as An}from"vaul";import{useQuery as dc}from"@tanstack/react-query";var Bi={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 lc="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",cc="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function gt(e,t){return`${e==="production"?cc:lc}/${t}.png`}function _i(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:gt(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:gt(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:gt(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:gt(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:gt(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:gt(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:gt(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:gt(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:gt(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1,serviceStatus:"available"},{id:"points",label:"Points",description:"Dive into CROSS World, Earn CROSS Points",url:{dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://onechain.nexus/points"},iconUrl:gt(t,"point"),order:1e4,type:"points",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:gt(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:gt(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1,serviceStatus:"available"}]}}function xo(e){let t=_e(e);return dc({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(Bi[t],{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(n.aborted)throw o;return _i(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Rr(e){return e.serviceStatus==="ending"||e.serviceStatus==="comingSoon"?e.serviceStatus:"available"}function Oi(e,t){return typeof e=="string"?e:e[t]??e.production??e.stage??e.dev}function Wi(e){return[...e].sort((t,n)=>{let o=Mi(t)-Mi(n);return o!==0?o:t.order-n.order})}function Mi(e){let t=Rr(e);return t==="comingSoon"?0:t==="ending"?2:1}function se(...e){return e.filter(Boolean).join(" ")}import{jsx as Me,jsxs as Pn}from"react/jsx-runtime";function pc(e){return e.id==="cross-staking"||e.type==="cross-staking"}function zi({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:a,domain:i,close:s}=bo(),{data:c}=xo(o),l=gn.useMemo(()=>Wi(c?.items??[]),[c?.items]),d=8,w=gn.useRef(null),h=gn.useCallback(v=>{w.current={x:v.clientX,y:v.clientY}},[]),m=typeof window<"u"?window.location.pathname:"",y=gn.useCallback((v,C)=>{if(w.current){let k=v.clientX-w.current.x,N=v.clientY-w.current.y;if(w.current=null,Math.abs(k)>d||Math.abs(N)>d)return}let p=C.url[o]??C.url.production,T=Di(p,i);if(!T)try{let k=new URL(p).pathname;if(m===k||m.startsWith(k+"/")){s();return}}catch{}T?window.open(p,"_blank","noopener,noreferrer"):window.location.href=p,s()},[o,i,s,m]),b=v=>{let C=v.url[o]??v.url.production,p=Di(C,i),T=Rr(v),k=T==="ending",N=Oi(v.iconUrl,o),S=!1;if(!p)try{let G=new URL(C).pathname;S=m===G||m.startsWith(G+"/")}catch{S=!1}return Me("button",{type:"button",className:"al-grid-item","data-active":S||void 0,"data-service-status":T,onPointerDown:h,onClick:G=>y(G,v),children:Pn("div",{className:"al-grid-item-left",children:[Pn("div",{className:"al-grid-item-icon",children:[Me("img",{src:N,alt:v.label,width:24,height:24,loading:"lazy"}),v.isNew&&Me("span",{className:"al-status-ribbon al-status-ribbon-new",children:"N"})]}),Pn("span",{className:"al-grid-item-text",children:[Me("span",{className:"al-grid-item-label",children:v.label}),k&&Me("span",{className:"al-grid-item-status-text",children:"(End Soon)"}),v.badge&&!pc(v)&&Me("span",{className:"al-badge al-badge-list",children:v.badge})]})]})},v.id)},u=Me("div",{className:"al-menu","data-theme":r,children:Me("div",{className:"al-grid",children:l.map(b)})});return a?Pn(An.Portal,{children:[Me(An.Overlay,{className:"al-drawer-overlay"}),Pn(An.Content,{className:se("al-drawer-content",n),"data-theme":r,children:[Pn("div",{className:"al-drawer-header",children:[Me(An.Close,{className:"al-drawer-close",children:Me(Li,{})}),Me(An.Title,{className:"al-drawer-title",children:"CROSS Services"}),Me(An.Close,{className:"al-drawer-close",children:Me(Ai,{})})]}),Me("div",{className:"al-drawer-body",children:u})]})]}):Me(vo.Portal,{children:Me(vo.Content,{align:e,sideOffset:t,className:se("al-popover-content",n),"data-theme":r,children:u})})}function Di(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Je from"react";import*as ml from"@radix-ui/react-popover";import{Drawer as Ff}from"vaul";import{createContext as fc,useContext as uc}from"react";var Cr=fc(null);function tn(){let e=uc(Cr);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Tr=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(Tr||{}),yo={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 Aa from"react";import{jsx as ne,jsxs as qn}from"react/jsx-runtime";function Gi({size:e=16,className:t}){return qn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ne("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"}),ne("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 Vn({size:e=16,className:t}){return ne("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("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 hn({size:e=16,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Wt({size:e=24,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Hi({size:e=20,className:t}){return qn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ne("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"}),ne("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 ko({size:e=20,className:t}){return ne("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:ne("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 bn({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function wn({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ui({size:e=16,className:t}){return qn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ne("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"}),ne("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 $i({size:e=16,className:t}){return qn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ne("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"}),ne("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ji({size:e=42,className:t}){return ne("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:ne("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 Vi({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("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 qi({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("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 Ki({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("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 Qi({size:e=20,className:t}){return ne("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ne("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 Yi({size:e=20,className:t}){return qn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ne("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),ne("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 M from"react";import xn from"bignumber.js";function mc(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 nn(e,t){if(!e||e==="0")return"0.00";let n=new xn(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,xn.ROUND_DOWN)}function lt(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Nr(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 Zi(e,t,n){let r=new xn(e).shiftedBy(-t).multipliedBy(new xn(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(xn.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,xn.ROUND_DOWN):r.decimalPlaces(4,xn.ROUND_DOWN)).toFormat()}`}function Xi(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 i=Number(n);if(!Number.isFinite(i)||i===0)return{displayValue:"0",isLowerBound:!1};n=mc(i.toFixed(18))}let[o="0",r=""]=n.split(".");if(Number(o)>=1){let i=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${i}`,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 wc}from"react";import{useQuery as xc}from"@tanstack/react-query";var ye={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}},Fn="https://terms.crosstoken.io/docs/cross-terms-of-use",So="https://terms.crosstoken.io/docs/nexus-privacy-policy";import*as Bn from"react";var gc={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"},hc=3e3;function vn(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 Ir=new Map;function Ji(e,t){let n=`${gc[t]}/${e}`,o=Ir.get(n);return o||(o=(async()=>{let r=new AbortController,a=setTimeout(()=>r.abort(),hc);try{let i=await fetch(n,{cache:"no-store",signal:r.signal});return i.ok?await i.json():null}catch{return null}finally{clearTimeout(a)}})().then(r=>(r===null&&Ir.delete(n),r)),Ir.set(n,o)),o}function bc(e){return typeof e=="string"&&e.startsWith("https://")}async function re(e,t){let n=await Ji("endpoints.json",t),o=vn(n?.apis?.[e],t);if(!bc(o))throw new Error(`[remote-config] endpoints.json missing or invalid api base: ${e} (${t})`);return o}function yn(e,t,n){let[o,r]=Bn.useState(void 0),a=Bn.useRef(n);return a.current=n,Bn.useEffect(()=>{let i=!0;return Ji(e,t).then(s=>{if(!i)return;let c=a.current(s);c!==void 0&&r(c)}),()=>{i=!1}},[e,t]),o}var vc="send:chain-info";function yc(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 Er(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function kc(e,t,n,o){if(o)return t===ye[e].cross?ea(t,o):n?.explorer_url?Er(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):Sc(e,t,o)}function ea(e,t){return Er("https://explorer.onechain.nexus",String(e),"tx",t)}function Sc(e,t,n){let o=ye[e];if(t===o.cross)return ea(t,n);if(t===o.bsc)return Er(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function Ro(e,t,n,o=!0){let r=xc({queryKey:[vc,e,t],queryFn:async({signal:s})=>{let c=await re("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 d=await l.json();if("code"in d&&d.code!==void 0&&d.code!==200)throw new Error(`Chain info API error: ${d.code}`);return yc(d)},enabled:o,staleTime:3e5}),a=r.data;return{transactionUrl:wc(()=>kc(e,t,a,n),[t,a,e,n]),chainInfo:a,...r}}var ta="0x0000000000000000000000000000000000000001";var Rc="0xa9059cbb",Cc=/^0x[a-fA-F0-9]{40}$/,Tc="nexus-cross:dapp-ui:send:recent:",na=10;function Nc(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Kn(e){return e.toLowerCase()}function Dt(e){return Cc.test(e)}function on(e){return Kn(e.address)===ta}function Lr(e){return`${Tc}${e.toLowerCase()}`}function _n(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(Lr(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Dt(o.address)&&typeof o.updatedAt=="number").slice(0,na):[]}catch{return[]}}function Ar(e,t){if(typeof window>"u")return[];let n=Kn(t),o=[{address:n,updatedAt:Date.now()},..._n(e).filter(r=>r.address!==n)].slice(0,na);try{window.localStorage.setItem(Lr(e),JSON.stringify(o))}catch{return _n(e)}return o}function Pr(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(Lr(e))}catch{}}function Yt(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 a=BigInt(o||"0"),i=r.padEnd(t,"0"),s=i?BigInt(i):0n,c=10n**BigInt(t),l=a*c+s;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Qn(e,t){let n=BigInt(e||"0"),o=10n**BigInt(t),r=n/o,a=n%o;if(a===0n)return r.toString();let i=Nc(a.toString().padStart(t,"0"));return`${r.toString()}.${i}`}function Fr(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${Rc}${n}${o}`}function Co(e,t,n=10){if(t<=0)return e.toString();let o=10n**BigInt(t),r=e/o,a=e%o;if(a===0n)return r.toString();let s=a.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 Br(e,t){return Co(e,t,6)}function oa(e){return Co(e,9,2)}function ra(e){return e.toLocaleString("en-US")}function To(e){return e===56||e===97}function No(e){return e.gasPrice??e.maxFeePerGas}function ia(e,t=!1){return t?No(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Io(e,t=!1){if(t){let n=No(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 Eo(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function aa(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(aa(n.cause,t+1)),o.join(`
6
- `).toLowerCase()}function Ic(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 _r(e,t={},n="Failed to send transaction."){let o=aa(e);if(!o)return n;let r=t.nativeSymbol?.trim()||"gas token",a=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 i=a?` on ${a}`:"";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.":Ic(e)||n}var Ec=2000000000n,Lc=1000000000n;async function Lo(e,t,n){let o=new AbortController,r=setTimeout(()=>o.abort(),8e3),a=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(!a.ok)throw new Error(`RPC ${t} HTTP ${a.status}`);let i=await a.json();if(i.error)throw new Error(`RPC ${t}: ${i.error.message}`);if(i.result===void 0)throw new Error(`RPC ${t}: empty result`);return i.result}function Ao(e){return BigInt(e)}function Ac(e){return`0x${e.toString(16)}`}function Pc(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Ac(e.value)),e.data&&(t.data=e.data),t}function Fc(e){return e===56||e===97}async function sa(e){try{let t=await Lo(e,"eth_gasPrice",[]);return{gasPrice:Ao(t)}}catch{return{gasPrice:Ec}}}async function Bc(e,t){let n=Lc;try{let o=await Lo(e,"eth_maxPriorityFeePerGas",[]);n=Ao(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function _c(e,t){if(t)return sa(e);let n;try{n=(await Lo(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Bc(e,Ao(n)):sa(e)}async function la(e,t){let n=Fc(t.chainId),o=Pc(t),[r,a]=await Promise.all([Lo(e,"eth_estimateGas",[o]),_c(e,n)]);return{gasLimit:Ao(r),gasPrice:a.gasPrice,maxFeePerGas:a.maxFeePerGas,maxPriorityFeePerGas:a.maxPriorityFeePerGas}}function ca(e){let{estimateGas:t,sendTransaction:n,getTransactionReceipt:o}=e;return{canSend:!!n,canEstimateGas(r){return!!t||!!r},async estimateGas(r,a){if(t)return t(r);if(a)return la(a,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 Mc=1500,Oc=120;function da(e){return!!(e.token||e.recipient||e.amount)}function Mr({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},a=e.trim(),i=Yt(t,n.quantity.decimals),s;return a?Dt(a)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in i?r.amount=i.error:(s=i.value,s>o&&(r.amount="Amount exceeds available balance.")),!on(n)&&!Dt(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:a&&Dt(a)?a:void 0}}function Or({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return on(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:Kn(e.address),data:Fr(n,o),value:0n,chainId:e.chainId,from:r}}function Wc(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Dc=e=>new Promise(t=>setTimeout(t,e));async function pa({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=Mc,pollMaxAttempts:a=Oc}){let i=await e.sendTransaction(t);o(i);let{getTransactionReceipt:s}=e;if(!s)return"success";for(let c=0;c<a;c+=1){let l=await s({hash:i,chainId:n}).catch(()=>null);if(l)return Wc(l)?"reverted":"success";await Dc(r)}return"timeout"}var fa=["token","recipient","amount","review"];function ua(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:a="recipient",token:i,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:d,estimateGas:w,getTokenPriceUsd:h,onSubmitted:m,onSuccess:y,onFailed:b,onExit:u,onOutlink:v}=e,C=M.useMemo(()=>ca({sendTransaction:l,getTransactionReceipt:d,estimateGas:w}),[l,d,w]),[p,T]=M.useState(i);M.useEffect(()=>{T(i)},[i.address,i.chainId]);let[k,N]=M.useState(a),[S,G]=M.useState(""),[O,H]=M.useState(""),[B,ie]=M.useState({}),[I,oe]=M.useState("idle"),[W,V]=M.useState(""),[he,X]=M.useState(""),[U,fe]=M.useState(null),[ce,$]=M.useState(!1),[Ne,F]=M.useState(""),J=M.useRef(0),[ue,Le]=M.useState(null),[Q,de]=M.useState(""),[Ie,Ee]=M.useState(()=>_n(n)),Qt=M.useMemo(()=>_e(t),[t]),{transactionUrl:Ae,chainInfo:ke}=Ro(Qt,p.chainId,W||void 0,!0),dt=ke?.currency_symbol??"",Pe=ke?.name??`Chain ID ${p.chainId}`,De=M.useRef({nativeSymbol:dt||void 0,networkName:Pe,tokenSymbol:p.symbol});De.current={nativeSymbol:dt||void 0,networkName:Pe,tokenSymbol:p.symbol};let Se=M.useMemo(()=>BigInt(p.quantity.numeric||"0"),[p.quantity.numeric]),_t=M.useMemo(()=>nn(p.quantity.numeric,p.quantity.decimals),[p.quantity.numeric,p.quantity.decimals]),yt=h?.(p),Mt=M.useMemo(()=>{if(yt===void 0)return;let L=parseFloat(O.replace(/,/g,""));return Number.isFinite(L)?L*yt:0},[O,yt]);M.useEffect(()=>{H(""),ie({})},[p.address,p.chainId]),M.useEffect(()=>{J.current+=1,fe(null),F(""),$(!1)},[p.address,p.chainId,S,O]),M.useEffect(()=>{Ee(_n(n))},[n]);let rt=M.useCallback(L=>{G(L),ie(ee=>({...ee,recipient:void 0}))},[]),kt=M.useCallback(L=>{H(L),ie(ee=>({...ee,amount:void 0}))},[]),pt=M.useCallback(()=>{H(_t.replace(/,/g,"")),ie(L=>({...L,amount:void 0}))},[_t]),be=M.useCallback(L=>{T(L),c?.(L),N("recipient")},[c]),Ot=M.useCallback(()=>N("token"),[]),ft=M.useCallback(()=>{N(L=>{if(L==="result")return"review";if(L===a)return u?.(),L;let ee=fa.indexOf(L);return ee<=0?(u?.(),L):fa[ee-1]})},[a,u]),ze=M.useCallback(()=>{let{errors:L}=Mr({recipient:S,amount:"1",token:p,balanceRaw:Se});if(L.recipient){ie(ee=>({...ee,recipient:L.recipient}));return}ie(ee=>({...ee,recipient:void 0})),N("amount")},[S,p,Se]),Fe=M.useCallback(L=>{G(L),ie(ee=>({...ee,recipient:void 0})),N("amount")},[]),Ge=M.useCallback(()=>{let L=Mr({recipient:S,amount:O,token:p,balanceRaw:Se});ie(L.errors),!(da(L.errors)||L.rawAmount===void 0||!L.recipient)&&(Le(L.rawAmount),de(L.recipient),fe(null),F(""),oe("idle"),N("review"))},[S,O,p,Se]);M.useEffect(()=>{if(k!=="review"||!Q||ue===null||U!==null||ce||Ne||!C.canEstimateGas(ke?.rpc))return;let L=++J.current;$(!0),F(""),(async()=>{try{let ee=Or({token:p,walletAddress:n,recipient:Q,rawAmount:ue}),we=await C.estimateGas(ee,ke?.rpc);if(J.current!==L)return;fe(we)}catch(ee){if(J.current!==L)return;F(_r(ee,De.current,"Failed to estimate gas."))}finally{J.current===L&&$(!1)}})()},[k,Q,ue,U,ce,Ne,C,ke?.rpc,p,n]);let et=M.useMemo(()=>{if(!on(p)||!U||ue===null)return!1;let L=Io(U,To(p.chainId));return L===null?!1:ue+L>Se},[p,U,ue,Se]),it=M.useCallback(async()=>{if(!(!Q||ue===null)&&!et){X(""),V(""),oe("submitting");try{let L="",ee=await pa({repository:C,args:Or({token:p,walletAddress:n,recipient:Q,rawAmount:ue}),chainId:p.chainId,onSubmitted:we=>{L=we,V(we),oe("confirming"),Ee(Ar(n,Q)),m?.({txHash:we,chainId:p.chainId,amount:O,tokenSymbol:p.symbol,recipient:Q})}});if(ee==="success")oe("success"),L&&y?y?.(L):N("result");else if(ee==="reverted"){let we="Transaction reverted on-chain.";oe("error"),X(we),L&&b?b({txHash:L,chainId:p.chainId,message:we}):N("result")}else{let we="Transaction receipt was not found. Please check again later.";oe("error"),X(we),L&&b?b({txHash:L,chainId:p.chainId,message:we}):N("result")}}catch(L){oe("error"),X(_r(L,{nativeSymbol:dt||void 0,networkName:Pe,tokenSymbol:p.symbol})),N("result")}}},[C,Q,ue,et,p,O,n,m,y,b,dt,Pe]),[tt,ut]=M.useState(!1),St=M.useRef(void 0);M.useEffect(()=>()=>clearTimeout(St.current),[]);let je=M.useCallback(async()=>{if(W)try{await navigator.clipboard.writeText(W),ut(!0),clearTimeout(St.current),St.current=setTimeout(()=>ut(!1),2e3)}catch{}},[W]),Ve=M.useCallback(()=>{if(!Ae||!W)return;let L=at=>{typeof window<"u"&&window.open(at,"_blank","noopener,noreferrer")};if(!v){L(Ae);return}let ee=v(Ae,{category:"send",origin:"send-transaction",payload:{chainId:p.chainId,txHash:W}});if(ee&&typeof ee.then=="function"){let at=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;ee.then(mt=>{if(mt===null){at?.close();return}let Rt=mt??Ae;if(at)try{at.location.href=Rt}catch{at.close(),L(Rt)}else L(Rt)});return}let we=ee;we!==null&&L(we??Ae)},[v,p.chainId,Ae,W]),qe=M.useCallback(()=>{X(""),V(""),oe("idle"),fe(null),F(""),N("review")},[]);return{step:k,status:I,token:p,tokens:s.length>0?s:[p],recipient:S,amount:O,amountUsd:Mt,fieldErrors:B,error:he,txHash:W,gasEstimate:U,gasLoading:ce,gasError:Ne,insufficientGas:et,reviewRawAmount:ue,reviewRecipient:Q,recentAddresses:Ie,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Qt,transactionUrl:Ae,networkName:Pe,nativeSymbol:dt,nativeDecimals:ke?.currency_decimals??p.quantity.decimals,balanceRaw:Se,balanceText:_t,priceUsd:yt,canSelectToken:(s.length>0?s:[p]).length>1,canSend:C.canSend,getTokenPriceUsd:h,setRecipient:rt,setAmount:kt,setMax:pt,selectToken:be,goToTokenSelect:Ot,selectRecipient:Fe,submitRecipient:ze,submitAmount:Ge,confirmSend:it,retry:qe,back:ft,hashCopied:tt,copyHash:je,openTransaction:Ve}}import*as It from"react";import{jsx as Yn,jsxs as Wr}from"react/jsx-runtime";function ma({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:a,token:i,setMax:s}=e,c=It.useRef(null),l=It.useCallback(()=>{requestAnimationFrame(()=>{let b=c.current;if(!b)return;let u=b.value.length;b.setSelectionRange(u,u)})},[]);It.useEffect(()=>{c.current?.focus(),l()},[l]),It.useEffect(()=>{t===""&&(h(!1),l())},[t,l]);let d=It.useMemo(()=>{let b=Yt(t,i.quantity.decimals);return"value"in b&&b.value>a},[t,i.quantity.decimals,a]),[w,h]=It.useState(!1),m=!w&&t===""?"0.00":t,y=t.trim()===""||t.trim()==="0";return Yn("div",{className:"sf-body sf-amount",children:Wr("div",{className:"sf-amount-center",children:[Yn("span",{className:"sf-amount-usd",children:o!==void 0?Eo(o):"\xA0"}),Yn("div",{className:"sf-amount-input-wrap","data-over":d||void 0,"data-empty":y||void 0,onClick:()=>c.current?.focus(),children:Yn("input",{ref:c,className:"sf-amount-input",value:m,onChange:b=>{let u=b.target.value;if(w)n(u);else if(t===""){if(u.length<4)return;h(!0);let v=u.startsWith("0.00")?u.slice(4):u;n(v)}else h(!0),n(u)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${i.symbol}`,size:1})}),Wr("div",{className:"sf-amount-balance",children:[Yn("span",{children:"Balance:"}),Wr("button",{type:"button",className:"sf-amount-max",onClick:s,children:[r," ",i.symbol]})]})]})})}import*as Et from"react";var Gc=new Set(["0xff42c13d927a6b9265236619161accb227b6d452","0x9364ea6790f6e0ecfaa5164085f2a7de34ec55fb"].map(e=>e.toLowerCase()));function ha(e){return Gc.has(e.toLowerCase())}var ga={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Zn(e,t){let n=ye[e];if(t===n.cross)return ga.cross;if(t===n.bsc)return ga.bsc}var Hc={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Zt(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:a="png"}=n,i=Hc[e],s=r?`&bg=${r}`:"";return`${i}/portrait/evm/${t}.${a}?size=${o}${s}`}import{jsx as ht,jsxs as Po}from"react/jsx-runtime";function ba({size:e=20,className:t}){return Po("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[ht("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),ht("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function wa({size:e=20,className:t}){return ht("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:ht("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 xa({size:e=20,className:t}){return Po("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[ht("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),ht("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function va({size:e=16,className:t}){return ht("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:ht("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ya({size:e=56,className:t}){return Po("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[ht("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),ht("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 ka({size:e=56,className:t}){return Po("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[ht("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),ht("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as Re,jsxs as zt}from"react/jsx-runtime";function Sa(e,t){return e.name||`Account ${(e.index??t)+1}`}function Ra(e){return e.trim().slice(0,1).toUpperCase()||"A"}function Ca(e){return e.toLowerCase()}function Ta({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:a,walletAddress:i,resolvedEnv:s,selectRecipient:c}=e,l=Et.useMemo(()=>a.filter(p=>p.address.toLowerCase()!==i.toLowerCase()),[a,i]),d=l.length>0,w=Et.useMemo(()=>new Map(l.map((p,T)=>[Ca(p.address),{account:p,index:T}])),[l]),[h,m]=Et.useState("recent"),y=Et.useRef(null);Et.useEffect(()=>{y.current?.focus()},[]);let b="1A1A2E",u=Et.useCallback(async()=>{try{let p=await navigator.clipboard.readText();p&&n(p.trim())}catch{}},[n]),v=t.trim().length>0,C=Dt(t.trim());return zt("div",{className:"sf-recipient",children:[zt("div",{className:"sf-recipient-top",children:[zt("div",{className:"sf-address-field","data-filled":v||void 0,"data-invalid":o.recipient||void 0,children:[Re("textarea",{ref:y,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:v?2:1}),v?Re("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear",children:Re(xa,{size:20})}):Re("button",{type:"button",className:"sf-address-action",onClick:u,"aria-label":"Paste from clipboard",children:Re(wa,{size:20})})]}),o.recipient&&Re("p",{className:"sf-field-error",role:"alert",children:o.recipient}),zt("div",{className:"sf-tabs",role:"tablist",children:[Re("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="recent"||void 0,"aria-selected":h==="recent",onClick:()=>m("recent"),children:"Recent"}),d&&Re("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="account"||void 0,"aria-selected":h==="account",onClick:()=>m("account"),children:"My Account"})]})]}),Re("div",{className:"sf-address-list",children:h==="account"&&d?l.map((p,T)=>{let k=Sa(p,T),N=Zt(s,p.address,{size:56,bg:b});return zt("button",{type:"button",className:"sf-address-row",onClick:()=>c(p.address),children:[zt("span",{className:"sf-address-avatar",children:[N&&Re("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:S=>{S.currentTarget.style.display="none"}}),Re("span",{className:"sf-address-avatar-fallback",children:Ra(k)})]}),zt("span",{className:"sf-address-meta",children:[Re("span",{className:"sf-address-name",children:k}),Re("span",{className:"sf-address-value",children:lt(p.address)})]})]},p.address)}):r.length>0?r.map(p=>{let T=w.get(Ca(p.address)),k=T?Sa(T.account,T.index):lt(p.address),N=Zt(s,p.address,{size:56,bg:b});return zt("button",{type:"button",className:"sf-address-row",onClick:()=>c(p.address),children:[zt("span",{className:"sf-address-avatar",children:[N&&Re("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:S=>{S.currentTarget.style.display="none"}}),Re("span",{className:"sf-address-avatar-fallback",children:Ra(k)})]}),zt("span",{className:"sf-address-meta",children:[Re("span",{className:"sf-address-name",children:k}),Re("span",{className:"sf-address-value",children:lt(p.address)})]})]},p.address)}):Re("div",{className:"sf-empty",children:"No send history"})}),v&&!C&&!o.recipient&&Re("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as Ye,jsxs as Mn}from"react/jsx-runtime";function Ia({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:a,openTransaction:i}=e,s=t==="error",c=t==="success";return s?Mn("div",{className:"sf-body sf-result sf-result--error",children:[Ye("span",{className:"sf-result-icon",children:Ye(ka,{size:56})}),Mn("div",{className:"sf-result-copy",children:[Ye("h3",{className:"sf-result-title",children:"Transaction Failed"}),Ye("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&Ye(Na,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]}):Mn("div",{className:"sf-body sf-result",children:[Ye("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?Ye(ya,{size:56}):Ye("span",{className:"sf-result-spinner"})}),Mn("div",{className:"sf-result-copy",children:[Ye("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),Ye("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&Ye(Na,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]})}function Na({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return Mn("div",{className:"sf-result-hash-card",children:[Ye("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),Mn("div",{className:"sf-result-hash-row",children:[Ye("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer",children:lt(e)}),Ye("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash",children:t?Ye(hn,{size:16}):"Copy"})]})]})}import{jsx as xe,jsxs as Ze}from"react/jsx-runtime";var Fo="\u2014";function Ea({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:a,walletAddress:i,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:d,gasLoading:w,gasError:h,insufficientGas:m,error:y,resolvedEnv:b}=e,u=on(t),v=n!==null?Co(n,t.quantity.decimals):"",C=r?.trim()||`Account ${(a[0]?.index??0)+1}`,p=Zt(b,i,{size:56,bg:"1A1A2E"}),T=c||(u?t.symbol:""),k=To(t.chainId),N=d?ia(d,k):null,S=d?Io(d,k):null,G=I=>I!==null&&T?`${Br(I,l)} ${T}`:Fo,O=I=>I!==void 0?`${oa(I)} Gwei`:Fo,H=(()=>{if(!u||!d||S===null||n===null)return Fo;let I=n+S;return`${Br(I,l)} ${T||t.symbol}`})(),B=I=>w?"\u2026":I,ie=[{label:"Est. Tx Fee",value:B(G(S))},...N==="dynamic"?[{label:"Max Priority Fee",value:B(O(d?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:B(O(d?.maxFeePerGas))}]:N==="legacy"?[{label:"Gas Price",value:B(O(d?No(d):void 0))}]:[],{label:"Gas Limit",value:B(d?ra(d.gasLimit):Fo)}];return Ze("div",{className:"sf-body sf-review",children:[Ze("div",{className:"sf-review-amount",children:[xe("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"}}),Ze("span",{className:"sf-review-amount-value",children:[v,xe("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),Ze("div",{className:"sf-review-parties",children:[Ze("div",{className:"sf-review-card sf-review-party",children:[xe("span",{className:"sf-review-party-label",children:"From"}),Ze("div",{className:"sf-review-party-head",children:[xe("span",{className:"sf-review-party-avatar",children:p&&xe("img",{src:p,alt:"",width:28,height:28,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}})}),xe("span",{className:"sf-review-party-name",children:C})]}),xe("span",{className:"sf-review-party-addr",children:i})]}),xe("span",{className:"sf-review-arrow","aria-hidden":!0,children:xe(va,{size:16})}),Ze("div",{className:"sf-review-card sf-review-party",children:[xe("span",{className:"sf-review-party-label",children:"To"}),xe("span",{className:"sf-review-party-addr",children:o})]})]}),Ze("section",{className:"sf-review-card",children:[xe("h3",{className:"sf-review-section-title",children:"Summary"}),Ze("div",{className:"sf-review-row",children:[xe("span",{className:"sf-review-row-label",children:"Network"}),xe("span",{className:"sf-review-row-value",children:s})]}),ie.map(I=>Ze("div",{className:"sf-review-row",children:[xe("span",{className:"sf-review-row-label",children:I.label}),xe("span",{className:"sf-review-row-value",children:I.value})]},I.label))]}),Ze("section",{className:"sf-review-card",children:[xe("h3",{className:"sf-review-section-title",children:"Total"}),Ze("div",{className:"sf-review-row",children:[xe("span",{className:"sf-review-row-label",children:"Total Amount"}),Ze("span",{className:"sf-review-row-value",children:[v," ",t.symbol]})]}),u&&Ze("div",{className:"sf-review-row",children:[xe("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),xe("span",{className:"sf-review-row-value",children:B(H)})]})]}),m&&!h&&!y&&Ze("div",{className:"sf-message sf-message--error",role:"alert",children:["Not enough ",T||t.symbol," to cover the amount plus the network fee. Reduce the amount and try again."]}),(h||y)&&xe("div",{className:"sf-message sf-message--error",role:"alert",children:h||y})]})}import*as Bo from"react";import{jsx as rn,jsxs as kn}from"react/jsx-runtime";function La({flow:e}){let[t,n]=Bo.useState(""),o=t.trim().toLowerCase(),r=Bo.useMemo(()=>o?e.tokens.filter(a=>a.symbol.toLowerCase().includes(o)||a.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return kn("div",{className:"sf-body sf-token-select",children:[kn("div",{className:"sf-search",children:[rn(ba,{size:20}),rn("input",{className:"sf-search-input",value:t,onChange:a=>n(a.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),kn("div",{className:"sf-token-list",children:[r.map(a=>{let i=`${a.chainId}:${a.address.toLowerCase()}`,s=Zn(e.resolvedEnv,a.chainId),c=e.getTokenPriceUsd?.(a);return kn("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(a),children:[kn("span",{className:"sf-token-left",children:[kn("span",{className:"sf-token-icon-wrap",children:[rn("img",{className:"sf-token-icon",src:a.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&&rn("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"}})]}),rn("span",{className:"sf-token-name",children:a.symbol})]}),kn("span",{className:"sf-token-right",children:[rn("span",{className:"sf-token-balance",children:nn(a.quantity.numeric,a.quantity.decimals)}),c!==void 0&&rn("span",{className:"sf-token-price",children:Eo(c)})]})]},i)}),r.length===0&&rn("div",{className:"sf-empty",children:"No tokens found"})]})]})}K(`.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 _o}from"react/jsx-runtime";var Uc={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function Mo({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...a}){let i=Aa.useCallback(v=>{o?.(v),n?.(v)},[n,o]),c=ua({...a,onSuccess:o||n?i:void 0,onExit:t}),{step:l,status:d}=c,w=Dt(c.recipient.trim()),h=Yt(c.amount,c.token.quantity.decimals),m="value"in h&&h.value<=c.balanceRaw,y=d==="submitting"||d==="confirming",b=l!=="result",u=Uc[l]??"";return _o("div",{className:se("sf-root",r),"data-step":l,children:[_o("header",{className:"sf-header",children:[b?Oe("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back",children:Oe(bn,{size:24})}):Oe("span",{className:"sf-header-btn","aria-hidden":!0}),Oe("span",{className:"sf-header-title",children:u}),Oe("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:Oe(Wt,{size:24})})]}),l==="token"&&Oe(La,{flow:c}),l==="recipient"&&Oe(Ta,{flow:c}),l==="amount"&&Oe(ma,{flow:c}),l==="review"&&Oe(Ea,{flow:c}),l==="result"&&Oe(Ia,{flow:c}),_o("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":!w||void 0,"aria-disabled":!w,children:"Next"}),l==="amount"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!m||void 0,"aria-disabled":!m,children:"Next"}),l==="review"&&_o("div",{className:"sf-footer-row",children:[Oe("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:y,children:"Cancel"}),Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:y||!c.canSend||c.insufficientGas,children:y?"Sending...":"Send"})]}),l==="result"&&d==="success"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(c.txHash||void 0),children:"All done"}),l==="result"&&d==="error"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,children:"Try Again"})]})]})}import*as Pa from"@radix-ui/react-popover";import{Drawer as $c}from"vaul";import{jsx as Oo,jsxs as jc}from"react/jsx-runtime";function Fa({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:a}=tn(),i=n!=null,s=e??!0,c=i?n:jc("button",{type:"button",className:se("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[Oo(Gi,{size:o?14:16}),Oo("span",{className:"wi-trigger-address",children:lt(a)})]});return o?Oo($c.Trigger,{asChild:s,children:c}):Oo(Pa.Trigger,{asChild:s,children:c})}import*as z from"react";import*as nr from"@radix-ui/react-popover";import{Drawer as er}from"vaul";import oo from"bignumber.js";import{useQueries as Vc}from"@tanstack/react-query";import{useMemo as qc}from"react";var Dr="user-balance";async function Kc(e,t,n,o){let r=new URLSearchParams({networkId:`eip155:${t}`,account:n}),a=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:o});if(!a.ok)throw new Error(`Failed to fetch token balance: ${a.status}`);let i=await a.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function an(e,t,n=!0){let o=ye[e],r=[o.cross,o.bsc],a=Vc({queries:r.map(l=>({queryKey:[Dr,e,t,l],queryFn:async({signal:d})=>Kc(await re("walletServer",e),l,t,d),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),i=a.some(l=>l.isLoading),s=a.some(l=>l.isError);return{tokens:qc(()=>{let l=[];for(let d of a)d.data&&l.push(...d.data);return l},[a]),isLoading:i,isError:s}}import{useQuery as Qc,useQueries as Yc}from"@tanstack/react-query";import{useMemo as Zc}from"react";var Xc="forge-holdings",Jc="forge-token-image";async function ed(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 td(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 Ba(e,t,n=!0){let{data:o,...r}=Qc({queryKey:[Xc,e,t],queryFn:async({signal:a})=>ed(await re("bondingCurve",e),t,a),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:o??[],...r}}function _a(e,t,n=!0){let o=Yc({queries:t.map(a=>({queryKey:[Jc,e,a],queryFn:async({signal:i})=>td(await re("bondingCurve",e),a,i),enabled:n,staleTime:1/0}))});return{imageMap:Zc(()=>{let a=new Map;for(let i of o)i.data&&a.set(i.data.address,i.data.image_url);return a},[o])}}import{useQuery as nd}from"@tanstack/react-query";import{useMemo as od}from"react";var zr="token-stats";function Lt(e,t){return`${e}:${t.toLowerCase()}`}function sn(e,t=!0){let{data:n,...o}=nd({queryKey:[zr,e],queryFn:async({signal:a})=>{let i=await re("walletServer",e),s=await fetch(`${i}/v1/public/token/stats`,{cache:"no-store",signal:a});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:od(()=>{let a=new Map;if(!n?.data)return a;for(let i of n.data){let s=Lt(i.chain_id,i.address);a.set(s,i)}return a},[n]),...o}}import{useQuery as rd}from"@tanstack/react-query";var id="crossd-apy",ad="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function Ma(){let{data:e,...t}=rd({queryKey:[id],queryFn:async({signal:n})=>{let o=await fetch(ad,{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch CROSSD overview: ${o.status}`);let r=await o.json();if(r.code!==200)throw new Error(`CROSSD overview API error: ${r.code}`);let a=parseFloat(r.data.est_last_epoch_apy);if(!Number.isFinite(a))throw new Error("CROSSD overview returned a non-numeric APY");return a*100},staleTime:6e4});return{apyPercent:e??null,...t}}import{useQuery as sd}from"@tanstack/react-query";import{useMemo as ld}from"react";var cd="token-info";function Gr(e,t){return`${t.toLowerCase()}_${e}`}function Oa(e,t=!0){let{data:n,...o}=sd({queryKey:[cd,e],queryFn:async({signal:a})=>{let i=await re("walletServer",e),s=await fetch(`${i}/v1/public/token/info`,{cache:"no-store",signal:a});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:ld(()=>{let a=new Map;if(!n?.data)return a;for(let i of n.data){let s=Gr(i.chain_id,i.address);a.set(s,i.category)}return a},[n]),...o}}import{useMemo as dd}from"react";import Hr from"bignumber.js";function Wa(e,t,n){let{tokens:o,isLoading:r}=an(e,t,n),{statsMap:a}=sn(e,n);return dd(()=>{let i=new Hr(0);for(let d of o){let w=a.get(Lt(d.chainId,d.address));if(!w)continue;let m=new Hr(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new Hr(w.price));m.isNaN()||(i=i.plus(m))}let s=i.toFixed(),{displayValue:c,isLowerBound:l}=Xi(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,a,r])}import{QRCodeSVG as Nf}from"qrcode.react";function Xe(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 a=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,d=w=>{if(w===null){l?.close();return}let h=w??t;if(l)try{l.location.href=h}catch{l.close(),a(h)}else a(h)};r.then(d,w=>{console.error("[dapp-ui] onOutlink rejected:",w),l?.close()});return}let s=r;if(s===null)return;a(s??t)}import*as Cn from"react";import{Drawer as Bp}from"vaul";import{createContext as ud,useContext as md,useMemo as gd}from"react";import bt from"bignumber.js";var pd=/^(\d{4}-\d{2}-\d{2})/;function Da(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:a}of e.map(i=>({key:pd.exec(i.reference_date)?.[1],cumulative:i.cumulative_earned})).filter(i=>!!i.key&&i.cumulative!=null).sort((i,s)=>i.key<s.key?-1:i.key>s.key?1:0))t.set(r,a),n=r;if(n===void 0)return;let o=new Date().toISOString().slice(0,10);return t.get(o)??t.get(n)}function Wo(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function za(e){return e.length<=13?e:`${e.slice(0,6)}...${e.slice(-4)}`}var fd="0xe00e8bf3";function Ga(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`${fd}${o}${r}`}function Ur(e){return!e||e<=0n?"0":new bt(e.toString()).shiftedBy(-9).toFormat(2,bt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function Ha(e){return!e||e<=0n?"0":new bt(e.toString()).toFormat(0,bt.ROUND_DOWN)}function Ua(e){if(!e||e<=0n)return"0";let t=new bt(e.toString()).shiftedBy(-18),n=t.isLessThan(1e-4)?7:4;return t.toFormat(n,bt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function At(e,t){let n=new bt(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,bt.ROUND_DOWN):n.toFormat(4,bt.ROUND_DOWN)}function $r(e){return At(e,0)}var Xn={rate:1,symbol:"$"};function Jn(e,t=Xn){let n=Number.isFinite(t.rate)&&t.rate>0?t.rate:1;return`${t.symbol||"$"}${e.times(n).toFormat(2,bt.ROUND_DOWN)}`}function ln(e,t,n,o=Xn){let r=new bt(n||"0");if(!r.isFinite()||r.isLessThanOrEqualTo(0))return null;let a=new bt(e||"0").shiftedBy(-t).times(r);return a.isFinite()?Jn(a,o):null}var eo=ud(null);function We(){let e=md(eo);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}function Gt(){let{conversionRatio:e,currencySymbol:t}=We();return gd(()=>({rate:typeof e=="number"&&e>0?e:Xn.rate,symbol:t||Xn.symbol}),[e,t])}import{Drawer as hd}from"vaul";import{jsx as $a}from"react/jsx-runtime";function ja({asChild:e,children:t}){let{walletAddress:n}=We(),o=t!=null,r=e??!0,a=o?t:$a("button",{type:"button",children:lt(n)});return $a(hd.Trigger,{asChild:r,children:a})}import{Drawer as Ko}from"vaul";import*as ve from"react";import{useQueryClient as Ap}from"@tanstack/react-query";import{createContext as bd,useContext as wd}from"react";var jr=bd(null);function Va(){return wd(jr)}import{jsx as ct,jsxs as Do}from"react/jsx-runtime";function qa({size:e=22,className:t}){return ct("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ct("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka({size:e=22,className:t}){return Do("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ct("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),ct("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 Qa({size:e=16,className:t}){return Do("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ct("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"}),ct("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 Ya({size:e=16,className:t}){return ct("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:ct("path",{d:"M13.333 4L6 11.333 2.667 8",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Za({size:e=48,className:t}){return Do("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ct("circle",{cx:"24",cy:"24",r:"24",fill:"currentColor"}),ct("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 Pt({size:e=12,className:t}){return Do("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:[ct("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"}),ct("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),ct("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as ps from"react";import{useQuery as xd}from"@tanstack/react-query";import{useMemo as Xa}from"react";var vd="wp:reward-pools";function On(e,t=!0){let{data:n,...o}=xd({queryKey:[vd,e],queryFn:async({signal:i})=>{let s=await re("gameReward",e),c=await fetch(`${s}/v1/pools`,{cache:"no-store",signal:i});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=Xa(()=>n?.data.pools.filter(i=>i.pool_type==="CrossPool")??[],[n]),a=Xa(()=>n?.data.pools.filter(i=>i.pool_type==="GamePool")??[],[n]);return{crossPools:r,gamePools:a,allPools:n?.data.pools??[],...o}}import{useQuery as yd}from"@tanstack/react-query";import{useMemo as kd}from"react";var Sd="wp:user-deposits";function zo(e,t,n=!0){let o=n&&!!t,{data:r,...a}=yd({queryKey:[Sd,e,t],queryFn:async({signal:s})=>{let c=await re("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 d=await l.json();if(d.code!==200)throw new Error(`Deposits API error: ${d.code}`);return d},enabled:o,staleTime:0});return{depositMap:kd(()=>{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??[],...a}}import{useQuery as Rd}from"@tanstack/react-query";import{useMemo as Cd}from"react";var Ja={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},es={dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://www.onechain.nexus/points"};var ts={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"};var Vr={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},ns={dev:`${Vr.dev}/portfolio`,stage:`${Vr.stage}/portfolio`,production:`${Vr.production}/portfolio`};var os={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Ht={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",production:"https://contents.crosstoken.io/frontend/common/app-launcher/icons"};var Td="wp:token-info";function Go(e,t=!0){let n=ye[e].cross,{data:o,...r}=Rd({queryKey:[Td,e],queryFn:async({signal:c})=>{let l=await re("walletServer",e),d=await fetch(`${l}/v1/public/token/info`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let w=await d.json();if(w.code!==200)throw new Error(`Token info API error: ${w.code}`);return w},enabled:t,staleTime:300*1e3}),{byChainAddr:a,byChainSym:i}=Cd(()=>{let c=new Map,l=new Map;if(!o?.data)return{byChainAddr:c,byChainSym:l};for(let d of o.data){let w=d.address.toLowerCase();c.set(`${d.chain_id}:${w}`,d),c.set(w,d);let h=d.symbol.replace(/^t/,"").toUpperCase(),m=`${d.chain_id}:${h}`;l.has(m)||l.set(m,d),l.has(h)||l.set(h,d)}return{byChainAddr:c,byChainSym:l}},[o]);return{getTokenImage:(c,l)=>{let d=c.toLowerCase(),w=a.get(`${n}:${d}`);if(w?.image)return w.image;let h=a.get(d);if(h?.image)return h.image;if(l){let m=l.replace(/^t/,"").toUpperCase(),y=i.get(`${n}:${m}`);if(y?.image)return y.image;let b=i.get(m);if(b?.image)return b.image}return""},...r}}import{useQuery as Bd}from"@tanstack/react-query";import{useMemo as Ho}from"react";var Nd="0x70a08231",Id="0x18160ddd",Ed="0x313ce567",Ld=8e3;async function Ad(e,t,n,o){let r=new AbortController,a=setTimeout(()=>r.abort(),Ld);o&&o.addEventListener("abort",()=>r.abort(),{once:!0});let i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:n}),signal:r.signal}).finally(()=>clearTimeout(a));if(!i.ok)throw new Error(`RPC ${t} HTTP ${i.status}`);let s=await i.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 Pd(e){return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function to(e){if(!(!e||e==="0x"))try{return BigInt(e)}catch{return}}async function Sn(e,t,n,o){try{return await Ad(e,"eth_call",[{to:t,data:n},"latest"],o)}catch{return}}async function Fd(e,t,n,o){let[r,a,i]=await Promise.all([Sn(e,n,Nd+Pd(t),o),Sn(e,n,Id,o),Sn(e,n,Ed,o)]),s=to(r);if(s===void 0)return null;let c=to(i);return{balance:s,totalSupply:to(a),decimals:c!==void 0?Number(c):void 0}}async function qr(e,t){let n=ye[e].cross,o=await re("walletServer",e),r=await fetch(`${o}/v1/public/chain/info/${n}`,{cache:"no-store",signal:t});if(!r.ok)return;let a=await r.json();return("data"in a&&a.data!==void 0?Array.isArray(a.data)?a.data[0]:a.data:a)?.rpc||void 0}async function rs(e,t,n,o){if(!t||n.length===0)return{};let r;try{r=await qr(e,o)}catch{r=void 0}if(!r)return{};let a=await Promise.all(n.map(async s=>[s.toLowerCase(),await Fd(r,t,s,o)])),i={};for(let[s,c]of a)c&&(i[s]=c);return i}var _d="wp:withdraw-token-meta",Md="0xc89039c5",Od="0x95d89b41",Wd="0x313ce567";function Dd(e){if(!(!e||e==="0x"))try{let t=e.replace(/^0x/,""),n=Number(BigInt("0x"+t.slice(64,128)));if(!Number.isFinite(n)||n<=0||n>64)return;let o=t.slice(128,128+n*2),r="";for(let a=0;a<o.length;a+=2)r+=String.fromCharCode(parseInt(o.slice(a,a+2),16));return r||void 0}catch{return}}function zd(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 Gd(e,t,n){if(t.length===0)return{};let o;try{o=await qr(e,n)}catch{o=void 0}if(!o)return{};let r=await Promise.all(t.map(async i=>{let s=zd(await Sn(o,i,Md,n));if(!s)return[i.toLowerCase(),null];let[c,l]=await Promise.all([Sn(o,s,Od,n),Sn(o,s,Wd,n)]),d=Dd(c),w=to(l);return d?[i.toLowerCase(),{tokenAddress:s,symbol:d,decimals:w!==void 0?Number(w):18}]:[i.toLowerCase(),null]})),a={};for(let[i,s]of r)s&&(a[i]=s);return a}function Uo(e,t,n=!0){let r=n&&!!t,{allPools:a,isLoading:i}=On(e,r),{deposits:s,isLoading:c}=zo(e,t,r),l=Ho(()=>{let u=new Map;for(let v of a)u.set(v.pool_address.toLowerCase(),v);return u},[a]),d=Ho(()=>s.filter(u=>{try{return BigInt(u.deposited_amount||"0")>0n}catch{return!1}}),[s]),w=Ho(()=>d.map(u=>u.pool_address.toLowerCase()).filter(u=>!l.has(u)).sort(),[d,l]),{data:h,isLoading:m}=Bd({queryKey:[_d,e,w],queryFn:({signal:u})=>Gd(e,w,u),enabled:r&&w.length>0,staleTime:1440*60*1e3});return{positions:Ho(()=>{let u=[];for(let v of d){let C=v.pool_address.toLowerCase(),p=l.get(C);if(p){u.push({poolId:v.pool_id,poolAddress:v.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:v.deposited_amount});continue}let T=h?.[C];T&&u.push({poolId:v.pool_id,poolAddress:v.pool_address,poolType:"Unknown",tokenSymbol:T.symbol,tokenAddress:T.tokenAddress,decimals:T.decimals,depositedRaw:v.deposited_amount})}return u},[d,l,h]),isLoading:i||c||m}}import*as Qr from"react";import{jsx as Kr,jsxs as is}from"react/jsx-runtime";function Ut({sectionKey:e,title:t,icon:n,iconFit:o="cover",isEmpty:r,loading:a=!1,children:i}){let s=Va();return Qr.useEffect(()=>{s?.report(e,{loading:a,empty:r})},[s,e,a,r]),Qr.useEffect(()=>()=>s?.unregister(e),[s,e]),r?null:is("div",{className:"wp-svc-card",children:[is("div",{className:"wp-svc-card-head",children:[Kr("img",{className:"wp-svc-card-icon",src:n,alt:"",style:{objectFit:o}}),Kr("span",{className:"wp-svc-card-title",children:t})]}),Kr("div",{className:"wp-svc-items",children:i})]})}import*as ge from"react";import{Fragment as ss,jsx as j,jsxs as pe}from"react/jsx-runtime";var Hd=/^\d*\.?\d{0,2}$/,Ud=[100n,1000n,2000n],$d=400;function jd(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":`${Ua(e.gasLimit*n)} CROSS`}function Yr(e,t,n){return n==="loading"?"Estimating...":n==="error"||n==="unavailable"?"-":`${e} ${t}`.trim()}function as({position:e,size:t}){return e.icon?j("img",{src:e.icon,alt:"",width:t,height:t}):j("span",{children:e.tokenSymbol.slice(0,1)})}function $o({open:e,status:t,positions:n,initialPoolAddress:o,walletAddress:r,txHash:a,error:i,copied:s=!1,estimateWithdraw:c,onClose:l,onConfirm:d,onCopyHash:w}){let[h,m]=ge.useState(void 0),[y,b]=ge.useState(""),[u,v]=ge.useState(null),[C,p]=ge.useState("idle"),T=ge.useRef(0),k=ge.useRef(void 0),N=ge.useRef(null);ge.useEffect(()=>()=>clearTimeout(k.current),[]);let S=ge.useMemo(()=>{let F=(h??o)?.toLowerCase();return n.find(J=>J.poolAddress.toLowerCase()===F)??n[0]??null},[n,h,o]),G=ge.useMemo(()=>{try{return BigInt(S?.depositedRaw??"0")}catch{return 0n}},[S?.depositedRaw]),O=S?.decimals??18,H=ge.useMemo(()=>{let F=Yt(y,O);return"value"in F?F.value:null},[y,O]),B=H!==null&&H>G,ie=t==="confirm"&&!!S&&H!==null&&H>0n&&!B,I=ge.useCallback(()=>{b(""),v(null),p(c?"idle":"unavailable"),T.current+=1,N.current=null},[]);ge.useEffect(()=>{e&&(m(o),I())},[e]);let oe=ge.useCallback(F=>{t==="confirm"&&(m(F.poolAddress),I())},[t,I]);ge.useEffect(()=>{if(!e||t!=="confirm"){clearTimeout(k.current);return}if(!c||!S){clearTimeout(k.current),p("unavailable");return}if(H===null||H<=0n||B){clearTimeout(k.current),T.current+=1,N.current=null,v(null),p("idle");return}let F=`${S.poolAddress.toLowerCase()}:${H.toString()}`;if(N.current===F)return;N.current=F,clearTimeout(k.current);let J=T.current+1;T.current=J,p("loading"),k.current=setTimeout(()=>{c(S,H).then(ue=>{T.current===J&&(v(ue??null),p(ue?"ready":"unavailable"))}).catch(()=>{T.current===J&&(v(null),p("error"))})},$d)},[e,t,H,B,c,S]);let W=ge.useCallback(F=>{let J=F.target.value.replace(/,/g,"");(J===""||Hd.test(J))&&b(J)},[]),V=ge.useCallback(F=>{b(Qn(F.toString(),O))},[O]),he=ge.useCallback(F=>{let J=10n**BigInt(O),Le=(H??0n)+F*J;V(Le>G?G:Le)},[H,O,G,V]),X=ge.useCallback(()=>{V(G)},[G,V]);if(!e||!S)return null;let U=t==="submitting",fe=Ur(u?.maxPriorityFeePerGas),ce=Ur(u?.maxFeePerGas??u?.gasPrice),$=Ha(u?.gasLimit),Ne=At(S.depositedRaw,O);return j("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:F=>{F.target===F.currentTarget&&!U&&l()},children:pe("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-withdraw-title","data-status":t,"data-vaul-no-drag":!0,children:[j("div",{className:"wp-claim-grabber","aria-hidden":!0,children:j("span",{})}),pe("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&a?pe(ss,{children:[j("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:j(Za,{})}),pe("div",{className:"wp-claim-copy",children:[j("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),j("p",{className:"wp-claim-desc",children:"Your withdrawal request has been submitted. Balances will update shortly after the transaction settles."})]}),j("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:pe("div",{className:"wp-claim-list-item",children:[j("span",{children:"Tx Hash"}),pe("button",{type:"button",className:"wp-claim-hash",onClick:w,"aria-label":"Copy transaction hash",children:[j("strong",{children:za(a)}),s?j(Ya,{}):j(Qa,{})]})]})})]}):pe(ss,{children:[pe("div",{className:"wp-claim-heading",children:[j("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:t==="error"?"Withdraw Failed":"Withdraw"}),t==="error"&&j("p",{className:"wp-claim-error-message",children:i||"The withdraw request could not be completed."})]}),n.length>1&&j("div",{className:"wp-withdraw-token-list",role:"listbox","aria-label":"Withdrawable tokens",children:n.map(F=>{let J=F.poolAddress.toLowerCase()===S.poolAddress.toLowerCase();return pe("button",{type:"button",role:"option","aria-selected":J,className:"wp-withdraw-token","data-selected":J||void 0,disabled:U,onClick:()=>oe(F),children:[j("span",{className:"wp-withdraw-token-icon","aria-hidden":!0,children:j(as,{position:F,size:28})}),j("span",{className:"wp-withdraw-token-symbol",children:F.tokenSymbol}),j("span",{className:"wp-withdraw-token-amount",children:At(F.depositedRaw,F.decimals)})]},F.poolAddress)})}),pe("div",{className:"wp-claim-reward-card","aria-label":"Deposited balance",children:[j("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:j(as,{position:S,size:28})}),j("strong",{className:"wp-claim-reward-symbol",children:S.tokenSymbol}),j("strong",{className:"wp-claim-reward-amount",children:Ne})]}),pe("div",{className:"wp-withdraw-amount-card",children:[pe("div",{className:"wp-withdraw-amount-row",children:[j("input",{className:"wp-withdraw-input",type:"text",inputMode:"decimal",autoComplete:"off",placeholder:"0",value:y,disabled:U,onChange:W,"aria-label":`Withdraw amount (${S.tokenSymbol})`,"aria-invalid":B||void 0}),j("span",{className:"wp-withdraw-input-symbol",children:S.tokenSymbol})]}),B&&j("p",{className:"wp-claim-error-message",children:"Amount exceeds deposited balance."}),pe("div",{className:"wp-withdraw-quick-row",role:"group","aria-label":"Quick amounts",children:[Ud.map(F=>pe("button",{type:"button",className:"wp-withdraw-quick",disabled:U,onClick:()=>he(F),children:["+",F.toString()]},F.toString())),j("button",{type:"button",className:"wp-withdraw-quick",disabled:U,onClick:X,children:"MAX"})]})]}),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:[j("span",{className:"wp-claim-account-avatar","aria-hidden":!0}),pe("strong",{children:[S.tokenSymbol," Pool"]})]}),j("span",{children:Wo(r)})]}),j("span",{className:"wp-claim-divider","aria-hidden":!0}),pe("div",{className:"wp-claim-detail-list",children:[pe("div",{className:"wp-claim-detail-row",children:[j("span",{children:"Est. Tx Fee"}),j("strong",{children:jd(u,C)})]}),pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[j("span",{children:"Priority Fee Per Gas"}),j("strong",{children:Yr(fe,"Gwei",C)})]}),pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[j("span",{children:"Max Fee Per Gas"}),j("strong",{children:Yr(ce,"Gwei",C)})]}),pe("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[j("span",{children:"Gas Limit"}),j("strong",{children:Yr($,"",C)})]})]})]})]}),pe("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",onClick:l,children:t==="error"?"Close":"Cancel"}),pe("button",{type:"button",className:"wp-claim-primary",onClick:()=>{if(t==="success"){l();return}S&&H!==null&&H>0n&&!B&&d(S,H,u)},disabled:U||(t==="confirm"||t==="error")&&(H===null||H<=0n||B),children:[t==="success"&&"Done",t==="submitting"&&j("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}),t==="error"&&"Try Again",t==="confirm"&&"Withdraw Now"]})]})]}),j("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:j("span",{})})]})})}import*as Ce from"react";import{useQueryClient as Kd}from"@tanstack/react-query";import{useQuery as Vd}from"@tanstack/react-query";var qd="wp:reward-factory-info";function ls(e,t=!0){let{data:n,...o}=Vd({queryKey:[qd,e],queryFn:async({signal:r})=>{let a=await re("gameReward",e),i=await fetch(`${a}/v1/factory/info`,{cache:"no-store",signal:r});if(!i.ok)throw new Error(`Factory info fetch failed: ${i.status}`);let s=await i.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 Qd="wp:";function cs(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function jo(){let{env:e,walletAddress:t,sendTransaction:n,estimateGas:o}=We(),r=!!t,a=!!n,i=Kd(),{routerAddress:s}=ls(e,r&&a),c=cs(s),[l,d]=Ce.useState(!1),[w,h]=Ce.useState(void 0),[m,y]=Ce.useState("confirm"),[b,u]=Ce.useState(),[v,C]=Ce.useState(""),[p,T]=Ce.useState(!1),k=Ce.useRef(void 0);Ce.useEffect(()=>()=>clearTimeout(k.current),[]);let N=Ce.useCallback((I,oe)=>c?{to:c,value:0n,data:Ga(I,oe),chainId:ye[e].cross}:null,[e,c]),S=Ce.useCallback(()=>{i.invalidateQueries({predicate:I=>typeof I.queryKey[0]=="string"&&I.queryKey[0].startsWith(Qd)})},[i]),G=Ce.useCallback(I=>{h(I),d(!0),y("confirm"),u(void 0),C(""),T(!1)},[]),O=Ce.useCallback(()=>{m!=="submitting"&&(d(!1),h(void 0),y("confirm"),u(void 0),C(""),T(!1),m==="success"&&S())},[m,S]),H=Ce.useCallback(async(I,oe)=>{if(!o)return null;let W=N(I.poolId,oe),V=cs(t);return!W||!V?null:o({...W,from:V})},[N,o,t]),B=Ce.useCallback(async()=>{if(!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b),T(!0),clearTimeout(k.current),k.current=setTimeout(()=>T(!1),1400)}catch{T(!1)}},[b]),ie=Ce.useCallback(async(I,oe,W)=>{if(!n){y("error"),C("Withdraw is not available for this wallet.");return}if(!c){y("error"),C("Withdraw contract address is not available.");return}try{y("submitting"),C("");let V=N(I.poolId,oe);if(!V){y("error"),C("Withdraw contract address is not available.");return}let he=await n({...V,gas:W?.gasLimit&&W.gasLimit>0n?W.gasLimit:void 0,maxFeePerGas:W?.maxFeePerGas&&W.maxFeePerGas>0n?W.maxFeePerGas:void 0,maxPriorityFeePerGas:W?.maxPriorityFeePerGas&&W.maxPriorityFeePerGas>0n?W.maxPriorityFeePerGas:void 0});u(he),y("success"),S()}catch(V){y("error"),C(V instanceof Error?V.message:"Failed to request withdraw.")}},[N,S,c,n]);return{canWithdrawInline:a,isOpen:l,initialPoolAddress:w,status:m,txHash:b,error:v,copied:p,hasEstimator:!!o,openWithdraw:G,closeWithdraw:O,estimateWithdraw:H,confirmWithdraw:ie,copyHash:B}}import Zr from"bignumber.js";import{Fragment as Zd,jsx as Te,jsxs as Ue}from"react/jsx-runtime";var Yd="CROSS Rewards";function ds(e){return new Zr(e||"0").isGreaterThan(0)}function fs(){let{env:e,walletAddress:t,onOutlink:n}=We(),o=Gt(),r=!!t,{allPools:a,isLoading:i}=On(e,r),{depositMap:s,isLoading:c}=zo(e,t,r),{getTokenImage:l}=Go(e,r),d=jo(),{positions:w}=Uo(e,t,r&&d.canWithdrawInline),h=ps.useMemo(()=>w.filter(u=>u.poolType==="CrossPool").map(u=>({...u,icon:l(u.tokenAddress,u.tokenSymbol)})),[w,l]),m=(u,v)=>`${Ja[e]}/rewards/${u.pool_address}?action=${v}`,y=`${Ht[e]}/reward.png`,b=a.filter(u=>{let v=s.get(u.pool_address.toLowerCase()),C=v?.deposited_amount??"0",p=v?.claimable_reward??"0";return!(new Zr(C).isZero()&&new Zr(p).isZero())});return Ue(Zd,{children:[Te(Ut,{sectionKey:"rewards",title:Yd,icon:y,isEmpty:b.length===0,loading:i||c,children:b.map(u=>{let v=s.get(u.pool_address.toLowerCase()),C=v?.deposited_amount??"0",p=v?.claimable_reward??"0",T=m(u,"withdraw"),k=m(u,"claim"),N=l(u.deposit_token.address,u.deposit_token.symbol),S=u.reward_tokens[0],G=S?l(S.address,S.symbol):"",O=u.reward_tokens.map(X=>X.symbol),H=O.length>0?`${u.deposit_token.symbol}-${O.join("/")}`:u.deposit_token.symbol,B=S?At(p,S.decimals):"0",ie=S?.symbol??"Reward",I=ln(C,u.deposit_token.decimals,u.deposit_token.price,o),oe=S?ln(p,S.decimals,S.price,o):null,W=!!v&&ds(p),V=!!v&&ds(C),he=d.canWithdrawInline&&h.some(X=>X.poolAddress.toLowerCase()===u.pool_address.toLowerCase());return Ue("article",{className:"wp-item","data-side":"reward",children:[Ue("div",{className:"wp-item-body",children:[Ue("div",{className:"wp-item-line",children:[Te("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),Ue("div",{className:"wp-svc-token",children:[Ue("span",{className:"wp-token-stack","aria-hidden":!0,children:[N&&Te("img",{className:"wp-svc-token-icon",src:N,alt:""}),G&&Te("img",{className:"wp-svc-token-icon",src:G,alt:""})]}),Te("span",{children:H})]})]}),Ue("div",{className:"wp-item-line",children:[Te("span",{className:"wp-item-label",children:"Deposited"}),Ue("div",{className:"wp-svc-token wp-svc-token--amount",children:[N&&Te("img",{className:"wp-svc-token-icon",src:N,alt:""}),Ue("div",{className:"wp-svc-amount",children:[Te("span",{className:"wp-svc-amount-main",children:At(C,u.deposit_token.decimals)}),I&&Te("span",{className:"wp-item-usd",children:I})]})]})]}),Ue("div",{className:"wp-item-line",children:[Ue("span",{className:"wp-item-label",children:["Claimable (",ie,")"]}),Ue("div",{className:"wp-svc-token wp-svc-token--amount",children:[G&&Te("img",{className:"wp-svc-token-icon",src:G,alt:""}),Ue("div",{className:"wp-svc-amount",children:[Te("span",{className:"wp-svc-amount-main",children:B}),oe&&Te("span",{className:"wp-item-usd",children:oe})]})]})]})]}),Ue("div",{className:"wp-item-tags",children:[he?Te("button",{type:"button",className:"wp-tag wp-tag--muted","data-disabled":!V||void 0,"aria-disabled":!V||void 0,onClick:()=>{V&&d.openWithdraw(u.pool_address)},children:Te("span",{className:"wp-tag-label",children:"Withdraw"})}):Ue("a",{className:"wp-tag wp-tag--muted",href:T,target:"_blank",rel:"noopener noreferrer",onClick:X=>Xe(X,T,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:v}},n),children:[Te("span",{className:"wp-tag-label",children:"Withdraw"}),Te(Pt,{size:12,className:"wp-tag-icon"})]}),Ue("a",{className:"wp-tag wp-tag--mint","data-disabled":!W||void 0,"aria-disabled":!W||void 0,href:W?k:void 0,target:W?"_blank":void 0,rel:W?"noopener noreferrer":void 0,onClick:X=>{if(!W){X.preventDefault();return}Xe(X,k,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:v}},n)},children:[Te("span",{className:"wp-tag-label",children:"Claim"}),Te(Pt,{size:12,className:"wp-tag-icon"})]})]})]},u.pool_address)})}),Te($o,{open:d.isOpen,status:d.status,positions:h,initialPoolAddress:d.initialPoolAddress,walletAddress:t,txHash:d.txHash,error:d.error,copied:d.copied,estimateWithdraw:d.hasEstimator?d.estimateWithdraw:void 0,onClose:d.closeWithdraw,onConfirm:d.confirmWithdraw,onCopyHash:d.copyHash})]})}import*as us from"react";import{Fragment as Jd,jsx as nt,jsxs as Xt}from"react/jsx-runtime";var Xd="Points";function ms(){let{env:e,walletAddress:t,onOutlink:n}=We(),o=Gt(),r=!!t,{getTokenImage:a}=Go(e,r),i=jo(),{positions:s,isLoading:c}=Uo(e,t,r),l=us.useMemo(()=>s.filter(h=>h.poolType!=="CrossPool").map(h=>({...h,icon:a(h.tokenAddress,h.tokenSymbol)})),[s,a]),d=`${Ht[e]}/point.png`,w=es[e];return Xt(Jd,{children:[nt(Ut,{sectionKey:"points",title:Xd,icon:d,isEmpty:l.length===0,loading:c,children:l.map(h=>{let m=h.price?ln(h.depositedRaw,h.decimals,h.price,o):null;return Xt("article",{className:"wp-item","data-side":"reward",children:[Xt("div",{className:"wp-item-body",children:[Xt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"Token"}),Xt("div",{className:"wp-svc-token",children:[h.icon&&nt("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),nt("span",{children:h.tokenSymbol})]})]}),Xt("div",{className:"wp-item-line",children:[nt("span",{className:"wp-item-label",children:"Deposited"}),Xt("div",{className:"wp-svc-token wp-svc-token--amount",children:[h.icon&&nt("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),Xt("div",{className:"wp-svc-amount",children:[nt("span",{className:"wp-svc-amount-main",children:At(h.depositedRaw,h.decimals)}),m&&nt("span",{className:"wp-item-usd",children:m})]})]})]})]}),nt("div",{className:"wp-item-tags",children:i.canWithdrawInline?nt("button",{type:"button",className:"wp-tag wp-tag--muted",onClick:()=>i.openWithdraw(h.poolAddress),children:nt("span",{className:"wp-tag-label",children:"Withdraw"})}):Xt("a",{className:"wp-tag wp-tag--muted",href:w,target:"_blank",rel:"noopener noreferrer",onClick:y=>Xe(y,w,{category:"portfolio",origin:"portfolio-points",payload:{position:h}},n),children:[nt("span",{className:"wp-tag-label",children:"Withdraw"}),nt(Pt,{size:12,className:"wp-tag-icon"})]})})]},h.poolAddress)})}),nt($o,{open:i.isOpen,status:i.status,positions:l,initialPoolAddress:i.initialPoolAddress,walletAddress:t,txHash:i.txHash,error:i.error,copied:i.copied,estimateWithdraw:i.hasEstimator?i.estimateWithdraw:void 0,onClose:i.closeWithdraw,onConfirm:i.confirmWithdraw,onCopyHash:i.copyHash})]})}import*as Xr from"react";import{useQuery as ep}from"@tanstack/react-query";var tp="wp:stake-info";function gs(e,t,n=!0){let o=n&&!!t,{data:r,...a}=ep({queryKey:[tp,e,t],queryFn:async({signal:s})=>{let c=await re("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 d=await l.json();if(d.code!==0&&d.code!==200)throw new Error(`Stake info API error: ${d.code}`);return d},enabled:o,staleTime:0});return{stakeInfo:r?.data,...a}}import{useQuery as np}from"@tanstack/react-query";var op="wp:stake-rewards",rp=31;function hs(e,t,n=!0){let o=n&&!!t,{data:r,...a}=np({queryKey:[op,e,t],queryFn:async({signal:i})=>{let s=await re("posa",e),c=await fetch(`${s}/rewards/${t}?limit=${rp}`,{cache:"no-store",signal:i});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:Da(r),...a}}import{useQuery as ip}from"@tanstack/react-query";var ap="wp:staking-onchain";function bs(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...a}=ip({queryKey:[ap,e],queryFn:async()=>{if(!t)throw new Error("stakingRewardsReader not provided");return t(e)},enabled:o,staleTime:0});return{onchain:r,...a}}import{useMemo as ws}from"react";import sp from"bignumber.js";function xs(e){return e?.trim().toUpperCase()==="CROSS"}function vs(e){return new sp(e||"0").isGreaterThan(0)}function Vo(e,t,n=!0){let{allPools:o}=On(e,n),r=ws(()=>{for(let l of o)for(let d of[l.deposit_token,...l.reward_tokens])if(xs(d?.symbol)&&vs(d.price))return d.price},[o]),a=n&&r===void 0,{tokens:i}=an(e,t,a),{statsMap:s}=sn(e,a),c=ye[e].cross;return ws(()=>{if(r)return r;let l=i.find(d=>d.chainId===c&&xs(d.symbol));if(l){let d=s.get(Lt(l.chainId,l.address));if(d&&vs(d.price))return d.price}return"0"},[r,i,s,c])}import cn from"bignumber.js";import{jsx as $t,jsxs as jt}from"react/jsx-runtime";var lp="CROSS Staking";function cp(e){if(!e)return"\u2014";let t=new cn(e);return t.isFinite()?`${t.toFormat(2,cn.ROUND_DOWN)}%`:"\u2014"}function ys(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=We(),r=Gt(),a=!!t,{stakeInfo:i,isLoading:s}=gs(e,t,a),{latestReward:c,aprAccrued:l,isLoading:d}=hs(e,t,a),{onchain:w}=bs(t,o,a),h=Vo(e,t,a),m=`${Ht[e]}/cross-staking.png`,y=ns[e],b=i?.total_stake??"0",u=Xr.useMemo(()=>w?new cn(w.earnedWei.toString()).shiftedBy(-18).toString(10):c?.cumulative_earned??i?.rewards_earned??"0",[w,c,i]),v=Xr.useMemo(()=>w?new cn(w.stakedWei.toString()).shiftedBy(-18):new cn(b),[w,b]),C=l!==void 0?new cn(l):void 0,p=i?.days_since_first_stake,T=C!==void 0&&C.isFinite()&&v.isGreaterThan(0)&&p!==null&&p!==void 0?C.div(v).times(365).div(Math.max(1,p)).times(100):void 0,k=!(new cn(b).isZero()&&new cn(u).isZero()),N=ln(b,0,h,r),S=ln(u,0,h,r);return $t(Ut,{sectionKey:"staking",title:lp,icon:m,iconFit:"contain",isEmpty:!k,loading:s||d,children:jt("article",{className:"wp-item","data-side":"stake",children:[jt("div",{className:"wp-item-body",children:[jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"Staked"}),jt("div",{className:"wp-svc-amount",children:[jt("span",{className:"wp-svc-amount-main",children:[$r(b)," CROSS"]}),N&&$t("span",{className:"wp-item-usd",children:N})]})]}),jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"Rewards Earned"}),jt("div",{className:"wp-svc-amount",children:[jt("span",{className:"wp-svc-amount-main",children:[$r(u)," CROSS"]}),S&&$t("span",{className:"wp-item-usd",children:S})]})]}),jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"My APR"}),$t("span",{children:cp(T?.toString(10))})]})]}),$t("div",{className:"wp-item-tags",children:jt("a",{className:"wp-tag wp-tag--mint",href:y,target:"_blank",rel:"noopener noreferrer",onClick:G=>Xe(G,y,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:i}},n),children:[$t("span",{className:"wp-tag-label",children:"Manage"}),$t(Pt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as Jr from"react";import{useQuery as dp}from"@tanstack/react-query";var pp="wp:game-swap-pools";function ks(e,t,n=!0){let o=n&&!!t,{data:r,...a}=dp({queryKey:[pp,e,t],queryFn:async({signal:i})=>{let s=await re("gameSwap",e),c=await fetch(`${s}/addresses/${t}/portfolio`,{cache:"no-store",signal:i});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??[],...a}}import{useQuery as fp}from"@tanstack/react-query";var up="wp:game-swap-lp-balances";function Ss(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),a=!!t&&r.length>0,{data:i,...s}=fp({queryKey:[up,e,t,r,!!o],queryFn:async({signal:c})=>{let l=o?await o(r):await rs(e,t,r,c),d={};for(let[w,h]of Object.entries(l))d[w.toLowerCase()]=h;return d},enabled:a,staleTime:0});return{balances:i??{},...s}}import Jt from"bignumber.js";import{jsx as wt,jsxs as Ft}from"react/jsx-runtime";var mp="Gametoken LP",Cs=18,gp=new Jt("0.0001");function Rs(e){return e?.trim().toUpperCase()==="CROSS"}function hp(e){return e&&e>0?e:Cs}function bp(e){let t=Rs(e.token_a?.symbol)&&!Rs(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=hp(t?e.token_a?.decimals:e.token_b?.decimals),r=new Jt(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Jt(0):r.times(2)}function wp(e,t,n){let o=e.token_a?.symbol?.trim()||"TOKEN",r=e.token_b?.symbol?.trim()||"CROSS",a=t?.decimals??Cs,i,s;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let c=new Jt(t.balance.toString()),l=new Jt(t.totalSupply.toString()),d=c.div(l);i=d.times(100);let w=d.times(bp(e));if(w.isGreaterThan(0)){let h=new Jt(e.quote_usd??e.cross_usd??"0");s=h.isGreaterThan(0)?Jn(w.times(h),n):`${w.toFormat(4,Jt.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:o,tokenBSymbol:r,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:a,sharePercent:i,valueText:s}}function Ts(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=We(),r=Gt(),a=!!t,{pools:i,isLoading:s}=ks(e,t,a),c=Jr.useMemo(()=>i.map(b=>b.pair_address).filter(Boolean),[i]),{balances:l,isLoading:d}=Ss(e,t,c,o),w=`${Ht[e]}/dex.png`,h=Object.keys(l).length>0,m=Jr.useMemo(()=>{let b=i.map(u=>wp(u,l[u.pair_address?.toLowerCase()],r));return h?b.filter(u=>u.lpAmountRaw?new Jt(u.lpAmountRaw).shiftedBy(-u.lpDecimals).isGreaterThanOrEqualTo(gp):!1):b},[i,l,h,r]),y=b=>{let u=b.token_a?.address??b.pair_address;return`${os[e]}/tokens/${u}?trade=deposit`};return wt(Ut,{sectionKey:"gameSwap",title:mp,icon:w,iconFit:"contain",isEmpty:m.length===0,loading:s||d,children:m.map(b=>{let{pool:u}=b,v=y(u),C=`${b.tokenASymbol} / ${b.tokenBSymbol}`,p=u.token_a?.logo_url,T=u.token_b?.logo_url;return Ft("article",{className:"wp-item","data-side":"game-swap",children:[Ft("div",{className:"wp-item-body",children:[Ft("div",{className:"wp-item-line",children:[wt("span",{className:"wp-item-label",children:"Pool"}),Ft("div",{className:"wp-svc-token",children:[Ft("span",{className:"wp-token-stack","aria-hidden":!0,children:[p&&wt("img",{className:"wp-svc-token-icon",src:p,alt:""}),T&&wt("img",{className:"wp-svc-token-icon",src:T,alt:""})]}),wt("span",{children:C})]})]}),b.lpAmountRaw!==void 0&&Ft("div",{className:"wp-item-line",children:[wt("span",{className:"wp-item-label",children:"My LP"}),Ft("span",{children:[At(b.lpAmountRaw,b.lpDecimals)," LP"]})]}),b.sharePercent!==void 0&&Ft("div",{className:"wp-item-line",children:[wt("span",{className:"wp-item-label",children:"Pool Share"}),Ft("span",{children:[b.sharePercent.toFormat(2,Jt.ROUND_DOWN),"%"]})]}),b.valueText!==void 0&&Ft("div",{className:"wp-item-line",children:[wt("span",{className:"wp-item-label",children:"Value"}),wt("span",{children:b.valueText})]})]}),wt("div",{className:"wp-item-tags",children:Ft("a",{className:"wp-tag wp-tag--mint",href:v,target:"_blank",rel:"noopener noreferrer",onClick:k=>Xe(k,v,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:u}},n),children:[wt("span",{className:"wp-tag-label",children:"Manage"}),wt(Pt,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}import Rn from"bignumber.js";import{useMemo as Cp}from"react";import{useQuery as xp}from"@tanstack/react-query";var vp="wp:forge-pools";function Ns(e,t,n=!0){let o=n&&!!t,{data:r,...a}=xp({queryKey:[vp,e,t],queryFn:async()=>{let s=await re("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}),i=r??[];return{pools:i,isEmpty:i.length===0,...a}}import{useQueries as yp}from"@tanstack/react-query";import{useMemo as kp}from"react";var Sp="wp:forge-token-detail";async function Rp(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function Is(e,t,n=!0){let o=yp({queries:t.map(i=>({queryKey:[Sp,e,i],queryFn:async()=>Rp(await re("bondingCurve",e),i),enabled:n&&!!i,staleTime:3e4}))}),r=kp(()=>{let i=new Map;for(let s=0;s<o.length;s++){let c=o[s]?.data,l=t[s];c&&l&&i.set(l.toLowerCase(),c)}return i},[o,t]),a=o.some(i=>i.isLoading);return{detailMap:r,isLoading:a}}import{jsx as ot,jsxs as dn}from"react/jsx-runtime";var Tp="Forge",Es=18,Np="https://contents.crosstoken.io/wallet/token/images/FT.png";function Ip(e){if(!e||e==="0")return"0";let t=new Rn(e).shiftedBy(-Es);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Rn.ROUND_DOWN):t.toFormat(4,Rn.ROUND_DOWN)}function Ep(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 Lp(e,t,n,o){let r=new Rn(n||"0");if(!r.isGreaterThan(0))return null;let a=new Rn(e.total_supply||"0"),i=new Rn(e.lp_balance||"0"),s=new Rn(t?.reserve_b||"0").shiftedBy(-Es);if(!a.isGreaterThan(0)||!i.isGreaterThan(0)||!s.isGreaterThan(0))return null;let c=s.times(2),d=i.div(a).times(c).times(r);return d.isFinite()?Jn(d,o):null}function Ls(){let{env:e,walletAddress:t,onOutlink:n}=We(),o=Gt(),r=!!t,{pools:a,isEmpty:i,isLoading:s}=Ns(e,t,r),c=Cp(()=>a.map(m=>m.token.address),[a]),{detailMap:l}=Is(e,c,r&&c.length>0),d=Vo(e,t,r),w=m=>`${ts[e]}/forge/token/${m.token.address}`,h=`${Ht[e]}/forge.png`;return ot(Ut,{sectionKey:"forge",title:Tp,icon:h,iconFit:"contain",isEmpty:i,loading:s,children:a.map(m=>{let y=l.get(m.token.address.toLowerCase()),b=y?.image_url||y?.image||m.token.image||Np,u=y?.symbol||m.token.symbol,v=w(m),C=Lp(m,y,d,o);return dn("a",{className:"wp-item","data-side":"lp",href:v,target:"_blank",rel:"noopener noreferrer",onClick:p=>Xe(p,v,{category:"portfolio",origin:"portfolio-forge",payload:{pool:m,tokenDetail:y}},n),children:[dn("div",{className:"wp-item-body",children:[dn("div",{className:"wp-item-line",children:[ot("span",{className:"wp-item-label",children:"Asset"}),dn("div",{className:"wp-svc-token",children:[ot("img",{className:"wp-svc-token-icon",src:b,alt:""}),ot("span",{children:u}),y?.name&&ot("span",{className:"wp-token-subtle",children:y.name})]})]}),dn("div",{className:"wp-item-line",children:[ot("span",{className:"wp-item-label",children:"LP Balance"}),ot("div",{className:"wp-svc-token wp-svc-token--amount",children:dn("div",{className:"wp-svc-amount",children:[ot("span",{className:"wp-svc-amount-main",children:Ip(m.lp_balance)}),C&&ot("span",{className:"wp-item-usd",children:C})]})})]}),dn("div",{className:"wp-item-line",children:[ot("span",{className:"wp-item-label",children:"Ownership"}),ot("span",{className:"wp-line-value",children:Ep(m.pool_ownership)})]})]}),ot("div",{className:"wp-item-tags",children:dn("span",{className:"wp-tag wp-tag--muted",children:[ot("span",{className:"wp-tag-label",children:"Withdraw"}),ot(Pt,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}var qo=["rewards","points","staking","gameSwap","forge"];K(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--ds-bg-default, #202530);--wp-header-bg: var(--ds-surface-default, #252b39);--wp-card: var(--ds-surface-medium, #252b39);--wp-control: #292f40;--wp-border: var(--ds-border-default, #292f40);--wp-panel-border: var(--ds-border-medium, rgba(255, 255, 255, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .28);--wp-text: var(--ds-content-highest, #ffffff);--wp-text-60: var(--ds-content-high, rgba(255, 255, 255, .85));--wp-text-40: var(--ds-content-medium, rgba(255, 255, 255, .65));--wp-text-30: var(--ds-content-low, rgba(255, 255, 255, .4));--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, rgba(0, 160, 162, .14));--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #9b8cef;--wp-claim-primary-text: #202530;--wp-claim-secondary-bg: var(--wp-control);--wp-claim-success: #00d4aa;--wp-claim-success-soft: rgba(0, 212, 170, .18);--wp-claim-error: #ff3aa3;--wp-claim-error-soft: rgba(255, 58, 163, .16)}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--ds-bg-dim, #f5f7fa);--wp-header-bg: var(--ds-surface-default, #ffffff);--wp-card: var(--ds-surface-default, #ffffff);--wp-control: var(--ds-surface-medium, #f5f7fa);--wp-border: var(--ds-border-default, rgba(0, 0, 0, .07));--wp-panel-border: var(--ds-border-medium, rgba(0, 0, 0, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .15);--wp-text: var(--ds-content-highest, #000000);--wp-text-60: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-text-40: var(--ds-content-medium, rgba(0, 0, 0, .65));--wp-text-30: var(--ds-content-low, rgba(0, 0, 0, .4));--wp-chrome-text: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-card-shadow: none;--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, #e7f9f8);--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;position:relative;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:73px;padding:24px;position:relative;border-bottom:1px solid var(--wp-border);background:var(--wp-header-bg);color:var(--wp-chrome-text);flex-shrink:0;box-sizing:border-box}.wp-fullscreen .wp-header{height:60px;min-height:60px;padding:11px 20px;border-bottom:none;background:transparent}.wp-fullscreen .wp-header-btn{width:22px;height:22px;color:var(--wp-chrome-text)}.wp-fullscreen .wp-header-btn:hover{color:var(--wp-chrome-text)}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wp-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wp-header-edge{display:flex;align-items:center;width:24px;min-width:24px}.wp-header-edge--right{justify-content:flex-end}.wp-header-edge--right .wp-header-btn{position:absolute;top:24px;right:24px}.wp-header-spacer{display:block;width:24px;height:24px}.wp-header-avatar{width:38px;height:38px;flex-shrink:0;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:var(--wp-header-avatar-bg)}.wp-header-avatar-img{width:30px;height:30px;object-fit:cover;display:block}.wp-fullscreen[data-theme=dark] .wp-header-avatar,.wp-embed[data-theme=dark] .wp-header-avatar{--wp-header-avatar-bg: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;text-align:center;color:var(--ds-content-highest, #000000);margin:0}.wp-header-account{flex:1;display:flex;align-items:center;gap:12px;min-width:0}.wp-header-account-meta{display:flex;flex-direction:column;justify-content:center;min-width:0;gap:2px}.wp-header-wallet-name{min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:1.4;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-btn{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;padding:0;border:0;background:transparent;cursor:pointer;font:inherit}.wp-header-address{min-width:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-copy{display:inline-flex;align-items:center;flex-shrink:0;color:var(--wp-text-40);transition:color .15s ease}.wp-header-address-btn:hover .wp-header-address-copy{color:var(--wp-text-60)}.wp-header-address-copy[data-copied=true]{color:var(--wp-mint)}.wp-top{flex-shrink:0;padding:0 16px 16px;display:flex;flex-direction:column;gap:16px}.wp-identity{display:flex;flex-direction:column;gap:8px}.wp-address{display:inline-flex;align-items:center;gap:8px}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40)}.wp-total{font-size:28px;font-weight:600;line-height:1.3;color:var(--wp-text);margin:0}.wp-asset{display:flex;flex-direction:column;gap:8px}.wp-asset-head{display:flex;align-items:center;gap:4px}.wp-asset-head-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-asset-head-icon{display:inline-flex;color:var(--wp-text-40)}.wp-bar{display:flex;height:20px;border-radius:4px;overflow:hidden}.wp-bar-seg{display:flex;align-items:center;justify-content:center;min-width:8px}.wp-bar-seg-pct{font-size:10px;font-weight:400;line-height:1.3;color:#fff;white-space:nowrap}.wp-legend{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}.wp-legend-item{display:flex;align-items:center;gap:4px}.wp-legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.wp-legend-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-tabs{flex-shrink:0;padding:8px 16px}.wp-tabs-inner{display:flex;align-items:center;padding:0 2px}.wp-tabs-list{display:flex;gap:20px;flex:1}.wp-tab{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:44px;padding-top:12px;background:transparent;border:none;cursor:pointer}.wp-tab-text{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text-30);white-space:nowrap}.wp-tab[data-active=true] .wp-tab-text{color:var(--wp-mint)}.wp-tab-bar{width:20px;height:4px;border-radius:2px;background:var(--wp-mint);opacity:0}.wp-tab[data-active=true] .wp-tab-bar{opacity:1}.wp-tabs-filter-wrap{position:relative;display:flex;align-items:center;width:44px;height:44px;flex-shrink:0}.wp-tabs-filter-grad{position:absolute;inset:0;background:linear-gradient(to left,var(--wp-bg) 74%,transparent);pointer-events:none}.wp-tabs-filter{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text-40)}.wp-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wp-border) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:var(--wp-border);border-radius:4px}.wp-body-inner{padding:16px 16px 32px;display:flex;flex-direction:column;gap:32px}.wp-fullscreen .wp-body-inner{padding-top:8px;gap:24px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-summary-head{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:4px}.wp-summary-label{font-size:14px;font-weight:400;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address{display:inline-flex;align-items:center;gap:8px;min-width:0}.wp-address-avatar{width:16px;height:16px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 68% 34%,#ff78d1 0 18%,transparent 19%),radial-gradient(circle at 34% 66%,#00d4aa 0 20%,transparent 21%),linear-gradient(135deg,#7346f3,#0488fc)}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40);flex-shrink:0}.wp-summary-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#019d921a;color:var(--wp-mint);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;white-space:nowrap}.wp-summary-estimate{position:relative;display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.wp-estimate-info{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wp-text-40);cursor:help}.wp-estimate-tooltip{position:absolute;top:calc(100% + 8px);left:0;right:auto;z-index:3;display:flex;flex-direction:column;gap:8px;width:min(280px,calc(100vw - 48px));padding:12px;border-radius:8px;background:var(--wp-tooltip-bg);box-shadow:0 12px 32px #0000003d;color:var(--wp-tooltip-text);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(-4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-estimate-tooltip-title{display:block;font-size:12px;font-weight:600;line-height:1.3}.wp-estimate-tooltip-group{display:flex;flex-direction:column;gap:4px}.wp-estimate-tooltip-item{display:block;color:#ffffffc7}.wp-estimate-tooltip-item:before{content:"- "}.wp-estimate-info:hover .wp-estimate-tooltip,.wp-estimate-info:focus .wp-estimate-tooltip,.wp-estimate-info:focus-visible .wp-estimate-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-total{font-family:var( --wp-total-font-family, Sora, Inter, system-ui, -apple-system, sans-serif );font-size:36px;font-weight:600;line-height:1.25;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px;width:100%}.wp-svc-card-head{display:flex;align-items:center;gap:6px}.wp-svc-card-icon{width:24px;height:24px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:20px;width:100%;padding:12px;border-radius:12px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:12px;border-top:0}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:12px;min-width:0}.wp-order-head{display:flex;align-items:center;width:100%}.wp-item-line{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:21px;min-width:0}.wp-item-label{flex-shrink:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-30);white-space:nowrap}.wp-line-value,.wp-order-side{min-width:0;overflow:hidden;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-order-side--buy{color:var(--wp-mint)}.wp-order-side--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;min-height:21px}.wp-svc-token>span{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:16px;height:16px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-token--amount{align-items:flex-start}.wp-svc-token--amount>.wp-svc-token-icon{margin-top:2.5px}.wp-token-stack{display:inline-flex;align-items:center;justify-content:flex-end;width:29px;min-width:29px;overflow:visible}.wp-token-stack .wp-svc-token-icon+.wp-svc-token-icon{margin-left:-3.5px}.wp-token-subtle,.wp-item-usd{color:var(--wp-text-30)!important}.wp-svc-amount{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:1px;min-width:0}.wp-svc-amount-main{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.wp-svc-amount .wp-item-usd{font-size:12px;font-weight:500;line-height:1.35}.wp-order-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-order-token .wp-svc-token-icon{width:32px;height:32px}.wp-order-token-meta{display:flex;min-width:0;flex-direction:column;justify-content:center}.wp-order-token-symbol{overflow:hidden;color:var(--wp-text-60);font-size:14px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-order-token-pair{overflow:hidden;color:var(--wp-text-30);font-size:12px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-item-tags{display:flex;align-items:stretch;gap:8px;width:100%}.wp-tag{appearance:none;display:inline-flex;flex:1 1 0;align-items:center;justify-content:center;gap:0;min-width:0;min-height:33px;padding:6px 10px;border-radius:6px;border:0;background:var(--wp-control);font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);text-align:center;text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease}a.wp-tag,button.wp-tag{cursor:pointer}.wp-tag:hover{background:var(--wp-control);transform:none}.wp-tag:focus-visible{outline:2px solid var(--wp-mint);outline-offset:2px}.wp-tag[aria-disabled=true],.wp-tag[data-disabled]{cursor:default;opacity:.48;pointer-events:none}.wp-tag-label{display:inline-flex;align-items:center}.wp-tag-icon{display:none}.wp-tag:hover .wp-tag-icon{transform:none}.wp-tag--mint{color:var(--wp-mint);background:var(--wp-accent-soft)}.wp-tag--mint:hover{background:var(--wp-accent-soft)}.wp-tag--muted{color:var(--wp-text-40)}.wp-body-inner[data-empty]{min-height:100%;box-sizing:border-box;justify-content:center}.wp-portfolio-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:280px;padding:32px 24px;text-align:center}.wp-portfolio-empty-icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;margin-bottom:6px;border-radius:50%;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);color:var(--wp-text-30)}.wp-portfolio-empty-title{margin:0;font-size:15px;font-weight:600;line-height:1.3;color:var(--wp-text-60)}.wp-portfolio-empty-desc{margin:0;font-size:13px;font-weight:400;line-height:1.4;color:var(--wp-text-30)}.wp-portfolio-loading{display:flex;align-items:center;justify-content:center;min-height:280px;padding:32px 24px}.wp-portfolio-spinner{width:22px;height:22px;border:2px solid var(--wp-border);border-top-color:var(--wp-mint);border-radius:50%;animation:wp-claim-spin .8s linear infinite}.wp-claim-overlay{position:absolute;inset:0;z-index:8;display:flex;align-items:flex-end;justify-content:center;background:#00000094;box-sizing:border-box}.wp-claim-sheet{display:flex;flex-direction:column;width:100%;max-width:375px;max-height:calc(100% - 24px);overflow:hidden;border-radius:24px 24px 0 0;background:var(--wp-bg);color:var(--wp-text);box-shadow:0 -18px 48px #00000042;animation:wp-claim-slide-up .22s ease-out}@keyframes wp-claim-slide-up{0%{transform:translateY(18px);opacity:0}to{transform:translateY(0);opacity:1}}.wp-claim-grabber{display:flex;align-items:flex-start;justify-content:center;height:38px;min-height:38px;padding-top:12px;box-sizing:border-box}.wp-claim-grabber span{display:block;width:52px;height:5px;border-radius:999px;background:var(--wp-control)}.wp-claim-content{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;padding:20px;box-sizing:border-box}.wp-claim-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;flex-shrink:0}.wp-claim-icon--success{background:var(--wp-claim-success-soft);color:var(--wp-claim-success)}.wp-claim-icon--pending{background:#9b8cef29;color:var(--wp-claim-primary)}.wp-claim-icon--error{background:var(--wp-claim-error-soft);color:var(--wp-claim-error);font-size:30px;font-weight:600;line-height:1}.wp-claim-icon--token{background:#00d4aa29}.wp-claim-icon--token img{width:48px;height:48px;border-radius:50%;object-fit:cover}.wp-claim-icon--token span{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--wp-mint);color:#101820;font-size:18px;font-weight:600}.wp-claim-spinner{width:36px;height:36px;border-radius:50%;border:3px solid rgba(155,140,239,.28);border-top-color:var(--wp-claim-primary);animation:wp-claim-spin .8s linear infinite}@keyframes wp-claim-spin{to{transform:rotate(360deg)}}.wp-claim-copy{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;text-align:center}.wp-claim-title{margin:0;font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text)}.wp-claim-desc{max-width:335px;margin:0;font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-40)}.wp-claim-heading{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.wp-claim-error-message{margin:0;color:var(--wp-claim-error);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0}.wp-claim-reward-card{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:60px;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-reward-token{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-claim-reward-token img{width:28px;height:28px;object-fit:cover}.wp-claim-reward-token span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-claim-reward-symbol{flex:1 1 auto;min-width:0;overflow:hidden;color:var(--wp-text);font-size:18px;font-weight:600;line-height:1.3;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-reward-amount{flex-shrink:0;color:var(--wp-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-account-row{display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;min-height:40px}.wp-claim-account-row>span{flex-shrink:0;color:var(--wp-text-40);font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account{display:flex;align-items:center;gap:8px;min-width:0}.wp-claim-account strong{overflow:hidden;color:var(--wp-text);font-size:15px;font-weight:600;line-height:1.6;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-account-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 30% 28%,#d87aff 0 12%,transparent 13%),radial-gradient(circle at 68% 28%,#f0a1ff 0 12%,transparent 13%),radial-gradient(circle at 32% 70%,#b561e7 0 13%,transparent 14%),radial-gradient(circle at 70% 70%,#d4a2ff 0 13%,transparent 14%),radial-gradient(circle at 50% 50%,#8c4fc4 0 18%,transparent 19%),#4a315f;box-shadow:inset 0 0 0 3.37px var(--wp-control)}.wp-claim-divider{display:block;width:100%;height:1px;background:var(--wp-border)}.wp-claim-detail-list{display:flex;flex-direction:column;gap:8px;width:100%}.wp-claim-detail-row{display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;min-height:20px}.wp-claim-detail-row>span{min-width:0;color:var(--wp-text-40);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-detail-row--sub>span:before{content:"";display:inline-block;width:3px;height:3px;margin:0 8px 3px;background:currentColor}.wp-claim-detail-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list{display:flex;flex-direction:column;gap:8px;width:100%;padding-bottom:8px}.wp-claim-list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-list-item>span{flex-shrink:0;font-size:14px;font-weight:400;line-height:1.3;color:var(--wp-text-40);white-space:nowrap}.wp-claim-list-item strong{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;overflow:hidden;color:var(--wp-text);font-size:14px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list-item img{width:16px;height:16px;border-radius:50%;flex-shrink:0}.wp-claim-hash{appearance:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);cursor:pointer;font:inherit}.wp-claim-hash svg{flex-shrink:0;color:var(--wp-text-60)}.wp-claim-gas-card{display:flex;flex-direction:column;gap:4px;width:100%;padding:14px 16px;border-radius:8px;border:1px solid var(--wp-border);background:var(--wp-card);box-sizing:border-box}.wp-claim-gas-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px}.wp-claim-gas-row>span{min-width:0;font-size:12px;font-weight:400;line-height:1.3;color:var(--wp-text-40)}.wp-claim-gas-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:12px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-gas-row--primary{min-height:32px}.wp-claim-gas-row--primary>span,.wp-claim-gas-row--primary strong{font-size:14px;color:var(--wp-text)}.wp-claim-fee-label{position:relative;display:inline-flex;align-items:center;text-decoration:underline dotted;text-underline-offset:3px;cursor:help;overflow:visible!important}.wp-claim-fee-tooltip{position:absolute;left:0;bottom:calc(100% + 8px);z-index:2;width:min(260px,calc(100vw - 64px));padding:10px 12px;border-radius:8px;background:var(--wp-tooltip-bg);color:var(--wp-tooltip-text);box-shadow:0 12px 32px #0000003d;font-size:11px;font-weight:400;line-height:1.4;text-align:left;text-decoration:none;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-claim-fee-label:hover .wp-claim-fee-tooltip,.wp-claim-fee-label:focus .wp-claim-fee-tooltip,.wp-claim-fee-label:focus-visible .wp-claim-fee-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-claim-actions{display:flex;align-items:center;gap:8px;width:100%}.wp-claim-primary,.wp-claim-secondary{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;height:52px;padding:0 24px;border:none;border-radius:40px;font-family:inherit;font-size:15px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap;cursor:pointer}.wp-claim-primary{background:var(--wp-claim-primary);color:var(--wp-claim-primary-text)}.wp-claim-primary:disabled{cursor:default;opacity:.72}.wp-claim-secondary{background:var(--wp-claim-secondary-bg, var(--wp-control));color:var(--wp-claim-primary)}.wp-claim-actions[data-count="2"] .wp-claim-primary{flex:1 1 0}.wp-claim-actions[data-count="2"] .wp-claim-secondary{flex:0 0 120px}.wp-claim-button-spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(32,37,48,.28);border-top-color:var(--wp-claim-primary-text);animation:wp-claim-spin .8s linear infinite}.wp-claim-home-indicator{display:flex;align-items:flex-end;justify-content:center;height:34px;min-height:34px;padding-bottom:8px;box-sizing:border-box}.wp-claim-home-indicator span{display:block;width:134px;height:5px;border-radius:16px;background:var(--wp-text-40)}@media(max-width:359px){.wp-header{gap:12px;padding:0 12px}.wp-total{font-size:24px}.wp-body-inner{padding:0 12px 128px;gap:20px}.wp-svc-items,.wp-claim-content{padding:18px 14px}.wp-item-line{gap:10px}.wp-svc-token>span{max-width:168px}}.wp-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.wi-drawer-content .wp-header,.wi-portfolio-body .wp-header{padding:16px}.wi-drawer-content .wp-header-edge--right .wp-header-btn,.wi-portfolio-body .wp-header-edge--right .wp-header-btn{top:16px;right:16px}.wp-withdraw-amount-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-withdraw-amount-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-input{flex:1 1 auto;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);font-family:inherit;font-size:24px;font-weight:600;line-height:1.3;letter-spacing:0;text-align:left;outline:none}.wp-withdraw-input::placeholder{color:var(--wp-text-30)}.wp-withdraw-input[aria-invalid=true]{color:var(--wp-claim-error)}.wp-withdraw-input-symbol{flex-shrink:0;color:var(--wp-text-40);font-size:15px;font-weight:600;line-height:1.3}.wp-withdraw-quick-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-quick{appearance:none;flex:1 1 0;min-width:0;height:32px;padding:0 10px;border:1px solid var(--wp-border);border-radius:999px;background:transparent;color:var(--wp-text-60);font-family:inherit;font-size:13px;font-weight:600;line-height:1;white-space:nowrap;cursor:pointer}.wp-withdraw-quick:hover:not(:disabled){border-color:var(--wp-claim-primary);color:var(--wp-claim-primary)}.wp-withdraw-quick:disabled{cursor:default;opacity:.5}.wp-withdraw-content{overflow-y:auto}.wp-withdraw-token-list{display:flex;flex-direction:column;gap:8px;width:100%;max-height:216px;overflow-y:auto}.wp-withdraw-token{appearance:none;display:flex;align-items:center;gap:10px;width:100%;min-height:52px;padding:10px 12px;border:1px solid var(--wp-border);border-radius:8px;background:var(--wp-card);color:var(--wp-text);font-family:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.wp-withdraw-token[data-selected]{border-color:var(--wp-claim-primary);box-shadow:inset 0 0 0 1px var(--wp-claim-primary)}.wp-withdraw-token:disabled{cursor:default;opacity:.6}.wp-withdraw-token-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-withdraw-token-icon img{width:28px;height:28px;object-fit:cover}.wp-withdraw-token-icon span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-withdraw-token-symbol{flex:1 1 auto;min-width:0;overflow:hidden;font-size:15px;font-weight:600;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}.wp-withdraw-token-amount{flex-shrink:0;color:var(--wp-text-40);font-size:13px;font-weight:500;line-height:1.3;white-space:nowrap}
8
- `);import{Fragment as Fp,jsx as le,jsxs as en}from"react/jsx-runtime";var ei=15,Pp="wp:";function Wn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:a=!0,variant:i="embed",className:s,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d,sendTransaction:w,estimateGas:h,conversionRatio:m,currencySymbol:y,sections:b}){let u=_e(e),v=ve.useCallback(Q=>!b||b.includes(Q),[b]),C=!!n,p=Ap(),[T,k]=ve.useState({}),N=ve.useCallback((Q,de)=>{k(Ie=>{let Ee=Ie[Q];return Ee&&Ee.loading===de.loading&&Ee.empty===de.empty?Ie:{...Ie,[Q]:de}})},[]),S=ve.useCallback(Q=>{k(de=>{if(!(Q in de))return de;let Ie={...de};return delete Ie[Q],Ie})},[]),G=ve.useMemo(()=>({report:N,unregister:S}),[N,S]),[O,H]=ve.useState(ei),[B,ie]=ve.useState(!1),[I,oe]=ve.useState(!1),W=ve.useRef(void 0),V=ve.useCallback(()=>{p.invalidateQueries({predicate:Q=>typeof Q.queryKey[0]=="string"&&Q.queryKey[0].startsWith(Pp)})},[p]),he=ve.useCallback(()=>{V(),ie(!0),setTimeout(()=>ie(!1),600),H(ei)},[V]);ve.useEffect(()=>{if(!C)return;let Q=setInterval(()=>{H(de=>de<=1?(he(),ei):de-1)},1e3);return()=>clearInterval(Q)},[C,he]);let X=ve.useCallback(()=>{r?.()},[r]),U=C?Zt(u,n,{size:64}):void 0,fe=ve.useCallback(async()=>{if(!(I||!n))try{await navigator.clipboard.writeText(n),oe(!0),clearTimeout(W.current),W.current=setTimeout(()=>oe(!1),2e3)}catch{}},[n,I]);ve.useEffect(()=>()=>clearTimeout(W.current),[]);let ce=ve.useMemo(()=>({env:u,theme:t,open:!0,walletAddress:n,close:X,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d,sendTransaction:w,estimateGas:h,conversionRatio:m,currencySymbol:y}),[u,t,n,X,c,l,d,w,h,m,y]),$=qo.filter(v),Ne=$.length>0&&$.every(Q=>{let de=T[Q];return!!de&&!de.loading}),F=Ne&&$.every(Q=>T[Q]?.empty),J=$.some(Q=>{let de=T[Q];return!!de&&!de.empty}),ue=$.length>0&&!Ne&&!J,Le=en(Fp,{children:[a&&en("div",{className:"wp-header",children:[en("div",{className:"wp-header-account",children:[r&&le("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:r,children:le(qa,{})}),le("span",{className:"wp-header-avatar","aria-hidden":!0,children:U&&le("img",{src:U,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&en("div",{className:"wp-header-account-meta",children:[o&&le("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&en("button",{type:"button",className:"wp-header-address-btn",onClick:fe,"aria-label":"Copy wallet address",children:[le("span",{className:"wp-header-address",children:Wo(n)}),le("span",{className:"wp-header-address-copy","data-copied":I,children:I?le(hn,{size:14}):le(Vn,{size:14})})]})]})]}),en("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio",onClick:he,children:[le(Ka,{className:B?"wp-spin-once":void 0}),C&&le("span",{className:"wp-refresh-badge",children:O})]})]}),le("div",{className:"wp-body",children:en("div",{className:"wp-body-inner","data-empty":F||void 0,children:[v("rewards")&&le(fs,{}),v("points")&&le(ms,{}),v("staking")&&le(ys,{}),v("gameSwap")&&le(Ts,{}),v("forge")&&le(Ls,{}),ue&&le("div",{className:"wp-portfolio-loading",role:"status","aria-label":"Loading portfolio",children:le("span",{className:"wp-portfolio-spinner","aria-hidden":!0})}),F&&en("div",{className:"wp-portfolio-empty",role:"status",children:[le("span",{className:"wp-portfolio-empty-icon","aria-hidden":!0,children:en("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[le("path",{d:"M20 7H5a2 2 0 0 1-2-2 2 2 0 0 1 2-2h13v4"}),le("path",{d:"M3 5v13a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1"}),le("circle",{cx:"16.5",cy:"13.5",r:"1",fill:"currentColor",stroke:"none"})]})}),le("p",{className:"wp-portfolio-empty-title",children:"No assets yet"}),le("p",{className:"wp-portfolio-empty-desc",children:"Assets you hold across CROSS services will appear here."})]})]})})]});return le(eo.Provider,{value:ce,children:le(jr.Provider,{value:G,children:i==="none"?Le:le("div",{className:se(i==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:Le})})})}import{jsx as ti,jsxs as As}from"react/jsx-runtime";function Ps({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s}=We();return As(Ko.Portal,{children:[ti(Ko.Overlay,{className:"wp-overlay"}),As(Ko.Content,{className:se("wp-fullscreen",e),"data-theme":n,children:[ti(Ko.Title,{className:"wp-sr-only",children:"Portfolio"}),ti(Wn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s})]})]})}import{jsx as Fs}from"react/jsx-runtime";function _p({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:d,currencySymbol:w,children:h}){let m=_e(e),y=o!==void 0,[b,u]=Cn.useState(!1),v=y?o:b,C=Cn.useCallback(k=>{y||u(k),r?.(k)},[y,r]),p=Cn.useCallback(()=>C(!1),[C]),T=Cn.useMemo(()=>({env:m,theme:t,open:v,walletAddress:n,close:p,onOutlink:a,lpBalanceReader:i,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:d,currencySymbol:w}),[m,t,v,n,p,a,i,s,c,l,d,w]);return Fs(eo.Provider,{value:T,children:Fs(Bp.Root,{direction:"bottom",open:v,onOpenChange:C,noBodyStyles:!0,children:h})})}var Bs=Object.assign(_p,{Trigger:ja,Content:Ps});import*as A from"react";import{createPortal as Dn}from"react-dom";import Vt from"bignumber.js";import{jsx as xt,jsxs as Mp}from"react/jsx-runtime";function _s({size:e=20,className:t}){return Mp("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:[xt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),xt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function Ms({size:e=16,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:xt("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 Os({size:e=16,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:xt("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 Ws({size:e=20,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:xt("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ds({size:e=16,className:t}){return xt("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:xt("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function zs({size:e=12,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:xt("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 P from"react";import Us from"bignumber.js";function Gs(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Hs(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,Us.ROUND_DOWN).toFixed()}function Op(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 Wp(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new Us(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Gs(t)&&Gs(n)?e.lastChangedBy==="to"?{fromAmount:Hs(r.multipliedBy(n).dividedBy(t))}:{toAmount:Hs(r.multipliedBy(t).dividedBy(n))}:Op(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function $s({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):Wp(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var js=15,Dp=18,Qs="cross_bridge_terms_accepted",zp=3600*24*365;function Gp(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,js);let r=t.slice(0,o).slice(0,js),a=t.slice(o+1).slice(0,Dp);return`${r}.${a}`}function Hp(){return typeof document>"u"?!1:document.cookie.split(";").map(e=>e.trim()).some(e=>e===`${Qs}=true`)}function Up(){if(typeof document>"u")return;let e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=[`${Qs}=true`,"Path=/",`Max-Age=${zp}`,"SameSite=Lax",e].filter(Boolean).join("; ")}function $p(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 Vs(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function jp(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([Vs(e.symbol),Vs(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function Bt(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function Qo(e){return e[0]}function ni(e,t,n,o){if(n&&!Bt(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??Qo(e);let a=e.findIndex(s=>Bt(s,t)),i=a>=0?e[a+1]:void 0;return i&&!Bt(i,t)?i:e.find(s=>!Bt(s,t))??t}function qs({fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}){return{fromToken:e,toToken:t,fromAmount:n,toAmount:o,lastChangedBy:r,slippage:a}}function Yo(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),...Yo(n.cause,t+1),...Yo(n.data,t+1),...Yo(n.error,t+1)]}function oi(e){let t=Yo(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 Ks(e,t){return oi(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
9
- `)[0]?.trim()||t}function Ys(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:a,approveBridge:i,history:s=[],initialSlippage:c="1",termsUrl:l=Fn,getQuote:d,submitBridge:w,onSubmitted:h,onSuccess:m,onFailed:y,onExit:b}=e,u=P.useMemo(()=>$s({getQuote:d,submitBridge:w}),[d,w]),[v,C]=P.useState("form"),[p,T]=P.useState(n??Qo(t)),[k,N]=P.useState(()=>ni(t,n??Qo(t),o,r)),[S,G]=P.useState(""),[O,H]=P.useState(""),[B,ie]=P.useState("from"),[I,oe]=P.useState(c),[W,V]=P.useState(null),he=P.useMemo(()=>jp(p,k),[p,k]),X=P.useMemo(()=>he?"1":I==="auto"?$p(W?.priceImpact):I,[he,I,W?.priceImpact]),[U,fe]=P.useState(""),[ce,$]=P.useState("idle"),[Ne,F]=P.useState(""),[J,ue]=P.useState(null),[Le,Q]=P.useState([]),[de,Ie]=P.useState(!1),[Ee,Qt]=P.useState(Hp),[Ae,ke]=P.useState(null),[dt,Pe]=P.useState(!1),[De,Se]=P.useState(null),[_t,yt]=P.useState(null),[Mt,rt]=P.useState(!1),[kt,pt]=P.useState(!1),be=P.useRef(0),Ot=P.useRef(null),ft=P.useCallback(()=>{Ot.current&&(clearTimeout(Ot.current),Ot.current=null)},[]),ze=P.useCallback(D=>{ft(),yt(D)},[ft]);P.useEffect(()=>ft,[ft]),P.useEffect(()=>{let D=t.find(me=>Bt(me,p))??Qo(t),Be=D?r?.(D,t):void 0,q=Be?.find(me=>Bt(me,k))??(Be?void 0:t.find(me=>Bt(me,k)))??ni(t,D,void 0,r);T(D),N(q)},[r,t,p,k]);let Fe=P.useCallback((D,Be)=>{let q=Gp(D);if(!q){be.current+=1,G(""),H(""),ie(Be),V(null),fe(""),$("idle");return}Be==="from"?G(q):H(q),ie(Be),fe("")},[]),Ge=P.useCallback(()=>{be.current+=1,G(""),H(""),ie("from"),V(null),fe(""),F(""),$("idle"),ke(null),Pe(!1),Se(null),rt(!1),ze(null)},[ze]),et=P.useCallback(D=>{Bt(D,p)||(T(D),N(ni(t,D,void 0,r)),Ge())},[p,r,Ge,t]),it=P.useCallback(D=>{Bt(D,k)||Bt(D,p)||(N(D),Ge())},[p,Ge,k]),tt=P.useMemo(()=>p?r?.(p,t)??t.filter(D=>!Bt(D,p)):[],[p,r,t]),ut=P.useCallback(()=>{p?.balance&&Fe(p.balance,"from")},[p?.balance,Fe]),St=P.useCallback(()=>{!p||!k||(T(k),N(p),Ge())},[p,Ge,k]),je=P.useCallback(()=>{be.current+=1,G(""),H(""),ie("from"),V(null),fe(""),F("")},[]);P.useEffect(()=>{if(!p||!k)return;if(!S&&!O){V(null),fe(""),$(q=>q==="quoting"?"idle":q);return}let D=++be.current,Be=qs({fromToken:p,toToken:k,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:I});$(q=>q==="submitting"?q:u.canQuote?"quoting":"idle"),(async()=>{try{let q=await u.getQuote(Be);if(be.current!==D)return;q.fromAmount!==void 0&&B==="to"&&G(q.fromAmount),q.toAmount!==void 0&&B==="from"&&H(q.toAmount),V(q.summary??null),fe(q.error??"")}catch(q){if(be.current!==D)return;fe(q instanceof Error?q.message:"Failed to quote bridge.")}finally{be.current===D&&$(q=>q==="quoting"?"idle":q)}})()},[S,p,B,u,I,O,k]);let Ve=P.useCallback(()=>!p||!k?null:qs({fromToken:p,toToken:k,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:X}),[X,S,p,B,O,k]),qe=P.useCallback(async(D,Be)=>{F(""),rt(!1),Pe(!1),$("submitting");try{if(!Be?.skipApprovalCheck&&a){let me=await a(D);if(me){ke(me),Se(D),$("idle");return}}ke(null),Se(null),ze("processing");let q=await u.submitBridge(D);ue(q),$("success"),Q(me=>[{id:q.txHash,timestamp:new Date().toISOString(),txHash:q.txHash,fromToken:q.fromToken,toToken:q.toToken,fromAmount:q.fromAmount,toAmount:q.toAmount,summary:W??void 0,status:"pending"},...me.filter(po=>po.txHash!==q.txHash)]),je(),pt(!0),ze(null),rt(!0),h?.(q),m?.(q)}catch(q){if(ze(null),oi(q)){$("idle");return}let me=Ks(q,"Failed to submit bridge.");F(me),$("error"),y?.({message:me})}},[a,y,h,m,u,je,ze,W]),L=P.useCallback(async()=>{if(U)return;let D=Ve();if(D){if(!Ee){Se(D),Ie(!0);return}await qe(D)}},[Ve,U,qe,Ee]),ee=P.useCallback(async()=>{let D=De??Ve();D&&(Up(),Qt(!0),Ie(!1),await qe(D))},[Ve,De,qe]),we=P.useCallback(()=>{Ie(!1),Se(null)},[]),at=P.useCallback(async()=>{if(!(ce==="submitting"||!Ae||!De||!i)){F(""),$("submitting");try{await i(De,Ae),ke(null),$("idle"),Pe(!0)}catch(D){if(oi(D)){$("idle");return}let Be=Ks(D,"Failed to approve token.");F(Be),$("error"),y?.({message:Be})}}},[Ae,i,y,De,qe,ce]),mt=P.useCallback(()=>{ce!=="submitting"&&(ke(null),Pe(!1),Se(null),$("idle"))},[ce]),Rt=P.useCallback(async()=>{if(ce==="submitting")return;let D=De??Ve();if(!D){Pe(!1),F("Bridge input is no longer available. Please try again."),$("error");return}Pe(!1),await qe(D,{skipApprovalCheck:!0})},[Ve,De,qe,ce]),Tn=P.useCallback(()=>{rt(!1)},[]),Ct=P.useCallback(D=>{C(D),D==="history"&&pt(!1)},[]),co=P.useCallback(()=>{if(v==="history"){Ct("form");return}b?.()},[b,Ct,v]),fn=P.useMemo(()=>[...s,...Le.filter(D=>!s.some(Be=>Be.txHash===D.txHash))],[s,Le]);return{step:v,setStep:Ct,status:ce,error:Ne,quoteError:U,fromToken:p,toToken:k,tokens:t,availableToTokens:tt,fromAmount:S,toAmount:O,lastChangedBy:B,slippage:I,effectiveSlippage:X,slippageLocked:he,setSlippage:oe,summary:W,history:fn,submitted:J,canSubmit:u.canSubmit,termsOpen:de,approvalInfo:Ae,approvalSuccessOpen:dt,approveBridge:i,pendingSubmitInput:De,submitToast:_t,successDialogOpen:Mt,dismissSuccessDialog:Tn,hasNewHistory:kt,termsUrl:l,setFromToken:T,setToToken:N,selectFromToken:et,selectToToken:it,setAmount:Fe,setMax:ut,swapTokens:St,submit:L,confirmTerms:ee,cancelTerms:we,confirmApproval:at,cancelApproval:mt,continueAfterApproval:Rt,back:co}}K(`.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 ii,jsx as f,jsxs as R}from"react/jsx-runtime";var nl=A.createContext(void 0);function zn(){return A.useContext(nl)}function Vp(e){let[t,n]=A.useState(void 0);return A.useEffect(()=>{let o=e.current;if(!o)return;let r=()=>{let i=o.closest("[data-theme]");n(i?.getAttribute("data-theme")??void 0)};r();let a=new MutationObserver(r);return a.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[e]),t}var Zs=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],qp=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Kp(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function Xs(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 Qp(e){return`${e.chainId}:${e.address.toLowerCase()}`}function ol(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Js(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 Yp(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 Zp(e,t){if(!t)return!1;let n=new Vt(e||"0"),o=new Vt(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Xp(e){if(e.priceUsd===void 0)return null;let t=new Vt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Jp(e){if(e.priceUsd===void 0)return null;let t=new Vt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function rl(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,Vt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new Vt(o||"0").toFormat(0);return r?`${a}.${r}`:a}function ef(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function tf(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 nf(e){let t=new Vt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":rl(t)}function of(e,t){if(t?.priceUsd===void 0)return null;let n=new Vt(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function Xo(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function rf(e,t){return t==="all"?!0:Xo(e)===t}function af(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function el(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function il(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function al(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":il(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function sl(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function Zo(e){return!e||e==="0"||Number(e)===0}function sf(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 lf(e){let t=e.fromToken,n=e.toToken,o=al(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!sl(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${el(t.chainId)} \u2192 ${el(n.chainId)}`:"-"},{label:"Validator Fee",value:Zo(r)?"0":"Free",tone:Zo(r)?"default":"accent"},{label:"Network Fee",value:Zo(r)?"0":"Free",tone:Zo(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:a,valueToken:n?{symbol:n.symbol,iconUrl:n.iconUrl}:void 0}]:void 0,txFee:[{label:"Priority Fee Per Gas",value:"0 Gwei"},{label:"Max Fee Per Gas",value:"0 Gwei"},{label:"Gas Limit",value:"0"}],txFeeInfo:{estTxFee:"0",isDelegateFee:!1}}}function no({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 tl({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a,locked:i=!1}){return R("section",{className:"bf-amount-panel",children:[R("div",{className:"bf-amount-head",children:[f("span",{children:e}),R("span",{className:"bf-balance",children:[ol(t?.balance??"0")," ",t?.symbol??""]})]}),R("div",{className:"bf-amount-main",children:[R("label",{className:"bf-amount-input-wrap",children:[R("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})]}),R("button",{type:"button",className:"bf-token-pill",onClick:i?void 0:a,disabled:!i&&!a,"data-locked":i?"true":void 0,"aria-label":`Select ${e.toLowerCase()} token`,children:[f(no,{token:t}),f("span",{children:t?.symbol??"Select"}),!i&&f(wn,{size:16})]})]})]})}function cf({flow:e,side:t,onClose:n}){let o=A.useId(),[r,a]=A.useState(""),[i,s]=A.useState(null),c=zn(),l=t==="from"?e.fromToken:e.toToken;A.useEffect(()=>{s(document.body)},[]),A.useEffect(()=>{let m=y=>{y.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]);let d=A.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),w=A.useMemo(()=>{let m=r.trim().toLowerCase();return m?d.filter(y=>y.symbol.toLowerCase().includes(m)||y.name.toLowerCase().includes(m)):d},[r,d]),h=A.useCallback(m=>{t==="from"?e.selectFromToken(m):e.selectToToken(m),n()},[e,n,t]);return i?Dn(f("div",{className:"bf-token-picker-overlay","data-theme":c,role:"presentation",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:R("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[f("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),R("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(Wt,{size:24})})]}),R("label",{className:"bf-token-search",children:[f(_s,{size:20}),f("span",{className:"bf-sr-only",children:"Search tokens"}),f("input",{value:r,onChange:m=>a(m.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),R("div",{className:"bf-token-list",children:[w.map(m=>{let y=il(m,l),b=y?Jp(m):Xp(m);return R("button",{type:"button",className:"bf-token-row","data-selected":y?"true":"false",onClick:()=>h(m),children:[R("span",{className:"bf-token-row-left",children:[f(no,{token:m,size:40}),R("span",{className:"bf-token-meta",children:[f("span",{className:"bf-token-symbol",children:m.symbol}),!y&&f("span",{className:"bf-token-name",children:m.name})]})]}),R("span",{className:"bf-token-row-right",children:[R("span",{className:"bf-token-balance",children:[ol(m.balance),y?null:` ${m.symbol}`]}),b&&f("span",{className:"bf-token-price",children:b})]})]},Qp(m))}),w.length===0&&f("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i):null}function df({flow:e,onClose:t}){let n=A.useId(),[o,r]=A.useState(null),a=Zs.find(b=>b.value===e.slippage),[i,s]=A.useState(e.slippage&&!a?e.slippage:""),c=i.trim()!==""&&i.trim()!==".",l=c?Number(i):NaN,d=Number.isFinite(l)&&l>50,w=Number.isFinite(l)&&l>5&&!d,h=b=>{e.setSlippage(b),t()},m=()=>{!c||d||(e.setSlippage(Xs(i)),t())};if(A.useEffect(()=>{r(document.body)},[]),A.useEffect(()=>{let b=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t]),!o)return null;let y=zn();return Dn(f("div",{className:"bf-slippage-overlay","data-theme":y,role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:R("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[R("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(Wt,{size:24})})]}),R("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."}),R("div",{className:"bf-slippage-controls",children:[f("div",{className:"bf-slippage-presets",children:Zs.map(b=>f("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===b.value?"true":"false",onClick:()=>h(b.value),children:b.label},b.value))}),R("label",{className:"bf-slippage-custom","data-selected":c?"true":"false",children:[f("span",{className:"bf-sr-only",children:"Custom slippage percent"}),f("input",{value:i,onChange:b=>{s(Xs(b.target.value))},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),m())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),f("span",{"aria-hidden":"true",children:"%"})]})]}),d?f("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):w?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:m,disabled:d,children:"Apply"})]})]})}),o)}function pf({flow:e}){let t=A.useId(),[n,o]=A.useState(!1),[r,a]=A.useState(null),i=zn();return A.useEffect(()=>{a(document.body)},[]),A.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:Dn(f("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:R("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."}),R("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",onClick:()=>o(s=>!s),children:f("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"})}),R("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,children:"Confirm"})]})}),r)}function ff({value:e,disabled:t=!1}){let[n,o]=A.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 uf({flow:e,approval:t}){let n=A.useId(),[o,r]=A.useState(null),a=zn();if(A.useEffect(()=>{r(document.body)},[]),A.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 i=e.status==="submitting"||!e.approveBridge,s=e.status==="submitting";return Dn(f("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:R("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[R("h3",{id:n,children:["Approve ",t.token.symbol]}),f(no,{token:t.token,size:72}),R("div",{className:"bf-approve-address-box",children:[f("span",{children:"Token Address"}),R("div",{children:[f("strong",{children:t.tokenAddress}),f(ff,{value:t.tokenAddress,disabled:s})]})]}),R("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),R("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":s,children:[s&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function mf({flow:e}){let t=A.useId(),[n,o]=A.useState(null),r=zn();if(A.useEffect(()=>{o(document.body)},[]),A.useEffect(()=>{if(!e.approvalSuccessOpen)return;let i=s=>{s.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.approvalSuccessOpen)return null;let a=e.status==="submitting";return Dn(f("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:R("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"}),R("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",f("br",{}),"Please continue to the next step."]}),R("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:a,children:"Cancel"}),R("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,disabled:a,"aria-busy":a,children:[a&&f("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),f("span",{children:a?"Continuing...":"Continue"})]})]})]})}),n)}function gf({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=A.useState(!1),i=A.useMemo(()=>{let l=new Vt(e||"0"),d=new Vt(t||"0");return!l.isFinite()||!d.isFinite()||l.lte(0)||d.lte(0)?null:r?l.dividedBy(d):d.dividedBy(l)},[e,r,t]);if(!i||!n||!o||n.symbol===o.symbol)return null;let s=r?o.symbol:n.symbol,c=r?n.symbol:o.symbol;return R("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(l=>!l),children:[R("span",{children:["1 ",s]}),f(zs,{size:12}),R("span",{children:[rl(i)," ",c]})]})}function hf({flow:e}){return e.submitToast?R("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"})}),R("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 bf({message:e}){let[t,n]=A.useState(!1);return A.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:R("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:"!"})}),R("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Error"}),f("span",{children:e})]})]})}function wf(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 xf({flow:e}){let t=A.useId(),[n,o]=A.useState(null),r=e.submitted,a=zn();return A.useEffect(()=>{o(document.body)},[]),A.useEffect(()=>{if(!e.successDialogOpen)return;let i=s=>{s.key==="Escape"&&e.dismissSuccessDialog()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),!n||!e.successDialogOpen||!r?null:Dn(f("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:f("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:R("div",{className:"bf-success-body",children:[f("span",{className:"bf-success-mark","aria-hidden":"true"}),R("div",{className:"bf-success-copy",children:[f("strong",{id:t,children:wf(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((i,s)=>R(A.Fragment,{children:[s>0&&f("span",{className:"bf-success-route-arrow",children:"\u2192"}),f(ri,{token:i,size:43})]},`${i.symbol}-${s}`))}),f("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function ri({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 vf({row:e}){return e.routeTokens&&e.routeTokens.length>0?f("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>R(A.Fragment,{children:[n>0&&f("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),f(ri,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?R("span",{className:"bf-info-value-token",children:[f(ri,{token:e.valueToken}),f("span",{children:e.value})]}):f(ii,{children:e.value})}function ll({rows:e}){return!e||e.length===0?null:f("div",{className:"bf-info-rows",children:e.map((t,n)=>R("div",{className:"bf-info-row",children:[R("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(vf,{row:t})})]},`${t.label}-${t.value}`))})}function yf(e,t,n){return e.pathType==="bridge"?"Bridge Info":sl(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function kf({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(ii,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?R("div",{className:"bf-info-section",children:[o&&f("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),f(ll,{rows:i})]},a):null})})}function Sf({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=yf(e,t,n),[a,i]=A.useState(!0),[s,c]=A.useState(!0);return R("div",{className:"bf-details",children:[e.liquidity&&R("section",{className:"bf-liquidity",children:[R("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)&&R("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[R("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(l=>!l),children:[f("h3",{children:r}),f(wn,{size:16,className:"bf-collapse-chevron"})]}),a&&f("div",{className:"bf-collapse-body",children:f(kf,{summary:e})})]}),o&&R("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[R("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>c(l=>!l),children:[f("h3",{children:"Est. Tx Fee"}),R("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:Yp(e.txFeeInfo?.estTxFee??"0")}),f(wn,{size:16,className:"bf-collapse-chevron"})]})]}),s&&f("div",{className:"bf-collapse-body",children:f(ll,{rows:e.txFee})})]})]})}function Rf({item:e}){let t=Xo(e),n=of(e.fromAmount,e.fromToken);return R("article",{className:"bf-history-item",children:[R("div",{className:"bf-history-item-head",children:[f("span",{className:"bf-history-status","data-status":t,children:af(t)}),f("time",{className:"bf-history-time",dateTime:e.timestamp,children:tf(e.timestamp)})]}),R("div",{className:"bf-history-item-body",children:[R("strong",{className:"bf-history-amount",children:[nf(e.fromAmount)," ",e.fromToken.symbol]}),R("div",{className:"bf-history-meta",children:[f("span",{className:"bf-history-usd",children:n??ef(e.txHash)}),R("span",{className:"bf-history-route",children:[R("span",{className:"bf-history-route-token",children:[f(no,{token:e.fromToken,size:16}),f("span",{children:e.fromToken.symbol})]}),f(Ds,{size:16,className:"bf-history-route-arrow"}),R("span",{className:"bf-history-route-token",children:[f(no,{token:e.toToken,size:16}),f("span",{children:e.toToken.symbol})]})]})]})]})]})}function Cf({flow:e}){let[t,n]=A.useState("all"),o=e.history.some(i=>Xo(i)==="pending"),r=e.history.filter(i=>rf(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return R("main",{className:"bf-history-body",children:[f("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:qp.map(i=>R("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[f("span",{children:i.label}),i.value==="pending"&&o&&f("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?f("div",{className:"bf-history-list",children:r.map(i=>f(Rf,{item:i},i.id||i.txHash))}):f("div",{className:"bf-empty",children:a})]})}function Tf({flow:e,env:t}){let[n,o]=A.useState(null),[r,a]=A.useState(!1),[i,s]=A.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??lf(e):null,d=yn("apps.json",t,p=>vn(p?.bridgePoweredBy?.url,t)),w=sf(e.quoteError),h=Zp(e.fromAmount,e.fromToken),m=h?"Insufficient balance":w.from,y=e.quoteError&&!w.from&&!w.to?e.quoteError:"",b=e.error||y,u=e.history.some(p=>Xo(p)==="pending"),C=(l?.pathType??al(e.fromToken,e.toToken))!=="bridge";return R(ii,{children:[R("main",{className:"bf-body",children:[R("div",{className:"bf-toolbar",children:[R("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[f(Ms,{}),f("span",{children:"History"}),(u||e.hasNewHistory)&&f("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),C&&R("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[f(Os,{}),f("span",{children:e.slippageLocked?"Auto 1%":Kp(e.slippage,e.effectiveSlippage)})]})]}),R("div",{className:"bf-swap-card","data-has-from-error":m?"true":"false",children:[f(tl,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Js(e.fromAmount,e.fromToken),onAmountChange:p=>e.setAmount(p,"from"),onTokenClick:()=>o("from")}),m&&f("div",{className:"bf-field-error",children:m}),f("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(p=>p+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:f(Ws,{size:22})}),f(tl,{label:"To",token:e.toToken,amount:e.toAmount,usd:Js(e.toAmount,e.toToken),onAmountChange:p=>e.setAmount(p,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),w.to&&f("div",{className:"bf-field-error",children:w.to})]}),f(gf,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&f(Sf,{summary:l})]}),R("footer",{className:"bf-footer",children:[f("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError||h,children:e.status==="submitting"?"Processing...":"Next"}),d&&R("a",{className:"bf-powered",href:d,target:"_blank",rel:"noreferrer",children:["Powered by ",f("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&f(cf,{flow:e,side:n,onClose:()=>o(null)}),r&&f(df,{flow:e,onClose:()=>a(!1)}),f(pf,{flow:e}),e.approvalInfo&&f(uf,{flow:e,approval:e.approvalInfo}),f(mf,{flow:e}),f(hf,{flow:e}),f(bf,{message:e.submitToast?"":b}),f(xf,{flow:e})]})}function Jo({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=A.useMemo(()=>_e(n),[n]),i=Ys({...r,onExit:t}),s=A.useRef(null),c=Vp(s),l=i.step==="history"?"History":"Swap & Bridge";return f(nl.Provider,{value:c,children:R("div",{ref:s,className:se("bf-root",o),"data-view":i.step,"data-status":i.status,children:[R("header",{className:"bf-header",children:[f("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:f(bn,{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(Wt,{size:24})})]}),i.step==="history"?f(Cf,{flow:i}):f(Tf,{flow:i,env:a})]})})}import{Fragment as tr,jsx as g,jsxs as E}from"react/jsx-runtime";var If="On-ramp is not available in your region.";function ai(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 Ef(e){return parseInt(e.split(":")[1],10)}function Lf(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 Af(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Pf(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 cl({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:a,isMobile:i,open:s,drawerDirection:c,modal:l,showBalance:d,showForgeToken:w,showGameToken:h,showQR:m,showBridge:y,qrLogoSrc:b,walletAddress:u,accountName:v,sendAccounts:C,profileImageUrl:p,preferredTokens:T,close:k,onSelectWallet:N,onCopyAddress:S,onBuy:G,onDisconnect:O,disconnectLabel:H,termsUrl:B,termsLabel:ie,privacyUrl:I,privacyLabel:oe,portalStyle:W,navContent:V,navPosition:he,footerContent:X,view:U,setView:fe,selectedSendToken:ce,setSelectedSendToken:$,showPortfolio:Ne,portfolioTitle:F,portfolioSections:J,showTotalAssets:ue,totalAssetsLabel:Le,sendTransaction:Q,getTransactionReceipt:de,estimateGas:Ie,onOutlink:Ee,lpBalanceReader:Qt,stakingRewardsReader:Ae,bridgeTokens:ke,bridgeHistory:dt,getBridgeQuote:Pe,getBridgeToTokens:De,getBridgeApproval:Se,approveBridge:_t,submitBridge:yt,onReceive:Mt,onSend:rt,onBuyDisabledMessage:kt,onBridgeDisabledMessage:pt,onSendDisabledMessage:be}=tn(),[Ot,ft]=z.useState(null),ze=z.useRef(void 0),Fe=z.useCallback(x=>{ft(x),clearTimeout(ze.current),ze.current=setTimeout(()=>ft(null),4e3)},[]);z.useEffect(()=>()=>clearTimeout(ze.current),[]);let Ge=!!kt,et=z.useCallback(()=>{if(Ge){Fe(kt);return}let x=G?.();x&&typeof x.then=="function"&&x.catch(()=>{Fe(kt??If)})},[Ge,kt,G,Fe]),it=!!pt,tt=!!be,{tokens:ut,isLoading:St}=an(r,u,s&&d),{statsMap:je}=sn(r,d),{apyPercent:Ve}=Ma(),{categoryMap:qe}=Oa(r,d),L=d&&ue,{displayValue:ee,isLowerBound:we,isLoading:at}=Wa(r,u,s&&L),[mt,Rt]=z.useState(!1),Tn=z.useRef(null),[Ct,co]=z.useState(0),{holdings:fn,isLoading:D}=Ba(r,u,s&&d&&w),Be=z.useMemo(()=>fn.map(x=>x.token),[fn]),{imageMap:q}=_a(r,Be,w&&fn.length>0),me=z.useMemo(()=>{let x=[],_=[],te=[],Qe=new Map((T??[]).map((ae,He)=>[`${Ef(ae.chainId)}:${ae.address.toLowerCase()}`,He]));for(let ae of ut){let He=ai(r,ae.chainId,ae.symbol)!==void 0,Nt=`${ae.chainId}:${ae.address.toLowerCase()}`,mn=Qe.get(Nt),xr=new oo(ae.quantity.numeric).shiftedBy(-ae.quantity.decimals);if(He)x.push(ae);else if(mn!==void 0)_.push(ae);else if(xr.isGreaterThan(0)){if(!h&&qe.get(Gr(ae.chainId,ae.address))==="game")continue;te.push(ae)}}return x.sort((ae,He)=>{let Nt=ai(r,ae.chainId,ae.symbol)??99,mn=ai(r,He.chainId,He.symbol)??99;return Nt-mn}),_.sort((ae,He)=>{let Nt=Qe.get(`${ae.chainId}:${ae.address.toLowerCase()}`)??99,mn=Qe.get(`${He.chainId}:${He.address.toLowerCase()}`)??99;return Nt-mn}),te.sort((ae,He)=>{let Nt=je.get(Lt(ae.chainId,ae.address)),mn=je.get(Lt(He.chainId,He.address)),xr=new oo(ae.quantity.numeric).shiftedBy(-ae.quantity.decimals).multipliedBy(Nt?.price??0);return new oo(He.quantity.numeric).shiftedBy(-He.quantity.decimals).multipliedBy(mn?.price??0).minus(xr).toNumber()}),[...x,..._,...te]},[ut,r,je,h,qe,T]),po=z.useMemo(()=>{if(!w)return[];let x=new Set(ut.map(_=>_.address.toLowerCase()));return[...fn].filter(_=>!x.has(_.token.toLowerCase())).sort((_,te)=>{let Qe=new oo(_.value);return new oo(te.value).minus(Qe).toNumber()})},[fn,w,ut]),un=z.useRef(!1),[Ke,Hn]=z.useState(null),Nn=z.useRef(void 0),pi=Ke?.chainId??ce?.chainId??me[0]?.chainId??0,{transactionUrl:fr}=Ro(r,pi,Ke?.txHash,!!(Ke?.txHash&&pi)),Tt=z.useCallback(x=>{un.current=!0,fe(x)},[fe]),[Wl,ur]=z.useState("recipient"),fo=z.useCallback(()=>{$(null),ur("recipient"),Tt("wallet")},[$,Tt]),mr=z.useCallback((x,_="recipient")=>{if(tt){Fe(be);return}ur(_),$(x),Tt("send")},[tt,be,Fe,$,Tt]),uo=yn("apps.json",r,x=>vn(x?.gametokenBridge,r)),fi=yn("apps.json",r,x=>x?.gametokenSites),Dl=z.useCallback(()=>{if(it){Fe(pt);return}if(uo){if(Lf(fi)){window.location.assign(uo);return}window.open(uo,"_blank","noopener,noreferrer")}},[it,pt,uo,fi,Fe]),zl=z.useCallback(x=>{clearTimeout(Nn.current),$(null),Tt("wallet"),Hn({status:"pending",txHash:x.txHash,chainId:x.chainId,description:`${x.amount} ${x.tokenSymbol} to ${lt(x.recipient)}`})},[$,Tt]),Gl=z.useCallback(x=>{let _=ce?.chainId;$(null),Tt("wallet"),!(!x||!_)&&(Hn(te=>({status:"success",txHash:x,chainId:_,description:te?.txHash===x?te.description:"Tap to see your transaction"})),clearTimeout(Nn.current),Nn.current=setTimeout(()=>Hn(null),5e3))},[ce?.chainId,$,Tt]),Hl=z.useCallback(x=>{let _=x.txHash;_&&(Hn({status:"error",txHash:_,chainId:x.chainId,description:x.message}),clearTimeout(Nn.current),Nn.current=setTimeout(()=>Hn(null),5e3))},[]),Un=z.useMemo(()=>{if(Mt)return Mt;if(m)return()=>Tt("qr")},[Mt,m,Tt]),gr=z.useMemo(()=>{if(rt)return rt;if(me.length===0)return;let x=me[0];return()=>mr(x,"token")},[rt,me,mr]),Ul=z.useCallback(()=>{if(tt){Fe(be);return}gr?.()},[tt,be,gr,Fe]);z.useEffect(()=>{s||(un.current=!1,ur("recipient"))},[s]);let ui=z.useRef(null);z.useEffect(()=>{let x=ui.current;if(!x||!i)return;let _=te=>{te.pointerType==="touch"&&te.stopPropagation()};return x.addEventListener("pointerdown",_),()=>x.removeEventListener("pointerdown",_)},[i]);let[In,mi]=z.useState(!1),hr=z.useRef(void 0),[$n,jn]=z.useState(!1);z.useEffect(()=>{if(!$n)return;let x=()=>jn(!1),_=Qe=>{Qe.key==="Escape"&&jn(!1)},te=setTimeout(()=>{document.addEventListener("mousedown",x,!0),document.addEventListener("keydown",_,!0)},0);return()=>{clearTimeout(te),document.removeEventListener("mousedown",x,!0),document.removeEventListener("keydown",_,!0)}},[$n]),z.useEffect(()=>{jn(!1)},[u]),z.useEffect(()=>()=>clearTimeout(hr.current),[]),z.useEffect(()=>()=>clearTimeout(Nn.current),[]),z.useEffect(()=>{let x=Tn.current;if(!x||X===null){co(0);return}let _=()=>{co(x.offsetHeight)};if(_(),typeof ResizeObserver>"u")return;let te=new ResizeObserver(_);return te.observe(x),()=>te.disconnect()},[X]);let gi=z.useCallback(async()=>{if(!In)try{await navigator.clipboard.writeText(u),mi(!0),clearTimeout(hr.current),hr.current=setTimeout(()=>mi(!1),2e3),S?.(u,!0)}catch{S?.(u,!1)}},[u,S,In]),mo=z.useCallback(x=>{x.currentTarget.setAttribute("data-loaded","true")},[]),hi=z.useMemo(()=>({background:Pf(u)}),[u]),go=z.useMemo(()=>p||Zt(r,u,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[p,r,u,a]),br=z.useMemo(()=>Af(ee),[ee]),bi=B||I?E("div",{className:"wi-legal-links",children:[B&&g("a",{className:"wi-legal-link",href:B,target:"_blank",rel:"noopener noreferrer",onClick:x=>Xe(x,B,{category:"terms",origin:"terms"},Ee),children:ie}),B&&I&&g("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),I&&g("a",{className:"wi-legal-link",href:I,target:"_blank",rel:"noopener noreferrer",onClick:x=>Xe(x,I,{category:"privacy",origin:"privacy"},Ee),children:oe})]}):null,wi=O?E("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{O(),k()},children:[g(Hi,{size:16}),g("span",{className:"wi-disconnect-label",children:H})]}):null,$l=d&&!V?E("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[E("button",{type:"button",className:se("wi-action-card",Ge&&"wi-action-card--dimmed"),onClick:et,disabled:!G&&!Ge,"aria-disabled":Ge||void 0,"aria-label":"Buy",children:[g(Ki,{size:20}),g("span",{children:"Buy"})]}),y?E("button",{type:"button",className:se("wi-action-card",it&&"wi-action-card--dimmed"),onClick:Dl,"aria-disabled":it||void 0,"aria-label":"Bridge",children:[g(Qi,{size:20}),g("span",{children:"Bridge"})]}):E("button",{type:"button",className:"wi-action-card",onClick:Un,disabled:!Un,"aria-label":"Receive",children:[g(ko,{size:20}),g("span",{children:"Receive"})]}),E("button",{type:"button",className:se("wi-action-card",tt&&"wi-action-card--dimmed"),onClick:Ul,disabled:!tt&&!gr,"aria-disabled":tt||void 0,"aria-label":"Send",children:[g(Vi,{size:20}),g("span",{children:"Send"})]}),Ne?E("button",{type:"button",className:"wi-action-card",onClick:()=>Tt("portfolio"),"aria-label":"View portfolio",children:[g(qi,{size:20}),g("span",{children:"Portfolio"})]}):y?E("button",{type:"button",className:"wi-action-card",onClick:Un,disabled:!Un,"aria-label":"Receive",children:[g(ko,{size:20}),g("span",{children:"Receive"})]}):null]}):null,jl=E("div",{className:se("wi-view-inner",un.current&&"wi-view-wallet"),children:[L&&E("div",{className:"wi-total-section",children:[E("div",{className:"wi-total-head",children:[g("span",{className:"wi-total-label",children:Le}),g("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:x=>{x.stopPropagation(),Rt(_=>!_)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),Rt(_=>!_))},"aria-label":mt?"Show balance":"Hide balance",children:mt?g($i,{}):g(Ui,{})})]}),g("div",{className:"wi-total-body",children:at?g("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):g("div",{className:"wi-total-value","data-hidden":mt||void 0,children:mt?g("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):E(tr,{children:[we&&g("span",{className:"wi-total-lte",children:"\u2264"}),g("span",{className:"wi-total-currency",children:"$"}),g("span",{className:"wi-total-amount",children:br.main}),br.decimal&&g("span",{className:"wi-total-decimal",children:br.decimal})]})})})]}),he==="top"&&(V?g("div",{className:"wi-nav-fixed",children:V}):$l),d&&g("div",{ref:ui,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:E("div",{className:"wi-token-list",children:[St&&Array.from({length:5},(x,_)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),E("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},_)),!St&&me.length===0&&!w&&g("div",{className:"wi-empty",children:"No Tokens Found"}),me.map(x=>{let _=je.get(Lt(x.chainId,x.address)),te=_?parseFloat(_.percent_change_24h):null,Qe=te!==null&&te>=0,ae=Zn(r,x.chainId),He=ha(x.address);return E("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>mr(x),"aria-label":`Send ${x.symbol}`,children:[E("div",{className:"wi-token-left",children:[E("div",{className:"wi-token-icon-wrap",children:[g("img",{src:x.icon_url,alt:x.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:mo,onError:Nt=>{Nt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ae&&g("img",{src:ae,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Nt=>{Nt.currentTarget.style.display="none"}})]}),E("div",{className:"wi-token-info",children:[E("span",{className:"wi-token-name-row",children:[g("span",{className:"wi-token-name",children:x.symbol}),He&&Ve!==null&&g("span",{className:"wi-token-apy",children:`APR ${Ve>=0?"+":"-"}${(Ve>=0?Math.floor:Math.ceil)(Math.abs(Ve)*100)/100}%`})]}),_&&E("div",{className:"wi-token-price-row",children:[g("span",{className:"wi-token-price",children:Nr(_.price)}),g("span",{className:"wi-token-change","data-positive":Qe,"data-zero":te===0||void 0,children:te!==null&&(te===0?"0%":`${Qe?"+":"-"}${(Qe?Math.floor:Math.ceil)(Math.abs(te)*100)/100}%`)})]})]})]}),E("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:nn(x.quantity.numeric,x.quantity.decimals)}),_&&g("span",{className:"wi-token-value",children:Zi(x.quantity.numeric,x.quantity.decimals,_.price)})]})]},`${x.address}-${x.chainId}`)}),w&&D&&Array.from({length:3},(x,_)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),E("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${_}`)),w&&!D&&!St&&me.length===0&&po.length===0&&g("div",{className:"wi-empty",children:"No Tokens Found"}),w&&po.map(x=>{let _=q.get(x.token)||"",te=Zn(r,ye[r].cross);return E("div",{className:"wi-token-item",children:[E("div",{className:"wi-token-left",children:[E("div",{className:"wi-token-icon-wrap",children:[g("img",{src:_||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:x.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:mo,onError:Qe=>{Qe.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),te&&g("img",{src:te,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Qe=>{Qe.currentTarget.style.display="none"}})]}),E("div",{className:"wi-token-info",children:[g("span",{className:"wi-token-name",children:x.token_name}),g("div",{className:"wi-token-price-row",children:E("span",{className:"wi-token-price",children:[nn(x.current_price,18)," CROSS"]})})]})]}),E("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:nn(x.balance,18)}),g("span",{className:"wi-token-value",children:Nr(x.current_value_usd)})]})]},`forge-${x.token}`)})]})}),he==="bottom"&&V&&g("div",{className:"wi-nav-fixed",children:V}),wi&&g("div",{className:"wi-wallet-disconnect-row",children:wi})]},"wallet"),Vl=Ne?g("div",{className:se("wi-view-inner wi-portfolio-body",un.current&&"wi-view-portfolio"),children:g(Wn,{env:r,theme:a,walletAddress:u,showHeader:!1,onOutlink:Ee,lpBalanceReader:Qt,stakingRewardsReader:Ae,sendTransaction:Q,estimateGas:Ie,sections:J})},"portfolio"):null,ql=ce?g("div",{className:se("wi-view-inner wi-send-body",un.current&&"wi-view-send"),children:g(Mo,{env:r,theme:a,walletAddress:u,accountName:v,accounts:C,initialStep:Wl,token:ce,tokens:me,onTokenChange:$,sendTransaction:Q,getTransactionReceipt:de,estimateGas:Ie,getTokenPriceUsd:x=>{let _=je.get(Lt(x.chainId,x.address));if(!_?.price)return;let te=parseFloat(_.price);return Number.isFinite(te)?te:void 0},onClose:k,onBackToWallet:fo,onSubmitted:zl,onSuccess:Gl,onFailed:Hl,onOutlink:Ee})},"send"):null,Kl=z.useMemo(()=>ke||me.map(x=>{let _=je.get(Lt(x.chainId,x.address)),te=_?.price?parseFloat(_.price):void 0;return{name:x.name,symbol:x.symbol,chainId:x.chainId,address:x.address,decimals:x.quantity.decimals,balance:Qn(x.quantity.numeric,x.quantity.decimals),iconUrl:x.icon_url,priceUsd:Number.isFinite(te)?te:void 0}}),[ke,je,me]),Ql=g("div",{className:se("wi-view-inner wi-bridge-body",un.current&&"wi-view-send"),children:g(Jo,{env:r,walletAddress:u,tokens:Kl,history:dt,termsUrl:B,getQuote:Pe,getToTokens:De,getApproval:Se,approveBridge:_t,submitBridge:yt,onClose:k,onBackToWallet:fo})},"bridge"),wr=!!N&&v?.trim().toLowerCase()!=="my wallet",xi=E(tr,{children:[E("span",{className:"wi-receive-avatar",children:[g("span",{className:"wi-avatar-fallback",style:hi}),go&&g("img",{src:go,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:mo,onError:x=>{x.currentTarget.style.display="none"}})]}),g("span",{className:"wi-receive-account-name",children:v??"Account 1"}),wr&&g("span",{className:"wi-receive-chevron","data-open":$n,"aria-hidden":"true",children:g(wn,{size:16})})]}),Yl=E("div",{className:se("wi-view-inner wi-qr-body",un.current&&"wi-view-qr"),children:[E("div",{className:"wi-receive-section",children:[wr?g("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{jn(!0),N?.()},"aria-label":"Switch account",children:xi}):g("div",{className:"wi-receive-account",children:xi}),E("div",{className:"wi-qr-block",children:[E("div",{className:"wi-qr-box",children:[g(Nf,{value:u,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&g("div",{className:"wi-qr-logo",children:g(ji,{size:33})})]}),g("p",{className:"wi-qr-address",children:u})]}),E("button",{type:"button",className:"wi-qr-copy-btn",onClick:gi,children:[g("span",{className:"wi-qr-copy-icon",children:In?g(hn,{size:16}):g(Vn,{size:16})}),g("span",{className:"wi-qr-copy-text",children:In?"Copied!":"Copy address"})]})]}),bi&&g("div",{className:"wi-receive-footer",children:bi})]},"qr"),Zl=U==="qr"||U==="portfolio"||U==="send"||U==="bridge",vi=X!==null?g("div",{className:"wi-builtin-footer",children:X}):null,yi=E("div",{className:"wi-account-text",children:[wr?E("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{jn(!0),N?.()},"aria-label":"Switch account","aria-expanded":$n,children:[g("span",{className:"wi-account-name",children:v??"Account 1"}),g("span",{className:"wi-account-switch","data-open":$n,"aria-hidden":"true",children:g(wn,{size:20})})]}):g("div",{className:"wi-account-row",children:g("span",{className:"wi-account-name",children:v??"Account 1"})}),E("button",{type:"button",className:"wi-address-row-btn",onClick:gi,"aria-label":"Copy address",children:[g("span",{className:"wi-account-address",children:lt(u)}),g("span",{className:"wi-account-copy","data-copied":In,children:In?g(hn,{size:12}):g(Vn,{size:12})})]})]}),ki=E(tr,{children:[o,U==="qr"?g("div",{className:"wi-sticky-header",children:E("div",{className:"wi-header wi-header--receive",children:[g("button",{type:"button",className:"wi-header-back",onClick:fo,"aria-label":"Back",children:g(bn,{size:24})}),g("span",{className:"wi-receive-title",children:"Receive"}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Wt,{size:24})})]})}):U==="send"||U==="bridge"?null:Zl?E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[g("button",{type:"button",className:"wi-header-back",onClick:fo,"aria-label":"Back",children:g(bn,{size:24})}),g("div",{className:"wi-account-block wi-account-block--sub-account",children:yi}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Wt,{size:24})})]}),g("hr",{className:"wi-divider"})]}):E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet",children:[E("div",{className:"wi-account-block",children:[E("div",{className:"wi-avatar",children:[g("div",{className:"wi-avatar-fallback",style:hi}),go&&g("img",{src:go,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:mo,onError:x=>{x.currentTarget.style.display="none"}})]}),yi]}),E("div",{className:"wi-header-actions",children:[m&&y&&g("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:Un,"aria-label":"Show QR code",children:g(ko,{size:20})}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Wt,{size:24})})]})]}),g("hr",{className:"wi-divider"})]}),E("div",{className:"wi-view-container",children:[U==="wallet"&&jl,U==="qr"&&Yl,U==="portfolio"&&Vl,U==="send"&&ql,U==="bridge"&&Ql]}),U==="wallet"&&Ot&&g("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Ot}),U==="wallet"&&Ke&&E("a",{className:"wi-send-toast",href:fr??"#",target:"_blank",rel:"noopener noreferrer",onClick:x=>{if(!fr){x.preventDefault();return}Xe(x,fr,{category:"send",origin:"send-transaction",payload:{chainId:Ke.chainId,txHash:Ke.txHash}},Ee)},children:[g("span",{className:"wi-send-toast-icon","data-status":Ke.status,"aria-hidden":!0,children:Ke.status==="pending"?g("span",{className:"wi-send-toast-spinner"}):Ke.status==="error"?g("span",{className:"wi-send-toast-error-dot"}):g(Yi,{size:20})}),E("span",{className:"wi-send-toast-copy",children:[g("span",{className:"wi-send-toast-title",children:Ke.status==="pending"?"Sending...":Ke.status==="error"?"Send failed":"Send complete"}),g("span",{className:"wi-send-toast-desc",children:Ke.status==="pending"||Ke.status==="error"?Ke.description:"Tap to see your transaction"})]})]}),vi&&U!=="portfolio"&&U!=="send"&&g("div",{className:"wi-sticky-footer",children:g("div",{className:"wi-footer",ref:Tn,children:vi})})]}),Si={...W,...Ct>0?{"--wi-footer-height":`${Ct}px`}:null};return i?E(er.Portal,{children:[l&&g(er.Overlay,{className:"wi-drawer-overlay"}),E(er.Content,{className:se("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:Si,"data-direction":c,"data-no-balance":!d||void 0,"data-has-footer":Ct>0||void 0,"data-view":U,children:[g(er.Title,{className:"wi-sr-only",children:"My Wallet"}),ki]})]}):E(tr,{children:[l&&s&&g("div",{className:"wi-drawer-overlay",onClick:k}),g(nr.Portal,{children:g(nr.Content,{align:e,sideOffset:t,className:se("wi-popover-content",n),"data-theme":a,style:Si,"data-no-balance":!d||void 0,"data-has-footer":Ct>0||void 0,"data-view":U,children:ki})})]})}import*as dl from"react";function pl({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=tn();return dl.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as fl from"react";function ul({children:e}){let{setFooterContent:t}=tn();return fl.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}K(`[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
- `);K(`.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
- `);K(`@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
- `);K(`.wi-popover-content{-webkit-font-smoothing:antialiased;z-index:100001;width:393px;border-radius:24px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--wi-surface-bg);box-shadow:var(--ds-shadow-modal, var(--wi-shadow));animation:wi-fade-in .15s ease-out;height:600px;overflow:hidden;display:flex;flex-direction:column}.wi-popover-content[data-no-balance]{height:auto}.wi-popover-content[data-has-footer]:not([data-no-balance]){height:min(calc(600px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{-webkit-font-smoothing:antialiased;position:fixed;top:0;right:0;bottom:0;z-index:100001;width:100vw;max-height:100vh;background:var(--wi-surface-bg);overflow:hidden;display:flex;flex-direction:column;box-sizing:border-box}.wi-drawer-content[data-no-balance]{bottom:auto;max-height:none}.wi-drawer-content[data-no-balance][data-direction=bottom]{bottom:0;top:auto;border-radius:24px 24px 0 0}.wi-drawer-content[data-direction=left]{right:auto;left:0}.wi-drawer-content[data-direction=bottom]{top:0;left:0;right:0;width:100%;max-height:100dvh;margin:0 auto}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:100dvh}.wi-popover-content[data-view=qr]{max-height:calc(100dvh - 32px)}.wi-sticky-header{flex-shrink:0;position:relative}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:24px}.wi-header--wallet{align-items:flex-start;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--wallet+.wi-divider{display:none}.wi-header--sub-account{align-items:center}.wi-header--sub-account .wi-header-back{width:32px;height:38px}.wi-header--sub-account .wi-header-action{flex-shrink:0}.wi-account-block{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.wi-account-block--sub-account{align-items:center}.wi-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:32px;height:32px;border-radius:50%;object-fit:cover;background:transparent}.wi-account-text{display:flex;flex-direction:column;gap:2px;min-width:0}.wi-account-row{display:flex;align-items:center;gap:8px;min-width:0}.wi-account-row--btn{padding:2px;margin:0;width:fit-content;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;border-radius:6px;transition:background-color .15s ease,opacity .15s ease}.wi-account-row--btn:hover{background:var(--wi-surface-subtle, rgba(255, 255, 255, .06))}.wi-account-row--btn:focus-visible{outline:2px solid var(--wi-primary, #00d5aa);outline-offset:2px}.wi-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px 0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));border-radius:4px;flex-shrink:0;transition:color .15s ease,transform .2s ease}.wi-account-switch[data-open=true]{transform:rotate(180deg)}.wi-account-row--btn:hover .wi-account-switch{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-medium, rgba(0, 0, 0, .65));font:inherit;text-align:left;min-width:0;transition:color .15s ease}.wi-address-row-btn:hover .wi-account-address,.wi-address-row-btn:hover .wi-account-copy{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-account-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-copy{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:color .15s ease}.wi-account-copy[data-copied=true]{color:var(--ds-system-green-high, #00a869)}.wi-header-actions{display:flex;align-items:center;gap:16px;flex-shrink:0;margin-top:-4px}.wi-header-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;border-radius:0;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-action:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header-action--qr{width:32px;height:32px;border-radius:8px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-medium, rgba(0, 0, 0, .65));transition:background-color .15s ease,color .15s ease}.wi-header-action--qr:hover{background:var(--ds-surface-high, rgba(0, 0, 0, .08));color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-header--receive{align-items:center;border-bottom:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-header--receive .wi-header-action,.wi-header--sub-account .wi-header-action{position:absolute;top:24px;right:24px}.wi-receive-title{position:absolute;left:50%;transform:translate(-50%);font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);text-align:center;pointer-events:none}.wi-header-info{flex:1;display:flex;flex-direction:column;gap:8px;min-width:0}.wi-header-title{font-family:inherit;font-size:16px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);margin:0}.wi-header-close{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--ds-content-low, #00000066);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:24px 24px 0;padding:0;flex-shrink:0;display:flex;flex-direction:column;gap:8px;border:none;background:transparent;border-radius:12px;color:inherit;font:inherit;text-align:left;width:auto}.wi-action-row{display:flex;align-items:flex-start;gap:8px;width:auto;margin:24px 24px 0}.wi-action-card{appearance:none;display:flex;flex:1 1 0;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border:none;border-radius:12px;background:var(--ds-surface-medium, #f5f7fa);color:var(--ds-content-high, rgba(0, 0, 0, .85));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;text-align:center;cursor:pointer;transition:background-color .15s ease,color .15s ease}.wi-action-card:hover:not(:disabled){background:#2e3544!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}:root[data-ds-theme=light] .wi-action-card:hover:not(:disabled){background:#e4e8ef!important;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-action-card:disabled{cursor:default}.wi-action-card>svg{flex-shrink:0}.wi-action-card:not(:disabled){transition:background-color .15s ease,transform .1s ease}.wi-action-card:active:not(:disabled){transform:scale(.93)}.wi-total-head{display:flex;align-items:center;gap:4px}.wi-total-body{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.wi-total-label{font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65))}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--ds-content-low, rgba(0, 0, 0, .4));cursor:pointer;transition:color .15s ease;border-radius:4px}.wi-total-eye:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-total-eye:focus-visible{outline:1px solid var(--wi-texticon-secondary);outline-offset:2px}.wi-total-value{display:flex;align-items:baseline;gap:0;font-family:inherit;font-weight:600;line-height:1.25;color:var(--ds-content-highest, #000000);font-variant-numeric:tabular-nums;min-height:45px;white-space:nowrap}.wi-total-currency,.wi-total-amount,.wi-total-decimal{font-size:36px;color:var(--ds-content-highest, #000000)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:22px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:32px;color:var(--wi-texticon-secondary)}.wi-total-skeleton{border-radius:6px}.wi-scrollable-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:8px 0 0;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}.wi-drawer-content .wi-scrollable-body{touch-action:pan-y}[data-theme=light] .wi-scrollable-body{scrollbar-color:rgba(0,0,0,.12) transparent}.wi-scrollable-body::-webkit-scrollbar{width:4px}.wi-scrollable-body::-webkit-scrollbar-track{background:transparent}.wi-scrollable-body::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}.wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wi-scrollable-body::-webkit-scrollbar-thumb:hover{background:#0003}.wi-nav-fixed{flex-shrink:0;padding:0 24px}.wi-token-list{display:flex;flex-direction:column;gap:0;padding:8px 0}.wi-token-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 24px;border:none;background:transparent;text-align:left;font-family:inherit;width:100%;box-sizing:border-box}.wi-token-item--button{cursor:pointer;background:var(--ds-surface-default, #ffffff);transition:none}.wi-token-item--button:hover{background:#252b39!important}:root[data-ds-theme=light] .wi-token-item--button:hover{background:#eff3f8!important}button.wi-token-item:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px;border-radius:4px}.wi-token-left{display:flex;align-items:center;gap:16px;min-width:0}.wi-token-icon-wrap{position:relative;width:40px;height:40px;flex-shrink:0}.wi-token-icon{width:40px;height:40px;border-radius:0;object-fit:contain;opacity:0;transition:opacity .2s ease}.wi-token-icon[data-loaded=true]{opacity:1}.wi-token-chain-badge{position:absolute;right:0;bottom:0;width:14px;height:14px;border-radius:50%;background:var(--wi-surface-bg);box-shadow:0 0 0 1.5px var(--wi-surface-bg);object-fit:contain}.wi-token-info{display:flex;flex-direction:column;min-width:0}.wi-token-name-row{display:flex;align-items:center;gap:6px;min-width:0}.wi-token-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-token-apy{flex-shrink:0;font-family:inherit;font-size:12px;font-weight:600;line-height:1;color:var(--ds-system-purple-high, #9b78ff);background:var(--ds-system-purple-low, #2e2854);padding:4px;border-radius:6px;white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:8px}.wi-token-price{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-token-change{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--ds-system-green-high, #00a0a2)}.wi-token-change[data-positive=false]{color:var(--ds-system-red-high, #a80927)}.wi-token-change[data-zero]{color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-highest, #000000);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4));white-space:nowrap}.wi-sticky-footer{flex-shrink:0}.wi-footer{padding:16px 24px 24px}.wi-builtin-footer{display:flex;flex-direction:column;gap:8px;align-items:stretch}.wi-wallet-disconnect-row{display:flex;justify-content:flex-end;flex-shrink:0;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-send-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:2;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);box-sizing:border-box;text-decoration:none}.wi-action-toast{position:absolute;left:15px;right:15px;bottom:20px;z-index:3;padding:12px 14px;border-radius:12px;background:var(--ds-surface-inverted, #1e232e);color:var(--ds-content-inverted, #ffffff);font-size:14px;line-height:1.4;text-align:center;box-sizing:border-box;animation:wi-action-toast-in .18s ease-out}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-action-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-action-toast{bottom:72px}@keyframes wi-action-toast-in{0%{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}.wi-action-card--dimmed{opacity:.4;cursor:pointer}.wi-action-card--dimmed:hover{opacity:.5}.wi-popover-content:has(.wi-wallet-disconnect-row) .wi-send-toast,.wi-drawer-content:has(.wi-wallet-disconnect-row) .wi-send-toast{bottom:72px}.wi-send-toast:hover{opacity:.92}.wi-send-toast-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;color:var(--ds-accent-primary-default, #00b4b7)}.wi-send-toast-spinner{width:18px;height:18px;border:2px solid rgba(0,232,201,.22);border-top-color:var(--ds-accent-primary-on-inverted, #00e8c9);border-radius:50%;animation:wi-send-toast-spin .8s linear infinite}.wi-send-toast-error-dot{width:18px;height:18px;border-radius:50%;background:var(--ds-system-red-default, #ff3358)}@keyframes wi-send-toast-spin{to{transform:rotate(360deg)}}.wi-send-toast-copy{display:flex;min-width:0;flex-direction:column}.wi-send-toast-title{font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-inverted, #ffffff)}.wi-send-toast-desc{font-family:inherit;font-size:12px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-accent-primary-on-inverted, #00e8c9)}.wi-send-toast-icon[data-status=error]+.wi-send-toast-copy .wi-send-toast-desc{color:var(--ds-system-red-default, #ff3358)}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:16px;padding:0;border:none;background:transparent;color:var(--ds-content-low, rgba(0, 0, 0, .4));font-family:inherit;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:-.01em;cursor:pointer;transition:color .15s ease}.wi-disconnect-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-disconnect-label{white-space:nowrap}.wi-legal-links{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:100%;flex-shrink:0;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-low, rgba(0, 0, 0, .4))}.wi-receive-avatar .wi-avatar-fallback{position:absolute;inset:0;border-radius:50%;z-index:0}.wi-receive-avatar .wi-avatar-img{width:24px;height:24px}.wi-legal-link{color:var(--ds-content-low, rgba(0, 0, 0, .4));text-decoration:underline;text-underline-offset:2px;transition:color .15s ease}.wi-legal-link:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-legal-sep{color:inherit}.wi-empty{display:flex;align-items:center;justify-content:center;padding:32px 0;font-family:inherit;font-size:16px;color:var(--wi-texticon-secondary)}.wi-skeleton-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-skeleton-left{display:flex;align-items:center;gap:12px}.wi-skeleton-block{border-radius:6px;background:var(--wi-border-default);position:relative;overflow:hidden}.wi-skeleton-block:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.06) 50%,transparent 100%);animation:wi-shimmer 1.5s ease-in-out infinite}[data-theme=light] .wi-skeleton-block:after{background:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.04) 50%,transparent 100%)}.wi-skeleton-icon{width:32px;height:32px;border-radius:50%;flex-shrink:0}.wi-skeleton-lines{display:flex;flex-direction:column;gap:6px}.wi-skeleton-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px}.wi-header-back{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wi-header-back:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-view-container{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-popover-content[data-view=qr] .wi-view-container,.wi-drawer-content[data-view=qr] .wi-view-container{flex:1;min-height:0}.wi-view-inner{display:flex;flex-direction:column;flex:1;min-height:0}.wi-view-wallet{animation:wi-slide-in-left .25s ease-out}.wi-view-qr,.wi-view-portfolio{animation:wi-slide-in-right .25s ease-out}.wi-qr-body{flex:1;min-height:0;display:flex;flex-direction:column}.wi-portfolio-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.wi-portfolio-body>.wp-embed{flex:1;min-height:0}.wi-portfolio-body .wp-body-inner{padding:16px 16px 32px;gap:32px}.wi-receive-section{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;padding:24px}.wi-receive-account{display:inline-flex;align-items:center;gap:8px;padding:4px 8px 4px 4px;border:0;background:var(--ds-surface-high, #edf1f2);border-radius:9999px;font-family:inherit;color:inherit}.wi-receive-account--btn{cursor:pointer;transition:none}.wi-receive-account--btn:hover{background:#2e3544}:root[data-ds-theme=light] .wi-receive-account--btn:hover{background:#e4e8ef}.wi-receive-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0}.wi-receive-account-name{font-family:inherit;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-account>svg{color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0}.wi-receive-chevron{display:inline-flex;align-items:center;color:var(--ds-content-medium, rgba(0, 0, 0, .65));flex-shrink:0;transition:transform .2s ease}.wi-receive-chevron[data-open=true]{transform:rotate(180deg)}.wi-qr-block{display:flex;flex-direction:column;align-items:center;gap:16px}.wi-qr-box{position:relative;display:flex;align-items:center;justify-content:center;padding:10px;background:#fff;border-radius:6px;overflow:hidden}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:16px;font-weight:400;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-medium, rgba(0, 0, 0, .65));text-align:center;word-break:break-all;max-width:281px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;padding:12px 16px;border:1px solid var(--ds-border-default, rgba(0, 0, 0, .07));background:var(--ds-surface-default, #ffffff);border-radius:12px;cursor:pointer;transition:border-color .15s ease}.wi-qr-copy-btn:hover{border-color:var(--ds-border-medium, rgba(0, 0, 0, .18))}.wi-qr-copy-icon{display:inline-flex;color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wi-qr-copy-text{font-family:inherit;font-size:16px;font-weight:500;line-height:1.5;letter-spacing:-.01em;color:var(--ds-content-high, rgba(0, 0, 0, .85));white-space:nowrap}.wi-receive-footer{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 24px;border-top:1px solid var(--ds-border-default, rgba(0, 0, 0, .07))}.wi-drawer-content .wi-header{padding:16px}.wi-drawer-content .wi-header--receive .wi-header-action,.wi-drawer-content .wi-header--sub-account .wi-header-action{top:16px;right:16px}.wi-drawer-content .wi-total-section,.wi-drawer-content .wi-action-row{margin:16px 16px 0}.wi-drawer-content .wi-nav-fixed{padding:0 16px}.wi-drawer-content .wi-token-item{padding:12px 16px}.wi-drawer-content .wi-wallet-disconnect-row{padding:16px}
14
- `);K(`.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 si}from"react/jsx-runtime";function Bf({env:e,theme:t="dark",mobileBreakpoint:n=768,drawerDirection:o,modal:r,showBalance:a=!1,showForgeToken:i=!1,showGameToken:s=!0,showQR:c=!0,showBridge:l=!0,qrLogoSrc:d,walletAddress:w,accountName:h,sendAccounts:m,profileImageUrl:y,connectorId:b,connectorName:u,connectorIconUrl:v,preferredTokens:C=[],onSelectWallet:p,onCopyAddress:T,onBuy:k,onBuyDisabledMessage:N,onBridgeDisabledMessage:S,onSendDisabledMessage:G,onDisconnect:O,disconnectLabel:H="Disconnect",termsUrl:B=Fn,termsLabel:ie="Terms of Service",privacyUrl:I=So,privacyLabel:oe="Privacy Policy",open:W,onOpenChange:V,showPortfolio:he=!1,portfolioTitle:X="My Portfolio",portfolioSections:U,showTotalAssets:fe=!0,totalAssetsLabel:ce="Total Assets USD",sendTransaction:$,getTransactionReceipt:Ne,estimateGas:F,onOutlink:J,lpBalanceReader:ue,stakingRewardsReader:Le,bridgeTokens:Q,bridgeHistory:de,getBridgeQuote:Ie,getBridgeToTokens:Ee,getBridgeApproval:Qt,approveBridge:Ae,submitBridge:ke,onReceive:dt,onBridge:Pe,onSend:De,style:Se,children:_t}){let yt=_e(e),Mt=b?yo[b]:void 0,rt=u??Mt?.name,kt=v??Mt?.iconUrl,pt=En(`(max-width: ${n}px)`),be=o??(a?"right":"bottom"),Ot=be==="left"||be==="right",ft=r??!1,ze=W!==void 0,[Fe,Ge]=Je.useState(!1),et=ze?W:Fe,it=Je.useCallback(Ct=>{ze||Ge(Ct),V?.(Ct)},[ze,V]),tt=Je.useCallback(()=>it(!1),[it]),[ut,St]=Je.useState(null),[je,Ve]=Je.useState("top"),[qe,L]=Je.useState(null),[ee,we]=Je.useState("wallet"),[at,mt]=Je.useState(null);Je.useEffect(()=>{et||(we("wallet"),mt(null))},[et]);let Rt=Je.useCallback(()=>{Pr(w),O?.()},[O,w]),Tn=Je.useMemo(()=>({env:yt,theme:t,isMobile:pt,open:et,drawerDirection:be,modal:ft,showBalance:a,showForgeToken:i,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:d,walletAddress:w,accountName:h,sendAccounts:m,profileImageUrl:y,connectorName:rt,connectorIconUrl:kt,preferredTokens:C,close:tt,onSelectWallet:p,onCopyAddress:T,onBuy:k,onBuyDisabledMessage:N,onBridgeDisabledMessage:S,onSendDisabledMessage:G,onDisconnect:O?Rt:void 0,disconnectLabel:H,termsUrl:B,termsLabel:ie,privacyUrl:I,privacyLabel:oe,portalStyle:Se,navContent:ut,navPosition:je,setNavContent:St,setNavPosition:Ve,footerContent:qe,setFooterContent:L,view:ee,setView:we,selectedSendToken:at,setSelectedSendToken:mt,showPortfolio:he,portfolioTitle:X,portfolioSections:U,showTotalAssets:fe,totalAssetsLabel:ce,sendTransaction:$,getTransactionReceipt:Ne,estimateGas:F,onOutlink:J,lpBalanceReader:ue,stakingRewardsReader:Le,bridgeTokens:Q,bridgeHistory:de,getBridgeQuote:Ie,getBridgeToTokens:Ee,getBridgeApproval:Qt,approveBridge:Ae,submitBridge:ke,onReceive:dt,onBridge:Pe,onSend:De}),[yt,t,pt,et,be,ft,a,i,s,c,l,d,w,h,m,y,rt,kt,C,tt,p,T,k,N,S,G,O,Rt,H,B,ie,I,oe,Se,ut,je,qe,ee,at,he,X,U,fe,ce,$,Ne,F,J,ue,Le,Q,de,Ie,Ee,Qt,Ae,ke,dt,Pe,De]);return si(Cr.Provider,{value:Tn,children:pt?si(Ff.Root,{direction:be,open:et,onOpenChange:it,handleOnly:Ot,noBodyStyles:!0,repositionInputs:!1,children:_t},"drawer"):si(ml.Root,{open:et,onOpenChange:it,children:_t},"popover")})}var Gn=Object.assign(Bf,{Trigger:Fa,Content:cl,Nav:pl,Footer:ul});import*as Kt from"react";import*as Al from"@radix-ui/react-dialog";import{Drawer as Hf}from"vaul";import{createContext as _f,useContext as Mf}from"react";var or=_f(null);function ro(){let e=Mf(or);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as gl,useEffect as Of,useCallback as Wf}from"react";function rr(){let[e,t]=gl([]),[n,o]=gl(!0);Of(()=>{if(typeof window>"u"){o(!1);return}let a=[],i=c=>{let{info:l}=c.detail;l?.rdns&&!a.some(d=>d.rdns===l.rdns)&&(a.push({rdns:l.rdns,name:l.name,icon:l.icon}),t([...a]))};window.addEventListener("eip6963:announceProvider",i),window.addEventListener("eip6963:crossAnnounceProvider",i),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let s=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",i),window.removeEventListener("eip6963:crossAnnounceProvider",i),clearTimeout(s)}},[]);let r=Wf(a=>e.some(i=>i.rdns===a),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as bl from"@radix-ui/react-dialog";import{Drawer as Df}from"vaul";import{jsx as hl}from"react/jsx-runtime";function wl({asChild:e,children:t}){let{isMobile:n}=ro(),o=n?Df.Trigger:bl.Trigger;return hl(o,{asChild:e??t!=null,children:t??hl("button",{type:"button",children:"Connect Wallet"})})}import*as qt from"@radix-ui/react-dialog";import{Drawer as ar}from"vaul";import{jsx as Z,jsxs as pn}from"react/jsx-runtime";function ir(){return pn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Z("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),Z("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 xl(){return pn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[pn("g",{clipPath:"url(#clip0_1331_27065)",children:[Z("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"}),Z("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"}),Z("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"}),Z("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"}),Z("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"}),Z("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),Z("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"})]}),Z("defs",{children:Z("clipPath",{id:"clip0_1331_27065",children:Z("rect",{width:"40",height:"40",fill:"white"})})})]})}function vl(){return pn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Z("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),Z("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),Z("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),Z("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),Z("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 yl(){return pn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[Z("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),Z("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"}),Z("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),Z("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 kl(){return pn("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[pn("g",{clipPath:"url(#clip0_1185_7785)",children:[Z("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"}),Z("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"})]}),Z("defs",{children:Z("clipPath",{id:"clip0_1185_7785",children:Z("rect",{width:"28",height:"28",fill:"white"})})})]})}function Sl(){return pn("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[Z("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"}),Z("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"}),Z("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"}),Z("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 Rl(){return Z("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:Z("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 Cl(){return Z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Z("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var li={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:ir},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:ir,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:ir,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:xl,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:vl},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:yl,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:kl,badge:"For SHOP"}};function ci(e){return li[e]}var di={google:{id:"google",name:"Google",icon:Sl},apple:{id:"apple",name:"Apple",icon:Rl}};function Tl(e){return di[e]}import{Fragment as El,jsx as Y,jsxs as $e}from"react/jsx-runtime";function zf({wallet:e,detected:t,onConnect:n}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}n()},r=e.icon,a=e.featured===!0;return $e("button",{type:"button",className:se("wcm-wallet-item",a&&"wcm-wallet-item--featured"),onClick:o,children:[$e("div",{className:"wcm-wallet-item-left",children:[Y("div",{className:"wcm-wallet-icon",children:Y(r,{})}),$e("div",{className:"wcm-wallet-name-row",children:[Y("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&Y("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?Y("span",{className:"wcm-installed-label",children:"Installed"}):Y("span",{className:"wcm-install-btn",children:"Install"}))]})}function Gf({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return $e("button",{type:"button",className:"wcm-social-item","data-provider":e.id,onClick:t,"aria-label":o,children:[Y("span",{className:"wcm-social-icon",children:Y(n,{})}),Y("span",{className:"wcm-social-name",children:o})]})}function Nl(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:a,isDetected:i,close:s,isMobile:c}=ro(),l=t.filter(h=>{let m=ci(h).visibility;return!m||m==="always"?!0:m==="desktop-only"?!c:m==="mobile-only"?c:!0}),d=o.length>0,w=l.length>0;return $e(El,{children:[$e("div",{className:"wcm-header",children:[$e("div",{className:"wcm-header-text",children:[Y("h2",{className:"wcm-title",children:"CROSS Wallet"}),!c&&Y("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),Y("button",{type:"button",className:"wcm-close-btn",onClick:s,"aria-label":"Close",children:Y(Cl,{})})]}),$e("div",{className:"wcm-body",children:[d&&$e(El,{children:[!c&&$e("div",{className:"wcm-section-header",children:[Y("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),Y("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),Y("div",{className:"wcm-social-grid",children:o.map(h=>{let m=Tl(h);return Y(Gf,{social:m,onSignIn:()=>{n[h]?.(),s()}},h)})}),w&&$e("div",{className:"wcm-separator",children:[Y("div",{className:"wcm-separator-line"}),Y("span",{className:"wcm-separator-text",children:"Other Wallets"}),Y("div",{className:"wcm-separator-line"})]})]}),w&&Y("div",{className:"wcm-wallet-list",children:l.map(h=>{let m=ci(h),y=m.rdns?i(m.rdns):!1;return Y(zf,{wallet:m,detected:y,onConnect:()=>{e[h]?.(),s()}},h)})}),$e("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",Y(Il,{href:r,children:"Terms of Service"})," and consent to its ",Y(Il,{href:a,children:"Privacy Policy"}),"."]})]})]})}function Il({href:e,children:t}){return e?Y("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer",children:t}):Y("span",{className:"wcm-terms-link",children:t})}function Ll({className:e}){let{isMobile:t,theme:n,portalStyle:o}=ro();return t?$e(ar.Portal,{children:[Y(ar.Overlay,{className:"wcm-overlay"}),$e(ar.Content,{className:se("wcm-drawer-content",e),"data-theme":n,style:o,children:[Y(ar.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),Y("div",{className:"wcm-drawer-handle"}),Y("div",{className:"wcm-drawer-body",children:Y(Nl,{})})]})]}):$e(qt.Portal,{children:[Y(qt.Overlay,{className:"wcm-overlay"}),$e(qt.Content,{className:se("wcm-dialog-content",e),"data-theme":n,style:o,children:[Y(qt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),Y(qt.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),Y("div",{className:"wcm-dialog-body",children:Y(Nl,{})})]})]})}K(`.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
- `);K(`@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 io}from"react/jsx-runtime";var Uf={};function $f({wallets:e,socialProviders:t=Uf,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:a=768,drawerDirection:i="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:d,open:w,onOpenChange:h,children:m}){let y=En(`(max-width: ${a}px)`),[b,u]=Kt.useState(!1),v=w!==void 0,C=v?w:b,p=Kt.useCallback(B=>{v||u(B),h?.(B)},[v,h]),T=Kt.useCallback(()=>p(!1),[p]),{isDetected:k}=rr(),N=Kt.useMemo(()=>Object.keys(e),[e]),S=Kt.useMemo(()=>Object.keys(t),[t]),G=Kt.useMemo(()=>{let B={};return s&&(B["--wcm-dialog-width"]=s),c&&(B["--wcm-drawer-max-width"]=c),l&&(B["--wcm-drawer-min-width"]=l),{...B,...d}},[s,c,l,d]),O=Kt.useMemo(()=>({theme:r,isMobile:y,open:C,setOpen:p,close:T,wallets:e,activeWalletIds:N,socialProviders:t,activeSocialIds:S,termsUrl:n??Fn,privacyUrl:o??So,isDetected:k,portalStyle:G}),[r,y,C,p,T,e,N,t,S,n,o,k,G]),H=io("div",{"data-theme":r,style:G,children:m});return y?io(or.Provider,{value:O,children:io(Hf.Root,{direction:i,open:C,onOpenChange:p,noBodyStyles:!0,children:H},"drawer")}):io(or.Provider,{value:O,children:io(Al.Root,{open:C,onOpenChange:p,children:H})})}var Pl=Object.assign($f,{Trigger:wl,Content:Ll});K(`.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
- `);K(`.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 jf='<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>',Vf='<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>',qf='<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>',Kf='<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>',Qf='<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 ao(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var sr=ao(jf),lr=ao(Vf),cr=ao(qf),dr=ao(Kf),pr=ao(Qf);import{jsx as vt,jsxs as so}from"react/jsx-runtime";function Bl({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:a,onConnect:i,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:d,onBuyDisabledMessage:w,label:h="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:y,className:b,theme:u="dark",env:v,showBalance:C=!0,showPortfolio:p,drawerDirection:T,modal:k,connectorId:N,style:S,walletInfoStyle:G,sendTransaction:O,getTransactionReceipt:H,estimateGas:B,onReceive:ie,onBridge:I,onSend:oe,bridgeTokens:W,bridgeHistory:V,getBridgeQuote:he,getBridgeToTokens:X,getBridgeApproval:U,approveBridge:fe,submitBridge:ce}){let $=b?`cb-button ${b}`:"cb-button",Ne=b?`cb-pill ${b}`:"cb-pill";if(e)return so("button",{type:"button",disabled:!0,className:$,style:S,"aria-busy":"true",children:[vt("span",{className:"cb-spinner","aria-hidden":"true"}),vt("span",{className:"cb-button-label",children:m})]});if(t){let F=o??Jf(n),J=n?Zf[n]:void 0;return so(Gn,{env:v,theme:u,drawerDirection:T,modal:k,showBalance:C,showPortfolio:p,walletAddress:t,accountName:r,sendAccounts:a,connectorId:N,onSelectWallet:l,onCopyAddress:c?(ue,Le)=>{Le&&c()}:void 0,onDisconnect:s,disconnectLabel:y,style:G,sendTransaction:O,getTransactionReceipt:H,estimateGas:B,onReceive:ie,onBridge:I,onBuy:d,onBuyDisabledMessage:w,onSend:oe,bridgeTokens:W,bridgeHistory:V,getBridgeQuote:he,getBridgeToTokens:X,getBridgeApproval:U,approveBridge:fe,submitBridge:ce,children:[vt(Gn.Trigger,{asChild:!0,children:so("button",{type:"button",className:Ne,style:S,"aria-label":`Connected with ${F}: ${Fl(t)}`,children:[J?vt("img",{src:J,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):vt("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),vt("span",{className:"cb-pill-address",children:Fl(t)})]})}),vt(Gn.Content,{align:"end",sideOffset:8})]})}return so("button",{type:"button",onClick:i,className:$,style:S,"aria-label":typeof h=="string"?h:"Connect Wallet",children:[vt(Yf,{}),vt("span",{className:"cb-button-label",children:h})]})}function Yf(){return so("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[vt("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"}),vt("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"}),vt("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var Zf={google:dr,apple:pr,cross:sr,metamask:lr,binance:cr},Xf={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Jf(e){return e?Xf[e]:"Wallet"}function Fl(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as _l from"react";K(`.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
- `);K(`.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 lo,jsxs as tu}from"react/jsx-runtime";var Ml="https://www.onechain.nexus/skills";function Ol({label:e="Skills",href:t,onClick:n,className:o,style:r,theme:a,disabled:i=!1,isLoading:s=!1,loadingLabel:c="Loading...",openInNewTab:l=!1,type:d="button"}){let[w,h]=_l.useState(!1),m=_e(),y=yn("apps.json",m,k=>vn(k?.skills,m)),b=t??y,u=async k=>{if(b&&!n){l?window.open(b,"_blank","noopener,noreferrer"):window.location.href=b;return}if(n)try{h(!0),await n()}finally{h(!1)}},v=i||s||w,C=s||w,p=C?c:e,T=o?`sb-button ${o}`:"sb-button";return tu("button",{type:d,onClick:u,disabled:v,className:T,"data-theme":a,style:r,"aria-busy":C,children:[C?lo("span",{className:"sb-spinner","aria-hidden":"true"}):lo(eu,{}),lo("span",{className:"sb-label",children:p})]})}function eu(){return lo("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:lo("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"})})}yr({mode:"dapp-ui"});export{pr as APPLE_ICON,Ii as AppLauncher,zi as AppLauncherContent,Fi as AppLauncherTrigger,cr as BINANCE_ICON,Jo as BridgeFlow,yo as CONNECTOR_REGISTRY,sr as CROSSX_ICON,Bl as ConnectButton,Tr as ConnectorId,Ml as DEFAULT_SKILLS_HREF,dr as GOOGLE_ICON,lr as METAMASK_ICON,qo as PORTFOLIO_SECTIONS,di as SOCIAL_REGISTRY,Mo as SendFlow,Ol as SkillsButton,zr as TOKEN_STATS_QUERY_KEY,Dr as USER_BALANCE_QUERY_KEY,li as WALLET_REGISTRY,Pl as WalletConnectModal,Gn as WalletInfo,Bs as WalletPortfolio,Wn as WalletPortfolioBody,yr as announceAppLauncherUsage,_e as resolveEnvironment,xo as useGlobalMenu,an as useTokenBalance,sn as useTokenStats,rr as useWalletDetect};
1
+ function Oa(e){try{return import.meta.env?.[e]}catch{return}}function Wa(e){if(!(typeof process>"u"))return process.env?.[e]}function Ee(e){if(e)return Ua(e);let t=Oa("VITE_CROSSX_ENVIRONMENT")??Oa("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Wa("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Wa("CROSSX_ENVIRONMENT");return Ua(t)}function Ua(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var Zn="1.3.5";var Ro="__nexusCrossAppLauncherRuntime";function Sc(){if(typeof window>"u")return null;let e=window;return e[Ro]??(e[Ro]={mode:"dapp-ui"}),e[Ro]}function Rc(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${Zn}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${Zn} \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 Ar(e){let t=Sc();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),Rc(t))}import{BrowserClient as Cc,Scope as Tc,defaultStackParser as Nc,linkedErrorsIntegration as Ic,makeFetchTransport as Ec}from"@sentry/react";var Lc="https://5c82aeb32da33b5a0a14b7c5393992ca@o4511668907081728.ingest.de.sentry.io/4511705324126289",Ac=`dapp-ui@${Zn}`,Ln=null,za=1;function Ga(){return za}function Pc(e){switch(e){case"dev":return"dev";case"stage":return"stg";default:return"prod"}}function Xn(e){if(Ln)return Ln;if(typeof window>"u")return null;let t=Pc(Ee(e?.environment));typeof e?.analyticsSampleRate=="number"&&(za=Math.min(1,Math.max(0,e.analyticsSampleRate)));let n=new Cc({dsn:e?.dsn??Lc,transport:Ec,stackParser:Nc,integrations:[Ic()],environment:t,release:Ac,enabled:e?.enabled??t==="prod"}),o=new Tc;return o.setClient(n),o.setTags({package:"dapp-ui",framework:"react",source:"dapp-ui"}),n.init(),Ln=o,Ln}function Co(){return Ln}function To(e,t){let n=Ln??Xn();if(n)return n.captureException(e,t?{captureContext:{extra:t}}:void 0)}import{Component as _c}from"react";var No=class extends _c{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,o){To(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 fe(...e){return e.filter(Boolean).join(" ")}function Ha(){return typeof window>"u"?!1:window.navigator.userAgent.includes("CROSSx")}var $a="__nexus_dapp_ui_uid",Pr=null;function Fc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Array.from({length:32},()=>Math.floor(Math.random()*16).toString(16)).join("")}function _r(){if(Pr)return Pr;let e=null;try{e=window.localStorage.getItem($a)}catch{}if(!e||!e.startsWith("anon_")){e=`anon_${Fc()}`;try{window.localStorage.setItem($a,e)}catch{}}return Pr=e,e}async function ja(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 Bc(){let e=window.navigator.userAgent;return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|iphone|ipod|android/i.test(e)?"mobile":"desktop"}function Ka(){return{host:window.location.hostname,device_type:Bc(),is_cross_inapp:String(Ha())}}var Va=!1;function Fr(){if(typeof window>"u")return null;let e=Co()??Xn();return e?(Va||(Va=!0,e.setUser({id:_r()})),e):null}function Qa(){return Math.random()>=Ga()}var qa=0;function An(e){let t=Fr();if(!t)return;let n=++qa;if(!e){t.setUser({id:_r()});return}ja(e).then(o=>{o&&n===qa&&t.setUser({id:o})})}function Io(e,t,n){let o=Fr();!o||Qa()||o.captureMessage(`ui: ${e}_${t}`,"info",{captureContext:{tags:{...Ka(),feature:e,action:t,...n}}})}function Te(e,t,n){let o=Fr();if(!o||Qa())return;let r=n?.status??"success";o.captureMessage(`funnel: ${e}_${t}`,"info",{captureContext:{tags:{...Ka(),flow:e,funnel_step:`${e}_${t}`,funnel_status:r,...r==="failure"?{failure_reason:n?.reason??"unknown"}:{},...n?.tags}}})}function Nt(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 Mc}from"react";import{jsx as Dc}from"react/jsx-runtime";function ge({feature:e,children:t}){let n=Mc(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");Io(e,s,c?{item_id:c}:void 0)},[e]);return Dc("div",{style:{display:"contents"},onClick:n,children:t})}import*as _n from"react";import*as Ya from"@radix-ui/react-popover";import{Drawer as Gc}from"vaul";import{createContext as Oc,useContext as Wc}from"react";var Br=Oc(null);function Eo(){let e=Wc(Br);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as Uc,useEffect as zc}from"react";function Pn(e){let[t,n]=Uc(!1);return zc(()=>{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 Mr}from"react/jsx-runtime";function Za({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let i=Pn(`(max-width: ${n}px)`),[a,s]=_n.useState(!1),c=_n.useCallback(()=>s(!1),[]),l=Ee(e),d=_n.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:o,close:c}),[l,t,i,a,o,c]);return Mr(Br.Provider,{value:d,children:i?Mr(Gc.Root,{direction:"right",open:a,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Mr(Ya.Root,{open:a,onOpenChange:s,children:r},"popover")})}import*as ti from"@radix-ui/react-popover";import{Drawer as $c}from"vaul";import{jsx as ft,jsxs as Hc}from"react/jsx-runtime";function Xa({size:e=18}){return Hc("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ft("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ft("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function Ja(){return ft("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ft("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ei(){return ft("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ft("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Fn}from"react/jsx-runtime";function ni({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:i}=Eo(),a=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=a?t:Fn("button",{type:"button",className:c,"data-theme":i,"data-track":"open",style:o,children:Fn(Xa,{size:18})});return r?Fn(ge,{feature:"app_launcher",children:Fn($c.Trigger,{asChild:s,children:l})}):Fn(ge,{feature:"app_launcher",children:Fn(ti.Trigger,{asChild:s,children:l})})}import*as wn from"react";import*as Ao from"@radix-ui/react-popover";import{Drawer as Bn}from"vaul";import{useQuery as qc}from"@tanstack/react-query";var oi={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 jc="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",Vc="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function It(e,t){return`${e==="production"?Vc:jc}/${t}.png`}function ri(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:It(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:It(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:It(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:It(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:It(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:It(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:It(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:It(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:It(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:It(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:It(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1,serviceStatus:"available"}]}}function Lo(e){let t=Ee(e);return qc({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(oi[t],{cache:"no-store",signal:n});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()}catch(o){if(n.aborted)throw o;return ri(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Dr(e){return e.serviceStatus==="ending"||e.serviceStatus==="comingSoon"?e.serviceStatus:"available"}function ii(e,t){return typeof e=="string"?e:e[t]??e.production??e.stage??e.dev}function si(e){return[...e].sort((t,n)=>{let o=ai(t)-ai(n);return o!==0?o:t.order-n.order})}function ai(e){let t=Dr(e);return t==="comingSoon"?0:t==="ending"?2:1}import{jsx as Le,jsxs as Mn}from"react/jsx-runtime";function Kc(e){return e.id==="cross-staking"||e.type==="cross-staking"}function ci({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:i,domain:a,close:s}=Eo(),{data:c}=Lo(o),l=wn.useMemo(()=>si(c?.items??[]),[c?.items]),d=8,w=wn.useRef(null),h=wn.useCallback(x=>{w.current={x:x.clientX,y:x.clientY}},[]),m=typeof window<"u"?window.location.pathname:"",y=wn.useCallback((x,R)=>{if(w.current){let k=x.clientX-w.current.x,N=x.clientY-w.current.y;if(w.current=null,Math.abs(k)>d||Math.abs(N)>d)return}let p=R.url[o]??R.url.production,C=li(p,a);if(!C)try{let k=new URL(p).pathname;if(m===k||m.startsWith(k+"/")){s();return}}catch{}C?window.open(p,"_blank","noopener,noreferrer"):window.location.href=p,s()},[o,a,s,m]),b=x=>{let R=x.url[o]??x.url.production,p=li(R,a),C=Dr(x),k=C==="ending",N=ii(x.iconUrl,o),E=!1;if(!p)try{let T=new URL(R).pathname;E=m===T||m.startsWith(T+"/")}catch{E=!1}return Le("button",{type:"button",className:"al-grid-item","data-track":"menu_item_click","data-track-id":x.id,"data-active":E||void 0,"data-service-status":C,onPointerDown:h,onClick:T=>y(T,x),children:Mn("div",{className:"al-grid-item-left",children:[Mn("div",{className:"al-grid-item-icon",children:[Le("img",{src:N,alt:x.label,width:24,height:24,loading:"lazy"}),x.isNew&&Le("span",{className:"al-status-ribbon al-status-ribbon-new",children:"N"})]}),Mn("span",{className:"al-grid-item-text",children:[Le("span",{className:"al-grid-item-label",children:x.label}),k&&Le("span",{className:"al-grid-item-status-text",children:"(End Soon)"}),x.badge&&!Kc(x)&&Le("span",{className:"al-badge al-badge-list",children:x.badge})]})]})},x.id)},u=Le("div",{className:"al-menu","data-theme":r,children:Le("div",{className:"al-grid",children:l.map(b)})});return i?Le(ge,{feature:"app_launcher",children:Mn(Bn.Portal,{children:[Le(Bn.Overlay,{className:"al-drawer-overlay"}),Mn(Bn.Content,{className:fe("al-drawer-content",n),"data-theme":r,children:[Mn("div",{className:"al-drawer-header",children:[Le(Bn.Close,{className:"al-drawer-close","data-track":"close",children:Le(Ja,{})}),Le(Bn.Title,{className:"al-drawer-title",children:"CROSS Services"}),Le(Bn.Close,{className:"al-drawer-close","data-track":"close",children:Le(ei,{})})]}),Le("div",{className:"al-drawer-body",children:u})]})]})}):Le(ge,{feature:"app_launcher",children:Le(Ao.Portal,{children:Le(Ao.Content,{align:e,sideOffset:t,className:fe("al-popover-content",n),"data-theme":r,children:u})})})}function li(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Ve from"react";import*as Dl from"@radix-ui/react-popover";import{Drawer as hu}from"vaul";import{createContext as Qc,useContext as Yc}from"react";var Or=Qc(null);function an(){let e=Yc(Or);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Wr=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(Wr||{}),Po={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 es from"react";import{jsx as re,jsxs as eo}from"react/jsx-runtime";function di({size:e=16,className:t}){return eo("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[re("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"}),re("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 Jn({size:e=16,className:t}){return re("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("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 xn({size:e=16,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ot({size:e=24,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function pi({size:e=20,className:t}){return eo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[re("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"}),re("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 _o({size:e=20,className:t}){return re("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:re("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 vn({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function yn({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function fi({size:e=16,className:t}){return eo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[re("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"}),re("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 ui({size:e=16,className:t}){return eo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[re("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"}),re("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mi({size:e=42,className:t}){return re("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:re("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 gi({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("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 hi({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("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 bi({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("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 wi({size:e=20,className:t}){return re("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:re("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 xi({size:e=20,className:t}){return eo("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[re("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),re("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 B from"react";import kn from"bignumber.js";function Zc(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 sn(e,t){if(!e||e==="0")return"0.00";let n=new kn(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,kn.ROUND_DOWN)}function ut(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ur(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 vi(e,t,n){let r=new kn(e).shiftedBy(-t).multipliedBy(new kn(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(kn.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,kn.ROUND_DOWN):r.decimalPlaces(4,kn.ROUND_DOWN)).toFormat()}`}function yi(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=Zc(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 td}from"react";import{useQuery as nd}from"@tanstack/react-query";var Ne={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}},Dn="https://terms.crosstoken.io/docs/cross-terms-of-use",Fo="https://terms.crosstoken.io/docs/nexus-privacy-policy";import*as On from"react";var Xc={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"},Jc=3e3;function Sn(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 zr=new Map;function ki(e,t){let n=`${Xc[t]}/${e}`,o=zr.get(n);return o||(o=(async()=>{let r=new AbortController,i=setTimeout(()=>r.abort(),Jc);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&&zr.delete(n),r)),zr.set(n,o)),o}function ed(e){return typeof e=="string"&&e.startsWith("https://")}async function le(e,t){let n=await ki("endpoints.json",t),o=Sn(n?.apis?.[e],t);if(!ed(o))throw new Error(`[remote-config] endpoints.json missing or invalid api base: ${e} (${t})`);return o}function Rn(e,t,n){let[o,r]=On.useState(void 0),i=On.useRef(n);return i.current=n,On.useEffect(()=>{let a=!0;return ki(e,t).then(s=>{if(!a)return;let c=i.current(s);c!==void 0&&r(c)}),()=>{a=!1}},[e,t]),o}var od="send:chain-info";function rd(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 Gr(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function ad(e,t,n,o){if(o)return t===Ne[e].cross?Si(t,o):n?.explorer_url?Gr(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):id(e,t,o)}function Si(e,t){return Gr("https://explorer.onechain.nexus",String(e),"tx",t)}function id(e,t,n){let o=Ne[e];if(t===o.cross)return Si(t,n);if(t===o.bsc)return Gr(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function Bo(e,t,n,o=!0){let r=nd({queryKey:[od,e,t],queryFn:async({signal:s})=>{let c=await le("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 d=await l.json();if("code"in d&&d.code!==void 0&&d.code!==200)throw new Error(`Chain info API error: ${d.code}`);return rd(d)},enabled:o,staleTime:3e5}),i=r.data;return{transactionUrl:td(()=>ad(e,t,i,n),[t,i,e,n]),chainInfo:i,...r}}var Ri="0x0000000000000000000000000000000000000001";var sd="0xa9059cbb",ld=/^0x[a-fA-F0-9]{40}$/,cd="nexus-cross:dapp-ui:send:recent:",Ci=10;function dd(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function to(e){return e.toLowerCase()}function Wt(e){return ld.test(e)}function ln(e){return to(e.address)===Ri}function Hr(e){return`${cd}${e.toLowerCase()}`}function Wn(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(Hr(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&Wt(o.address)&&typeof o.updatedAt=="number").slice(0,Ci):[]}catch{return[]}}function $r(e,t){if(typeof window>"u")return[];let n=to(t),o=[{address:n,updatedAt:Date.now()},...Wn(e).filter(r=>r.address!==n)].slice(0,Ci);try{window.localStorage.setItem(Hr(e),JSON.stringify(o))}catch{return Wn(e)}return o}function jr(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(Hr(e))}catch{}}function Jt(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 no(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=dd(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function Vr(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${sd}${n}${o}`}function Mo(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 qr(e,t){return Mo(e,t,6)}function Ti(e){return Mo(e,9,2)}function Ni(e){return e.toLocaleString("en-US")}function Do(e){return e===56||e===97}function Oo(e){return e.gasPrice??e.maxFeePerGas}function Ii(e,t=!1){return t?Oo(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Wo(e,t=!1){if(t){let n=Oo(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 Uo(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Ei(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(Ei(n.cause,t+1)),o.join(`
6
+ `).toLowerCase()}function pd(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 Kr(e,t={},n="Failed to send transaction."){let o=Ei(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.":pd(e)||n}var fd=2000000000n,ud=1000000000n;async function zo(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 Go(e){return BigInt(e)}function md(e){return`0x${e.toString(16)}`}function gd(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=md(e.value)),e.data&&(t.data=e.data),t}function hd(e){return e===56||e===97}async function Li(e){try{let t=await zo(e,"eth_gasPrice",[]);return{gasPrice:Go(t)}}catch{return{gasPrice:fd}}}async function bd(e,t){let n=ud;try{let o=await zo(e,"eth_maxPriorityFeePerGas",[]);n=Go(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function wd(e,t){if(t)return Li(e);let n;try{n=(await zo(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?bd(e,Go(n)):Li(e)}async function Ai(e,t){let n=hd(t.chainId),o=gd(t),[r,i]=await Promise.all([zo(e,"eth_estimateGas",[o]),wd(e,n)]);return{gasLimit:Go(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function Pi(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 Ai(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 xd=1500,vd=120;function _i(e){return!!(e.token||e.recipient||e.amount)}function Qr({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},i=e.trim(),a=Jt(t,n.quantity.decimals),s;return i?Wt(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.")),!ln(n)&&!Wt(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:i&&Wt(i)?i:void 0}}function Yr({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return ln(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:to(e.address),data:Vr(n,o),value:0n,chainId:e.chainId,from:r}}function yd(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var kd=e=>new Promise(t=>setTimeout(t,e));async function Fi({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=xd,pollMaxAttempts:i=vd}){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 yd(l)?"reverted":"success";await kd(r)}return"timeout"}var Bi=["token","recipient","amount","review"];function Mi(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:i="recipient",token:a,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:d,estimateGas:w,getTokenPriceUsd:h,onSubmitted:m,onSuccess:y,onFailed:b,onExit:u,onOutlink:x}=e,R=B.useMemo(()=>Pi({sendTransaction:l,getTransactionReceipt:d,estimateGas:w}),[l,d,w]),[p,C]=B.useState(a);B.useEffect(()=>{C(a)},[a.address,a.chainId]);let[k,N]=B.useState(i),[E,T]=B.useState(""),[M,q]=B.useState(""),[L,K]=B.useState({}),[U,ce]=B.useState("idle"),[J,$]=B.useState(""),[ne,G]=B.useState(""),[D,ae]=B.useState(null),[me,j]=B.useState(!1),[_e,xe]=B.useState(""),O=B.useRef(0),[ee,Fe]=B.useState(null),[Q,be]=B.useState(""),[Be,Me]=B.useState(()=>Wn(n)),St=B.useRef(new Set),ue=B.useCallback((I,Z)=>{St.current.has(I)||(St.current.add(I),Te("send",I,Z))},[]);B.useEffect(()=>{ue("opened"),i!=="token"&&ue("token_selected",{tags:{item_id:a.symbol}})},[ue,i,a.symbol]);let Ke=B.useMemo(()=>Ee(t),[t]),{transactionUrl:tt,chainInfo:De}=Bo(Ke,p.chainId,J||void 0,!0),Ie=De?.currency_symbol??"",We=De?.name??`Chain ID ${p.chainId}`,Qt=B.useRef({nativeSymbol:Ie||void 0,networkName:We,tokenSymbol:p.symbol});Qt.current={nativeSymbol:Ie||void 0,networkName:We,tokenSymbol:p.symbol};let nt=B.useMemo(()=>BigInt(p.quantity.numeric||"0"),[p.quantity.numeric]),gt=B.useMemo(()=>sn(p.quantity.numeric,p.quantity.decimals),[p.quantity.numeric,p.quantity.decimals]),ze=h?.(p),Rt=B.useMemo(()=>{if(ze===void 0)return;let I=parseFloat(M.replace(/,/g,""));return Number.isFinite(I)?I*ze:0},[M,ze]);B.useEffect(()=>{q(""),K({})},[p.address,p.chainId]),B.useEffect(()=>{O.current+=1,ae(null),xe(""),j(!1)},[p.address,p.chainId,E,M]),B.useEffect(()=>{Me(Wn(n))},[n]);let ht=B.useCallback(I=>{T(I),K(Z=>({...Z,recipient:void 0}))},[]),ve=B.useCallback(I=>{q(I),K(Z=>({...Z,amount:void 0}))},[]),Mt=B.useCallback(()=>{q(gt.replace(/,/g,"")),K(I=>({...I,amount:void 0}))},[gt]),Dt=B.useCallback(I=>{C(I),c?.(I),ue("token_selected",{tags:{item_id:I.symbol}}),N("recipient")},[c,ue]),ot=B.useCallback(()=>N("token"),[]),Ge=B.useCallback(()=>{N(I=>{if(I==="result")return"review";if(I===i)return u?.(),I;let Z=Bi.indexOf(I);return Z<=0?(u?.(),I):Bi[Z-1]})},[i,u]),rt=B.useCallback(()=>{let{errors:I}=Qr({recipient:E,amount:"1",token:p,balanceRaw:nt});if(I.recipient){K(Z=>({...Z,recipient:I.recipient}));return}K(Z=>({...Z,recipient:void 0})),ue("recipient_entered"),N("amount")},[E,p,nt,ue]),Qe=B.useCallback(I=>{T(I),K(Z=>({...Z,recipient:void 0})),ue("recipient_entered"),N("amount")},[ue]),He=B.useCallback(()=>{let I=Qr({recipient:E,amount:M,token:p,balanceRaw:nt});K(I.errors),!(_i(I.errors)||I.rawAmount===void 0||!I.recipient)&&(Fe(I.rawAmount),be(I.recipient),ae(null),xe(""),ce("idle"),ue("amount_entered"),N("review"))},[E,M,p,nt,ue]);B.useEffect(()=>{if(k!=="review"||!Q||ee===null||D!==null||me||_e||!R.canEstimateGas(De?.rpc))return;let I=++O.current;j(!0),xe(""),(async()=>{try{let Z=Yr({token:p,walletAddress:n,recipient:Q,rawAmount:ee}),ie=await R.estimateGas(Z,De?.rpc);if(O.current!==I)return;ae(ie)}catch(Z){if(O.current!==I)return;xe(Kr(Z,Qt.current,"Failed to estimate gas."))}finally{O.current===I&&j(!1)}})()},[k,Q,ee,D,me,_e,R,De?.rpc,p,n]);let ye=B.useMemo(()=>{if(!ln(p)||!D||ee===null)return!1;let I=Wo(D,Do(p.chainId));return I===null?!1:ee+I>nt},[p,D,ee,nt]),dt=B.useCallback(async()=>{if(!(!Q||ee===null)&&!ye){G(""),$(""),ce("submitting"),ue("submitted");try{let I="",Z=await Fi({repository:R,args:Yr({token:p,walletAddress:n,recipient:Q,rawAmount:ee}),chainId:p.chainId,onSubmitted:ie=>{I=ie,$(ie),ce("confirming"),Me($r(n,Q)),m?.({txHash:ie,chainId:p.chainId,amount:M,tokenSymbol:p.symbol,recipient:Q})}});if(Z==="success")ce("success"),ue("confirmed"),I&&y?y?.(I):N("result");else if(Z==="reverted"){let ie="Transaction reverted on-chain.";ce("error"),G(ie),ue("confirmed",{status:"failure",reason:Nt(new Error(ie))}),I&&b?b({txHash:I,chainId:p.chainId,message:ie}):N("result")}else{let ie="Transaction receipt was not found. Please check again later.";ce("error"),G(ie),ue("confirmed",{status:"failure",reason:"timeout"}),I&&b?b({txHash:I,chainId:p.chainId,message:ie}):N("result")}}catch(I){ce("error"),ue("confirmed",{status:"failure",reason:Nt(I)}),G(Kr(I,{nativeSymbol:Ie||void 0,networkName:We,tokenSymbol:p.symbol})),N("result")}}},[R,Q,ee,ye,p,M,n,m,y,b,Ie,We,ue]),[at,Ye]=B.useState(!1),bt=B.useRef(void 0);B.useEffect(()=>()=>clearTimeout(bt.current),[]);let Yt=B.useCallback(async()=>{if(J)try{await navigator.clipboard.writeText(J),Ye(!0),clearTimeout(bt.current),bt.current=setTimeout(()=>Ye(!1),2e3)}catch{}},[J]),rn=B.useCallback(()=>{if(!tt||!J)return;let I=it=>{typeof window<"u"&&window.open(it,"_blank","noopener,noreferrer")};if(!x){I(tt);return}let Z=x(tt,{category:"send",origin:"send-transaction",payload:{chainId:p.chainId,txHash:J}});if(Z&&typeof Z.then=="function"){let it=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;Z.then(Xt=>{if(Xt===null){it?.close();return}let pt=Xt??tt;if(it)try{it.location.href=pt}catch{it.close(),I(pt)}else I(pt)});return}let ie=Z;ie!==null&&I(ie??tt)},[x,p.chainId,tt,J]),Zt=B.useCallback(()=>{G(""),$(""),ce("idle"),ae(null),xe(""),St.current.delete("submitted"),St.current.delete("confirmed"),N("review")},[]);return{step:k,status:U,token:p,tokens:s.length>0?s:[p],recipient:E,amount:M,amountUsd:Rt,fieldErrors:L,error:ne,txHash:J,gasEstimate:D,gasLoading:me,gasError:_e,insufficientGas:ye,reviewRawAmount:ee,reviewRecipient:Q,recentAddresses:Be,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Ke,transactionUrl:tt,networkName:We,nativeSymbol:Ie,nativeDecimals:De?.currency_decimals??p.quantity.decimals,balanceRaw:nt,balanceText:gt,priceUsd:ze,canSelectToken:(s.length>0?s:[p]).length>1,canSend:R.canSend,getTokenPriceUsd:h,setRecipient:ht,setAmount:ve,setMax:Mt,selectToken:Dt,goToTokenSelect:ot,selectRecipient:Qe,submitRecipient:rt,submitAmount:He,confirmSend:dt,retry:Zt,back:Ge,hashCopied:at,copyHash:Yt,openTransaction:rn}}import*as Et from"react";import{jsx as oo,jsxs as Zr}from"react/jsx-runtime";function Di({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:i,token:a,setMax:s}=e,c=Et.useRef(null),l=Et.useCallback(()=>{requestAnimationFrame(()=>{let b=c.current;if(!b)return;let u=b.value.length;b.setSelectionRange(u,u)})},[]);Et.useEffect(()=>{c.current?.focus(),l()},[l]),Et.useEffect(()=>{t===""&&(h(!1),l())},[t,l]);let d=Et.useMemo(()=>{let b=Jt(t,a.quantity.decimals);return"value"in b&&b.value>i},[t,a.quantity.decimals,i]),[w,h]=Et.useState(!1),m=!w&&t===""?"0.00":t,y=t.trim()===""||t.trim()==="0";return oo("div",{className:"sf-body sf-amount",children:Zr("div",{className:"sf-amount-center",children:[oo("span",{className:"sf-amount-usd",children:o!==void 0?Uo(o):"\xA0"}),oo("div",{className:"sf-amount-input-wrap","data-over":d||void 0,"data-empty":y||void 0,onClick:()=>c.current?.focus(),children:oo("input",{ref:c,className:"sf-amount-input",value:m,onChange:b=>{let u=b.target.value;if(w)n(u);else if(t===""){if(u.length<4)return;h(!0);let x=u.startsWith("0.00")?u.slice(4):u;n(x)}else h(!0),n(u)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${a.symbol}`,size:1})}),Zr("div",{className:"sf-amount-balance",children:[oo("span",{children:"Balance:"}),Zr("button",{type:"button",className:"sf-amount-max",onClick:s,"data-track":"amount_max",children:[r," ",a.symbol]})]})]})})}import*as Lt from"react";var Rd=new Set(["0xff42c13d927a6b9265236619161accb227b6d452","0x9364ea6790f6e0ecfaa5164085f2a7de34ec55fb"].map(e=>e.toLowerCase()));function Wi(e){return Rd.has(e.toLowerCase())}var Oi={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function ro(e,t){let n=Ne[e];if(t===n.cross)return Oi.cross;if(t===n.bsc)return Oi.bsc}var Cd={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function en(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:i="png"}=n,a=Cd[e],s=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${o}${s}`}import{jsx as xt,jsxs as Ho}from"react/jsx-runtime";function Ui({size:e=20,className:t}){return Ho("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[xt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),xt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function zi({size:e=20,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:xt("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 Gi({size:e=20,className:t}){return Ho("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[xt("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),xt("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function Hi({size:e=16,className:t}){return xt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:xt("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function $i({size:e=56,className:t}){return Ho("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[xt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),xt("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 ji({size:e=56,className:t}){return Ho("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[xt("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),xt("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as Ae,jsxs as Ut}from"react/jsx-runtime";function Vi(e,t){return e.name||`Account ${(e.index??t)+1}`}function qi(e){return e.trim().slice(0,1).toUpperCase()||"A"}function Ki(e){return e.toLowerCase()}function Qi({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:i,walletAddress:a,resolvedEnv:s,selectRecipient:c}=e,l=Lt.useMemo(()=>i.filter(p=>p.address.toLowerCase()!==a.toLowerCase()),[i,a]),d=l.length>0,w=Lt.useMemo(()=>new Map(l.map((p,C)=>[Ki(p.address),{account:p,index:C}])),[l]),[h,m]=Lt.useState("recent"),y=Lt.useRef(null);Lt.useEffect(()=>{y.current?.focus()},[]);let b="1A1A2E",u=Lt.useCallback(async()=>{try{let p=await navigator.clipboard.readText();p&&n(p.trim())}catch{}},[n]),x=t.trim().length>0,R=Wt(t.trim());return Ut("div",{className:"sf-recipient",children:[Ut("div",{className:"sf-recipient-top",children:[Ut("div",{className:"sf-address-field","data-filled":x||void 0,"data-invalid":o.recipient||void 0,children:[Ae("textarea",{ref:y,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:x?2:1}),x?Ae("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear","data-track":"recipient_clear",children:Ae(Gi,{size:20})}):Ae("button",{type:"button",className:"sf-address-action",onClick:u,"aria-label":"Paste from clipboard","data-track":"recipient_paste",children:Ae(zi,{size:20})})]}),o.recipient&&Ae("p",{className:"sf-field-error",role:"alert",children:o.recipient}),Ut("div",{className:"sf-tabs",role:"tablist",children:[Ae("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="recent"||void 0,"aria-selected":h==="recent",onClick:()=>m("recent"),"data-track":"recipient_tab","data-track-id":"recent",children:"Recent"}),d&&Ae("button",{type:"button",role:"tab",className:"sf-tab","data-active":h==="account"||void 0,"aria-selected":h==="account",onClick:()=>m("account"),"data-track":"recipient_tab","data-track-id":"account",children:"My Account"})]})]}),Ae("div",{className:"sf-address-list",children:h==="account"&&d?l.map((p,C)=>{let k=Vi(p,C),N=en(s,p.address,{size:56,bg:b});return Ut("button",{type:"button",className:"sf-address-row",onClick:()=>c(p.address),"data-track":"recipient_item",children:[Ut("span",{className:"sf-address-avatar",children:[N&&Ae("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:E=>{E.currentTarget.style.display="none"}}),Ae("span",{className:"sf-address-avatar-fallback",children:qi(k)})]}),Ut("span",{className:"sf-address-meta",children:[Ae("span",{className:"sf-address-name",children:k}),Ae("span",{className:"sf-address-value",children:ut(p.address)})]})]},p.address)}):r.length>0?r.map(p=>{let C=w.get(Ki(p.address)),k=C?Vi(C.account,C.index):ut(p.address),N=en(s,p.address,{size:56,bg:b});return Ut("button",{type:"button",className:"sf-address-row",onClick:()=>c(p.address),"data-track":"recipient_item",children:[Ut("span",{className:"sf-address-avatar",children:[N&&Ae("img",{src:N,alt:"",width:40,height:40,draggable:!1,onError:E=>{E.currentTarget.style.display="none"}}),Ae("span",{className:"sf-address-avatar-fallback",children:qi(k)})]}),Ut("span",{className:"sf-address-meta",children:[Ae("span",{className:"sf-address-name",children:k}),Ae("span",{className:"sf-address-value",children:ut(p.address)})]})]},p.address)}):Ae("div",{className:"sf-empty",children:"No send history"})}),x&&!R&&!o.recipient&&Ae("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as Xe,jsxs as Un}from"react/jsx-runtime";function Zi({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:i,openTransaction:a}=e,s=t==="error",c=t==="success";return s?Un("div",{className:"sf-body sf-result sf-result--error",children:[Xe("span",{className:"sf-result-icon",children:Xe(ji,{size:56})}),Un("div",{className:"sf-result-copy",children:[Xe("h3",{className:"sf-result-title",children:"Transaction Failed"}),Xe("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&Xe(Yi,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]}):Un("div",{className:"sf-body sf-result",children:[Xe("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?Xe($i,{size:56}):Xe("span",{className:"sf-result-spinner"})}),Un("div",{className:"sf-result-copy",children:[Xe("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),Xe("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&Xe(Yi,{txHash:n,hashCopied:i,onCopy:r,onOpen:a})]})}function Yi({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return Un("div",{className:"sf-result-hash-card",children:[Xe("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),Un("div",{className:"sf-result-hash-row",children:[Xe("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer","data-track":"tx_link_open",children:ut(e)}),Xe("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash","data-track":"tx_hash_copy",children:t?Xe(xn,{size:16}):"Copy"})]})]})}import{jsx as ke,jsxs as Je}from"react/jsx-runtime";var $o="\u2014";function Xi({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:i,walletAddress:a,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:d,gasLoading:w,gasError:h,insufficientGas:m,error:y,resolvedEnv:b}=e,u=ln(t),x=n!==null?Mo(n,t.quantity.decimals):"",R=r?.trim()||`Account ${(i[0]?.index??0)+1}`,p=en(b,a,{size:56,bg:"1A1A2E"}),C=c||(u?t.symbol:""),k=Do(t.chainId),N=d?Ii(d,k):null,E=d?Wo(d,k):null,T=U=>U!==null&&C?`${qr(U,l)} ${C}`:$o,M=U=>U!==void 0?`${Ti(U)} Gwei`:$o,q=(()=>{if(!u||!d||E===null||n===null)return $o;let U=n+E;return`${qr(U,l)} ${C||t.symbol}`})(),L=U=>w?"\u2026":U,K=[{label:"Est. Tx Fee",value:L(T(E))},...N==="dynamic"?[{label:"Max Priority Fee",value:L(M(d?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:L(M(d?.maxFeePerGas))}]:N==="legacy"?[{label:"Gas Price",value:L(M(d?Oo(d):void 0))}]:[],{label:"Gas Limit",value:L(d?Ni(d.gasLimit):$o)}];return Je("div",{className:"sf-body sf-review",children:[Je("div",{className:"sf-review-amount",children:[ke("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:U=>{U.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),Je("span",{className:"sf-review-amount-value",children:[x,ke("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),Je("div",{className:"sf-review-parties",children:[Je("div",{className:"sf-review-card sf-review-party",children:[ke("span",{className:"sf-review-party-label",children:"From"}),Je("div",{className:"sf-review-party-head",children:[ke("span",{className:"sf-review-party-avatar",children:p&&ke("img",{src:p,alt:"",width:28,height:28,draggable:!1,onError:U=>{U.currentTarget.style.display="none"}})}),ke("span",{className:"sf-review-party-name",children:R})]}),ke("span",{className:"sf-review-party-addr",children:a})]}),ke("span",{className:"sf-review-arrow","aria-hidden":!0,children:ke(Hi,{size:16})}),Je("div",{className:"sf-review-card sf-review-party",children:[ke("span",{className:"sf-review-party-label",children:"To"}),ke("span",{className:"sf-review-party-addr",children:o})]})]}),Je("section",{className:"sf-review-card",children:[ke("h3",{className:"sf-review-section-title",children:"Summary"}),Je("div",{className:"sf-review-row",children:[ke("span",{className:"sf-review-row-label",children:"Network"}),ke("span",{className:"sf-review-row-value",children:s})]}),K.map(U=>Je("div",{className:"sf-review-row",children:[ke("span",{className:"sf-review-row-label",children:U.label}),ke("span",{className:"sf-review-row-value",children:U.value})]},U.label))]}),Je("section",{className:"sf-review-card",children:[ke("h3",{className:"sf-review-section-title",children:"Total"}),Je("div",{className:"sf-review-row",children:[ke("span",{className:"sf-review-row-label",children:"Total Amount"}),Je("span",{className:"sf-review-row-value",children:[x," ",t.symbol]})]}),u&&Je("div",{className:"sf-review-row",children:[ke("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),ke("span",{className:"sf-review-row-value",children:L(q)})]})]}),m&&!h&&!y&&Je("div",{className:"sf-message sf-message--error",role:"alert",children:["Not enough ",C||t.symbol," to cover the amount plus the network fee. Reduce the amount and try again."]}),(h||y)&&ke("div",{className:"sf-message sf-message--error",role:"alert",children:h||y})]})}import*as jo from"react";import{jsx as cn,jsxs as Cn}from"react/jsx-runtime";function Ji({flow:e}){let[t,n]=jo.useState(""),o=t.trim().toLowerCase(),r=jo.useMemo(()=>o?e.tokens.filter(i=>i.symbol.toLowerCase().includes(o)||i.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return Cn("div",{className:"sf-body sf-token-select",children:[Cn("div",{className:"sf-search",children:[cn(Ui,{size:20}),cn("input",{className:"sf-search-input",value:t,onChange:i=>n(i.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),Cn("div",{className:"sf-token-list",children:[r.map(i=>{let a=`${i.chainId}:${i.address.toLowerCase()}`,s=ro(e.resolvedEnv,i.chainId),c=e.getTokenPriceUsd?.(i);return Cn("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(i),"data-track":"token_item","data-track-id":i.symbol,children:[Cn("span",{className:"sf-token-left",children:[Cn("span",{className:"sf-token-icon-wrap",children:[cn("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&&cn("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"}})]}),cn("span",{className:"sf-token-name",children:i.symbol})]}),Cn("span",{className:"sf-token-right",children:[cn("span",{className:"sf-token-balance",children:sn(i.quantity.numeric,i.quantity.decimals)}),c!==void 0&&cn("span",{className:"sf-token-price",children:Uo(c)})]})]},a)}),r.length===0&&cn("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 Vo}from"react/jsx-runtime";var Td={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function qo({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...i}){let a=es.useCallback(x=>{o?.(x),n?.(x)},[n,o]),c=Mi({...i,onSuccess:o||n?a:void 0,onExit:t}),{step:l,status:d}=c,w=Wt(c.recipient.trim()),h=Jt(c.amount,c.token.quantity.decimals),m="value"in h&&h.value<=c.balanceRaw,y=d==="submitting"||d==="confirming",b=l!=="result",u=Td[l]??"";return Oe(ge,{feature:"send",children:Vo("div",{className:fe("sf-root",r),"data-step":l,children:[Vo("header",{className:"sf-header",children:[b?Oe("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back","data-track":"back",children:Oe(vn,{size:24})}):Oe("span",{className:"sf-header-btn","aria-hidden":!0}),Oe("span",{className:"sf-header-title",children:u}),Oe("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close","data-track":"close",children:Oe(Ot,{size:24})})]}),l==="token"&&Oe(Ji,{flow:c}),l==="recipient"&&Oe(Qi,{flow:c}),l==="amount"&&Oe(Di,{flow:c}),l==="review"&&Oe(Xi,{flow:c}),l==="result"&&Oe(Zi,{flow:c}),Vo("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":!w||void 0,"aria-disabled":!w,"data-track":"recipient_next",children:"Next"}),l==="amount"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!m||void 0,"aria-disabled":!m,"data-track":"amount_next",children:"Next"}),l==="review"&&Vo("div",{className:"sf-footer-row",children:[Oe("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:y,"data-track":"review_cancel",children:"Cancel"}),Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:y||!c.canSend||c.insufficientGas,"data-track":"review_send",children:y?"Sending...":"Send"})]}),l==="result"&&d==="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"&&d==="error"&&Oe("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,"data-track":"result_retry",children:"Try Again"})]})]})})}import*as ts from"@radix-ui/react-popover";import{Drawer as Nd}from"vaul";import{jsx as Ko,jsxs as Id}from"react/jsx-runtime";function ns({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:i}=an(),a=n!=null,s=e??!0,c=a?n:Id("button",{type:"button",className:fe("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[Ko(di,{size:o?14:16}),Ko("span",{className:"wi-trigger-address",children:ut(i)})]});return o?Ko(Nd.Trigger,{asChild:s,children:c}):Ko(ts.Trigger,{asChild:s,children:c})}import*as z from"react";import*as fr from"@radix-ui/react-popover";import{Drawer as pr}from"vaul";import po from"bignumber.js";import{useQueries as Ed}from"@tanstack/react-query";import{useMemo as Ld}from"react";var Xr="user-balance";async function Ad(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 dn(e,t,n=!0){let o=Ne[e],r=[o.cross,o.bsc],i=Ed({queries:r.map(l=>({queryKey:[Xr,e,t,l],queryFn:async({signal:d})=>Ad(await le("walletServer",e),l,t,d),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),a=i.some(l=>l.isLoading),s=i.some(l=>l.isError);return{tokens:Ld(()=>{let l=[];for(let d of i)d.data&&l.push(...d.data);return l},[i]),isLoading:a,isError:s}}import{useQuery as Pd,useQueries as _d}from"@tanstack/react-query";import{useMemo as Fd}from"react";var Bd="forge-holdings",Md="forge-token-image";async function Dd(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 Od(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 os(e,t,n=!0){let{data:o,...r}=Pd({queryKey:[Bd,e,t],queryFn:async({signal:i})=>Dd(await le("bondingCurve",e),t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:o??[],...r}}function rs(e,t,n=!0){let o=_d({queries:t.map(i=>({queryKey:[Md,e,i],queryFn:async({signal:a})=>Od(await le("bondingCurve",e),i,a),enabled:n,staleTime:1/0}))});return{imageMap:Fd(()=>{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 Wd}from"@tanstack/react-query";import{useMemo as Ud}from"react";var Jr="token-stats";function At(e,t){return`${e}:${t.toLowerCase()}`}function pn(e,t=!0){let{data:n,...o}=Wd({queryKey:[Jr,e],queryFn:async({signal:i})=>{let a=await le("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:Ud(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=At(a.chain_id,a.address);i.set(s,a)}return i},[n]),...o}}import{useQuery as zd}from"@tanstack/react-query";var Gd="crossd-apr",Hd="https://crossd-dashboard-api.crossdefi.io/api/v1/overview";function as(){let{data:e,...t}=zd({queryKey:[Gd],queryFn:async({signal:n})=>{let o=await fetch(Hd,{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 $d}from"@tanstack/react-query";import{useMemo as jd}from"react";var Vd="token-info";function ea(e,t){return`${t.toLowerCase()}_${e}`}function is(e,t=!0){let{data:n,...o}=$d({queryKey:[Vd,e],queryFn:async({signal:i})=>{let a=await le("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:jd(()=>{let i=new Map;if(!n?.data)return i;for(let a of n.data){let s=ea(a.chain_id,a.address);i.set(s,a.category)}return i},[n]),...o}}import{useMemo as qd}from"react";import ta from"bignumber.js";function ss(e,t,n){let{tokens:o,isLoading:r}=dn(e,t,n),{statsMap:i}=pn(e,n);return qd(()=>{let a=new ta(0);for(let d of o){let w=i.get(At(d.chainId,d.address));if(!w)continue;let m=new ta(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new ta(w.price));m.isNaN()||(a=a.plus(m))}let s=a.toFixed(),{displayValue:c,isLowerBound:l}=yi(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,i,r])}import{QRCodeSVG as du}from"qrcode.react";function et(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,d=w=>{if(w===null){l?.close();return}let h=w??t;if(l)try{l.location.href=h}catch{l.close(),i(h)}else i(h)};r.then(d,w=>{console.error("[dapp-ui] onOutlink rejected:",w),l?.close()});return}let s=r;if(s===null)return;i(s??t)}import*as In from"react";import{Drawer as wf}from"vaul";import{createContext as Yd,useContext as Zd,useMemo as Xd}from"react";import vt from"bignumber.js";var Kd=/^(\d{4}-\d{2}-\d{2})/;function ls(e){if(!e||e.length===0)return;let t=new Map,n;for(let{key:r,cumulative:i}of e.map(a=>({key:Kd.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 Qo(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function cs(e){return e.length<=13?e:`${e.slice(0,6)}...${e.slice(-4)}`}var Qd="0xe00e8bf3";function ds(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`${Qd}${o}${r}`}function na(e){return!e||e<=0n?"0":new vt(e.toString()).shiftedBy(-9).toFormat(2,vt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function ps(e){return!e||e<=0n?"0":new vt(e.toString()).toFormat(0,vt.ROUND_DOWN)}function fs(e){if(!e||e<=0n)return"0";let t=new vt(e.toString()).shiftedBy(-18),n=t.isLessThan(1e-4)?7:4;return t.toFormat(n,vt.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$/,"$1").replace(/\.0+$/,"")}function Pt(e,t){let n=new vt(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,vt.ROUND_DOWN):n.toFormat(4,vt.ROUND_DOWN)}function oa(e){return Pt(e,0)}var ao={rate:1,symbol:"$"};function io(e,t=ao){let n=Number.isFinite(t.rate)&&t.rate>0?t.rate:1;return`${t.symbol||"$"}${e.times(n).toFormat(2,vt.ROUND_DOWN)}`}function fn(e,t,n,o=ao){let r=new vt(n||"0");if(!r.isFinite()||r.isLessThanOrEqualTo(0))return null;let i=new vt(e||"0").shiftedBy(-t).times(r);return i.isFinite()?io(i,o):null}var so=Yd(null);function Ue(){let e=Zd(so);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}function zt(){let{conversionRatio:e,currencySymbol:t}=Ue();return Xd(()=>({rate:typeof e=="number"&&e>0?e:ao.rate,symbol:t||ao.symbol}),[e,t])}import{Drawer as Jd}from"vaul";import{jsx as us}from"react/jsx-runtime";function ms({asChild:e,children:t}){let{walletAddress:n}=Ue(),o=t!=null,r=e??!0,i=o?t:us("button",{type:"button",children:ut(n)});return us(Jd.Trigger,{asChild:r,children:i})}import{Drawer as ar}from"vaul";import*as Re from"react";import{useQueryClient as gf}from"@tanstack/react-query";import{createContext as ep,useContext as tp}from"react";var ra=ep(null);function gs(){return tp(ra)}import{jsx as mt,jsxs as Yo}from"react/jsx-runtime";function hs({size:e=22,className:t}){return mt("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:mt("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function bs({size:e=22,className:t}){return Yo("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[mt("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),mt("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 ws({size:e=16,className:t}){return Yo("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[mt("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"}),mt("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 xs({size:e=16,className:t}){return mt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:mt("path",{d:"M13.333 4L6 11.333 2.667 8",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function vs({size:e=48,className:t}){return Yo("svg",{width:e,height:e,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[mt("circle",{cx:"24",cy:"24",r:"24",fill:"currentColor"}),mt("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 _t({size:e=12,className:t}){return Yo("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:[mt("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"}),mt("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),mt("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import*as Fs from"react";import{useQuery as np}from"@tanstack/react-query";import{useMemo as ys}from"react";var op="wp:reward-pools";function zn(e,t=!0){let{data:n,...o}=np({queryKey:[op,e],queryFn:async({signal:a})=>{let s=await le("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=ys(()=>n?.data.pools.filter(a=>a.pool_type==="CrossPool")??[],[n]),i=ys(()=>n?.data.pools.filter(a=>a.pool_type==="GamePool")??[],[n]);return{crossPools:r,gamePools:i,allPools:n?.data.pools??[],...o}}import{useQuery as rp}from"@tanstack/react-query";import{useMemo as ap}from"react";var ip="wp:user-deposits";function Zo(e,t,n=!0){let o=n&&!!t,{data:r,...i}=rp({queryKey:[ip,e,t],queryFn:async({signal:s})=>{let c=await le("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 d=await l.json();if(d.code!==200)throw new Error(`Deposits API error: ${d.code}`);return d},enabled:o,staleTime:0});return{depositMap:ap(()=>{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 sp}from"@tanstack/react-query";import{useMemo as lp}from"react";var ks={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Ss={dev:"https://stg.onechain.nexus/points",stage:"https://stg.onechain.nexus/points",production:"https://www.onechain.nexus/points"};var Rs={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"};var aa={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},Cs={dev:`${aa.dev}/portfolio`,stage:`${aa.stage}/portfolio`,production:`${aa.production}/portfolio`};var Ts={dev:"https://stg.onechain.nexus",stage:"https://stg.onechain.nexus",production:"https://onechain.nexus"},Gt={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",production:"https://contents.crosstoken.io/frontend/common/app-launcher/icons"};var cp="wp:token-info";function Xo(e,t=!0){let n=Ne[e].cross,{data:o,...r}=sp({queryKey:[cp,e],queryFn:async({signal:c})=>{let l=await le("walletServer",e),d=await fetch(`${l}/v1/public/token/info`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let w=await d.json();if(w.code!==200)throw new Error(`Token info API error: ${w.code}`);return w},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:a}=lp(()=>{let c=new Map,l=new Map;if(!o?.data)return{byChainAddr:c,byChainSym:l};for(let d of o.data){let w=d.address.toLowerCase();c.set(`${d.chain_id}:${w}`,d),c.set(w,d);let h=d.symbol.replace(/^t/,"").toUpperCase(),m=`${d.chain_id}:${h}`;l.has(m)||l.set(m,d),l.has(h)||l.set(h,d)}return{byChainAddr:c,byChainSym:l}},[o]);return{getTokenImage:(c,l)=>{let d=c.toLowerCase(),w=i.get(`${n}:${d}`);if(w?.image)return w.image;let h=i.get(d);if(h?.image)return h.image;if(l){let m=l.replace(/^t/,"").toUpperCase(),y=a.get(`${n}:${m}`);if(y?.image)return y.image;let b=a.get(m);if(b?.image)return b.image}return""},...r}}import{useQuery as bp}from"@tanstack/react-query";import{useMemo as Jo}from"react";var dp="0x70a08231",pp="0x18160ddd",fp="0x313ce567",up=8e3;async function mp(e,t,n,o){let r=new AbortController,i=setTimeout(()=>r.abort(),up);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 gp(e){return e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}function lo(e){if(!(!e||e==="0x"))try{return BigInt(e)}catch{return}}async function Tn(e,t,n,o){try{return await mp(e,"eth_call",[{to:t,data:n},"latest"],o)}catch{return}}async function hp(e,t,n,o){let[r,i,a]=await Promise.all([Tn(e,n,dp+gp(t),o),Tn(e,n,pp,o),Tn(e,n,fp,o)]),s=lo(r);if(s===void 0)return null;let c=lo(a);return{balance:s,totalSupply:lo(i),decimals:c!==void 0?Number(c):void 0}}async function ia(e,t){let n=Ne[e].cross,o=await le("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 Ns(e,t,n,o){if(!t||n.length===0)return{};let r;try{r=await ia(e,o)}catch{r=void 0}if(!r)return{};let i=await Promise.all(n.map(async s=>[s.toLowerCase(),await hp(r,t,s,o)])),a={};for(let[s,c]of i)c&&(a[s]=c);return a}var wp="wp:withdraw-token-meta",xp="0xc89039c5",vp="0x95d89b41",yp="0x313ce567";function kp(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 Sp(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 Rp(e,t,n){if(t.length===0)return{};let o;try{o=await ia(e,n)}catch{o=void 0}if(!o)return{};let r=await Promise.all(t.map(async a=>{let s=Sp(await Tn(o,a,xp,n));if(!s)return[a.toLowerCase(),null];let[c,l]=await Promise.all([Tn(o,s,vp,n),Tn(o,s,yp,n)]),d=kp(c),w=lo(l);return d?[a.toLowerCase(),{tokenAddress:s,symbol:d,decimals:w!==void 0?Number(w):18}]:[a.toLowerCase(),null]})),i={};for(let[a,s]of r)s&&(i[a]=s);return i}function er(e,t,n=!0){let r=n&&!!t,{allPools:i,isLoading:a}=zn(e,r),{deposits:s,isLoading:c}=Zo(e,t,r),l=Jo(()=>{let u=new Map;for(let x of i)u.set(x.pool_address.toLowerCase(),x);return u},[i]),d=Jo(()=>s.filter(u=>{try{return BigInt(u.deposited_amount||"0")>0n}catch{return!1}}),[s]),w=Jo(()=>d.map(u=>u.pool_address.toLowerCase()).filter(u=>!l.has(u)).sort(),[d,l]),{data:h,isLoading:m}=bp({queryKey:[wp,e,w],queryFn:({signal:u})=>Rp(e,w,u),enabled:r&&w.length>0,staleTime:1440*60*1e3});return{positions:Jo(()=>{let u=[];for(let x of d){let R=x.pool_address.toLowerCase(),p=l.get(R);if(p){u.push({poolId:x.pool_id,poolAddress:x.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:x.deposited_amount});continue}let C=h?.[R];C&&u.push({poolId:x.pool_id,poolAddress:x.pool_address,poolType:"Unknown",tokenSymbol:C.symbol,tokenAddress:C.tokenAddress,decimals:C.decimals,depositedRaw:x.deposited_amount})}return u},[d,l,h]),isLoading:a||c||m}}import*as la from"react";import{jsx as sa,jsxs as Is}from"react/jsx-runtime";function Ht({sectionKey:e,title:t,icon:n,iconFit:o="cover",isEmpty:r,loading:i=!1,children:a}){let s=gs();return la.useEffect(()=>{s?.report(e,{loading:i,empty:r})},[s,e,i,r]),la.useEffect(()=>()=>s?.unregister(e),[s,e]),r?null:Is("div",{className:"wp-svc-card",children:[Is("div",{className:"wp-svc-card-head",children:[sa("img",{className:"wp-svc-card-icon",src:n,alt:"",style:{objectFit:o}}),sa("span",{className:"wp-svc-card-title",children:t})]}),sa("div",{className:"wp-svc-items",children:a})]})}import*as he from"react";import{Fragment as Ls,jsx as V,jsxs as we}from"react/jsx-runtime";var Cp=/^\d*\.?\d{0,2}$/,Tp=[100n,1000n,2000n],Np=400;function Ip(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":`${fs(e.gasLimit*n)} CROSS`}function ca(e,t,n){return n==="loading"?"Estimating...":n==="error"||n==="unavailable"?"-":`${e} ${t}`.trim()}function Es({position:e,size:t}){return e.icon?V("img",{src:e.icon,alt:"",width:t,height:t}):V("span",{children:e.tokenSymbol.slice(0,1)})}function tr({open:e,status:t,positions:n,initialPoolAddress:o,walletAddress:r,txHash:i,error:a,copied:s=!1,estimateWithdraw:c,onClose:l,onConfirm:d,onCopyHash:w,trackFunnel:h}){let[m,y]=he.useState(void 0),[b,u]=he.useState(""),[x,R]=he.useState(null),[p,C]=he.useState("idle"),k=he.useRef(0),N=he.useRef(void 0),E=he.useRef(null);he.useEffect(()=>()=>clearTimeout(N.current),[]);let T=he.useMemo(()=>{let O=(m??o)?.toLowerCase();return n.find(ee=>ee.poolAddress.toLowerCase()===O)??n[0]??null},[n,m,o]),M=he.useMemo(()=>{try{return BigInt(T?.depositedRaw??"0")}catch{return 0n}},[T?.depositedRaw]),q=T?.decimals??18,L=he.useMemo(()=>{let O=Jt(b,q);return"value"in O?O.value:null},[b,q]),K=L!==null&&L>M;he.useEffect(()=>{!e||!T||h?.("position_selected")},[e,T,h]),he.useEffect(()=>{!e||L===null||L<=0n||K||h?.("amount_entered")},[e,L,K,h]);let U=t==="confirm"&&!!T&&L!==null&&L>0n&&!K,ce=he.useCallback(()=>{u(""),R(null),C(c?"idle":"unavailable"),k.current+=1,E.current=null},[]);he.useEffect(()=>{e&&(y(o),ce())},[e]);let J=he.useCallback(O=>{t==="confirm"&&(y(O.poolAddress),ce())},[t,ce]);he.useEffect(()=>{if(!e||t!=="confirm"){clearTimeout(N.current);return}if(!c||!T){clearTimeout(N.current),C("unavailable");return}if(L===null||L<=0n||K){clearTimeout(N.current),k.current+=1,E.current=null,R(null),C("idle");return}let O=`${T.poolAddress.toLowerCase()}:${L.toString()}`;if(E.current===O)return;E.current=O,clearTimeout(N.current);let ee=k.current+1;k.current=ee,C("loading"),N.current=setTimeout(()=>{c(T,L).then(Fe=>{k.current===ee&&(R(Fe??null),C(Fe?"ready":"unavailable"))}).catch(()=>{k.current===ee&&(R(null),C("error"))})},Np)},[e,t,L,K,c,T]);let $=he.useCallback(O=>{let ee=O.target.value.replace(/,/g,"");(ee===""||Cp.test(ee))&&u(ee)},[]),ne=he.useCallback(O=>{u(no(O.toString(),q))},[q]),G=he.useCallback(O=>{let ee=10n**BigInt(q),Q=(L??0n)+O*ee;ne(Q>M?M:Q)},[L,q,M,ne]),D=he.useCallback(()=>{ne(M)},[M,ne]);if(!e||!T)return null;let ae=t==="submitting",me=na(x?.maxPriorityFeePerGas),j=na(x?.maxFeePerGas??x?.gasPrice),_e=ps(x?.gasLimit),xe=Pt(T.depositedRaw,q);return V("div",{className:"wp-claim-overlay",role:"presentation",onMouseDown:O=>{O.target===O.currentTarget&&!ae&&l()},children:we("section",{className:"wp-claim-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"wp-withdraw-title","data-status":t,"data-vaul-no-drag":!0,children:[V("div",{className:"wp-claim-grabber","aria-hidden":!0,children:V("span",{})}),we("div",{className:"wp-claim-content wp-withdraw-content",children:[t==="success"&&i?we(Ls,{children:[V("span",{className:"wp-claim-icon wp-claim-icon--success","aria-hidden":!0,children:V(vs,{})}),we("div",{className:"wp-claim-copy",children:[V("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:"Withdraw Submitted!"}),V("p",{className:"wp-claim-desc",children:"Your withdrawal request has been submitted. Balances will update shortly after the transaction settles."})]}),V("div",{className:"wp-claim-list","aria-label":"Withdraw transaction",children:we("div",{className:"wp-claim-list-item",children:[V("span",{children:"Tx Hash"}),we("button",{type:"button",className:"wp-claim-hash",onClick:w,"aria-label":"Copy transaction hash","data-track":"withdraw_hash_copy",children:[V("strong",{children:cs(i)}),s?V(xs,{}):V(ws,{})]})]})})]}):we(Ls,{children:[we("div",{className:"wp-claim-heading",children:[V("h3",{id:"wp-withdraw-title",className:"wp-claim-title",children:t==="error"?"Withdraw Failed":"Withdraw"}),t==="error"&&V("p",{className:"wp-claim-error-message",children:a||"The withdraw request could not be completed."})]}),n.length>1&&V("div",{className:"wp-withdraw-token-list",role:"listbox","aria-label":"Withdrawable tokens",children:n.map(O=>{let ee=O.poolAddress.toLowerCase()===T.poolAddress.toLowerCase();return we("button",{type:"button",role:"option","aria-selected":ee,className:"wp-withdraw-token","data-selected":ee||void 0,"data-track":"withdraw_position_select","data-track-id":O.tokenSymbol,disabled:ae,onClick:()=>J(O),children:[V("span",{className:"wp-withdraw-token-icon","aria-hidden":!0,children:V(Es,{position:O,size:28})}),V("span",{className:"wp-withdraw-token-symbol",children:O.tokenSymbol}),V("span",{className:"wp-withdraw-token-amount",children:Pt(O.depositedRaw,O.decimals)})]},O.poolAddress)})}),we("div",{className:"wp-claim-reward-card","aria-label":"Deposited balance",children:[V("span",{className:"wp-claim-reward-token","aria-hidden":!0,children:V(Es,{position:T,size:28})}),V("strong",{className:"wp-claim-reward-symbol",children:T.tokenSymbol}),V("strong",{className:"wp-claim-reward-amount",children:xe})]}),we("div",{className:"wp-withdraw-amount-card",children:[we("div",{className:"wp-withdraw-amount-row",children:[V("input",{className:"wp-withdraw-input",type:"text",inputMode:"decimal",autoComplete:"off",placeholder:"0",value:b,disabled:ae,onChange:$,"aria-label":`Withdraw amount (${T.tokenSymbol})`,"aria-invalid":K||void 0}),V("span",{className:"wp-withdraw-input-symbol",children:T.tokenSymbol})]}),K&&V("p",{className:"wp-claim-error-message",children:"Amount exceeds deposited balance."}),we("div",{className:"wp-withdraw-quick-row",role:"group","aria-label":"Quick amounts",children:[Tp.map(O=>we("button",{type:"button",className:"wp-withdraw-quick","data-track":"withdraw_quick_add",disabled:ae,onClick:()=>G(O),children:["+",O.toString()]},O.toString())),V("button",{type:"button",className:"wp-withdraw-quick","data-track":"withdraw_max",disabled:ae,onClick:D,children:"MAX"})]})]}),we("div",{className:"wp-claim-account-card","aria-label":"Withdraw gas fee",children:[we("div",{className:"wp-claim-account-row",children:[we("div",{className:"wp-claim-account",children:[V("span",{className:"wp-claim-account-avatar","aria-hidden":!0}),we("strong",{children:[T.tokenSymbol," Pool"]})]}),V("span",{children:Qo(r)})]}),V("span",{className:"wp-claim-divider","aria-hidden":!0}),we("div",{className:"wp-claim-detail-list",children:[we("div",{className:"wp-claim-detail-row",children:[V("span",{children:"Est. Tx Fee"}),V("strong",{children:Ip(x,p)})]}),we("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[V("span",{children:"Priority Fee Per Gas"}),V("strong",{children:ca(me,"Gwei",p)})]}),we("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[V("span",{children:"Max Fee Per Gas"}),V("strong",{children:ca(j,"Gwei",p)})]}),we("div",{className:"wp-claim-detail-row wp-claim-detail-row--sub",children:[V("span",{children:"Gas Limit"}),V("strong",{children:ca(_e,"",p)})]})]})]})]}),we("div",{className:"wp-claim-actions","data-count":t==="confirm"||t==="error"?2:1,children:[(t==="confirm"||t==="error")&&V("button",{type:"button",className:"wp-claim-secondary","data-track":"withdraw_cancel",onClick:l,children:t==="error"?"Close":"Cancel"}),we("button",{type:"button",className:"wp-claim-primary","data-track":"withdraw_confirm",onClick:()=>{if(t==="success"){l();return}T&&L!==null&&L>0n&&!K&&d(T,L,x)},disabled:ae||(t==="confirm"||t==="error")&&(L===null||L<=0n||K),children:[t==="success"&&"Done",t==="submitting"&&V("span",{className:"wp-claim-button-spinner","aria-label":"Waiting"}),t==="error"&&"Try Again",t==="confirm"&&"Withdraw Now"]})]})]}),V("div",{className:"wp-claim-home-indicator","aria-hidden":!0,children:V("span",{})})]})})}import*as Se from"react";import{useQueryClient as Ap}from"@tanstack/react-query";import{useQuery as Ep}from"@tanstack/react-query";var Lp="wp:reward-factory-info";function As(e,t=!0){let{data:n,...o}=Ep({queryKey:[Lp,e],queryFn:async({signal:r})=>{let i=await le("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 Pp="wp:";function Ps(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?e:null}function nr(e){let{env:t,walletAddress:n,sendTransaction:o,estimateGas:r}=Ue(),i=!!n,a=!!o,s=Ap(),{routerAddress:c}=As(t,i&&a),l=Ps(c),[d,w]=Se.useState(!1),[h,m]=Se.useState(void 0),[y,b]=Se.useState("confirm"),[u,x]=Se.useState(),[R,p]=Se.useState(""),[C,k]=Se.useState(!1),N=Se.useRef(void 0);Se.useEffect(()=>()=>clearTimeout(N.current),[]);let E=Se.useRef(new Set),T=Se.useCallback(($,ne)=>{E.current.has($)||(E.current.add($),Te("withdraw",$,{...ne,tags:{section:e,...ne?.tags}}))},[e]),M=Se.useCallback(($,ne)=>l?{to:l,value:0n,data:ds($,ne),chainId:Ne[t].cross}:null,[t,l]),q=Se.useCallback(()=>{s.invalidateQueries({predicate:$=>typeof $.queryKey[0]=="string"&&$.queryKey[0].startsWith(Pp)})},[s]),L=Se.useCallback($=>{m($),w(!0),b("confirm"),x(void 0),p(""),k(!1),E.current=new Set,T("opened")},[T]),K=Se.useCallback(()=>{y!=="submitting"&&(w(!1),m(void 0),b("confirm"),x(void 0),p(""),k(!1),y==="success"&&q())},[y,q]),U=Se.useCallback(async($,ne)=>{if(!r)return null;let G=M($.poolId,ne),D=Ps(n);return!G||!D?null:r({...G,from:D})},[M,r,n]),ce=Se.useCallback(async()=>{if(!(!u||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(u),k(!0),clearTimeout(N.current),N.current=setTimeout(()=>k(!1),1400)}catch{k(!1)}},[u]),J=Se.useCallback(async($,ne,G)=>{if(!o){b("error"),p("Withdraw is not available for this wallet.");return}if(!l){b("error"),p("Withdraw contract address is not available.");return}try{b("submitting"),p("");let D=M($.poolId,ne);if(!D){b("error"),p("Withdraw contract address is not available.");return}T("submitted");let ae=await o({...D,gas:G?.gasLimit&&G.gasLimit>0n?G.gasLimit:void 0,maxFeePerGas:G?.maxFeePerGas&&G.maxFeePerGas>0n?G.maxFeePerGas:void 0,maxPriorityFeePerGas:G?.maxPriorityFeePerGas&&G.maxPriorityFeePerGas>0n?G.maxPriorityFeePerGas:void 0});x(ae),b("success"),T("confirmed"),q()}catch(D){b("error"),p(D instanceof Error?D.message:"Failed to request withdraw."),T("confirmed",{status:"failure",reason:Nt(D)})}},[M,q,l,o,T]);return{canWithdrawInline:a,isOpen:d,initialPoolAddress:h,status:y,txHash:u,error:R,copied:C,hasEstimator:!!r,openWithdraw:L,closeWithdraw:K,estimateWithdraw:U,confirmWithdraw:J,copyHash:ce,trackFunnelOnce:T}}import da from"bignumber.js";import{Fragment as Fp,jsx as Pe,jsxs as je}from"react/jsx-runtime";var _p="CROSS Rewards";function _s(e){return new da(e||"0").isGreaterThan(0)}function Bs(){let{env:e,walletAddress:t,onOutlink:n}=Ue(),o=zt(),r=!!t,{allPools:i,isLoading:a}=zn(e,r),{depositMap:s,isLoading:c}=Zo(e,t,r),{getTokenImage:l}=Xo(e,r),d=nr("rewards"),{positions:w}=er(e,t,r&&d.canWithdrawInline),h=Fs.useMemo(()=>w.filter(u=>u.poolType==="CrossPool").map(u=>({...u,icon:l(u.tokenAddress,u.tokenSymbol)})),[w,l]),m=(u,x)=>`${ks[e]}/rewards/${u.pool_address}?action=${x}`,y=`${Gt[e]}/reward.png`,b=i.filter(u=>{let x=s.get(u.pool_address.toLowerCase()),R=x?.deposited_amount??"0",p=x?.claimable_reward??"0";return!(new da(R).isZero()&&new da(p).isZero())});return je(Fp,{children:[Pe(Ht,{sectionKey:"rewards",title:_p,icon:y,isEmpty:b.length===0,loading:a||c,children:b.map(u=>{let x=s.get(u.pool_address.toLowerCase()),R=x?.deposited_amount??"0",p=x?.claimable_reward??"0",C=m(u,"withdraw"),k=m(u,"claim"),N=l(u.deposit_token.address,u.deposit_token.symbol),E=u.reward_tokens[0],T=E?l(E.address,E.symbol):"",M=u.reward_tokens.map(G=>G.symbol),q=M.length>0?`${u.deposit_token.symbol}-${M.join("/")}`:u.deposit_token.symbol,L=E?Pt(p,E.decimals):"0",K=E?.symbol??"Reward",U=fn(R,u.deposit_token.decimals,u.deposit_token.price,o),ce=E?fn(p,E.decimals,E.price,o):null,J=!!x&&_s(p),$=!!x&&_s(R),ne=d.canWithdrawInline&&h.some(G=>G.poolAddress.toLowerCase()===u.pool_address.toLowerCase());return je("article",{className:"wp-item","data-side":"reward",children:[je("div",{className:"wp-item-body",children:[je("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),je("div",{className:"wp-svc-token",children:[je("span",{className:"wp-token-stack","aria-hidden":!0,children:[N&&Pe("img",{className:"wp-svc-token-icon",src:N,alt:""}),T&&Pe("img",{className:"wp-svc-token-icon",src:T,alt:""})]}),Pe("span",{children:q})]})]}),je("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"Deposited"}),je("div",{className:"wp-svc-token wp-svc-token--amount",children:[N&&Pe("img",{className:"wp-svc-token-icon",src:N,alt:""}),je("div",{className:"wp-svc-amount",children:[Pe("span",{className:"wp-svc-amount-main",children:Pt(R,u.deposit_token.decimals)}),U&&Pe("span",{className:"wp-item-usd",children:U})]})]})]}),je("div",{className:"wp-item-line",children:[je("span",{className:"wp-item-label",children:["Claimable (",K,")"]}),je("div",{className:"wp-svc-token wp-svc-token--amount",children:[T&&Pe("img",{className:"wp-svc-token-icon",src:T,alt:""}),je("div",{className:"wp-svc-amount",children:[Pe("span",{className:"wp-svc-amount-main",children:L}),ce&&Pe("span",{className:"wp-item-usd",children:ce})]})]})]})]}),je("div",{className:"wp-item-tags",children:[ne?Pe("button",{type:"button",className:"wp-tag wp-tag--muted","data-disabled":!$||void 0,"aria-disabled":!$||void 0,"data-track":"rewards_withdraw_open",onClick:()=>{$&&d.openWithdraw(u.pool_address)},children:Pe("span",{className:"wp-tag-label",children:"Withdraw"})}):je("a",{className:"wp-tag wp-tag--muted",href:C,target:"_blank",rel:"noopener noreferrer","data-track":"rewards_withdraw_open",onClick:G=>et(G,C,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:x}},n),children:[Pe("span",{className:"wp-tag-label",children:"Withdraw"}),Pe(_t,{size:12,className:"wp-tag-icon"})]}),je("a",{className:"wp-tag wp-tag--mint","data-disabled":!J||void 0,"aria-disabled":!J||void 0,href:J?k:void 0,target:J?"_blank":void 0,rel:J?"noopener noreferrer":void 0,onClick:G=>{if(!J){G.preventDefault();return}et(G,k,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:u,userDeposit:x}},n)},children:[Pe("span",{className:"wp-tag-label",children:"Claim"}),Pe(_t,{size:12,className:"wp-tag-icon"})]})]})]},u.pool_address)})}),Pe(tr,{open:d.isOpen,status:d.status,positions:h,initialPoolAddress:d.initialPoolAddress,walletAddress:t,txHash:d.txHash,error:d.error,copied:d.copied,estimateWithdraw:d.hasEstimator?d.estimateWithdraw:void 0,onClose:d.closeWithdraw,onConfirm:d.confirmWithdraw,onCopyHash:d.copyHash,trackFunnel:d.trackFunnelOnce})]})}import*as Ms from"react";import{Fragment as Mp,jsx as st,jsxs as tn}from"react/jsx-runtime";var Bp="Points";function Ds(){let{env:e,walletAddress:t,onOutlink:n}=Ue(),o=zt(),r=!!t,{getTokenImage:i}=Xo(e,r),a=nr("points"),{positions:s,isLoading:c}=er(e,t,r),l=Ms.useMemo(()=>s.filter(h=>h.poolType!=="CrossPool").map(h=>({...h,icon:i(h.tokenAddress,h.tokenSymbol)})),[s,i]),d=`${Gt[e]}/point.png`,w=Ss[e];return tn(Mp,{children:[st(Ht,{sectionKey:"points",title:Bp,icon:d,isEmpty:l.length===0,loading:c,children:l.map(h=>{let m=h.price?fn(h.depositedRaw,h.decimals,h.price,o):null;return tn("article",{className:"wp-item","data-side":"reward",children:[tn("div",{className:"wp-item-body",children:[tn("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"Token"}),tn("div",{className:"wp-svc-token",children:[h.icon&&st("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),st("span",{children:h.tokenSymbol})]})]}),tn("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"Deposited"}),tn("div",{className:"wp-svc-token wp-svc-token--amount",children:[h.icon&&st("img",{className:"wp-svc-token-icon",src:h.icon,alt:""}),tn("div",{className:"wp-svc-amount",children:[st("span",{className:"wp-svc-amount-main",children:Pt(h.depositedRaw,h.decimals)}),m&&st("span",{className:"wp-item-usd",children:m})]})]})]})]}),st("div",{className:"wp-item-tags",children:a.canWithdrawInline?st("button",{type:"button",className:"wp-tag wp-tag--muted","data-track":"points_withdraw_open",onClick:()=>a.openWithdraw(h.poolAddress),children:st("span",{className:"wp-tag-label",children:"Withdraw"})}):tn("a",{className:"wp-tag wp-tag--muted",href:w,target:"_blank",rel:"noopener noreferrer","data-track":"points_withdraw_open",onClick:y=>et(y,w,{category:"portfolio",origin:"portfolio-points",payload:{position:h}},n),children:[st("span",{className:"wp-tag-label",children:"Withdraw"}),st(_t,{size:12,className:"wp-tag-icon"})]})})]},h.poolAddress)})}),st(tr,{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 pa from"react";import{useQuery as Dp}from"@tanstack/react-query";var Op="wp:stake-info";function Os(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Dp({queryKey:[Op,e,t],queryFn:async({signal:s})=>{let c=await le("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 d=await l.json();if(d.code!==0&&d.code!==200)throw new Error(`Stake info API error: ${d.code}`);return d},enabled:o,staleTime:0});return{stakeInfo:r?.data,...i}}import{useQuery as Wp}from"@tanstack/react-query";var Up="wp:stake-rewards",zp=31;function Ws(e,t,n=!0){let o=n&&!!t,{data:r,...i}=Wp({queryKey:[Up,e,t],queryFn:async({signal:a})=>{let s=await le("posa",e),c=await fetch(`${s}/rewards/${t}?limit=${zp}`,{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:ls(r),...i}}import{useQuery as Gp}from"@tanstack/react-query";var Hp="wp:staking-onchain";function Us(e,t,n=!0){let o=n&&!!t&&!!e,{data:r,...i}=Gp({queryKey:[Hp,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 zs}from"react";import $p from"bignumber.js";function Gs(e){return e?.trim().toUpperCase()==="CROSS"}function Hs(e){return new $p(e||"0").isGreaterThan(0)}function or(e,t,n=!0){let{allPools:o}=zn(e,n),r=zs(()=>{for(let l of o)for(let d of[l.deposit_token,...l.reward_tokens])if(Gs(d?.symbol)&&Hs(d.price))return d.price},[o]),i=n&&r===void 0,{tokens:a}=dn(e,t,i),{statsMap:s}=pn(e,i),c=Ne[e].cross;return zs(()=>{if(r)return r;let l=a.find(d=>d.chainId===c&&Gs(d.symbol));if(l){let d=s.get(At(l.chainId,l.address));if(d&&Hs(d.price))return d.price}return"0"},[r,a,s,c])}import un from"bignumber.js";import{jsx as $t,jsxs as jt}from"react/jsx-runtime";var jp="CROSS Staking";function Vp(e){if(!e)return"\u2014";let t=new un(e);return t.isFinite()?`${t.toFormat(2,un.ROUND_DOWN)}%`:"\u2014"}function $s(){let{env:e,walletAddress:t,onOutlink:n,stakingRewardsReader:o}=Ue(),r=zt(),i=!!t,{stakeInfo:a,isLoading:s}=Os(e,t,i),{latestReward:c,aprAccrued:l,isLoading:d}=Ws(e,t,i),{onchain:w}=Us(t,o,i),h=or(e,t,i),m=`${Gt[e]}/cross-staking.png`,y=Cs[e],b=a?.total_stake??"0",u=pa.useMemo(()=>w?new un(w.earnedWei.toString()).shiftedBy(-18).toString(10):c?.cumulative_earned??a?.rewards_earned??"0",[w,c,a]),x=pa.useMemo(()=>w?new un(w.stakedWei.toString()).shiftedBy(-18):new un(b),[w,b]),R=l!==void 0?new un(l):void 0,p=a?.days_since_first_stake,C=R!==void 0&&R.isFinite()&&x.isGreaterThan(0)&&p!==null&&p!==void 0?R.div(x).times(365).div(Math.max(1,p)).times(100):void 0,k=!(new un(b).isZero()&&new un(u).isZero()),N=fn(b,0,h,r),E=fn(u,0,h,r);return $t(Ht,{sectionKey:"staking",title:jp,icon:m,iconFit:"contain",isEmpty:!k,loading:s||d,children:jt("article",{className:"wp-item","data-side":"stake",children:[jt("div",{className:"wp-item-body",children:[jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"Staked"}),jt("div",{className:"wp-svc-amount",children:[jt("span",{className:"wp-svc-amount-main",children:[oa(b)," CROSS"]}),N&&$t("span",{className:"wp-item-usd",children:N})]})]}),jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"Rewards Earned"}),jt("div",{className:"wp-svc-amount",children:[jt("span",{className:"wp-svc-amount-main",children:[oa(u)," CROSS"]}),E&&$t("span",{className:"wp-item-usd",children:E})]})]}),jt("div",{className:"wp-item-line",children:[$t("span",{className:"wp-item-label",children:"My APR"}),$t("span",{children:Vp(C?.toString(10))})]})]}),$t("div",{className:"wp-item-tags",children:jt("a",{className:"wp-tag wp-tag--mint",href:y,target:"_blank",rel:"noopener noreferrer","data-track":"stake_outlink",onClick:T=>et(T,y,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:a}},n),children:[$t("span",{className:"wp-tag-label",children:"Manage"}),$t(_t,{size:12,className:"wp-tag-icon"})]})})]})})}import*as fa from"react";import{useQuery as qp}from"@tanstack/react-query";var Kp="wp:game-swap-pools";function js(e,t,n=!0){let o=n&&!!t,{data:r,...i}=qp({queryKey:[Kp,e,t],queryFn:async({signal:a})=>{let s=await le("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 Qp}from"@tanstack/react-query";var Yp="wp:game-swap-lp-balances";function Vs(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),i=!!t&&r.length>0,{data:a,...s}=Qp({queryKey:[Yp,e,t,r,!!o],queryFn:async({signal:c})=>{let l=o?await o(r):await Ns(e,t,r,c),d={};for(let[w,h]of Object.entries(l))d[w.toLowerCase()]=h;return d},enabled:i,staleTime:0});return{balances:a??{},...s}}import nn from"bignumber.js";import{jsx as yt,jsxs as Ft}from"react/jsx-runtime";var Zp="Gametoken LP",Ks=18,Xp=new nn("0.0001");function qs(e){return e?.trim().toUpperCase()==="CROSS"}function Jp(e){return e&&e>0?e:Ks}function ef(e){let t=qs(e.token_a?.symbol)&&!qs(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Jp(t?e.token_a?.decimals:e.token_b?.decimals),r=new nn(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new nn(0):r.times(2)}function tf(e,t,n){let o=e.token_a?.symbol?.trim()||"TOKEN",r=e.token_b?.symbol?.trim()||"CROSS",i=t?.decimals??Ks,a,s;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let c=new nn(t.balance.toString()),l=new nn(t.totalSupply.toString()),d=c.div(l);a=d.times(100);let w=d.times(ef(e));if(w.isGreaterThan(0)){let h=new nn(e.quote_usd??e.cross_usd??"0");s=h.isGreaterThan(0)?io(w.times(h),n):`${w.toFormat(4,nn.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:o,tokenBSymbol:r,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:i,sharePercent:a,valueText:s}}function Qs(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=Ue(),r=zt(),i=!!t,{pools:a,isLoading:s}=js(e,t,i),c=fa.useMemo(()=>a.map(b=>b.pair_address).filter(Boolean),[a]),{balances:l,isLoading:d}=Vs(e,t,c,o),w=`${Gt[e]}/dex.png`,h=Object.keys(l).length>0,m=fa.useMemo(()=>{let b=a.map(u=>tf(u,l[u.pair_address?.toLowerCase()],r));return h?b.filter(u=>u.lpAmountRaw?new nn(u.lpAmountRaw).shiftedBy(-u.lpDecimals).isGreaterThanOrEqualTo(Xp):!1):b},[a,l,h,r]),y=b=>{let u=b.token_a?.address??b.pair_address;return`${Ts[e]}/tokens/${u}?trade=deposit`};return yt(Ht,{sectionKey:"gameSwap",title:Zp,icon:w,iconFit:"contain",isEmpty:m.length===0,loading:s||d,children:m.map(b=>{let{pool:u}=b,x=y(u),R=`${b.tokenASymbol} / ${b.tokenBSymbol}`,p=u.token_a?.logo_url,C=u.token_b?.logo_url;return Ft("article",{className:"wp-item","data-side":"game-swap",children:[Ft("div",{className:"wp-item-body",children:[Ft("div",{className:"wp-item-line",children:[yt("span",{className:"wp-item-label",children:"Pool"}),Ft("div",{className:"wp-svc-token",children:[Ft("span",{className:"wp-token-stack","aria-hidden":!0,children:[p&&yt("img",{className:"wp-svc-token-icon",src:p,alt:""}),C&&yt("img",{className:"wp-svc-token-icon",src:C,alt:""})]}),yt("span",{children:R})]})]}),b.lpAmountRaw!==void 0&&Ft("div",{className:"wp-item-line",children:[yt("span",{className:"wp-item-label",children:"My LP"}),Ft("span",{children:[Pt(b.lpAmountRaw,b.lpDecimals)," LP"]})]}),b.sharePercent!==void 0&&Ft("div",{className:"wp-item-line",children:[yt("span",{className:"wp-item-label",children:"Pool Share"}),Ft("span",{children:[b.sharePercent.toFormat(2,nn.ROUND_DOWN),"%"]})]}),b.valueText!==void 0&&Ft("div",{className:"wp-item-line",children:[yt("span",{className:"wp-item-label",children:"Value"}),yt("span",{children:b.valueText})]})]}),yt("div",{className:"wp-item-tags",children:Ft("a",{className:"wp-tag wp-tag--mint",href:x,target:"_blank",rel:"noopener noreferrer","data-track":"gameswap_outlink","data-track-id":R,onClick:k=>et(k,x,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:u}},n),children:[yt("span",{className:"wp-tag-label",children:"Manage"}),yt(_t,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}import Nn from"bignumber.js";import{useMemo as cf}from"react";import{useQuery as nf}from"@tanstack/react-query";var of="wp:forge-pools";function Ys(e,t,n=!0){let o=n&&!!t,{data:r,...i}=nf({queryKey:[of,e,t],queryFn:async()=>{let s=await le("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 rf}from"@tanstack/react-query";import{useMemo as af}from"react";var sf="wp:forge-token-detail";async function lf(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function Zs(e,t,n=!0){let o=rf({queries:t.map(a=>({queryKey:[sf,e,a],queryFn:async()=>lf(await le("bondingCurve",e),a),enabled:n&&!!a,staleTime:3e4}))}),r=af(()=>{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 lt,jsxs as mn}from"react/jsx-runtime";var df="Forge",Xs=18,pf="https://contents.crosstoken.io/wallet/token/images/FT.png";function ff(e){if(!e||e==="0")return"0";let t=new Nn(e).shiftedBy(-Xs);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Nn.ROUND_DOWN):t.toFormat(4,Nn.ROUND_DOWN)}function uf(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 mf(e,t,n,o){let r=new Nn(n||"0");if(!r.isGreaterThan(0))return null;let i=new Nn(e.total_supply||"0"),a=new Nn(e.lp_balance||"0"),s=new Nn(t?.reserve_b||"0").shiftedBy(-Xs);if(!i.isGreaterThan(0)||!a.isGreaterThan(0)||!s.isGreaterThan(0))return null;let c=s.times(2),d=a.div(i).times(c).times(r);return d.isFinite()?io(d,o):null}function Js(){let{env:e,walletAddress:t,onOutlink:n}=Ue(),o=zt(),r=!!t,{pools:i,isEmpty:a,isLoading:s}=Ys(e,t,r),c=cf(()=>i.map(m=>m.token.address),[i]),{detailMap:l}=Zs(e,c,r&&c.length>0),d=or(e,t,r),w=m=>`${Rs[e]}/forge/token/${m.token.address}`,h=`${Gt[e]}/forge.png`;return lt(Ht,{sectionKey:"forge",title:df,icon:h,iconFit:"contain",isEmpty:a,loading:s,children:i.map(m=>{let y=l.get(m.token.address.toLowerCase()),b=y?.image_url||y?.image||m.token.image||pf,u=y?.symbol||m.token.symbol,x=w(m),R=mf(m,y,d,o);return mn("a",{className:"wp-item","data-side":"lp",href:x,target:"_blank",rel:"noopener noreferrer","data-track":"forge_outlink","data-track-id":u,onClick:p=>et(p,x,{category:"portfolio",origin:"portfolio-forge",payload:{pool:m,tokenDetail:y}},n),children:[mn("div",{className:"wp-item-body",children:[mn("div",{className:"wp-item-line",children:[lt("span",{className:"wp-item-label",children:"Asset"}),mn("div",{className:"wp-svc-token",children:[lt("img",{className:"wp-svc-token-icon",src:b,alt:""}),lt("span",{children:u}),y?.name&&lt("span",{className:"wp-token-subtle",children:y.name})]})]}),mn("div",{className:"wp-item-line",children:[lt("span",{className:"wp-item-label",children:"LP Balance"}),lt("div",{className:"wp-svc-token wp-svc-token--amount",children:mn("div",{className:"wp-svc-amount",children:[lt("span",{className:"wp-svc-amount-main",children:ff(m.lp_balance)}),R&&lt("span",{className:"wp-item-usd",children:R})]})})]}),mn("div",{className:"wp-item-line",children:[lt("span",{className:"wp-item-label",children:"Ownership"}),lt("span",{className:"wp-line-value",children:uf(m.pool_ownership)})]})]}),lt("div",{className:"wp-item-tags",children:mn("span",{className:"wp-tag wp-tag--muted",children:[lt("span",{className:"wp-tag-label",children:"Withdraw"}),lt(_t,{size:12,className:"wp-tag-icon"})]})})]},m.pair_address)})})}var rr=["rewards","points","staking","gameSwap","forge"];Y(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--ds-bg-default, #202530);--wp-header-bg: var(--ds-surface-default, #252b39);--wp-card: var(--ds-surface-medium, #252b39);--wp-control: #292f40;--wp-border: var(--ds-border-default, #292f40);--wp-panel-border: var(--ds-border-medium, rgba(255, 255, 255, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .28);--wp-text: var(--ds-content-highest, #ffffff);--wp-text-60: var(--ds-content-high, rgba(255, 255, 255, .85));--wp-text-40: var(--ds-content-medium, rgba(255, 255, 255, .65));--wp-text-30: var(--ds-content-low, rgba(255, 255, 255, .4));--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, rgba(0, 160, 162, .14));--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #9b8cef;--wp-claim-primary-text: #202530;--wp-claim-secondary-bg: var(--wp-control);--wp-claim-success: #00d4aa;--wp-claim-success-soft: rgba(0, 212, 170, .18);--wp-claim-error: #ff3aa3;--wp-claim-error-soft: rgba(255, 58, 163, .16)}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--ds-bg-dim, #f5f7fa);--wp-header-bg: var(--ds-surface-default, #ffffff);--wp-card: var(--ds-surface-default, #ffffff);--wp-control: var(--ds-surface-medium, #f5f7fa);--wp-border: var(--ds-border-default, rgba(0, 0, 0, .07));--wp-panel-border: var(--ds-border-medium, rgba(0, 0, 0, .18));--wp-panel-shadow: 0px 4px 30px -1px rgba(0, 0, 0, .15);--wp-text: var(--ds-content-highest, #000000);--wp-text-60: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-text-40: var(--ds-content-medium, rgba(0, 0, 0, .65));--wp-text-30: var(--ds-content-low, rgba(0, 0, 0, .4));--wp-chrome-text: var(--ds-content-high, rgba(0, 0, 0, .85));--wp-card-shadow: none;--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: var(--ds-accent-primary-default, #00a0a2);--wp-green: var(--ds-accent-primary-default, #00a0a2);--wp-accent-soft: var(--ds-accent-primary-low, #e7f9f8);--wp-red: var(--ds-system-red-default, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;position:relative;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-chrome-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:73px;padding:24px;position:relative;border-bottom:1px solid var(--wp-border);background:var(--wp-header-bg);color:var(--wp-chrome-text);flex-shrink:0;box-sizing:border-box}.wp-fullscreen .wp-header{height:60px;min-height:60px;padding:11px 20px;border-bottom:none;background:transparent}.wp-fullscreen .wp-header-btn{width:22px;height:22px;color:var(--wp-chrome-text)}.wp-fullscreen .wp-header-btn:hover{color:var(--wp-chrome-text)}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--ds-content-low, rgba(0, 0, 0, .4));flex-shrink:0;transition:color .15s ease}.wp-header-btn:hover{color:var(--ds-content-high, rgba(0, 0, 0, .85))}.wp-header-edge{display:flex;align-items:center;width:24px;min-width:24px}.wp-header-edge--right{justify-content:flex-end}.wp-header-edge--right .wp-header-btn{position:absolute;top:24px;right:24px}.wp-header-spacer{display:block;width:24px;height:24px}.wp-header-avatar{width:38px;height:38px;flex-shrink:0;border-radius:50%;overflow:hidden;display:inline-flex;align-items:center;justify-content:center;background:var(--wp-header-avatar-bg)}.wp-header-avatar-img{width:30px;height:30px;object-fit:cover;display:block}.wp-fullscreen[data-theme=dark] .wp-header-avatar,.wp-embed[data-theme=dark] .wp-header-avatar{--wp-header-avatar-bg: hsl(221.3 24.6% 25.5%)}.wp-fullscreen[data-theme=light] .wp-header-avatar,.wp-embed[data-theme=light] .wp-header-avatar{--wp-header-avatar-bg: rgba(18, 18, 18, .1)}.wp-refresh-btn{position:relative}.wp-refresh-badge{position:absolute;top:-6px;right:-8px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--wp-mint);color:#fff;font-size:10px;font-weight:600;line-height:16px;text-align:center}.wp-spin-once{animation:wp-spin-once .6s ease-in-out}@keyframes wp-spin-once{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wp-header-title{flex:1;font-family:inherit;font-size:18px;font-weight:600;line-height:1.5;letter-spacing:-.01em;text-align:center;color:var(--ds-content-highest, #000000);margin:0}.wp-header-account{flex:1;display:flex;align-items:center;gap:12px;min-width:0}.wp-header-account-meta{display:flex;flex-direction:column;justify-content:center;min-width:0;gap:2px}.wp-header-wallet-name{min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:1.4;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-btn{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;padding:0;border:0;background:transparent;cursor:pointer;font:inherit}.wp-header-address{min-width:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-header-address-copy{display:inline-flex;align-items:center;flex-shrink:0;color:var(--wp-text-40);transition:color .15s ease}.wp-header-address-btn:hover .wp-header-address-copy{color:var(--wp-text-60)}.wp-header-address-copy[data-copied=true]{color:var(--wp-mint)}.wp-top{flex-shrink:0;padding:0 16px 16px;display:flex;flex-direction:column;gap:16px}.wp-identity{display:flex;flex-direction:column;gap:8px}.wp-address{display:inline-flex;align-items:center;gap:8px}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40)}.wp-total{font-size:28px;font-weight:600;line-height:1.3;color:var(--wp-text);margin:0}.wp-asset{display:flex;flex-direction:column;gap:8px}.wp-asset-head{display:flex;align-items:center;gap:4px}.wp-asset-head-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-asset-head-icon{display:inline-flex;color:var(--wp-text-40)}.wp-bar{display:flex;height:20px;border-radius:4px;overflow:hidden}.wp-bar-seg{display:flex;align-items:center;justify-content:center;min-width:8px}.wp-bar-seg-pct{font-size:10px;font-weight:400;line-height:1.3;color:#fff;white-space:nowrap}.wp-legend{display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap}.wp-legend-item{display:flex;align-items:center;gap:4px}.wp-legend-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.wp-legend-label{font-size:12px;font-weight:400;line-height:1.4;color:var(--wp-text-40)}.wp-tabs{flex-shrink:0;padding:8px 16px}.wp-tabs-inner{display:flex;align-items:center;padding:0 2px}.wp-tabs-list{display:flex;gap:20px;flex:1}.wp-tab{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:44px;padding-top:12px;background:transparent;border:none;cursor:pointer}.wp-tab-text{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text-30);white-space:nowrap}.wp-tab[data-active=true] .wp-tab-text{color:var(--wp-mint)}.wp-tab-bar{width:20px;height:4px;border-radius:2px;background:var(--wp-mint);opacity:0}.wp-tab[data-active=true] .wp-tab-bar{opacity:1}.wp-tabs-filter-wrap{position:relative;display:flex;align-items:center;width:44px;height:44px;flex-shrink:0}.wp-tabs-filter-grad{position:absolute;inset:0;background:linear-gradient(to left,var(--wp-bg) 74%,transparent);pointer-events:none}.wp-tabs-filter{position:relative;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text-40)}.wp-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wp-border) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:var(--wp-border);border-radius:4px}.wp-body-inner{padding:16px 16px 32px;display:flex;flex-direction:column;gap:32px}.wp-fullscreen .wp-body-inner{padding-top:8px;gap:24px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-summary-head{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:4px}.wp-summary-label{font-size:14px;font-weight:400;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address{display:inline-flex;align-items:center;gap:8px;min-width:0}.wp-address-avatar{width:16px;height:16px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 68% 34%,#ff78d1 0 18%,transparent 19%),radial-gradient(circle at 34% 66%,#00d4aa 0 20%,transparent 21%),linear-gradient(135deg,#7346f3,#0488fc)}.wp-address-label{font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-address-chevron{display:inline-flex;align-items:center;color:var(--wp-text-40);flex-shrink:0}.wp-summary-badge{display:inline-flex;align-items:center;justify-content:center;padding:4px 8px;border-radius:999px;background:#019d921a;color:var(--wp-mint);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;white-space:nowrap}.wp-summary-estimate{position:relative;display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.wp-estimate-info{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--wp-text-40);cursor:help}.wp-estimate-tooltip{position:absolute;top:calc(100% + 8px);left:0;right:auto;z-index:3;display:flex;flex-direction:column;gap:8px;width:min(280px,calc(100vw - 48px));padding:12px;border-radius:8px;background:var(--wp-tooltip-bg);box-shadow:0 12px 32px #0000003d;color:var(--wp-tooltip-text);font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(-4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-estimate-tooltip-title{display:block;font-size:12px;font-weight:600;line-height:1.3}.wp-estimate-tooltip-group{display:flex;flex-direction:column;gap:4px}.wp-estimate-tooltip-item{display:block;color:#ffffffc7}.wp-estimate-tooltip-item:before{content:"- "}.wp-estimate-info:hover .wp-estimate-tooltip,.wp-estimate-info:focus .wp-estimate-tooltip,.wp-estimate-info:focus-visible .wp-estimate-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-total{font-family:var( --wp-total-font-family, Sora, Inter, system-ui, -apple-system, sans-serif );font-size:36px;font-weight:600;line-height:1.25;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px;width:100%}.wp-svc-card-head{display:flex;align-items:center;gap:6px}.wp-svc-card-icon{width:24px;height:24px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border-radius:0;background:transparent;box-shadow:none;box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:20px;width:100%;padding:12px;border-radius:12px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:12px;border-top:0}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:12px;min-width:0}.wp-order-head{display:flex;align-items:center;width:100%}.wp-item-line{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:21px;min-width:0}.wp-item-label{flex-shrink:0;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-30);white-space:nowrap}.wp-line-value,.wp-order-side{min-width:0;overflow:hidden;font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-order-side--buy{color:var(--wp-mint)}.wp-order-side--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;min-height:21px}.wp-svc-token>span{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:16px;height:16px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-token--amount{align-items:flex-start}.wp-svc-token--amount>.wp-svc-token-icon{margin-top:2.5px}.wp-token-stack{display:inline-flex;align-items:center;justify-content:flex-end;width:29px;min-width:29px;overflow:visible}.wp-token-stack .wp-svc-token-icon+.wp-svc-token-icon{margin-left:-3.5px}.wp-token-subtle,.wp-item-usd{color:var(--wp-text-30)!important}.wp-svc-amount{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:1px;min-width:0}.wp-svc-amount-main{font-size:14px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--wp-text-60);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.wp-svc-amount .wp-item-usd{font-size:12px;font-weight:500;line-height:1.35}.wp-order-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-order-token .wp-svc-token-icon{width:32px;height:32px}.wp-order-token-meta{display:flex;min-width:0;flex-direction:column;justify-content:center}.wp-order-token-symbol{overflow:hidden;color:var(--wp-text-60);font-size:14px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-order-token-pair{overflow:hidden;color:var(--wp-text-30);font-size:12px;font-weight:500;line-height:1.5;text-overflow:ellipsis;white-space:nowrap}.wp-item-tags{display:flex;align-items:stretch;gap:8px;width:100%}.wp-tag{appearance:none;display:inline-flex;flex:1 1 0;align-items:center;justify-content:center;gap:0;min-width:0;min-height:33px;padding:6px 10px;border-radius:6px;border:0;background:var(--wp-control);font-family:inherit;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:0;color:var(--wp-text-40);text-align:center;text-decoration:none;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .15s ease}a.wp-tag,button.wp-tag{cursor:pointer}.wp-tag:hover{background:var(--wp-control);transform:none}.wp-tag:focus-visible{outline:2px solid var(--wp-mint);outline-offset:2px}.wp-tag[aria-disabled=true],.wp-tag[data-disabled]{cursor:default;opacity:.48;pointer-events:none}.wp-tag-label{display:inline-flex;align-items:center}.wp-tag-icon{display:none}.wp-tag:hover .wp-tag-icon{transform:none}.wp-tag--mint{color:var(--wp-mint);background:var(--wp-accent-soft)}.wp-tag--mint:hover{background:var(--wp-accent-soft)}.wp-tag--muted{color:var(--wp-text-40)}.wp-body-inner[data-empty]{min-height:100%;box-sizing:border-box;justify-content:center}.wp-portfolio-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:280px;padding:32px 24px;text-align:center}.wp-portfolio-empty-icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;margin-bottom:6px;border-radius:50%;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);color:var(--wp-text-30)}.wp-portfolio-empty-title{margin:0;font-size:15px;font-weight:600;line-height:1.3;color:var(--wp-text-60)}.wp-portfolio-empty-desc{margin:0;font-size:13px;font-weight:400;line-height:1.4;color:var(--wp-text-30)}.wp-portfolio-loading{display:flex;align-items:center;justify-content:center;min-height:280px;padding:32px 24px}.wp-portfolio-spinner{width:22px;height:22px;border:2px solid var(--wp-border);border-top-color:var(--wp-mint);border-radius:50%;animation:wp-claim-spin .8s linear infinite}.wp-claim-overlay{position:absolute;inset:0;z-index:8;display:flex;align-items:flex-end;justify-content:center;background:#00000094;box-sizing:border-box}.wp-claim-sheet{display:flex;flex-direction:column;width:100%;max-width:375px;max-height:calc(100% - 24px);overflow:hidden;border-radius:24px 24px 0 0;background:var(--wp-bg);color:var(--wp-text);box-shadow:0 -18px 48px #00000042;animation:wp-claim-slide-up .22s ease-out}@keyframes wp-claim-slide-up{0%{transform:translateY(18px);opacity:0}to{transform:translateY(0);opacity:1}}.wp-claim-grabber{display:flex;align-items:flex-start;justify-content:center;height:38px;min-height:38px;padding-top:12px;box-sizing:border-box}.wp-claim-grabber span{display:block;width:52px;height:5px;border-radius:999px;background:var(--wp-control)}.wp-claim-content{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;padding:20px;box-sizing:border-box}.wp-claim-icon{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:50%;flex-shrink:0}.wp-claim-icon--success{background:var(--wp-claim-success-soft);color:var(--wp-claim-success)}.wp-claim-icon--pending{background:#9b8cef29;color:var(--wp-claim-primary)}.wp-claim-icon--error{background:var(--wp-claim-error-soft);color:var(--wp-claim-error);font-size:30px;font-weight:600;line-height:1}.wp-claim-icon--token{background:#00d4aa29}.wp-claim-icon--token img{width:48px;height:48px;border-radius:50%;object-fit:cover}.wp-claim-icon--token span{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--wp-mint);color:#101820;font-size:18px;font-weight:600}.wp-claim-spinner{width:36px;height:36px;border-radius:50%;border:3px solid rgba(155,140,239,.28);border-top-color:var(--wp-claim-primary);animation:wp-claim-spin .8s linear infinite}@keyframes wp-claim-spin{to{transform:rotate(360deg)}}.wp-claim-copy{display:flex;flex-direction:column;align-items:center;gap:16px;width:100%;text-align:center}.wp-claim-title{margin:0;font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text)}.wp-claim-desc{max-width:335px;margin:0;font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-40)}.wp-claim-heading{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}.wp-claim-error-message{margin:0;color:var(--wp-claim-error);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0}.wp-claim-reward-card{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:60px;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-reward-token{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-claim-reward-token img{width:28px;height:28px;object-fit:cover}.wp-claim-reward-token span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-claim-reward-symbol{flex:1 1 auto;min-width:0;overflow:hidden;color:var(--wp-text);font-size:18px;font-weight:600;line-height:1.3;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-reward-amount{flex-shrink:0;color:var(--wp-text);font-size:20px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-account-row{display:flex;align-items:center;justify-content:space-between;gap:4px;width:100%;min-height:40px}.wp-claim-account-row>span{flex-shrink:0;color:var(--wp-text-40);font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-account{display:flex;align-items:center;gap:8px;min-width:0}.wp-claim-account strong{overflow:hidden;color:var(--wp-text);font-size:15px;font-weight:600;line-height:1.6;letter-spacing:0;text-overflow:ellipsis;white-space:nowrap}.wp-claim-account-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;background:radial-gradient(circle at 30% 28%,#d87aff 0 12%,transparent 13%),radial-gradient(circle at 68% 28%,#f0a1ff 0 12%,transparent 13%),radial-gradient(circle at 32% 70%,#b561e7 0 13%,transparent 14%),radial-gradient(circle at 70% 70%,#d4a2ff 0 13%,transparent 14%),radial-gradient(circle at 50% 50%,#8c4fc4 0 18%,transparent 19%),#4a315f;box-shadow:inset 0 0 0 3.37px var(--wp-control)}.wp-claim-divider{display:block;width:100%;height:1px;background:var(--wp-border)}.wp-claim-detail-list{display:flex;flex-direction:column;gap:8px;width:100%}.wp-claim-detail-row{display:flex;align-items:center;justify-content:space-between;gap:20px;width:100%;min-height:20px}.wp-claim-detail-row>span{min-width:0;color:var(--wp-text-40);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;white-space:nowrap}.wp-claim-detail-row--sub>span:before{content:"";display:inline-block;width:3px;height:3px;margin:0 8px 3px;background:currentColor}.wp-claim-detail-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list{display:flex;flex-direction:column;gap:8px;width:100%;padding-bottom:8px}.wp-claim-list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-claim-list-item>span{flex-shrink:0;font-size:14px;font-weight:400;line-height:1.3;color:var(--wp-text-40);white-space:nowrap}.wp-claim-list-item strong{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;overflow:hidden;color:var(--wp-text);font-size:14px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-list-item img{width:16px;height:16px;border-radius:50%;flex-shrink:0}.wp-claim-hash{appearance:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);cursor:pointer;font:inherit}.wp-claim-hash svg{flex-shrink:0;color:var(--wp-text-60)}.wp-claim-gas-card{display:flex;flex-direction:column;gap:4px;width:100%;padding:14px 16px;border-radius:8px;border:1px solid var(--wp-border);background:var(--wp-card);box-sizing:border-box}.wp-claim-gas-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:28px}.wp-claim-gas-row>span{min-width:0;font-size:12px;font-weight:400;line-height:1.3;color:var(--wp-text-40)}.wp-claim-gas-row strong{min-width:0;overflow:hidden;color:var(--wp-text);font-size:12px;font-weight:400;line-height:1.3;text-align:right;text-overflow:ellipsis;white-space:nowrap}.wp-claim-gas-row--primary{min-height:32px}.wp-claim-gas-row--primary>span,.wp-claim-gas-row--primary strong{font-size:14px;color:var(--wp-text)}.wp-claim-fee-label{position:relative;display:inline-flex;align-items:center;text-decoration:underline dotted;text-underline-offset:3px;cursor:help;overflow:visible!important}.wp-claim-fee-tooltip{position:absolute;left:0;bottom:calc(100% + 8px);z-index:2;width:min(260px,calc(100vw - 64px));padding:10px 12px;border-radius:8px;background:var(--wp-tooltip-bg);color:var(--wp-tooltip-text);box-shadow:0 12px 32px #0000003d;font-size:11px;font-weight:400;line-height:1.4;text-align:left;text-decoration:none;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease}.wp-claim-fee-label:hover .wp-claim-fee-tooltip,.wp-claim-fee-label:focus .wp-claim-fee-tooltip,.wp-claim-fee-label:focus-visible .wp-claim-fee-tooltip{opacity:1;transform:translateY(0);visibility:visible}.wp-claim-actions{display:flex;align-items:center;gap:8px;width:100%}.wp-claim-primary,.wp-claim-secondary{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:100%;min-width:0;height:52px;padding:0 24px;border:none;border-radius:40px;font-family:inherit;font-size:15px;font-weight:600;line-height:1.3;letter-spacing:0;white-space:nowrap;cursor:pointer}.wp-claim-primary{background:var(--wp-claim-primary);color:var(--wp-claim-primary-text)}.wp-claim-primary:disabled{cursor:default;opacity:.72}.wp-claim-secondary{background:var(--wp-claim-secondary-bg, var(--wp-control));color:var(--wp-claim-primary)}.wp-claim-actions[data-count="2"] .wp-claim-primary{flex:1 1 0}.wp-claim-actions[data-count="2"] .wp-claim-secondary{flex:0 0 120px}.wp-claim-button-spinner{width:16px;height:16px;border-radius:50%;border:2px solid rgba(32,37,48,.28);border-top-color:var(--wp-claim-primary-text);animation:wp-claim-spin .8s linear infinite}.wp-claim-home-indicator{display:flex;align-items:flex-end;justify-content:center;height:34px;min-height:34px;padding-bottom:8px;box-sizing:border-box}.wp-claim-home-indicator span{display:block;width:134px;height:5px;border-radius:16px;background:var(--wp-text-40)}@media(max-width:359px){.wp-header{gap:12px;padding:0 12px}.wp-total{font-size:24px}.wp-body-inner{padding:0 12px 128px;gap:20px}.wp-svc-items,.wp-claim-content{padding:18px 14px}.wp-item-line{gap:10px}.wp-svc-token>span{max-width:168px}}.wp-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.wi-drawer-content .wp-header,.wi-portfolio-body .wp-header{padding:16px}.wi-drawer-content .wp-header-edge--right .wp-header-btn,.wi-portfolio-body .wp-header-edge--right .wp-header-btn{top:16px;right:16px}.wp-withdraw-amount-card{display:flex;flex-direction:column;gap:12px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-sizing:border-box}.wp-withdraw-amount-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-input{flex:1 1 auto;min-width:0;padding:0;border:none;background:transparent;color:var(--wp-text);font-family:inherit;font-size:24px;font-weight:600;line-height:1.3;letter-spacing:0;text-align:left;outline:none}.wp-withdraw-input::placeholder{color:var(--wp-text-30)}.wp-withdraw-input[aria-invalid=true]{color:var(--wp-claim-error)}.wp-withdraw-input-symbol{flex-shrink:0;color:var(--wp-text-40);font-size:15px;font-weight:600;line-height:1.3}.wp-withdraw-quick-row{display:flex;align-items:center;gap:8px;width:100%}.wp-withdraw-quick{appearance:none;flex:1 1 0;min-width:0;height:32px;padding:0 10px;border:1px solid var(--wp-border);border-radius:999px;background:transparent;color:var(--wp-text-60);font-family:inherit;font-size:13px;font-weight:600;line-height:1;white-space:nowrap;cursor:pointer}.wp-withdraw-quick:hover:not(:disabled){border-color:var(--wp-claim-primary);color:var(--wp-claim-primary)}.wp-withdraw-quick:disabled{cursor:default;opacity:.5}.wp-withdraw-content{overflow-y:auto}.wp-withdraw-token-list{display:flex;flex-direction:column;gap:8px;width:100%;max-height:216px;overflow-y:auto}.wp-withdraw-token{appearance:none;display:flex;align-items:center;gap:10px;width:100%;min-height:52px;padding:10px 12px;border:1px solid var(--wp-border);border-radius:8px;background:var(--wp-card);color:var(--wp-text);font-family:inherit;text-align:left;cursor:pointer;box-sizing:border-box}.wp-withdraw-token[data-selected]{border-color:var(--wp-claim-primary);box-shadow:inset 0 0 0 1px var(--wp-claim-primary)}.wp-withdraw-token:disabled{cursor:default;opacity:.6}.wp-withdraw-token-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;flex-shrink:0;overflow:hidden;background:var(--wp-control)}.wp-withdraw-token-icon img{width:28px;height:28px;object-fit:cover}.wp-withdraw-token-icon span{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--wp-mint);color:#101820;font-size:13px;font-weight:600;line-height:1}.wp-withdraw-token-symbol{flex:1 1 auto;min-width:0;overflow:hidden;font-size:15px;font-weight:600;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}.wp-withdraw-token-amount{flex-shrink:0;color:var(--wp-text-40);font-size:13px;font-weight:500;line-height:1.3;white-space:nowrap}
8
+ `);import{Fragment as bf,jsx as pe,jsxs as on}from"react/jsx-runtime";var ua=15,hf="wp:";function Gn({env:e,theme:t="light",walletAddress:n,walletName:o,onBack:r,showHeader:i=!0,variant:a="embed",className:s,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d,sendTransaction:w,estimateGas:h,conversionRatio:m,currencySymbol:y,sections:b}){let u=Ee(e),x=Re.useCallback(Q=>!b||b.includes(Q),[b]),R=!!n,p=gf(),[C,k]=Re.useState({}),N=Re.useCallback((Q,be)=>{k(Be=>{let Me=Be[Q];return Me&&Me.loading===be.loading&&Me.empty===be.empty?Be:{...Be,[Q]:be}})},[]),E=Re.useCallback(Q=>{k(be=>{if(!(Q in be))return be;let Be={...be};return delete Be[Q],Be})},[]),T=Re.useMemo(()=>({report:N,unregister:E}),[N,E]),[M,q]=Re.useState(ua),[L,K]=Re.useState(!1),[U,ce]=Re.useState(!1),J=Re.useRef(void 0),$=Re.useCallback(()=>{p.invalidateQueries({predicate:Q=>typeof Q.queryKey[0]=="string"&&Q.queryKey[0].startsWith(hf)})},[p]),ne=Re.useCallback(()=>{$(),K(!0),setTimeout(()=>K(!1),600),q(ua)},[$]);Re.useEffect(()=>{if(!R)return;let Q=setInterval(()=>{q(be=>be<=1?(ne(),ua):be-1)},1e3);return()=>clearInterval(Q)},[R,ne]);let G=Re.useCallback(()=>{r?.()},[r]),D=R?en(u,n,{size:64}):void 0,ae=Re.useCallback(async()=>{if(!(U||!n))try{await navigator.clipboard.writeText(n),ce(!0),clearTimeout(J.current),J.current=setTimeout(()=>ce(!1),2e3)}catch{}},[n,U]);Re.useEffect(()=>()=>clearTimeout(J.current),[]);let me=Re.useMemo(()=>({env:u,theme:t,open:!0,walletAddress:n,close:G,onOutlink:c,lpBalanceReader:l,stakingRewardsReader:d,sendTransaction:w,estimateGas:h,conversionRatio:m,currencySymbol:y}),[u,t,n,G,c,l,d,w,h,m,y]),j=rr.filter(x),_e=j.length>0&&j.every(Q=>{let be=C[Q];return!!be&&!be.loading}),xe=_e&&j.every(Q=>C[Q]?.empty),O=j.some(Q=>{let be=C[Q];return!!be&&!be.empty}),ee=j.length>0&&!_e&&!O,Fe=on(bf,{children:[i&&on("div",{className:"wp-header",children:[on("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(hs,{})}),pe("span",{className:"wp-header-avatar","aria-hidden":!0,children:D&&pe("img",{src:D,alt:"",className:"wp-header-avatar-img",draggable:!1})}),(o||n)&&on("div",{className:"wp-header-account-meta",children:[o&&pe("span",{className:"wp-header-wallet-name",title:o,children:o}),n&&on("button",{type:"button",className:"wp-header-address-btn",onClick:ae,"aria-label":"Copy wallet address","data-track":"address_copy",children:[pe("span",{className:"wp-header-address",children:Qo(n)}),pe("span",{className:"wp-header-address-copy","data-copied":U,children:U?pe(xn,{size:14}):pe(Jn,{size:14})})]})]})]}),on("button",{type:"button",className:"wp-header-btn wp-refresh-btn","aria-label":"Refresh portfolio","data-track":"refresh",onClick:ne,children:[pe(bs,{className:L?"wp-spin-once":void 0}),R&&pe("span",{className:"wp-refresh-badge",children:M})]})]}),pe("div",{className:"wp-body",children:on("div",{className:"wp-body-inner","data-empty":xe||void 0,children:[x("rewards")&&pe(Bs,{}),x("points")&&pe(Ds,{}),x("staking")&&pe($s,{}),x("gameSwap")&&pe(Qs,{}),x("forge")&&pe(Js,{}),ee&&pe("div",{className:"wp-portfolio-loading",role:"status","aria-label":"Loading portfolio",children:pe("span",{className:"wp-portfolio-spinner","aria-hidden":!0})}),xe&&on("div",{className:"wp-portfolio-empty",role:"status",children:[pe("span",{className:"wp-portfolio-empty-icon","aria-hidden":!0,children:on("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(so.Provider,{value:me,children:pe(ra.Provider,{value:T,children:pe(ge,{feature:"wallet_portfolio",children:a==="none"?Fe:pe("div",{className:fe(a==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:Fe})})})})}import{jsx as ma,jsxs as el}from"react/jsx-runtime";function tl({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s}=Ue();return el(ar.Portal,{children:[ma(ar.Overlay,{className:"wp-overlay"}),el(ar.Content,{className:fe("wp-fullscreen",e),"data-theme":n,children:[ma(ar.Title,{className:"wp-sr-only",children:"Portfolio"}),ma(Gn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s})]})]})}import{jsx as nl}from"react/jsx-runtime";function xf({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:d,currencySymbol:w,children:h}){let m=Ee(e),y=o!==void 0,[b,u]=In.useState(!1),x=y?o:b,R=In.useCallback(k=>{y||u(k),r?.(k)},[y,r]),p=In.useCallback(()=>R(!1),[R]),C=In.useMemo(()=>({env:m,theme:t,open:x,walletAddress:n,close:p,onOutlink:i,lpBalanceReader:a,stakingRewardsReader:s,sendTransaction:c,estimateGas:l,conversionRatio:d,currencySymbol:w}),[m,t,x,n,p,i,a,s,c,l,d,w]);return nl(so.Provider,{value:C,children:nl(wf.Root,{direction:"bottom",open:x,onOpenChange:R,noBodyStyles:!0,children:h})})}var ol=Object.assign(xf,{Trigger:ms,Content:tl});import*as _ from"react";import{createPortal as Hn}from"react-dom";import Vt from"bignumber.js";import{jsx as kt,jsxs as vf}from"react/jsx-runtime";function rl({size:e=20,className:t}){return vf("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:[kt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),kt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function al({size:e=16,className:t}){return kt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:kt("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 il({size:e=16,className:t}){return kt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:kt("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 sl({size:e=20,className:t}){return kt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:kt("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function ll({size:e=16,className:t}){return kt("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:kt("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function cl({size:e=12,className:t}){return kt("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:kt("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 fl from"bignumber.js";function dl(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function pl(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,fl.ROUND_DOWN).toFixed()}function yf(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 kf(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new fl(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:dl(t)&&dl(n)?e.lastChangedBy==="to"?{fromAmount:pl(r.multipliedBy(n).dividedBy(t))}:{toAmount:pl(r.multipliedBy(t).dividedBy(n))}:yf(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function ul({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):kf(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}var ml=15,Sf=18,wl="cross_bridge_terms_accepted",Rf=3600*24*365;function Cf(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,ml);let r=t.slice(0,o).slice(0,ml),i=t.slice(o+1).slice(0,Sf);return`${r}.${i}`}function Tf(){return typeof document>"u"?!1:document.cookie.split(";").map(e=>e.trim()).some(e=>e===`${wl}=true`)}function Nf(){if(typeof document>"u")return;let e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=[`${wl}=true`,"Path=/",`Max-Age=${Rf}`,"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 gl(e){let t=e.toUpperCase();return t.startsWith("T")&&t.slice(1).startsWith("CROSS")?t.slice(1):t}function Ef(e,t){if(!e||!t||e.chainId!==t.chainId)return!1;let n=new Set([gl(e.symbol),gl(t.symbol)]);return n.has("CROSS")&&n.has("CROSSD")}function Bt(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function ir(e){return e[0]}function ga(e,t,n,o){if(n&&!Bt(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??ir(e);let i=e.findIndex(s=>Bt(s,t)),a=i>=0?e[i+1]:void 0;return a&&!Bt(a,t)?a:e.find(s=>!Bt(s,t))??t}function hl({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 ha(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 bl(e,t){return ha(e)?"Transaction request was rejected.":(e instanceof Error?e.message:typeof e=="string"?e:"").split(`
9
+ `)[0]?.trim()||t}function xl(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:i,approveBridge:a,history:s=[],initialSlippage:c="1",termsUrl:l=Dn,getQuote:d,submitBridge:w,onSubmitted:h,onSuccess:m,onFailed:y,onExit:b}=e,u=A.useMemo(()=>ul({getQuote:d,submitBridge:w}),[d,w]),[x,R]=A.useState("form"),[p,C]=A.useState(n??ir(t)),[k,N]=A.useState(()=>ga(t,n??ir(t),o,r)),[E,T]=A.useState(""),[M,q]=A.useState(""),[L,K]=A.useState("from"),[U,ce]=A.useState(c),[J,$]=A.useState(null),ne=A.useMemo(()=>Ef(p,k),[p,k]),G=A.useMemo(()=>ne?"1":U==="auto"?If(J?.priceImpact):U,[ne,U,J?.priceImpact]),[D,ae]=A.useState(""),[me,j]=A.useState("idle"),[_e,xe]=A.useState(""),[O,ee]=A.useState(null),[Fe,Q]=A.useState([]),[be,Be]=A.useState(!1),[Me,St]=A.useState(Tf),[ue,Ke]=A.useState(null),[tt,De]=A.useState(!1),[Ie,We]=A.useState(null),[Qt,nt]=A.useState(null),[gt,ze]=A.useState(!1),[Rt,ht]=A.useState(!1),ve=A.useRef(0),Mt=A.useRef(null),Dt=A.useRef(!1),ot=A.useRef(!1),Ge=A.useRef(!1),rt=A.useRef(!1),Qe=A.useRef(!1);A.useEffect(()=>{Dt.current||(Dt.current=!0,Te("bridge","opened"))},[]);let He=A.useCallback(()=>{Mt.current&&(clearTimeout(Mt.current),Mt.current=null)},[]),ye=A.useCallback(F=>{He(),nt(F)},[He]);A.useEffect(()=>He,[He]),A.useEffect(()=>{let F=t.find(Ce=>Bt(Ce,p))??ir(t),se=F?r?.(F,t):void 0,H=se?.find(Ce=>Bt(Ce,k))??(se?void 0:t.find(Ce=>Bt(Ce,k)))??ga(t,F,void 0,r);C(F),N(H)},[r,t,p,k]);let dt=A.useCallback((F,se)=>{let H=Cf(F);if(!H){ve.current+=1,T(""),q(""),K(se),$(null),ae(""),j("idle");return}se==="from"?T(H):q(H),K(se),ae(""),!Ge.current&&Number(H)>0&&(Ge.current=!0,Te("bridge","amount_entered"))},[]),at=A.useCallback(()=>{ve.current+=1,T(""),q(""),K("from"),$(null),ae(""),xe(""),j("idle"),Ke(null),De(!1),We(null),ze(!1),ye(null)},[ye]),Ye=A.useCallback(F=>{Bt(F,p)||(ot.current||(ot.current=!0,Te("bridge","token_selected",{tags:{item_id:`from:${F.symbol}`}})),C(F),N(ga(t,F,void 0,r)),at())},[p,r,at,t]),bt=A.useCallback(F=>{Bt(F,k)||Bt(F,p)||(ot.current||(ot.current=!0,Te("bridge","token_selected",{tags:{item_id:`to:${F.symbol}`}})),N(F),at())},[p,at,k]),Yt=A.useMemo(()=>p?r?.(p,t)??t.filter(F=>!Bt(F,p)):[],[p,r,t]),rn=A.useCallback(()=>{p?.balance&&dt(p.balance,"from")},[p?.balance,dt]),Zt=A.useCallback(()=>{!p||!k||(C(k),N(p),at())},[p,at,k]),I=A.useCallback(()=>{ve.current+=1,T(""),q(""),K("from"),$(null),ae(""),xe("")},[]);A.useEffect(()=>{if(!p||!k)return;if(!E&&!M){$(null),ae(""),j(H=>H==="quoting"?"idle":H);return}let F=++ve.current,se=hl({fromToken:p,toToken:k,fromAmount:E,toAmount:M,lastChangedBy:L,slippage:U});j(H=>H==="submitting"?H:u.canQuote?"quoting":"idle"),(async()=>{try{let H=await u.getQuote(se);if(ve.current!==F)return;H.fromAmount!==void 0&&L==="to"&&T(H.fromAmount),H.toAmount!==void 0&&L==="from"&&q(H.toAmount),$(H.summary??null),ae(H.error??"")}catch(H){if(ve.current!==F)return;ae(H instanceof Error?H.message:"Failed to quote bridge.")}finally{ve.current===F&&j(H=>H==="quoting"?"idle":H)}})()},[E,p,L,u,U,M,k]);let Z=A.useCallback(()=>!p||!k?null:hl({fromToken:p,toToken:k,fromAmount:E,toAmount:M,lastChangedBy:L,slippage:G}),[G,E,p,L,M,k]),ie=A.useCallback(async(F,se)=>{xe(""),ze(!1),De(!1),j("submitting");try{if(!se?.skipApprovalCheck&&i){let Ce=await i(F);if(Ce){Ke(Ce),We(F),j("idle");return}}Ke(null),We(null),ye("processing");let H=await u.submitBridge(F);ee(H),j("success"),Q(Ce=>[{id:H.txHash,timestamp:new Date().toISOString(),txHash:H.txHash,fromToken:H.fromToken,toToken:H.toToken,fromAmount:H.fromAmount,toAmount:H.toAmount,summary:J??void 0,status:"pending"},...Ce.filter(xo=>xo.txHash!==H.txHash)]),I(),ht(!0),ye(null),ze(!0),Te("bridge","confirmed"),rt.current=!1,Qe.current=!1,h?.(H),m?.(H)}catch(H){if(ye(null),Te("bridge","confirmed",{status:"failure",reason:Nt(H)}),rt.current=!1,Qe.current=!1,ha(H)){j("idle");return}let Ce=bl(H,"Failed to submit bridge.");xe(Ce),j("error"),y?.({message:Ce})}},[i,y,h,m,u,I,ye,J]),it=A.useCallback(async()=>{if(D)return;let F=Z();if(F){if(rt.current||(rt.current=!0,Te("bridge","submitted")),!Me){We(F),Be(!0);return}await ie(F)}},[Z,D,ie,Me]),Xt=A.useCallback(async()=>{let F=Ie??Z();F&&(Nf(),St(!0),Be(!1),await ie(F))},[Z,Ie,ie]),pt=A.useCallback(()=>{Be(!1),We(null)},[]),ho=A.useCallback(async()=>{if(!(me==="submitting"||!ue||!Ie||!a)){xe(""),j("submitting");try{await a(Ie,ue),Qe.current||(Qe.current=!0,Te("bridge","approved")),Ke(null),j("idle"),De(!0)}catch(F){if(ha(F)){j("idle");return}let se=bl(F,"Failed to approve token.");xe(se),j("error"),y?.({message:se})}}},[ue,a,y,Ie,ie,me]),hn=A.useCallback(()=>{me!=="submitting"&&(Ke(null),De(!1),We(null),j("idle"))},[me]),bo=A.useCallback(async()=>{if(me==="submitting")return;let F=Ie??Z();if(!F){De(!1),xe("Bridge input is no longer available. Please try again."),j("error");return}De(!1),await ie(F,{skipApprovalCheck:!0})},[Z,Ie,ie,me]),kr=A.useCallback(()=>{ze(!1)},[]),qn=A.useCallback(F=>{R(F),F==="history"&&ht(!1)},[]),wt=A.useCallback(()=>{if(x==="history"){qn("form");return}b?.()},[b,qn,x]),wo=A.useMemo(()=>[...s,...Fe.filter(F=>!s.some(se=>se.txHash===F.txHash))],[s,Fe]);return{step:x,setStep:qn,status:me,error:_e,quoteError:D,fromToken:p,toToken:k,tokens:t,availableToTokens:Yt,fromAmount:E,toAmount:M,lastChangedBy:L,slippage:U,effectiveSlippage:G,slippageLocked:ne,setSlippage:ce,summary:J,history:wo,submitted:O,canSubmit:u.canSubmit,termsOpen:be,approvalInfo:ue,approvalSuccessOpen:tt,approveBridge:a,pendingSubmitInput:Ie,submitToast:Qt,successDialogOpen:gt,dismissSuccessDialog:kr,hasNewHistory:Rt,termsUrl:l,setFromToken:C,setToToken:N,selectFromToken:Ye,selectToToken:bt,setAmount:dt,setMax:rn,swapTokens:Zt,submit:it,confirmTerms:Xt,cancelTerms:pt,confirmApproval:ho,cancelApproval:hn,continueAfterApproval:bo,back:wt}}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 wa,jsx as f,jsxs as S}from"react/jsx-runtime";var Cl=_.createContext(void 0);function $n(){return _.useContext(Cl)}function Lf(e){let[t,n]=_.useState(void 0);return _.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 vl=[{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"},{value:"5",label:"5%"}],Af=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Pf(e,t){return e==="auto"?t?`Auto ${t}%`:"Auto":e?`${e}%`:"1%"}function yl(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 _f(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Tl(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function kl(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 Ff(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 Bf(e,t){if(!t)return!1;let n=new Vt(e||"0"),o=new Vt(t.balance||"0");return!n.isFinite()||!o.isFinite()?!1:n.isGreaterThan(o)}function Mf(e){if(e.priceUsd===void 0)return null;let t=new Vt(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function Df(e){if(e.priceUsd===void 0)return null;let t=new Vt(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function Nl(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,Vt.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),i=new Vt(o||"0").toFormat(0);return r?`${i}.${r}`:i}function Of(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function Wf(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 Uf(e){let t=new Vt(e||"0");return!t.isFinite()||t.isNaN()?e||"0":Nl(t)}function zf(e,t){if(t?.priceUsd===void 0)return null;let n=new Vt(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 Gf(e,t){return t==="all"?!0:cr(e)===t}function Hf(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Sl(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function Il(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function El(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":Il(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function Ll(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function lr(e){return!e||e==="0"||Number(e)===0}function $f(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 jf(e){let t=e.fromToken,n=e.toToken,o=El(t,n),r=e.fromAmount||"0",i=e.toAmount||"0",a=o!==void 0&&!Ll(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:a?[{label:"Route",value:t&&n?`${Sl(t.chainId)} \u2192 ${Sl(n.chainId)}`:"-"},{label:"Validator Fee",value:lr(r)?"0":"Free",tone:lr(r)?"default":"accent"},{label:"Network Fee",value:lr(r)?"0":"Free",tone:lr(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 co({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 Rl({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:i,locked:a=!1}){return S("section",{className:"bf-amount-panel",children:[S("div",{className:"bf-amount-head",children:[f("span",{children:e}),S("span",{className:"bf-balance",children:[Tl(t?.balance??"0")," ",t?.symbol??""]})]}),S("div",{className:"bf-amount-main",children:[S("label",{className:"bf-amount-input-wrap",children:[S("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})]}),S("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(co,{token:t}),f("span",{children:t?.symbol??"Select"}),!a&&f(yn,{size:16})]})]})]})}function Vf({flow:e,side:t,onClose:n}){let o=_.useId(),[r,i]=_.useState(""),[a,s]=_.useState(null),c=$n(),l=t==="from"?e.fromToken:e.toToken;_.useEffect(()=>{s(document.body)},[]),_.useEffect(()=>{let m=y=>{y.key==="Escape"&&n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]);let d=_.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),w=_.useMemo(()=>{let m=r.trim().toLowerCase();return m?d.filter(y=>y.symbol.toLowerCase().includes(m)||y.name.toLowerCase().includes(m)):d},[r,d]),h=_.useCallback(m=>{t==="from"?e.selectFromToken(m):e.selectToToken(m),n()},[e,n,t]);return a?Hn(f("div",{className:"bf-token-picker-overlay","data-theme":c,role:"presentation",onMouseDown:m=>{m.target===m.currentTarget&&n()},children:S("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[f("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),S("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(Ot,{size:24})})]}),S("label",{className:"bf-token-search",children:[f(rl,{size:20}),f("span",{className:"bf-sr-only",children:"Search tokens"}),f("input",{value:r,onChange:m=>i(m.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),S("div",{className:"bf-token-list",children:[w.map(m=>{let y=Il(m,l),b=y?Df(m):Mf(m);return S("button",{type:"button",className:"bf-token-row","data-selected":y?"true":"false",onClick:()=>h(m),children:[S("span",{className:"bf-token-row-left",children:[f(co,{token:m,size:40}),S("span",{className:"bf-token-meta",children:[f("span",{className:"bf-token-symbol",children:m.symbol}),!y&&f("span",{className:"bf-token-name",children:m.name})]})]}),S("span",{className:"bf-token-row-right",children:[S("span",{className:"bf-token-balance",children:[Tl(m.balance),y?null:` ${m.symbol}`]}),b&&f("span",{className:"bf-token-price",children:b})]})]},_f(m))}),w.length===0&&f("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),a):null}function qf({flow:e,onClose:t}){let n=_.useId(),[o,r]=_.useState(null),i=vl.find(b=>b.value===e.slippage),[a,s]=_.useState(e.slippage&&!i?e.slippage:""),c=a.trim()!==""&&a.trim()!==".",l=c?Number(a):NaN,d=Number.isFinite(l)&&l>50,w=Number.isFinite(l)&&l>5&&!d,h=b=>{e.setSlippage(b),t()},m=()=>{!c||d||(e.setSlippage(yl(a)),t())};if(_.useEffect(()=>{r(document.body)},[]),_.useEffect(()=>{let b=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t]),!o)return null;let y=$n();return Hn(f("div",{className:"bf-slippage-overlay","data-theme":y,role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&t()},children:S("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[S("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(Ot,{size:24})})]}),S("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."}),S("div",{className:"bf-slippage-controls",children:[f("div",{className:"bf-slippage-presets",children:vl.map(b=>f("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===b.value?"true":"false",onClick:()=>h(b.value),children:b.label},b.value))}),S("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:b=>{s(yl(b.target.value))},onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),m())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),f("span",{"aria-hidden":"true",children:"%"})]})]}),d?f("p",{className:"bf-slippage-message","data-variant":"error",children:"Slippage cannot exceed 50%."}):w?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:m,disabled:d,children:"Apply"})]})]})}),o)}function Kf({flow:e}){let t=_.useId(),[n,o]=_.useState(!1),[r,i]=_.useState(null),a=$n();return _.useEffect(()=>{i(document.body)},[]),_.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:Hn(f("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:S("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."}),S("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"})}),S("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]=_.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 Yf({flow:e,approval:t}){let n=_.useId(),[o,r]=_.useState(null),i=$n();if(_.useEffect(()=>{r(document.body)},[]),_.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 Hn(f("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",children:S("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[S("h3",{id:n,children:["Approve ",t.token.symbol]}),f(co,{token:t.token,size:72}),S("div",{className:"bf-approve-address-box",children:[f("span",{children:"Token Address"}),S("div",{children:[f("strong",{children:t.tokenAddress}),f(Qf,{value:t.tokenAddress,disabled:s})]})]}),S("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),S("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 Zf({flow:e}){let t=_.useId(),[n,o]=_.useState(null),r=$n();if(_.useEffect(()=>{o(document.body)},[]),_.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 Hn(f("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:S("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"}),S("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",f("br",{}),"Please continue to the next step."]}),S("div",{className:"bf-action-buttons",children:[f("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:i,children:"Cancel"}),S("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 Xf({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,i]=_.useState(!1),a=_.useMemo(()=>{let l=new Vt(e||"0"),d=new Vt(t||"0");return!l.isFinite()||!d.isFinite()||l.lte(0)||d.lte(0)?null:r?l.dividedBy(d):d.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 S("button",{type:"button",className:"bf-exchange-rate",onClick:()=>i(l=>!l),"data-track":"rate_reverse",children:[S("span",{children:["1 ",s]}),f(cl,{size:12}),S("span",{children:[Nl(a)," ",c]})]})}function Jf({flow:e}){return e.submitToast?S("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"})}),S("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 eu({message:e}){let[t,n]=_.useState(!1);return _.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:S("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:"!"})}),S("span",{className:"bf-status-toast-copy",children:[f("strong",{children:"Error"}),f("span",{children:e})]})]})}function tu(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 nu({flow:e}){let t=_.useId(),[n,o]=_.useState(null),r=e.submitted,i=$n();return _.useEffect(()=>{o(document.body)},[]),_.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:Hn(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:S("div",{className:"bf-success-body",children:[f("span",{className:"bf-success-mark","aria-hidden":"true"}),S("div",{className:"bf-success-copy",children:[f("strong",{id:t,children:tu(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)=>S(_.Fragment,{children:[s>0&&f("span",{className:"bf-success-route-arrow",children:"\u2192"}),f(ba,{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 ba({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 ou({row:e}){return e.routeTokens&&e.routeTokens.length>0?f("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>S(_.Fragment,{children:[n>0&&f("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),f(ba,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?S("span",{className:"bf-info-value-token",children:[f(ba,{token:e.valueToken}),f("span",{children:e.value})]}):f(wa,{children:e.value})}function Al({rows:e}){return!e||e.length===0?null:f("div",{className:"bf-info-rows",children:e.map((t,n)=>S("div",{className:"bf-info-row",children:[S("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(ou,{row:t})})]},`${t.label}-${t.value}`))})}function ru(e,t,n){return e.pathType==="bridge"?"Bridge Info":Ll(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function au({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(wa,{children:r.map(i=>{let a=i==="swap"?e.swapInfo:e.bridgeInfo;return a?.length?S("div",{className:"bf-info-section",children:[o&&f("h4",{children:i==="swap"?"Swap Info":"Bridge Info"}),f(Al,{rows:a})]},i):null})})}function iu({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=ru(e,t,n),[i,a]=_.useState(!0),[s,c]=_.useState(!0);return S("div",{className:"bf-details",children:[e.liquidity&&S("section",{className:"bf-liquidity",children:[S("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)&&S("section",{className:"bf-detail-section bf-info-card","data-open":i?"true":"false",children:[S("button",{type:"button",className:"bf-collapse-head","aria-expanded":i,onClick:()=>a(l=>!l),"data-track":"details_toggle",children:[f("h3",{children:r}),f(yn,{size:16,className:"bf-collapse-chevron"})]}),i&&f("div",{className:"bf-collapse-body",children:f(au,{summary:e})})]}),o&&S("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[S("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"}),S("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:Ff(e.txFeeInfo?.estTxFee??"0")}),f(yn,{size:16,className:"bf-collapse-chevron"})]})]}),s&&f("div",{className:"bf-collapse-body",children:f(Al,{rows:e.txFee})})]})]})}function su({item:e}){let t=cr(e),n=zf(e.fromAmount,e.fromToken);return S("article",{className:"bf-history-item",children:[S("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:Wf(e.timestamp)})]}),S("div",{className:"bf-history-item-body",children:[S("strong",{className:"bf-history-amount",children:[Uf(e.fromAmount)," ",e.fromToken.symbol]}),S("div",{className:"bf-history-meta",children:[f("span",{className:"bf-history-usd",children:n??Of(e.txHash)}),S("span",{className:"bf-history-route",children:[S("span",{className:"bf-history-route-token",children:[f(co,{token:e.fromToken,size:16}),f("span",{children:e.fromToken.symbol})]}),f(ll,{size:16,className:"bf-history-route-arrow"}),S("span",{className:"bf-history-route-token",children:[f(co,{token:e.toToken,size:16}),f("span",{children:e.toToken.symbol})]})]})]})]})]})}function lu({flow:e}){let[t,n]=_.useState("all"),o=e.history.some(a=>cr(a)==="pending"),r=e.history.filter(a=>Gf(a,t)),i=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return S("main",{className:"bf-history-body",children:[f("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:Af.map(a=>S("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(su,{item:a},a.id||a.txHash))}):f("div",{className:"bf-empty",children:i})]})}function cu({flow:e,env:t}){let[n,o]=_.useState(null),[r,i]=_.useState(!1),[a,s]=_.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??jf(e):null,d=Rn("apps.json",t,p=>Sn(p?.bridgePoweredBy?.url,t)),w=$f(e.quoteError),h=Bf(e.fromAmount,e.fromToken),m=h?"Insufficient balance":w.from,y=e.quoteError&&!w.from&&!w.to?e.quoteError:"",b=e.error||y,u=e.history.some(p=>cr(p)==="pending"),R=(l?.pathType??El(e.fromToken,e.toToken))!=="bridge";return S(wa,{children:[S("main",{className:"bf-body",children:[S("div",{className:"bf-toolbar",children:[S("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),"data-track":"history_open",children:[f(al,{}),f("span",{children:"History"}),(u||e.hasNewHistory)&&f("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),R&&S("button",{type:"button",className:"bf-chip",onClick:()=>i(!0),"data-track":"slippage_open",disabled:e.slippageLocked,"aria-haspopup":"dialog","aria-expanded":r,children:[f(il,{}),f("span",{children:e.slippageLocked?"Auto 1%":Pf(e.slippage,e.effectiveSlippage)})]})]}),S("div",{className:"bf-swap-card","data-has-from-error":m?"true":"false",children:[f(Rl,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:kl(e.fromAmount,e.fromToken),onAmountChange:p=>e.setAmount(p,"from"),onTokenClick:()=>o("from")}),m&&f("div",{className:"bf-field-error",children:m}),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(sl,{size:22})}),f(Rl,{label:"To",token:e.toToken,amount:e.toAmount,usd:kl(e.toAmount,e.toToken),onAmountChange:p=>e.setAmount(p,"to"),onTokenClick:()=>o("to"),locked:e.availableToTokens.length<=1}),w.to&&f("div",{className:"bf-field-error",children:w.to})]}),f(Xf,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&f(iu,{summary:l})]}),S("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"}),d&&S("a",{className:"bf-powered",href:d,target:"_blank",rel:"noreferrer",children:["Powered by ",f("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&f(Vf,{flow:e,side:n,onClose:()=>o(null)}),r&&f(qf,{flow:e,onClose:()=>i(!1)}),f(Kf,{flow:e}),e.approvalInfo&&f(Yf,{flow:e,approval:e.approvalInfo}),f(Zf,{flow:e}),f(Jf,{flow:e}),f(eu,{message:e.submitToast?"":b}),f(nu,{flow:e})]})}function dr({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let i=_.useMemo(()=>Ee(n),[n]),a=xl({...r,onExit:t}),s=_.useRef(null),c=Lf(s),l=a.step==="history"?"History":"Swap & Bridge";return f(ge,{feature:"bridge",children:f(Cl.Provider,{value:c,children:S("div",{ref:s,className:fe("bf-root",o),"data-view":a.step,"data-status":a.status,children:[S("header",{className:"bf-header",children:[f("button",{type:"button",className:"bf-header-btn",onClick:a.back,"aria-label":"Back",children:f(vn,{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(Ot,{size:24})})]}),a.step==="history"?f(lu,{flow:a}):f(cu,{flow:a,env:i})]})})})}import{Fragment as va,jsx as g,jsxs as P}from"react/jsx-runtime";var pu="On-ramp is not available in your region.";function xa(e,t,n){let o=Ne[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 fu(e){return parseInt(e.split(":")[1],10)}function uu(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 mu(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function gu(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 Pl({align:e="end",sideOffset:t=12,className:n,children:o}){let{env:r,theme:i,isMobile:a,open:s,drawerDirection:c,modal:l,showBalance:d,showForgeToken:w,showGameToken:h,showQR:m,showBridge:y,qrLogoSrc:b,walletAddress:u,accountName:x,sendAccounts:R,profileImageUrl:p,preferredTokens:C,close:k,onSelectWallet:N,onCopyAddress:E,onBuy:T,onDisconnect:M,disconnectLabel:q,termsUrl:L,termsLabel:K,privacyUrl:U,privacyLabel:ce,portalStyle:J,navContent:$,navPosition:ne,footerContent:G,view:D,setView:ae,selectedSendToken:me,setSelectedSendToken:j,showPortfolio:_e,portfolioTitle:xe,portfolioSections:O,showTotalAssets:ee,totalAssetsLabel:Fe,sendTransaction:Q,getTransactionReceipt:be,estimateGas:Be,onOutlink:Me,lpBalanceReader:St,stakingRewardsReader:ue,bridgeTokens:Ke,bridgeHistory:tt,getBridgeQuote:De,getBridgeToTokens:Ie,getBridgeApproval:We,approveBridge:Qt,submitBridge:nt,onReceive:gt,onSend:ze,onBuyDisabledMessage:Rt,onBridgeDisabledMessage:ht,onSendDisabledMessage:ve}=an(),[Mt,Dt]=z.useState(null),ot=z.useRef(void 0),Ge=z.useCallback(v=>{Dt(v),clearTimeout(ot.current),ot.current=setTimeout(()=>Dt(null),4e3)},[]);z.useEffect(()=>()=>clearTimeout(ot.current),[]);let rt=!!Rt,Qe=z.useCallback(()=>{if(rt){Ge(Rt);return}let v=T?.();v&&typeof v.then=="function"&&v.catch(()=>{Ge(Rt??pu)})},[rt,Rt,T,Ge]),He=!!ht,ye=!!ve,{tokens:dt,isLoading:at}=dn(r,u,s&&d),{statsMap:Ye}=pn(r,d),{aprPercent:bt}=as(),{categoryMap:Yt}=is(r,d),rn=d&&ee,{displayValue:Zt,isLowerBound:I,isLoading:Z}=ss(r,u,s&&rn),[ie,it]=z.useState(!1),Xt=z.useRef(null),[pt,ho]=z.useState(0),{holdings:hn,isLoading:bo}=os(r,u,s&&d&&w),kr=z.useMemo(()=>hn.map(v=>v.token),[hn]),{imageMap:qn}=rs(r,kr,w&&hn.length>0),wt=z.useMemo(()=>{let v=[],W=[],oe=[],Ze=new Map((C??[]).map((de,$e)=>[`${fu(de.chainId)}:${de.address.toLowerCase()}`,$e]));for(let de of dt){let $e=xa(r,de.chainId,de.symbol)!==void 0,Tt=`${de.chainId}:${de.address.toLowerCase()}`,bn=Ze.get(Tt),Lr=new po(de.quantity.numeric).shiftedBy(-de.quantity.decimals);if($e)v.push(de);else if(bn!==void 0)W.push(de);else if(Lr.isGreaterThan(0)){if(!h&&Yt.get(ea(de.chainId,de.address))==="game")continue;oe.push(de)}}return v.sort((de,$e)=>{let Tt=xa(r,de.chainId,de.symbol)??99,bn=xa(r,$e.chainId,$e.symbol)??99;return Tt-bn}),W.sort((de,$e)=>{let Tt=Ze.get(`${de.chainId}:${de.address.toLowerCase()}`)??99,bn=Ze.get(`${$e.chainId}:${$e.address.toLowerCase()}`)??99;return Tt-bn}),oe.sort((de,$e)=>{let Tt=Ye.get(At(de.chainId,de.address)),bn=Ye.get(At($e.chainId,$e.address)),Lr=new po(de.quantity.numeric).shiftedBy(-de.quantity.decimals).multipliedBy(Tt?.price??0);return new po($e.quantity.numeric).shiftedBy(-$e.quantity.decimals).multipliedBy(bn?.price??0).minus(Lr).toNumber()}),[...v,...W,...oe]},[dt,r,Ye,h,Yt,C]),wo=z.useMemo(()=>{if(!w)return[];let v=new Set(dt.map(W=>W.address.toLowerCase()));return[...hn].filter(W=>!v.has(W.token.toLowerCase())).sort((W,oe)=>{let Ze=new po(W.value);return new po(oe.value).minus(Ze).toNumber()})},[hn,w,dt]),F=z.useRef(!1),[se,H]=z.useState(null),Ce=z.useRef(void 0),xo=se?.chainId??me?.chainId??wt[0]?.chainId??0,{transactionUrl:Sr}=Bo(r,xo,se?.txHash,!!(se?.txHash&&xo)),Ct=z.useCallback(v=>{F.current=!0,ae(v)},[ae]),[lc,Rr]=z.useState("recipient"),vo=z.useCallback(()=>{j(null),Rr("recipient"),Ct("wallet")},[j,Ct]),Cr=z.useCallback((v,W="recipient")=>{if(ye){Ge(ve);return}Rr(W),j(v),Ct("send")},[ye,ve,Ge,j,Ct]),yo=Rn("apps.json",r,v=>Sn(v?.gametokenBridge,r)),Ta=Rn("apps.json",r,v=>v?.gametokenSites),cc=z.useCallback(()=>{if(He){Ge(ht);return}if(yo){if(uu(Ta)){window.location.assign(yo);return}window.open(yo,"_blank","noopener,noreferrer")}},[He,ht,yo,Ta,Ge]),dc=z.useCallback(v=>{clearTimeout(Ce.current),j(null),Ct("wallet"),H({status:"pending",txHash:v.txHash,chainId:v.chainId,description:`${v.amount} ${v.tokenSymbol} to ${ut(v.recipient)}`})},[j,Ct]),pc=z.useCallback(v=>{let W=me?.chainId;j(null),Ct("wallet"),!(!v||!W)&&(H(oe=>({status:"success",txHash:v,chainId:W,description:oe?.txHash===v?oe.description:"Tap to see your transaction"})),clearTimeout(Ce.current),Ce.current=setTimeout(()=>H(null),5e3))},[me?.chainId,j,Ct]),fc=z.useCallback(v=>{let W=v.txHash;W&&(H({status:"error",txHash:W,chainId:v.chainId,description:v.message}),clearTimeout(Ce.current),Ce.current=setTimeout(()=>H(null),5e3))},[]),Kn=z.useMemo(()=>{if(gt)return gt;if(m)return()=>Ct("qr")},[gt,m,Ct]),Tr=z.useMemo(()=>{if(ze)return ze;if(wt.length===0)return;let v=wt[0];return()=>Cr(v,"token")},[ze,wt,Cr]),uc=z.useCallback(()=>{if(ye){Ge(ve);return}Tr?.()},[ye,ve,Tr,Ge]);z.useEffect(()=>{s||(F.current=!1,Rr("recipient"))},[s]);let Na=z.useRef(null);z.useEffect(()=>{let v=Na.current;if(!v||!a)return;let W=oe=>{oe.pointerType==="touch"&&oe.stopPropagation()};return v.addEventListener("pointerdown",W),()=>v.removeEventListener("pointerdown",W)},[a]);let[En,Ia]=z.useState(!1),Nr=z.useRef(void 0),[Qn,Yn]=z.useState(!1);z.useEffect(()=>{if(!Qn)return;let v=()=>Yn(!1),W=Ze=>{Ze.key==="Escape"&&Yn(!1)},oe=setTimeout(()=>{document.addEventListener("mousedown",v,!0),document.addEventListener("keydown",W,!0)},0);return()=>{clearTimeout(oe),document.removeEventListener("mousedown",v,!0),document.removeEventListener("keydown",W,!0)}},[Qn]),z.useEffect(()=>{Yn(!1)},[u]),z.useEffect(()=>()=>clearTimeout(Nr.current),[]),z.useEffect(()=>()=>clearTimeout(Ce.current),[]),z.useEffect(()=>{let v=Xt.current;if(!v||G===null){ho(0);return}let W=()=>{ho(v.offsetHeight)};if(W(),typeof ResizeObserver>"u")return;let oe=new ResizeObserver(W);return oe.observe(v),()=>oe.disconnect()},[G]);let Ea=z.useCallback(async()=>{if(!En)try{await navigator.clipboard.writeText(u),Ia(!0),clearTimeout(Nr.current),Nr.current=setTimeout(()=>Ia(!1),2e3),E?.(u,!0)}catch{E?.(u,!1)}},[u,E,En]),ko=z.useCallback(v=>{v.currentTarget.setAttribute("data-loaded","true")},[]),La=z.useMemo(()=>({background:gu(u)}),[u]),So=z.useMemo(()=>p||en(r,u,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[p,r,u,i]),Ir=z.useMemo(()=>mu(Zt),[Zt]),Aa=L||U?P("div",{className:"wi-legal-links",children:[L&&g("a",{className:"wi-legal-link",href:L,target:"_blank",rel:"noopener noreferrer","data-track":"terms_link",onClick:v=>et(v,L,{category:"terms",origin:"terms"},Me),children:K}),L&&U&&g("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),U&&g("a",{className:"wi-legal-link",href:U,target:"_blank",rel:"noopener noreferrer","data-track":"privacy_link",onClick:v=>et(v,U,{category:"privacy",origin:"privacy"},Me),children:ce})]}):null,Pa=M?P("button",{type:"button",className:"wi-disconnect-btn","data-track":"disconnect",onClick:()=>{M(),k()},children:[g(pi,{size:16}),g("span",{className:"wi-disconnect-label",children:q})]}):null,mc=d&&!$?P("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[P("button",{type:"button",className:fe("wi-action-card",rt&&"wi-action-card--dimmed"),onClick:Qe,disabled:!T&&!rt,"aria-disabled":rt||void 0,"aria-label":"Buy","data-track":"buy",children:[g(bi,{size:20}),g("span",{children:"Buy"})]}),y?P("button",{type:"button",className:fe("wi-action-card",He&&"wi-action-card--dimmed"),onClick:cc,"aria-disabled":He||void 0,"aria-label":"Bridge","data-track":"bridge_open",children:[g(wi,{size:20}),g("span",{children:"Bridge"})]}):P("button",{type:"button",className:"wi-action-card",onClick:Kn,disabled:!Kn,"aria-label":"Receive","data-track":"receive",children:[g(_o,{size:20}),g("span",{children:"Receive"})]}),P("button",{type:"button",className:fe("wi-action-card",ye&&"wi-action-card--dimmed"),onClick:uc,disabled:!ye&&!Tr,"aria-disabled":ye||void 0,"aria-label":"Send","data-track":"send_open",children:[g(gi,{size:20}),g("span",{children:"Send"})]}),_e?P("button",{type:"button",className:"wi-action-card",onClick:()=>Ct("portfolio"),"aria-label":"View portfolio","data-track":"portfolio_open",children:[g(hi,{size:20}),g("span",{children:"Portfolio"})]}):y?P("button",{type:"button",className:"wi-action-card",onClick:Kn,disabled:!Kn,"aria-label":"Receive","data-track":"receive",children:[g(_o,{size:20}),g("span",{children:"Receive"})]}):null]}):null,gc=P("div",{className:fe("wi-view-inner",F.current&&"wi-view-wallet"),children:[rn&&P("div",{className:"wi-total-section",children:[P("div",{className:"wi-total-head",children:[g("span",{className:"wi-total-label",children:Fe}),g("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:v=>{v.stopPropagation(),it(W=>!W)},onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),v.stopPropagation(),it(W=>!W))},"aria-label":ie?"Show balance":"Hide balance","data-track":"balance_toggle",children:ie?g(ui,{}):g(fi,{})})]}),g("div",{className:"wi-total-body",children:Z?g("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):g("div",{className:"wi-total-value","data-hidden":ie||void 0,children:ie?g("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):P(va,{children:[I&&g("span",{className:"wi-total-lte",children:"\u2264"}),g("span",{className:"wi-total-currency",children:"$"}),g("span",{className:"wi-total-amount",children:Ir.main}),Ir.decimal&&g("span",{className:"wi-total-decimal",children:Ir.decimal})]})})})]}),ne==="top"&&($?g("div",{className:"wi-nav-fixed",children:$}):mc),d&&g("div",{ref:Na,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:P("div",{className:"wi-token-list",children:[at&&Array.from({length:5},(v,W)=>P("div",{className:"wi-skeleton-item",children:[P("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),P("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),P("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},W)),!at&&wt.length===0&&!w&&g("div",{className:"wi-empty",children:"No Tokens Found"}),wt.map(v=>{let W=Ye.get(At(v.chainId,v.address)),oe=W?parseFloat(W.percent_change_24h):null,Ze=oe!==null&&oe>=0,de=ro(r,v.chainId),$e=Wi(v.address);return P("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Cr(v),"aria-label":`Send ${v.symbol}`,"data-track":"token_send","data-track-id":v.symbol,children:[P("div",{className:"wi-token-left",children:[P("div",{className:"wi-token-icon-wrap",children:[g("img",{src:v.icon_url,alt:v.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:ko,onError:Tt=>{Tt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),de&&g("img",{src:de,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Tt=>{Tt.currentTarget.style.display="none"}})]}),P("div",{className:"wi-token-info",children:[P("span",{className:"wi-token-name-row",children:[g("span",{className:"wi-token-name",children:v.symbol}),$e&&bt!==null&&g("span",{className:"wi-token-apr",children:`APR ${bt>=0?"+":"-"}${(bt>=0?Math.floor:Math.ceil)(Math.abs(bt)*100)/100}%`})]}),W&&P("div",{className:"wi-token-price-row",children:[g("span",{className:"wi-token-price",children:Ur(W.price)}),g("span",{className:"wi-token-change","data-positive":Ze,"data-zero":oe===0||void 0,children:oe!==null&&(oe===0?"0%":`${Ze?"+":"-"}${(Ze?Math.floor:Math.ceil)(Math.abs(oe)*100)/100}%`)})]})]})]}),P("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:sn(v.quantity.numeric,v.quantity.decimals)}),W&&g("span",{className:"wi-token-value",children:vi(v.quantity.numeric,v.quantity.decimals,W.price)})]})]},`${v.address}-${v.chainId}`)}),w&&bo&&Array.from({length:3},(v,W)=>P("div",{className:"wi-skeleton-item",children:[P("div",{className:"wi-skeleton-left",children:[g("div",{className:"wi-skeleton-block wi-skeleton-icon"}),P("div",{className:"wi-skeleton-lines",children:[g("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),P("div",{className:"wi-skeleton-right",children:[g("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),g("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${W}`)),w&&!bo&&!at&&wt.length===0&&wo.length===0&&g("div",{className:"wi-empty",children:"No Tokens Found"}),w&&wo.map(v=>{let W=qn.get(v.token)||"",oe=ro(r,Ne[r].cross);return P("div",{className:"wi-token-item",children:[P("div",{className:"wi-token-left",children:[P("div",{className:"wi-token-icon-wrap",children:[g("img",{src:W||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:v.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:ko,onError:Ze=>{Ze.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),oe&&g("img",{src:oe,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Ze=>{Ze.currentTarget.style.display="none"}})]}),P("div",{className:"wi-token-info",children:[g("span",{className:"wi-token-name",children:v.token_name}),g("div",{className:"wi-token-price-row",children:P("span",{className:"wi-token-price",children:[sn(v.current_price,18)," CROSS"]})})]})]}),P("div",{className:"wi-token-right",children:[g("span",{className:"wi-token-balance",children:sn(v.balance,18)}),g("span",{className:"wi-token-value",children:Ur(v.current_value_usd)})]})]},`forge-${v.token}`)})]})}),ne==="bottom"&&$&&g("div",{className:"wi-nav-fixed",children:$}),Pa&&g("div",{className:"wi-wallet-disconnect-row",children:Pa})]},"wallet"),hc=_e?g("div",{className:fe("wi-view-inner wi-portfolio-body",F.current&&"wi-view-portfolio"),children:g(Gn,{env:r,theme:i,walletAddress:u,showHeader:!1,onOutlink:Me,lpBalanceReader:St,stakingRewardsReader:ue,sendTransaction:Q,estimateGas:Be,sections:O})},"portfolio"):null,bc=me?g("div",{className:fe("wi-view-inner wi-send-body",F.current&&"wi-view-send"),children:g(qo,{env:r,theme:i,walletAddress:u,accountName:x,accounts:R,initialStep:lc,token:me,tokens:wt,onTokenChange:j,sendTransaction:Q,getTransactionReceipt:be,estimateGas:Be,getTokenPriceUsd:v=>{let W=Ye.get(At(v.chainId,v.address));if(!W?.price)return;let oe=parseFloat(W.price);return Number.isFinite(oe)?oe:void 0},onClose:k,onBackToWallet:vo,onSubmitted:dc,onSuccess:pc,onFailed:fc,onOutlink:Me})},"send"):null,wc=z.useMemo(()=>Ke||wt.map(v=>{let W=Ye.get(At(v.chainId,v.address)),oe=W?.price?parseFloat(W.price):void 0;return{name:v.name,symbol:v.symbol,chainId:v.chainId,address:v.address,decimals:v.quantity.decimals,balance:no(v.quantity.numeric,v.quantity.decimals),iconUrl:v.icon_url,priceUsd:Number.isFinite(oe)?oe:void 0}}),[Ke,Ye,wt]),xc=g("div",{className:fe("wi-view-inner wi-bridge-body",F.current&&"wi-view-send"),children:g(dr,{env:r,walletAddress:u,tokens:wc,history:tt,termsUrl:L,getQuote:De,getToTokens:Ie,getApproval:We,approveBridge:Qt,submitBridge:nt,onClose:k,onBackToWallet:vo})},"bridge"),Er=!!N&&x?.trim().toLowerCase()!=="my wallet",_a=P(va,{children:[P("span",{className:"wi-receive-avatar",children:[g("span",{className:"wi-avatar-fallback",style:La}),So&&g("img",{src:So,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:ko,onError:v=>{v.currentTarget.style.display="none"}})]}),g("span",{className:"wi-receive-account-name",children:x??"Account 1"}),Er&&g("span",{className:"wi-receive-chevron","data-open":Qn,"aria-hidden":"true",children:g(yn,{size:16})})]}),vc=P("div",{className:fe("wi-view-inner wi-qr-body",F.current&&"wi-view-qr"),children:[P("div",{className:"wi-receive-section",children:[Er?g("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{Yn(!0),N?.()},"aria-label":"Switch account",children:_a}):g("div",{className:"wi-receive-account",children:_a}),P("div",{className:"wi-qr-block",children:[P("div",{className:"wi-qr-box",children:[g(du,{value:u,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&g("div",{className:"wi-qr-logo",children:g(mi,{size:33})})]}),g("p",{className:"wi-qr-address",children:u})]}),P("button",{type:"button",className:"wi-qr-copy-btn",onClick:Ea,"data-track":"address_copy",children:[g("span",{className:"wi-qr-copy-icon",children:En?g(xn,{size:16}):g(Jn,{size:16})}),g("span",{className:"wi-qr-copy-text",children:En?"Copied!":"Copy address"})]})]}),Aa&&g("div",{className:"wi-receive-footer",children:Aa})]},"qr"),yc=D==="qr"||D==="portfolio"||D==="send"||D==="bridge",Fa=G!==null?g("div",{className:"wi-builtin-footer",children:G}):null,Ba=P("div",{className:"wi-account-text",children:[Er?P("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{Yn(!0),N?.()},"aria-label":"Switch account","aria-expanded":Qn,children:[g("span",{className:"wi-account-name",children:x??"Account 1"}),g("span",{className:"wi-account-switch","data-open":Qn,"aria-hidden":"true",children:g(yn,{size:20})})]}):g("div",{className:"wi-account-row",children:g("span",{className:"wi-account-name",children:x??"Account 1"})}),P("button",{type:"button",className:"wi-address-row-btn",onClick:Ea,"aria-label":"Copy address","data-track":"address_copy",children:[g("span",{className:"wi-account-address",children:ut(u)}),g("span",{className:"wi-account-copy","data-copied":En,children:En?g(xn,{size:12}):g(Jn,{size:12})})]})]}),Ma=P(va,{children:[o,D==="qr"?g("div",{className:"wi-sticky-header",children:P("div",{className:"wi-header wi-header--receive",children:[g("button",{type:"button",className:"wi-header-back",onClick:vo,"aria-label":"Back",children:g(vn,{size:24})}),g("span",{className:"wi-receive-title",children:"Receive"}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Ot,{size:24})})]})}):D==="send"||D==="bridge"?null:yc?P("div",{className:"wi-sticky-header",children:[P("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[g("button",{type:"button",className:"wi-header-back",onClick:vo,"aria-label":"Back",children:g(vn,{size:24})}),g("div",{className:"wi-account-block wi-account-block--sub-account",children:Ba}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Ot,{size:24})})]}),g("hr",{className:"wi-divider"})]}):P("div",{className:"wi-sticky-header",children:[P("div",{className:"wi-header wi-header--wallet",children:[P("div",{className:"wi-account-block",children:[P("div",{className:"wi-avatar",children:[g("div",{className:"wi-avatar-fallback",style:La}),So&&g("img",{src:So,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:ko,onError:v=>{v.currentTarget.style.display="none"}})]}),Ba]}),P("div",{className:"wi-header-actions",children:[m&&y&&g("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:Kn,"aria-label":"Show QR code","data-track":"receive",children:g(_o,{size:20})}),g("button",{type:"button",className:"wi-header-action",onClick:k,"aria-label":"Close",children:g(Ot,{size:24})})]})]}),g("hr",{className:"wi-divider"})]}),P("div",{className:"wi-view-container",children:[D==="wallet"&&gc,D==="qr"&&vc,D==="portfolio"&&hc,D==="send"&&bc,D==="bridge"&&xc]}),D==="wallet"&&Mt&&g("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Mt}),D==="wallet"&&se&&P("a",{className:"wi-send-toast",href:Sr??"#",target:"_blank",rel:"noopener noreferrer",onClick:v=>{if(!Sr){v.preventDefault();return}et(v,Sr,{category:"send",origin:"send-transaction",payload:{chainId:se.chainId,txHash:se.txHash}},Me)},children:[g("span",{className:"wi-send-toast-icon","data-status":se.status,"aria-hidden":!0,children:se.status==="pending"?g("span",{className:"wi-send-toast-spinner"}):se.status==="error"?g("span",{className:"wi-send-toast-error-dot"}):g(xi,{size:20})}),P("span",{className:"wi-send-toast-copy",children:[g("span",{className:"wi-send-toast-title",children:se.status==="pending"?"Sending...":se.status==="error"?"Send failed":"Send complete"}),g("span",{className:"wi-send-toast-desc",children:se.status==="pending"||se.status==="error"?se.description:"Tap to see your transaction"})]})]}),Fa&&D!=="portfolio"&&D!=="send"&&g("div",{className:"wi-sticky-footer",children:g("div",{className:"wi-footer",ref:Xt,children:Fa})})]}),Da={...J,...pt>0?{"--wi-footer-height":`${pt}px`}:null};return a?g(ge,{feature:"wallet_info",children:P(pr.Portal,{children:[l&&g(pr.Overlay,{className:"wi-drawer-overlay"}),P(pr.Content,{className:fe("wi-drawer-content",n),"data-theme":i,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:Da,"data-direction":c,"data-no-balance":!d||void 0,"data-has-footer":pt>0||void 0,"data-view":D,children:[g(pr.Title,{className:"wi-sr-only",children:"My Wallet"}),Ma]})]})}):P(ge,{feature:"wallet_info",children:[l&&s&&g("div",{className:"wi-drawer-overlay",onClick:k}),g(fr.Portal,{children:g(fr.Content,{align:e,sideOffset:t,className:fe("wi-popover-content",n),"data-theme":i,style:Da,"data-no-balance":!d||void 0,"data-has-footer":pt>0||void 0,"data-view":D,children:Ma})})]})}import*as _l from"react";function Fl({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=an();return _l.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as Bl from"react";function Ml({children:e}){let{setFooterContent:t}=an();return Bl.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 ya}from"react/jsx-runtime";function bu({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:d,walletAddress:w,accountName:h,sendAccounts:m,profileImageUrl:y,connectorId:b,connectorName:u,connectorIconUrl:x,preferredTokens:R=[],onSelectWallet:p,onCopyAddress:C,onBuy:k,onBuyDisabledMessage:N,onBridgeDisabledMessage:E,onSendDisabledMessage:T,onDisconnect:M,disconnectLabel:q="Disconnect",termsUrl:L=Dn,termsLabel:K="Terms of Service",privacyUrl:U=Fo,privacyLabel:ce="Privacy Policy",open:J,onOpenChange:$,showPortfolio:ne=!1,portfolioTitle:G="My Portfolio",portfolioSections:D,showTotalAssets:ae=!0,totalAssetsLabel:me="Total Assets USD",sendTransaction:j,getTransactionReceipt:_e,estimateGas:xe,onOutlink:O,lpBalanceReader:ee,stakingRewardsReader:Fe,bridgeTokens:Q,bridgeHistory:be,getBridgeQuote:Be,getBridgeToTokens:Me,getBridgeApproval:St,approveBridge:ue,submitBridge:Ke,onReceive:tt,onBridge:De,onSend:Ie,style:We,children:Qt}){let nt=Ee(e),gt=b?Po[b]:void 0,ze=u??gt?.name,Rt=x??gt?.iconUrl,ht=Pn(`(max-width: ${n}px)`),ve=o??(i?"right":"bottom"),Mt=ve==="left"||ve==="right",Dt=r??!1,ot=J!==void 0,[Ge,rt]=Ve.useState(!1),Qe=ot?J:Ge,He=Ve.useCallback(pt=>{ot||rt(pt),$?.(pt)},[ot,$]),ye=Ve.useCallback(()=>He(!1),[He]),[dt,at]=Ve.useState(null),[Ye,bt]=Ve.useState("top"),[Yt,rn]=Ve.useState(null),[Zt,I]=Ve.useState("wallet"),[Z,ie]=Ve.useState(null);Ve.useEffect(()=>{Qe||(I("wallet"),ie(null))},[Qe]),Ve.useEffect(()=>{An(w)},[w]);let it=Ve.useCallback(()=>{jr(w),M?.()},[M,w]),Xt=Ve.useMemo(()=>({env:nt,theme:t,isMobile:ht,open:Qe,drawerDirection:ve,modal:Dt,showBalance:i,showForgeToken:a,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:d,walletAddress:w,accountName:h,sendAccounts:m,profileImageUrl:y,connectorName:ze,connectorIconUrl:Rt,preferredTokens:R,close:ye,onSelectWallet:p,onCopyAddress:C,onBuy:k,onBuyDisabledMessage:N,onBridgeDisabledMessage:E,onSendDisabledMessage:T,onDisconnect:M?it:void 0,disconnectLabel:q,termsUrl:L,termsLabel:K,privacyUrl:U,privacyLabel:ce,portalStyle:We,navContent:dt,navPosition:Ye,setNavContent:at,setNavPosition:bt,footerContent:Yt,setFooterContent:rn,view:Zt,setView:I,selectedSendToken:Z,setSelectedSendToken:ie,showPortfolio:ne,portfolioTitle:G,portfolioSections:D,showTotalAssets:ae,totalAssetsLabel:me,sendTransaction:j,getTransactionReceipt:_e,estimateGas:xe,onOutlink:O,lpBalanceReader:ee,stakingRewardsReader:Fe,bridgeTokens:Q,bridgeHistory:be,getBridgeQuote:Be,getBridgeToTokens:Me,getBridgeApproval:St,approveBridge:ue,submitBridge:Ke,onReceive:tt,onBridge:De,onSend:Ie}),[nt,t,ht,Qe,ve,Dt,i,a,s,c,l,d,w,h,m,y,ze,Rt,R,ye,p,C,k,N,E,T,M,it,q,L,K,U,ce,We,dt,Ye,Yt,Zt,Z,ne,G,D,ae,me,j,_e,xe,O,ee,Fe,Q,be,Be,Me,St,ue,Ke,tt,De,Ie]);return ya(Or.Provider,{value:Xt,children:ht?ya(hu.Root,{direction:ve,open:Qe,onOpenChange:He,handleOnly:Mt,noBodyStyles:!0,repositionInputs:!1,children:Qt},"drawer"):ya(Dl.Root,{open:Qe,onOpenChange:He,children:Qt},"popover")})}var jn=Object.assign(bu,{Trigger:ns,Content:Pl,Nav:Fl,Footer:Ml});import*as Kt from"react";import*as ec from"@radix-ui/react-dialog";import{Drawer as Tu}from"vaul";import{createContext as wu,useContext as xu}from"react";var ur=wu(null);function fo(){let e=xu(ur);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as Ol,useEffect as vu,useCallback as yu}from"react";function mr(){let[e,t]=Ol([]),[n,o]=Ol(!0);vu(()=>{if(typeof window>"u"){o(!1);return}let i=[],a=c=>{let{info:l}=c.detail;l?.rdns&&!i.some(d=>d.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=yu(i=>e.some(a=>a.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as Wl from"@radix-ui/react-dialog";import{Drawer as ku}from"vaul";import{jsx as ka}from"react/jsx-runtime";function Ul({asChild:e,children:t}){let{isMobile:n}=fo(),o=n?ku.Trigger:Wl.Trigger;return ka(ge,{feature:"wallet_connect",children:ka(o,{asChild:e??t!=null,children:t??ka("button",{type:"button","data-track":"open",children:"Connect Wallet"})})})}import{useEffect as Su}from"react";import*as qt from"@radix-ui/react-dialog";import{Drawer as hr}from"vaul";import{jsx as te,jsxs as gn}from"react/jsx-runtime";function gr(){return gn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),te("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 zl(){return gn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[gn("g",{clipPath:"url(#clip0_1331_27065)",children:[te("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"}),te("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"}),te("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"}),te("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"}),te("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"}),te("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),te("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"})]}),te("defs",{children:te("clipPath",{id:"clip0_1331_27065",children:te("rect",{width:"40",height:"40",fill:"white"})})})]})}function Gl(){return gn("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),te("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),te("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),te("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),te("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 Hl(){return gn("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[te("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),te("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"}),te("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),te("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 $l(){return gn("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[gn("g",{clipPath:"url(#clip0_1185_7785)",children:[te("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"}),te("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"})]}),te("defs",{children:te("clipPath",{id:"clip0_1185_7785",children:te("rect",{width:"28",height:"28",fill:"white"})})})]})}function jl(){return gn("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[te("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"}),te("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"}),te("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"}),te("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 Vl(){return te("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:te("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 ql(){return te("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:te("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Sa={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:gr},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:gr,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:gr,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:zl,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:Gl},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Hl,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:$l,badge:"For SHOP"}};function Ra(e){return Sa[e]}var Ca={google:{id:"google",name:"Google",icon:jl},apple:{id:"apple",name:"Apple",icon:Vl}};function Kl(e){return Ca[e]}import{Fragment as Xl,jsx as X,jsxs as qe}from"react/jsx-runtime";function Ql(e,t){Te("connect","wallet_selected",{tags:{item_id:e}});let n=t?.();n instanceof Promise&&n.then(()=>Te("connect","connected"),o=>Te("connect","connected",{status:"failure",reason:Nt(o)}))}function Ru({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:fe("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 Cu({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 Yl(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:i,isDetected:a,close:s,isMobile:c}=fo(),l=t.filter(h=>{let m=Ra(h).visibility;return!m||m==="always"?!0:m==="desktop-only"?!c:m==="mobile-only"?c:!0}),d=o.length>0,w=l.length>0;return qe(Xl,{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(ql,{})})]}),qe("div",{className:"wcm-body",children:[d&&qe(Xl,{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(h=>{let m=Kl(h);return X(Cu,{social:m,onSignIn:()=>{Ql(h,n[h]),s()}},h)})}),w&&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"})]})]}),w&&X("div",{className:"wcm-wallet-list",children:l.map(h=>{let m=Ra(h),y=m.rdns?a(m.rdns):!1;return X(Ru,{wallet:m,detected:y,onConnect:()=>{Ql(h,e[h]),s()}},h)})}),qe("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",X(Zl,{href:r,track:"terms_link",children:"Terms of Service"})," ","and consent to its"," ",X(Zl,{href:i,track:"privacy_link",children:"Privacy Policy"}),"."]})]})]})}function Zl({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 Jl({className:e}){let{isMobile:t,theme:n,portalStyle:o,open:r}=fo();return Su(()=>{r&&Te("connect","opened")},[r]),t?X(ge,{feature:"wallet_connect",children:qe(hr.Portal,{children:[X(hr.Overlay,{className:"wcm-overlay"}),qe(hr.Content,{className:fe("wcm-drawer-content",e),"data-theme":n,style:o,children:[X(hr.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X("div",{className:"wcm-drawer-handle"}),X("div",{className:"wcm-drawer-body",children:X(Yl,{})})]})]})}):X(ge,{feature:"wallet_connect",children:qe(qt.Portal,{children:[X(qt.Overlay,{className:"wcm-overlay"}),qe(qt.Content,{className:fe("wcm-dialog-content",e),"data-theme":n,style:o,children:[X(qt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),X(qt.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(Yl,{})})]})]})})}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 uo}from"react/jsx-runtime";var Nu={};function Iu({wallets:e,socialProviders:t=Nu,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:i=768,drawerDirection:a="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:d,open:w,onOpenChange:h,children:m}){let y=Pn(`(max-width: ${i}px)`),[b,u]=Kt.useState(!1),x=w!==void 0,R=x?w:b,p=Kt.useCallback(L=>{x||u(L),h?.(L)},[x,h]),C=Kt.useCallback(()=>p(!1),[p]),{isDetected:k}=mr(),N=Kt.useMemo(()=>Object.keys(e),[e]),E=Kt.useMemo(()=>Object.keys(t),[t]),T=Kt.useMemo(()=>{let L={};return s&&(L["--wcm-dialog-width"]=s),c&&(L["--wcm-drawer-max-width"]=c),l&&(L["--wcm-drawer-min-width"]=l),{...L,...d}},[s,c,l,d]),M=Kt.useMemo(()=>({theme:r,isMobile:y,open:R,setOpen:p,close:C,wallets:e,activeWalletIds:N,socialProviders:t,activeSocialIds:E,termsUrl:n??Dn,privacyUrl:o??Fo,isDetected:k,portalStyle:T}),[r,y,R,p,C,e,N,t,E,n,o,k,T]),q=uo("div",{"data-theme":r,style:T,children:m});return y?uo(ur.Provider,{value:M,children:uo(Tu.Root,{direction:a,open:R,onOpenChange:p,noBodyStyles:!0,children:q},"drawer")}):uo(ur.Provider,{value:M,children:uo(ec.Root,{open:R,onOpenChange:p,children:q})})}var tc=Object.assign(Iu,{Trigger:Ul,Content:Jl});import*as oc 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 Eu='<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>',Lu='<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>',Au='<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>',Pu='<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>',_u='<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 mo(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var br=mo(Eu),wr=mo(Lu),xr=mo(Au),vr=mo(Pu),yr=mo(_u);import{jsx as ct,jsxs as go}from"react/jsx-runtime";function rc({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:i,onConnect:a,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:d,onBuyDisabledMessage:w,label:h="Connect Wallet",connectingLabel:m="Connecting...",disconnectLabel:y,className:b,theme:u="dark",env:x,showBalance:R=!0,showPortfolio:p,drawerDirection:C,modal:k,connectorId:N,style:E,walletInfoStyle:T,sendTransaction:M,getTransactionReceipt:q,estimateGas:L,onReceive:K,onBridge:U,onSend:ce,bridgeTokens:J,bridgeHistory:$,getBridgeQuote:ne,getBridgeToTokens:G,getBridgeApproval:D,approveBridge:ae,submitBridge:me}){let j=b?`cb-button ${b}`:"cb-button",_e=b?`cb-pill ${b}`:"cb-pill";if(oc.useEffect(()=>{An(t)},[t]),e)return go("button",{type:"button",disabled:!0,className:j,style:E,"aria-busy":"true",children:[ct("span",{className:"cb-spinner","aria-hidden":"true"}),ct("span",{className:"cb-button-label",children:m})]});if(t){let xe=o??Du(n),O=n?Bu[n]:void 0;return ct(ge,{feature:"connect_button",children:go(jn,{env:x,theme:u,drawerDirection:C,modal:k,showBalance:R,showPortfolio:p,walletAddress:t,accountName:r,sendAccounts:i,connectorId:N,onSelectWallet:l,onCopyAddress:c?(ee,Fe)=>{Fe&&c()}:void 0,onDisconnect:s,disconnectLabel:y,style:T,sendTransaction:M,getTransactionReceipt:q,estimateGas:L,onReceive:K,onBridge:U,onBuy:d,onBuyDisabledMessage:w,onSend:ce,bridgeTokens:J,bridgeHistory:$,getBridgeQuote:ne,getBridgeToTokens:G,getBridgeApproval:D,approveBridge:ae,submitBridge:me,children:[ct(jn.Trigger,{asChild:!0,children:go("button",{type:"button",className:_e,"data-track":"wallet_pill_open",style:E,"aria-label":`Connected with ${xe}: ${nc(t)}`,children:[O?ct("img",{src:O,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":n}):ct("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),ct("span",{className:"cb-pill-address",children:nc(t)})]})}),ct(jn.Content,{align:"end",sideOffset:8})]})})}return ct(ge,{feature:"connect_button",children:go("button",{type:"button",onClick:a,className:j,"data-track":"connect_click",style:E,"aria-label":typeof h=="string"?h:"Connect Wallet",children:[ct(Fu,{}),ct("span",{className:"cb-button-label",children:h})]})})}function Fu(){return go("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[ct("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"}),ct("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"}),ct("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var Bu={google:vr,apple:yr,cross:br,metamask:wr,binance:xr},Mu={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Du(e){return e?Mu[e]:"Wallet"}function nc(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as ac 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 Vn,jsxs as Wu}from"react/jsx-runtime";var ic="https://www.onechain.nexus/skills";function sc({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:d="button"}){let[w,h]=ac.useState(!1),m=Ee(),y=Rn("apps.json",m,k=>Sn(k?.skills,m)),b=t??y,u=async k=>{if(b&&!n){l?window.open(b,"_blank","noopener,noreferrer"):window.location.href=b;return}if(n)try{h(!0),await n()}finally{h(!1)}},x=a||s||w,R=s||w,p=R?c:e,C=o?`sb-button ${o}`:"sb-button";return Vn(ge,{feature:"skills",children:Wu("button",{type:d,onClick:u,disabled:x,className:C,"data-theme":i,"data-track":"click",style:r,"aria-busy":R,children:[R?Vn("span",{className:"sb-spinner","aria-hidden":"true"}):Vn(Ou,{}),Vn("span",{className:"sb-label",children:p})]})})}function Ou(){return Vn("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:Vn("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"})})}Ar({mode:"dapp-ui"});export{yr as APPLE_ICON,Za as AppLauncher,ci as AppLauncherContent,ni as AppLauncherTrigger,xr as BINANCE_ICON,dr as BridgeFlow,Po as CONNECTOR_REGISTRY,br as CROSSX_ICON,rc as ConnectButton,Wr as ConnectorId,ic as DEFAULT_SKILLS_HREF,No as DappUiErrorBoundary,vr as GOOGLE_ICON,wr as METAMASK_ICON,rr as PORTFOLIO_SECTIONS,Ca as SOCIAL_REGISTRY,qo as SendFlow,sc as SkillsButton,Jr as TOKEN_STATS_QUERY_KEY,Xr as USER_BALANCE_QUERY_KEY,Sa as WALLET_REGISTRY,tc as WalletConnectModal,jn as WalletInfo,ol as WalletPortfolio,Gn as WalletPortfolioBody,Ar as announceAppLauncherUsage,To as captureDappUiException,Co as getDappUiSentryScope,Xn as initDappUiSentry,Nt as normalizeFailureReason,Ee as resolveEnvironment,An as setDappUiAnalyticsUser,Io as trackDappUiEvent,Te as trackDappUiFunnel,Lo as useGlobalMenu,dn as useTokenBalance,pn as useTokenStats,mr as useWalletDetect};
22
+ //# sourceMappingURL=index.js.map