@nexus-cross/dapp-ui 1.3.0-beta.1 → 1.3.0

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,19 +1,21 @@
1
- function ur(e){try{return import.meta.env?.[e]}catch{return}}function gr(e){if(!(typeof process>"u"))return process.env?.[e]}function me(e){if(e)return wr(e);let t=ur("VITE_CROSSX_ENVIRONMENT")??ur("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??gr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??gr("CROSSX_ENVIRONMENT");return wr(t)}function wr(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var go="1.3.0";var kn="__nexusCrossAppLauncherRuntime";function ja(){if(typeof window>"u")return null;let e=window;return e[kn]??(e[kn]={mode:"dapp-ui"}),e[kn]}function qa(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 o=e.connectKitVersion??"unknown";console.info(`[CROSSx App Launcher] connect-kit-react v${o} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${go}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${go} \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 wo(e){let t=ja();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),qa(t))}import*as Gt from"react";import*as hr from"@radix-ui/react-popover";import{Drawer as Xa}from"vaul";import{createContext as Ka,useContext as Za}from"react";var ho=Ka(null);function Sn(){let e=Za(ho);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as Ya,useEffect as Qa}from"react";function zt(e){let[t,o]=Ya(!1);return Qa(()=>{let n=window.matchMedia(e);o(n.matches);let r=i=>o(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),t}function P(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}P(`[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-badge-bg: var(--ds-accent-primary-low, #123235);--al-badge-text: var(--ds-accent-primary-default, #00ceb2);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--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-badge-bg: var(--ds-accent-primary-low, #e7f9f8);--al-badge-text: var(--ds-accent-primary-default, #00b4b7);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #00000080)}
2
- `);P(`.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
- `);P(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
- `);P(`.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-grid{grid-template-columns:repeat(4,100px);row-gap:16px;column-gap:0;padding:0;justify-content:center;align-items:start}.al-popover-content .al-grid-item{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:hidden}.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-right,.al-popover-content .al-badge-new{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-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}.al-drawer-content .al-grid-item-icon{width:32px;height:32px;border-radius:6.75px;overflow:hidden}.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(--ds-content-low, #00000066);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:space-between;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:#252b39!important}:root[data-ds-theme=light] .al-grid-item:hover,:root[data-ds-theme=light] .al-grid-item[data-active=true]{background:#eff3f8!important}.al-grid-item-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden}.al-grid-item-right{display:flex;align-items:center;gap:6px;flex-shrink:0}.al-grid-item-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0}.al-grid-item-icon img{width:100%;height:100%;object-fit:contain}.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-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}.al-badge-new{display:flex;width:16px;height:16px;justify-content:center;align-items:center;aspect-ratio:1/1;border-radius:12px;background:var(--ds-system-purple-high, #7346f3);color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
5
- `);P("");import{jsx as bo}from"react/jsx-runtime";function br({env:e,theme:t="dark",mobileBreakpoint:o=768,domain:n,children:r}){let i=zt(`(max-width: ${o}px)`),[a,c]=Gt.useState(!1),d=Gt.useCallback(()=>c(!1),[]),l=me(e),s=Gt.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:n,close:d}),[l,t,i,a,n,d]);return bo(ho.Provider,{value:s,children:i?bo(Xa.Root,{direction:"right",open:a,onOpenChange:c,noBodyStyles:!0,children:r},"drawer"):bo(hr.Root,{open:a,onOpenChange:c,children:r},"popover")})}import*as kr from"@radix-ui/react-popover";import{Drawer as es}from"vaul";import{jsx as ue,jsxs as Ja}from"react/jsx-runtime";function xr({size:e=18}){return Ja("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ue("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),ue("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function vr(){return ue("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ue("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function yr(){return ue("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ue("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Cn}from"react/jsx-runtime";function Sr({asChild:e,children:t,className:o,style:n}){let{isMobile:r,theme:i}=Sn(),a=t!=null,c=e??!0,d=o?`al-trigger-btn ${o}`:"al-trigger-btn",l=a?t:Cn("button",{type:"button",className:d,"data-theme":i,style:n,children:Cn(xr,{size:18})});return r?Cn(es.Trigger,{asChild:c,children:l}):Cn(kr.Trigger,{asChild:c,children:l})}import*as St from"react";import*as Rn from"@radix-ui/react-popover";import{Drawer as Ht}from"vaul";import{useQuery as os}from"@tanstack/react-query";var Cr={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json"};var ts="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",ns="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function Be(e,t){return`${e==="production"?ns:ts}/${t}.png`}function Nr(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://dev-x.crosstoken.io/gametoken/CROSS",stage:"https://stg-x.crosstoken.io/gametoken/CROSS",production:"https://x.crosstoken.io/gametoken/CROSS"},iconUrl:Be(t,"dex"),order:1e3,type:"gametoken",badge:null,isNew:!1},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg-x.crosstoken.io/forge",stage:"https://stg-x.crosstoken.io/forge",production:"https://x.crosstoken.io/forge"},iconUrl:Be(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0},{id:"crossd",label:"Bridge (CROSSD)",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:Be(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1},{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:Be(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg-x.crosstoken.io/rewards",stage:"https://stg-x.crosstoken.io/rewards",production:"https://x.crosstoken.io/rewards"},iconUrl:Be(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1},{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:Be(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{id:"play",label:"Play",description:"Discover and play games on CROSS.",url:{dev:"https://stg-play.cross.nexus",stage:"https://stg-play.cross.nexus",production:"https://play.cross.nexus"},iconUrl:Be(t,"play"),order:8500,type:"play",badge:null,isNew:!0},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://www.dev.cross.shop/",stage:"https://www.stage.cross.shop/",production:"https://www.cross.shop/"},iconUrl:Be(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1},{id:"points",label:"Points",description:"Dive into CROSS World, Earn CROSS Points",url:{dev:"https://stg-x.crosstoken.io/points",stage:"https://stg-x.crosstoken.io/points",production:"https://x.crosstoken.io/points"},iconUrl:Be(t,"point"),order:1e4,type:"points",badge:null,isNew:!1},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg-wave.crosstoken.io/en",stage:"https://stg-wave.crosstoken.io/en",production:"https://wave.crosstoken.io/en"},iconUrl:Be(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.crosstoken.io/612055",stage:"https://stg-explorer.crosstoken.io/612055",production:"https://explorer.crosstoken.io/612055"},iconUrl:Be(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function Nn(e){let t=me(e);return os({queryKey:["global-menu",t],queryFn:async({signal:o})=>{try{let n=await fetch(Cr[t],{cache:"no-store",signal:o});if(!n.ok)throw new Error(`Failed to fetch global menu: ${n.status}`);return n.json()}catch(n){if(o.aborted)throw n;return Nr(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function U(...e){return e.filter(Boolean).join(" ")}import{jsx as te,jsxs as nn}from"react/jsx-runtime";function rs(e){return e.id==="cross-staking"||e.type==="cross-staking"}function Lr({align:e="end",sideOffset:t=8,className:o}){let{env:n,theme:r,isMobile:i,domain:a,close:c}=Sn(),{data:d}=Nn(n),l=St.useMemo(()=>(d?.items??[]).sort((b,v)=>b.order-v.order),[d]),s=8,m=St.useRef(null),f=St.useCallback(b=>{m.current={x:b.clientX,y:b.clientY}},[]),u=typeof window<"u"?window.location.pathname:"",x=St.useCallback((b,v)=>{if(m.current){let R=b.clientX-m.current.x,F=b.clientY-m.current.y;if(m.current=null,Math.abs(R)>s||Math.abs(F)>s)return}let S=v.url[n]??v.url.production,g=Rr(S,a);if(!g)try{let R=new URL(S).pathname;if(u===R||u.startsWith(R+"/")){c();return}}catch{}g?window.open(S,"_blank","noopener,noreferrer"):window.location.href=S,c()},[n,a,c,u]),w=te("div",{className:"al-grid","data-theme":r,children:l.map(b=>{let v=b.url[n]??b.url.production,S=Rr(v,a),g=!1;if(!S)try{let R=new URL(v).pathname;g=u===R||u.startsWith(R+"/")}catch{g=!1}return nn("button",{type:"button",className:"al-grid-item","data-active":g||void 0,onPointerDown:f,onClick:R=>x(R,b),children:[nn("div",{className:"al-grid-item-left",children:[te("div",{className:"al-grid-item-icon",children:te("img",{src:b.iconUrl,alt:b.label,width:24,height:24,loading:"lazy"})}),te("span",{className:"al-grid-item-label",children:b.label}),b.isNew&&te("span",{className:"al-badge-new",children:"N"})]}),te("div",{className:"al-grid-item-right",children:b.badge&&!rs(b)&&te("span",{className:"al-badge",children:b.badge})})]},b.id)})});return i?nn(Ht.Portal,{children:[te(Ht.Overlay,{className:"al-drawer-overlay"}),nn(Ht.Content,{className:U("al-drawer-content",o),"data-theme":r,children:[nn("div",{className:"al-drawer-header",children:[te(Ht.Close,{className:"al-drawer-close",children:te(vr,{})}),te(Ht.Title,{className:"al-drawer-title",children:"CROSS Services"}),te(Ht.Close,{className:"al-drawer-close",children:te(yr,{})})]}),te("div",{className:"al-drawer-body",children:w})]})]}):te(Rn.Portal,{children:te(Rn.Content,{align:e,sideOffset:t,className:U("al-popover-content",o),"data-theme":r,children:w})})}function Rr(e,t){try{let o=new URL(e).hostname;return typeof window>"u"?!0:o!==(t??window.location.hostname)}catch{return!1}}import*as ae from"react";import*as fa from"@radix-ui/react-popover";import{Drawer as Yl}from"vaul";import{createContext as is,useContext as as}from"react";var xo=is(null);function lt(){let e=as(xo);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var vo=(n=>(n.CROSSx="crossx",n.MetaMask="io.metamask",n.Binance="com.binance.wallet",n))(vo||{}),Ln={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 xi from"react";import{jsx as _,jsxs as rn}from"react/jsx-runtime";function Er({size:e=16,className:t}){return rn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_("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"}),_("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 yo({size:e=16,className:t}){return _("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("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 on({size:e=16,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vt({size:e=24,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ir({size:e=20,className:t}){return rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_("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"}),_("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 Tr({size:e=20,className:t}){return _("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:_("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 Ct({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function ko({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pr({size:e=16,className:t}){return rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_("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"}),_("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 Ar({size:e=16,className:t}){return rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_("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"}),_("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mr({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("path",{d:"M17.5 13.3333H15C14.558 13.3333 14.134 13.5089 13.8215 13.8215C13.5089 14.134 13.3333 14.558 13.3333 15V17.5M17.5 17.5V17.5083M10 5.83333V8.33333C10 8.77536 9.8244 9.19928 9.51184 9.51184C9.19928 9.8244 8.77536 10 8.33333 10H5.83333M2.5 10H2.50833M10 2.5H10.0083M10 13.3333V13.3417M13.3333 10H14.1667M17.5 10V10.0083M10 17.5V16.6667M3.33333 2.5H5.83333C6.29357 2.5 6.66667 2.8731 6.66667 3.33333V5.83333C6.66667 6.29357 6.29357 6.66667 5.83333 6.66667H3.33333C2.8731 6.66667 2.5 6.29357 2.5 5.83333V3.33333C2.5 2.8731 2.8731 2.5 3.33333 2.5ZM14.1667 2.5H16.6667C17.1269 2.5 17.5 2.8731 17.5 3.33333V5.83333C17.5 6.29357 17.1269 6.66667 16.6667 6.66667H14.1667C13.7064 6.66667 13.3333 6.29357 13.3333 5.83333V3.33333C13.3333 2.8731 13.7064 2.5 14.1667 2.5ZM3.33333 13.3333H5.83333C6.29357 13.3333 6.66667 13.7064 6.66667 14.1667V16.6667C6.66667 17.1269 6.29357 17.5 5.83333 17.5H3.33333C2.8731 17.5 2.5 17.1269 2.5 16.6667V14.1667C2.5 13.7064 2.8731 13.3333 3.33333 13.3333Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function _r({size:e=42,className:t}){return _("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:_("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 Fr({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("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 Or({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("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 Wr({size:e=20,className:t}){return _("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:_("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 Br({size:e=20,className:t}){return rn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[_("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),_("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 C from"react";import Nt from"bignumber.js";function ss(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 ct(e,t){if(!e||e==="0")return"0.00";let o=new Nt(e).shiftedBy(-t),n=o.isGreaterThanOrEqualTo(1)?2:4;return o.toFormat(n,Nt.ROUND_DOWN)}function ge(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function So(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let o=t>=1?2:4,n=Math.pow(10,o);return`$${(Math.floor(t*n)/n).toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o})}`}function Dr(e,t,o){let r=new Nt(e).shiftedBy(-t).multipliedBy(new Nt(o));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Nt.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Nt.ROUND_DOWN):r.decimalPlaces(4,Nt.ROUND_DOWN)).toFormat()}`}function zr(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 o=t;if(o.includes("e")||o.includes("E")){let a=Number(o);if(!Number.isFinite(a)||a===0)return{displayValue:"0",isLowerBound:!1};o=ss(a.toFixed(18))}let[n="0",r=""]=o.split(".");if(Number(n)>=1){let a=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(n).toLocaleString("en-US")}.${a}`,isLowerBound:!1}}return r.length<4?{displayValue:`${n}.${r}`,isLowerBound:!1}:r.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${r.slice(0,4)}`,isLowerBound:!1}}import{useMemo as ls}from"react";import{useQuery as cs}from"@tanstack/react-query";var Ee={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},le={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var ds="send:chain-info";function ps(e){if("data"in e&&e.data!==void 0){let t=e.data;if(Array.isArray(t)){let o=t[0];if(!o)throw new Error("Chain info payload is empty.");return o}return t}return e}function Co(e,...t){let o=e.replace(/\/+$/,""),n=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[o,...n].join("/")}function fs(e,t,o,n){if(n)return t===le[e].cross?Gr(t,n):o?.explorer_url?Co(o.explorer_url,o.explorer_postfix?.transaction??"tx",n):ms(e,t,n)}function Gr(e,t){return Co("https://explorer.crosstoken.io",String(e),"tx",t)}function ms(e,t,o){let n=le[e];if(t===n.cross)return Gr(t,o);if(t===n.bsc)return Co(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",o)}function En(e,t,o,n=!0){let r=Ee[e],i=cs({queryKey:[ds,e,t],queryFn:async({signal:d})=>{let l=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:d});if(!l.ok)throw new Error(`Failed to fetch chain info: ${l.status}`);let s=await l.json();if("code"in s&&s.code!==void 0&&s.code!==200)throw new Error(`Chain info API error: ${s.code}`);return ps(s)},enabled:n,staleTime:300*1e3}),a=i.data;return{transactionUrl:ls(()=>fs(e,t,a,o),[t,a,e,o]),chainInfo:a,...i}}var Hr="0x0000000000000000000000000000000000000001";var us="0xa9059cbb",gs=/^0x[a-fA-F0-9]{40}$/,ws="nexus-cross:dapp-ui:send:recent:",Vr=10;function hs(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function an(e){return e.toLowerCase()}function je(e){return gs.test(e)}function Ut(e){return an(e.address)===Hr}function No(e){return`${ws}${e.toLowerCase()}`}function $t(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(No(e));if(!t)return[];let o=JSON.parse(t);return Array.isArray(o)?o.filter(n=>n!==null&&typeof n=="object"&&je(n.address)&&typeof n.updatedAt=="number").slice(0,Vr):[]}catch{return[]}}function Ro(e,t){if(typeof window>"u")return[];let o=an(t),n=[{address:o,updatedAt:Date.now()},...$t(e).filter(r=>r.address!==o)].slice(0,Vr);try{window.localStorage.setItem(No(e),JSON.stringify(n))}catch{return $t(e)}return n}function Lo(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(No(e))}catch{}}function Rt(e,t){let o=e.trim();if(!o)return{error:"Enter an amount."};if(!/^\d+(\.\d*)?$/.test(o))return{error:"Enter a valid amount."};let[n="0",r=""]=o.split(".");if(r.length>t)return{error:`Max ${t} decimal places.`};let i=BigInt(n||"0"),a=r.padEnd(t,"0"),c=a?BigInt(a):0n,d=10n**BigInt(t),l=i*d+c;return l<=0n?{error:"Amount must be greater than 0."}:{value:l}}function Eo(e,t){let o=BigInt(e||"0"),n=10n**BigInt(t),r=o/n,i=o%n;if(i===0n)return r.toString();let a=hs(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function Io(e,t){let o=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),n=t.toString(16).padStart(64,"0");return`${us}${o}${n}`}function $r(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 o=e,n=[];return typeof o.name=="string"&&n.push(o.name),typeof o.shortMessage=="string"&&n.push(o.shortMessage),typeof o.message=="string"&&n.push(o.message),typeof o.details=="string"&&n.push(o.details),o.cause!==void 0&&n.push($r(o.cause,t+1)),n.join(`
6
- `).toLowerCase()}function bs(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 To(e,t={},o="Failed to send transaction."){let n=$r(e);if(!n)return o;let r=t.nativeSymbol?.trim()||"gas token",i=t.networkName?.trim();if(n.includes("user rejected")||n.includes("userrejected")||n.includes("user denied")||n.includes("user cancelled")||n.includes("user canceled")||n.includes("action_rejected")||n.includes("rejected by user"))return"Transaction was cancelled.";if(n.includes("insufficientfunds")||n.includes("insufficient funds")||n.includes("exceeds the balance of the account")||n.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 n.includes("transaction underpriced")||n.includes("replacement transaction underpriced")||n.includes("fee too low")?"Gas fee was too low for the network. Please try again.":n.includes("nonce too low")||n.includes("nonce has already been used")||n.includes("nonce too high")?"Pending transactions are out of order. Refresh the page and try again.":n.includes("execution reverted")||n.includes("contractfunctionrevertederror")||n.includes("contractfunctionexecutionerror")?"The transaction was rejected by the contract. The recipient or token may be invalid.":n.match(/chain \d+ is not configured/)?"This network is not registered in the app. Contact support.":n.includes("http request failed")||n.includes("failed to fetch")||n.includes("network request failed")||n.includes("timeout")||n.includes("econnreset")||n.includes("rpc error")||n.includes("429")?"Network connection failed. Check your internet and try again.":n.includes("estimategas")||n.includes("gas estimation failed")?"Could not estimate the gas fee. The recipient address or amount may be invalid.":bs(e)||o}var xs=2000000000n,vs=1000000000n;async function In(e,t,o){let n=new AbortController,r=setTimeout(()=>n.abort(),8e3),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:o}),signal:n.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 Tn(e){return BigInt(e)}function ys(e){return`0x${e.toString(16)}`}function ks(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=ys(e.value)),e.data&&(t.data=e.data),t}function Ss(e){return e===56||e===97}async function Ur(e){try{let t=await In(e,"eth_gasPrice",[]);return{gasPrice:Tn(t)}}catch{return{gasPrice:xs}}}async function Cs(e,t){let o=vs;try{let n=await In(e,"eth_maxPriorityFeePerGas",[]);o=Tn(n)}catch{}return{maxFeePerGas:t+o,maxPriorityFeePerGas:o}}async function Ns(e,t){if(t)return Ur(e);let o;try{o=(await In(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return o?Cs(e,Tn(o)):Ur(e)}async function jr(e,t){let o=Ss(t.chainId),n=ks(t),[r,i]=await Promise.all([In(e,"eth_estimateGas",[n]),Ns(e,o)]);return{gasLimit:Tn(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function qr(e){let{estimateGas:t,sendTransaction:o,getTransactionReceipt:n}=e;return{canSend:!!o,canEstimateGas(r){return!!t||!!r},async estimateGas(r,i){if(t)return t(r);if(i)return jr(i,r);throw new Error("Gas estimation is not available.")},async sendTransaction(r){if(!o)throw new Error("Sending is not available for this wallet.");return o(r)},getTransactionReceipt:n}}var Rs=1500,Ls=120;function Kr(e){return!!(e.token||e.recipient||e.amount)}function Po({recipient:e,amount:t,token:o,balanceRaw:n}){let r={},i=e.trim(),a=Rt(t,o.quantity.decimals),c;return i?je(i)||(r.recipient="Enter a valid EVM recipient address."):r.recipient="Enter a recipient address.","error"in a?r.amount=a.error:(c=a.value,c>n&&(r.amount="Amount exceeds available balance.")),!Ut(o)&&!je(o.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:c,recipient:i&&je(i)?i:void 0}}function Ao({token:e,walletAddress:t,recipient:o,rawAmount:n}){let r=t;return Ut(e)?{to:o,value:n,chainId:e.chainId,from:r}:{to:an(e.address),data:Io(o,n),value:0n,chainId:e.chainId,from:r}}function Es(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Is=e=>new Promise(t=>setTimeout(t,e));async function Zr({repository:e,args:t,chainId:o,onSubmitted:n,pollIntervalMs:r=Rs,pollMaxAttempts:i=Ls}){let a=await e.sendTransaction(t);n(a);let{getTransactionReceipt:c}=e;if(!c)return"success";for(let d=0;d<i;d+=1){let l=await c({hash:a,chainId:o}).catch(()=>null);if(l)return Es(l)?"reverted":"success";await Is(r)}return"timeout"}var Yr=["token","recipient","amount","review"];function Qr(e){let{env:t,walletAddress:o,accountName:n,accounts:r=[],initialStep:i="recipient",token:a,tokens:c=[],onTokenChange:d,sendTransaction:l,getTransactionReceipt:s,estimateGas:m,getTokenPriceUsd:f,onSubmitted:u,onSuccess:x,onFailed:w,onExit:b,onOutlink:v}=e,S=C.useMemo(()=>qr({sendTransaction:l,getTransactionReceipt:s,estimateGas:m}),[l,s,m]),[g,R]=C.useState(a);C.useEffect(()=>{R(a)},[a.address,a.chainId]);let[F,E]=C.useState(i),[I,z]=C.useState(""),[G,$]=C.useState(""),[Z,T]=C.useState({}),[it,J]=C.useState("idle"),[q,Me]=C.useState(""),[ye,V]=C.useState(""),[_e,de]=C.useState(null),[ee,Xe]=C.useState(!1),[gt,He]=C.useState(""),Ve=C.useRef(0),[ke,At]=C.useState(null),[se,$e]=C.useState(""),[Mt,Ue]=C.useState(()=>$t(o)),Se=C.useMemo(()=>me(t),[t]),{transactionUrl:pe,chainInfo:Ce}=En(Se,g.chainId,q||void 0,!0),Ne=Ce?.currency_symbol??"",Fe=Ce?.name??`Chain ID ${g.chainId}`,wt=C.useRef({nativeSymbol:Ne||void 0,networkName:Fe,tokenSymbol:g.symbol});wt.current={nativeSymbol:Ne||void 0,networkName:Fe,tokenSymbol:g.symbol};let Y=C.useMemo(()=>BigInt(g.quantity.numeric||"0"),[g.quantity.numeric]),at=C.useMemo(()=>ct(g.quantity.numeric,g.quantity.decimals),[g.quantity.numeric,g.quantity.decimals]),Re=f?.(g),st=C.useMemo(()=>{if(Re===void 0)return;let k=parseFloat(G.replace(/,/g,""));return Number.isFinite(k)?k*Re:0},[G,Re]);C.useEffect(()=>{$(""),T({})},[g.address,g.chainId]),C.useEffect(()=>{Ve.current+=1,de(null),He(""),Xe(!1)},[g.address,g.chainId,I,G]),C.useEffect(()=>{Ue($t(o))},[o]);let Je=C.useCallback(k=>{z(k),T(O=>({...O,recipient:void 0}))},[]),ht=C.useCallback(k=>{$(k),T(O=>({...O,amount:void 0}))},[]),_t=C.useCallback(()=>{$(Eo(g.quantity.numeric,g.quantity.decimals)),T(k=>({...k,amount:void 0}))},[g.quantity.numeric,g.quantity.decimals]),bt=C.useCallback(k=>{R(k),d?.(k),E("recipient")},[d]),en=C.useCallback(()=>E("token"),[]),Ft=C.useCallback(()=>{E(k=>{if(k==="result")return"review";if(k===i)return b?.(),k;let O=Yr.indexOf(k);return O<=0?(b?.(),k):Yr[O-1]})},[i,b]),et=C.useCallback(()=>{let{errors:k}=Po({recipient:I,amount:"1",token:g,balanceRaw:Y});if(k.recipient){T(O=>({...O,recipient:k.recipient}));return}T(O=>({...O,recipient:void 0})),E("amount")},[I,g,Y]),xt=C.useCallback(k=>{z(k),T(O=>({...O,recipient:void 0})),E("amount")},[]),vt=C.useCallback(()=>{let k=Po({recipient:I,amount:G,token:g,balanceRaw:Y});T(k.errors),!(Kr(k.errors)||k.rawAmount===void 0||!k.recipient)&&(At(k.rawAmount),$e(k.recipient),de(null),He(""),J("idle"),E("review"))},[I,G,g,Y]);C.useEffect(()=>{if(F!=="review"||!se||ke===null||_e!==null||ee||gt||!S.canEstimateGas(Ce?.rpc))return;let k=++Ve.current;Xe(!0),He(""),(async()=>{try{let O=Ao({token:g,walletAddress:o,recipient:se,rawAmount:ke}),W=await S.estimateGas(O,Ce?.rpc);if(Ve.current!==k)return;de(W)}catch(O){if(Ve.current!==k)return;He(To(O,wt.current,"Failed to estimate gas."))}finally{Ve.current===k&&Xe(!1)}})()},[F,se,ke,_e,ee,gt,S,Ce?.rpc,g,o]);let tt=C.useCallback(async()=>{if(!(!se||ke===null)){V(""),Me(""),J("submitting");try{let k="",O=await Zr({repository:S,args:Ao({token:g,walletAddress:o,recipient:se,rawAmount:ke}),chainId:g.chainId,onSubmitted:W=>{k=W,Me(W),J("confirming"),Ue(Ro(o,se)),u?.({txHash:W,chainId:g.chainId,amount:G,tokenSymbol:g.symbol,recipient:se})}});if(O==="success")J("success"),k&&x?x?.(k):E("result");else if(O==="reverted"){let W="Transaction reverted on-chain.";J("error"),V(W),k&&w?w({txHash:k,chainId:g.chainId,message:W}):E("result")}else{let W="Transaction receipt was not found. Please check again later.";J("error"),V(W),k&&w?w({txHash:k,chainId:g.chainId,message:W}):E("result")}}catch(k){J("error"),V(To(k,{nativeSymbol:Ne||void 0,networkName:Fe,tokenSymbol:g.symbol})),E("result")}}},[S,se,ke,g,G,o,u,x,w,Ne,Fe]),[Ot,Oe]=C.useState(!1),Wt=C.useRef(void 0);C.useEffect(()=>()=>clearTimeout(Wt.current),[]);let ro=C.useCallback(async()=>{if(q)try{await navigator.clipboard.writeText(q),Oe(!0),clearTimeout(Wt.current),Wt.current=setTimeout(()=>Oe(!1),2e3)}catch{}},[q]),io=C.useCallback(()=>{if(!pe||!q)return;let k=Le=>{typeof window<"u"&&window.open(Le,"_blank","noopener,noreferrer")};if(!v){k(pe);return}let O=v(pe,{category:"send",origin:"send-transaction",payload:{chainId:g.chainId,txHash:q}});if(O&&typeof O.then=="function"){let Le=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;O.then(nt=>{if(nt===null){Le?.close();return}let Bt=nt??pe;if(Le)try{Le.location.href=Bt}catch{Le.close(),k(Bt)}else k(Bt)});return}let W=O;W!==null&&k(W??pe)},[v,g.chainId,pe,q]),We=C.useCallback(()=>{V(""),Me(""),J("idle"),de(null),He(""),E("review")},[]);return{step:F,status:it,token:g,tokens:c.length>0?c:[g],recipient:I,amount:G,amountUsd:st,fieldErrors:Z,error:ye,txHash:q,gasEstimate:_e,gasLoading:ee,gasError:gt,reviewRawAmount:ke,reviewRecipient:se,recentAddresses:Mt,accounts:r,accountName:n,walletAddress:o,resolvedEnv:Se,transactionUrl:pe,networkName:Fe,nativeSymbol:Ne,nativeDecimals:Ce?.currency_decimals??g.quantity.decimals,balanceRaw:Y,balanceText:at,priceUsd:Re,canSelectToken:(c.length>0?c:[g]).length>1,canSend:S.canSend,getTokenPriceUsd:f,setRecipient:Je,setAmount:ht,setMax:_t,selectToken:bt,goToTokenSelect:en,selectRecipient:xt,submitRecipient:et,submitAmount:vt,confirmSend:tt,retry:We,back:Ft,hashCopied:Ot,copyHash:ro,openTransaction:io}}import*as De from"react";function Pn(e,t,o=10){if(t<=0)return e.toString();let n=10n**BigInt(t),r=e/n,i=e%n;if(i===0n)return r.toString();let c=i.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(o,t)));return c=c.replace(/0+$/,""),c?`${r.toString()}.${c}`:r.toString()}function Mo(e,t){return Pn(e,t,6)}function Xr(e){return Pn(e,9,2)}function Jr(e){return e.toLocaleString("en-US")}function ei(e){return e===56||e===97}function An(e){return e.gasPrice??e.maxFeePerGas}function ti(e,t=!1){return t?An(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function ni(e,t=!1){if(t){let o=An(e);return o!==void 0?e.gasLimit*o:null}return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function Mn(e){return!Number.isFinite(e)||e<=0?"$0.00":`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}import{jsx as sn,jsxs as _o}from"react/jsx-runtime";function oi({flow:e}){let{amount:t,setAmount:o,amountUsd:n,balanceText:r,balanceRaw:i,token:a,setMax:c}=e,d=De.useRef(null),l=De.useCallback(()=>{requestAnimationFrame(()=>{let w=d.current;if(!w)return;let b=w.value.length;w.setSelectionRange(b,b)})},[]);De.useEffect(()=>{d.current?.focus(),l()},[l]),De.useEffect(()=>{t===""&&(f(!1),l())},[t,l]);let s=De.useMemo(()=>{let w=Rt(t,a.quantity.decimals);return"value"in w&&w.value>i},[t,a.quantity.decimals,i]),[m,f]=De.useState(!1),u=!m&&t===""?"0.00":t,x=t.trim()===""||t.trim()==="0";return sn("div",{className:"sf-body sf-amount",children:_o("div",{className:"sf-amount-center",children:[sn("span",{className:"sf-amount-usd",children:n!==void 0?Mn(n):"\xA0"}),sn("div",{className:"sf-amount-input-wrap","data-over":s||void 0,"data-empty":x||void 0,onClick:()=>d.current?.focus(),children:sn("input",{ref:d,className:"sf-amount-input",value:u,onChange:w=>{let b=w.target.value;if(m)o(b);else if(t===""){if(b.length<4)return;f(!0);let v=b.startsWith("0.00")?b.slice(4):b;o(v)}else f(!0),o(b)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${a.symbol}`,size:1})}),_o("div",{className:"sf-amount-balance",children:[sn("span",{children:"Balance:"}),_o("button",{type:"button",className:"sf-amount-max",onClick:c,children:[r," ",a.symbol]})]})]})})}import*as ze from"react";var Fo={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},ri={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function ln(e,t){let o=le[e];if(t===o.cross)return ri.cross;if(t===o.bsc)return ri.bsc}var Ts={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Lt(e,t,o={}){if(!t||!t.startsWith("0x"))return;let{size:n=120,bg:r,format:i="png"}=o,a=Ts[e],c=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${n}${c}`}import{jsx as Ie,jsxs as _n}from"react/jsx-runtime";function ii({size:e=20,className:t}){return _n("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Ie("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),Ie("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function ai({size:e=20,className:t}){return Ie("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:Ie("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 si({size:e=20,className:t}){return _n("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[Ie("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),Ie("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function li({size:e=16,className:t}){return Ie("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:Ie("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function ci({size:e=56,className:t}){return _n("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Ie("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),Ie("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 di({size:e=56,className:t}){return _n("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[Ie("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),Ie("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as K,jsxs as qe}from"react/jsx-runtime";function pi(e,t){return e.name||`Account ${(e.index??t)+1}`}function fi(e){return e.trim().slice(0,1).toUpperCase()||"A"}function mi(e){return e.toLowerCase()}function ui({flow:e}){let{recipient:t,setRecipient:o,fieldErrors:n,recentAddresses:r,accounts:i,walletAddress:a,resolvedEnv:c,selectRecipient:d}=e,l=ze.useMemo(()=>i.filter(g=>g.address.toLowerCase()!==a.toLowerCase()),[i,a]),s=l.length>0,m=ze.useMemo(()=>new Map(l.map((g,R)=>[mi(g.address),{account:g,index:R}])),[l]),[f,u]=ze.useState("recent"),x=ze.useRef(null);ze.useEffect(()=>{x.current?.focus()},[]);let w="1A1A2E",b=ze.useCallback(async()=>{try{let g=await navigator.clipboard.readText();g&&o(g.trim())}catch{}},[o]),v=t.trim().length>0,S=je(t.trim());return qe("div",{className:"sf-recipient",children:[qe("div",{className:"sf-recipient-top",children:[qe("div",{className:"sf-address-field","data-filled":v||void 0,"data-invalid":n.recipient||void 0,children:[K("textarea",{ref:x,className:"sf-address-input",value:t,onChange:g=>o(g.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:v?2:1}),v?K("button",{type:"button",className:"sf-address-action",onClick:()=>o(""),"aria-label":"Clear",children:K(si,{size:20})}):K("button",{type:"button",className:"sf-address-action",onClick:b,"aria-label":"Paste from clipboard",children:K(ai,{size:20})})]}),n.recipient&&K("p",{className:"sf-field-error",role:"alert",children:n.recipient}),qe("div",{className:"sf-tabs",role:"tablist",children:[K("button",{type:"button",role:"tab",className:"sf-tab","data-active":f==="recent"||void 0,"aria-selected":f==="recent",onClick:()=>u("recent"),children:"Recent"}),s&&K("button",{type:"button",role:"tab",className:"sf-tab","data-active":f==="account"||void 0,"aria-selected":f==="account",onClick:()=>u("account"),children:"My Account"})]})]}),K("div",{className:"sf-address-list",children:f==="account"&&s?l.map((g,R)=>{let F=pi(g,R),E=Lt(c,g.address,{size:56,bg:w});return qe("button",{type:"button",className:"sf-address-row",onClick:()=>d(g.address),children:[qe("span",{className:"sf-address-avatar",children:[E&&K("img",{src:E,alt:"",width:40,height:40,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}}),K("span",{className:"sf-address-avatar-fallback",children:fi(F)})]}),qe("span",{className:"sf-address-meta",children:[K("span",{className:"sf-address-name",children:F}),K("span",{className:"sf-address-value",children:ge(g.address)})]})]},g.address)}):r.length>0?r.map(g=>{let R=m.get(mi(g.address)),F=R?pi(R.account,R.index):ge(g.address),E=Lt(c,g.address,{size:56,bg:w});return qe("button",{type:"button",className:"sf-address-row",onClick:()=>d(g.address),children:[qe("span",{className:"sf-address-avatar",children:[E&&K("img",{src:E,alt:"",width:40,height:40,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}}),K("span",{className:"sf-address-avatar-fallback",children:fi(F)})]}),qe("span",{className:"sf-address-meta",children:[K("span",{className:"sf-address-name",children:F}),K("span",{className:"sf-address-value",children:ge(g.address)})]})]},g.address)}):K("div",{className:"sf-empty",children:"No send history"})}),v&&!S&&!n.recipient&&K("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as re,jsxs as jt}from"react/jsx-runtime";function wi({flow:e}){let{status:t,txHash:o,error:n,copyHash:r,hashCopied:i,openTransaction:a}=e,c=t==="error",d=t==="success";return c?jt("div",{className:"sf-body sf-result sf-result--error",children:[re("span",{className:"sf-result-icon",children:re(di,{size:56})}),jt("div",{className:"sf-result-copy",children:[re("h3",{className:"sf-result-title",children:"Transaction Failed"}),re("p",{className:"sf-result-desc",children:n||"Something went wrong. Please try again."})]}),o&&re(gi,{txHash:o,hashCopied:i,onCopy:r,onOpen:a})]}):jt("div",{className:"sf-body sf-result",children:[re("span",{className:"sf-result-icon","data-pending":!d||void 0,children:d?re(ci,{size:56}):re("span",{className:"sf-result-spinner"})}),jt("div",{className:"sf-result-copy",children:[re("h3",{className:"sf-result-title",children:d?"Transaction Complete":"Transaction in Progress"}),re("p",{className:"sf-result-desc",children:d?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),o&&re(gi,{txHash:o,hashCopied:i,onCopy:r,onOpen:a})]})}function gi({txHash:e,hashCopied:t,onCopy:o,onOpen:n}){return jt("div",{className:"sf-result-hash-card",children:[re("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),jt("div",{className:"sf-result-hash-row",children:[re("button",{type:"button",className:"sf-result-hash-link",onClick:n,"aria-label":"Open transaction in explorer",children:ge(e)}),re("button",{type:"button",className:"sf-result-copy-btn",onClick:o,"aria-label":"Copy transaction hash",children:t?re(on,{size:16}):"Copy"})]})]})}import{jsx as j,jsxs as ce}from"react/jsx-runtime";var Fn="\u2014";function hi({flow:e}){let{token:t,reviewRawAmount:o,reviewRecipient:n,accountName:r,accounts:i,walletAddress:a,networkName:c,nativeSymbol:d,nativeDecimals:l,gasEstimate:s,gasLoading:m,gasError:f,error:u,resolvedEnv:x}=e,w=Ut(t),b=o!==null?Pn(o,t.quantity.decimals):"",v=r?.trim()||`Account ${(i[0]?.index??0)+1}`,S=Lt(x,a,{size:56,bg:"1A1A2E"}),g=d||(w?t.symbol:""),R=ei(t.chainId),F=s?ti(s,R):null,E=s?ni(s,R):null,I=T=>T!==null&&g?`${Mo(T,l)} ${g}`:Fn,z=T=>T!==void 0?`${Xr(T)} Gwei`:Fn,G=(()=>{if(!w||!s||E===null||o===null)return Fn;let T=o+E;return`${Mo(T,l)} ${g||t.symbol}`})(),$=T=>m?"\u2026":T,Z=[{label:"Est. Tx Fee",value:$(I(E))},...F==="dynamic"?[{label:"Max Priority Fee",value:$(z(s?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:$(z(s?.maxFeePerGas))}]:F==="legacy"?[{label:"Gas Price",value:$(z(s?An(s):void 0))}]:[],{label:"Gas Limit",value:$(s?Jr(s.gasLimit):Fn)}];return ce("div",{className:"sf-body sf-review",children:[ce("div",{className:"sf-review-amount",children:[j("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:T=>{T.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),ce("span",{className:"sf-review-amount-value",children:[b,j("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),ce("div",{className:"sf-review-parties",children:[ce("div",{className:"sf-review-card sf-review-party",children:[j("span",{className:"sf-review-party-label",children:"From"}),ce("div",{className:"sf-review-party-head",children:[j("span",{className:"sf-review-party-avatar",children:S&&j("img",{src:S,alt:"",width:28,height:28,draggable:!1,onError:T=>{T.currentTarget.style.display="none"}})}),j("span",{className:"sf-review-party-name",children:v})]}),j("span",{className:"sf-review-party-addr",children:a})]}),j("span",{className:"sf-review-arrow","aria-hidden":!0,children:j(li,{size:16})}),ce("div",{className:"sf-review-card sf-review-party",children:[j("span",{className:"sf-review-party-label",children:"To"}),j("span",{className:"sf-review-party-addr",children:n})]})]}),ce("section",{className:"sf-review-card",children:[j("h3",{className:"sf-review-section-title",children:"Summary"}),ce("div",{className:"sf-review-row",children:[j("span",{className:"sf-review-row-label",children:"Network"}),j("span",{className:"sf-review-row-value",children:c})]}),Z.map(T=>ce("div",{className:"sf-review-row",children:[j("span",{className:"sf-review-row-label",children:T.label}),j("span",{className:"sf-review-row-value",children:T.value})]},T.label))]}),ce("section",{className:"sf-review-card",children:[j("h3",{className:"sf-review-section-title",children:"Total"}),ce("div",{className:"sf-review-row",children:[j("span",{className:"sf-review-row-label",children:"Total Amount"}),ce("span",{className:"sf-review-row-value",children:[b," ",t.symbol]})]}),w&&ce("div",{className:"sf-review-row",children:[j("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),j("span",{className:"sf-review-row-value",children:$(G)})]})]}),(f||u)&&j("div",{className:"sf-message sf-message--error",role:"alert",children:f||u})]})}import*as On from"react";import{jsx as dt,jsxs as Et}from"react/jsx-runtime";function bi({flow:e}){let[t,o]=On.useState(""),n=t.trim().toLowerCase(),r=On.useMemo(()=>n?e.tokens.filter(i=>i.symbol.toLowerCase().includes(n)||i.name.toLowerCase().includes(n)):e.tokens,[e.tokens,n]);return Et("div",{className:"sf-body sf-token-select",children:[Et("div",{className:"sf-search",children:[dt(ii,{size:20}),dt("input",{className:"sf-search-input",value:t,onChange:i=>o(i.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),Et("div",{className:"sf-token-list",children:[r.map(i=>{let a=`${i.chainId}:${i.address.toLowerCase()}`,c=ln(e.resolvedEnv,i.chainId),d=e.getTokenPriceUsd?.(i);return Et("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(i),children:[Et("span",{className:"sf-token-left",children:[Et("span",{className:"sf-token-icon-wrap",children:[dt("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"}}),c&&dt("img",{className:"sf-token-chain-badge",src:c,alt:"","aria-hidden":!0,width:16,height:16,loading:"lazy",draggable:!1,onError:l=>{l.currentTarget.style.display="none"}})]}),dt("span",{className:"sf-token-name",children:i.symbol})]}),Et("span",{className:"sf-token-right",children:[dt("span",{className:"sf-token-balance",children:ct(i.quantity.numeric,i.quantity.decimals)}),d!==void 0&&dt("span",{className:"sf-token-price",children:Mn(d)})]})]},a)}),r.length===0&&dt("div",{className:"sf-empty",children:"No tokens found"})]})]})}P(`.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;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;width:100%;margin-top:8px}.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;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 X,jsxs as Wn}from"react/jsx-runtime";var Ps={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function Bn({onClose:e,onBackToWallet:t,onConfirmSuccess:o,onSuccess:n,className:r,...i}){let a=xi.useCallback(v=>{n?.(v),o?.(v)},[o,n]),d=Qr({...i,onSuccess:n||o?a:void 0,onExit:t}),{step:l,status:s}=d,m=je(d.recipient.trim()),f=Rt(d.amount,d.token.quantity.decimals),u="value"in f&&f.value<=d.balanceRaw,x=s==="submitting"||s==="confirming",w=l!=="result",b=Ps[l]??"";return Wn("div",{className:U("sf-root",r),"data-step":l,children:[Wn("header",{className:"sf-header",children:[w?X("button",{type:"button",className:"sf-header-btn",onClick:d.back,"aria-label":"Back",children:X(Ct,{size:24})}):X("span",{className:"sf-header-btn","aria-hidden":!0}),X("span",{className:"sf-header-title",children:b}),X("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:X(Vt,{size:24})})]}),l==="token"&&X(bi,{flow:d}),l==="recipient"&&X(ui,{flow:d}),l==="amount"&&X(oi,{flow:d}),l==="review"&&X(hi,{flow:d}),l==="result"&&X(wi,{flow:d}),Wn("footer",{className:"sf-footer","data-step":l,children:[l==="recipient"&&X("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.submitRecipient,"data-disabled":!m||void 0,"aria-disabled":!m,children:"Next"}),l==="amount"&&X("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.submitAmount,"data-disabled":!u||void 0,"aria-disabled":!u,children:"Next"}),l==="review"&&Wn("div",{className:"sf-footer-row",children:[X("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:d.back,disabled:x,children:"Cancel"}),X("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.confirmSend,disabled:x||!d.canSend,children:x?"Sending...":"Send"})]}),l==="result"&&s==="success"&&X("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>o?.(d.txHash||void 0),children:"All done"}),l==="result"&&s==="error"&&X("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:d.retry,children:"Try Again"})]})]})}import*as vi from"@radix-ui/react-popover";import{Drawer as As}from"vaul";import{jsx as Dn,jsxs as Ms}from"react/jsx-runtime";function yi({asChild:e,className:t,children:o}){let{isMobile:n,theme:r,walletAddress:i}=lt(),a=o!=null,c=e??!0,d=a?o:Ms("button",{type:"button",className:U("wi-trigger-btn",t),"data-theme":r,"data-mobile":n||void 0,children:[Dn(Er,{size:n?14:16}),Dn("span",{className:"wi-trigger-address",children:ge(i)})]});return n?Dn(As.Trigger,{asChild:c,children:d}):Dn(vi.Trigger,{asChild:c,children:d})}import*as L from"react";import*as Kn from"@radix-ui/react-popover";import{Drawer as jn}from"vaul";import fn from"bignumber.js";import{useQueries as _s}from"@tanstack/react-query";import{useMemo as Fs}from"react";var Oo="user-balance";async function Os(e,t,o,n){let r=new URLSearchParams({networkId:`eip155:${t}`,account:o}),i=await fetch(`${e}/v1/public/token/balance?${r}`,{cache:"no-store",signal:n});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 qt(e,t,o=!0){let n=Ee[e],r=le[e],i=[r.cross,r.bsc],a=_s({queries:i.map(s=>({queryKey:[Oo,e,t,s],queryFn:({signal:m})=>Os(n,s,t,m),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1}))}),c=a.some(s=>s.isLoading),d=a.some(s=>s.isError);return{tokens:Fs(()=>{let s=[];for(let m of a)m.data&&s.push(...m.data);return s},[a]),isLoading:c,isError:d}}import{useQuery as Ws,useQueries as Bs}from"@tanstack/react-query";import{useMemo as Ds}from"react";var zs="forge-holdings",Gs="forge-token-image";async function Hs(e,t,o){let n=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:o});if(!n.ok)throw new Error(`Failed to fetch forge holdings: ${n.status}`);let r=await n.json();if(!r.success)throw new Error("Forge holdings API error");return r.data.items}async function Vs(e,t,o){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:o});if(!n.ok)return{address:t,image_url:""};let r=await n.json();return r.success?{address:t,image_url:r.data.token.image_url}:{address:t,image_url:""}}function ki(e,t,o=!0){let n=Fo[e],{data:r,...i}=Ws({queryKey:[zs,e,t],queryFn:({signal:a})=>Hs(n,t,a),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1});return{holdings:r??[],...i}}function Si(e,t,o=!0){let n=Fo[e],r=Bs({queries:t.map(a=>({queryKey:[Gs,e,a],queryFn:({signal:c})=>Vs(n,a,c),enabled:o,staleTime:1/0}))});return{imageMap:Ds(()=>{let a=new Map;for(let c of r)c.data&&a.set(c.data.address,c.data.image_url);return a},[r])}}import{useQuery as $s}from"@tanstack/react-query";import{useMemo as Us}from"react";var Wo="token-stats";function pt(e,t){return`${e}:${t.toLowerCase()}`}function Kt(e,t=!0){let o=Ee[e],{data:n,...r}=$s({queryKey:[Wo,e],queryFn:async({signal:a})=>{let c=await fetch(`${o}/v1/public/token/stats`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Failed to fetch token stats: ${c.status}`);let d=await c.json();if(d.code!==200)throw new Error(`Token stats API error: ${d.code}`);return d},enabled:t,staleTime:3e4});return{statsMap:Us(()=>{let a=new Map;if(!n?.data)return a;for(let c of n.data){let d=pt(c.chain_id,c.address);a.set(d,c)}return a},[n]),...r}}import{useQuery as js}from"@tanstack/react-query";import{useMemo as qs}from"react";var Ks="token-info";function Bo(e,t){return`${t.toLowerCase()}_${e}`}function Ci(e,t=!0){let o=Ee[e],{data:n,...r}=js({queryKey:[Ks,e],queryFn:async({signal:a})=>{let c=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Failed to fetch token info: ${c.status}`);let d=await c.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:1/0});return{categoryMap:qs(()=>{let a=new Map;if(!n?.data)return a;for(let c of n.data){let d=Bo(c.chain_id,c.address);a.set(d,c.category)}return a},[n]),...r}}import{useMemo as Zs}from"react";import Do from"bignumber.js";function Ni(e,t,o){let{tokens:n,isLoading:r}=qt(e,t,o),{statsMap:i}=Kt(e,o);return Zs(()=>{let a=new Do(0);for(let s of n){let m=i.get(pt(s.chainId,s.address));if(!m)continue;let u=new Do(s.quantity.numeric).shiftedBy(-s.quantity.decimals).multipliedBy(new Do(m.price));u.isNaN()||(a=a.plus(u))}let c=a.toFixed(),{displayValue:d,isLowerBound:l}=zr(c);return{totalUsd:c,displayValue:d,isLowerBound:l,isLoading:r}},[n,i,r])}import{QRCodeSVG as jl}from"qrcode.react";function we(e,t,o,n){if(!n||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;e.preventDefault();let r;try{r=n(t,o)}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,s=m=>{if(m===null){l?.close();return}let f=m??t;if(l)try{l.location.href=f}catch{l.close(),i(f)}else i(f)};r.then(s,m=>{console.error("[dapp-ui] onOutlink rejected:",m),l?.close()});return}let c=r;if(c===null)return;i(c??t)}import*as Pt from"react";import{Drawer as $l}from"vaul";import{createContext as Ys,useContext as Qs}from"react";var cn=Ys(null);function Te(){let e=Qs(cn);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as Xs}from"vaul";import{jsx as Ri}from"react/jsx-runtime";function Li({asChild:e,children:t}){let{walletAddress:o}=Te(),n=t!=null,r=e??!0,i=n?t:Ri("button",{type:"button",children:ge(o)});return Ri(Xs.Trigger,{asChild:r,children:i})}import{Drawer as Un}from"vaul";import*as ve from"react";import{useQueryClient as Gl}from"@tanstack/react-query";import{useMemo as rl}from"react";import zo from"bignumber.js";import{useQuery as Js}from"@tanstack/react-query";import{useMemo as Mi}from"react";var zn={dev:"https://stg-cross-game-reward-api.crosstoken.io/api",stage:"https://stg-cross-game-reward-api.crosstoken.io/api",production:"https://cross-game-reward-api.crosstoken.io/api"},Ei={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Gn={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},Ii={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Zt={dev:"https://stg-posa-api.crosstoken.io/api/v1",stage:"https://stg-posa-api.crosstoken.io/api/v1",production:"https://posa-api.crosstoken.io/api/v1"},dn={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},Ti={dev:`${dn.dev}/portfolio`,stage:`${dn.stage}/portfolio`,production:`${dn.production}/portfolio`},Pi={dev:"https://stg-game-swap-api.cross.nexus/v1",stage:"https://stg-game-swap-api.cross.nexus/v1",production:"https://game-swap-api.cross.nexus/v1"},Ai={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},ft={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 el="wp:reward-pools";function Hn(e,t=!0){let o=zn[e],{data:n,...r}=Js({queryKey:[el,e],queryFn:async({signal:c})=>{let d=await fetch(`${o}/v1/pools`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Failed to fetch pools: ${d.status}`);let l=await d.json();if(l.code!==200)throw new Error(`Pools API error: ${l.code}`);return l},enabled:t,staleTime:0}),i=Mi(()=>n?.data.pools.filter(c=>c.pool_type==="CrossPool")??[],[n]),a=Mi(()=>n?.data.pools.filter(c=>c.pool_type==="GamePool")??[],[n]);return{crossPools:i,gamePools:a,allPools:n?.data.pools??[],...r}}import{useQuery as tl}from"@tanstack/react-query";import{useMemo as nl}from"react";var ol="wp:user-deposits";function Vn(e,t,o=!0){let n=zn[e],r=o&&!!t,{data:i,...a}=tl({queryKey:[ol,e,t],queryFn:async({signal:d})=>{let l=await fetch(`${n}/v1/users/${t}/deposits`,{cache:"no-store",signal:d});if(!l.ok)throw new Error(`Deposits fetch failed: ${l.status}`);let s=await l.json();if(s.code!==200)throw new Error(`Deposits API error: ${s.code}`);return s},enabled:r,staleTime:0});return{depositMap:nl(()=>{let d=new Map;if(!i?.data.user_deposits)return d;for(let l of i.data.user_deposits)d.set(l.pool_address.toLowerCase(),l);return d},[i]),deposits:i?.data.user_deposits??[],...a}}var il=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],_i="var(--wp-green)",Fi=4;function Oi(e,t,o=!0){let n=o&&!!t,{allPools:r}=Hn(e,n),{depositMap:i}=Vn(e,t,n);return rl(()=>{let a=new Map,c=new Map,d=(f,u)=>{!Number.isFinite(u)||u<=0||c.set(f,(c.get(f)??0)+u)};for(let f of r){let u=Number(f.deposit_token.price);u>0&&a.set(f.deposit_token.symbol,u);for(let x of f.reward_tokens){let w=Number(x.price);w>0&&a.set(x.symbol,w)}}for(let f of r){let u=i.get(f.pool_address.toLowerCase());if(!u)continue;let x=new zo(u.deposited_amount).shiftedBy(-f.deposit_token.decimals).toNumber();if(d(f.deposit_token.symbol,x),f.reward_tokens.length>0){let w=f.reward_tokens[0],b=new zo(u.claimable_reward).shiftedBy(-w.decimals).toNumber();d(w.symbol,b)}}let l=[],s=0;for(let[f,u]of c){let x=a.get(f)??0,w=u*x;w>0&&(l.push({symbol:f,usdValue:w}),s+=w)}l.sort((f,u)=>u.usdValue-f.usdValue);let m=[];if(s>0){let f=l.slice(0,Fi),u=l.slice(Fi);for(let w=0;w<f.length;w++)m.push({symbol:f[w].symbol,usdValue:f[w].usdValue,percentage:Math.round(f[w].usdValue/s*100),color:il[w]??_i});if(u.length>0){let w=u.reduce((b,v)=>b+v.usdValue,0);m.push({symbol:"Others",usdValue:w,percentage:Math.round(w/s*100),color:_i})}let x=m.reduce((w,b)=>w+b.percentage,0);x!==100&&m.length>0&&(m[0].percentage+=100-x)}return{totalUsd:s,formattedTotal:s>0?`$${new zo(s).toFormat(2)}`:"$0.00",segments:m}},[r,i])}import{jsx as ot,jsxs as Ho}from"react/jsx-runtime";function Wi({size:e=22,className:t}){return Ho("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[ot("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),ot("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 Bi({size:e=24,className:t}){return ot("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:ot("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function Go({size:e=16,className:t}){return Ho("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:[ot("path",{d:"M1.333 8s2.424-4.667 6.667-4.667S14.667 8 14.667 8 12.243 12.667 8 12.667 1.333 8 1.333 8z",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"}),ot("path",{d:"M8 10a2 2 0 100-4 2 2 0 000 4z",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rt({size:e=12,className:t}){return Ho("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:[ot("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"}),ot("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),ot("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import Vo from"bignumber.js";var $o={included:["CROSS Rewards deposited assets","CROSS Rewards claimable rewards"],excluded:["Forge LP value","CROSS staking value","Game Swap LP value","Wallet balances outside Portfolio"]};function Di(e){return e!=="production"}function Yt(e,t){let o=new Vo(e).shiftedBy(-t);return!o.isFinite()||o.isZero()?"0":o.isGreaterThanOrEqualTo(1)?o.toFormat(2,Vo.ROUND_DOWN):o.toFormat(4,Vo.ROUND_DOWN)}function Uo(e){return Yt(e,0)}import{useQuery as al}from"@tanstack/react-query";import{useMemo as sl}from"react";var ll="wp:token-info";function zi(e,t=!0){let o=Ee[e],n=le[e].cross,{data:r,...i}=al({queryKey:[ll,e],queryFn:async({signal:l})=>{let s=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:l});if(!s.ok)throw new Error(`Failed to fetch token info: ${s.status}`);let m=await s.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:a,byChainSym:c}=sl(()=>{let l=new Map,s=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:s};for(let m of r.data){let f=m.address.toLowerCase();l.set(`${m.chain_id}:${f}`,m),l.set(f,m);let u=m.symbol.replace(/^t/,"").toUpperCase(),x=`${m.chain_id}:${u}`;s.has(x)||s.set(x,m),s.has(u)||s.set(u,m)}return{byChainAddr:l,byChainSym:s}},[r]);return{getTokenImage:(l,s)=>{let m=l.toLowerCase(),f=a.get(`${n}:${m}`);if(f?.image)return f.image;let u=a.get(m);if(u?.image)return u.image;if(s){let x=s.replace(/^t/,"").toUpperCase(),w=c.get(`${n}:${x}`);if(w?.image)return w.image;let b=c.get(x);if(b?.image)return b.image}return""},...i}}import{jsx as $n,jsxs as Gi}from"react/jsx-runtime";function mt({title:e,icon:t,iconFit:o="cover",isEmpty:n,children:r}){return Gi("div",{className:"wp-svc-card",children:[Gi("div",{className:"wp-svc-card-head",children:[$n("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:o}}),$n("span",{className:"wp-svc-card-title",children:e})]}),n?$n("div",{className:"wp-svc-empty",children:"No assets yet"}):$n("div",{className:"wp-svc-items",children:r})]})}import pn from"bignumber.js";import{jsx as ie,jsxs as he}from"react/jsx-runtime";var cl="CROSS Rewards";function dl(e){return new pn(e||"0").isGreaterThan(0)}function pl(e,t,o){let n=new pn(e||"0").shiftedBy(-t).times(o||"0");return!n.isFinite()||n.isZero()?"$0.00":`$${n.toFormat(2,pn.ROUND_DOWN)}`}function Hi(){let{env:e,walletAddress:t,onOutlink:o}=Te(),n=!!t,{allPools:r}=Hn(e,n),{depositMap:i}=Vn(e,t,n),{getTokenImage:a}=zi(e,n),c=(s,m)=>`${Ei[e]}/rewards/${s.pool_address}?action=${m}`,d=`${ft[e]}/reward.png`,l=r.filter(s=>{let m=i.get(s.pool_address.toLowerCase()),f=m?.deposited_amount??"0",u=m?.claimable_reward??"0";return!(new pn(f).isZero()&&new pn(u).isZero())});return ie(mt,{title:cl,icon:d,isEmpty:l.length===0,children:l.map(s=>{let m=i.get(s.pool_address.toLowerCase()),f=m?.deposited_amount??"0",u=m?.claimable_reward??"0",x=c(s,"withdraw"),w=c(s,"claim"),b=a(s.deposit_token.address,s.deposit_token.symbol),v=s.reward_tokens[0],S=v?a(v.address,v.symbol):"",g=s.reward_tokens.map(G=>G.symbol),R=g.length>0?`${s.deposit_token.symbol}-${g.join("/")}`:s.deposit_token.symbol,F=v?Yt(u,v.decimals):"0",E=v?.symbol??"Reward",I=v?pl(u,v.decimals,v.price):"$0.00",z=!!m&&dl(u);return he("article",{className:"wp-item","data-side":"reward",children:[he("div",{className:"wp-item-body",children:[he("div",{className:"wp-item-line",children:[ie("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),he("div",{className:"wp-svc-token",children:[he("span",{className:"wp-token-stack","aria-hidden":!0,children:[b&&ie("img",{className:"wp-svc-token-icon",src:b,alt:""}),S&&ie("img",{className:"wp-svc-token-icon",src:S,alt:""})]}),ie("span",{children:R})]})]}),he("div",{className:"wp-item-line",children:[ie("span",{className:"wp-item-label",children:"Deposited"}),he("div",{className:"wp-svc-token",children:[b&&ie("img",{className:"wp-svc-token-icon",src:b,alt:""}),ie("span",{children:Yt(f,s.deposit_token.decimals)})]})]}),he("div",{className:"wp-item-line",children:[he("span",{className:"wp-item-label",children:["Claimable (",E,")"]}),he("div",{className:"wp-svc-token",children:[S&&ie("img",{className:"wp-svc-token-icon",src:S,alt:""}),ie("span",{children:F}),ie("span",{className:"wp-item-usd",children:I})]})]})]}),he("div",{className:"wp-item-tags",children:[he("a",{className:"wp-tag wp-tag--muted",href:x,target:"_blank",rel:"noopener noreferrer",onClick:G=>we(G,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:s,userDeposit:m}},o),children:[ie("span",{className:"wp-tag-label",children:"Withdraw"}),ie(rt,{size:12,className:"wp-tag-icon"})]}),he("a",{className:"wp-tag wp-tag--mint","data-disabled":!z||void 0,"aria-disabled":!z||void 0,href:z?w:void 0,target:z?"_blank":void 0,rel:z?"noopener noreferrer":void 0,onClick:G=>{if(!z){G.preventDefault();return}we(G,w,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:s,userDeposit:m}},o)},children:[ie("span",{className:"wp-tag-label",children:"Claim"}),ie(rt,{size:12,className:"wp-tag-icon"})]})]})]},s.pool_address)})})}import*as qi from"react";import{useQuery as fl}from"@tanstack/react-query";var ml="wp:stake-info";function Vi(e,t,o=!0){let n=Zt[e],r=o&&!!t,{data:i,...a}=fl({queryKey:[ml,e,t],queryFn:async({signal:d})=>{let l=await fetch(`${n}/stake/${t}`,{cache:"no-store",signal:d});if(!l.ok)throw new Error(`Stake info fetch failed: ${l.status}`);let s=await l.json();if(s.code!==0&&s.code!==200)throw new Error(`Stake info API error: ${s.code}`);return s},enabled:r,staleTime:0});return{stakeInfo:i?.data,...a}}import{useQuery as ul}from"@tanstack/react-query";var gl="wp:stake-rewards";function $i(e,t,o=!0){let n=Zt[e],r=o&&!!t,{data:i,...a}=ul({queryKey:[gl,e,t],queryFn:async({signal:c})=>{let d=await fetch(`${n}/rewards/${t}?limit=1`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Stake rewards fetch failed: ${d.status}`);let l=await d.json();if(l.code!==0&&l.code!==200)throw new Error(`Stake rewards API error: ${l.code}`);return l.data?.data?.[0]??null},enabled:r,staleTime:0});return{latestReward:i??null,...a}}import{useQuery as wl}from"@tanstack/react-query";var hl="wp:network-stats";function Ui(e,t=!0){let o=Zt[e],{data:n,...r}=wl({queryKey:[hl,e],queryFn:async({signal:a})=>{let c=await fetch(`${o}/network/stats`,{cache:"no-store",signal:a});if(!c.ok)throw new Error(`Network stats fetch failed: ${c.status}`);let d=await c.json();if(d.code!==0&&d.code!==200)throw new Error(`Network stats API error: ${d.code}`);return d},enabled:t,staleTime:0});return{networkStats:n?.data,...r}}import Qt from"bignumber.js";import{Fragment as xl,jsx as be,jsxs as Ke}from"react/jsx-runtime";var bl="CROSS Staking";function ji(e){if(!e)return"\u2014";let t=new Qt(e);return t.isFinite()?`${t.toFormat(2,Qt.ROUND_DOWN)}%`:"\u2014"}function Ki(){let{env:e,walletAddress:t,onOutlink:o}=Te(),n=!!t,{stakeInfo:r}=Vi(e,t,n),{latestReward:i}=$i(e,t,n),{networkStats:a}=Ui(e,n),c=`${ft[e]}/cross-staking.png`,d=Ti[e],l=r?.total_stake??"0",s=r?.delegations??0,m=qi.useMemo(()=>{let S=i?.cumulative_earned;if(!S)return;let g=new Qt(S);return g.isFinite()?g:void 0},[i]),f=m?.toString(10)??r?.rewards_earned??"0",u=new Qt(l),x=r?.days_since_first_stake,w=m!==void 0&&u.isGreaterThan(0)&&x!==null&&x!==void 0?m.div(u).times(365).div(Math.max(1,x)).times(100):void 0,b=!(new Qt(l).isZero()&&new Qt(f).isZero()),v=dn[e];return be(mt,{title:bl,icon:c,iconFit:"contain",isEmpty:!1,children:Ke("article",{className:"wp-item","data-side":"stake",children:[be("div",{className:"wp-item-body",children:b?Ke(xl,{children:[Ke("div",{className:"wp-item-line",children:[be("span",{className:"wp-item-label",children:"Staked"}),Ke("span",{children:[Uo(l)," CROSS"]})]}),Ke("div",{className:"wp-item-line",children:[be("span",{className:"wp-item-label",children:"Rewards Earned"}),Ke("span",{children:[Uo(f)," CROSS"]})]}),Ke("div",{className:"wp-item-line",children:[be("span",{className:"wp-item-label",children:"Delegations"}),be("span",{children:s})]}),Ke("div",{className:"wp-item-line",children:[be("span",{className:"wp-item-label",children:"My APR"}),be("span",{children:ji(w?.toString(10))})]})]}):Ke("div",{className:"wp-item-line",children:[be("span",{className:"wp-item-label",children:"Delegation APR"}),be("span",{children:ji(a?.apr)})]})}),be("div",{className:"wp-item-tags",children:Ke("a",{className:"wp-tag wp-tag--mint",href:b?d:v,target:"_blank",rel:"noopener noreferrer",onClick:S=>we(S,b?d:v,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:r,networkStats:a}},o),children:[be("span",{className:"wp-tag-label",children:b?"Manage":"Stake Now"}),be(rt,{size:12,className:"wp-tag-icon"})]})})]})})}import*as jo from"react";import{useQuery as vl}from"@tanstack/react-query";var yl="wp:game-swap-pools";function Zi(e,t,o=!0){let n=Pi[e],r=o&&!!t,{data:i,...a}=vl({queryKey:[yl,e,t],queryFn:async({signal:c})=>{let d=await fetch(`${n}/addresses/${t}/portfolio`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Game-swap portfolio fetch failed: ${d.status}`);return(await d.json()).pools??[]},enabled:r,staleTime:0});return{pools:i??[],...a}}import{useQuery as kl}from"@tanstack/react-query";var Sl="wp:game-swap-lp-balances";function Yi(e,t,o,n){let r=[...o].map(d=>d.toLowerCase()).sort(),i=!!n&&!!t&&r.length>0,{data:a,...c}=kl({queryKey:[Sl,e,t,r],queryFn:async()=>{if(!n)return{};let d=await n(r),l={};for(let[s,m]of Object.entries(d))l[s.toLowerCase()]=m;return l},enabled:i,staleTime:0});return{balances:a??{},...c}}import Ze from"bignumber.js";import{jsx as Pe,jsxs as Ge}from"react/jsx-runtime";var Cl="Game Swap LP",Xi=18,Nl=new Ze("0.0001");function Qi(e){return e?.trim().toUpperCase()==="CROSS"}function Rl(e){return e&&e>0?e:Xi}function Ll(e){let t=Qi(e.token_a?.symbol)&&!Qi(e.token_b?.symbol),o=t?e.reserve_a:e.reserve_b,n=Rl(t?e.token_a?.decimals:e.token_b?.decimals),r=new Ze(o||"0").shiftedBy(-n);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Ze(0):r.times(2)}function El(e,t){let o=e.token_a?.symbol?.trim()||"TOKEN",n=e.token_b?.symbol?.trim()||"CROSS",r=t?.decimals??Xi,i,a;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let c=new Ze(t.balance.toString()),d=new Ze(t.totalSupply.toString()),l=c.div(d);i=l.times(100);let s=l.times(Ll(e));if(s.isGreaterThan(0)){let m=new Ze(e.cross_usd||"0");a=m.isGreaterThan(0)?`$${s.times(m).toFormat(2,Ze.ROUND_DOWN)}`:`${s.toFormat(4,Ze.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:o,tokenBSymbol:n,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:r,sharePercent:i,valueText:a}}function Ji(){let{env:e,walletAddress:t,onOutlink:o,lpBalanceReader:n}=Te(),r=!!t,{pools:i}=Zi(e,t,r),a=jo.useMemo(()=>i.map(f=>f.pair_address).filter(Boolean),[i]),{balances:c}=Yi(e,t,a,n),d=`${ft[e]}/dex.png`,l=!!n,s=jo.useMemo(()=>{let f=i.map(u=>El(u,c[u.pair_address?.toLowerCase()]));return l?f.filter(u=>u.lpAmountRaw?new Ze(u.lpAmountRaw).shiftedBy(-u.lpDecimals).isGreaterThanOrEqualTo(Nl):!1):f},[i,c,l]),m=f=>{let u=f.token_a?.address??f.pair_address;return`${Ai[e]}/tokens/${u}?trade=deposit`};return Pe(mt,{title:Cl,icon:d,iconFit:"contain",isEmpty:s.length===0,children:s.map(f=>{let{pool:u}=f,x=m(u),w=`${f.tokenASymbol} / ${f.tokenBSymbol}`,b=u.token_a?.logo_url,v=u.token_b?.logo_url;return Ge("article",{className:"wp-item","data-side":"game-swap",children:[Ge("div",{className:"wp-item-body",children:[Ge("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"Pool"}),Ge("div",{className:"wp-svc-token",children:[Ge("span",{className:"wp-token-stack","aria-hidden":!0,children:[b&&Pe("img",{className:"wp-svc-token-icon",src:b,alt:""}),v&&Pe("img",{className:"wp-svc-token-icon",src:v,alt:""})]}),Pe("span",{children:w})]})]}),f.lpAmountRaw!==void 0&&Ge("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"My LP"}),Ge("span",{children:[Yt(f.lpAmountRaw,f.lpDecimals)," LP"]})]}),f.sharePercent!==void 0&&Ge("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"Pool Share"}),Ge("span",{children:[f.sharePercent.toFormat(2,Ze.ROUND_DOWN),"%"]})]}),f.valueText!==void 0&&Ge("div",{className:"wp-item-line",children:[Pe("span",{className:"wp-item-label",children:"Value"}),Pe("span",{children:f.valueText})]})]}),Pe("div",{className:"wp-item-tags",children:Ge("a",{className:"wp-tag wp-tag--mint",href:x,target:"_blank",rel:"noopener noreferrer",onClick:S=>we(S,x,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:u}},o),children:[Pe("span",{className:"wp-tag-label",children:"Manage"}),Pe(rt,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}import qo from"bignumber.js";import{useMemo as Fl}from"react";import{useQuery as Il}from"@tanstack/react-query";var Tl="wp:forge-pools";function ea(e,t,o=!0){let n=Gn[e],r=o&&!!t,{data:i,...a}=Il({queryKey:[Tl,e,t],queryFn:async()=>{let d=await fetch(`${n}/v1/users/${t}/pools`,{cache:"no-store"});if(!d.ok)throw new Error(`forge pools fetch failed: ${d.status}`);return(await d.json()).data?.items??[]},enabled:r,staleTime:0}),c=i??[];return{pools:c,isEmpty:c.length===0,...a}}import{useQueries as Pl}from"@tanstack/react-query";import{useMemo as Al}from"react";var Ml="wp:forge-token-detail";async function _l(e,t){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return o.ok?(await o.json())?.data?.token??null:null}function ta(e,t,o=!0){let n=Gn[e],r=Pl({queries:t.map(c=>({queryKey:[Ml,e,c],queryFn:()=>_l(n,c),enabled:o&&!!c,staleTime:3e4}))}),i=Al(()=>{let c=new Map;for(let d=0;d<r.length;d++){let l=r[d]?.data,s=t[d];l&&s&&c.set(s.toLowerCase(),l)}return c},[r,t]),a=r.some(c=>c.isLoading);return{detailMap:i,isLoading:a}}import{jsx as xe,jsxs as It}from"react/jsx-runtime";var Ol="Forge",Wl=18,Bl="https://contents.crosstoken.io/wallet/token/images/FT.png";function Dl(e){if(!e||e==="0")return"0";let t=new qo(e).shiftedBy(-Wl);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,qo.ROUND_DOWN):t.toFormat(4,qo.ROUND_DOWN)}function zl(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 na(){let{env:e,walletAddress:t,onOutlink:o}=Te(),n=!!t,{pools:r,isEmpty:i}=ea(e,t,n),a=Fl(()=>r.map(s=>s.token.address),[r]),{detailMap:c}=ta(e,a,n&&a.length>0),d=s=>`${Ii[e]}/forge/token/${s.token.address}`,l=`${ft[e]}/forge.png`;return xe(mt,{title:Ol,icon:l,iconFit:"contain",isEmpty:i,children:r.map(s=>{let m=c.get(s.token.address.toLowerCase()),f=m?.image_url||m?.image||s.token.image||Bl,u=m?.symbol||s.token.symbol,x=d(s);return It("a",{className:"wp-item","data-side":"lp",href:x,target:"_blank",rel:"noopener noreferrer",onClick:w=>we(w,x,{category:"portfolio",origin:"portfolio-forge",payload:{pool:s,tokenDetail:m}},o),children:[It("div",{className:"wp-item-body",children:[It("div",{className:"wp-item-line",children:[xe("span",{className:"wp-item-label",children:"Asset"}),It("div",{className:"wp-svc-token",children:[xe("img",{className:"wp-svc-token-icon",src:f,alt:""}),xe("span",{children:u}),m?.name&&xe("span",{className:"wp-token-subtle",children:m.name})]})]}),It("div",{className:"wp-item-line",children:[xe("span",{className:"wp-item-label",children:"LP Balance"}),xe("div",{className:"wp-svc-token",children:xe("span",{children:Dl(s.lp_balance)})})]}),It("div",{className:"wp-item-line",children:[xe("span",{className:"wp-item-label",children:"Ownership"}),xe("span",{className:"wp-line-value",children:zl(s.pool_ownership)})]})]}),xe("div",{className:"wp-item-tags",children:It("span",{className:"wp-tag wp-tag--muted",children:[xe("span",{className:"wp-tag-label",children:"Withdraw"}),xe(rt,{size:12,className:"wp-tag-icon"})]})})]},s.pair_address)})})}P(`.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;top:12px!important;left:max(12px,calc((100vw - 393px)/2))!important;right:max(12px,calc((100vw - 393px)/2))!important;bottom:12px!important;width:auto!important;height:calc(100dvh - 24px)!important;max-height:calc(100dvh - 24px)!important;z-index:50;background:var(--wp-bg);border:1px solid var(--wp-panel-border);border-radius:24px;box-shadow:var(--wp-panel-shadow);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-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-wallet-name{flex:1;min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:160%;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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-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{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{position:relative;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);right:0;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-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-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-svc-empty{display:flex;align-items:center;justify-content:center;min-height:74px;padding:20px 16px;background:var(--wp-card);border-radius:12px;box-shadow:var(--wp-card-shadow, none);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-30);box-sizing:border-box}.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}
8
- `);import{Fragment as Vl,jsx as H,jsxs as Tt}from"react/jsx-runtime";var Ko=5,Hl="wp:";function Xt({env:e,theme:t="light",walletAddress:o,onBack:n,showHeader:r=!0,variant:i="embed",className:a,onOutlink:c,lpBalanceReader:d}){let l=me(e),s=!!o,m=Gl(),f=ve.useId(),u=Di(l),{formattedTotal:x}=Oi(l,o,s),[,w]=ve.useState(Ko),[b,v]=ve.useState(!1),S=ve.useCallback(()=>{m.invalidateQueries({predicate:I=>typeof I.queryKey[0]=="string"&&I.queryKey[0].startsWith(Hl)})},[m]),g=ve.useCallback(()=>{S(),v(!0),setTimeout(()=>v(!1),600),w(Ko)},[S]);ve.useEffect(()=>{if(!s)return;let I=setInterval(()=>{w(z=>z<=1?(g(),Ko):z-1)},1e3);return()=>clearInterval(I)},[s,g]);let R=ve.useCallback(()=>{n?.()},[n]),F=ve.useMemo(()=>({env:l,theme:t,open:!0,walletAddress:o,close:R,onOutlink:c,lpBalanceReader:d}),[l,t,o,R,c,d]),E=Tt(Vl,{children:[r&&Tt("div",{className:"wp-header",children:[H("div",{className:"wp-header-edge wp-header-edge--left",children:n?H("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:n,children:H(Ct,{size:24})}):H("span",{className:"wp-header-spacer","aria-hidden":!0})}),H("h2",{className:"wp-header-title",children:"Portfolio"}),H("div",{className:"wp-header-edge wp-header-edge--right",children:H("button",{type:"button",className:U("wp-header-btn",n?void 0:"wp-refresh-btn"),"aria-label":n?"Close portfolio":"Refresh portfolio",onClick:n??g,children:n?H(Bi,{}):H(Wi,{className:b?"wp-spin-once":void 0})})})]}),H("div",{className:"wp-body",children:Tt("div",{className:"wp-body-inner",children:[Tt("section",{className:"wp-summary-card","aria-label":"Estimated portfolio value",children:[Tt("div",{className:"wp-summary-head",children:[H("span",{className:"wp-summary-label",children:"Total Assets USD (Estimated)"}),u?Tt("button",{type:"button",className:"wp-estimate-info","aria-label":"USD estimate details","aria-describedby":f,children:[H(Go,{}),Tt("span",{id:f,role:"tooltip",className:"wp-estimate-tooltip",children:[H("span",{className:"wp-estimate-tooltip-title",children:"USD estimate includes"}),H("span",{className:"wp-estimate-tooltip-group",children:$o.included.map(I=>H("span",{className:"wp-estimate-tooltip-item",children:I},I))}),H("span",{className:"wp-estimate-tooltip-title",children:"Not included"}),H("span",{className:"wp-estimate-tooltip-group",children:$o.excluded.map(I=>H("span",{className:"wp-estimate-tooltip-item",children:I},I))})]})]}):H("span",{className:"wp-estimate-info","aria-hidden":!0,children:H(Go,{})})]}),H("p",{className:"wp-total",children:x})]}),H(Hi,{}),H(Ki,{}),H(Ji,{}),H(na,{})]})})]});return H(cn.Provider,{value:F,children:i==="none"?E:H("div",{className:U(i==="fullscreen"?"wp-fullscreen":"wp-embed",a),"data-theme":t,children:E})})}import{jsx as Zo,jsxs as oa}from"react/jsx-runtime";function ra({className:e}){let{env:t,theme:o,walletAddress:n,close:r,onOutlink:i,lpBalanceReader:a}=Te();return oa(Un.Portal,{children:[Zo(Un.Overlay,{className:"wp-overlay"}),oa(Un.Content,{className:U("wp-fullscreen",e),"data-theme":o,children:[Zo(Un.Title,{className:"wp-sr-only",children:"Portfolio"}),Zo(Xt,{env:t,theme:o,walletAddress:n,onBack:r,variant:"none",onOutlink:i,lpBalanceReader:a})]})]})}import{jsx as ia}from"react/jsx-runtime";function Ul({env:e,theme:t="light",walletAddress:o,open:n,onOpenChange:r,onOutlink:i,lpBalanceReader:a,children:c}){let d=me(e),l=n!==void 0,[s,m]=Pt.useState(!1),f=l?n:s,u=Pt.useCallback(b=>{l||m(b),r?.(b)},[l,r]),x=Pt.useCallback(()=>u(!1),[u]),w=Pt.useMemo(()=>({env:d,theme:t,open:f,walletAddress:o,close:x,onOutlink:i,lpBalanceReader:a}),[d,t,f,o,x,i,a]);return ia(cn.Provider,{value:w,children:ia($l.Root,{direction:"bottom",open:f,onOpenChange:u,noBodyStyles:!0,children:c})})}var aa=Object.assign(Ul,{Trigger:Li,Content:ra});import{Fragment as qn,jsx as p,jsxs as y}from"react/jsx-runtime";function Yo(e,t,o){let n=le[e],r=o.toUpperCase();if(t===n.cross&&r.includes("CROSSD"))return 0;if(t===n.cross&&r==="CROSS")return 1;if(t===n.bsc&&r==="CROSS")return 2}function ql(e){return parseInt(e.split(":")[1],10)}function Kl(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Zl(e){let t=e.toLowerCase().replace(/^0x/,""),o=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),n=parseInt(o.slice(0,4),16)%360,r=(n+60+parseInt(o.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${n} 85% 65%), hsl(${r} 80% 55%))`}function sa({align:e="end",sideOffset:t=12,className:o,children:n}){let{env:r,theme:i,isMobile:a,open:c,drawerDirection:d,modal:l,showBalance:s,showForgeToken:m,showGameToken:f,showQR:u,qrLogoSrc:x,walletAddress:w,accountName:b,sendAccounts:v,profileImageUrl:S,preferredTokens:g,close:R,onSelectWallet:F,onCopyAddress:E,onBuy:I,onDisconnect:z,disconnectLabel:G,termsUrl:$,termsLabel:Z,privacyUrl:T,privacyLabel:it,portalStyle:J,navContent:q,navPosition:Me,footerContent:ye,view:V,setView:_e,selectedSendToken:de,setSelectedSendToken:ee,showPortfolio:Xe,portfolioTitle:gt,showTotalAssets:He,totalAssetsLabel:Ve,sendTransaction:ke,getTransactionReceipt:At,estimateGas:se,onOutlink:$e,lpBalanceReader:Mt,onReceive:Ue,onSend:Se,onBuyDisabledMessage:pe}=lt(),[Ce,Ne]=L.useState(null),Fe=L.useRef(void 0),wt=L.useCallback(h=>{Ne(h),clearTimeout(Fe.current),Fe.current=setTimeout(()=>Ne(null),4e3)},[]);L.useEffect(()=>()=>clearTimeout(Fe.current),[]);let Y=!!pe,at=L.useCallback(()=>{if(Y){wt(pe);return}I?.()},[Y,pe,I,wt]),{tokens:Re,isLoading:st}=qt(r,w,c&&s),{statsMap:Je}=Kt(r,s),{categoryMap:ht}=Ci(r,s),_t=s&&He,{displayValue:bt,isLowerBound:en,isLoading:Ft}=Ni(r,w,c&&_t),[et,xt]=L.useState(!1),vt=L.useRef(null),[tt,Ot]=L.useState(0),{holdings:Oe,isLoading:Wt}=ki(r,w,c&&s&&m),ro=L.useMemo(()=>Oe.map(h=>h.token),[Oe]),{imageMap:io}=Si(r,ro,m&&Oe.length>0),We=L.useMemo(()=>{let h=[],N=[],B=[],oe=new Map((g??[]).map((D,Q)=>[`${ql(D.chainId)}:${D.address.toLowerCase()}`,Q]));for(let D of Re){let Q=Yo(r,D.chainId,D.symbol)!==void 0,yt=`${D.chainId}:${D.address.toLowerCase()}`,kt=oe.get(yt),uo=new fn(D.quantity.numeric).shiftedBy(-D.quantity.decimals);if(Q)h.push(D);else if(kt!==void 0)N.push(D);else if(uo.isGreaterThan(0)){if(!f&&ht.get(Bo(D.chainId,D.address))==="game")continue;B.push(D)}}return h.sort((D,Q)=>{let yt=Yo(r,D.chainId,D.symbol)??99,kt=Yo(r,Q.chainId,Q.symbol)??99;return yt-kt}),N.sort((D,Q)=>{let yt=oe.get(`${D.chainId}:${D.address.toLowerCase()}`)??99,kt=oe.get(`${Q.chainId}:${Q.address.toLowerCase()}`)??99;return yt-kt}),B.sort((D,Q)=>{let yt=Je.get(pt(D.chainId,D.address)),kt=Je.get(pt(Q.chainId,Q.address)),uo=new fn(D.quantity.numeric).shiftedBy(-D.quantity.decimals).multipliedBy(yt?.price??0);return new fn(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals).multipliedBy(kt?.price??0).minus(uo).toNumber()}),[...h,...N,...B]},[Re,r,Je,f,ht,g]),k=L.useMemo(()=>{if(!m)return[];let h=new Set(Re.map(N=>N.address.toLowerCase()));return[...Oe].filter(N=>!h.has(N.token.toLowerCase())).sort((N,B)=>{let oe=new fn(N.value);return new fn(B.value).minus(oe).toNumber()})},[Oe,m,Re]),O=L.useRef(!1),[W,Le]=L.useState(null),nt=L.useRef(void 0),Bt=W?.chainId??de?.chainId??We[0]?.chainId??0,{transactionUrl:ao}=En(r,Bt,W?.txHash,!!(W?.txHash&&Bt)),fe=L.useCallback(h=>{O.current=!0,_e(h)},[_e]),[Fa,so]=L.useState("recipient"),lo=L.useCallback(()=>{ee(null),so("recipient"),fe("wallet")},[ee,fe]),bn=L.useCallback((h,N="recipient")=>{so(N),ee(h),fe("send")},[ee,fe]),Oa=L.useCallback(h=>{clearTimeout(nt.current),ee(null),fe("wallet"),Le({status:"pending",txHash:h.txHash,chainId:h.chainId,description:`${h.amount} ${h.tokenSymbol} to ${ge(h.recipient)}`})},[ee,fe]),Wa=L.useCallback(h=>{let N=de?.chainId;ee(null),fe("wallet"),!(!h||!N)&&(Le(B=>({status:"success",txHash:h,chainId:N,description:B?.txHash===h?B.description:"Tap to see your transaction"})),clearTimeout(nt.current),nt.current=setTimeout(()=>Le(null),5e3))},[de?.chainId,ee,fe]),Ba=L.useCallback(h=>{let N=h.txHash;N&&(Le({status:"error",txHash:N,chainId:h.chainId,description:h.message}),clearTimeout(nt.current),nt.current=setTimeout(()=>Le(null),5e3))},[]),yc=L.useMemo(()=>{if(Ue)return Ue;if(u)return()=>fe("qr")},[Ue,u,fe]),kc=L.useMemo(()=>{if(Se)return Se;if(We.length===0)return;let h=We[0];return()=>bn(h)},[Se,We,bn]);L.useEffect(()=>{c||(O.current=!1,so("recipient"))},[c]);let nr=L.useRef(null);L.useEffect(()=>{let h=nr.current;if(!h||!a)return;let N=B=>{B.pointerType==="touch"&&B.stopPropagation()};return h.addEventListener("pointerdown",N),()=>h.removeEventListener("pointerdown",N)},[a]);let[Dt,or]=L.useState(!1),co=L.useRef(void 0),[tn,xn]=L.useState(!1);L.useEffect(()=>{if(!tn)return;let h=()=>xn(!1),N=oe=>{oe.key==="Escape"&&xn(!1)},B=setTimeout(()=>{document.addEventListener("mousedown",h,!0),document.addEventListener("keydown",N,!0)},0);return()=>{clearTimeout(B),document.removeEventListener("mousedown",h,!0),document.removeEventListener("keydown",N,!0)}},[tn]),L.useEffect(()=>()=>clearTimeout(co.current),[]),L.useEffect(()=>()=>clearTimeout(nt.current),[]),L.useEffect(()=>{let h=vt.current;if(!h||ye===null){Ot(0);return}let N=()=>{Ot(h.offsetHeight)};if(N(),typeof ResizeObserver>"u")return;let B=new ResizeObserver(N);return B.observe(h),()=>B.disconnect()},[ye]);let rr=L.useCallback(async()=>{if(!Dt)try{await navigator.clipboard.writeText(w),or(!0),clearTimeout(co.current),co.current=setTimeout(()=>or(!1),2e3),E?.(w,!0)}catch{E?.(w,!1)}},[w,E,Dt]),vn=L.useCallback(h=>{h.currentTarget.setAttribute("data-loaded","true")},[]),ir=L.useMemo(()=>({background:Zl(w)}),[w]),yn=L.useMemo(()=>S||Lt(r,w,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[S,r,w,i]),po=L.useMemo(()=>Kl(bt),[bt]),ar=$||T?y("div",{className:"wi-legal-links",children:[$&&p("a",{className:"wi-legal-link",href:$,target:"_blank",rel:"noopener noreferrer",onClick:h=>we(h,$,{category:"terms",origin:"terms"},$e),children:Z}),$&&T&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),T&&p("a",{className:"wi-legal-link",href:T,target:"_blank",rel:"noopener noreferrer",onClick:h=>we(h,T,{category:"privacy",origin:"privacy"},$e),children:it})]}):null,sr=z?y("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{z(),R()},children:[p(Ir,{size:16}),p("span",{className:"wi-disconnect-label",children:G})]}):null,lr=s&&!q,fo=We[0],Da=lr?y("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[y("button",{type:"button",className:"wi-action-card",onClick:()=>fo&&bn(fo,"token"),disabled:!fo,"aria-label":"Send",children:[p(Fr,{size:20}),p("span",{children:"Send"})]}),y("button",{type:"button",className:"wi-action-card",onClick:()=>fe("portfolio"),disabled:!Xe,"aria-label":"View portfolio",children:[p(Or,{size:20}),p("span",{children:"Portfolio"})]}),y("button",{type:"button",className:U("wi-action-card",Y&&"wi-action-card--dimmed"),onClick:at,disabled:!I&&!Y,"aria-disabled":Y||void 0,"aria-label":"Buy",children:[p(Wr,{size:20}),p("span",{children:"Buy"})]}),y("button",{type:"button",className:"wi-action-card",onClick:()=>fe("qr"),disabled:!u,"aria-label":"Receive",children:[p(Mr,{size:20}),p("span",{children:"Receive"})]})]}):null,za=y("div",{className:U("wi-view-inner",O.current&&"wi-view-wallet"),children:[_t&&y("div",{className:"wi-total-section",children:[y("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:Ve}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:h=>{h.stopPropagation(),xt(N=>!N)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),xt(N=>!N))},"aria-label":et?"Show balance":"Hide balance",children:et?p(Ar,{}):p(Pr,{})})]}),p("div",{className:"wi-total-body",children:Ft?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):p("div",{className:"wi-total-value","data-hidden":et||void 0,children:et?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):y(qn,{children:[en&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:po.main}),po.decimal&&p("span",{className:"wi-total-decimal",children:po.decimal})]})})})]}),Me==="top"&&(q?p("div",{className:"wi-nav-fixed",children:q}):Da),s&&p("div",{ref:nr,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:y("div",{className:"wi-token-list",children:[st&&Array.from({length:5},(h,N)=>y("div",{className:"wi-skeleton-item",children:[y("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),y("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),y("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},N)),!st&&We.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),We.map(h=>{let N=Je.get(pt(h.chainId,h.address)),B=N?parseFloat(N.percent_change_24h):null,oe=B!==null&&B>=0,D=ln(r,h.chainId);return y("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>bn(h),"aria-label":`Send ${h.symbol}`,children:[y("div",{className:"wi-token-left",children:[y("div",{className:"wi-token-icon-wrap",children:[p("img",{src:h.icon_url,alt:h.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:vn,onError:Q=>{Q.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),D&&p("img",{src:D,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Q=>{Q.currentTarget.style.display="none"}})]}),y("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:h.symbol}),N&&y("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:So(N.price)}),p("span",{className:"wi-token-change","data-positive":oe,"data-zero":B===0||void 0,children:B!==null&&(B===0?"0%":`${oe?"+":"-"}${(oe?Math.floor:Math.ceil)(Math.abs(B)*100)/100}%`)})]})]})]}),y("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:ct(h.quantity.numeric,h.quantity.decimals)}),N&&p("span",{className:"wi-token-value",children:Dr(h.quantity.numeric,h.quantity.decimals,N.price)})]})]},`${h.address}-${h.chainId}`)}),m&&Wt&&Array.from({length:3},(h,N)=>y("div",{className:"wi-skeleton-item",children:[y("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),y("div",{className:"wi-skeleton-lines",children:[p("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),y("div",{className:"wi-skeleton-right",children:[p("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),p("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${N}`)),m&&!Wt&&!st&&We.length===0&&k.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&k.map(h=>{let N=io.get(h.token)||"",B=ln(r,le[r].cross);return y("div",{className:"wi-token-item",children:[y("div",{className:"wi-token-left",children:[y("div",{className:"wi-token-icon-wrap",children:[p("img",{src:N||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:h.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:vn,onError:oe=>{oe.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),B&&p("img",{src:B,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:oe=>{oe.currentTarget.style.display="none"}})]}),y("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:h.token_name}),p("div",{className:"wi-token-price-row",children:y("span",{className:"wi-token-price",children:[ct(h.current_price,18)," CROSS"]})})]})]}),y("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:ct(h.balance,18)}),p("span",{className:"wi-token-value",children:So(h.current_value_usd)})]})]},`forge-${h.token}`)})]})}),Me==="bottom"&&q&&p("div",{className:"wi-nav-fixed",children:q}),sr&&p("div",{className:"wi-wallet-disconnect-row",children:sr})]},"wallet"),Ga=Xe?p("div",{className:U("wi-view-inner wi-portfolio-body",O.current&&"wi-view-portfolio"),children:p(Xt,{env:r,theme:i,walletAddress:w,showHeader:!1,onOutlink:$e,lpBalanceReader:Mt})},"portfolio"):null,Ha=de?p("div",{className:U("wi-view-inner wi-send-body",O.current&&"wi-view-send"),children:p(Bn,{env:r,theme:i,walletAddress:w,accountName:b,accounts:v,initialStep:Fa,token:de,tokens:We,onTokenChange:ee,sendTransaction:ke,getTransactionReceipt:At,estimateGas:se,getTokenPriceUsd:h=>{let N=Je.get(pt(h.chainId,h.address));if(!N?.price)return;let B=parseFloat(N.price);return Number.isFinite(B)?B:void 0},onClose:R,onBackToWallet:lo,onSubmitted:Oa,onSuccess:Wa,onFailed:Ba,onOutlink:$e})},"send"):null,mo=!!F&&b?.trim().toLowerCase()!=="my wallet",cr=y(qn,{children:[y("span",{className:"wi-receive-avatar",children:[p("span",{className:"wi-avatar-fallback",style:ir}),yn&&p("img",{src:yn,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:vn,onError:h=>{h.currentTarget.style.display="none"}})]}),p("span",{className:"wi-receive-account-name",children:b??"Account 1"}),mo&&p("span",{className:"wi-receive-chevron","data-open":tn,"aria-hidden":"true",children:p(ko,{size:16})})]}),Va=y("div",{className:U("wi-view-inner wi-qr-body",O.current&&"wi-view-qr"),children:[y("div",{className:"wi-receive-section",children:[mo?p("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{xn(!0),F?.()},"aria-label":"Switch account",children:cr}):p("div",{className:"wi-receive-account",children:cr}),y("div",{className:"wi-qr-block",children:[y("div",{className:"wi-qr-box",children:[p(jl,{value:w,size:180,level:"H",marginSize:2,...x&&{imageSettings:{src:x,height:33,width:33,excavate:!0}}}),!x&&p("div",{className:"wi-qr-logo",children:p(_r,{size:33})})]}),p("p",{className:"wi-qr-address",children:w})]}),y("button",{type:"button",className:"wi-qr-copy-btn",onClick:rr,children:[p("span",{className:"wi-qr-copy-icon",children:Dt?p(on,{size:16}):p(yo,{size:16})}),p("span",{className:"wi-qr-copy-text",children:Dt?"Copied!":"Copy address"})]})]}),ar&&p("div",{className:"wi-receive-footer",children:ar})]},"qr"),$a=V==="qr"||V==="portfolio"||V==="send",dr=ye!==null?p("div",{className:"wi-builtin-footer",children:ye}):null,pr=y("div",{className:"wi-account-text",children:[mo?y("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{xn(!0),F?.()},"aria-label":"Switch account","aria-expanded":tn,children:[p("span",{className:"wi-account-name",children:b??"Account 1"}),p("span",{className:"wi-account-switch","data-open":tn,"aria-hidden":"true",children:p(ko,{size:20})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:b??"Account 1"})}),y("button",{type:"button",className:"wi-address-row-btn",onClick:rr,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:ge(w)}),p("span",{className:"wi-account-copy","data-copied":Dt,children:Dt?p(on,{size:12}):p(yo,{size:12})})]})]}),fr=y(qn,{children:[n,V==="qr"?p("div",{className:"wi-sticky-header",children:y("div",{className:"wi-header wi-header--receive",children:[p("button",{type:"button",className:"wi-header-back",onClick:lo,"aria-label":"Back",children:p(Ct,{size:24})}),p("span",{className:"wi-receive-title",children:"Receive"}),p("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:p(Vt,{size:24})})]})}):V==="send"?null:$a?y("div",{className:"wi-sticky-header",children:[y("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[p("button",{type:"button",className:"wi-header-back",onClick:lo,"aria-label":"Back",children:p(Ct,{size:24})}),p("div",{className:"wi-account-block wi-account-block--sub-account",children:pr}),p("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:p(Vt,{size:24})})]}),p("hr",{className:"wi-divider"})]}):y("div",{className:"wi-sticky-header",children:[y("div",{className:"wi-header wi-header--wallet",children:[y("div",{className:"wi-account-block",children:[y("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:ir}),yn&&p("img",{src:yn,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:vn,onError:h=>{h.currentTarget.style.display="none"}})]}),pr]}),y("div",{className:"wi-header-actions",children:[u&&!lr&&p("button",{type:"button",className:"wi-header-action",onClick:()=>fe("qr"),"aria-label":"Show QR code",children:p(Tr,{size:20})}),p("button",{type:"button",className:"wi-header-action wi-header-close-fixed",onClick:R,"aria-label":"Close",children:p(Vt,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),y("div",{className:"wi-view-container",children:[V==="wallet"&&za,V==="qr"&&Va,V==="portfolio"&&Ga,V==="send"&&Ha]}),V==="wallet"&&Ce&&p("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Ce}),V==="wallet"&&W&&y("a",{className:"wi-send-toast",href:ao??"#",target:"_blank",rel:"noopener noreferrer",onClick:h=>{if(!ao){h.preventDefault();return}we(h,ao,{category:"send",origin:"send-transaction",payload:{chainId:W.chainId,txHash:W.txHash}},$e)},children:[p("span",{className:"wi-send-toast-icon","data-status":W.status,"aria-hidden":!0,children:W.status==="pending"?p("span",{className:"wi-send-toast-spinner"}):W.status==="error"?p("span",{className:"wi-send-toast-error-dot"}):p(Br,{size:20})}),y("span",{className:"wi-send-toast-copy",children:[p("span",{className:"wi-send-toast-title",children:W.status==="pending"?"Sending...":W.status==="error"?"Send failed":"Send complete"}),p("span",{className:"wi-send-toast-desc",children:W.status==="pending"||W.status==="error"?W.description:"Tap to see your transaction"})]})]}),dr&&V!=="portfolio"&&V!=="send"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",ref:vt,children:dr})})]}),mr={...J,...tt>0?{"--wi-footer-height":`${tt}px`}:null};return a?y(jn.Portal,{children:[l&&p(jn.Overlay,{className:"wi-drawer-overlay"}),y(jn.Content,{className:U("wi-drawer-content",o),"data-theme":i,"data-vaul-no-drag":d==="left"||d==="right"?!0:void 0,style:mr,"data-direction":d,"data-no-balance":!s||void 0,"data-has-footer":tt>0||void 0,"data-view":V,children:[p(jn.Title,{className:"wi-sr-only",children:"My Wallet"}),fr]})]}):y(qn,{children:[l&&c&&p("div",{className:"wi-drawer-overlay",onClick:R}),p(Kn.Portal,{children:p(Kn.Content,{align:e,sideOffset:t,className:U("wi-popover-content",o),"data-theme":i,style:mr,"data-no-balance":!s||void 0,"data-has-footer":tt>0||void 0,"data-view":V,children:fr})})]})}import*as la from"react";function ca({position:e="top",children:t}){let{setNavContent:o,setNavPosition:n}=lt();return la.useEffect(()=>(o(t),n(e),()=>o(null)),[t,e,o,n]),null}import*as da from"react";function pa({children:e}){let{setFooterContent:t}=lt();return da.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}P(`[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)}
9
- `);P(`.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}
10
- `);P(`@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}}
11
- `);P(`.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:flex-start;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:28px;height:28px;padding:0;margin-top:4px;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:28px;height:28px;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:8px;flex-shrink:0}.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-close-fixed{position:absolute;top:24px;right:24px}.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-medium, rgba(0, 0, 0, .65));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{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-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-close-fixed,.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}
12
- `);P(`.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}
13
- `);import{jsx as Qo}from"react/jsx-runtime";var Ql="https://terms.crosstoken.io/docs/cross-terms-of-use",Xl="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Jl({env:e,theme:t="dark",mobileBreakpoint:o=768,drawerDirection:n,modal:r,showBalance:i=!1,showForgeToken:a=!1,showGameToken:c=!0,showQR:d=!0,qrLogoSrc:l,walletAddress:s,accountName:m,sendAccounts:f,profileImageUrl:u,connectorId:x,connectorName:w,connectorIconUrl:b,preferredTokens:v=[],onSelectWallet:S,onCopyAddress:g,onBuy:R,onBuyDisabledMessage:F,onDisconnect:E,disconnectLabel:I="Disconnect",termsUrl:z=Ql,termsLabel:G="Terms of Service",privacyUrl:$=Xl,privacyLabel:Z="Privacy Policy",open:T,onOpenChange:it,showPortfolio:J=!1,portfolioTitle:q="My Portfolio",showTotalAssets:Me=!0,totalAssetsLabel:ye="Total Assets USD",sendTransaction:V,getTransactionReceipt:_e,estimateGas:de,onOutlink:ee,lpBalanceReader:Xe,onReceive:gt,onSend:He,style:Ve,children:ke}){let At=me(e),se=x?Ln[x]:void 0,$e=w??se?.name,Mt=b??se?.iconUrl,Ue=zt(`(max-width: ${o}px)`),Se=n??(i?"right":"bottom"),pe=Se==="left"||Se==="right",Ce=r??!1,Ne=T!==void 0,[Fe,wt]=ae.useState(!1),Y=Ne?T:Fe,at=ae.useCallback(Oe=>{Ne||wt(Oe),it?.(Oe)},[Ne,it]),Re=ae.useCallback(()=>at(!1),[at]),[st,Je]=ae.useState(null),[ht,_t]=ae.useState("top"),[bt,en]=ae.useState(null),[Ft,et]=ae.useState("wallet"),[xt,vt]=ae.useState(null);ae.useEffect(()=>{Y||(et("wallet"),vt(null))},[Y]);let tt=ae.useCallback(()=>{Lo(s),E?.()},[E,s]),Ot=ae.useMemo(()=>({env:At,theme:t,isMobile:Ue,open:Y,drawerDirection:Se,modal:Ce,showBalance:i,showForgeToken:a,showGameToken:c,showQR:d,qrLogoSrc:l,walletAddress:s,accountName:m,sendAccounts:f,profileImageUrl:u,connectorName:$e,connectorIconUrl:Mt,preferredTokens:v,close:Re,onSelectWallet:S,onCopyAddress:g,onBuy:R,onBuyDisabledMessage:F,onDisconnect:E?tt:void 0,disconnectLabel:I,termsUrl:z,termsLabel:G,privacyUrl:$,privacyLabel:Z,portalStyle:Ve,navContent:st,navPosition:ht,setNavContent:Je,setNavPosition:_t,footerContent:bt,setFooterContent:en,view:Ft,setView:et,selectedSendToken:xt,setSelectedSendToken:vt,showPortfolio:J,portfolioTitle:q,showTotalAssets:Me,totalAssetsLabel:ye,sendTransaction:V,getTransactionReceipt:_e,estimateGas:de,onOutlink:ee,lpBalanceReader:Xe,onReceive:gt,onSend:He}),[At,t,Ue,Y,Se,Ce,i,a,c,d,l,s,m,f,u,$e,Mt,v,Re,S,g,R,F,E,tt,I,z,G,$,Z,Ve,st,ht,bt,Ft,xt,J,q,Me,ye,V,_e,de,ee,Xe,gt,He]);return Qo(xo.Provider,{value:Ot,children:Ue?Qo(Yl.Root,{direction:Se,open:Y,onOpenChange:at,handleOnly:pe,noBodyStyles:!0,repositionInputs:!1,children:ke},"drawer"):Qo(fa.Root,{open:Y,onOpenChange:at,children:ke},"popover")})}var Jt=Object.assign(Jl,{Trigger:yi,Content:sa,Nav:ca,Footer:pa});import*as Qe from"react";import*as Ia from"@radix-ui/react-dialog";import{Drawer as sc}from"vaul";import{createContext as ec,useContext as tc}from"react";var Zn=ec(null);function mn(){let e=tc(Zn);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as ma,useEffect as nc,useCallback as oc}from"react";function Yn(){let[e,t]=ma([]),[o,n]=ma(!0);nc(()=>{if(typeof window>"u"){n(!1);return}let i=[],a=d=>{let{info:l}=d.detail;l?.rdns&&!i.some(s=>s.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 c=setTimeout(()=>n(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),window.removeEventListener("eip6963:crossAnnounceProvider",a),clearTimeout(c)}},[]);let r=oc(i=>e.some(a=>a.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:o}}import*as ga from"@radix-ui/react-dialog";import{Drawer as rc}from"vaul";import{jsx as ua}from"react/jsx-runtime";function wa({asChild:e,children:t}){let{isMobile:o}=mn(),n=o?rc.Trigger:ga.Trigger;return ua(n,{asChild:e??t!=null,children:t??ua("button",{type:"button",children:"Connect Wallet"})})}import*as Ye from"@radix-ui/react-dialog";import{Drawer as Xn}from"vaul";import{jsx as M,jsxs as ut}from"react/jsx-runtime";function Qn(){return ut("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[M("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),M("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 ha(){return ut("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[ut("g",{clipPath:"url(#clip0_1331_27065)",children:[M("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"}),M("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"}),M("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"}),M("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"}),M("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"}),M("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),M("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"})]}),M("defs",{children:M("clipPath",{id:"clip0_1331_27065",children:M("rect",{width:"40",height:"40",fill:"white"})})})]})}function ba(){return ut("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[M("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),M("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),M("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),M("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),M("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 xa(){return ut("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[M("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),M("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"}),M("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),M("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 va(){return ut("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut("g",{clipPath:"url(#clip0_1185_7785)",children:[M("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"}),M("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"})]}),M("defs",{children:M("clipPath",{id:"clip0_1185_7785",children:M("rect",{width:"28",height:"28",fill:"white"})})})]})}function ya(){return ut("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[M("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"}),M("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"}),M("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"}),M("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 ka(){return M("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:M("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 Sa(){return M("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:M("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Xo={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Qn},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Qn,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Qn,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:ha,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:ba},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:xa,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:va,badge:"For SHOP"}};function Jo(e){return Xo[e]}var er={google:{id:"google",name:"Google",icon:ya},apple:{id:"apple",name:"Apple",icon:ka}};function Ca(e){return er[e]}import{Fragment as La,jsx as A,jsxs as ne}from"react/jsx-runtime";function ic({wallet:e,detected:t,onConnect:o}){let n=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}o()},r=e.icon,i=e.featured===!0;return ne("button",{type:"button",className:U("wcm-wallet-item",i&&"wcm-wallet-item--featured"),onClick:n,children:[ne("div",{className:"wcm-wallet-item-left",children:[A("div",{className:"wcm-wallet-icon",children:A(r,{})}),ne("div",{className:"wcm-wallet-name-row",children:[A("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&A("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?A("span",{className:"wcm-installed-label",children:"Installed"}):A("span",{className:"wcm-install-btn",children:"Install"}))]})}function ac({social:e,onSignIn:t}){let o=e.icon,n=`Sign in with ${e.name}`;return ne("button",{type:"button",className:"wcm-social-item","data-provider":e.id,onClick:t,"aria-label":n,children:[A("span",{className:"wcm-social-icon",children:A(o,{})}),A("span",{className:"wcm-social-name",children:n})]})}function Na(){let{wallets:e,activeWalletIds:t,socialProviders:o,activeSocialIds:n,termsUrl:r,privacyUrl:i,isDetected:a,close:c,isMobile:d}=mn(),l=t.filter(f=>{let u=Jo(f).visibility;return!u||u==="always"?!0:u==="desktop-only"?!d:u==="mobile-only"?d:!0}),s=n.length>0,m=l.length>0;return ne(La,{children:[ne("div",{className:"wcm-header",children:[ne("div",{className:"wcm-header-text",children:[A("h2",{className:"wcm-title",children:"CROSS Wallet"}),!d&&A("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),A("button",{type:"button",className:"wcm-close-btn",onClick:c,"aria-label":"Close",children:A(Sa,{})})]}),ne("div",{className:"wcm-body",children:[s&&ne(La,{children:[!d&&ne("div",{className:"wcm-section-header",children:[A("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),A("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),A("div",{className:"wcm-social-grid",children:n.map(f=>{let u=Ca(f);return A(ac,{social:u,onSignIn:()=>{o[f]?.(),c()}},f)})}),m&&ne("div",{className:"wcm-separator",children:[A("div",{className:"wcm-separator-line"}),A("span",{className:"wcm-separator-text",children:"Other Wallets"}),A("div",{className:"wcm-separator-line"})]})]}),m&&A("div",{className:"wcm-wallet-list",children:l.map(f=>{let u=Jo(f),x=u.rdns?a(u.rdns):!1;return A(ic,{wallet:u,detected:x,onConnect:()=>{e[f]?.(),c()}},f)})}),ne("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",A(Ra,{href:r,children:"Terms of Service"})," and consent to its ",A(Ra,{href:i,children:"Privacy Policy"}),"."]})]})]})}function Ra({href:e,children:t}){return e?A("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer",children:t}):A("span",{className:"wcm-terms-link",children:t})}function Ea({className:e}){let{isMobile:t,theme:o,portalStyle:n}=mn();return t?ne(Xn.Portal,{children:[A(Xn.Overlay,{className:"wcm-overlay"}),ne(Xn.Content,{className:U("wcm-drawer-content",e),"data-theme":o,style:n,children:[A(Xn.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),A("div",{className:"wcm-drawer-handle"}),A("div",{className:"wcm-drawer-body",children:A(Na,{})})]})]}):ne(Ye.Portal,{children:[A(Ye.Overlay,{className:"wcm-overlay"}),ne(Ye.Content,{className:U("wcm-dialog-content",e),"data-theme":o,style:n,children:[A(Ye.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),A(Ye.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),A("div",{className:"wcm-dialog-body",children:A(Na,{})})]})]})}P(`.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, 540px);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:#fff}:root[data-ds-theme=light] .wcm-social-item[data-provider=apple] .wcm-social-icon{color:#000}.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}
14
- `);P(`@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)}}
15
- `);import{jsx as un}from"react/jsx-runtime";var lc={};function cc({wallets:e,socialProviders:t=lc,termsUrl:o,privacyUrl:n,theme:r="dark",mobileBreakpoint:i=768,drawerDirection:a="bottom",dialogWidth:c,drawerMaxWidth:d,drawerMinWidth:l,style:s,open:m,onOpenChange:f,children:u}){let x=zt(`(max-width: ${i}px)`),[w,b]=Qe.useState(!1),v=m!==void 0,S=v?m:w,g=Qe.useCallback(Z=>{v||b(Z),f?.(Z)},[v,f]),R=Qe.useCallback(()=>g(!1),[g]),{isDetected:F}=Yn(),E=Qe.useMemo(()=>Object.keys(e),[e]),I=Qe.useMemo(()=>Object.keys(t),[t]),z=Qe.useMemo(()=>{let Z={};return c&&(Z["--wcm-dialog-width"]=c),d&&(Z["--wcm-drawer-max-width"]=d),l&&(Z["--wcm-drawer-min-width"]=l),{...Z,...s}},[c,d,l,s]),G=Qe.useMemo(()=>({theme:r,isMobile:x,open:S,setOpen:g,close:R,wallets:e,activeWalletIds:E,socialProviders:t,activeSocialIds:I,termsUrl:o,privacyUrl:n,isDetected:F,portalStyle:z}),[r,x,S,g,R,e,E,t,I,o,n,F,z]),$=un("div",{"data-theme":r,style:z,children:u});return x?un(Zn.Provider,{value:G,children:un(sc.Root,{direction:a,open:S,onOpenChange:g,noBodyStyles:!0,children:$},"drawer")}):un(Zn.Provider,{value:G,children:un(Ia.Root,{open:S,onOpenChange:g,children:$})})}var Ta=Object.assign(cc,{Trigger:wa,Content:Ea});P(`.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}
16
- `);P(`.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)}}
17
- `);var dc='<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>',pc='<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>',fc='<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>',mc='<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>',uc='<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 gn(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var Jn=gn(dc),eo=gn(pc),to=gn(fc),no=gn(mc),oo=gn(uc);import{jsx as Ae,jsxs as wn}from"react/jsx-runtime";function Aa({isConnecting:e,address:t,provider:o,providerName:n,accountName:r,sendAccounts:i,onConnect:a,onDisconnect:c,onCopy:d,onSelectWallet:l,onBuy:s,onBuyDisabledMessage:m,label:f="Connect Wallet",connectingLabel:u="Connecting...",disconnectLabel:x,className:w,theme:b="dark",env:v,showBalance:S=!0,showPortfolio:g,drawerDirection:R,modal:F,connectorId:E,style:I,walletInfoStyle:z,sendTransaction:G,getTransactionReceipt:$,estimateGas:Z,onReceive:T,onSend:it}){let J=w?`cb-button ${w}`:"cb-button",q=w?`cb-pill ${w}`:"cb-pill";if(e)return wn("button",{type:"button",disabled:!0,className:J,style:I,"aria-busy":"true",children:[Ae("span",{className:"cb-spinner","aria-hidden":"true"}),Ae("span",{className:"cb-button-label",children:u})]});if(t){let Me=n??bc(o),ye=o?wc[o]:void 0;return wn(Jt,{env:v,theme:b,drawerDirection:R,modal:F,showBalance:S,showPortfolio:g,walletAddress:t,accountName:r,sendAccounts:i,connectorId:E,onSelectWallet:l,onCopyAddress:d?(V,_e)=>{_e&&d()}:void 0,onDisconnect:c,disconnectLabel:x,style:z,sendTransaction:G,getTransactionReceipt:$,estimateGas:Z,onReceive:T,onBuy:s,onBuyDisabledMessage:m,onSend:it,children:[Ae(Jt.Trigger,{asChild:!0,children:wn("button",{type:"button",className:q,style:I,"aria-label":`Connected with ${Me}: ${Pa(t)}`,children:[ye?Ae("img",{src:ye,alt:"",width:18,height:18,className:"cb-pill-icon","data-provider":o}):Ae("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),Ae("span",{className:"cb-pill-address",children:Pa(t)})]})}),Ae(Jt.Content,{align:"end",sideOffset:8})]})}return wn("button",{type:"button",onClick:a,className:J,style:I,"aria-label":typeof f=="string"?f:"Connect Wallet",children:[Ae(gc,{}),Ae("span",{className:"cb-button-label",children:f})]})}function gc(){return wn("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[Ae("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"}),Ae("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"}),Ae("path",{d:"M12.75 11.25H12.7575",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}var wc={google:no,apple:oo,cross:Jn,metamask:eo,binance:to},hc={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function bc(e){return e?hc[e]:"Wallet"}function Pa(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Ma from"react";P(`.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)}
18
- `);P(`.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)}}
19
- `);import{jsx as hn,jsxs as vc}from"react/jsx-runtime";var tr="https://skills.cross.nexus";function _a({label:e="Skills",href:t=tr,onClick:o,className:n,style:r,theme:i,disabled:a=!1,isLoading:c=!1,loadingLabel:d="Loading...",openInNewTab:l=!1,type:s="button"}){let[m,f]=Ma.useState(!1),u=async S=>{if(t&&!o){l?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t;return}if(o)try{f(!0),await o()}finally{f(!1)}},x=a||c||m,w=c||m,b=w?d:e,v=n?`sb-button ${n}`:"sb-button";return vc("button",{type:s,onClick:u,disabled:x,className:v,"data-theme":i,style:r,"aria-busy":w,children:[w?hn("span",{className:"sb-spinner","aria-hidden":"true"}):hn(xc,{}),hn("span",{className:"sb-label",children:b})]})}function xc(){return hn("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:hn("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"})})}wo({mode:"dapp-ui"});export{oo as APPLE_ICON,br as AppLauncher,Lr as AppLauncherContent,Sr as AppLauncherTrigger,to as BINANCE_ICON,Ln as CONNECTOR_REGISTRY,Jn as CROSSX_ICON,Aa as ConnectButton,vo as ConnectorId,tr as DEFAULT_SKILLS_HREF,no as GOOGLE_ICON,eo as METAMASK_ICON,er as SOCIAL_REGISTRY,Bn as SendFlow,_a as SkillsButton,Wo as TOKEN_STATS_QUERY_KEY,Oo as USER_BALANCE_QUERY_KEY,Xo as WALLET_REGISTRY,Ta as WalletConnectModal,Jt as WalletInfo,aa as WalletPortfolio,Xt as WalletPortfolioBody,wo as announceAppLauncherUsage,me as resolveEnvironment,Nn as useGlobalMenu,qt as useTokenBalance,Kt as useTokenStats,Yn as useWalletDetect};
1
+ function Hr(e){try{return import.meta.env?.[e]}catch{return}}function Gr(e){if(!(typeof process>"u"))return process.env?.[e]}function Ne(e){if(e)return Ur(e);let t=Hr("VITE_CROSSX_ENVIRONMENT")??Hr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Gr("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??Gr("CROSSX_ENVIRONMENT");return Ur(t)}function Ur(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}var Wo="1.3.0";var Un="__nexusCrossAppLauncherRuntime";function Vs(){if(typeof window>"u")return null;let e=window;return e[Un]??(e[Un]={mode:"dapp-ui"}),e[Un]}function qs(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${Wo}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${Wo} \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 Do(e){let t=Vs();t&&(e?.mode==="connect-kit-react"?t.mode="connect-kit-react":t.mode||(t.mode="dapp-ui"),e?.connectKitVersion&&(t.connectKitVersion=e.connectKitVersion),qs(t))}import*as an from"react";import*as $r from"@radix-ui/react-popover";import{Drawer as Xs}from"vaul";import{createContext as Ks,useContext as Qs}from"react";var Ho=Ks(null);function $n(){let e=Qs(Ho);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as Zs,useEffect as Ys}from"react";function rn(e){let[t,n]=Zs(!1);return Ys(()=>{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 O(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))}O(`[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-badge-bg: var(--ds-accent-primary-low, #123235);--al-badge-text: var(--ds-accent-primary-default, #00ceb2);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--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-badge-bg: var(--ds-accent-primary-low, #e7f9f8);--al-badge-text: var(--ds-accent-primary-default, #00b4b7);--al-badge-new-text: var(--ds-system-purple-on, #ffffff);--al-drawer-overlay: var(--ds-overlay-dim, #00000080)}
2
+ `);O(`.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
+ `);O(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
+ `);O(`.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-grid{grid-template-columns:repeat(4,100px);row-gap:16px;column-gap:0;padding:0;justify-content:center;align-items:start}.al-popover-content .al-grid-item{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:hidden}.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-right,.al-popover-content .al-badge-new{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-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}.al-drawer-content .al-grid-item-icon{width:32px;height:32px;border-radius:6.75px;overflow:hidden}.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(--ds-content-low, #00000066);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:space-between;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:#252b39!important}:root[data-ds-theme=light] .al-grid-item:hover,:root[data-ds-theme=light] .al-grid-item[data-active=true]{background:#eff3f8!important}.al-grid-item-left{display:flex;align-items:center;gap:8px;min-width:0;overflow:hidden}.al-grid-item-right{display:flex;align-items:center;gap:6px;flex-shrink:0}.al-grid-item-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0}.al-grid-item-icon img{width:100%;height:100%;object-fit:contain}.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-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}.al-badge-new{display:flex;width:16px;height:16px;justify-content:center;align-items:center;aspect-ratio:1/1;border-radius:12px;background:var(--ds-system-purple-high, #7346f3);color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
5
+ `);O("");import{jsx as Go}from"react/jsx-runtime";function jr({env:e,theme:t="dark",mobileBreakpoint:n=768,domain:o,children:r}){let a=rn(`(max-width: ${n}px)`),[i,s]=an.useState(!1),c=an.useCallback(()=>s(!1),[]),l=Ne(e),d=an.useMemo(()=>({env:l,theme:t,isMobile:a,open:i,domain:o,close:c}),[l,t,a,i,o,c]);return Go(Ho.Provider,{value:d,children:a?Go(Xs.Root,{direction:"right",open:i,onOpenChange:s,noBodyStyles:!0,children:r},"drawer"):Go($r.Root,{open:i,onOpenChange:s,children:r},"popover")})}import*as Qr from"@radix-ui/react-popover";import{Drawer as el}from"vaul";import{jsx as $e,jsxs as Js}from"react/jsx-runtime";function Vr({size:e=18}){return Js("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[$e("rect",{width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"7",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"14",y:"7",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"7",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"}),$e("rect",{x:"14",y:"14",width:"4",height:"4",rx:"2",fill:"currentColor"})]})}function qr(){return $e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$e("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Kr(){return $e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$e("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as jn}from"react/jsx-runtime";function Zr({asChild:e,children:t,className:n,style:o}){let{isMobile:r,theme:a}=$n(),i=t!=null,s=e??!0,c=n?`al-trigger-btn ${n}`:"al-trigger-btn",l=i?t:jn("button",{type:"button",className:c,"data-theme":a,style:o,children:jn(Vr,{size:18})});return r?jn(el.Trigger,{asChild:s,children:l}):jn(Qr.Trigger,{asChild:s,children:l})}import*as Kt from"react";import*as qn from"@radix-ui/react-popover";import{Drawer as sn}from"vaul";import{useQuery as ol}from"@tanstack/react-query";var Yr={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/app-launcher.json"};var tl="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",nl="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function ft(e,t){return`${e==="production"?nl:tl}/${t}.png`}function Xr(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://dev-x.crosstoken.io/gametoken/CROSS",stage:"https://stg-x.crosstoken.io/gametoken/CROSS",production:"https://x.crosstoken.io/gametoken/CROSS"},iconUrl:ft(t,"dex"),order:1e3,type:"gametoken",badge:null,isNew:!1},{id:"forge",label:"Forge",description:"Launch Your Game, Ignite the Market",url:{dev:"https://stg-x.crosstoken.io/forge",stage:"https://stg-x.crosstoken.io/forge",production:"https://x.crosstoken.io/forge"},iconUrl:ft(t,"forge"),order:4e3,type:"forge",badge:null,isNew:!0},{id:"crossd",label:"Bridge (CROSSD)",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:ft(t,"crossd"),order:5e3,type:"crossd",badge:null,isNew:!1},{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:ft(t,"prediction"),order:6e3,type:"prediction",badge:null,isNew:!0},{id:"rewards",label:"Rewards",description:"Deposit CROSS and earn rewards. Grow together.",url:{dev:"https://stg-x.crosstoken.io/rewards",stage:"https://stg-x.crosstoken.io/rewards",production:"https://x.crosstoken.io/rewards"},iconUrl:ft(t,"reward"),order:7e3,type:"rewards",badge:null,isNew:!1},{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:ft(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{id:"play",label:"Play",description:"Discover and play games on CROSS.",url:{dev:"https://stg-play.cross.nexus",stage:"https://stg-play.cross.nexus",production:"https://play.cross.nexus"},iconUrl:ft(t,"play"),order:8500,type:"play",badge:null,isNew:!0},{id:"shop",label:"Shop",description:"Game Payment Platform & In-Game Currency Store.",url:{dev:"https://www.dev.cross.shop/",stage:"https://www.stage.cross.shop/",production:"https://www.cross.shop/"},iconUrl:ft(t,"shop"),order:9e3,type:"shop",badge:null,isNew:!1},{id:"points",label:"Points",description:"Dive into CROSS World, Earn CROSS Points",url:{dev:"https://stg-x.crosstoken.io/points",stage:"https://stg-x.crosstoken.io/points",production:"https://x.crosstoken.io/points"},iconUrl:ft(t,"point"),order:1e4,type:"points",badge:null,isNew:!1},{id:"wave",label:"Wave",description:"Stream, support, and earn in the CROSS ecosystem.",url:{dev:"https://stg-wave.crosstoken.io/en",stage:"https://stg-wave.crosstoken.io/en",production:"https://wave.crosstoken.io/en"},iconUrl:ft(t,"wave"),order:11e4,type:"wave",badge:null,isNew:!1},{id:"explorer",label:"Explorer",description:"View transactions, blocks, and token data on the CROSS network.",url:{dev:"https://stg-explorer.crosstoken.io/612055",stage:"https://stg-explorer.crosstoken.io/612055",production:"https://explorer.crosstoken.io/612055"},iconUrl:ft(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function Vn(e){let t=Ne(e);return ol({queryKey:["global-menu",t],queryFn:async({signal:n})=>{try{let o=await fetch(Yr[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 Xr(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Q(...e){return e.filter(Boolean).join(" ")}import{jsx as ve,jsxs as kn}from"react/jsx-runtime";function rl(e){return e.id==="cross-staking"||e.type==="cross-staking"}function ei({align:e="end",sideOffset:t=8,className:n}){let{env:o,theme:r,isMobile:a,domain:i,close:s}=$n(),{data:c}=Vn(o),l=Kt.useMemo(()=>(c?.items??[]).sort((b,k)=>b.order-k.order),[c]),d=8,m=Kt.useRef(null),f=Kt.useCallback(b=>{m.current={x:b.clientX,y:b.clientY}},[]),u=typeof window<"u"?window.location.pathname:"",v=Kt.useCallback((b,k)=>{if(m.current){let B=b.clientX-m.current.x,R=b.clientY-m.current.y;if(m.current=null,Math.abs(B)>d||Math.abs(R)>d)return}let E=k.url[o]??k.url.production,g=Jr(E,i);if(!g)try{let B=new URL(E).pathname;if(u===B||u.startsWith(B+"/")){s();return}}catch{}g?window.open(E,"_blank","noopener,noreferrer"):window.location.href=E,s()},[o,i,s,u]),x=ve("div",{className:"al-grid","data-theme":r,children:l.map(b=>{let k=b.url[o]??b.url.production,E=Jr(k,i),g=!1;if(!E)try{let B=new URL(k).pathname;g=u===B||u.startsWith(B+"/")}catch{g=!1}return kn("button",{type:"button",className:"al-grid-item","data-active":g||void 0,onPointerDown:f,onClick:B=>v(B,b),children:[kn("div",{className:"al-grid-item-left",children:[ve("div",{className:"al-grid-item-icon",children:ve("img",{src:b.iconUrl,alt:b.label,width:24,height:24,loading:"lazy"})}),ve("span",{className:"al-grid-item-label",children:b.label}),b.isNew&&ve("span",{className:"al-badge-new",children:"N"})]}),ve("div",{className:"al-grid-item-right",children:b.badge&&!rl(b)&&ve("span",{className:"al-badge",children:b.badge})})]},b.id)})});return a?kn(sn.Portal,{children:[ve(sn.Overlay,{className:"al-drawer-overlay"}),kn(sn.Content,{className:Q("al-drawer-content",n),"data-theme":r,children:[kn("div",{className:"al-drawer-header",children:[ve(sn.Close,{className:"al-drawer-close",children:ve(qr,{})}),ve(sn.Title,{className:"al-drawer-title",children:"CROSS Services"}),ve(sn.Close,{className:"al-drawer-close",children:ve(Kr,{})})]}),ve("div",{className:"al-drawer-body",children:x})]})]}):ve(qn.Portal,{children:ve(qn.Content,{align:e,sideOffset:t,className:Q("al-popover-content",n),"data-theme":r,children:x})})}function Jr(e,t){try{let n=new URL(e).hostname;return typeof window>"u"?!0:n!==(t??window.location.hostname)}catch{return!1}}import*as Ie from"react";import*as cs from"@radix-ui/react-popover";import{Drawer as Pd}from"vaul";import{createContext as il,useContext as al}from"react";var Uo=il(null);function Wt(){let e=al(Uo);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var $o=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))($o||{}),Kn={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 ji from"react";import{jsx as q,jsxs as Cn}from"react/jsx-runtime";function ti({size:e=16,className:t}){return Cn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[q("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"}),q("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 jo({size:e=16,className:t}){return q("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("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 Sn({size:e=16,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function kt({size:e=24,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ni({size:e=20,className:t}){return Cn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[q("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"}),q("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 Vo({size:e=20,className:t}){return q("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:q("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 Bt({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qt({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function oi({size:e=16,className:t}){return Cn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[q("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"}),q("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 ri({size:e=16,className:t}){return Cn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[q("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"}),q("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ii({size:e=42,className:t}){return q("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:q("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 ai({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("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 si({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("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 li({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("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 ci({size:e=20,className:t}){return q("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:q("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 di({size:e=20,className:t}){return Cn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[q("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor"}),q("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 A from"react";import Zt from"bignumber.js";function sl(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 Dt(e,t){if(!e||e==="0")return"0.00";let n=new Zt(e).shiftedBy(-t),o=n.isGreaterThanOrEqualTo(1)?2:4;return n.toFormat(o,Zt.ROUND_DOWN)}function je(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function qo(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 pi(e,t,n){let r=new Zt(e).shiftedBy(-t).multipliedBy(new Zt(n));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(Zt.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,Zt.ROUND_DOWN):r.decimalPlaces(4,Zt.ROUND_DOWN)).toFormat()}`}function fi(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=sl(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 ll}from"react";import{useQuery as cl}from"@tanstack/react-query";var rt={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},Pe={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var dl="send:chain-info";function pl(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 Ko(e,...t){let n=e.replace(/\/+$/,""),o=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[n,...o].join("/")}function fl(e,t,n,o){if(o)return t===Pe[e].cross?ui(t,o):n?.explorer_url?Ko(n.explorer_url,n.explorer_postfix?.transaction??"tx",o):ul(e,t,o)}function ui(e,t){return Ko("https://explorer.crosstoken.io",String(e),"tx",t)}function ul(e,t,n){let o=Pe[e];if(t===o.cross)return ui(t,n);if(t===o.bsc)return Ko(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",n)}function Qn(e,t,n,o=!0){let r=rt[e],a=cl({queryKey:[dl,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:c});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 pl(d)},enabled:o,staleTime:300*1e3}),i=a.data;return{transactionUrl:ll(()=>fl(e,t,i,n),[t,i,e,n]),chainInfo:i,...a}}var mi="0x0000000000000000000000000000000000000001";var ml="0xa9059cbb",gl=/^0x[a-fA-F0-9]{40}$/,hl="nexus-cross:dapp-ui:send:recent:",gi=10;function bl(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Nn(e){return e.toLowerCase()}function St(e){return gl.test(e)}function cn(e){return Nn(e.address)===mi}function Qo(e){return`${hl}${e.toLowerCase()}`}function ln(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(Qo(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(o=>o!==null&&typeof o=="object"&&St(o.address)&&typeof o.updatedAt=="number").slice(0,gi):[]}catch{return[]}}function Zo(e,t){if(typeof window>"u")return[];let n=Nn(t),o=[{address:n,updatedAt:Date.now()},...ln(e).filter(r=>r.address!==n)].slice(0,gi);try{window.localStorage.setItem(Qo(e),JSON.stringify(o))}catch{return ln(e)}return o}function Yo(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(Qo(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 Tn(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=bl(a.toString().padStart(t,"0"));return`${r.toString()}.${i}`}function Xo(e,t){let n=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),o=t.toString(16).padStart(64,"0");return`${ml}${n}${o}`}function hi(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(hi(n.cause,t+1)),o.join(`
6
+ `).toLowerCase()}function wl(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 Jo(e,t={},n="Failed to send transaction."){let o=hi(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.":wl(e)||n}var xl=2000000000n,vl=1000000000n;async function Zn(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 Yn(e){return BigInt(e)}function yl(e){return`0x${e.toString(16)}`}function kl(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=yl(e.value)),e.data&&(t.data=e.data),t}function Sl(e){return e===56||e===97}async function bi(e){try{let t=await Zn(e,"eth_gasPrice",[]);return{gasPrice:Yn(t)}}catch{return{gasPrice:xl}}}async function Cl(e,t){let n=vl;try{let o=await Zn(e,"eth_maxPriorityFeePerGas",[]);n=Yn(o)}catch{}return{maxFeePerGas:t+n,maxPriorityFeePerGas:n}}async function Nl(e,t){if(t)return bi(e);let n;try{n=(await Zn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return n?Cl(e,Yn(n)):bi(e)}async function wi(e,t){let n=Sl(t.chainId),o=kl(t),[r,a]=await Promise.all([Zn(e,"eth_estimateGas",[o]),Nl(e,n)]);return{gasLimit:Yn(r),gasPrice:a.gasPrice,maxFeePerGas:a.maxFeePerGas,maxPriorityFeePerGas:a.maxPriorityFeePerGas}}function xi(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 wi(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 Tl=1500,Rl=120;function vi(e){return!!(e.token||e.recipient||e.amount)}function er({recipient:e,amount:t,token:n,balanceRaw:o}){let r={},a=e.trim(),i=Yt(t,n.quantity.decimals),s;return a?St(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.")),!cn(n)&&!St(n.address)&&(r.token="Token contract address is invalid."),{errors:r,rawAmount:r.amount?void 0:s,recipient:a&&St(a)?a:void 0}}function tr({token:e,walletAddress:t,recipient:n,rawAmount:o}){let r=t;return cn(e)?{to:n,value:o,chainId:e.chainId,from:r}:{to:Nn(e.address),data:Xo(n,o),value:0n,chainId:e.chainId,from:r}}function Il(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}var Ll=e=>new Promise(t=>setTimeout(t,e));async function yi({repository:e,args:t,chainId:n,onSubmitted:o,pollIntervalMs:r=Tl,pollMaxAttempts:a=Rl}){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 Il(l)?"reverted":"success";await Ll(r)}return"timeout"}var ki=["token","recipient","amount","review"];function Si(e){let{env:t,walletAddress:n,accountName:o,accounts:r=[],initialStep:a="recipient",token:i,tokens:s=[],onTokenChange:c,sendTransaction:l,getTransactionReceipt:d,estimateGas:m,getTokenPriceUsd:f,onSubmitted:u,onSuccess:v,onFailed:x,onExit:b,onOutlink:k}=e,E=A.useMemo(()=>xi({sendTransaction:l,getTransactionReceipt:d,estimateGas:m}),[l,d,m]),[g,B]=A.useState(i);A.useEffect(()=>{B(i)},[i.address,i.chainId]);let[R,F]=A.useState(a),[I,H]=A.useState(""),[W,Y]=A.useState(""),[$,z]=A.useState({}),[ce,ue]=A.useState("idle"),[ie,ae]=A.useState(""),[Fe,te]=A.useState(""),[G,J]=A.useState(null),[we,X]=A.useState(!1),[Me,_e]=A.useState(""),xe=A.useRef(0),[ke,bt]=A.useState(null),[de,Lt]=A.useState(""),[Ye,Xe]=A.useState(()=>ln(n)),Se=A.useMemo(()=>Ne(t),[t]),{transactionUrl:Le,chainInfo:me}=Qn(Se,g.chainId,ie||void 0,!0),re=me?.currency_symbol??"",ge=me?.name??`Chain ID ${g.chainId}`,Et=A.useRef({nativeSymbol:re||void 0,networkName:ge,tokenSymbol:g.symbol});Et.current={nativeSymbol:re||void 0,networkName:ge,tokenSymbol:g.symbol};let Je=A.useMemo(()=>BigInt(g.quantity.numeric||"0"),[g.quantity.numeric]),wt=A.useMemo(()=>Dt(g.quantity.numeric,g.quantity.decimals),[g.quantity.numeric,g.quantity.decimals]),he=f?.(g),Oe=A.useMemo(()=>{if(he===void 0)return;let N=parseFloat(W.replace(/,/g,""));return Number.isFinite(N)?N*he:0},[W,he]);A.useEffect(()=>{Y(""),z({})},[g.address,g.chainId]),A.useEffect(()=>{xe.current+=1,J(null),_e(""),X(!1)},[g.address,g.chainId,I,W]),A.useEffect(()=>{Xe(ln(n))},[n]);let xt=A.useCallback(N=>{H(N),z(j=>({...j,recipient:void 0}))},[]),Ee=A.useCallback(N=>{Y(N),z(j=>({...j,amount:void 0}))},[]),et=A.useCallback(()=>{Y(Tn(g.quantity.numeric,g.quantity.decimals)),z(N=>({...N,amount:void 0}))},[g.quantity.numeric,g.quantity.decimals]),tt=A.useCallback(N=>{B(N),c?.(N),F("recipient")},[c]),ze=A.useCallback(()=>F("token"),[]),pe=A.useCallback(()=>{F(N=>{if(N==="result")return"review";if(N===a)return b?.(),N;let j=ki.indexOf(N);return j<=0?(b?.(),N):ki[j-1]})},[a,b]),We=A.useCallback(()=>{let{errors:N}=er({recipient:I,amount:"1",token:g,balanceRaw:Je});if(N.recipient){z(j=>({...j,recipient:N.recipient}));return}z(j=>({...j,recipient:void 0})),F("amount")},[I,g,Je]),dt=A.useCallback(N=>{H(N),z(j=>({...j,recipient:void 0})),F("amount")},[]),vt=A.useCallback(()=>{let N=er({recipient:I,amount:W,token:g,balanceRaw:Je});z(N.errors),!(vi(N.errors)||N.rawAmount===void 0||!N.recipient)&&(bt(N.rawAmount),Lt(N.recipient),J(null),_e(""),ue("idle"),F("review"))},[I,W,g,Je]);A.useEffect(()=>{if(R!=="review"||!de||ke===null||G!==null||we||Me||!E.canEstimateGas(me?.rpc))return;let N=++xe.current;X(!0),_e(""),(async()=>{try{let j=tr({token:g,walletAddress:n,recipient:de,rawAmount:ke}),ee=await E.estimateGas(j,me?.rpc);if(xe.current!==N)return;J(ee)}catch(j){if(xe.current!==N)return;_e(Jo(j,Et.current,"Failed to estimate gas."))}finally{xe.current===N&&X(!1)}})()},[R,de,ke,G,we,Me,E,me?.rpc,g,n]);let De=A.useCallback(async()=>{if(!(!de||ke===null)){te(""),ae(""),ue("submitting");try{let N="",j=await yi({repository:E,args:tr({token:g,walletAddress:n,recipient:de,rawAmount:ke}),chainId:g.chainId,onSubmitted:ee=>{N=ee,ae(ee),ue("confirming"),Xe(Zo(n,de)),u?.({txHash:ee,chainId:g.chainId,amount:W,tokenSymbol:g.symbol,recipient:de})}});if(j==="success")ue("success"),N&&v?v?.(N):F("result");else if(j==="reverted"){let ee="Transaction reverted on-chain.";ue("error"),te(ee),N&&x?x({txHash:N,chainId:g.chainId,message:ee}):F("result")}else{let ee="Transaction receipt was not found. Please check again later.";ue("error"),te(ee),N&&x?x({txHash:N,chainId:g.chainId,message:ee}):F("result")}}catch(N){ue("error"),te(Jo(N,{nativeSymbol:re||void 0,networkName:ge,tokenSymbol:g.symbol})),F("result")}}},[E,de,ke,g,W,n,u,v,x,re,ge]),[At,Pt]=A.useState(!1),nt=A.useRef(void 0);A.useEffect(()=>()=>clearTimeout(nt.current),[]);let yt=A.useCallback(async()=>{if(ie)try{await navigator.clipboard.writeText(ie),Pt(!0),clearTimeout(nt.current),nt.current=setTimeout(()=>Pt(!1),2e3)}catch{}},[ie]),Ae=A.useCallback(()=>{if(!Le||!ie)return;let N=He=>{typeof window<"u"&&window.open(He,"_blank","noopener,noreferrer")};if(!k){N(Le);return}let j=k(Le,{category:"send",origin:"send-transaction",payload:{chainId:g.chainId,txHash:ie}});if(j&&typeof j.then=="function"){let He=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;j.then(Ge=>{if(Ge===null){He?.close();return}let Ot=Ge??Le;if(He)try{He.location.href=Ot}catch{He.close(),N(Ot)}else N(Ot)});return}let ee=j;ee!==null&&N(ee??Le)},[k,g.chainId,Le,ie]),pt=A.useCallback(()=>{te(""),ae(""),ue("idle"),J(null),_e(""),F("review")},[]);return{step:R,status:ce,token:g,tokens:s.length>0?s:[g],recipient:I,amount:W,amountUsd:Oe,fieldErrors:$,error:Fe,txHash:ie,gasEstimate:G,gasLoading:we,gasError:Me,reviewRawAmount:ke,reviewRecipient:de,recentAddresses:Ye,accounts:r,accountName:o,walletAddress:n,resolvedEnv:Se,transactionUrl:Le,networkName:ge,nativeSymbol:re,nativeDecimals:me?.currency_decimals??g.quantity.decimals,balanceRaw:Je,balanceText:wt,priceUsd:he,canSelectToken:(s.length>0?s:[g]).length>1,canSend:E.canSend,getTokenPriceUsd:f,setRecipient:xt,setAmount:Ee,setMax:et,selectToken:tt,goToTokenSelect:ze,selectRecipient:dt,submitRecipient:We,submitAmount:vt,confirmSend:De,retry:pt,back:pe,hashCopied:At,copyHash:yt,openTransaction:Ae}}import*as ut from"react";function Xn(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 nr(e,t){return Xn(e,t,6)}function Ci(e){return Xn(e,9,2)}function Ni(e){return e.toLocaleString("en-US")}function Ti(e){return e===56||e===97}function Jn(e){return e.gasPrice??e.maxFeePerGas}function Ri(e,t=!1){return t?Jn(e)!==void 0?"legacy":null:e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Ii(e,t=!1){if(t){let n=Jn(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})}`}import{jsx as Rn,jsxs as or}from"react/jsx-runtime";function Li({flow:e}){let{amount:t,setAmount:n,amountUsd:o,balanceText:r,balanceRaw:a,token:i,setMax:s}=e,c=ut.useRef(null),l=ut.useCallback(()=>{requestAnimationFrame(()=>{let x=c.current;if(!x)return;let b=x.value.length;x.setSelectionRange(b,b)})},[]);ut.useEffect(()=>{c.current?.focus(),l()},[l]),ut.useEffect(()=>{t===""&&(f(!1),l())},[t,l]);let d=ut.useMemo(()=>{let x=Yt(t,i.quantity.decimals);return"value"in x&&x.value>a},[t,i.quantity.decimals,a]),[m,f]=ut.useState(!1),u=!m&&t===""?"0.00":t,v=t.trim()===""||t.trim()==="0";return Rn("div",{className:"sf-body sf-amount",children:or("div",{className:"sf-amount-center",children:[Rn("span",{className:"sf-amount-usd",children:o!==void 0?eo(o):"\xA0"}),Rn("div",{className:"sf-amount-input-wrap","data-over":d||void 0,"data-empty":v||void 0,onClick:()=>c.current?.focus(),children:Rn("input",{ref:c,className:"sf-amount-input",value:u,onChange:x=>{let b=x.target.value;if(m)n(b);else if(t===""){if(b.length<4)return;f(!0);let k=b.startsWith("0.00")?b.slice(4):b;n(k)}else f(!0),n(b)},placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-label":`Amount in ${i.symbol}`,size:1})}),or("div",{className:"sf-amount-balance",children:[Rn("span",{children:"Balance:"}),or("button",{type:"button",className:"sf-amount-max",onClick:s,children:[r," ",i.symbol]})]})]})})}import*as mt from"react";var rr={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},Ei={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function In(e,t){let n=Pe[e];if(t===n.cross)return Ei.cross;if(t===n.bsc)return Ei.bsc}var El={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function Xt(e,t,n={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:r,format:a="png"}=n,i=El[e],s=r?`&bg=${r}`:"";return`${i}/portrait/evm/${t}.${a}?size=${o}${s}`}import{jsx as it,jsxs as to}from"react/jsx-runtime";function Ai({size:e=20,className:t}){return to("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[it("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:"1.7"}),it("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Pi({size:e=20,className:t}){return it("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:t,"aria-hidden":"true",children:it("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 Bi({size:e=20,className:t}){return to("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,"aria-hidden":"true",children:[it("circle",{cx:"10",cy:"10",r:"10",fill:"currentColor",opacity:"0.12"}),it("path",{d:"M7 7l6 6M13 7l-6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})]})}function Fi({size:e=16,className:t}){return it("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",className:t,"aria-hidden":"true",children:it("path",{d:"M8 3v10m0 0 4-4m-4 4-4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Mi({size:e=56,className:t}){return to("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[it("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-accent-primary-default, #00b4b7)"}),it("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 _i({size:e=56,className:t}){return to("svg",{width:e,height:e,viewBox:"0 0 56 56",fill:"none",className:t,"aria-hidden":"true",children:[it("circle",{cx:"28",cy:"28",r:"28",fill:"var(--ds-system-red-default, #da0b2e)"}),it("path",{d:"M20 20 36 36m0-16L20 36",stroke:"#ffffff",strokeWidth:"4",strokeLinecap:"round"})]})}import{jsx as le,jsxs as Ct}from"react/jsx-runtime";function Oi(e,t){return e.name||`Account ${(e.index??t)+1}`}function zi(e){return e.trim().slice(0,1).toUpperCase()||"A"}function Wi(e){return e.toLowerCase()}function Di({flow:e}){let{recipient:t,setRecipient:n,fieldErrors:o,recentAddresses:r,accounts:a,walletAddress:i,resolvedEnv:s,selectRecipient:c}=e,l=mt.useMemo(()=>a.filter(g=>g.address.toLowerCase()!==i.toLowerCase()),[a,i]),d=l.length>0,m=mt.useMemo(()=>new Map(l.map((g,B)=>[Wi(g.address),{account:g,index:B}])),[l]),[f,u]=mt.useState("recent"),v=mt.useRef(null);mt.useEffect(()=>{v.current?.focus()},[]);let x="1A1A2E",b=mt.useCallback(async()=>{try{let g=await navigator.clipboard.readText();g&&n(g.trim())}catch{}},[n]),k=t.trim().length>0,E=St(t.trim());return Ct("div",{className:"sf-recipient",children:[Ct("div",{className:"sf-recipient-top",children:[Ct("div",{className:"sf-address-field","data-filled":k||void 0,"data-invalid":o.recipient||void 0,children:[le("textarea",{ref:v,className:"sf-address-input",value:t,onChange:g=>n(g.target.value),placeholder:"Enter the recipient's address",autoComplete:"off",spellCheck:!1,"aria-label":"Recipient address",rows:k?2:1}),k?le("button",{type:"button",className:"sf-address-action",onClick:()=>n(""),"aria-label":"Clear",children:le(Bi,{size:20})}):le("button",{type:"button",className:"sf-address-action",onClick:b,"aria-label":"Paste from clipboard",children:le(Pi,{size:20})})]}),o.recipient&&le("p",{className:"sf-field-error",role:"alert",children:o.recipient}),Ct("div",{className:"sf-tabs",role:"tablist",children:[le("button",{type:"button",role:"tab",className:"sf-tab","data-active":f==="recent"||void 0,"aria-selected":f==="recent",onClick:()=>u("recent"),children:"Recent"}),d&&le("button",{type:"button",role:"tab",className:"sf-tab","data-active":f==="account"||void 0,"aria-selected":f==="account",onClick:()=>u("account"),children:"My Account"})]})]}),le("div",{className:"sf-address-list",children:f==="account"&&d?l.map((g,B)=>{let R=Oi(g,B),F=Xt(s,g.address,{size:56,bg:x});return Ct("button",{type:"button",className:"sf-address-row",onClick:()=>c(g.address),children:[Ct("span",{className:"sf-address-avatar",children:[F&&le("img",{src:F,alt:"",width:40,height:40,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}}),le("span",{className:"sf-address-avatar-fallback",children:zi(R)})]}),Ct("span",{className:"sf-address-meta",children:[le("span",{className:"sf-address-name",children:R}),le("span",{className:"sf-address-value",children:je(g.address)})]})]},g.address)}):r.length>0?r.map(g=>{let B=m.get(Wi(g.address)),R=B?Oi(B.account,B.index):je(g.address),F=Xt(s,g.address,{size:56,bg:x});return Ct("button",{type:"button",className:"sf-address-row",onClick:()=>c(g.address),children:[Ct("span",{className:"sf-address-avatar",children:[F&&le("img",{src:F,alt:"",width:40,height:40,draggable:!1,onError:I=>{I.currentTarget.style.display="none"}}),le("span",{className:"sf-address-avatar-fallback",children:zi(R)})]}),Ct("span",{className:"sf-address-meta",children:[le("span",{className:"sf-address-name",children:R}),le("span",{className:"sf-address-value",children:je(g.address)})]})]},g.address)}):le("div",{className:"sf-empty",children:"No send history"})}),k&&!E&&!o.recipient&&le("p",{className:"sf-field-error",role:"alert",children:"Enter a valid EVM recipient address."})]})}import{jsx as Te,jsxs as dn}from"react/jsx-runtime";function Gi({flow:e}){let{status:t,txHash:n,error:o,copyHash:r,hashCopied:a,openTransaction:i}=e,s=t==="error",c=t==="success";return s?dn("div",{className:"sf-body sf-result sf-result--error",children:[Te("span",{className:"sf-result-icon",children:Te(_i,{size:56})}),dn("div",{className:"sf-result-copy",children:[Te("h3",{className:"sf-result-title",children:"Transaction Failed"}),Te("p",{className:"sf-result-desc",children:o||"Something went wrong. Please try again."})]}),n&&Te(Hi,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]}):dn("div",{className:"sf-body sf-result",children:[Te("span",{className:"sf-result-icon","data-pending":!c||void 0,children:c?Te(Mi,{size:56}):Te("span",{className:"sf-result-spinner"})}),dn("div",{className:"sf-result-copy",children:[Te("h3",{className:"sf-result-title",children:c?"Transaction Complete":"Transaction in Progress"}),Te("p",{className:"sf-result-desc",children:c?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),n&&Te(Hi,{txHash:n,hashCopied:a,onCopy:r,onOpen:i})]})}function Hi({txHash:e,hashCopied:t,onCopy:n,onOpen:o}){return dn("div",{className:"sf-result-hash-card",children:[Te("span",{className:"sf-result-hash-label",children:"Transaction Hash"}),dn("div",{className:"sf-result-hash-row",children:[Te("button",{type:"button",className:"sf-result-hash-link",onClick:o,"aria-label":"Open transaction in explorer",children:je(e)}),Te("button",{type:"button",className:"sf-result-copy-btn",onClick:n,"aria-label":"Copy transaction hash",children:t?Te(Sn,{size:16}):"Copy"})]})]})}import{jsx as oe,jsxs as Be}from"react/jsx-runtime";var no="\u2014";function Ui({flow:e}){let{token:t,reviewRawAmount:n,reviewRecipient:o,accountName:r,accounts:a,walletAddress:i,networkName:s,nativeSymbol:c,nativeDecimals:l,gasEstimate:d,gasLoading:m,gasError:f,error:u,resolvedEnv:v}=e,x=cn(t),b=n!==null?Xn(n,t.quantity.decimals):"",k=r?.trim()||`Account ${(a[0]?.index??0)+1}`,E=Xt(v,i,{size:56,bg:"1A1A2E"}),g=c||(x?t.symbol:""),B=Ti(t.chainId),R=d?Ri(d,B):null,F=d?Ii(d,B):null,I=z=>z!==null&&g?`${nr(z,l)} ${g}`:no,H=z=>z!==void 0?`${Ci(z)} Gwei`:no,W=(()=>{if(!x||!d||F===null||n===null)return no;let z=n+F;return`${nr(z,l)} ${g||t.symbol}`})(),Y=z=>m?"\u2026":z,$=[{label:"Est. Tx Fee",value:Y(I(F))},...R==="dynamic"?[{label:"Max Priority Fee",value:Y(H(d?.maxPriorityFeePerGas))},{label:"Max Gas Fee",value:Y(H(d?.maxFeePerGas))}]:R==="legacy"?[{label:"Gas Price",value:Y(H(d?Jn(d):void 0))}]:[],{label:"Gas Limit",value:Y(d?Ni(d.gasLimit):no)}];return Be("div",{className:"sf-body sf-review",children:[Be("div",{className:"sf-review-amount",children:[oe("img",{className:"sf-review-amount-icon",src:t.icon_url,alt:"",width:40,height:40,draggable:!1,onError:z=>{z.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),Be("span",{className:"sf-review-amount-value",children:[b,oe("span",{className:"sf-review-amount-symbol",children:t.symbol})]})]}),Be("div",{className:"sf-review-parties",children:[Be("div",{className:"sf-review-card sf-review-party",children:[oe("span",{className:"sf-review-party-label",children:"From"}),Be("div",{className:"sf-review-party-head",children:[oe("span",{className:"sf-review-party-avatar",children:E&&oe("img",{src:E,alt:"",width:28,height:28,draggable:!1,onError:z=>{z.currentTarget.style.display="none"}})}),oe("span",{className:"sf-review-party-name",children:k})]}),oe("span",{className:"sf-review-party-addr",children:i})]}),oe("span",{className:"sf-review-arrow","aria-hidden":!0,children:oe(Fi,{size:16})}),Be("div",{className:"sf-review-card sf-review-party",children:[oe("span",{className:"sf-review-party-label",children:"To"}),oe("span",{className:"sf-review-party-addr",children:o})]})]}),Be("section",{className:"sf-review-card",children:[oe("h3",{className:"sf-review-section-title",children:"Summary"}),Be("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Network"}),oe("span",{className:"sf-review-row-value",children:s})]}),$.map(z=>Be("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:z.label}),oe("span",{className:"sf-review-row-value",children:z.value})]},z.label))]}),Be("section",{className:"sf-review-card",children:[oe("h3",{className:"sf-review-section-title",children:"Total"}),Be("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Total Amount"}),Be("span",{className:"sf-review-row-value",children:[b," ",t.symbol]})]}),x&&Be("div",{className:"sf-review-row",children:[oe("span",{className:"sf-review-row-label",children:"Max. Total Amount"}),oe("span",{className:"sf-review-row-value",children:Y(W)})]})]}),(f||u)&&oe("div",{className:"sf-message sf-message--error",role:"alert",children:f||u})]})}import*as oo from"react";import{jsx as Ht,jsxs as Jt}from"react/jsx-runtime";function $i({flow:e}){let[t,n]=oo.useState(""),o=t.trim().toLowerCase(),r=oo.useMemo(()=>o?e.tokens.filter(a=>a.symbol.toLowerCase().includes(o)||a.name.toLowerCase().includes(o)):e.tokens,[e.tokens,o]);return Jt("div",{className:"sf-body sf-token-select",children:[Jt("div",{className:"sf-search",children:[Ht(Ai,{size:20}),Ht("input",{className:"sf-search-input",value:t,onChange:a=>n(a.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1,"aria-label":"Search tokens"})]}),Jt("div",{className:"sf-token-list",children:[r.map(a=>{let i=`${a.chainId}:${a.address.toLowerCase()}`,s=In(e.resolvedEnv,a.chainId),c=e.getTokenPriceUsd?.(a);return Jt("button",{type:"button",className:"sf-token-row",onClick:()=>e.selectToken(a),children:[Jt("span",{className:"sf-token-left",children:[Jt("span",{className:"sf-token-icon-wrap",children:[Ht("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&&Ht("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"}})]}),Ht("span",{className:"sf-token-name",children:a.symbol})]}),Jt("span",{className:"sf-token-right",children:[Ht("span",{className:"sf-token-balance",children:Dt(a.quantity.numeric,a.quantity.decimals)}),c!==void 0&&Ht("span",{className:"sf-token-price",children:eo(c)})]})]},i)}),r.length===0&&Ht("div",{className:"sf-empty",children:"No tokens found"})]})]})}O(`.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;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;width:100%;margin-top:8px}.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;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 be,jsxs as ro}from"react/jsx-runtime";var Al={token:"Send",recipient:"Send",amount:"Send",review:"Sign Transaction",result:""};function io({onClose:e,onBackToWallet:t,onConfirmSuccess:n,onSuccess:o,className:r,...a}){let i=ji.useCallback(k=>{o?.(k),n?.(k)},[n,o]),c=Si({...a,onSuccess:o||n?i:void 0,onExit:t}),{step:l,status:d}=c,m=St(c.recipient.trim()),f=Yt(c.amount,c.token.quantity.decimals),u="value"in f&&f.value<=c.balanceRaw,v=d==="submitting"||d==="confirming",x=l!=="result",b=Al[l]??"";return ro("div",{className:Q("sf-root",r),"data-step":l,children:[ro("header",{className:"sf-header",children:[x?be("button",{type:"button",className:"sf-header-btn",onClick:c.back,"aria-label":"Back",children:be(Bt,{size:24})}):be("span",{className:"sf-header-btn","aria-hidden":!0}),be("span",{className:"sf-header-title",children:b}),be("button",{type:"button",className:"sf-header-btn",onClick:e,"aria-label":"Close",children:be(kt,{size:24})})]}),l==="token"&&be($i,{flow:c}),l==="recipient"&&be(Di,{flow:c}),l==="amount"&&be(Li,{flow:c}),l==="review"&&be(Ui,{flow:c}),l==="result"&&be(Gi,{flow:c}),ro("footer",{className:"sf-footer","data-step":l,children:[l==="recipient"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitRecipient,"data-disabled":!m||void 0,"aria-disabled":!m,children:"Next"}),l==="amount"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.submitAmount,"data-disabled":!u||void 0,"aria-disabled":!u,children:"Next"}),l==="review"&&ro("div",{className:"sf-footer-row",children:[be("button",{type:"button",className:"sf-btn sf-btn--secondary",onClick:c.back,disabled:v,children:"Cancel"}),be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.confirmSend,disabled:v||!c.canSend,children:v?"Sending...":"Send"})]}),l==="result"&&d==="success"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:()=>n?.(c.txHash||void 0),children:"All done"}),l==="result"&&d==="error"&&be("button",{type:"button",className:"sf-btn sf-btn--primary",onClick:c.retry,children:"Try Again"})]})]})}import*as Vi from"@radix-ui/react-popover";import{Drawer as Pl}from"vaul";import{jsx as ao,jsxs as Bl}from"react/jsx-runtime";function qi({asChild:e,className:t,children:n}){let{isMobile:o,theme:r,walletAddress:a}=Wt(),i=n!=null,s=e??!0,c=i?n:Bl("button",{type:"button",className:Q("wi-trigger-btn",t),"data-theme":r,"data-mobile":o||void 0,children:[ao(ti,{size:o?14:16}),ao("span",{className:"wi-trigger-address",children:je(a)})]});return o?ao(Pl.Trigger,{asChild:s,children:c}):ao(Vi.Trigger,{asChild:s,children:c})}import*as P from"react";import*as vo from"@radix-ui/react-popover";import{Drawer as wo}from"vaul";import Bn from"bignumber.js";import{useQueries as Fl}from"@tanstack/react-query";import{useMemo as Ml}from"react";var ir="user-balance";async function _l(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 pn(e,t,n=!0){let o=rt[e],r=Pe[e],a=[r.cross,r.bsc],i=Fl({queries:a.map(d=>({queryKey:[ir,e,t,d],queryFn:({signal:m})=>_l(o,d,t,m),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1}))}),s=i.some(d=>d.isLoading),c=i.some(d=>d.isError);return{tokens:Ml(()=>{let d=[];for(let m of i)m.data&&d.push(...m.data);return d},[i]),isLoading:s,isError:c}}import{useQuery as Ol,useQueries as zl}from"@tanstack/react-query";import{useMemo as Wl}from"react";var Dl="forge-holdings",Hl="forge-token-image";async function Gl(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 Ul(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 Ki(e,t,n=!0){let o=rr[e],{data:r,...a}=Ol({queryKey:[Dl,e,t],queryFn:({signal:i})=>Gl(o,t,i),enabled:!!t&&n,staleTime:0,refetchInterval:n?5e3:!1});return{holdings:r??[],...a}}function Qi(e,t,n=!0){let o=rr[e],r=zl({queries:t.map(i=>({queryKey:[Hl,e,i],queryFn:({signal:s})=>Ul(o,i,s),enabled:n,staleTime:1/0}))});return{imageMap:Wl(()=>{let i=new Map;for(let s of r)s.data&&i.set(s.data.address,s.data.image_url);return i},[r])}}import{useQuery as $l}from"@tanstack/react-query";import{useMemo as jl}from"react";var ar="token-stats";function Ft(e,t){return`${e}:${t.toLowerCase()}`}function fn(e,t=!0){let n=rt[e],{data:o,...r}=$l({queryKey:[ar,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/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:jl(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=Ft(s.chain_id,s.address);i.set(c,s)}return i},[o]),...r}}import{useQuery as Vl}from"@tanstack/react-query";import{useMemo as ql}from"react";var Kl="token-info";function sr(e,t){return`${t.toLowerCase()}_${e}`}function Zi(e,t=!0){let n=rt[e],{data:o,...r}=Vl({queryKey:[Kl,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/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:ql(()=>{let i=new Map;if(!o?.data)return i;for(let s of o.data){let c=sr(s.chain_id,s.address);i.set(c,s.category)}return i},[o]),...r}}import{useMemo as Ql}from"react";import lr from"bignumber.js";function Yi(e,t,n){let{tokens:o,isLoading:r}=pn(e,t,n),{statsMap:a}=fn(e,n);return Ql(()=>{let i=new lr(0);for(let d of o){let m=a.get(Ft(d.chainId,d.address));if(!m)continue;let u=new lr(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new lr(m.price));u.isNaN()||(i=i.plus(u))}let s=i.toFixed(),{displayValue:c,isLowerBound:l}=fi(s);return{totalUsd:s,displayValue:c,isLowerBound:l,isLoading:r}},[o,a,r])}import{QRCodeSVG as Id}from"qrcode.react";function Ve(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=m=>{if(m===null){l?.close();return}let f=m??t;if(l)try{l.location.href=f}catch{l.close(),a(f)}else a(f)};r.then(d,m=>{console.error("[dapp-ui] onOutlink rejected:",m),l?.close()});return}let s=r;if(s===null)return;a(s??t)}import*as nn from"react";import{Drawer as $c}from"vaul";import{createContext as Zl,useContext as Yl}from"react";var Ln=Zl(null);function at(){let e=Yl(Ln);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as Xl}from"vaul";import{jsx as Xi}from"react/jsx-runtime";function Ji({asChild:e,children:t}){let{walletAddress:n}=at(),o=t!=null,r=e??!0,a=o?t:Xi("button",{type:"button",children:je(n)});return Xi(Xl.Trigger,{asChild:r,children:a})}import{Drawer as uo}from"vaul";import*as Ze from"react";import{useQueryClient as Hc}from"@tanstack/react-query";import{useMemo as rc}from"react";import cr from"bignumber.js";import{useQuery as Jl}from"@tanstack/react-query";import{useMemo as ia}from"react";var so={dev:"https://stg-cross-game-reward-api.crosstoken.io/api",stage:"https://stg-cross-game-reward-api.crosstoken.io/api",production:"https://cross-game-reward-api.crosstoken.io/api"},ea={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},lo={dev:"https://stg-bonding-curve-api.crosstoken.io/api",stage:"https://stg-bonding-curve-api.crosstoken.io/api",production:"https://bonding-curve-api.crosstoken.io/api"},ta={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},un={dev:"https://stg-posa-api.crosstoken.io/api/v1",stage:"https://stg-posa-api.crosstoken.io/api/v1",production:"https://posa-api.crosstoken.io/api/v1"},En={dev:"https://dev-stake.ogfcorp.com",stage:"https://stg-stake.ogfcorp.com",production:"https://stake.ogfcorp.com"},na={dev:`${En.dev}/portfolio`,stage:`${En.stage}/portfolio`,production:`${En.production}/portfolio`},oa={dev:"https://stg-game-swap-api.cross.nexus/v1",stage:"https://stg-game-swap-api.cross.nexus/v1",production:"https://game-swap-api.cross.nexus/v1"},ra={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},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 ec="wp:reward-pools";function co(e,t=!0){let n=so[e],{data:o,...r}=Jl({queryKey:[ec,e],queryFn:async({signal:s})=>{let c=await fetch(`${n}/v1/pools`,{cache:"no-store",signal:s});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}),a=ia(()=>o?.data.pools.filter(s=>s.pool_type==="CrossPool")??[],[o]),i=ia(()=>o?.data.pools.filter(s=>s.pool_type==="GamePool")??[],[o]);return{crossPools:a,gamePools:i,allPools:o?.data.pools??[],...r}}import{useQuery as tc}from"@tanstack/react-query";import{useMemo as nc}from"react";var oc="wp:user-deposits";function po(e,t,n=!0){let o=so[e],r=n&&!!t,{data:a,...i}=tc({queryKey:[oc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:c});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:r,staleTime:0});return{depositMap:nc(()=>{let c=new Map;if(!a?.data.user_deposits)return c;for(let l of a.data.user_deposits)c.set(l.pool_address.toLowerCase(),l);return c},[a]),deposits:a?.data.user_deposits??[],...i}}var ic=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],aa="var(--wp-green)",sa=4;function la(e,t,n=!0){let o=n&&!!t,{allPools:r}=co(e,o),{depositMap:a}=po(e,t,o);return rc(()=>{let i=new Map,s=new Map,c=(f,u)=>{!Number.isFinite(u)||u<=0||s.set(f,(s.get(f)??0)+u)};for(let f of r){let u=Number(f.deposit_token.price);u>0&&i.set(f.deposit_token.symbol,u);for(let v of f.reward_tokens){let x=Number(v.price);x>0&&i.set(v.symbol,x)}}for(let f of r){let u=a.get(f.pool_address.toLowerCase());if(!u)continue;let v=new cr(u.deposited_amount).shiftedBy(-f.deposit_token.decimals).toNumber();if(c(f.deposit_token.symbol,v),f.reward_tokens.length>0){let x=f.reward_tokens[0],b=new cr(u.claimable_reward).shiftedBy(-x.decimals).toNumber();c(x.symbol,b)}}let l=[],d=0;for(let[f,u]of s){let v=i.get(f)??0,x=u*v;x>0&&(l.push({symbol:f,usdValue:x}),d+=x)}l.sort((f,u)=>u.usdValue-f.usdValue);let m=[];if(d>0){let f=l.slice(0,sa),u=l.slice(sa);for(let x=0;x<f.length;x++)m.push({symbol:f[x].symbol,usdValue:f[x].usdValue,percentage:Math.round(f[x].usdValue/d*100),color:ic[x]??aa});if(u.length>0){let x=u.reduce((b,k)=>b+k.usdValue,0);m.push({symbol:"Others",usdValue:x,percentage:Math.round(x/d*100),color:aa})}let v=m.reduce((x,b)=>x+b.percentage,0);v!==100&&m.length>0&&(m[0].percentage+=100-v)}return{totalUsd:d,formattedTotal:d>0?`$${new cr(d).toFormat(2)}`:"$0.00",segments:m}},[r,a])}import{jsx as Mt,jsxs as pr}from"react/jsx-runtime";function ca({size:e=22,className:t}){return pr("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 da({size:e=24,className:t}){return Mt("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:Mt("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function dr({size:e=16,className:t}){return pr("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:[Mt("path",{d:"M1.333 8s2.424-4.667 6.667-4.667S14.667 8 14.667 8 12.243 12.667 8 12.667 1.333 8 1.333 8z",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M8 10a2 2 0 100-4 2 2 0 000 4z",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=12,className:t}){return pr("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 fr from"bignumber.js";var ur={included:["CROSS Rewards deposited assets","CROSS Rewards claimable rewards"],excluded:["Forge LP value","CROSS staking value","Game Swap LP value","Wallet balances outside Portfolio"]};function pa(e){return e!=="production"}function mn(e,t){let n=new fr(e).shiftedBy(-t);return!n.isFinite()||n.isZero()?"0":n.isGreaterThanOrEqualTo(1)?n.toFormat(2,fr.ROUND_DOWN):n.toFormat(4,fr.ROUND_DOWN)}function mr(e){return mn(e,0)}import{useQuery as ac}from"@tanstack/react-query";import{useMemo as sc}from"react";var lc="wp:token-info";function fa(e,t=!0){let n=rt[e],o=Pe[e].cross,{data:r,...a}=ac({queryKey:[lc,e],queryFn:async({signal:l})=>{let d=await fetch(`${n}/v1/public/token/info`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let m=await d.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:s}=sc(()=>{let l=new Map,d=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:d};for(let m of r.data){let f=m.address.toLowerCase();l.set(`${m.chain_id}:${f}`,m),l.set(f,m);let u=m.symbol.replace(/^t/,"").toUpperCase(),v=`${m.chain_id}:${u}`;d.has(v)||d.set(v,m),d.has(u)||d.set(u,m)}return{byChainAddr:l,byChainSym:d}},[r]);return{getTokenImage:(l,d)=>{let m=l.toLowerCase(),f=i.get(`${o}:${m}`);if(f?.image)return f.image;let u=i.get(m);if(u?.image)return u.image;if(d){let v=d.replace(/^t/,"").toUpperCase(),x=s.get(`${o}:${v}`);if(x?.image)return x.image;let b=s.get(v);if(b?.image)return b.image}return""},...a}}import{jsx as fo,jsxs as ua}from"react/jsx-runtime";function Ut({title:e,icon:t,iconFit:n="cover",isEmpty:o,children:r}){return ua("div",{className:"wp-svc-card",children:[ua("div",{className:"wp-svc-card-head",children:[fo("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:n}}),fo("span",{className:"wp-svc-card-title",children:e})]}),o?fo("div",{className:"wp-svc-empty",children:"No assets yet"}):fo("div",{className:"wp-svc-items",children:r})]})}import An from"bignumber.js";import{jsx as Re,jsxs as qe}from"react/jsx-runtime";var cc="CROSS Rewards";function dc(e){return new An(e||"0").isGreaterThan(0)}function pc(e,t,n){let o=new An(e||"0").shiftedBy(-t).times(n||"0");return!o.isFinite()||o.isZero()?"$0.00":`$${o.toFormat(2,An.ROUND_DOWN)}`}function ma(){let{env:e,walletAddress:t,onOutlink:n}=at(),o=!!t,{allPools:r}=co(e,o),{depositMap:a}=po(e,t,o),{getTokenImage:i}=fa(e,o),s=(d,m)=>`${ea[e]}/rewards/${d.pool_address}?action=${m}`,c=`${Gt[e]}/reward.png`,l=r.filter(d=>{let m=a.get(d.pool_address.toLowerCase()),f=m?.deposited_amount??"0",u=m?.claimable_reward??"0";return!(new An(f).isZero()&&new An(u).isZero())});return Re(Ut,{title:cc,icon:c,isEmpty:l.length===0,children:l.map(d=>{let m=a.get(d.pool_address.toLowerCase()),f=m?.deposited_amount??"0",u=m?.claimable_reward??"0",v=s(d,"withdraw"),x=s(d,"claim"),b=i(d.deposit_token.address,d.deposit_token.symbol),k=d.reward_tokens[0],E=k?i(k.address,k.symbol):"",g=d.reward_tokens.map(W=>W.symbol),B=g.length>0?`${d.deposit_token.symbol}-${g.join("/")}`:d.deposit_token.symbol,R=k?mn(u,k.decimals):"0",F=k?.symbol??"Reward",I=k?pc(u,k.decimals,k.price):"$0.00",H=!!m&&dc(u);return qe("article",{className:"wp-item","data-side":"reward",children:[qe("div",{className:"wp-item-body",children:[qe("div",{className:"wp-item-line",children:[Re("span",{className:"wp-item-label",children:"Pool (Deposit - Earn)"}),qe("div",{className:"wp-svc-token",children:[qe("span",{className:"wp-token-stack","aria-hidden":!0,children:[b&&Re("img",{className:"wp-svc-token-icon",src:b,alt:""}),E&&Re("img",{className:"wp-svc-token-icon",src:E,alt:""})]}),Re("span",{children:B})]})]}),qe("div",{className:"wp-item-line",children:[Re("span",{className:"wp-item-label",children:"Deposited"}),qe("div",{className:"wp-svc-token",children:[b&&Re("img",{className:"wp-svc-token-icon",src:b,alt:""}),Re("span",{children:mn(f,d.deposit_token.decimals)})]})]}),qe("div",{className:"wp-item-line",children:[qe("span",{className:"wp-item-label",children:["Claimable (",F,")"]}),qe("div",{className:"wp-svc-token",children:[E&&Re("img",{className:"wp-svc-token-icon",src:E,alt:""}),Re("span",{children:R}),Re("span",{className:"wp-item-usd",children:I})]})]})]}),qe("div",{className:"wp-item-tags",children:[qe("a",{className:"wp-tag wp-tag--muted",href:v,target:"_blank",rel:"noopener noreferrer",onClick:W=>Ve(W,v,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:m}},n),children:[Re("span",{className:"wp-tag-label",children:"Withdraw"}),Re(_t,{size:12,className:"wp-tag-icon"})]}),qe("a",{className:"wp-tag wp-tag--mint","data-disabled":!H||void 0,"aria-disabled":!H||void 0,href:H?x:void 0,target:H?"_blank":void 0,rel:H?"noopener noreferrer":void 0,onClick:W=>{if(!H){W.preventDefault();return}Ve(W,x,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:d,userDeposit:m}},n)},children:[Re("span",{className:"wp-tag-label",children:"Claim"}),Re(_t,{size:12,className:"wp-tag-icon"})]})]})]},d.pool_address)})})}import*as xa from"react";import{useQuery as fc}from"@tanstack/react-query";var uc="wp:stake-info";function ga(e,t,n=!0){let o=un[e],r=n&&!!t,{data:a,...i}=fc({queryKey:[uc,e,t],queryFn:async({signal:c})=>{let l=await fetch(`${o}/stake/${t}`,{cache:"no-store",signal:c});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:r,staleTime:0});return{stakeInfo:a?.data,...i}}import{useQuery as mc}from"@tanstack/react-query";var gc="wp:stake-rewards";function ha(e,t,n=!0){let o=un[e],r=n&&!!t,{data:a,...i}=mc({queryKey:[gc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/rewards/${t}?limit=1`,{cache:"no-store",signal:s});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?.[0]??null},enabled:r,staleTime:0});return{latestReward:a??null,...i}}import{useQuery as hc}from"@tanstack/react-query";var bc="wp:network-stats";function ba(e,t=!0){let n=un[e],{data:o,...r}=hc({queryKey:[bc,e],queryFn:async({signal:i})=>{let s=await fetch(`${n}/network/stats`,{cache:"no-store",signal:i});if(!s.ok)throw new Error(`Network stats fetch failed: ${s.status}`);let c=await s.json();if(c.code!==0&&c.code!==200)throw new Error(`Network stats API error: ${c.code}`);return c},enabled:t,staleTime:0});return{networkStats:o?.data,...r}}import gn from"bignumber.js";import{Fragment as xc,jsx as Ke,jsxs as Nt}from"react/jsx-runtime";var wc="CROSS Staking";function wa(e){if(!e)return"\u2014";let t=new gn(e);return t.isFinite()?`${t.toFormat(2,gn.ROUND_DOWN)}%`:"\u2014"}function va(){let{env:e,walletAddress:t,onOutlink:n}=at(),o=!!t,{stakeInfo:r}=ga(e,t,o),{latestReward:a}=ha(e,t,o),{networkStats:i}=ba(e,o),s=`${Gt[e]}/cross-staking.png`,c=na[e],l=r?.total_stake??"0",d=r?.delegations??0,m=xa.useMemo(()=>{let E=a?.cumulative_earned;if(!E)return;let g=new gn(E);return g.isFinite()?g:void 0},[a]),f=m?.toString(10)??r?.rewards_earned??"0",u=new gn(l),v=r?.days_since_first_stake,x=m!==void 0&&u.isGreaterThan(0)&&v!==null&&v!==void 0?m.div(u).times(365).div(Math.max(1,v)).times(100):void 0,b=!(new gn(l).isZero()&&new gn(f).isZero()),k=En[e];return Ke(Ut,{title:wc,icon:s,iconFit:"contain",isEmpty:!1,children:Nt("article",{className:"wp-item","data-side":"stake",children:[Ke("div",{className:"wp-item-body",children:b?Nt(xc,{children:[Nt("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Staked"}),Nt("span",{children:[mr(l)," CROSS"]})]}),Nt("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Rewards Earned"}),Nt("span",{children:[mr(f)," CROSS"]})]}),Nt("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Delegations"}),Ke("span",{children:d})]}),Nt("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"My APR"}),Ke("span",{children:wa(x?.toString(10))})]})]}):Nt("div",{className:"wp-item-line",children:[Ke("span",{className:"wp-item-label",children:"Delegation APR"}),Ke("span",{children:wa(i?.apr)})]})}),Ke("div",{className:"wp-item-tags",children:Nt("a",{className:"wp-tag wp-tag--mint",href:b?c:k,target:"_blank",rel:"noopener noreferrer",onClick:E=>Ve(E,b?c:k,{category:"portfolio",origin:"portfolio-stake",payload:{stakeInfo:r,networkStats:i}},n),children:[Ke("span",{className:"wp-tag-label",children:b?"Manage":"Stake Now"}),Ke(_t,{size:12,className:"wp-tag-icon"})]})})]})})}import*as gr from"react";import{useQuery as vc}from"@tanstack/react-query";var yc="wp:game-swap-pools";function ya(e,t,n=!0){let o=oa[e],r=n&&!!t,{data:a,...i}=vc({queryKey:[yc,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/addresses/${t}/portfolio`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Game-swap portfolio fetch failed: ${c.status}`);return(await c.json()).pools??[]},enabled:r,staleTime:0});return{pools:a??[],...i}}import{useQuery as kc}from"@tanstack/react-query";var Sc="wp:game-swap-lp-balances";function ka(e,t,n,o){let r=[...n].map(c=>c.toLowerCase()).sort(),a=!!o&&!!t&&r.length>0,{data:i,...s}=kc({queryKey:[Sc,e,t,r],queryFn:async()=>{if(!o)return{};let c=await o(r),l={};for(let[d,m]of Object.entries(c))l[d.toLowerCase()]=m;return l},enabled:a,staleTime:0});return{balances:i??{},...s}}import Tt from"bignumber.js";import{jsx as st,jsxs as gt}from"react/jsx-runtime";var Cc="Game Swap LP",Ca=18,Nc=new Tt("0.0001");function Sa(e){return e?.trim().toUpperCase()==="CROSS"}function Tc(e){return e&&e>0?e:Ca}function Rc(e){let t=Sa(e.token_a?.symbol)&&!Sa(e.token_b?.symbol),n=t?e.reserve_a:e.reserve_b,o=Tc(t?e.token_a?.decimals:e.token_b?.decimals),r=new Tt(n||"0").shiftedBy(-o);return!r.isFinite()||r.isLessThanOrEqualTo(0)?new Tt(0):r.times(2)}function Ic(e,t){let n=e.token_a?.symbol?.trim()||"TOKEN",o=e.token_b?.symbol?.trim()||"CROSS",r=t?.decimals??Ca,a,i;if(t&&t.totalSupply&&t.totalSupply>BigInt(0)){let s=new Tt(t.balance.toString()),c=new Tt(t.totalSupply.toString()),l=s.div(c);a=l.times(100);let d=l.times(Rc(e));if(d.isGreaterThan(0)){let m=new Tt(e.cross_usd||"0");i=m.isGreaterThan(0)?`$${d.times(m).toFormat(2,Tt.ROUND_DOWN)}`:`${d.toFormat(4,Tt.ROUND_DOWN)} CROSS`}}return{pool:e,tokenASymbol:n,tokenBSymbol:o,info:t,lpAmountRaw:t?.balance.toString(),lpDecimals:r,sharePercent:a,valueText:i}}function Na(){let{env:e,walletAddress:t,onOutlink:n,lpBalanceReader:o}=at(),r=!!t,{pools:a}=ya(e,t,r),i=gr.useMemo(()=>a.map(f=>f.pair_address).filter(Boolean),[a]),{balances:s}=ka(e,t,i,o),c=`${Gt[e]}/dex.png`,l=!!o,d=gr.useMemo(()=>{let f=a.map(u=>Ic(u,s[u.pair_address?.toLowerCase()]));return l?f.filter(u=>u.lpAmountRaw?new Tt(u.lpAmountRaw).shiftedBy(-u.lpDecimals).isGreaterThanOrEqualTo(Nc):!1):f},[a,s,l]),m=f=>{let u=f.token_a?.address??f.pair_address;return`${ra[e]}/tokens/${u}?trade=deposit`};return st(Ut,{title:Cc,icon:c,iconFit:"contain",isEmpty:d.length===0,children:d.map(f=>{let{pool:u}=f,v=m(u),x=`${f.tokenASymbol} / ${f.tokenBSymbol}`,b=u.token_a?.logo_url,k=u.token_b?.logo_url;return gt("article",{className:"wp-item","data-side":"game-swap",children:[gt("div",{className:"wp-item-body",children:[gt("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"Pool"}),gt("div",{className:"wp-svc-token",children:[gt("span",{className:"wp-token-stack","aria-hidden":!0,children:[b&&st("img",{className:"wp-svc-token-icon",src:b,alt:""}),k&&st("img",{className:"wp-svc-token-icon",src:k,alt:""})]}),st("span",{children:x})]})]}),f.lpAmountRaw!==void 0&&gt("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"My LP"}),gt("span",{children:[mn(f.lpAmountRaw,f.lpDecimals)," LP"]})]}),f.sharePercent!==void 0&&gt("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"Pool Share"}),gt("span",{children:[f.sharePercent.toFormat(2,Tt.ROUND_DOWN),"%"]})]}),f.valueText!==void 0&&gt("div",{className:"wp-item-line",children:[st("span",{className:"wp-item-label",children:"Value"}),st("span",{children:f.valueText})]})]}),st("div",{className:"wp-item-tags",children:gt("a",{className:"wp-tag wp-tag--mint",href:v,target:"_blank",rel:"noopener noreferrer",onClick:E=>Ve(E,v,{category:"portfolio",origin:"portfolio-game-swap",payload:{pool:u}},n),children:[st("span",{className:"wp-tag-label",children:"Manage"}),st(_t,{size:12,className:"wp-tag-icon"})]})})]},u.pair_address)})})}import hr from"bignumber.js";import{useMemo as Mc}from"react";import{useQuery as Lc}from"@tanstack/react-query";var Ec="wp:forge-pools";function Ta(e,t,n=!0){let o=lo[e],r=n&&!!t,{data:a,...i}=Lc({queryKey:[Ec,e,t],queryFn:async()=>{let c=await fetch(`${o}/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:r,staleTime:0}),s=a??[];return{pools:s,isEmpty:s.length===0,...i}}import{useQueries as Ac}from"@tanstack/react-query";import{useMemo as Pc}from"react";var Bc="wp:forge-token-detail";async function Fc(e,t){let n=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return n.ok?(await n.json())?.data?.token??null:null}function Ra(e,t,n=!0){let o=lo[e],r=Ac({queries:t.map(s=>({queryKey:[Bc,e,s],queryFn:()=>Fc(o,s),enabled:n&&!!s,staleTime:3e4}))}),a=Pc(()=>{let s=new Map;for(let c=0;c<r.length;c++){let l=r[c]?.data,d=t[c];l&&d&&s.set(d.toLowerCase(),l)}return s},[r,t]),i=r.some(s=>s.isLoading);return{detailMap:a,isLoading:i}}import{jsx as Qe,jsxs as en}from"react/jsx-runtime";var _c="Forge",Oc=18,zc="https://contents.crosstoken.io/wallet/token/images/FT.png";function Wc(e){if(!e||e==="0")return"0";let t=new hr(e).shiftedBy(-Oc);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,hr.ROUND_DOWN):t.toFormat(4,hr.ROUND_DOWN)}function Dc(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 Ia(){let{env:e,walletAddress:t,onOutlink:n}=at(),o=!!t,{pools:r,isEmpty:a}=Ta(e,t,o),i=Mc(()=>r.map(d=>d.token.address),[r]),{detailMap:s}=Ra(e,i,o&&i.length>0),c=d=>`${ta[e]}/forge/token/${d.token.address}`,l=`${Gt[e]}/forge.png`;return Qe(Ut,{title:_c,icon:l,iconFit:"contain",isEmpty:a,children:r.map(d=>{let m=s.get(d.token.address.toLowerCase()),f=m?.image_url||m?.image||d.token.image||zc,u=m?.symbol||d.token.symbol,v=c(d);return en("a",{className:"wp-item","data-side":"lp",href:v,target:"_blank",rel:"noopener noreferrer",onClick:x=>Ve(x,v,{category:"portfolio",origin:"portfolio-forge",payload:{pool:d,tokenDetail:m}},n),children:[en("div",{className:"wp-item-body",children:[en("div",{className:"wp-item-line",children:[Qe("span",{className:"wp-item-label",children:"Asset"}),en("div",{className:"wp-svc-token",children:[Qe("img",{className:"wp-svc-token-icon",src:f,alt:""}),Qe("span",{children:u}),m?.name&&Qe("span",{className:"wp-token-subtle",children:m.name})]})]}),en("div",{className:"wp-item-line",children:[Qe("span",{className:"wp-item-label",children:"LP Balance"}),Qe("div",{className:"wp-svc-token",children:Qe("span",{children:Wc(d.lp_balance)})})]}),en("div",{className:"wp-item-line",children:[Qe("span",{className:"wp-item-label",children:"Ownership"}),Qe("span",{className:"wp-line-value",children:Dc(d.pool_ownership)})]})]}),Qe("div",{className:"wp-item-tags",children:en("span",{className:"wp-tag wp-tag--muted",children:[Qe("span",{className:"wp-tag-label",children:"Withdraw"}),Qe(_t,{size:12,className:"wp-tag-icon"})]})})]},d.pair_address)})})}O(`.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;top:12px!important;left:max(12px,calc((100vw - 393px)/2))!important;right:max(12px,calc((100vw - 393px)/2))!important;bottom:12px!important;width:auto!important;height:calc(100dvh - 24px)!important;max-height:calc(100dvh - 24px)!important;z-index:50;background:var(--wp-bg);border:1px solid var(--wp-panel-border);border-radius:24px;box-shadow:var(--wp-panel-shadow);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:flex-start;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-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-wallet-name{flex:1;min-width:0;font-family:inherit;font-size:15px;font-weight:600;line-height:160%;letter-spacing:0;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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-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{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{position:relative;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);right:0;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-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-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-svc-empty{display:flex;align-items:center;justify-content:center;min-height:74px;padding:20px 16px;background:var(--wp-card);border-radius:12px;box-shadow:var(--wp-card-shadow, none);font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text-30);box-sizing:border-box}.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}
8
+ `);import{Fragment as Uc,jsx as Z,jsxs as tn}from"react/jsx-runtime";var br=5,Gc="wp:";function hn({env:e,theme:t="light",walletAddress:n,onBack:o,showHeader:r=!0,variant:a="embed",className:i,onOutlink:s,lpBalanceReader:c}){let l=Ne(e),d=!!n,m=Hc(),f=Ze.useId(),u=pa(l),{formattedTotal:v}=la(l,n,d),[,x]=Ze.useState(br),[b,k]=Ze.useState(!1),E=Ze.useCallback(()=>{m.invalidateQueries({predicate:I=>typeof I.queryKey[0]=="string"&&I.queryKey[0].startsWith(Gc)})},[m]),g=Ze.useCallback(()=>{E(),k(!0),setTimeout(()=>k(!1),600),x(br)},[E]);Ze.useEffect(()=>{if(!d)return;let I=setInterval(()=>{x(H=>H<=1?(g(),br):H-1)},1e3);return()=>clearInterval(I)},[d,g]);let B=Ze.useCallback(()=>{o?.()},[o]),R=Ze.useMemo(()=>({env:l,theme:t,open:!0,walletAddress:n,close:B,onOutlink:s,lpBalanceReader:c}),[l,t,n,B,s,c]),F=tn(Uc,{children:[r&&tn("div",{className:"wp-header",children:[Z("div",{className:"wp-header-edge wp-header-edge--left",children:o?Z("button",{type:"button",className:"wp-header-btn","aria-label":"Back",onClick:o,children:Z(Bt,{size:24})}):Z("span",{className:"wp-header-spacer","aria-hidden":!0})}),Z("h2",{className:"wp-header-title",children:"Portfolio"}),Z("div",{className:"wp-header-edge wp-header-edge--right",children:Z("button",{type:"button",className:Q("wp-header-btn",o?void 0:"wp-refresh-btn"),"aria-label":o?"Close portfolio":"Refresh portfolio",onClick:o??g,children:o?Z(da,{}):Z(ca,{className:b?"wp-spin-once":void 0})})})]}),Z("div",{className:"wp-body",children:tn("div",{className:"wp-body-inner",children:[tn("section",{className:"wp-summary-card","aria-label":"Estimated portfolio value",children:[tn("div",{className:"wp-summary-head",children:[Z("span",{className:"wp-summary-label",children:"Total Assets USD (Estimated)"}),u?tn("button",{type:"button",className:"wp-estimate-info","aria-label":"USD estimate details","aria-describedby":f,children:[Z(dr,{}),tn("span",{id:f,role:"tooltip",className:"wp-estimate-tooltip",children:[Z("span",{className:"wp-estimate-tooltip-title",children:"USD estimate includes"}),Z("span",{className:"wp-estimate-tooltip-group",children:ur.included.map(I=>Z("span",{className:"wp-estimate-tooltip-item",children:I},I))}),Z("span",{className:"wp-estimate-tooltip-title",children:"Not included"}),Z("span",{className:"wp-estimate-tooltip-group",children:ur.excluded.map(I=>Z("span",{className:"wp-estimate-tooltip-item",children:I},I))})]})]}):Z("span",{className:"wp-estimate-info","aria-hidden":!0,children:Z(dr,{})})]}),Z("p",{className:"wp-total",children:v})]}),Z(ma,{}),Z(va,{}),Z(Na,{}),Z(Ia,{})]})})]});return Z(Ln.Provider,{value:R,children:a==="none"?F:Z("div",{className:Q(a==="fullscreen"?"wp-fullscreen":"wp-embed",i),"data-theme":t,children:F})})}import{jsx as wr,jsxs as La}from"react/jsx-runtime";function Ea({className:e}){let{env:t,theme:n,walletAddress:o,close:r,onOutlink:a,lpBalanceReader:i}=at();return La(uo.Portal,{children:[wr(uo.Overlay,{className:"wp-overlay"}),La(uo.Content,{className:Q("wp-fullscreen",e),"data-theme":n,children:[wr(uo.Title,{className:"wp-sr-only",children:"Portfolio"}),wr(hn,{env:t,theme:n,walletAddress:o,onBack:r,variant:"none",onOutlink:a,lpBalanceReader:i})]})]})}import{jsx as Aa}from"react/jsx-runtime";function jc({env:e,theme:t="light",walletAddress:n,open:o,onOpenChange:r,onOutlink:a,lpBalanceReader:i,children:s}){let c=Ne(e),l=o!==void 0,[d,m]=nn.useState(!1),f=l?o:d,u=nn.useCallback(b=>{l||m(b),r?.(b)},[l,r]),v=nn.useCallback(()=>u(!1),[u]),x=nn.useMemo(()=>({env:c,theme:t,open:f,walletAddress:n,close:v,onOutlink:a,lpBalanceReader:i}),[c,t,f,n,v,a,i]);return Aa(Ln.Provider,{value:x,children:Aa($c.Root,{direction:"bottom",open:f,onOpenChange:u,noBodyStyles:!0,children:s})})}var Pa=Object.assign(jc,{Trigger:Ji,Content:Ea});import*as S from"react";import{createPortal as bn}from"react-dom";import $t from"bignumber.js";import{jsx as lt,jsxs as Vc}from"react/jsx-runtime";function Ba({size:e=20,className:t}){return Vc("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:[lt("circle",{cx:"9",cy:"9",r:"6",stroke:"currentColor",strokeWidth:1.7}),lt("path",{d:"m17 17-3.2-3.2",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round"})]})}function Fa({size:e=16,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:lt("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 Ma({size:e=16,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:lt("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 _a({size:e=20,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:lt("path",{d:"M10 4.167v11.666M4.167 10 10 15.833 15.833 10",stroke:"currentColor",strokeWidth:1.667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Oa({size:e=16,className:t}){return lt("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:lt("path",{d:"M3.333 8h9.334M8.667 4l4 4-4 4",stroke:"currentColor",strokeWidth:1.333,strokeLinecap:"round",strokeLinejoin:"round"})})}function za({size:e=12,className:t}){return lt("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:lt("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 T from"react";import Ha from"bignumber.js";function Wa(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Da(e){return!e.isFinite()||e.isNaN()||e.lte(0)?"":e.decimalPlaces(6,Ha.ROUND_DOWN).toFixed()}function qc(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 Kc(e){let t=e.fromToken.priceUsd,n=e.toToken.priceUsd,o=e.lastChangedBy==="to"?e.toAmount:e.fromAmount,r=new Ha(o||"0");return!r.isFinite()||r.isNaN()||r.lte(0)?{fromAmount:e.fromAmount,toAmount:e.toAmount}:Wa(t)&&Wa(n)?e.lastChangedBy==="to"?{fromAmount:Da(r.multipliedBy(n).dividedBy(t))}:{toAmount:Da(r.multipliedBy(t).dividedBy(n))}:qc(e)?e.lastChangedBy==="to"?{fromAmount:e.toAmount}:{toAmount:e.fromAmount}:{fromAmount:e.lastChangedBy==="to"?"":e.fromAmount,toAmount:e.lastChangedBy==="from"?"":e.toAmount}}function Ga({getQuote:e,submitBridge:t}){return{canQuote:!!e,canSubmit:!!t,async getQuote(n){return e?e(n):Kc(n)},async submitBridge(n){if(!t)throw new Error("Bridge submit handler is not configured.");return t(n)}}}function ht(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function mo(e){return e[0]}function xr(e,t,n,o){if(n&&!ht(n,t))return n;let r=t?o?.(t,e):void 0;if(r?.length)return r[0];if(!t)return e[1]??mo(e);let a=e.findIndex(s=>ht(s,t)),i=a>=0?e[a+1]:void 0;return i&&!ht(i,t)?i:e.find(s=>!ht(s,t))??t}function Ua({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 $a(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:"",o=e&&typeof e=="object"&&"code"in e?String(e.code):"",r=n.toLowerCase();return o==="4001"||r.includes("user rejected")||r.includes("user denied")||r.includes("rejected the request")||r.includes("request rejected")?"Transaction request was rejected.":n.split(`
9
+ `)[0]?.trim()||t}function ja(e){let{tokens:t,initialFromToken:n,initialToToken:o,getToTokens:r,getApproval:a,approveBridge:i,history:s=[],initialSlippage:c="0.5",termsUrl:l,getQuote:d,submitBridge:m,onSubmitted:f,onSuccess:u,onFailed:v,onExit:x}=e,b=T.useMemo(()=>Ga({getQuote:d,submitBridge:m}),[d,m]),[k,E]=T.useState("form"),[g,B]=T.useState(n??mo(t)),[R,F]=T.useState(()=>xr(t,n??mo(t),o,r)),[I,H]=T.useState(""),[W,Y]=T.useState(""),[$,z]=T.useState("from"),[ce,ue]=T.useState(c),[ie,ae]=T.useState(null),[Fe,te]=T.useState(""),[G,J]=T.useState("idle"),[we,X]=T.useState(""),[Me,_e]=T.useState(null),[xe,ke]=T.useState([]),[bt,de]=T.useState(!1),[Lt,Ye]=T.useState(!1),[Xe,Se]=T.useState(null),[Le,me]=T.useState(!1),[re,ge]=T.useState(null),[Et,Je]=T.useState(null),[wt,he]=T.useState(!1),[Oe,xt]=T.useState(!1),Ee=T.useRef(0),et=T.useRef(null),tt=T.useCallback(()=>{et.current&&(clearTimeout(et.current),et.current=null)},[]),ze=T.useCallback(M=>{tt(),Je(M)},[tt]);T.useEffect(()=>tt,[tt]),T.useEffect(()=>{let M=t.find(se=>ht(se,g))??mo(t),ne=M?r?.(M,t):void 0,_=ne?.find(se=>ht(se,R))??(ne?void 0:t.find(se=>ht(se,R)))??xr(t,M,void 0,r);B(M),F(_)},[r,t,g,R]);let pe=T.useCallback((M,ne)=>{let _=M.replace(/[^\d.]/g,"");ne==="from"?H(_):Y(_),z(ne),te("")},[]),We=T.useCallback(()=>{Ee.current+=1,H(""),Y(""),z("from"),ae(null),te(""),X(""),J("idle"),Se(null),me(!1),ge(null),he(!1),ze(null)},[ze]),dt=T.useCallback(M=>{ht(M,g)||(B(M),F(xr(t,M,void 0,r)),We())},[g,r,We,t]),vt=T.useCallback(M=>{ht(M,R)||ht(M,g)||(F(M),We())},[g,We,R]),De=T.useMemo(()=>g?r?.(g,t)??t.filter(M=>!ht(M,g)):[],[g,r,t]),At=T.useCallback(()=>{g?.balance&&pe(g.balance,"from")},[g?.balance,pe]),Pt=T.useCallback(()=>{!g||!R||(B(R),F(g),H(W),Y(I),z($==="from"?"to":"from"),te(""))},[I,g,$,W,R]),nt=T.useCallback(()=>{Ee.current+=1,H(""),Y(""),z("from"),ae(null),te(""),X("")},[]);T.useEffect(()=>{if(!g||!R)return;if(!I&&!W){ae(null),te(""),J("idle");return}let M=++Ee.current,ne=Ua({fromToken:g,toToken:R,fromAmount:I,toAmount:W,lastChangedBy:$,slippage:ce});J(b.canQuote?"quoting":"idle"),(async()=>{try{let _=await b.getQuote(ne);if(Ee.current!==M)return;_.fromAmount!==void 0&&$==="to"&&H(_.fromAmount),_.toAmount!==void 0&&$==="from"&&Y(_.toAmount),ae(_.summary??null),te(_.error??"")}catch(_){if(Ee.current!==M)return;te(_ instanceof Error?_.message:"Failed to quote bridge.")}finally{Ee.current===M&&J("idle")}})()},[I,g,$,b,ce,W,R]);let yt=T.useCallback(()=>!g||!R?null:Ua({fromToken:g,toToken:R,fromAmount:I,toAmount:W,lastChangedBy:$,slippage:ce}),[I,g,$,ce,W,R]),Ae=T.useCallback(async(M,ne)=>{X(""),he(!1),me(!1),J("submitting");try{if(!ne?.skipApprovalCheck&&a){let se=await a(M);if(se){Se(se),ge(M),J("idle");return}}Se(null),ge(null),ze("processing");let _=await b.submitBridge(M);_e(_),J("success"),ke(se=>[{id:_.txHash,timestamp:new Date().toISOString(),txHash:_.txHash,fromToken:_.fromToken,toToken:_.toToken,fromAmount:_.fromAmount,toAmount:_.toAmount,summary:ie??void 0,status:"pending"},...se.filter(zt=>zt.txHash!==_.txHash)]),nt(),xt(!0),ze(null),he(!0),f?.(_),u?.(_)}catch(_){let se=$a(_,"Failed to submit bridge.");ze(null),X(se),J("error"),v?.({message:se})}},[a,v,f,u,b,nt,ze,ie]),pt=T.useCallback(async()=>{if(Fe)return;let M=yt();if(M){if(!Lt){ge(M),de(!0);return}await Ae(M)}},[yt,Fe,Ae,Lt]),N=T.useCallback(async()=>{let M=re??yt();M&&(Ye(!0),de(!1),await Ae(M))},[yt,re,Ae]),j=T.useCallback(()=>{de(!1),ge(null)},[]),ee=T.useCallback(async()=>{if(!(G==="submitting"||!Xe||!re||!i)){X(""),J("submitting");try{await i(re,Xe),Se(null),J("idle"),me(!0)}catch(M){let ne=$a(M,"Failed to approve token.");X(ne),J("error"),v?.({message:ne})}}},[Xe,i,v,re,Ae,G]),He=T.useCallback(()=>{G!=="submitting"&&(Se(null),me(!1),ge(null),J("idle"))},[G]),Ge=T.useCallback(async()=>{G==="submitting"||!re||(me(!1),await Ae(re,{skipApprovalCheck:!0}))},[re,Ae,G]),Ot=T.useCallback(()=>{he(!1)},[]),vn=T.useCallback(M=>{E(M),M==="history"&&xt(!1)},[]),Eo=T.useCallback(()=>{if(k==="history"){vn("form");return}x?.()},[x,vn,k]),ot=T.useMemo(()=>[...s,...xe.filter(M=>!s.some(ne=>ne.txHash===M.txHash))],[s,xe]);return{step:k,setStep:vn,status:G,error:we,quoteError:Fe,fromToken:g,toToken:R,tokens:t,availableToTokens:De,fromAmount:I,toAmount:W,lastChangedBy:$,slippage:ce,setSlippage:ue,summary:ie,history:ot,submitted:Me,canSubmit:b.canSubmit,termsOpen:bt,approvalInfo:Xe,approvalSuccessOpen:Le,approveBridge:i,pendingSubmitInput:re,submitToast:Et,successDialogOpen:wt,dismissSuccessDialog:Ot,hasNewHistory:Oe,termsUrl:l,setFromToken:B,setToToken:F,selectFromToken:dt,selectToToken:vt,setAmount:pe,setMax:At,swapTokens:Pt,submit:pt,confirmTerms:N,cancelTerms:j,confirmApproval:ee,cancelApproval:He,continueAfterApproval:Ge,back:Eo}}O(`.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{color:var(--bf-text-high);background:var(--bf-surface-hover)}.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-max-btn{padding:0;border:0;background:transparent;color:var(--bf-text-medium);font:inherit;font-size:12px;text-decoration:underline;cursor:pointer}.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{color:var(--bf-text-low);font-size:12px;font-weight:500;line-height:1.5;letter-spacing:-.01em}.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){background:var(--bf-surface-hover)}.bf-token-pill:disabled{cursor:default;opacity:.6}.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:min(316px,calc(100dvh - 48px));max-height:calc(100dvh - 48px);min-height:0;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-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:minmax(0,1fr) auto;align-items:center;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;cursor:pointer;touch-action:manipulation;user-select:none}.bf-terms-check-button{appearance:none;display:grid;min-width:0;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:12px;padding:0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;touch-action:manipulation}.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:var(--ds-content-inverted, #ffffff);font-size:14px;font-weight:600;line-height:1.5;letter-spacing:-.01em}.bf-status-toast-copy span{color:var(--ds-content-inverted, #ffffff);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:last-child[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-liquidity-value{color:var(--bf-text-low);font-size:12px}.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 yr,jsx as p,jsxs as y}from"react/jsx-runtime";var Ya=S.createContext(void 0);function wn(){return S.useContext(Ya)}function Qc(e){let[t,n]=S.useState(void 0);return S.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 Va=[{value:"auto",label:"Auto"},{value:"0.1",label:"0.1%"},{value:"0.5",label:"0.5%"},{value:"1",label:"1%"}],Zc={dev:"https://dev.crossdefi.io",stage:"https://stg.crossdefi.io",production:"https://crossdefi.io"},Yc=[{value:"all",label:"ALL"},{value:"completed",label:"Completed"},{value:"pending",label:"Pending"}];function Xc(e){return e==="auto"?"Auto":e?`${e}%`:"0.5%"}function qa(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 Jc(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Xa(e){let t=Number(e);return Number.isFinite(t)?t.toLocaleString("en-US",{maximumFractionDigits:t>=1?2:6}):e||"0"}function Ka(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 ed(e){if(e.priceUsd===void 0)return null;let t=new $t(e.balance||"0");return t.isFinite()?`\u2248 $${t.multipliedBy(e.priceUsd).toFormat(2)} USD`:null}function td(e){if(e.priceUsd===void 0)return null;let t=new $t(e.priceUsd);return t.isFinite()?`$${t.toFormat(t.isLessThan(1)?4:2)}`:null}function Ja(e){if(!e.isFinite()||e.isNaN())return"0";let n=e.decimalPlaces(6,$t.ROUND_DOWN).toFixed(6).replace(/\.?0+$/,""),[o="0",r]=n.split("."),a=new $t(o||"0").toFormat(0);return r?`${a}.${r}`:a}function nd(e){return e.length<=14?e:`${e.slice(0,6)}...${e.slice(-6)}`}function od(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 rd(e){let t=new $t(e||"0");return!t.isFinite()||t.isNaN()?e||"0":Ja(t)}function id(e,t){if(t?.priceUsd===void 0)return null;let n=new $t(e||"0").multipliedBy(t.priceUsd);return!n.isFinite()||n.isNaN()?null:`$${n.toFormat(2)}`}function ho(e){return e.status==="success"?"completed":e.status==="failed"?"failed":"pending"}function ad(e,t){return t==="all"?!0:ho(e)===t}function sd(e){return e==="completed"?"Completed":e==="failed"?"Failed":"Pending"}function Qa(e){return e===56||e===97?"BSC":e===612044||e===5555?"CROSS":`Chain ${e}`}function es(e,t){return!!e&&!!t&&e.chainId===t.chainId&&e.address.toLowerCase()===t.address.toLowerCase()}function ts(e,t){if(!(!e||!t))return e.chainId===t.chainId?"swap":es(e,t)||e.symbol.toLowerCase()===t.symbol.toLowerCase()?"bridge":"swap-bridge"}function ns(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function go(e){return!e||e==="0"||Number(e)===0}function ld(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")?{from:e}:t.includes("insufficient liquidity")||t.includes("not enough liquidity")?{to:e}:{}:{}}function cd(e){let t=e.fromToken,n=e.toToken,o=ts(t,n),r=e.fromAmount||"0",a=e.toAmount||"0",i=o!==void 0&&!ns(o),s=o!==void 0&&o!=="bridge";return{pathType:o,bridgeInfo:i?[{label:"Route",value:t&&n?`${Qa(t.chainId)} \u2192 ${Qa(n.chainId)}`:"-"},{label:"Validator Fee",value:go(r)?"0":"Free",tone:go(r)?"default":"accent"},{label:"Network Fee",value:go(r)?"0":"Free",tone:go(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 Pn({token:e,size:t=20}){let n=e?.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":!!n?"true":"false",style:{width:t,height:t},children:n?p("img",{src:n,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e?.symbol?.slice(0,1)??"?"})})}function Za({label:e,token:t,amount:n,usd:o,onAmountChange:r,onTokenClick:a,onMax:i}){return y("section",{className:"bf-amount-panel",children:[y("div",{className:"bf-amount-head",children:[p("span",{children:e}),y("span",{className:"bf-balance",children:[Xa(t?.balance??"0")," ",t?.symbol??"",i&&p("button",{type:"button",className:"bf-max-btn",onClick:i,children:"MAX"})]})]}),y("div",{className:"bf-amount-main",children:[y("label",{className:"bf-amount-input-wrap",children:[y("span",{className:"bf-sr-only",children:[e," amount"]}),p("input",{type:"text",inputMode:"decimal",value:n,onChange:s=>r(s.target.value),placeholder:"0",className:"bf-amount-input"}),p("span",{className:"bf-amount-usd",children:o})]}),y("button",{type:"button",className:"bf-token-pill",onClick:a,disabled:!a,"aria-label":`Select ${e.toLowerCase()} token`,children:[p(Pn,{token:t}),p("span",{children:t?.symbol??"Select"}),p(Qt,{size:16})]})]})]})}function dd({flow:e,side:t,onClose:n}){let o=S.useId(),[r,a]=S.useState(""),[i,s]=S.useState(null),c=t==="from"?e.fromToken:e.toToken;S.useEffect(()=>{s(document.body)},[]),S.useEffect(()=>{let u=v=>{v.key==="Escape"&&n()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let l=S.useMemo(()=>t==="from"?e.tokens:e.availableToTokens,[e.availableToTokens,e.tokens,t]),d=S.useMemo(()=>{let u=r.trim().toLowerCase();return u?l.filter(v=>v.symbol.toLowerCase().includes(u)||v.name.toLowerCase().includes(u)):l},[r,l]),m=S.useCallback(u=>{t==="from"?e.selectFromToken(u):e.selectToToken(u),n()},[e,n,t]);if(!i)return null;let f=wn();return bn(p("div",{className:"bf-token-picker-overlay","data-theme":f,role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&n()},children:y("section",{className:"bf-token-picker",role:"dialog","aria-modal":"true","aria-labelledby":o,children:[p("span",{className:"bf-token-picker-handle","aria-hidden":"true"}),y("header",{className:"bf-token-picker-head",children:[p("h3",{id:o,children:"Select a token"}),p("button",{type:"button",className:"bf-token-picker-close",onClick:n,"aria-label":"Close token selector",children:p(kt,{size:24})})]}),y("label",{className:"bf-token-search",children:[p(Ba,{size:20}),p("span",{className:"bf-sr-only",children:"Search tokens"}),p("input",{value:r,onChange:u=>a(u.target.value),placeholder:"Search Tokens",autoComplete:"off",spellCheck:!1})]}),y("div",{className:"bf-token-list",children:[d.map(u=>{let v=es(u,c),x=v?td(u):ed(u);return y("button",{type:"button",className:"bf-token-row","data-selected":v?"true":"false",onClick:()=>m(u),children:[y("span",{className:"bf-token-row-left",children:[p(Pn,{token:u,size:40}),y("span",{className:"bf-token-meta",children:[p("span",{className:"bf-token-symbol",children:u.symbol}),!v&&p("span",{className:"bf-token-name",children:u.name})]})]}),y("span",{className:"bf-token-row-right",children:[y("span",{className:"bf-token-balance",children:[Xa(u.balance),v?null:` ${u.symbol}`]}),x&&p("span",{className:"bf-token-price",children:x})]})]},Jc(u))}),d.length===0&&p("div",{className:"bf-token-empty",children:"No tokens found"})]})]})}),i)}function pd({flow:e,onClose:t}){let n=S.useId(),[o,r]=S.useState(null),a=Va.find(f=>f.value===e.slippage),[i,s]=S.useState(e.slippage&&!a?e.slippage:""),c=i.trim()!==""&&i.trim()!==".",l=f=>{e.setSlippage(f),t()},d=()=>{c&&(e.setSlippage(qa(i)),t())};if(S.useEffect(()=>{r(document.body)},[]),S.useEffect(()=>{let f=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[t]),!o)return null;let m=wn();return bn(p("div",{className:"bf-slippage-overlay","data-theme":m,role:"presentation",onMouseDown:f=>{f.target===f.currentTarget&&t()},children:y("section",{className:"bf-slippage-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[y("header",{className:"bf-slippage-head",children:[p("h3",{id:n,children:"Slippage Settings"}),p("button",{type:"button",className:"bf-slippage-close",onClick:t,"aria-label":"Close slippage settings",children:p(kt,{size:24})})]}),y("div",{className:"bf-slippage-body",children:[p("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."}),y("div",{className:"bf-slippage-controls",children:[p("div",{className:"bf-slippage-presets",children:Va.map(f=>p("button",{type:"button",className:"bf-slippage-preset","data-selected":!c&&e.slippage===f.value?"true":"false",onClick:()=>l(f.value),children:f.label},f.value))}),y("label",{className:"bf-slippage-custom","data-selected":c?"true":"false",children:[p("span",{className:"bf-sr-only",children:"Custom slippage percent"}),p("input",{value:i,onChange:f=>{s(qa(f.target.value))},onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),d())},inputMode:"decimal",placeholder:"Enter custom slippage",autoComplete:"off",spellCheck:!1}),p("span",{"aria-hidden":"true",children:"%"})]})]}),c&&p("button",{type:"button",className:"bf-slippage-apply",onClick:d,children:"Apply"})]})]})}),o)}function fd({flow:e}){let t=S.useId(),[n,o]=S.useState(!1),[r,a]=S.useState(null),i=wn();return S.useEffect(()=>{a(document.body)},[]),S.useEffect(()=>{let s=c=>{c.key==="Escape"&&e.cancelTerms()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),!r||!e.termsOpen?null:bn(p("div",{className:"bf-action-modal-overlay","data-theme":i,role:"presentation",onPointerDown:s=>{s.target===s.currentTarget&&e.cancelTerms()},children:y("section",{className:"bf-action-modal bf-terms-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Agree to Terms of Service"}),p("p",{className:"bf-action-modal-desc",children:"Please make sure to review the Terms of Service before using CROSSD."}),y("div",{className:"bf-terms-check-row","data-checked":n?"true":"false",children:[y("button",{type:"button",className:"bf-terms-check-button",role:"checkbox","aria-checked":n,onClick:()=>o(s=>!s),children:[p("span",{className:"bf-terms-checkbox","data-checked":n?"true":"false","aria-hidden":"true"}),p("span",{children:"Agree to Terms of Use"})]}),e.termsUrl&&p("a",{href:e.termsUrl,target:"_blank",rel:"noreferrer",children:"Terms of Service"})]}),p("p",{className:"bf-terms-privacy",children:"I have read and acknowledged the Privacy Policy to use CROSSD"}),p("button",{type:"button",className:"bf-action-primary",disabled:!n||e.status==="submitting",onClick:e.confirmTerms,children:"Confirm"})]})}),r)}function ud({value:e,disabled:t=!1}){let[n,o]=S.useState(!1);return p("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 md({flow:e,approval:t}){let n=S.useId(),[o,r]=S.useState(null),a=wn();if(S.useEffect(()=>{r(document.body)},[]),S.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 bn(p("div",{className:"bf-action-modal-overlay","data-theme":a,role:"presentation",children:y("section",{className:"bf-action-modal bf-approve-modal",role:"dialog","aria-modal":"true","aria-labelledby":n,children:[y("h3",{id:n,children:["Approve ",t.token.symbol]}),p(Pn,{token:t.token,size:72}),y("div",{className:"bf-approve-address-box",children:[p("span",{children:"Token Address"}),y("div",{children:[p("strong",{children:t.tokenAddress}),p(ud,{value:t.tokenAddress,disabled:s})]})]}),y("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,disabled:e.status==="submitting",children:"Cancel"}),y("button",{type:"button",className:"bf-action-primary",onClick:e.confirmApproval,disabled:i,"aria-busy":s,children:[s&&p("span",{className:"bf-action-button-spinner","aria-hidden":"true"}),p("span",{children:s?"Approving...":"Approve"})]})]})]})}),o)}function gd({flow:e}){let t=S.useId(),[n,o]=S.useState(null),r=wn();return S.useEffect(()=>{o(document.body)},[]),S.useEffect(()=>{if(!e.approvalSuccessOpen)return;let a=i=>{i.key==="Escape"&&e.cancelApproval()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e]),!n||!e.approvalSuccessOpen?null:bn(p("div",{className:"bf-action-modal-overlay","data-theme":r,role:"presentation",children:y("section",{className:"bf-action-modal bf-approval-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:[p("h3",{id:t,children:"Approval Success"}),p("span",{className:"bf-success-mark","aria-hidden":"true"}),y("p",{className:"bf-action-modal-desc",children:["Token approval confirmed successfully.",p("br",{}),"Please continue to the next step."]}),y("div",{className:"bf-action-buttons",children:[p("button",{type:"button",className:"bf-action-secondary",onClick:e.cancelApproval,children:"Cancel"}),p("button",{type:"button",className:"bf-action-primary",onClick:e.continueAfterApproval,children:"Continue"})]})]})}),n)}function hd({fromAmount:e,toAmount:t,fromToken:n,toToken:o}){let[r,a]=S.useState(!1),i=S.useMemo(()=>{let l=new $t(e||"0"),d=new $t(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)return null;let s=r?o.symbol:n.symbol,c=r?n.symbol:o.symbol;return y("button",{type:"button",className:"bf-exchange-rate",onClick:()=>a(l=>!l),children:[y("span",{children:["1 ",s]}),p(za,{size:12}),y("span",{children:[Ja(i)," ",c]})]})}function bd({flow:e}){return e.submitToast?y("div",{className:"bf-status-toast","data-variant":"processing",role:"status","aria-live":"polite",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-spinner"})}),y("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Transaction Processing"}),p("span",{children:"Your transaction is being processed on the blockchain"})]})]}):null}function wd({message:e}){let[t,n]=S.useState(!1);return S.useEffect(()=>{if(!e){n(!1);return}n(!0);let o=window.setTimeout(()=>{n(!1)},3500);return()=>window.clearTimeout(o)},[e]),!e||!t?null:y("div",{className:"bf-status-toast","data-variant":"error",role:"alert","aria-live":"assertive",children:[p("span",{className:"bf-status-toast-icon","aria-hidden":"true",children:p("span",{className:"bf-status-error-mark",children:"!"})}),y("span",{className:"bf-status-toast-copy",children:[p("strong",{children:"Error"}),p("span",{children:e})]})]})}function xd(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 vd({flow:e}){let t=S.useId(),[n,o]=S.useState(null),r=e.submitted,a=wn();return S.useEffect(()=>{o(document.body)},[]),S.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:bn(p("div",{className:"bf-success-overlay","data-theme":a,role:"presentation",children:p("section",{className:"bf-success-modal",role:"dialog","aria-modal":"true","aria-labelledby":t,children:y("div",{className:"bf-success-body",children:[p("span",{className:"bf-success-mark","aria-hidden":"true"}),y("div",{className:"bf-success-copy",children:[p("strong",{id:t,children:xd(r.pathType)}),p("span",{children:"Please check the results in the history."})]}),p("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)=>y(S.Fragment,{children:[s>0&&p("span",{className:"bf-success-route-arrow",children:"\u2192"}),p(vr,{token:i,size:43})]},`${i.symbol}-${s}`))}),p("button",{type:"button",className:"bf-success-ok",onClick:e.dismissSuccessDialog,children:"OK"})]})})}),n)}function vr({token:e,size:t=16}){let n=!!e.iconUrl;return p("span",{className:"bf-token-icon","data-has-image":n?"true":"false",style:{width:t,height:t},children:e.iconUrl?p("img",{src:e.iconUrl,alt:"",width:t,height:t,draggable:!1}):p("span",{className:"bf-token-fallback",children:e.symbol?.slice(0,1)??"?"})})}function yd({row:e}){return e.routeTokens&&e.routeTokens.length>0?p("span",{className:"bf-info-route",children:e.routeTokens.map((t,n)=>y(S.Fragment,{children:[n>0&&p("span",{className:"bf-info-route-arrow","aria-hidden":"true",children:"\u2192"}),p(vr,{token:t})]},`${t.symbol}-${n}`))}):e.valueToken?y("span",{className:"bf-info-value-token",children:[p(vr,{token:e.valueToken}),p("span",{children:e.value})]}):p(yr,{children:e.value})}function os({rows:e}){return!e||e.length===0?null:p("div",{className:"bf-info-rows",children:e.map((t,n)=>y("div",{className:"bf-info-row",children:[y("span",{className:"bf-info-label",children:[p("span",{className:"bf-tree-marker",children:n===e.length-1?"\u2514":"\u251C"}),p("span",{children:t.label})]}),p("span",{className:"bf-info-value","data-tone":t.tone??"default",children:p(yd,{row:t})})]},`${t.label}-${t.value}`))})}function kd(e,t,n){return e.pathType==="bridge"?"Bridge Info":ns(e.pathType)?"Swap Info":t&&n?"Swap & Bridge Info":t?"Bridge Info":"Swap Info"}function Sd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=t&&n,r=e.pathType==="bridge-swap"?["bridge","swap"]:["swap","bridge"];return p(yr,{children:r.map(a=>{let i=a==="swap"?e.swapInfo:e.bridgeInfo;return i?.length?y("div",{className:"bf-info-section",children:[o&&p("h4",{children:a==="swap"?"Swap Info":"Bridge Info"}),p(os,{rows:i})]},a):null})})}function Cd({summary:e}){let t=!!e.bridgeInfo?.length,n=!!e.swapInfo?.length,o=!!e.txFee?.length,r=kd(e,t,n),[a,i]=S.useState(!0),[s,c]=S.useState(!0);return y("div",{className:"bf-details",children:[e.liquidity&&y("section",{className:"bf-liquidity",children:[y("div",{className:"bf-liquidity-head",children:[p("span",{children:e.liquidity.label??"Available Liquidity"}),p("span",{className:"bf-liquidity-status","data-status":e.liquidity.status,children:e.liquidity.status??"Normal"})]}),p("div",{className:"bf-liquidity-track",children:p("span",{style:{width:`${e.liquidity.percentage??50}%`}})}),p("span",{className:"bf-liquidity-value",children:e.liquidity.value})]}),(t||n)&&y("section",{className:"bf-detail-section bf-info-card","data-open":a?"true":"false",children:[y("button",{type:"button",className:"bf-collapse-head","aria-expanded":a,onClick:()=>i(l=>!l),children:[p("h3",{children:r}),p(Qt,{size:16,className:"bf-collapse-chevron"})]}),a&&p("div",{className:"bf-collapse-body",children:p(Sd,{summary:e})})]}),o&&y("section",{className:"bf-detail-section bf-tx-fee-section","data-open":s?"true":"false",children:[y("button",{type:"button",className:"bf-collapse-head bf-tx-fee-head","aria-expanded":s,onClick:()=>c(l=>!l),children:[p("h3",{children:"Est. Tx Fee"}),y("div",{className:"bf-tx-fee-total",children:[e.txFeeInfo?.isDelegateFee&&p("span",{className:"bf-fee-delegated",children:"Fee Delegated"}),e.txFeeInfo?.tokenIconUrl&&p("img",{className:"bf-tx-fee-token",src:e.txFeeInfo.tokenIconUrl,alt:e.txFeeInfo.tokenSymbol??"",width:16,height:16,draggable:!1}),p("span",{"data-delegated":e.txFeeInfo?.isDelegateFee||void 0,children:e.txFeeInfo?.estTxFee??"0"}),p(Qt,{size:16,className:"bf-collapse-chevron"})]})]}),s&&p("div",{className:"bf-collapse-body",children:p(os,{rows:e.txFee})})]})]})}function Nd({item:e}){let t=ho(e),n=id(e.fromAmount,e.fromToken);return y("article",{className:"bf-history-item",children:[y("div",{className:"bf-history-item-head",children:[p("span",{className:"bf-history-status","data-status":t,children:sd(t)}),p("time",{className:"bf-history-time",dateTime:e.timestamp,children:od(e.timestamp)})]}),y("div",{className:"bf-history-item-body",children:[y("strong",{className:"bf-history-amount",children:[rd(e.fromAmount)," ",e.fromToken.symbol]}),y("div",{className:"bf-history-meta",children:[p("span",{className:"bf-history-usd",children:n??nd(e.txHash)}),y("span",{className:"bf-history-route",children:[y("span",{className:"bf-history-route-token",children:[p(Pn,{token:e.fromToken,size:16}),p("span",{children:e.fromToken.symbol})]}),p(Oa,{size:16,className:"bf-history-route-arrow"}),y("span",{className:"bf-history-route-token",children:[p(Pn,{token:e.toToken,size:16}),p("span",{children:e.toToken.symbol})]})]})]})]})]})}function Td({flow:e}){let[t,n]=S.useState("all"),o=e.history.some(i=>ho(i)==="pending"),r=e.history.filter(i=>ad(i,t)),a=t==="all"?"No bridge history yet.":`No ${t} bridge history.`;return y("main",{className:"bf-history-body",children:[p("nav",{className:"bf-history-tabs","aria-label":"Bridge history filters",children:Yc.map(i=>y("button",{type:"button",className:"bf-history-tab","data-active":t===i.value?"true":"false",onClick:()=>n(i.value),children:[p("span",{children:i.label}),i.value==="pending"&&o&&p("span",{className:"bf-history-tab-dot","aria-hidden":"true"})]},i.value))}),r.length>0?p("div",{className:"bf-history-list",children:r.map(i=>p(Nd,{item:i},i.id||i.txHash))}):p("div",{className:"bf-empty",children:a})]})}function Rd({flow:e,env:t}){let[n,o]=S.useState(null),[r,a]=S.useState(!1),[i,s]=S.useState(0),l=!!(e.fromAmount.trim()||e.toAmount.trim())?e.summary??cd(e):null,d=Zc[t],m=ld(e.quoteError),f=e.quoteError&&!m.from&&!m.to?e.quoteError:"",u=e.error||f,v=e.history.some(k=>ho(k)==="pending"),b=(l?.pathType??ts(e.fromToken,e.toToken))!=="bridge";return y(yr,{children:[y("main",{className:"bf-body",children:[y("div",{className:"bf-toolbar",children:[y("button",{type:"button",className:"bf-chip bf-chip-history",onClick:()=>e.setStep("history"),children:[p(Fa,{}),p("span",{children:"History"}),(v||e.hasNewHistory)&&p("span",{className:"bf-chip-dot","aria-hidden":"true"})]}),b&&y("button",{type:"button",className:"bf-chip",onClick:()=>a(!0),"aria-haspopup":"dialog","aria-expanded":r,children:[p(Ma,{}),p("span",{children:Xc(e.slippage)})]})]}),y("div",{className:"bf-swap-card","data-has-from-error":m.from?"true":"false",children:[p(Za,{label:"From",token:e.fromToken,amount:e.fromAmount,usd:Ka(e.fromAmount,e.fromToken),onAmountChange:k=>e.setAmount(k,"from"),onTokenClick:()=>o("from"),onMax:e.setMax}),m.from&&p("div",{className:"bf-field-error",children:m.from}),p("button",{type:"button",className:"bf-swap-toggle",onClick:()=>{e.swapTokens(),s(k=>k+360)},style:{transform:`translateX(-50%) rotate(${i}deg)`,transition:"transform 0.2s ease"},children:p(_a,{size:22})}),p(Za,{label:"To",token:e.toToken,amount:e.toAmount,usd:Ka(e.toAmount,e.toToken),onAmountChange:k=>e.setAmount(k,"to"),onTokenClick:()=>o("to")}),m.to&&p("div",{className:"bf-field-error",children:m.to})]}),p(hd,{fromAmount:e.fromAmount,toAmount:e.toAmount,fromToken:e.fromToken,toToken:e.toToken}),l&&p(Cd,{summary:l})]}),y("footer",{className:"bf-footer",children:[p("button",{type:"button",className:"bf-next",onClick:e.submit,disabled:e.status==="submitting"||!!e.quoteError,children:e.status==="submitting"?"Processing...":"Next"}),y("a",{className:"bf-powered",href:d,target:"_blank",rel:"noreferrer",children:["Powered by ",p("span",{className:"bf-powered-brand",children:"CROSS DeFi"})]})]}),n&&p(dd,{flow:e,side:n,onClose:()=>o(null)}),r&&p(pd,{flow:e,onClose:()=>a(!1)}),p(fd,{flow:e}),e.approvalInfo&&p(md,{flow:e,approval:e.approvalInfo}),p(gd,{flow:e}),p(bd,{flow:e}),p(wd,{message:e.submitToast?"":u}),p(vd,{flow:e})]})}function bo({onClose:e,onBackToWallet:t,env:n,className:o,...r}){let a=S.useMemo(()=>Ne(n),[n]),i=ja({...r,onExit:t}),s=S.useRef(null),c=Qc(s),l=i.step==="history"?"History":"Swap & Bridge";return p(Ya.Provider,{value:c,children:y("div",{ref:s,className:Q("bf-root",o),"data-view":i.step,"data-status":i.status,children:[y("header",{className:"bf-header",children:[p("button",{type:"button",className:"bf-header-btn",onClick:i.back,"aria-label":"Back",children:p(Bt,{size:24})}),p("span",{className:"bf-header-title",children:l}),p("button",{type:"button",className:"bf-header-btn",onClick:e,"aria-label":"Close",children:p(kt,{size:24})})]}),i.step==="history"?p(Td,{flow:i}):p(Rd,{flow:i,env:a})]})})}import{Fragment as xo,jsx as h,jsxs as C}from"react/jsx-runtime";function kr(e,t,n){let o=Pe[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 Ld(e){return parseInt(e.split(":")[1],10)}function Ed(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Ad(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 rs({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:m,showGameToken:f,showQR:u,showBridge:v,qrLogoSrc:x,walletAddress:b,accountName:k,sendAccounts:E,profileImageUrl:g,preferredTokens:B,close:R,onSelectWallet:F,onCopyAddress:I,onBuy:H,onDisconnect:W,disconnectLabel:Y,termsUrl:$,termsLabel:z,privacyUrl:ce,privacyLabel:ue,portalStyle:ie,navContent:ae,navPosition:Fe,footerContent:te,view:G,setView:J,selectedSendToken:we,setSelectedSendToken:X,showPortfolio:Me,portfolioTitle:_e,showTotalAssets:xe,totalAssetsLabel:ke,sendTransaction:bt,getTransactionReceipt:de,estimateGas:Lt,onOutlink:Ye,lpBalanceReader:Xe,bridgeTokens:Se,bridgeHistory:Le,getBridgeQuote:me,getBridgeToTokens:re,getBridgeApproval:ge,approveBridge:Et,submitBridge:Je,onReceive:wt,onBridge:he,onSend:Oe,onBuyDisabledMessage:xt}=Wt(),[Ee,et]=P.useState(null),tt=P.useRef(void 0),ze=P.useCallback(w=>{et(w),clearTimeout(tt.current),tt.current=setTimeout(()=>et(null),4e3)},[]);P.useEffect(()=>()=>clearTimeout(tt.current),[]);let pe=!!xt,We=P.useCallback(()=>{if(pe){ze(xt);return}H?.()},[pe,xt,H,ze]),{tokens:dt,isLoading:vt}=pn(r,b,s&&d),{statsMap:De}=fn(r,d),{categoryMap:At}=Zi(r,d),Pt=d&&xe,{displayValue:nt,isLowerBound:yt,isLoading:Ae}=Yi(r,b,s&&Pt),[pt,N]=P.useState(!1),j=P.useRef(null),[ee,He]=P.useState(0),{holdings:Ge,isLoading:Ot}=Ki(r,b,s&&d&&m),vn=P.useMemo(()=>Ge.map(w=>w.token),[Ge]),{imageMap:Eo}=Qi(r,vn,m&&Ge.length>0),ot=P.useMemo(()=>{let w=[],L=[],V=[],Ce=new Map((B??[]).map((K,fe)=>[`${Ld(K.chainId)}:${K.address.toLowerCase()}`,fe]));for(let K of dt){let fe=kr(r,K.chainId,K.symbol)!==void 0,Vt=`${K.chainId}:${K.address.toLowerCase()}`,qt=Ce.get(Vt),zo=new Bn(K.quantity.numeric).shiftedBy(-K.quantity.decimals);if(fe)w.push(K);else if(qt!==void 0)L.push(K);else if(zo.isGreaterThan(0)){if(!f&&At.get(sr(K.chainId,K.address))==="game")continue;V.push(K)}}return w.sort((K,fe)=>{let Vt=kr(r,K.chainId,K.symbol)??99,qt=kr(r,fe.chainId,fe.symbol)??99;return Vt-qt}),L.sort((K,fe)=>{let Vt=Ce.get(`${K.chainId}:${K.address.toLowerCase()}`)??99,qt=Ce.get(`${fe.chainId}:${fe.address.toLowerCase()}`)??99;return Vt-qt}),V.sort((K,fe)=>{let Vt=De.get(Ft(K.chainId,K.address)),qt=De.get(Ft(fe.chainId,fe.address)),zo=new Bn(K.quantity.numeric).shiftedBy(-K.quantity.decimals).multipliedBy(Vt?.price??0);return new Bn(fe.quantity.numeric).shiftedBy(-fe.quantity.decimals).multipliedBy(qt?.price??0).minus(zo).toNumber()}),[...w,...L,...V]},[dt,r,De,f,At,B]),M=P.useMemo(()=>{if(!m)return[];let w=new Set(dt.map(L=>L.address.toLowerCase()));return[...Ge].filter(L=>!w.has(L.token.toLowerCase())).sort((L,V)=>{let Ce=new Bn(L.value);return new Bn(V.value).minus(Ce).toNumber()})},[Ge,m,dt]),ne=P.useRef(!1),[_,se]=P.useState(null),zt=P.useRef(void 0),Ir=_?.chainId??we?.chainId??ot[0]?.chainId??0,{transactionUrl:Ao}=Qn(r,Ir,_?.txHash,!!(_?.txHash&&Ir)),Ue=P.useCallback(w=>{ne.current=!0,J(w)},[J]),[Ps,Po]=P.useState("recipient"),Wn=P.useCallback(()=>{X(null),Po("recipient"),Ue("wallet")},[X,Ue]),Bo=P.useCallback((w,L="recipient")=>{Po(L),X(w),Ue("send")},[X,Ue]),Bs=P.useCallback(()=>{if(he){he();return}Ue("bridge")},[he,Ue]),Fs=P.useCallback(w=>{clearTimeout(zt.current),X(null),Ue("wallet"),se({status:"pending",txHash:w.txHash,chainId:w.chainId,description:`${w.amount} ${w.tokenSymbol} to ${je(w.recipient)}`})},[X,Ue]),Ms=P.useCallback(w=>{let L=we?.chainId;X(null),Ue("wallet"),!(!w||!L)&&(se(V=>({status:"success",txHash:w,chainId:L,description:V?.txHash===w?V.description:"Tap to see your transaction"})),clearTimeout(zt.current),zt.current=setTimeout(()=>se(null),5e3))},[we?.chainId,X,Ue]),_s=P.useCallback(w=>{let L=w.txHash;L&&(se({status:"error",txHash:L,chainId:w.chainId,description:w.message}),clearTimeout(zt.current),zt.current=setTimeout(()=>se(null),5e3))},[]),Fo=P.useMemo(()=>{if(wt)return wt;if(u)return()=>Ue("qr")},[wt,u,Ue]),Lr=P.useMemo(()=>{if(Oe)return Oe;if(ot.length===0)return;let w=ot[0];return()=>Bo(w,"token")},[Oe,ot,Bo]);P.useEffect(()=>{s||(ne.current=!1,Po("recipient"))},[s]);let Er=P.useRef(null);P.useEffect(()=>{let w=Er.current;if(!w||!i)return;let L=V=>{V.pointerType==="touch"&&V.stopPropagation()};return w.addEventListener("pointerdown",L),()=>w.removeEventListener("pointerdown",L)},[i]);let[on,Ar]=P.useState(!1),Mo=P.useRef(void 0),[yn,Dn]=P.useState(!1);P.useEffect(()=>{if(!yn)return;let w=()=>Dn(!1),L=Ce=>{Ce.key==="Escape"&&Dn(!1)},V=setTimeout(()=>{document.addEventListener("mousedown",w,!0),document.addEventListener("keydown",L,!0)},0);return()=>{clearTimeout(V),document.removeEventListener("mousedown",w,!0),document.removeEventListener("keydown",L,!0)}},[yn]),P.useEffect(()=>()=>clearTimeout(Mo.current),[]),P.useEffect(()=>()=>clearTimeout(zt.current),[]),P.useEffect(()=>{let w=j.current;if(!w||te===null){He(0);return}let L=()=>{He(w.offsetHeight)};if(L(),typeof ResizeObserver>"u")return;let V=new ResizeObserver(L);return V.observe(w),()=>V.disconnect()},[te]);let Pr=P.useCallback(async()=>{if(!on)try{await navigator.clipboard.writeText(b),Ar(!0),clearTimeout(Mo.current),Mo.current=setTimeout(()=>Ar(!1),2e3),I?.(b,!0)}catch{I?.(b,!1)}},[b,I,on]),Hn=P.useCallback(w=>{w.currentTarget.setAttribute("data-loaded","true")},[]),Br=P.useMemo(()=>({background:Ad(b)}),[b]),Gn=P.useMemo(()=>g||Xt(r,b,{size:120,bg:a==="dark"?"1A1A2E":"F3F6F8"}),[g,r,b,a]),_o=P.useMemo(()=>Ed(nt),[nt]),Fr=$||ce?C("div",{className:"wi-legal-links",children:[$&&h("a",{className:"wi-legal-link",href:$,target:"_blank",rel:"noopener noreferrer",onClick:w=>Ve(w,$,{category:"terms",origin:"terms"},Ye),children:z}),$&&ce&&h("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),ce&&h("a",{className:"wi-legal-link",href:ce,target:"_blank",rel:"noopener noreferrer",onClick:w=>Ve(w,ce,{category:"privacy",origin:"privacy"},Ye),children:ue})]}):null,Mr=W?C("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{W(),R()},children:[h(ni,{size:16}),h("span",{className:"wi-disconnect-label",children:Y})]}):null,Os=d&&!ae?C("div",{className:"wi-action-row","aria-label":"Wallet actions",children:[C("button",{type:"button",className:Q("wi-action-card",pe&&"wi-action-card--dimmed"),onClick:We,disabled:!H&&!pe,"aria-disabled":pe||void 0,"aria-label":"Buy",children:[h(li,{size:20}),h("span",{children:"Buy"})]}),v?C("button",{type:"button",className:"wi-action-card",onClick:Bs,"aria-label":"Bridge",children:[h(ci,{size:20}),h("span",{children:"Bridge"})]}):C("button",{type:"button",className:"wi-action-card",onClick:Fo,disabled:!Fo,"aria-label":"Receive",children:[h(Vo,{size:20}),h("span",{children:"Receive"})]}),C("button",{type:"button",className:"wi-action-card",onClick:Lr,disabled:!Lr,"aria-label":"Send",children:[h(ai,{size:20}),h("span",{children:"Send"})]}),C("button",{type:"button",className:"wi-action-card",onClick:()=>Ue("portfolio"),disabled:!Me,"aria-label":"View portfolio",children:[h(si,{size:20}),h("span",{children:"Portfolio"})]})]}):null,zs=C("div",{className:Q("wi-view-inner",ne.current&&"wi-view-wallet"),children:[Pt&&C("div",{className:"wi-total-section",children:[C("div",{className:"wi-total-head",children:[h("span",{className:"wi-total-label",children:ke}),h("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:w=>{w.stopPropagation(),N(L=>!L)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),N(L=>!L))},"aria-label":pt?"Show balance":"Hide balance",children:pt?h(ri,{}):h(oi,{})})]}),h("div",{className:"wi-total-body",children:Ae?h("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:42}}):h("div",{className:"wi-total-value","data-hidden":pt||void 0,children:pt?h("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):C(xo,{children:[yt&&h("span",{className:"wi-total-lte",children:"\u2264"}),h("span",{className:"wi-total-currency",children:"$"}),h("span",{className:"wi-total-amount",children:_o.main}),_o.decimal&&h("span",{className:"wi-total-decimal",children:_o.decimal})]})})})]}),Fe==="top"&&(ae?h("div",{className:"wi-nav-fixed",children:ae}):Os),d&&h("div",{ref:Er,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:C("div",{className:"wi-token-list",children:[vt&&Array.from({length:5},(w,L)=>C("div",{className:"wi-skeleton-item",children:[C("div",{className:"wi-skeleton-left",children:[h("div",{className:"wi-skeleton-block wi-skeleton-icon"}),C("div",{className:"wi-skeleton-lines",children:[h("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),h("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),C("div",{className:"wi-skeleton-right",children:[h("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),h("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},L)),!vt&&ot.length===0&&!m&&h("div",{className:"wi-empty",children:"No Tokens Found"}),ot.map(w=>{let L=De.get(Ft(w.chainId,w.address)),V=L?parseFloat(L.percent_change_24h):null,Ce=V!==null&&V>=0,K=In(r,w.chainId);return C("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Bo(w),"aria-label":`Send ${w.symbol}`,children:[C("div",{className:"wi-token-left",children:[C("div",{className:"wi-token-icon-wrap",children:[h("img",{src:w.icon_url,alt:w.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Hn,onError:fe=>{fe.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),K&&h("img",{src:K,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:fe=>{fe.currentTarget.style.display="none"}})]}),C("div",{className:"wi-token-info",children:[h("span",{className:"wi-token-name",children:w.symbol}),L&&C("div",{className:"wi-token-price-row",children:[h("span",{className:"wi-token-price",children:qo(L.price)}),h("span",{className:"wi-token-change","data-positive":Ce,"data-zero":V===0||void 0,children:V!==null&&(V===0?"0%":`${Ce?"+":"-"}${(Ce?Math.floor:Math.ceil)(Math.abs(V)*100)/100}%`)})]})]})]}),C("div",{className:"wi-token-right",children:[h("span",{className:"wi-token-balance",children:Dt(w.quantity.numeric,w.quantity.decimals)}),L&&h("span",{className:"wi-token-value",children:pi(w.quantity.numeric,w.quantity.decimals,L.price)})]})]},`${w.address}-${w.chainId}`)}),m&&Ot&&Array.from({length:3},(w,L)=>C("div",{className:"wi-skeleton-item",children:[C("div",{className:"wi-skeleton-left",children:[h("div",{className:"wi-skeleton-block wi-skeleton-icon"}),C("div",{className:"wi-skeleton-lines",children:[h("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),h("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),C("div",{className:"wi-skeleton-right",children:[h("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),h("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${L}`)),m&&!Ot&&!vt&&ot.length===0&&M.length===0&&h("div",{className:"wi-empty",children:"No Tokens Found"}),m&&M.map(w=>{let L=Eo.get(w.token)||"",V=In(r,Pe[r].cross);return C("div",{className:"wi-token-item",children:[C("div",{className:"wi-token-left",children:[C("div",{className:"wi-token-icon-wrap",children:[h("img",{src:L||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:w.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Hn,onError:Ce=>{Ce.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),V&&h("img",{src:V,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Ce=>{Ce.currentTarget.style.display="none"}})]}),C("div",{className:"wi-token-info",children:[h("span",{className:"wi-token-name",children:w.token_name}),h("div",{className:"wi-token-price-row",children:C("span",{className:"wi-token-price",children:[Dt(w.current_price,18)," CROSS"]})})]})]}),C("div",{className:"wi-token-right",children:[h("span",{className:"wi-token-balance",children:Dt(w.balance,18)}),h("span",{className:"wi-token-value",children:qo(w.current_value_usd)})]})]},`forge-${w.token}`)})]})}),Fe==="bottom"&&ae&&h("div",{className:"wi-nav-fixed",children:ae}),Mr&&h("div",{className:"wi-wallet-disconnect-row",children:Mr})]},"wallet"),Ws=Me?h("div",{className:Q("wi-view-inner wi-portfolio-body",ne.current&&"wi-view-portfolio"),children:h(hn,{env:r,theme:a,walletAddress:b,showHeader:!1,onOutlink:Ye,lpBalanceReader:Xe})},"portfolio"):null,Ds=we?h("div",{className:Q("wi-view-inner wi-send-body",ne.current&&"wi-view-send"),children:h(io,{env:r,theme:a,walletAddress:b,accountName:k,accounts:E,initialStep:Ps,token:we,tokens:ot,onTokenChange:X,sendTransaction:bt,getTransactionReceipt:de,estimateGas:Lt,getTokenPriceUsd:w=>{let L=De.get(Ft(w.chainId,w.address));if(!L?.price)return;let V=parseFloat(L.price);return Number.isFinite(V)?V:void 0},onClose:R,onBackToWallet:Wn,onSubmitted:Fs,onSuccess:Ms,onFailed:_s,onOutlink:Ye})},"send"):null,Hs=P.useMemo(()=>Se||ot.map(w=>{let L=De.get(Ft(w.chainId,w.address)),V=L?.price?parseFloat(L.price):void 0;return{name:w.name,symbol:w.symbol,chainId:w.chainId,address:w.address,decimals:w.quantity.decimals,balance:Tn(w.quantity.numeric,w.quantity.decimals),iconUrl:w.icon_url,priceUsd:Number.isFinite(V)?V:void 0}}),[Se,De,ot]),Gs=h("div",{className:Q("wi-view-inner wi-bridge-body",ne.current&&"wi-view-send"),children:h(bo,{env:r,walletAddress:b,tokens:Hs,history:Le,termsUrl:$,getQuote:me,getToTokens:re,getApproval:ge,approveBridge:Et,submitBridge:Je,onClose:R,onBackToWallet:Wn})},"bridge"),Oo=!!F&&k?.trim().toLowerCase()!=="my wallet",_r=C(xo,{children:[C("span",{className:"wi-receive-avatar",children:[h("span",{className:"wi-avatar-fallback",style:Br}),Gn&&h("img",{src:Gn,alt:"",className:"wi-avatar-img",width:24,height:24,draggable:!1,onLoad:Hn,onError:w=>{w.currentTarget.style.display="none"}})]}),h("span",{className:"wi-receive-account-name",children:k??"Account 1"}),Oo&&h("span",{className:"wi-receive-chevron","data-open":yn,"aria-hidden":"true",children:h(Qt,{size:16})})]}),Us=C("div",{className:Q("wi-view-inner wi-qr-body",ne.current&&"wi-view-qr"),children:[C("div",{className:"wi-receive-section",children:[Oo?h("button",{type:"button",className:"wi-receive-account wi-receive-account--btn",onClick:()=>{Dn(!0),F?.()},"aria-label":"Switch account",children:_r}):h("div",{className:"wi-receive-account",children:_r}),C("div",{className:"wi-qr-block",children:[C("div",{className:"wi-qr-box",children:[h(Id,{value:b,size:180,level:"H",marginSize:2,...x&&{imageSettings:{src:x,height:33,width:33,excavate:!0}}}),!x&&h("div",{className:"wi-qr-logo",children:h(ii,{size:33})})]}),h("p",{className:"wi-qr-address",children:b})]}),C("button",{type:"button",className:"wi-qr-copy-btn",onClick:Pr,children:[h("span",{className:"wi-qr-copy-icon",children:on?h(Sn,{size:16}):h(jo,{size:16})}),h("span",{className:"wi-qr-copy-text",children:on?"Copied!":"Copy address"})]})]}),Fr&&h("div",{className:"wi-receive-footer",children:Fr})]},"qr"),$s=G==="qr"||G==="portfolio"||G==="send"||G==="bridge",Or=te!==null?h("div",{className:"wi-builtin-footer",children:te}):null,zr=C("div",{className:"wi-account-text",children:[Oo?C("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:()=>{Dn(!0),F?.()},"aria-label":"Switch account","aria-expanded":yn,children:[h("span",{className:"wi-account-name",children:k??"Account 1"}),h("span",{className:"wi-account-switch","data-open":yn,"aria-hidden":"true",children:h(Qt,{size:20})})]}):h("div",{className:"wi-account-row",children:h("span",{className:"wi-account-name",children:k??"Account 1"})}),C("button",{type:"button",className:"wi-address-row-btn",onClick:Pr,"aria-label":"Copy address",children:[h("span",{className:"wi-account-address",children:je(b)}),h("span",{className:"wi-account-copy","data-copied":on,children:on?h(Sn,{size:12}):h(jo,{size:12})})]})]}),Wr=C(xo,{children:[o,G==="qr"?h("div",{className:"wi-sticky-header",children:C("div",{className:"wi-header wi-header--receive",children:[h("button",{type:"button",className:"wi-header-back",onClick:Wn,"aria-label":"Back",children:h(Bt,{size:24})}),h("span",{className:"wi-receive-title",children:"Receive"}),h("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:h(kt,{size:24})})]})}):G==="send"||G==="bridge"?null:$s?C("div",{className:"wi-sticky-header",children:[C("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[h("button",{type:"button",className:"wi-header-back",onClick:Wn,"aria-label":"Back",children:h(Bt,{size:24})}),h("div",{className:"wi-account-block wi-account-block--sub-account",children:zr}),h("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:h(kt,{size:24})})]}),h("hr",{className:"wi-divider"})]}):C("div",{className:"wi-sticky-header",children:[C("div",{className:"wi-header wi-header--wallet",children:[C("div",{className:"wi-account-block",children:[C("div",{className:"wi-avatar",children:[h("div",{className:"wi-avatar-fallback",style:Br}),Gn&&h("img",{src:Gn,alt:"",className:"wi-avatar-img",width:28,height:28,draggable:!1,onLoad:Hn,onError:w=>{w.currentTarget.style.display="none"}})]}),zr]}),C("div",{className:"wi-header-actions",children:[u&&v&&h("button",{type:"button",className:"wi-header-action wi-header-action--qr",onClick:Fo,"aria-label":"Show QR code",children:h(Vo,{size:20})}),h("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:h(kt,{size:24})})]})]}),h("hr",{className:"wi-divider"})]}),C("div",{className:"wi-view-container",children:[G==="wallet"&&zs,G==="qr"&&Us,G==="portfolio"&&Ws,G==="send"&&Ds,G==="bridge"&&Gs]}),G==="wallet"&&Ee&&h("div",{className:"wi-action-toast",role:"status","aria-live":"polite",children:Ee}),G==="wallet"&&_&&C("a",{className:"wi-send-toast",href:Ao??"#",target:"_blank",rel:"noopener noreferrer",onClick:w=>{if(!Ao){w.preventDefault();return}Ve(w,Ao,{category:"send",origin:"send-transaction",payload:{chainId:_.chainId,txHash:_.txHash}},Ye)},children:[h("span",{className:"wi-send-toast-icon","data-status":_.status,"aria-hidden":!0,children:_.status==="pending"?h("span",{className:"wi-send-toast-spinner"}):_.status==="error"?h("span",{className:"wi-send-toast-error-dot"}):h(di,{size:20})}),C("span",{className:"wi-send-toast-copy",children:[h("span",{className:"wi-send-toast-title",children:_.status==="pending"?"Sending...":_.status==="error"?"Send failed":"Send complete"}),h("span",{className:"wi-send-toast-desc",children:_.status==="pending"||_.status==="error"?_.description:"Tap to see your transaction"})]})]}),Or&&G!=="portfolio"&&G!=="send"&&h("div",{className:"wi-sticky-footer",children:h("div",{className:"wi-footer",ref:j,children:Or})})]}),Dr={...ie,...ee>0?{"--wi-footer-height":`${ee}px`}:null};return i?C(wo.Portal,{children:[l&&h(wo.Overlay,{className:"wi-drawer-overlay"}),C(wo.Content,{className:Q("wi-drawer-content",n),"data-theme":a,"data-vaul-no-drag":c==="left"||c==="right"?!0:void 0,style:Dr,"data-direction":c,"data-no-balance":!d||void 0,"data-has-footer":ee>0||void 0,"data-view":G,children:[h(wo.Title,{className:"wi-sr-only",children:"My Wallet"}),Wr]})]}):C(xo,{children:[l&&s&&h("div",{className:"wi-drawer-overlay",onClick:R}),h(vo.Portal,{children:h(vo.Content,{align:e,sideOffset:t,className:Q("wi-popover-content",n),"data-theme":a,style:Dr,"data-no-balance":!d||void 0,"data-has-footer":ee>0||void 0,"data-view":G,children:Wr})})]})}import*as is from"react";function as({position:e="top",children:t}){let{setNavContent:n,setNavPosition:o}=Wt();return is.useEffect(()=>(n(t),o(e),()=>n(null)),[t,e,n,o]),null}import*as ss from"react";function ls({children:e}){let{setFooterContent:t}=Wt();return ss.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}O(`[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
+ `);O(`.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
+ `);O(`@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
+ `);O(`.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{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-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
+ `);O(`.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 Sr}from"react/jsx-runtime";var Bd="https://terms.crosstoken.io/docs/cross-terms-of-use",Fd="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Md({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:m,accountName:f,sendAccounts:u,profileImageUrl:v,connectorId:x,connectorName:b,connectorIconUrl:k,preferredTokens:E=[],onSelectWallet:g,onCopyAddress:B,onBuy:R,onBuyDisabledMessage:F,onDisconnect:I,disconnectLabel:H="Disconnect",termsUrl:W=Bd,termsLabel:Y="Terms of Service",privacyUrl:$=Fd,privacyLabel:z="Privacy Policy",open:ce,onOpenChange:ue,showPortfolio:ie=!1,portfolioTitle:ae="My Portfolio",showTotalAssets:Fe=!0,totalAssetsLabel:te="Total Assets USD",sendTransaction:G,getTransactionReceipt:J,estimateGas:we,onOutlink:X,lpBalanceReader:Me,bridgeTokens:_e,bridgeHistory:xe,getBridgeQuote:ke,getBridgeToTokens:bt,getBridgeApproval:de,approveBridge:Lt,submitBridge:Ye,onReceive:Xe,onBridge:Se,onSend:Le,style:me,children:re}){let ge=Ne(e),Et=x?Kn[x]:void 0,Je=b??Et?.name,wt=k??Et?.iconUrl,he=rn(`(max-width: ${n}px)`),Oe=o??(a?"right":"bottom"),xt=Oe==="left"||Oe==="right",Ee=r??!1,et=ce!==void 0,[tt,ze]=Ie.useState(!1),pe=et?ce:tt,We=Ie.useCallback(Ge=>{et||ze(Ge),ue?.(Ge)},[et,ue]),dt=Ie.useCallback(()=>We(!1),[We]),[vt,De]=Ie.useState(null),[At,Pt]=Ie.useState("top"),[nt,yt]=Ie.useState(null),[Ae,pt]=Ie.useState("wallet"),[N,j]=Ie.useState(null);Ie.useEffect(()=>{pe||(pt("wallet"),j(null))},[pe]);let ee=Ie.useCallback(()=>{Yo(m),I?.()},[I,m]),He=Ie.useMemo(()=>({env:ge,theme:t,isMobile:he,open:pe,drawerDirection:Oe,modal:Ee,showBalance:a,showForgeToken:i,showGameToken:s,showQR:c,showBridge:l,qrLogoSrc:d,walletAddress:m,accountName:f,sendAccounts:u,profileImageUrl:v,connectorName:Je,connectorIconUrl:wt,preferredTokens:E,close:dt,onSelectWallet:g,onCopyAddress:B,onBuy:R,onBuyDisabledMessage:F,onDisconnect:I?ee:void 0,disconnectLabel:H,termsUrl:W,termsLabel:Y,privacyUrl:$,privacyLabel:z,portalStyle:me,navContent:vt,navPosition:At,setNavContent:De,setNavPosition:Pt,footerContent:nt,setFooterContent:yt,view:Ae,setView:pt,selectedSendToken:N,setSelectedSendToken:j,showPortfolio:ie,portfolioTitle:ae,showTotalAssets:Fe,totalAssetsLabel:te,sendTransaction:G,getTransactionReceipt:J,estimateGas:we,onOutlink:X,lpBalanceReader:Me,bridgeTokens:_e,bridgeHistory:xe,getBridgeQuote:ke,getBridgeToTokens:bt,getBridgeApproval:de,approveBridge:Lt,submitBridge:Ye,onReceive:Xe,onBridge:Se,onSend:Le}),[ge,t,he,pe,Oe,Ee,a,i,s,c,l,d,m,f,u,v,Je,wt,E,dt,g,B,R,F,I,ee,H,W,Y,$,z,me,vt,At,nt,Ae,N,ie,ae,Fe,te,G,J,we,X,Me,_e,xe,ke,bt,de,Lt,Ye,Xe,Se,Le]);return Sr(Uo.Provider,{value:He,children:he?Sr(Pd.Root,{direction:Oe,open:pe,onOpenChange:We,handleOnly:xt,noBodyStyles:!0,repositionInputs:!1,children:re},"drawer"):Sr(cs.Root,{open:pe,onOpenChange:We,children:re},"popover")})}var xn=Object.assign(Md,{Trigger:qi,Content:rs,Nav:as,Footer:ls});import*as It from"react";import*as Ts from"@radix-ui/react-dialog";import{Drawer as Ud}from"vaul";import{createContext as _d,useContext as Od}from"react";var yo=_d(null);function Fn(){let e=Od(yo);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as ds,useEffect as zd,useCallback as Wd}from"react";function ko(){let[e,t]=ds([]),[n,o]=ds(!0);zd(()=>{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=Wd(a=>e.some(i=>i.rdns===a),[e]);return{wallets:e,isDetected:r,isLoading:n}}import*as fs from"@radix-ui/react-dialog";import{Drawer as Dd}from"vaul";import{jsx as ps}from"react/jsx-runtime";function us({asChild:e,children:t}){let{isMobile:n}=Fn(),o=n?Dd.Trigger:fs.Trigger;return ps(o,{asChild:e??t!=null,children:t??ps("button",{type:"button",children:"Connect Wallet"})})}import*as Rt from"@radix-ui/react-dialog";import{Drawer as Co}from"vaul";import{jsx as U,jsxs as jt}from"react/jsx-runtime";function So(){return jt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),U("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 ms(){return jt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[jt("g",{clipPath:"url(#clip0_1331_27065)",children:[U("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"}),U("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"}),U("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"}),U("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"}),U("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"}),U("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),U("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"})]}),U("defs",{children:U("clipPath",{id:"clip0_1331_27065",children:U("rect",{width:"40",height:"40",fill:"white"})})})]})}function gs(){return jt("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[U("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),U("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),U("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),U("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),U("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 hs(){return jt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[U("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),U("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"}),U("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),U("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 bs(){return jt("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jt("g",{clipPath:"url(#clip0_1185_7785)",children:[U("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"}),U("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"})]}),U("defs",{children:U("clipPath",{id:"clip0_1185_7785",children:U("rect",{width:"28",height:"28",fill:"white"})})})]})}function ws(){return jt("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[U("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"}),U("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"}),U("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"}),U("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 xs(){return U("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:U("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 vs(){return U("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:U("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Cr={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:So},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:So,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:So,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:ms,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:gs},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:hs,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:bs,badge:"For SHOP"}};function Nr(e){return Cr[e]}var Tr={google:{id:"google",name:"Google",icon:ws},apple:{id:"apple",name:"Apple",icon:xs}};function ys(e){return Tr[e]}import{Fragment as Cs,jsx as D,jsxs as ye}from"react/jsx-runtime";function Hd({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 ye("button",{type:"button",className:Q("wcm-wallet-item",a&&"wcm-wallet-item--featured"),onClick:o,children:[ye("div",{className:"wcm-wallet-item-left",children:[D("div",{className:"wcm-wallet-icon",children:D(r,{})}),ye("div",{className:"wcm-wallet-name-row",children:[D("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&D("span",{className:"wcm-wallet-badge",children:e.badge})]})]}),e.installUrl&&(t?D("span",{className:"wcm-installed-label",children:"Installed"}):D("span",{className:"wcm-install-btn",children:"Install"}))]})}function Gd({social:e,onSignIn:t}){let n=e.icon,o=`Sign in with ${e.name}`;return ye("button",{type:"button",className:"wcm-social-item","data-provider":e.id,onClick:t,"aria-label":o,children:[D("span",{className:"wcm-social-icon",children:D(n,{})}),D("span",{className:"wcm-social-name",children:o})]})}function ks(){let{wallets:e,activeWalletIds:t,socialProviders:n,activeSocialIds:o,termsUrl:r,privacyUrl:a,isDetected:i,close:s,isMobile:c}=Fn(),l=t.filter(f=>{let u=Nr(f).visibility;return!u||u==="always"?!0:u==="desktop-only"?!c:u==="mobile-only"?c:!0}),d=o.length>0,m=l.length>0;return ye(Cs,{children:[ye("div",{className:"wcm-header",children:[ye("div",{className:"wcm-header-text",children:[D("h2",{className:"wcm-title",children:"CROSS Wallet"}),!c&&D("p",{className:"wcm-subtitle",children:"Sign in instantly with your social account"})]}),D("button",{type:"button",className:"wcm-close-btn",onClick:s,"aria-label":"Close",children:D(vs,{})})]}),ye("div",{className:"wcm-body",children:[d&&ye(Cs,{children:[!c&&ye("div",{className:"wcm-section-header",children:[D("span",{className:"wcm-section-title",children:"Social Account Wallet Connect"}),D("span",{className:"wcm-recommended-badge",children:"Recommended"})]}),D("div",{className:"wcm-social-grid",children:o.map(f=>{let u=ys(f);return D(Gd,{social:u,onSignIn:()=>{n[f]?.(),s()}},f)})}),m&&ye("div",{className:"wcm-separator",children:[D("div",{className:"wcm-separator-line"}),D("span",{className:"wcm-separator-text",children:"Other Wallets"}),D("div",{className:"wcm-separator-line"})]})]}),m&&D("div",{className:"wcm-wallet-list",children:l.map(f=>{let u=Nr(f),v=u.rdns?i(u.rdns):!1;return D(Hd,{wallet:u,detected:v,onConnect:()=>{e[f]?.(),s()}},f)})}),ye("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",D(Ss,{href:r,children:"Terms of Service"})," and consent to its ",D(Ss,{href:a,children:"Privacy Policy"}),"."]})]})]})}function Ss({href:e,children:t}){return e?D("a",{className:"wcm-terms-link",href:e,target:"_blank",rel:"noopener noreferrer",children:t}):D("span",{className:"wcm-terms-link",children:t})}function Ns({className:e}){let{isMobile:t,theme:n,portalStyle:o}=Fn();return t?ye(Co.Portal,{children:[D(Co.Overlay,{className:"wcm-overlay"}),ye(Co.Content,{className:Q("wcm-drawer-content",e),"data-theme":n,style:o,children:[D(Co.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),D("div",{className:"wcm-drawer-handle"}),D("div",{className:"wcm-drawer-body",children:D(ks,{})})]})]}):ye(Rt.Portal,{children:[D(Rt.Overlay,{className:"wcm-overlay"}),ye(Rt.Content,{className:Q("wcm-dialog-content",e),"data-theme":n,style:o,children:[D(Rt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),D(Rt.Description,{className:"wcm-sr-only",children:"Sign in with a social provider or pick a wallet to connect."}),D("div",{className:"wcm-dialog-body",children:D(ks,{})})]})]})}O(`.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
+ `);O(`@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 Mn}from"react/jsx-runtime";var $d={};function jd({wallets:e,socialProviders:t=$d,termsUrl:n,privacyUrl:o,theme:r="dark",mobileBreakpoint:a=768,drawerDirection:i="bottom",dialogWidth:s,drawerMaxWidth:c,drawerMinWidth:l,style:d,open:m,onOpenChange:f,children:u}){let v=rn(`(max-width: ${a}px)`),[x,b]=It.useState(!1),k=m!==void 0,E=k?m:x,g=It.useCallback($=>{k||b($),f?.($)},[k,f]),B=It.useCallback(()=>g(!1),[g]),{isDetected:R}=ko(),F=It.useMemo(()=>Object.keys(e),[e]),I=It.useMemo(()=>Object.keys(t),[t]),H=It.useMemo(()=>{let $={};return s&&($["--wcm-dialog-width"]=s),c&&($["--wcm-drawer-max-width"]=c),l&&($["--wcm-drawer-min-width"]=l),{...$,...d}},[s,c,l,d]),W=It.useMemo(()=>({theme:r,isMobile:v,open:E,setOpen:g,close:B,wallets:e,activeWalletIds:F,socialProviders:t,activeSocialIds:I,termsUrl:n,privacyUrl:o,isDetected:R,portalStyle:H}),[r,v,E,g,B,e,F,t,I,n,o,R,H]),Y=Mn("div",{"data-theme":r,style:H,children:u});return v?Mn(yo.Provider,{value:W,children:Mn(Ud.Root,{direction:i,open:E,onOpenChange:g,noBodyStyles:!0,children:Y},"drawer")}):Mn(yo.Provider,{value:W,children:Mn(Ts.Root,{open:E,onOpenChange:g,children:Y})})}var Rs=Object.assign(jd,{Trigger:us,Content:Ns});O(`.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
+ `);O(`.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 Vd='<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>',qd='<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>',Kd='<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>',Qd='<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>',Zd='<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 _n(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var No=_n(Vd),To=_n(qd),Ro=_n(Kd),Io=_n(Qd),Lo=_n(Zd);import{jsx as ct,jsxs as On}from"react/jsx-runtime";function Ls({isConnecting:e,address:t,provider:n,providerName:o,accountName:r,sendAccounts:a,onConnect:i,onDisconnect:s,onCopy:c,onSelectWallet:l,onBuy:d,onBuyDisabledMessage:m,label:f="Connect Wallet",connectingLabel:u="Connecting...",disconnectLabel:v,className:x,theme:b="dark",env:k,showBalance:E=!0,showPortfolio:g,drawerDirection:B,modal:R,connectorId:F,style:I,walletInfoStyle:H,sendTransaction:W,getTransactionReceipt:Y,estimateGas:$,onReceive:z,onBridge:ce,onSend:ue,bridgeTokens:ie,bridgeHistory:ae,getBridgeQuote:Fe,getBridgeToTokens:te,getBridgeApproval:G,approveBridge:J,submitBridge:we}){let X=x?`cb-button ${x}`:"cb-button",Me=x?`cb-pill ${x}`:"cb-pill";if(e)return On("button",{type:"button",disabled:!0,className:X,style:I,"aria-busy":"true",children:[ct("span",{className:"cb-spinner","aria-hidden":"true"}),ct("span",{className:"cb-button-label",children:u})]});if(t){let _e=o??ep(n),xe=n?Xd[n]:void 0;return On(xn,{env:k,theme:b,drawerDirection:B,modal:R,showBalance:E,showPortfolio:g,walletAddress:t,accountName:r,sendAccounts:a,connectorId:F,onSelectWallet:l,onCopyAddress:c?(ke,bt)=>{bt&&c()}:void 0,onDisconnect:s,disconnectLabel:v,style:H,sendTransaction:W,getTransactionReceipt:Y,estimateGas:$,onReceive:z,onBridge:ce,onBuy:d,onBuyDisabledMessage:m,onSend:ue,bridgeTokens:ie,bridgeHistory:ae,getBridgeQuote:Fe,getBridgeToTokens:te,getBridgeApproval:G,approveBridge:J,submitBridge:we,children:[ct(xn.Trigger,{asChild:!0,children:On("button",{type:"button",className:Me,style:I,"aria-label":`Connected with ${_e}: ${Is(t)}`,children:[xe?ct("img",{src:xe,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:Is(t)})]})}),ct(xn.Content,{align:"end",sideOffset:8})]})}return On("button",{type:"button",onClick:i,className:X,style:I,"aria-label":typeof f=="string"?f:"Connect Wallet",children:[ct(Yd,{}),ct("span",{className:"cb-button-label",children:f})]})}function Yd(){return On("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 Xd={google:Io,apple:Lo,cross:No,metamask:To,binance:Ro},Jd={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function ep(e){return e?Jd[e]:"Wallet"}function Is(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}import*as Es from"react";O(`.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
+ `);O(`.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 zn,jsxs as np}from"react/jsx-runtime";var Rr="https://skills.cross.nexus";function As({label:e="Skills",href:t=Rr,onClick:n,className:o,style:r,theme:a,disabled:i=!1,isLoading:s=!1,loadingLabel:c="Loading...",openInNewTab:l=!1,type:d="button"}){let[m,f]=Es.useState(!1),u=async E=>{if(t&&!n){l?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t;return}if(n)try{f(!0),await n()}finally{f(!1)}},v=i||s||m,x=s||m,b=x?c:e,k=o?`sb-button ${o}`:"sb-button";return np("button",{type:d,onClick:u,disabled:v,className:k,"data-theme":a,style:r,"aria-busy":x,children:[x?zn("span",{className:"sb-spinner","aria-hidden":"true"}):zn(tp,{}),zn("span",{className:"sb-label",children:b})]})}function tp(){return zn("svg",{className:"sb-button-icon",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:zn("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"})})}Do({mode:"dapp-ui"});export{Lo as APPLE_ICON,jr as AppLauncher,ei as AppLauncherContent,Zr as AppLauncherTrigger,Ro as BINANCE_ICON,bo as BridgeFlow,Kn as CONNECTOR_REGISTRY,No as CROSSX_ICON,Ls as ConnectButton,$o as ConnectorId,Rr as DEFAULT_SKILLS_HREF,Io as GOOGLE_ICON,To as METAMASK_ICON,Tr as SOCIAL_REGISTRY,io as SendFlow,As as SkillsButton,ar as TOKEN_STATS_QUERY_KEY,ir as USER_BALANCE_QUERY_KEY,Cr as WALLET_REGISTRY,Rs as WalletConnectModal,xn as WalletInfo,Pa as WalletPortfolio,hn as WalletPortfolioBody,Do as announceAppLauncherUsage,Ne as resolveEnvironment,Vn as useGlobalMenu,pn as useTokenBalance,fn as useTokenStats,ko as useWalletDetect};