@nexus-cross/dapp-ui 1.1.2-beta.1 → 1.1.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +16 -16
- package/dist/index.d.cts +48 -23
- package/dist/index.d.ts +48 -23
- package/dist/index.js +16 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function ge(e){if(e)return
|
|
2
|
-
`);
|
|
3
|
-
`);
|
|
4
|
-
`);
|
|
5
|
-
`);O("");import{jsx as Dn}from"react/jsx-runtime";function ko({env:e,theme:t="dark",mobileBreakpoint:o=768,domain:n,children:r}){let i=Lt(`(max-width: ${o}px)`),[a,c]=Rt.useState(!1),d=Rt.useCallback(()=>c(!1),[]),l=ge(e),s=Rt.useMemo(()=>({env:l,theme:t,isMobile:i,open:a,domain:n,close:d}),[l,t,i,a,n,d]);return Dn(Fn.Provider,{value:s,children:i?Dn(li.Root,{direction:"right",open:a,onOpenChange:c,noBodyStyles:!0,children:r},"drawer"):Dn(yo.Root,{open:a,onOpenChange:c,children:r},"popover")})}import*as Ro from"@radix-ui/react-popover";import{Drawer as di}from"vaul";import{jsx as we,jsxs as ci}from"react/jsx-runtime";function Co({size:e=18}){return ci("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[we("rect",{width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function No(){return we("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Lo(){return we("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as sn}from"react/jsx-runtime";function Eo({asChild:e,children:t}){let{isMobile:o,theme:n}=an(),r=t!=null,i=e??!0,a=r?t:sn("button",{type:"button",className:"al-trigger-btn","data-theme":n,children:sn(Co,{size:o?12:18})});return o?sn(di.Trigger,{asChild:i,children:a}):sn(Ro.Trigger,{asChild:i,children:a})}import*as wt from"react";import*as cn from"@radix-ui/react-popover";import{Drawer as Et}from"vaul";import{useQuery as ui}from"@tanstack/react-query";var To={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 pi="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",mi="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function De(e,t){return`${e==="production"?mi:pi}/${t}.png`}function Po(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:De(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:De(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:De(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:De(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:De(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:De(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{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:De(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:De(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:De(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:De(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function ln(e){let t=ge(e);return ui({queryKey:["global-menu",t],queryFn:async({signal:o})=>{try{let n=await fetch(To[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 Po(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function K(...e){return e.filter(Boolean).join(" ")}import{jsx as oe,jsxs as Gt}from"react/jsx-runtime";function Io({align:e="end",sideOffset:t=12,className:o}){let{env:n,theme:r,isMobile:i,domain:a,close:c}=an(),{data:d}=ln(n),l=wt.useMemo(()=>(d?.items??[]).sort((h,P)=>h.order-P.order),[d]),s=8,m=wt.useRef(null),k=wt.useCallback(h=>{m.current={x:h.clientX,y:h.clientY}},[]),b=typeof window<"u"?window.location.pathname:"",g=wt.useCallback((h,P)=>{if(m.current){let N=h.clientX-m.current.x,V=h.clientY-m.current.y;if(m.current=null,Math.abs(N)>s||Math.abs(V)>s)return}let A=P.url[n]??P.url.production,I=So(A,a);if(!I)try{let N=new URL(A).pathname;if(b===N||b.startsWith(N+"/")){c();return}}catch{}I?window.open(A,"_blank","noopener,noreferrer"):window.location.href=A,c()},[n,a,c,b]),w=oe("div",{className:"al-grid","data-theme":r,children:l.map(h=>{let P=h.url[n]??h.url.production,A=So(P,a),I=!1;if(!A)try{let N=new URL(P).pathname;I=b===N||b.startsWith(N+"/")}catch{I=!1}return Gt("button",{type:"button",className:"al-grid-item","data-active":I||void 0,onPointerDown:k,onClick:N=>g(N,h),children:[Gt("div",{className:"al-grid-item-left",children:[oe("div",{className:"al-grid-item-icon",children:oe("img",{src:h.iconUrl,alt:h.label,width:24,height:24,loading:"lazy"})}),oe("span",{className:"al-grid-item-label",children:h.label}),h.isNew&&oe("span",{className:"al-badge-new",children:"N"})]}),oe("div",{className:"al-grid-item-right",children:h.badge&&oe("span",{className:"al-badge",children:h.badge})})]},h.id)})});return i?Gt(Et.Portal,{children:[oe(Et.Overlay,{className:"al-drawer-overlay"}),Gt(Et.Content,{className:K("al-drawer-content",o),"data-theme":r,children:[Gt("div",{className:"al-drawer-header",children:[oe(Et.Close,{className:"al-drawer-close",children:oe(No,{})}),oe(Et.Title,{className:"al-drawer-title",children:"CROSS Services"}),oe(Et.Close,{className:"al-drawer-close",children:oe(Lo,{})})]}),oe("div",{className:"al-drawer-body",children:w})]})]}):oe(cn.Portal,{children:oe(cn.Content,{align:e,sideOffset:t,className:K("al-popover-content",o),"data-theme":r,children:w})})}function So(e,t){try{let o=new URL(e).hostname;return typeof window>"u"?!0:o!==(t??window.location.hostname)}catch{return!1}}import*as ce from"react";import*as Vr from"@radix-ui/react-popover";import{Drawer as Qa}from"vaul";import{createContext as fi,useContext as gi}from"react";var Wn=fi(null);function tt(){let e=gi(Wn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Bn=(n=>(n.CROSSx="crossx",n.MetaMask="io.metamask",n.Binance="com.binance.wallet",n))(Bn||{}),dn={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 R from"react";import ht from"bignumber.js";function wi(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 bt(e,t){if(!e||e==="0")return"0.00";let o=new ht(e).shiftedBy(-t),n=o.isGreaterThanOrEqualTo(1)?2:4;return o.toFormat(n,ht.ROUND_DOWN)}function Ne(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function $n(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 Mo(e,t,o){let r=new ht(e).shiftedBy(-t).multipliedBy(new ht(o));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(ht.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,ht.ROUND_DOWN):r.decimalPlaces(4,ht.ROUND_DOWN)).toFormat()}`}function _o(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=wi(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}}var Le={dev:"https://stg-wallet-server.crosstoken.io/api",stage:"https://stg-wallet-server.crosstoken.io/api",production:"https://wallet-server.crosstoken.io/api"},me={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Vn={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"},Ao={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Hn(e,t){let o=me[e];if(t===o.cross)return Ao.cross;if(t===o.bsc)return Ao.bsc}var hi={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function xt(e,t,o={}){if(!t||!t.startsWith("0x"))return;let{size:n=120,bg:r,format:i="png"}=o,a=hi[e],c=r?`&bg=${r}`:"";return`${a}/portrait/evm/${t}.${i}?size=${n}${c}`}import{jsx as G,jsxs as pn}from"react/jsx-runtime";function Oo({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Gn({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("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 zt({size:e=16,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function zn({size:e=24,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fo({size:e=20,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Do({size:e=20,className:t}){return G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:G("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 Wo({size:e=20,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bo({size:e=20,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function $o({size:e=20,className:t}){return G("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:G("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vo({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("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 Ho({size:e=16,className:t}){return pn("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[G("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"}),G("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Go({size:e=42,className:t}){return G("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:G("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})})}import{useMemo as bi}from"react";import{useQuery as xi}from"@tanstack/react-query";var vi="send:chain-info";function yi(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 Un(e,...t){let o=e.replace(/\/+$/,""),n=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[o,...n].join("/")}function ki(e,t,o,n){if(n)return t===me[e].cross?zo(t,n):o?.explorer_url?Un(o.explorer_url,o.explorer_postfix?.transaction??"tx",n):Ci(e,t,n)}function zo(e,t){return Un("https://explorer.crosstoken.io",String(e),"tx",t)}function Ci(e,t,o){let n=me[e];if(t===n.cross)return zo(t,o);if(t===n.bsc)return Un(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",o)}function Uo(e,t,o,n=!0){let r=Le[e],i=xi({queryKey:[vi,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 yi(s)},enabled:n,staleTime:300*1e3}),a=i.data;return{transactionUrl:bi(()=>ki(e,t,a,o),[t,a,e,o]),chainInfo:a,...i}}var jo="0x0000000000000000000000000000000000000001";var Ni="0xa9059cbb",Li=/^0x[a-fA-F0-9]{40}$/,Ri="nexus-cross:dapp-ui:send:recent:",qo=10;function Ei(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Ut(e){return e.toLowerCase()}function jt(e){return Li.test(e)}function jn(e){return Ut(e.address)===jo}function qn(e){return`${Ri}${e.toLowerCase()}`}function Tt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(qn(e));if(!t)return[];let o=JSON.parse(t);return Array.isArray(o)?o.filter(n=>n!==null&&typeof n=="object"&&jt(n.address)&&typeof n.updatedAt=="number").slice(0,qo):[]}catch{return[]}}function Zn(e,t){if(typeof window>"u")return[];let o=Ut(t),n=[{address:o,updatedAt:Date.now()},...Tt(e).filter(r=>r.address!==o)].slice(0,qo);try{window.localStorage.setItem(qn(e),JSON.stringify(n))}catch{return Tt(e)}return n}function Kn(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(qn(e))}catch{}}function Yn(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 Qn(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=Ei(i.toString().padStart(t,"0"));return`${r.toString()}.${a}`}function Xn(e,t){let o=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),n=t.toString(16).padStart(64,"0");return`${Ni}${o}${n}`}var Ti=2000000000n,Pi=1000000000n;async function mn(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:o})});if(!n.ok)throw new Error(`RPC ${t} HTTP ${n.status}`);let r=await n.json();if(r.error)throw new Error(`RPC ${t}: ${r.error.message}`);if(r.result===void 0)throw new Error(`RPC ${t}: empty result`);return r.result}function un(e){return BigInt(e)}function Si(e){return`0x${e.toString(16)}`}function Ii(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Si(e.value)),e.data&&(t.data=e.data),t}function Mi(e){return e===56||e===97}async function Zo(e){try{let t=await mn(e,"eth_gasPrice",[]);return{gasPrice:un(t)}}catch{return{gasPrice:Ti}}}async function _i(e,t){let o=Pi;try{let n=await mn(e,"eth_maxPriorityFeePerGas",[]);o=un(n)}catch{}return{maxFeePerGas:t+o,maxPriorityFeePerGas:o}}async function Ai(e,t){if(t)return Zo(e);let o;try{o=(await mn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return o?_i(e,un(o)):Zo(e)}async function Ko(e,t){let o=Mi(t.chainId),n=Ii(t),[r,i]=await Promise.all([mn(e,"eth_estimateGas",[n]),Ai(e,o)]);return{gasLimit:un(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function Yo(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(Yo(o.cause,t+1)),n.join(`
|
|
6
|
-
`).toLowerCase()}function Oi(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 Jn(e,t={},o="Failed to send transaction."){let n=Yo(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}${a} to cover the gas fee. Top up ${r} 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.":Oi(e)||o}O(`.wi-token-item--button{position:relative;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:12px;padding:6px 8px;margin:-2px -8px;transition:background-color .15s ease,transform .15s ease}.wi-token-item--button:before{content:"";position:absolute;inset:-6px -16px;border-radius:16px}.wi-token-item--button:active{transform:scale(.99)}.wi-token-item--button:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.wi-view-send{animation:wi-slide-in-right .25s ease-out}.wi-send-body{flex:1;min-height:0;overflow:hidden}.wi-drawer-content[data-direction=bottom][data-view=send]{max-height:100dvh}.send-page{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.send-scroll{flex:1;min-height:0;display:flex;flex-direction:column;gap:16px;overflow-y:auto;overflow-x:hidden;padding:16px 24px 18px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .send-scroll{scrollbar-color:rgba(0,0,0,.12) transparent}.send-scroll::-webkit-scrollbar{width:4px}.send-scroll::-webkit-scrollbar-track{background:transparent}.send-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}[data-theme=light] .send-scroll::-webkit-scrollbar-thumb{background:#0000001f}.send-section{display:flex;flex-direction:column;gap:8px}.send-asset-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.send-asset-card:disabled{cursor:default}.send-asset-card:not(:disabled):hover,.send-asset-card[aria-expanded=true]{border-color:var(--wi-primary);background:var(--wi-surface-subtle)}.send-token-list{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto;padding:6px;border:1px solid var(--wi-border-subtle);border-radius:16px;background:var(--wi-surface-default)}.send-token-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;border:none;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer}.send-token-option:hover,.send-token-option[data-selected]{background:var(--wi-surface-subtle)}.send-token-option:focus-visible,.send-asset-card:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-token-option-icon{flex-shrink:0;width:28px;height:28px;object-fit:contain;background:transparent}.send-token-option-symbol{color:var(--wi-texticon-primary);font-size:13px;font-weight:700;line-height:1.3}.send-token-option-balance{color:var(--wi-texticon-secondary);font-size:12px;font-weight:600;line-height:1.3;white-space:nowrap}.send-asset-left{display:flex;align-items:center;gap:12px;min-width:0}.send-asset-icon{flex-shrink:0;width:40px;height:40px;object-fit:contain;background:transparent}.send-asset-info,.send-asset-balance{min-width:0;display:flex;flex-direction:column}.send-asset-symbol{color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.3}.send-asset-name,.send-balance-label{color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.send-asset-balance{align-items:flex-end;text-align:right}.send-balance-value{color:var(--wi-texticon-primary);font-size:13px;font-weight:600;line-height:1.35;white-space:nowrap}.send-form{display:flex;flex-direction:column;gap:14px}.send-field{display:flex;flex-direction:column;gap:8px}.send-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.send-label{color:var(--wi-texticon-secondary);font-size:13px;font-weight:600;line-height:1.3}.send-input,.send-amount-wrap{width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);color:var(--wi-texticon-primary);font:inherit}.send-input{min-height:46px;padding:0 14px;font-size:16px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.send-input:focus{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-address-wrap[data-invalid],.send-amount-wrap[data-invalid]{border-color:#ff6b6b}.send-address-wrap[data-invalid]:focus-within,.send-amount-wrap[data-invalid]:focus-within{border-color:#ff6b6b;box-shadow:0 0 0 3px #ff6b6b29}.send-input::placeholder{color:var(--wi-texticon-tertiary)}.send-address-wrap{display:flex;align-items:center;width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);transition:border-color .15s ease,box-shadow .15s ease}.send-address-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--address{flex:1;min-width:0;border:none;background:transparent;box-shadow:none}.send-input--address:focus{box-shadow:none}.send-address-book-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;margin-right:2px;border:none;border-radius:12px;background:transparent;color:var(--wi-texticon-tertiary);cursor:pointer;transition:background-color .15s ease,color .15s ease}.send-address-book-btn:hover,.send-address-book-btn[aria-expanded=true]{background:var(--wi-surface-subtle);color:var(--wi-primary)}.send-address-book-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-picker{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default)}.send-address-tabs{display:flex;align-items:center;gap:22px;border-bottom:1px solid var(--wi-border-subtle)}.send-address-tab{position:relative;border:none;background:transparent;color:var(--wi-texticon-tertiary);font:inherit;font-size:14px;font-weight:800;line-height:1.3;padding:0 0 12px;cursor:pointer}.send-address-tab[data-active]{color:var(--wi-primary)}.send-address-tab[data-active]:after{content:"";position:absolute;left:50%;bottom:-1px;width:34px;height:4px;border-radius:999px;background:var(--wi-primary);transform:translate(-50%)}.send-address-list{display:flex;flex-direction:column;gap:10px;max-height:224px;overflow-y:auto;padding-right:10px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}[data-theme=light] .send-address-list{scrollbar-color:rgba(0,0,0,.14) transparent}.send-address-list::-webkit-scrollbar{width:3px}.send-address-list::-webkit-scrollbar-track{background:transparent}.send-address-list::-webkit-scrollbar-thumb{background:#ffffff2e;border-radius:999px}[data-theme=light] .send-address-list::-webkit-scrollbar-thumb{background:#00000024}.send-address-option{display:flex;align-items:center;gap:12px;width:100%;min-height:54px;border:none;border-radius:14px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer;transition:background-color .15s ease}.send-address-option:hover{background:var(--wi-surface-subtle)}.send-address-option:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--wi-surface-subtle);color:var(--wi-primary);font-size:12px;font-weight:800;overflow:hidden}.send-address-avatar-img{position:relative;z-index:1;width:36px;height:36px;border-radius:50%;object-fit:cover}.send-address-avatar-fallback{position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center}.send-address-copy{min-width:0;display:flex;flex-direction:column;gap:2px}.send-address-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:800;line-height:1.3}.send-address-value{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:600;line-height:1.3}.send-address-empty{display:flex;align-items:center;justify-content:center;min-height:120px;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:700}.send-amount-wrap{display:flex;align-items:center;padding-right:12px}.send-amount-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--amount{border:none;background:transparent;box-shadow:none;flex:1;min-width:0}.send-input--amount:focus{box-shadow:none}.send-amount-symbol{color:var(--wi-texticon-secondary);font-size:13px;font-weight:700}.send-field-error{margin:-2px 0 0;color:#ff6b6b;font-size:12px;font-weight:600;line-height:1.35}.send-max-btn{border:none;border-radius:999px;background:var(--wi-surface-subtle);color:var(--wi-primary);font:inherit;font-size:12px;font-weight:700;padding:4px 10px;cursor:pointer}.send-max-btn:disabled{cursor:not-allowed;opacity:.45}.send-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.4}.send-meta span:last-child{color:var(--wi-texticon-secondary);font-weight:600}.send-message{border-radius:14px;padding:10px 12px;font-size:12px;line-height:1.45}.send-message--error{background:#ff50501f;color:#ff6b6b}.send-message--success{background:color-mix(in srgb,var(--wi-primary) 12%,transparent);color:var(--wi-primary)}.send-message span{font-weight:700}.send-submit-btn{width:100%;min-height:48px;border:none;border-radius:999px;background:var(--wi-primary);color:var(--wi-primary-contrast, #001410);font:inherit;font-size:15px;font-weight:800;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-submit-btn:hover:not(:disabled):not([data-disabled]){transform:translateY(-1px)}.send-submit-btn:disabled,.send-submit-btn[data-disabled]{cursor:not-allowed;opacity:.45}.send-footer{flex-shrink:0;padding:14px 24px 24px;border-top:1px solid var(--wi-border-subtle);background:var(--wi-surface-bg)}.send-page--success{background:var(--wi-surface-bg)}.send-success-body{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:32px 24px;text-align:center}.send-success-icon{display:inline-flex;align-items:center;justify-content:center}.send-success-icon[data-pending]{width:56px;height:56px;border-radius:50%;background:color-mix(in srgb,var(--wi-primary) 14%,transparent)}.send-success-spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--wi-primary) 22%,transparent);border-top-color:var(--wi-primary);border-radius:50%;animation:cross-send-spin .8s linear infinite}.send-success-copy{display:flex;flex-direction:column;gap:8px}.send-success-title{margin:0;color:var(--wi-texticon-primary);font-size:22px;font-weight:800;line-height:1.25}.send-success-desc{margin:0;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:600;line-height:1.45}.send-success-hash-card{width:100%;display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);box-sizing:border-box}.send-success-hash-label{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:700;line-height:1.3;text-align:left}.send-success-hash-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;border:none;border-radius:12px;background:var(--wi-surface-subtle);color:var(--wi-texticon-primary);font:inherit;font-size:14px;font-weight:800;padding:12px}.send-success-hash-link{flex:1;display:inline-flex;align-items:center;align-self:stretch;min-width:0;border:none;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;text-align:left;text-decoration:none;cursor:pointer;user-select:none}.send-success-hash-link:hover{color:var(--wi-primary)}.send-success-hash-link:focus-visible,.send-success-copy-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-success-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;border:none;background:transparent;color:var(--wi-primary);font:inherit;font-size:12px;font-weight:800;padding:0;cursor:pointer}@keyframes cross-send-spin{to{transform:rotate(360deg)}}.send-page--review{background:var(--wi-surface-bg)}.send-review-scroll{gap:16px;padding-top:12px}.send-review-amount{display:flex;align-items:center;justify-content:center;gap:4px;padding:12px 0}.send-review-amount-icon{width:32px;height:32px;object-fit:contain;flex-shrink:0}.send-review-amount-value{color:var(--wi-texticon-primary);font-size:26px;font-weight:800;line-height:1.3;letter-spacing:-.01em}.send-review-parties{display:flex;flex-direction:column;gap:4px;width:100%}.send-review-party{display:flex;align-items:flex-start;gap:8px;padding:16px;border-radius:8px;background:var(--wi-surface-subtle)}.send-review-party-label{flex-shrink:0;width:80px;color:var(--wi-texticon-tertiary);font-size:14px;line-height:1.4}.send-review-party-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;align-items:flex-end;text-align:right}.send-review-party-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:700;line-height:1.3}.send-review-party-addr{width:100%;color:var(--wi-texticon-primary);font-size:12px;line-height:1.4;word-break:break-all}.send-review-section{display:flex;flex-direction:column;gap:8px;width:100%}.send-review-section-title{margin:0;color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.6}.send-review-row{display:flex;align-items:flex-start;gap:20px;padding:2px 0}.send-review-row-label{flex-shrink:0;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.send-review-row-value{flex:1;min-width:0;color:var(--wi-texticon-primary);font-size:13px;line-height:1.3;text-align:right;word-break:break-all}.send-review-row-value--accent{color:var(--wi-primary)}.send-review-network{display:inline-flex;align-items:center;gap:4px;justify-content:flex-end}.send-review-network-dot{width:6px;height:6px;border-radius:999px;background:var(--wi-primary);flex-shrink:0}.send-footer--review{display:flex;gap:8px}.send-review-btn{flex:1;min-width:0;min-height:48px;padding:12px 16px;border-radius:12px;font:inherit;font-size:16px;font-weight:700;line-height:1.3;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-review-btn:disabled{cursor:not-allowed;opacity:.55}.send-review-btn--cancel{background:transparent;border:1px solid var(--wi-primary);color:var(--wi-primary)}.send-review-btn--confirm{background:var(--wi-primary);border:1px solid var(--wi-primary);color:var(--wi-primary-contrast, #001410)}.send-review-btn:not(:disabled):hover{transform:translateY(-1px)}
|
|
7
|
-
`);import{Fragment as ji,jsx as f,jsxs as v}from"react/jsx-runtime";var Fi=1500,Di=120;function eo(e){return`${e.chainId}:${e.address.toLowerCase()}`}function Qo(e,t){return e.name||`Account ${(e.index??t)+1}`}function Xo(e){return e.trim().slice(0,1).toUpperCase()||"A"}function Wi(e){return new Promise(t=>setTimeout(t,e))}function Bi(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}function $i(e){return!!(e.token||e.recipient||e.amount)}function oo(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 to(e,t){return oo(e,t,6)}function no(e){return oo(e,9,2)}function Vi(e){return e.toLocaleString("en-US")}function Hi(e){return e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Gi(e){return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function zi(){return v("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[f("path",{d:"M4.5 4.5C4.5 3.67 5.17 3 6 3h8.25c.69 0 1.25.56 1.25 1.25V16.5H6A1.5 1.5 0 0 1 4.5 15V4.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),f("path",{d:"M4.5 14.5C4.5 13.67 5.17 13 6 13h9.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),f("path",{d:"M8 6.5h4M8 9h3",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Ui(){return v("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none","aria-hidden":"true",children:[f("circle",{cx:"28",cy:"28",r:"28",fill:"var(--wi-primary)"}),f("path",{d:"M17 28.5L24.2 35.5L39 20.5",stroke:"var(--wi-primary-contrast, #001410)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({env:e,theme:t="dark",walletAddress:o,accountName:n,accounts:r=[],token:i,tokens:a=[],onTokenChange:c,sendTransaction:d,getTransactionReceipt:l,estimateGas:s,onSuccess:m,onConfirmSuccess:k,onOutlink:b}){let[g,w]=R.useState(""),[h,P]=R.useState(""),[A,I]=R.useState(""),[N,V]=R.useState({}),[y,T]=R.useState(""),[$,C]=R.useState(!1),[U,q]=R.useState(!1),[be,st]=R.useState(!1),[ae,He]=R.useState("account"),Re=R.useRef(void 0),Y=R.useRef(void 0),Ye=R.useRef(null),Qe=R.useRef(null),[ue,Xe]=R.useState(()=>Tt(o)),[xe,X]=R.useState("idle"),[Z,Ae]=R.useState(null),[se,Oe]=R.useState(!1),[ve,pe]=R.useState(""),ye=R.useRef(0),[J,Ee]=R.useState(null),[te,lt]=R.useState(""),ke=jn(i),Je=R.useMemo(()=>BigInt(i.quantity.numeric||"0"),[i.quantity.numeric]),Ge=R.useMemo(()=>bt(i.quantity.numeric,i.quantity.decimals),[i.quantity.numeric,i.quantity.decimals]),ze=R.useMemo(()=>r.filter(u=>u.address.toLowerCase()!==o.toLowerCase()),[r,o]),ct=R.useMemo(()=>{let u=new Map;return ze.forEach((L,M)=>{u.set(L.address.toLowerCase(),{account:L,index:M})}),u},[ze]),Te=ze.length>0,Ue=R.useMemo(()=>ge(e),[e]),Pe=t==="dark"?"1A1A2E":"F3F6F8",et=a.length>0?a:[i],je=et.length>1&&!!c,{transactionUrl:Se,chainInfo:fe}=Uo(Ue,i.chainId,y||void 0,!0),Ie=fe?.currency_symbol??"",Ce=fe?.name??`Chain ID ${i.chainId}`;R.useEffect(()=>{I(""),V({}),T(""),X("idle"),Ae(null),pe(""),Oe(!1),ye.current+=1},[i.address,i.chainId,g,h]),R.useEffect(()=>{P(""),C(!1)},[i.address,i.chainId]),R.useEffect(()=>{Xe(Tt(o))},[o]),R.useEffect(()=>()=>{clearTimeout(Re.current),clearTimeout(Y.current)},[]),R.useEffect(()=>{!Te&&ae==="account"&&He("recent")},[ae,Te]),R.useEffect(()=>{let u=window.visualViewport,L=Ye.current;if(!u||!L)return;let M=()=>{let le=document.activeElement;return L.contains(le)&&(le instanceof HTMLInputElement||le instanceof HTMLTextAreaElement)},S=48,H=()=>{L.style.paddingBottom=""},ne=()=>{if(!M()){H();return}let le=Math.max(0,window.innerHeight-u.height-u.offsetTop);le>0?L.style.paddingBottom=`${le+S}px`:H();let ut=document.activeElement;ut instanceof HTMLElement&&requestAnimationFrame(()=>{let $t=ut.getBoundingClientRect(),on=L.getBoundingClientRect().bottom-le-S,Ht=$t.bottom-on;Ht>0&&L.scrollBy({top:Ht,behavior:"smooth"})})},mt=()=>{setTimeout(()=>{M()||H()},0)};return u.addEventListener("resize",ne),window.addEventListener("resize",ne),L.addEventListener("focusout",mt),()=>{u.removeEventListener("resize",ne),window.removeEventListener("resize",ne),L.removeEventListener("focusout",mt),H()}},[]);let Fe=R.useCallback(()=>{clearTimeout(Y.current),Y.current=setTimeout(()=>{Qe.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},10)},[]),_n=R.useCallback(()=>{P(Qn(i.quantity.numeric,i.quantity.decimals))},[i.quantity.numeric,i.quantity.decimals]),Jt=R.useCallback(u=>{w(u),q(!1)},[]),en=R.useCallback(()=>{let u={},L=g.trim(),M=Yn(h,i.quantity.decimals),S;return L?jt(L)||(u.recipient="Enter a valid EVM recipient address."):u.recipient="Enter a recipient address.","error"in M?u.amount=M.error:(S=M.value,S>Je&&(u.amount="Amount exceeds available balance.")),!ke&&!jt(i.address)&&(u.token="Token contract address is invalid."),{errors:u,rawAmount:S,trimmedRecipient:L}},[h,Je,ke,g,i.address,i.quantity.decimals]),tn=R.useCallback(async()=>{if(y)try{await navigator.clipboard.writeText(y),st(!0),clearTimeout(Re.current),Re.current=setTimeout(()=>st(!1),2e3)}catch{}},[y]),dt=R.useCallback(()=>{if(!Se||!y)return;let u=S=>{typeof window>"u"||window.open(S,"_blank","noopener,noreferrer")};if(!b){u(Se);return}let L=b(Se,{category:"send",origin:"send-transaction",payload:{chainId:i.chainId,txHash:y}});if(L&&(typeof L=="object"||typeof L=="function")&&typeof L.then=="function"){let S=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;L.then(H=>{if(H===null){S?.close();return}let ne=H??Se;if(S)try{S.location.href=ne}catch{S.close(),u(ne)}else u(ne)});return}let M=L;M!==null&&u(M??Se)},[b,i.chainId,Se,y]),pt=R.useCallback((u,L)=>ke?{to:u,value:L,chainId:i.chainId,from:o}:{to:Ut(i.address),data:Xn(u,L),value:0n,chainId:i.chainId,from:o},[ke,i.address,i.chainId,o]),Ct=R.useCallback(async(u,L,M)=>{if(!s&&!M)return;let S=++ye.current;Oe(!0),pe("");try{let H=pt(u,L),ne=s?await s(H):await Ko(M,H);if(ye.current!==S)return;Ae(ne)}catch(H){if(ye.current!==S)return;pe(Jn(H,{nativeSymbol:Ie||void 0,networkName:Ce,tokenSymbol:i.symbol},"Failed to estimate gas."))}finally{ye.current===S&&Oe(!1)}},[pt,s,Ie,Ce,i.symbol]),nn=R.useCallback(u=>{if(u.preventDefault(),I(""),T(""),!d){X("error"),I("Sending is not available for this wallet.");return}let{errors:L,rawAmount:M,trimmedRecipient:S}=en();if(V(L),$i(L)||M===void 0){X("error");return}let H=S;Ee(M),lt(H),Ae(null),pe(""),X("review")},[d,en]);R.useEffect(()=>{xe==="review"&&(!te||J===null||Z===null&&(se||ve||!s&&!fe?.rpc||Ct(te,J,fe?.rpc)))},[fe?.rpc,s,Ct,Z,ve,se,J,te,xe]);let Wt=R.useCallback(async()=>{if(!(!d||!te||J===null)){I(""),T("");try{X("submitting");let u=await d(pt(te,J));if(T(u),X("confirming"),Xe(Zn(o,te)),m?.(u),!l){X("success");return}for(let L=0;L<Di;L+=1){let M=await l({hash:u,chainId:i.chainId}).catch(()=>null);if(M){if(Bi(M)){X("error"),I("Transaction reverted on-chain.");return}X("success");return}await Wi(Fi)}X("error"),I("Transaction receipt was not found. Please check again later.")}catch(u){X("error"),I(Jn(u,{nativeSymbol:Ie||void 0,networkName:Ce,tokenSymbol:i.symbol}))}}},[pt,l,Ie,Ce,m,J,te,d,i.chainId,i.symbol,o]),An=R.useCallback(()=>{ye.current+=1,Ae(null),pe(""),Oe(!1),I(""),X("idle")},[]),Bt=Je<=0n||!g.trim()||!h.trim();if(xe==="review"||xe==="submitting"){let u=xe==="submitting",L=J!==null?oo(J,i.quantity.decimals):h.trim(),M=n?.trim()||`Account ${(r[0]?.index??0)+1}`,S="\u2014",H=Ie||(ke?i.symbol:""),ne=fe?.currency_decimals??(ke?i.quantity.decimals:18),mt=Z?Hi(Z):null,le=Z?Gi(Z):null,ut=le!==null&&H?`${to(le,ne)} ${H}`:S,$t=Z?Vi(Z.gasLimit):S,Vt=Z?.maxPriorityFeePerGas!==void 0?`${no(Z.maxPriorityFeePerGas)} Gwei`:S,on=Z?.maxFeePerGas!==void 0?`${no(Z.maxFeePerGas)} Gwei`:S,Ht=Z?.gasPrice!==void 0?`${no(Z.gasPrice)} Gwei`:S,xo=`${L} ${i.symbol}`,rn=(()=>{if(!Z||le===null)return S;if(ke&&J!==null){let Nt=J+le;return`${to(Nt,ne)} ${H||i.symbol}`}return H?`${to(le,ne)} ${H}`:S})();return v("div",{className:"send-page send-page--review",children:[v("div",{className:"send-scroll send-review-scroll","data-vaul-no-drag":!0,children:[v("div",{className:"send-review-amount",children:[f("img",{className:"send-review-amount-icon",src:i.icon_url,alt:"",width:32,height:32,draggable:!1,onError:Nt=>{Nt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),v("span",{className:"send-review-amount-value",children:[L," ",i.symbol]})]}),v("div",{className:"send-review-parties",children:[v("div",{className:"send-review-party",children:[f("span",{className:"send-review-party-label",children:"From"}),v("div",{className:"send-review-party-info",children:[f("span",{className:"send-review-party-name",children:M}),f("span",{className:"send-review-party-addr",children:o})]})]}),v("div",{className:"send-review-party",children:[f("span",{className:"send-review-party-label",children:"To"}),f("div",{className:"send-review-party-info",children:f("span",{className:"send-review-party-addr",children:te})})]})]}),v("section",{className:"send-review-section",children:[f("h3",{className:"send-review-section-title",children:"Summary"}),v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Network"}),v("span",{className:"send-review-row-value send-review-network",children:[f("span",{className:"send-review-network-dot","aria-hidden":!0}),Ce]})]}),v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Est. Tx Fee"}),f("span",{className:"send-review-row-value",children:se?"\u2026":ut})]}),mt==="dynamic"?v(ji,{children:[v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Max Priority Fee"}),f("span",{className:"send-review-row-value",children:se?"\u2026":Vt})]}),v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Max Gas Fee"}),f("span",{className:"send-review-row-value",children:se?"\u2026":on})]})]}):mt==="legacy"?v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Gas Price"}),f("span",{className:"send-review-row-value",children:se?"\u2026":Ht})]}):null,v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Gas Limit"}),f("span",{className:"send-review-row-value",children:se?"\u2026":$t})]})]}),v("section",{className:"send-review-section",children:[f("h3",{className:"send-review-section-title",children:"Total"}),v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Total Amount"}),f("span",{className:"send-review-row-value",children:xo})]}),v("div",{className:"send-review-row",children:[f("span",{className:"send-review-row-label",children:"Max. Total Amount"}),f("span",{className:"send-review-row-value",children:se?"\u2026":rn})]})]}),ve&&f("div",{className:"send-message send-message--error",role:"alert",children:ve}),A&&f("div",{className:"send-message send-message--error",role:"alert",children:A})]}),v("div",{className:"send-footer send-footer--review",children:[f("button",{type:"button",className:"send-review-btn send-review-btn--cancel",onClick:An,disabled:u,children:"Cancel"}),f("button",{type:"button",className:"send-review-btn send-review-btn--confirm",onClick:Wt,disabled:u,children:u?"Sending...":"Send"})]})]})}if((xe==="confirming"||xe==="success")&&y){let u=xe==="success";return v("div",{className:"send-page send-page--success",children:[v("div",{className:"send-success-body","data-vaul-no-drag":!0,children:[f("div",{className:"send-success-icon","data-pending":!u||void 0,children:u?f(Ui,{}):f("span",{className:"send-success-spinner"})}),v("div",{className:"send-success-copy",children:[f("h3",{className:"send-success-title",children:u?"Transaction Complete":"Transaction in Progress"}),f("p",{className:"send-success-desc",children:u?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),v("div",{className:"send-success-hash-card",children:[f("span",{className:"send-success-hash-label",children:"Transaction Hash"}),v("div",{className:"send-success-hash-row","data-vaul-no-drag":!0,children:[f("button",{type:"button",className:"send-success-hash-link",onClick:dt,"aria-label":"Open transaction in explorer",children:Ne(y)}),f("button",{type:"button",className:"send-success-copy-btn",onClick:tn,"aria-label":"Copy transaction hash",children:be?f(zt,{size:16}):"Copy"})]})]})]}),f("div",{className:"send-footer",children:f("button",{type:"button",className:"send-submit-btn",onClick:k,disabled:!u,children:u?"All done":"Sending..."})})]})}return v("form",{className:"send-page",onSubmit:nn,children:[v("div",{className:"send-scroll","data-vaul-no-drag":!0,ref:Ye,children:[v("section",{className:"send-section","aria-label":"Select token to send",children:[f("span",{className:"send-label",children:"Token"}),v("button",{type:"button",className:"send-asset-card",onClick:()=>{je&&C(u=>!u)},disabled:!je,"aria-expanded":je?$:void 0,children:[v("span",{className:"send-asset-left",children:[f("img",{className:"send-asset-icon",src:i.icon_url,alt:i.symbol,width:40,height:40,draggable:!1,onError:u=>{u.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),v("span",{className:"send-asset-info",children:[f("span",{className:"send-asset-symbol",children:i.symbol}),f("span",{className:"send-asset-name",children:i.name})]})]}),v("span",{className:"send-asset-balance",children:[f("span",{className:"send-balance-label",children:"Available"}),v("span",{className:"send-balance-value",children:[Ge," ",i.symbol]})]})]}),je&&$&&f("div",{className:"send-token-list",role:"listbox",children:et.map(u=>{let L=eo(u)===eo(i);return v("button",{type:"button",role:"option","aria-selected":L,className:"send-token-option","data-selected":L||void 0,onClick:()=>c?.(u),children:[v("span",{className:"send-asset-left",children:[f("img",{className:"send-token-option-icon",src:u.icon_url,alt:u.symbol,width:28,height:28,draggable:!1,onError:M=>{M.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),v("span",{className:"send-asset-info",children:[f("span",{className:"send-token-option-symbol",children:u.symbol}),f("span",{className:"send-asset-name",children:u.name})]})]}),f("span",{className:"send-token-option-balance",children:bt(u.quantity.numeric,u.quantity.decimals)})]},eo(u))})}),N.token&&f("p",{className:"send-field-error",role:"alert",children:N.token})]}),v("section",{className:"send-field","aria-label":"Recipient address",children:[f("span",{className:"send-label",children:"To"}),v("div",{className:"send-address-wrap","data-invalid":N.recipient||void 0,children:[f("input",{className:"send-input send-input--address",value:g,onChange:u=>w(u.target.value),placeholder:"0x...",autoComplete:"off",spellCheck:!1,"aria-invalid":!!N.recipient,"aria-describedby":N.recipient?"send-recipient-error":void 0}),f("button",{type:"button",className:"send-address-book-btn",onClick:()=>q(u=>!u),"aria-label":"Open address book","aria-expanded":U,children:f(zi,{})})]}),N.recipient&&f("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:N.recipient}),U&&v("div",{className:"send-address-picker",children:[v("div",{className:"send-address-tabs",role:"tablist",children:[Te&&f("button",{type:"button",role:"tab",className:"send-address-tab","data-active":ae==="account"||void 0,"aria-selected":ae==="account",onClick:()=>He("account"),children:"My Account"}),f("button",{type:"button",role:"tab",className:"send-address-tab","data-active":ae==="recent"||void 0,"aria-selected":ae==="recent",onClick:()=>He("recent"),children:"Recent"})]}),Te&&ae==="account"?f("div",{className:"send-address-list",children:ze.map((u,L)=>{let M=Qo(u,L),S=xt(Ue,u.address,{size:56,bg:Pe});return v("button",{type:"button",className:"send-address-option",onClick:()=>Jt(u.address),children:[v("span",{className:"send-address-avatar","aria-hidden":!0,children:[S&&f("img",{className:"send-address-avatar-img",src:S,alt:"",width:36,height:36,draggable:!1,onError:H=>{H.currentTarget.style.display="none"}}),f("span",{className:"send-address-avatar-fallback",children:Xo(M)})]}),v("span",{className:"send-address-copy",children:[f("span",{className:"send-address-name",children:M}),f("span",{className:"send-address-value",children:Ne(u.address)})]})]},u.address)})}):ue.length>0?f("div",{className:"send-address-list",children:ue.map(u=>{let L=ct.get(u.address.toLowerCase()),M=L?Qo(L.account,L.index):void 0,S=xt(Ue,u.address,{size:56,bg:Pe});return v("button",{type:"button",className:"send-address-option",onClick:()=>Jt(u.address),children:[v("span",{className:"send-address-avatar","aria-hidden":!0,children:[S&&f("img",{className:"send-address-avatar-img",src:S,alt:"",width:36,height:36,draggable:!1,onError:H=>{H.currentTarget.style.display="none"}}),f("span",{className:"send-address-avatar-fallback",children:M?Xo(M):u.address.slice(2,4).toUpperCase()})]}),v("span",{className:"send-address-copy",children:[f("span",{className:"send-address-name",children:M??Ne(u.address)}),f("span",{className:"send-address-value",children:L?Ne(L.account.address):"Recently sent"})]})]},u.address)})}):f("div",{className:"send-address-empty",children:"No Send History"})]})]}),v("section",{className:"send-field","aria-labelledby":"send-amount-label",children:[v("span",{className:"send-label-row",children:[f("span",{id:"send-amount-label",className:"send-label",children:"Amount"}),f("button",{type:"button",className:"send-max-btn",onClick:_n,disabled:Je<=0n,children:"Max"})]}),v("div",{className:"send-amount-wrap","data-invalid":N.amount||void 0,children:[f("input",{ref:Qe,className:"send-input send-input--amount",value:h,onChange:u=>P(u.target.value),onFocus:Fe,placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!N.amount,"aria-describedby":N.amount?"send-amount-error":void 0}),f("span",{className:"send-amount-symbol",children:i.symbol})]}),N.amount&&f("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:N.amount})]}),v("div",{className:"send-meta",children:[f("span",{children:"From"}),f("span",{children:Ne(o)})]}),v("div",{className:"send-meta",children:[f("span",{children:"Network"}),v("span",{children:["Chain ID ",i.chainId]})]}),A&&f("div",{className:"send-message send-message--error",role:"alert",children:A})]}),f("div",{className:"send-footer",children:f("button",{type:"submit",className:"send-submit-btn","data-disabled":Bt||void 0,"aria-disabled":Bt,children:"Send"})})]})}import*as Jo from"@radix-ui/react-popover";import{Drawer as qi}from"vaul";import{jsx as gn,jsxs as Zi}from"react/jsx-runtime";function er({asChild:e,className:t,children:o}){let{isMobile:n,theme:r,walletAddress:i}=tt(),a=o!=null,c=e??!0,d=a?o:Zi("button",{type:"button",className:K("wi-trigger-btn",t),"data-theme":r,"data-mobile":n||void 0,children:[gn(Oo,{size:n?14:16}),gn("span",{className:"wi-trigger-address",children:Ne(i)})]});return n?gn(qi.Trigger,{asChild:c,children:d}):gn(Jo.Trigger,{asChild:c,children:d})}import*as B from"react";import*as Cn from"@radix-ui/react-popover";import{Drawer as kn}from"vaul";import Kt from"bignumber.js";import{useQueries as Ki}from"@tanstack/react-query";import{useMemo as Yi}from"react";var ro="user-balance";async function Qi(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 Pt(e,t,o=!0){let n=Le[e],r=me[e],i=[r.cross,r.bsc],a=Ki({queries:i.map(s=>({queryKey:[ro,e,t,s],queryFn:({signal:m})=>Qi(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:Yi(()=>{let s=[];for(let m of a)m.data&&s.push(...m.data);return s},[a]),isLoading:c,isError:d}}import{useQuery as Xi,useQueries as Ji}from"@tanstack/react-query";import{useMemo as ea}from"react";var ta="forge-holdings",na="forge-token-image";async function oa(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 ra(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 tr(e,t,o=!0){let n=Vn[e],{data:r,...i}=Xi({queryKey:[ta,e,t],queryFn:({signal:a})=>oa(n,t,a),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1});return{holdings:r??[],...i}}function nr(e,t,o=!0){let n=Vn[e],r=Ji({queries:t.map(a=>({queryKey:[na,e,a],queryFn:({signal:c})=>ra(n,a,c),enabled:o,staleTime:1/0}))});return{imageMap:ea(()=>{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 ia}from"@tanstack/react-query";import{useMemo as aa}from"react";var io="token-stats";function vt(e,t){return`${e}:${t.toLowerCase()}`}function St(e,t=!0){let o=Le[e],{data:n,...r}=ia({queryKey:[io,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:aa(()=>{let a=new Map;if(!n?.data)return a;for(let c of n.data){let d=vt(c.chain_id,c.address);a.set(d,c)}return a},[n]),...r}}import{useQuery as sa}from"@tanstack/react-query";import{useMemo as la}from"react";var ca="token-info";function ao(e,t){return`${t.toLowerCase()}_${e}`}function or(e,t=!0){let o=Le[e],{data:n,...r}=sa({queryKey:[ca,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:la(()=>{let a=new Map;if(!n?.data)return a;for(let c of n.data){let d=ao(c.chain_id,c.address);a.set(d,c.category)}return a},[n]),...r}}import{useMemo as da}from"react";import so from"bignumber.js";function rr(e,t,o){let{tokens:n,isLoading:r}=Pt(e,t,o),{statsMap:i}=St(e,o);return da(()=>{let a=new so(0);for(let s of n){let m=i.get(vt(s.chainId,s.address));if(!m)continue;let b=new so(s.quantity.numeric).shiftedBy(-s.quantity.decimals).multipliedBy(new so(m.price));b.isNaN()||(a=a.plus(b))}let c=a.toFixed(),{displayValue:d,isLowerBound:l}=_o(c);return{totalUsd:c,displayValue:d,isLowerBound:l,isLoading:r}},[n,i,r])}import{QRCodeSVG as qa}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 k=m??t;if(l)try{l.location.href=k}catch{l.close(),i(k)}else i(k)};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 kt from"react";import{Drawer as Ua}from"vaul";import{createContext as pa,useContext as ma}from"react";var qt=pa(null);function re(){let e=ma(qt);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as ua}from"vaul";import{jsx as ir}from"react/jsx-runtime";function ar({asChild:e,children:t}){let{walletAddress:o}=re(),n=t!=null,r=e??!0,i=n?t:ir("button",{type:"button",children:Ne(o)});return ir(ua.Trigger,{asChild:r,children:i})}import{Drawer as yn}from"vaul";import*as _e from"react";import{useQueryClient as Ha}from"@tanstack/react-query";import{useMemo as xa}from"react";import lo from"bignumber.js";import{useQuery as fa}from"@tanstack/react-query";import{useMemo as cr}from"react";var wn={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"},sr={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},hn={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"},nt={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Be={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"},lr={dev:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},stage:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},production:{cross:"https://dex-api.crosstoken.io/dex",crossd:"https://crossd-dex-api.crosstoken.io/dex",forge:"https://forge-dex-api.crosstoken.io/dex"}};var ga="wp:reward-pools";function bn(e,t=!0){let o=wn[e],{data:n,...r}=fa({queryKey:[ga,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=cr(()=>n?.data.pools.filter(c=>c.pool_type==="CrossPool")??[],[n]),a=cr(()=>n?.data.pools.filter(c=>c.pool_type==="GamePool")??[],[n]);return{crossPools:i,gamePools:a,allPools:n?.data.pools??[],...r}}import{useQuery as wa}from"@tanstack/react-query";import{useMemo as ha}from"react";var ba="wp:user-deposits";function xn(e,t,o=!0){let n=wn[e],r=o&&!!t,{data:i,...a}=wa({queryKey:[ba,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:ha(()=>{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}}import{useQuery as dr}from"@tanstack/react-query";import{useMemo as pr}from"react";function $e(e,t,o,n=!0){let r=lr[e][t],i=n&&!!o,{data:a,...c}=dr({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:g})=>{let w=await fetch(`${r}/pair-info`,{cache:"no-store",signal:g});if(!w.ok)throw new Error(`pair-info fetch failed: ${w.status}`);let h=await w.json();if(h.code!==200)throw new Error(`pair-info API error: ${h.code}`);return h},enabled:n,staleTime:0}),d=a?.data??[],l=pr(()=>{let g=new Map;for(let w of d)g.set(w.pair_address.toLowerCase(),w);return g},[d]),{data:s,...m}=dr({queryKey:["wp:dex-orders",e,t,o],queryFn:async({signal:g})=>{let w=Math.floor(Date.now()/1e3),h=new URLSearchParams({owner:o,size:"200",start_date:"0",end_date:String(w)}),P=await fetch(`${r}/open-order?${h}`,{cache:"no-store",signal:g});if(!P.ok)throw new Error(`open-order fetch failed: ${P.status}`);let A=await P.json();if(A.code!==200)throw new Error(`open-order API error: ${A.code}`);return A.data?.data??[]},enabled:i,staleTime:0}),k=s??[],b=pr(()=>{let g=new Map;for(let w of k){let h=w.pair.toLowerCase();g.has(h)||g.set(h,{buys:[],sells:[]});let P=g.get(h);w.order_side===1?P.buys.push(w):P.sells.push(w)}return g},[k]);return{allPairs:d,pairMap:l,orders:k,ordersByPair:b,isEmpty:k.length===0,isLoading:c.isLoading||m.isLoading}}var va=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],mr="var(--wp-green)",ur=4;function fr(e,t,o=!0){let n=o&&!!t,{allPools:r}=bn(e,n),{depositMap:i}=xn(e,t,n),{allPairs:a,pairMap:c,ordersByPair:d}=$e(e,"cross",t,n),{allPairs:l,pairMap:s,ordersByPair:m}=$e(e,"crossd",t,n),{allPairs:k,pairMap:b,ordersByPair:g}=$e(e,"forge",t,n);return xa(()=>{let w=new Map,h=new Map,P=(y,T)=>{!Number.isFinite(T)||T<=0||h.set(y,(h.get(y)??0)+T)};for(let y of r){let T=Number(y.deposit_token.price);T>0&&w.set(y.deposit_token.symbol,T);for(let $ of y.reward_tokens){let C=Number($.price);C>0&&w.set($.symbol,C)}}for(let y of[...a,...l,...k]){let T=w.get(y.quote_symbol),$=Number(y.billboard?.price);T&&$>0&&!w.has(y.base_symbol)&&w.set(y.base_symbol,$*T)}for(let y of r){let T=i.get(y.pool_address.toLowerCase());if(!T)continue;let $=new lo(T.deposited_amount).shiftedBy(-y.deposit_token.decimals).toNumber();if(P(y.deposit_token.symbol,$),y.reward_tokens.length>0){let C=y.reward_tokens[0],U=new lo(T.claimable_reward).shiftedBy(-C.decimals).toNumber();P(C.symbol,U)}}let A=[{pairMap:c,ordersByPair:d},{pairMap:s,ordersByPair:m},{pairMap:b,ordersByPair:g}];for(let{pairMap:y,ordersByPair:T}of A)for(let[$,C]of T){let U=y.get($);if(U){for(let q of C.buys){let be=Number(q.amount)-Number(q.filled);P(U.quote_symbol,be*Number(q.price))}for(let q of C.sells){let be=Number(q.amount)-Number(q.filled);P(U.base_symbol,be)}}}let I=[],N=0;for(let[y,T]of h){let $=w.get(y)??0,C=T*$;C>0&&(I.push({symbol:y,usdValue:C}),N+=C)}I.sort((y,T)=>T.usdValue-y.usdValue);let V=[];if(N>0){let y=I.slice(0,ur),T=I.slice(ur);for(let C=0;C<y.length;C++)V.push({symbol:y[C].symbol,usdValue:y[C].usdValue,percentage:Math.round(y[C].usdValue/N*100),color:va[C]??mr});if(T.length>0){let C=T.reduce((U,q)=>U+q.usdValue,0);V.push({symbol:"Others",usdValue:C,percentage:Math.round(C/N*100),color:mr})}let $=V.reduce((C,U)=>C+U.percentage,0);$!==100&&V.length>0&&(V[0].percentage+=100-$)}return{totalUsd:N,formattedTotal:N>0?`$${new lo(N).toFormat(2)}`:"$0.00",segments:V}},[r,i,a,c,d,l,s,m,k,b,g])}import{jsx as It,jsxs as ya}from"react/jsx-runtime";function gr({size:e=22,className:t}){return It("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:It("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function wr({size:e=22,className:t}){return ya("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[It("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),It("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 hr({size:e=12,className:t}){return It("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:It("path",{d:"M6 11A5 5 0 106 1a5 5 0 000 10zM6 8V6M6 4h.005",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}import{useQuery as ka}from"@tanstack/react-query";import{useMemo as Ca}from"react";var Na="wp:token-info";function ot(e,t=!0){let o=Le[e],n=me[e].cross,{data:r,...i}=ka({queryKey:[Na,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}=Ca(()=>{let l=new Map,s=new Map;if(!r?.data)return{byChainAddr:l,byChainSym:s};for(let m of r.data){let k=m.address.toLowerCase();l.set(`${m.chain_id}:${k}`,m),l.set(k,m);let b=m.symbol.replace(/^t/,"").toUpperCase(),g=`${m.chain_id}:${b}`;s.has(g)||s.set(g,m),s.has(b)||s.set(b,m)}return{byChainAddr:l,byChainSym:s}},[r]);return{getTokenImage:(l,s)=>{let m=l.toLowerCase(),k=a.get(`${n}:${m}`);if(k?.image)return k.image;let b=a.get(m);if(b?.image)return b.image;if(s){let g=s.replace(/^t/,"").toUpperCase(),w=c.get(`${n}:${g}`);if(w?.image)return w.image;let h=c.get(g);if(h?.image)return h.image}return""},...i}}import{jsx as vn,jsxs as br}from"react/jsx-runtime";function Ve({title:e,icon:t,iconFit:o="cover",isEmpty:n,children:r}){return br("div",{className:"wp-svc-card",children:[br("div",{className:"wp-svc-card-head",children:[vn("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:o}}),vn("span",{className:"wp-svc-card-title",children:e})]}),n?vn("div",{className:"wp-svc-empty",children:"No assets yet"}):vn("div",{className:"wp-svc-items",children:r})]})}import Zt from"bignumber.js";import{jsx as yt,jsxs as qe}from"react/jsx-runtime";var La="CROSS Rewards";function xr(e,t){let o=new Zt(e).shiftedBy(-t);return o.isZero()?"0":o.isGreaterThanOrEqualTo(1)?o.toFormat(2,Zt.ROUND_DOWN):o.toFormat(4,Zt.ROUND_DOWN)}function vr(){let{env:e,walletAddress:t,onOutlink:o}=re(),n=!!t,{allPools:r}=bn(e,n),{depositMap:i}=xn(e,t,n),{getTokenImage:a}=ot(e,n),c=s=>`${sr[e]}/rewards/${s.pool_address}?action=withdraw`,d=`${Be[e]}/reward.png`,l=r.filter(s=>{let m=i.get(s.pool_address.toLowerCase()),k=m?.deposited_amount??"0",b=m?.claimable_reward??"0";return!(new Zt(k).isZero()&&new Zt(b).isZero())});return yt(Ve,{title:La,icon:d,isEmpty:l.length===0,children:l.map(s=>{let m=i.get(s.pool_address.toLowerCase()),k=m?.deposited_amount??"0",b=c(s);return qe("a",{className:"wp-item","data-side":"reward",href:b,target:"_blank",rel:"noopener noreferrer",onClick:g=>We(g,b,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:s,userDeposit:m}},o),children:[qe("div",{className:"wp-item-body",children:[qe("div",{className:"wp-item-field",children:[qe("span",{className:"wp-item-label",children:["Deposited (",s.deposit_token.symbol,")"]}),qe("div",{className:"wp-svc-token",children:[a(s.deposit_token.address,s.deposit_token.symbol)&&yt("img",{className:"wp-svc-token-icon",src:a(s.deposit_token.address,s.deposit_token.symbol),alt:""}),yt("span",{children:xr(k,s.deposit_token.decimals)})]})]}),qe("div",{className:"wp-item-field",children:[qe("span",{className:"wp-item-label",children:["Rewards (",s.reward_tokens.map(g=>g.symbol).join(", "),")"]}),s.reward_tokens.map(g=>{let w=a(g.address,g.symbol);return qe("div",{className:"wp-svc-token",children:[w&&yt("img",{className:"wp-svc-token-icon",src:w,alt:""}),yt("span",{children:m?xr(m.claimable_reward,g.decimals):"0"})]},g.address)})]})]}),qe("div",{className:"wp-item-badges",children:[yt("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),yt("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},s.pool_address)})})}import kr from"bignumber.js";import{Fragment as Ra,jsx as he,jsxs as ie}from"react/jsx-runtime";function co(e){let t=new kr(e);if(t.isNaN())return e;let o=t.decimalPlaces()??0;return t.toFormat(o)}function yr(e){let t=new kr(e.amount).minus(e.filled);return co(t.toString())}function Mt({market:e,pairMap:t,ordersByPair:o,getDexUrl:n,getTokenImage:r}){let{onOutlink:i}=re(),a=[];for(let[c,d]of o){let l=t.get(c),s=l?r(l.base_address,l.base_symbol):"",m=l?r(l.quote_address,l.quote_symbol):"",k=n(c);for(let b of d.buys)a.push(ie("a",{className:"wp-item","data-side":"buy",href:k,target:"_blank",rel:"noopener noreferrer",onClick:g=>We(g,k,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"buy",order:b,pair:l}},i),children:[ie("div",{className:"wp-item-body",children:[ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label wp-item-label--buy",children:["Buy",l?.base_symbol?` (${l.base_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[s&&he("img",{className:"wp-svc-token-icon",src:s,alt:""}),he("span",{children:yr(b)})]})]}),ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:["Price",l?.quote_symbol?` (${l.quote_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[m&&he("img",{className:"wp-svc-token-icon",src:m,alt:""}),he("span",{children:co(b.price)})]})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`buy-${b.order_id}`));for(let b of d.sells)a.push(ie("a",{className:"wp-item","data-side":"sell",href:k,target:"_blank",rel:"noopener noreferrer",onClick:g=>We(g,k,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:"sell",order:b,pair:l}},i),children:[ie("div",{className:"wp-item-body",children:[ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label wp-item-label--sell",children:["Sell",l?.base_symbol?` (${l.base_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[s&&he("img",{className:"wp-svc-token-icon",src:s,alt:""}),he("span",{children:yr(b)})]})]}),ie("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:["Price",l?.quote_symbol?` (${l.quote_symbol})`:""]}),ie("div",{className:"wp-svc-token",children:[m&&he("img",{className:"wp-svc-token-icon",src:m,alt:""}),he("span",{children:co(b.price)})]})]})]}),he("div",{className:"wp-item-badges",children:he("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${b.order_id}`))}return he(Ra,{children:a})}import{jsx as Cr}from"react/jsx-runtime";var Ea="Gametoken - CROSS";function Nr(){let{env:e,walletAddress:t}=re(),o=!!t,{pairMap:n,ordersByPair:r,isEmpty:i}=$e(e,"cross",t,o),{getTokenImage:a}=ot(e,o),c=l=>{let s=n.get(l.toLowerCase());return`${nt[e]}/gametoken/cross/${s?.base_symbol??""}`},d=`${Be[e]}/dex.png`;return Cr(Ve,{title:Ea,icon:d,isEmpty:i,children:Cr(Mt,{market:"cross",pairMap:n,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import{jsx as Lr}from"react/jsx-runtime";var Ta="Gametoken - CROSSD";function Rr(){let{env:e,walletAddress:t}=re(),o=!!t,{pairMap:n,ordersByPair:r,isEmpty:i}=$e(e,"crossd",t,o),{getTokenImage:a}=ot(e,o),c=l=>{let s=n.get(l.toLowerCase());return`${nt[e]}/gametoken/crossd/${s?.base_symbol??""}`},d=`${Be[e]}/dex.png`;return Lr(Ve,{title:Ta,icon:d,isEmpty:i,children:Lr(Mt,{market:"crossd",pairMap:n,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import{jsx as Er}from"react/jsx-runtime";var Pa="Gametoken - Forge";function Tr(){let{env:e,walletAddress:t}=re(),o=!!t,{pairMap:n,ordersByPair:r,isEmpty:i}=$e(e,"forge",t,o),{getTokenImage:a}=ot(e,o);if(i)return null;let c=l=>{let s=n.get(l.toLowerCase());return`${nt[e]}/gametoken/forge/${s?.base_symbol??""}`},d=`${Be[e]}/dex.png`;return Er(Ve,{title:Pa,icon:d,isEmpty:i,children:Er(Mt,{market:"forge",pairMap:n,ordersByPair:r,getDexUrl:c,getTokenImage:a})})}import po from"bignumber.js";import{useMemo as Fa}from"react";import{useQuery as Sa}from"@tanstack/react-query";var Ia="wp:forge-pools";function Pr(e,t,o=!0){let n=hn[e],r=o&&!!t,{data:i,...a}=Sa({queryKey:[Ia,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 Ma}from"@tanstack/react-query";import{useMemo as _a}from"react";var Aa="wp:forge-token-detail";async function Oa(e,t){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return o.ok?(await o.json())?.data?.token??null:null}function Sr(e,t,o=!0){let n=hn[e],r=Ma({queries:t.map(c=>({queryKey:[Aa,e,c],queryFn:()=>Oa(n,c),enabled:o&&!!c,staleTime:3e4}))}),i=_a(()=>{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 Me,jsxs as _t}from"react/jsx-runtime";var Da="Forge",Wa=18,Ba="https://contents.crosstoken.io/wallet/token/images/FT.png";function $a(e){if(!e||e==="0")return"0";let t=new po(e).shiftedBy(-Wa);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,po.ROUND_DOWN):t.toFormat(4,po.ROUND_DOWN)}function Va(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 Ir(){let{env:e,walletAddress:t,onOutlink:o}=re(),n=!!t,{pools:r,isEmpty:i}=Pr(e,t,n),a=Fa(()=>r.map(s=>s.token.address),[r]),{detailMap:c}=Sr(e,a,n&&a.length>0),d=s=>`${nt[e]}/forge/token/${s.token.address}`,l=`${Be[e]}/forge.png`;return Me(Ve,{title:Da,icon:l,iconFit:"contain",isEmpty:i,children:r.map(s=>{let m=c.get(s.token.address.toLowerCase()),k=m?.image_url||m?.image||s.token.image||Ba,b=m?.symbol||s.token.symbol,g=d(s);return _t("a",{className:"wp-item","data-side":"lp",href:g,target:"_blank",rel:"noopener noreferrer",onClick:w=>We(w,g,{category:"portfolio",origin:"portfolio-forge",payload:{pool:s,tokenDetail:m}},o),children:[_t("div",{className:"wp-item-body",children:[_t("div",{className:"wp-item-field",children:[_t("span",{className:"wp-item-label",children:["Pair (",b,")"]}),Me("div",{className:"wp-svc-token",children:Me("img",{className:"wp-svc-token-icon",src:k,alt:""})})]}),_t("div",{className:"wp-item-field",children:[Me("span",{className:"wp-item-label",children:"LP Balance"}),Me("div",{className:"wp-svc-token",children:Me("span",{children:$a(s.lp_balance)})})]}),_t("div",{className:"wp-item-field",children:[Me("span",{className:"wp-item-label",children:"Ownership"}),Me("div",{className:"wp-svc-token",children:Me("span",{children:Va(s.pool_ownership)})})]})]}),Me("div",{className:"wp-item-badges",children:Me("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},s.pair_address)})})}O(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--cck-surface-bg, #202530);--wp-card: var(--cck-surface-default, #292f40);--wp-border: var(--cck-border-default, #313b51);--wp-text: var(--cck-texticon-primary, #ffffff);--wp-text-60: var(--cck-texticon-secondary, #d3d7df);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #717d97);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.wp-fullscreen[data-theme=light],.wp-embed[data-theme=light]{--wp-bg: var(--cck-surface-bg, #f5f6f8);--wp-card: var(--cck-surface-default, #ffffff);--wp-border: var(--cck-border-default, #e2e5ea);--wp-text: var(--cck-texticon-primary, #202530);--wp-text-60: var(--cck-texticon-secondary, #49556e);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #a0a9b8);--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased}.wp-embed{width:100%;height:100%;min-height:0;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;font-family:inherit;font-feature-settings:"calt" 0,"lnum" 1,"pnum" 1;box-sizing:border-box;-webkit-font-smoothing:antialiased;color:var(--wp-text)}.wp-overlay{position:fixed;inset:0;z-index:49;background:#0009}.wp-header{display:flex;align-items:center;gap:20px;height:60px;padding:0 20px;flex-shrink:0}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-text);flex-shrink:0}.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:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-text);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:rgba(255,255,255,.08) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:4px}.wp-body-inner{padding:16px 16px 128px;display:flex;flex-direction:column;gap:20px}.wp-svc-card{display:flex;flex-direction:column;gap:8px}.wp-svc-card-head{display:flex;align-items:center;gap:8px}.wp-svc-card-icon{width:20px;height:20px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:14px;font-weight:600;line-height:1.3;color:var(--wp-text-60);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wp-svc-items{display:flex;flex-direction:column;gap:10px}.wp-item{position:relative;background:var(--wp-card);border-radius:12px;padding:14px 40px 14px 16px;display:flex;flex-direction:column;gap:6px;box-shadow:0 1px 3px #00000014,0 2px 8px #0000000a;overflow:hidden;text-decoration:none;cursor:pointer;transition:box-shadow .2s ease,transform .15s ease}.wp-item:hover{box-shadow:0 2px 6px #0000001f,0 4px 14px #0000000f;transform:translateY(-1px)}.wp-item:active{transform:translateY(0);box-shadow:0 1px 3px #00000014}.wp-item:before{content:"";position:absolute;top:0;left:0;width:3px;height:100%;border-radius:3px 0 0 3px;background:var(--wp-border)}.wp-item:after{content:"";position:absolute;right:14px;top:50%;transform:translateY(-50%);width:12px;height:12px;background:currentColor;opacity:.25;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 1.5h7v7M10.5 1.5L1.5 10.5' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;transition:opacity .15s}.wp-item:hover:after{opacity:.5}.wp-item[data-side=buy]:before{background:var(--wp-green)}.wp-item[data-side=sell]:before{background:var(--wp-red)}.wp-item[data-side=reward]:before{background:var(--wp-mint)}.wp-item[data-side=lp]:before{background:var(--wp-purple)}.wp-item-body{display:flex;gap:12px}.wp-item-field{flex:1;display:flex;flex-direction:column;gap:4px;min-width:0}.wp-item-label{font-size:11px;font-weight:500;line-height:1.3;color:var(--wp-text-40);letter-spacing:.03em;text-transform:uppercase}.wp-item-label--buy{color:var(--wp-green)}.wp-item-label--sell{color:var(--wp-red)}.wp-svc-token{display:flex;align-items:center;gap:8px;min-width:0}.wp-svc-token>span{font-size:14px;font-weight:600;line-height:1.4;color:var(--wp-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-svc-token-icon{width:22px;height:22px;border-radius:50%;flex-shrink:0;object-fit:cover}.wp-svc-buy{color:var(--wp-green)}.wp-svc-sell{color:var(--wp-red)}.wp-badge{display:inline-flex;align-items:center;font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:2px 7px;border-radius:4px;border:1px solid transparent;pointer-events:none}.wp-badge--mint{color:var(--wp-mint);background:#00d4aa1a;border-color:#00d4aa40}.wp-badge--muted{color:var(--wp-text-40);background:#8c97ad14;border-color:#8c97ad2e}.wp-badge--red{color:var(--wp-red);background:#e7007714;border-color:#e7007733}.wp-item-badges{display:flex;align-items:center;gap:6px}.wp-svc-empty{display:flex;align-items:center;justify-content:center;height:56px;background:var(--wp-card);border-radius:12px;font-size:13px;font-weight:400;color:var(--wp-text-30);box-shadow:0 1px 3px #00000014}@media(max-width:375px){.wp-header{gap:12px;padding:0 12px}.wp-top{padding:0 12px 12px;gap:12px}.wp-total{font-size:22px}.wp-legend{gap:10px}.wp-legend-label{font-size:11px}.wp-body-inner{padding:12px 12px 128px;gap:14px}.wp-svc-items{gap:8px}.wp-item{padding:12px 36px 12px 14px;gap:6px;border-radius:10px}.wp-item:after{right:10px;width:11px;height:11px}.wp-item-body{gap:10px}.wp-svc-token{gap:6px}.wp-svc-token>span{font-size:13px}.wp-svc-token-icon{width:20px;height:20px}}.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}
|
|
8
|
-
`);import{Fragment as za,jsx as z,jsxs as Ze}from"react/jsx-runtime";var mo=5,Ga="wp:";function At({env:e,theme:t="dark",walletAddress:o,walletName:n,onBack:r,showHeader:i=!0,variant:a="embed",className:c,sendTransaction:d,getTransactionReceipt:l,onOutlink:s}){let m=ge(e),k=!!o,b=Ha(),{segments:g}=fr(m,o,k),[w,h]=_e.useState(mo),[P,A]=_e.useState(!1),I=_e.useCallback(()=>{b.invalidateQueries({predicate:C=>typeof C.queryKey[0]=="string"&&C.queryKey[0].startsWith(Ga)})},[b]),N=_e.useCallback(()=>{I(),A(!0),setTimeout(()=>A(!1),600),h(mo)},[I]);_e.useEffect(()=>{if(!k)return;let C=setInterval(()=>{h(U=>U<=1?(N(),mo):U-1)},1e3);return()=>clearInterval(C)},[k,N]);let V=_e.useCallback(()=>{r?.()},[r]),y=k?xt(m,o,{size:64}):void 0,T=_e.useMemo(()=>({env:m,theme:t,open:!0,walletAddress:o,close:V,sendTransaction:d,getTransactionReceipt:l,onOutlink:s}),[m,t,o,V,d,l,s]),$=Ze(za,{children:[i&&Ze("div",{className:"wp-header",children:[Ze("div",{className:"wp-header-account",children:[r?z("button",{type:"button",className:"wp-header-btn",onClick:r,children:z(gr,{})}):z("span",{className:"wp-header-avatar","aria-hidden":!0,children:y&&z("img",{src:y,alt:"",className:"wp-header-avatar-img",draggable:!1})}),n&&z("span",{className:"wp-header-wallet-name",title:n,children:n})]}),Ze("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:N,children:[z(wr,{className:P?"wp-spin-once":void 0}),k&&z("span",{className:"wp-refresh-badge",children:w})]})]}),z("div",{className:"wp-top",children:g.length>0&&Ze("div",{className:"wp-asset",children:[Ze("div",{className:"wp-asset-head",children:[z("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),z("span",{className:"wp-asset-head-icon",children:z(hr,{})})]}),z("div",{className:"wp-bar",children:g.map(C=>z("div",{className:"wp-bar-seg",style:{flex:`${C.percentage} 0 0`,background:C.color},children:C.percentage>=5&&Ze("span",{className:"wp-bar-seg-pct",children:[C.percentage,"%"]})},C.symbol))}),z("div",{className:"wp-legend",children:g.map(C=>Ze("div",{className:"wp-legend-item",children:[z("span",{className:"wp-legend-dot",style:{background:C.color}}),z("span",{className:"wp-legend-label",children:C.symbol})]},C.symbol))})]})}),z("div",{className:"wp-body",children:Ze("div",{className:"wp-body-inner",children:[z(vr,{}),z(Nr,{}),z(Rr,{}),z(Tr,{}),z(Ir,{})]})})]});return z(qt.Provider,{value:T,children:a==="none"?$:z("div",{className:K(a==="fullscreen"?"wp-fullscreen":"wp-embed",c),"data-theme":t,children:$})})}import{jsx as uo,jsxs as Mr}from"react/jsx-runtime";function _r({className:e}){let{env:t,theme:o,walletAddress:n,close:r,sendTransaction:i}=re();return Mr(yn.Portal,{children:[uo(yn.Overlay,{className:"wp-overlay"}),Mr(yn.Content,{className:K("wp-fullscreen",e),"data-theme":o,children:[uo(yn.Title,{className:"wp-sr-only",children:"My Portfolio"}),uo(At,{env:t,theme:o,walletAddress:n,onBack:r,variant:"none",sendTransaction:i})]})]})}import{jsx as Ar}from"react/jsx-runtime";function ja({env:e,theme:t="dark",walletAddress:o,open:n,onOpenChange:r,sendTransaction:i,onOutlink:a,children:c}){let d=ge(e),l=n!==void 0,[s,m]=kt.useState(!1),k=l?n:s,b=kt.useCallback(h=>{l||m(h),r?.(h)},[l,r]),g=kt.useCallback(()=>b(!1),[b]),w=kt.useMemo(()=>({env:d,theme:t,open:k,walletAddress:o,close:g,sendTransaction:i,onOutlink:a}),[d,t,k,o,g,i,a]);return Ar(qt.Provider,{value:w,children:Ar(Ua.Root,{direction:"bottom",open:k,onOpenChange:b,noBodyStyles:!0,children:c})})}var Or=Object.assign(ja,{Trigger:ar,Content:_r});import{Fragment as go,jsx as p,jsxs as E}from"react/jsx-runtime";function fo(e,t,o){let n=me[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 Za(e){return parseInt(e.split(":")[1],10)}function Ka(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function Ya(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 Fr({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:k,showQR:b,qrLogoSrc:g,walletAddress:w,accountName:h,sendAccounts:P,profileImageUrl:A,preferredTokens:I,close:N,onSelectWallet:V,onCopyAddress:y,onDisconnect:T,disconnectLabel:$,termsUrl:C,termsLabel:U,privacyUrl:q,privacyLabel:be,portalStyle:st,navContent:ae,navPosition:He,footerContent:Re,view:Y,setView:Ye,selectedSendToken:Qe,setSelectedSendToken:ue,showPortfolio:Xe,portfolioTitle:xe,showTotalAssets:X,totalAssetsLabel:Z,sendTransaction:Ae,getTransactionReceipt:se,estimateGas:Oe,onOutlink:ve}=tt(),{tokens:pe,isLoading:ye}=Pt(r,w,c&&s),{statsMap:J}=St(r,s),{categoryMap:Ee}=or(r,s),te=s&&X,{displayValue:lt,isLowerBound:ke,isLoading:Je}=rr(r,w,c&&te),[Ge,ze]=B.useState(!1),ct=B.useRef(null),[Te,Ue]=B.useState(0),{holdings:Pe,isLoading:et}=tr(r,w,c&&s&&m),je=B.useMemo(()=>Pe.map(x=>x.token),[Pe]),{imageMap:Se}=nr(r,je,m&&Pe.length>0),fe=B.useMemo(()=>{let x=[],F=[],W=[],ee=new Map((I??[]).map((D,Q)=>[`${Za(D.chainId)}:${D.address.toLowerCase()}`,Q]));for(let D of pe){let Q=fo(r,D.chainId,D.symbol)!==void 0,ft=`${D.chainId}:${D.address.toLowerCase()}`,gt=ee.get(ft),On=new Kt(D.quantity.numeric).shiftedBy(-D.quantity.decimals);if(Q)x.push(D);else if(gt!==void 0)F.push(D);else if(On.isGreaterThan(0)){if(!k&&Ee.get(ao(D.chainId,D.address))==="game")continue;W.push(D)}}return x.sort((D,Q)=>{let ft=fo(r,D.chainId,D.symbol)??99,gt=fo(r,Q.chainId,Q.symbol)??99;return ft-gt}),F.sort((D,Q)=>{let ft=ee.get(`${D.chainId}:${D.address.toLowerCase()}`)??99,gt=ee.get(`${Q.chainId}:${Q.address.toLowerCase()}`)??99;return ft-gt}),W.sort((D,Q)=>{let ft=J.get(vt(D.chainId,D.address)),gt=J.get(vt(Q.chainId,Q.address)),On=new Kt(D.quantity.numeric).shiftedBy(-D.quantity.decimals).multipliedBy(ft?.price??0);return new Kt(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals).multipliedBy(gt?.price??0).minus(On).toNumber()}),[...x,...F,...W]},[pe,r,J,k,Ee,I]),Ie=B.useMemo(()=>{if(!m)return[];let x=new Set(pe.map(F=>F.address.toLowerCase()));return[...Pe].filter(F=>!x.has(F.token.toLowerCase())).sort((F,W)=>{let ee=new Kt(F.value);return new Kt(W.value).minus(ee).toNumber()})},[Pe,m,pe]),Ce=B.useRef(!1),Fe=B.useCallback(x=>{Ce.current=!0,Ye(x)},[Ye]),_n=B.useCallback(()=>{ue(null),Fe("wallet")},[ue,Fe]),Jt=B.useCallback(x=>{ue(x),Fe("send")},[ue,Fe]),en=B.useCallback(()=>{ue(null),Fe("wallet")},[ue,Fe]);B.useEffect(()=>{c||(Ce.current=!1)},[c]);let tn=B.useRef(null);B.useEffect(()=>{let x=tn.current;if(!x||!a)return;let F=W=>{W.pointerType==="touch"&&W.stopPropagation()};return x.addEventListener("pointerdown",F),()=>x.removeEventListener("pointerdown",F)},[a]);let[dt,pt]=B.useState(!1),Ct=B.useRef(void 0);B.useEffect(()=>()=>clearTimeout(Ct.current),[]),B.useEffect(()=>{let x=ct.current;if(!x||Re===null){Ue(0);return}let F=()=>{Ue(x.offsetHeight)};if(F(),typeof ResizeObserver>"u")return;let W=new ResizeObserver(F);return W.observe(x),()=>W.disconnect()},[Re]);let nn=B.useCallback(async()=>{if(!dt)try{await navigator.clipboard.writeText(w),pt(!0),clearTimeout(Ct.current),Ct.current=setTimeout(()=>pt(!1),2e3),y?.(w,!0)}catch{y?.(w,!1)}},[w,y,dt]),Wt=B.useCallback(x=>{x.currentTarget.setAttribute("data-loaded","true")},[]),An=B.useMemo(()=>({background:Ya(w)}),[w]),Bt=B.useMemo(()=>A||xt(r,w,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[A,r,w,i]),u=B.useMemo(()=>Ka(lt),[lt]),L=C||q?E("div",{className:"wi-legal-links",children:[C&&p("a",{className:"wi-legal-link",href:C,target:"_blank",rel:"noopener noreferrer",onClick:x=>We(x,C,{category:"terms",origin:"terms"},ve),children:U}),C&&q&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),q&&p("a",{className:"wi-legal-link",href:q,target:"_blank",rel:"noopener noreferrer",onClick:x=>We(x,q,{category:"privacy",origin:"privacy"},ve),children:be})]}):null,M=T?E("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{T(),N()},children:[p(Fo,{size:12}),p("span",{className:"wi-disconnect-label",children:$})]}):null,S=E("div",{className:K("wi-view-inner",Ce.current&&"wi-view-wallet"),children:[te&&(()=>{let x=Xe;return E(x?"button":"div",{...x?{type:"button",onClick:()=>Fe("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":x||void 0,children:[E("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:Z}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:W=>{W.stopPropagation(),ze(ee=>!ee)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),ze(ee=>!ee))},"aria-label":Ge?"Show balance":"Hide balance",children:Ge?p(Ho,{}):p(Vo,{})})]}),E("div",{className:"wi-total-body",children:[Je?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Ge||void 0,children:Ge?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):E(go,{children:[ke&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:u.main}),u.decimal&&p("span",{className:"wi-total-decimal",children:u.decimal})]})}),x&&p("span",{className:"wi-total-chevron","aria-hidden":!0,children:p(Bo,{size:18})})]})]})})(),He==="top"&&ae&&p("div",{className:"wi-nav-fixed",children:ae}),s&&p("div",{ref:tn,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:E("div",{className:"wi-token-list",children:[ye&&Array.from({length:5},(x,F)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("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}})]})]}),E("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}})]})]},F)),!ye&&fe.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),fe.map(x=>{let F=J.get(vt(x.chainId,x.address)),W=F?parseFloat(F.percent_change_24h):null,ee=W!==null&&W>=0,D=Hn(r,x.chainId);return E("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Jt(x),"aria-label":`Send ${x.symbol}`,children:[E("div",{className:"wi-token-left",children:[E("div",{className:"wi-token-icon-wrap",children:[p("img",{src:x.icon_url,alt:x.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Wt,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"}})]}),E("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:x.symbol}),F&&E("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:$n(F.price)}),p("span",{className:"wi-token-change","data-positive":ee,"data-zero":W===0||void 0,children:W!==null&&(W===0?"0%":`${ee?"+":"-"}${(ee?Math.floor:Math.ceil)(Math.abs(W)*100)/100}%`)})]})]})]}),E("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:bt(x.quantity.numeric,x.quantity.decimals)}),F&&p("span",{className:"wi-token-value",children:Mo(x.quantity.numeric,x.quantity.decimals,F.price)})]})]},`${x.address}-${x.chainId}`)}),m&&et&&Array.from({length:3},(x,F)=>E("div",{className:"wi-skeleton-item",children:[E("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),E("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}})]})]}),E("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-${F}`)),m&&!et&&!ye&&fe.length===0&&Ie.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&Ie.map(x=>{let F=Se.get(x.token)||"",W=Hn(r,me[r].cross);return E("div",{className:"wi-token-item",children:[E("div",{className:"wi-token-left",children:[E("div",{className:"wi-token-icon-wrap",children:[p("img",{src:F||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:x.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Wt,onError:ee=>{ee.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),W&&p("img",{src:W,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:ee=>{ee.currentTarget.style.display="none"}})]}),E("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:x.token_name}),p("div",{className:"wi-token-price-row",children:E("span",{className:"wi-token-price",children:[bt(x.current_price,18)," CROSS"]})})]})]}),E("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:bt(x.balance,18)}),p("span",{className:"wi-token-value",children:$n(x.current_value_usd)})]})]},`forge-${x.token}`)})]})}),He==="bottom"&&ae&&p("div",{className:"wi-nav-fixed",children:ae}),M&&p("div",{className:"wi-wallet-disconnect-row",children:M})]},"wallet"),H=Xe?p("div",{className:K("wi-view-inner wi-portfolio-body",Ce.current&&"wi-view-portfolio"),children:p(At,{env:r,theme:i,walletAddress:w,showHeader:!1,sendTransaction:Ae,getTransactionReceipt:se,onOutlink:ve})},"portfolio"):null,ne=Qe?p("div",{className:K("wi-view-inner wi-send-body",Ce.current&&"wi-view-send"),children:p(fn,{env:r,theme:i,walletAddress:w,accountName:h,accounts:P,token:Qe,tokens:fe,onTokenChange:ue,sendTransaction:Ae,getTransactionReceipt:se,estimateGas:Oe,onConfirmSuccess:en,onOutlink:ve})},"send"):null,mt=p("div",{className:K("wi-view-inner wi-qr-body",Ce.current&&"wi-view-qr"),children:E("div",{className:"wi-qr-section",children:[E("div",{className:"wi-qr-card",children:[E("div",{className:"wi-qr-code",children:[p(qa,{value:w,size:180,level:"H",marginSize:2,...g&&{imageSettings:{src:g,height:33,width:33,excavate:!0}}}),!g&&p("div",{className:"wi-qr-logo",children:p(Go,{size:33})})]}),p("p",{className:"wi-qr-address",children:w}),E("button",{type:"button",className:"wi-qr-copy-btn",onClick:nn,children:[p("span",{className:"wi-qr-copy-icon",children:dt?p(zt,{size:16}):p(Gn,{size:16})}),p("span",{className:"wi-qr-copy-text",children:dt?"Copied!":"Copy address"})]})]}),L]})},"qr"),le=Y==="qr"||Y==="portfolio"||Y==="send",ut=Re!==null?p("div",{className:"wi-builtin-footer",children:Re}):null,$t=!!V&&h?.trim().toLowerCase()!=="my wallet",Vt=E("div",{className:"wi-account-text",children:[$t?E("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:V,"aria-label":"Switch account",children:[p("span",{className:"wi-account-name",children:h??"Account 1"}),p("span",{className:"wi-account-switch","aria-hidden":"true",children:p($o,{size:12})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:h??"Account 1"})}),E("button",{type:"button",className:"wi-address-row-btn",onClick:nn,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:Ne(w)}),p("span",{className:"wi-account-copy",children:dt?p(zt,{size:14}):p(Gn,{size:14})})]})]}),rn=E(go,{children:[n,le?E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[p("button",{type:"button",className:"wi-header-back",onClick:_n,"aria-label":"Back",children:p(Wo,{})}),p("div",{className:"wi-account-block wi-account-block--sub-account",children:Vt}),p("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:p(zn,{size:24})})]}),p("hr",{className:"wi-divider"})]}):E("div",{className:"wi-sticky-header",children:[E("div",{className:"wi-header wi-header--wallet",children:[E("div",{className:"wi-account-block",children:[E("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:An}),Bt&&p("img",{src:Bt,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Wt,onError:x=>{x.currentTarget.style.display="none"}})]}),Vt]}),E("div",{className:"wi-header-actions",children:[b&&p("button",{type:"button",className:"wi-header-action",onClick:()=>Fe("qr"),"aria-label":"Show QR code",children:p(Do,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:p(zn,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),E("div",{className:"wi-view-container",children:[Y==="wallet"&&S,Y==="qr"&&mt,Y==="portfolio"&&H,Y==="send"&&ne]}),ut&&Y!=="portfolio"&&Y!=="send"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",ref:ct,children:ut})})]}),Nt={...st,...Te>0?{"--wi-footer-height":`${Te}px`}:null};return a?E(kn.Portal,{children:[l&&p(kn.Overlay,{className:"wi-drawer-overlay"}),E(kn.Content,{className:K("wi-drawer-content",o),"data-theme":i,style:Nt,"data-direction":d,"data-no-balance":!s||void 0,"data-has-footer":Te>0||void 0,"data-view":Y,children:[p(kn.Title,{className:"wi-sr-only",children:"My Wallet"}),rn]})]}):E(go,{children:[l&&c&&p("div",{className:"wi-drawer-overlay",onClick:N}),p(Cn.Portal,{children:p(Cn.Content,{align:e,sideOffset:t,className:K("wi-popover-content",o),"data-theme":i,style:Nt,"data-no-balance":!s||void 0,"data-has-footer":Te>0||void 0,"data-view":Y,children:rn})})]})}import*as Dr from"react";function Wr({position:e="top",children:t}){let{setNavContent:o,setNavPosition:n}=tt();return Dr.useEffect(()=>(o(t),n(e),()=>o(null)),[t,e,o,n]),null}import*as Br from"react";function $r({children:e}){let{setFooterContent:t}=tt();return Br.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}O(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #121212);--wi-surface-default: var(--cck-surface-default, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(255, 255, 255, .1));--wi-border-default: var(--cck-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--cck-texticon-primary, #ffffff);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(255, 255, 255, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #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(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #ffffff);--wi-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wi-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--cck-texticon-primary, #121212);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
|
|
9
|
-
`);
|
|
10
|
-
`);
|
|
11
|
-
`);O(`.wi-popover-content{z-index:100001;width:343px;border-radius:24px;border:1px solid var(--wi-border-default);background:var(--wi-surface-bg);box-shadow:var(--wi-shadow);animation:wi-fade-in .15s ease-out;height:552px;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(552px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{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]{height:auto;max-height:calc(100dvh - 32px);overflow-y:auto}.wi-drawer-content[data-view=qr]{overflow-y:auto}.wi-sticky-header{flex-shrink:0}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:20px 24px}.wi-header--wallet{align-items:flex-start}.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:38px;height:38px;padding:4px;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:4px;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:30px;height:30px;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 4px;margin:-2px -4px;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:14px;font-weight:600;line-height:1.4;color:var(--wi-texticon-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px;border:none;background:transparent;color:var(--wi-texticon-tertiary);border-radius:4px;flex-shrink:0}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;text-align:left;min-width:0;transition:opacity .15s ease}.wi-address-row-btn:hover{opacity:.7}.wi-account-address{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary);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}.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:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease,background .15s ease}.wi-header-action:hover{opacity:.75}.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(--wi-texticon-primary);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:16px 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}button.wi-total-section{cursor:pointer;transition:opacity .15s ease}button.wi-total-section:hover,button.wi-total-section:focus-visible{outline:none;opacity:.85}.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-chevron{display:inline-flex;align-items:center;justify-content:center;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:transform .15s ease,color .15s ease}button.wi-total-section:hover .wi-total-chevron,button.wi-total-section:focus-visible .wi-total-chevron{color:var(--wi-texticon-primary);transform:translate(2px)}.wi-total-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary)}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--wi-texticon-tertiary);cursor:pointer;transition:opacity .15s ease;border-radius:4px}.wi-total-eye:hover{opacity:.7}.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.3;color:var(--wi-texticon-primary);font-variant-numeric:tabular-nums;min-height:36px;white-space:nowrap}.wi-total-currency,.wi-total-amount{font-size:28px}.wi-total-decimal{font-size:20px;color:var(--wi-texticon-primary)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:20px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:28px;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:16px 24px 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:12px}.wi-token-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-token-left{display:flex;align-items:center;gap:12px;min-width:0}.wi-token-icon-wrap{position:relative;width:32px;height:32px;flex-shrink:0}.wi-token-icon{width:28px;height:28px;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:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:4px}.wi-token-price{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}.wi-token-change{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--wi-primary)}.wi-token-change[data-positive=false]{color:var(--wi-secondary)}.wi-token-change[data-zero]{opacity:.8}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);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:8px 24px 16px}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:16px;padding:0;border:none;background:transparent;color:var(--wi-texticon-tertiary);font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;cursor:pointer;transition:opacity .15s ease}.wi-disconnect-btn:hover{opacity:.75}.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;margin-top:16px;font-family:inherit;font-size:10px;font-weight:400;line-height:1.3;color:var(--wi-texticon-tertiary)}.wi-legal-link{color:inherit;text-decoration:underline;text-underline-offset:2px;transition:opacity .15s ease}.wi-legal-link:hover{opacity:.75}.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;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease}.wi-header-back:hover{opacity:.7}.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:0 0 auto;min-height:424px;overflow:visible}.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-top{padding:16px 20px;gap:14px}.wi-portfolio-body .wp-body-inner{padding:4px 20px 24px;gap:16px}.wi-qr-section{flex:0 0 auto;min-height:424px;display:flex;flex-direction:column;overflow:visible;padding:16px 24px}.wi-qr-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;flex:0 0 auto;min-height:356px;padding:32px 24px;background:var(--wi-border-default);border:1px solid var(--wi-border-default);border-radius:12px}.wi-qr-code{position:relative;display:flex;align-items:center;justify-content:center}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:inherit;font-size:14px;font-weight:400;line-height:1.3;color:var(--wi-texticon-primary);text-align:center;word-break:break-all;max-width:247px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px;border:1px solid var(--wi-border-subtle);background:var(--wi-surface-default);border-radius:8px;cursor:pointer;transition:opacity .15s ease}.wi-qr-copy-btn:hover{opacity:.7}.wi-qr-copy-icon{display:inline-flex;color:var(--wi-texticon-secondary)}.wi-qr-copy-text{font-family:inherit;font-size:12px;font-weight:600;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}
|
|
12
|
-
`);
|
|
13
|
-
`);import{jsx as wo}from"react/jsx-runtime";var Xa="https://terms.crosstoken.io/docs/cross-terms-of-use",Ja="https://terms.crosstoken.io/docs/nexus-privacy-policy";function es({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:k,profileImageUrl:b,connectorId:g,connectorName:w,connectorIconUrl:h,preferredTokens:P=[],onSelectWallet:A,onCopyAddress:I,onDisconnect:N,disconnectLabel:V="Disconnect",termsUrl:y=Xa,termsLabel:T="Terms of Service",privacyUrl:$=Ja,privacyLabel:C="Privacy Policy",open:U,onOpenChange:q,showPortfolio:be=!1,portfolioTitle:st="My Portfolio",showTotalAssets:ae=!0,totalAssetsLabel:He="Total Assets USD",sendTransaction:Re,getTransactionReceipt:Y,estimateGas:Ye,onOutlink:Qe,style:ue,children:Xe}){let xe=ge(e),X=g?dn[g]:void 0,Z=w??X?.name,Ae=h??X?.iconUrl,se=Lt(`(max-width: ${o}px)`),Oe=n??(i?"right":"bottom"),ve=r??!1,pe=U!==void 0,[ye,J]=ce.useState(!1),Ee=pe?U:ye,te=ce.useCallback(Ie=>{pe||J(Ie),q?.(Ie)},[pe,q]),lt=ce.useCallback(()=>te(!1),[te]),[ke,Je]=ce.useState(null),[Ge,ze]=ce.useState("top"),[ct,Te]=ce.useState(null),[Ue,Pe]=ce.useState("wallet"),[et,je]=ce.useState(null);ce.useEffect(()=>{Ee||(Pe("wallet"),je(null))},[Ee]);let Se=ce.useCallback(()=>{Kn(s),N?.()},[N,s]),fe=ce.useMemo(()=>({env:xe,theme:t,isMobile:se,open:Ee,drawerDirection:Oe,modal:ve,showBalance:i,showForgeToken:a,showGameToken:c,showQR:d,qrLogoSrc:l,walletAddress:s,accountName:m,sendAccounts:k,profileImageUrl:b,connectorName:Z,connectorIconUrl:Ae,preferredTokens:P,close:lt,onSelectWallet:A,onCopyAddress:I,onDisconnect:N?Se:void 0,disconnectLabel:V,termsUrl:y,termsLabel:T,privacyUrl:$,privacyLabel:C,portalStyle:ue,navContent:ke,navPosition:Ge,setNavContent:Je,setNavPosition:ze,footerContent:ct,setFooterContent:Te,view:Ue,setView:Pe,selectedSendToken:et,setSelectedSendToken:je,showPortfolio:be,portfolioTitle:st,showTotalAssets:ae,totalAssetsLabel:He,sendTransaction:Re,getTransactionReceipt:Y,estimateGas:Ye,onOutlink:Qe}),[xe,t,se,Ee,Oe,ve,i,a,c,d,l,s,m,k,b,Z,Ae,P,lt,A,I,N,Se,V,y,T,$,C,ue,ke,Ge,ct,Ue,et,be,st,ae,He,Re,Y,Ye,Qe]);return wo(Wn.Provider,{value:fe,children:se?wo(Qa.Root,{direction:Oe,open:Ee,onOpenChange:te,noBodyStyles:!0,repositionInputs:!1,children:Xe},"drawer"):wo(Vr.Root,{open:Ee,onOpenChange:te,children:Xe},"popover")})}var Ot=Object.assign(es,{Trigger:er,Content:Fr,Nav:Wr,Footer:$r});import*as Ke from"react";import*as Jr from"@radix-ui/react-dialog";import{Drawer as ss}from"vaul";import{createContext as ts,useContext as ns}from"react";var Nn=ts(null);function Yt(){let e=ns(Nn);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as Hr,useEffect as os,useCallback as rs}from"react";function Ln(){let[e,t]=Hr([]),[o,n]=Hr(!0);os(()=>{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=rs(i=>e.some(a=>a.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:o}}import*as zr from"@radix-ui/react-dialog";import{Drawer as is}from"vaul";import{jsx as Gr}from"react/jsx-runtime";function Ur({asChild:e,children:t}){let{isMobile:o}=Yt(),n=o?is.Trigger:zr.Trigger;return Gr(n,{asChild:e??t!=null,children:t??Gr("button",{type:"button",children:"Connect Wallet"})})}import*as rt from"@radix-ui/react-dialog";import{Drawer as En}from"vaul";import{jsx as j,jsxs as Ft}from"react/jsx-runtime";function Rn(){return Ft("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[j("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),j("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 jr(){return Ft("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[Ft("g",{clipPath:"url(#clip0_1331_27065)",children:[j("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"}),j("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"}),j("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"}),j("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"}),j("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"}),j("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),j("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"})]}),j("defs",{children:j("clipPath",{id:"clip0_1331_27065",children:j("rect",{width:"40",height:"40",fill:"white"})})})]})}function qr(){return Ft("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[j("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),j("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"}),j("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),j("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 Zr(){return Ft("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Ft("g",{clipPath:"url(#clip0_1185_7785)",children:[j("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"}),j("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"})]}),j("defs",{children:j("clipPath",{id:"clip0_1185_7785",children:j("rect",{width:"28",height:"28",fill:"white"})})})]})}function Kr(){return j("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:j("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var ho={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Rn,featured:!0},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Rn},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Rn,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:jr,rdns:"io.metamask"},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:qr,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Zr,badge:"For SHOP"}};function Dt(e){return ho[e]}import{Fragment as as,jsx as _,jsxs as de}from"react/jsx-runtime";function Yr({wallet:e,detected:t,onConnect:o}){let n=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}o()},r=e.icon;return de("button",{type:"button",className:"wcm-wallet-item",onClick:n,children:[de("div",{className:"wcm-wallet-item-left",children:[_("div",{className:"wcm-wallet-icon",children:_(r,{})}),de("div",{className:"wcm-wallet-info",children:[de("div",{className:"wcm-wallet-name-row",children:[_("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&_("span",{className:"wcm-wallet-badge",children:e.badge})]}),_("span",{className:"wcm-wallet-desc",children:e.description})]})]}),e.installUrl&&(t?_("span",{className:"wcm-installed-label",children:"Installed"}):_("span",{className:"wcm-install-btn",children:"Install"}))]})}function Qr(){let{wallets:e,activeWalletIds:t,isDetected:o,close:n,isMobile:r}=Yt(),i=t.filter(d=>{let l=Dt(d).visibility;return!l||l==="always"?!0:l==="desktop-only"?!r:l==="mobile-only"?r:!0}),a=i.filter(d=>Dt(d).featured),c=i.filter(d=>!Dt(d).featured);return de(as,{children:[de("div",{className:"wcm-header",children:[de("div",{className:"wcm-header-text",children:[_("h2",{className:"wcm-title",children:"Connect Wallet"}),_("p",{className:"wcm-subtitle",children:"Connect with one of our available wallet providers to continue."})]}),_("button",{type:"button",className:"wcm-close-btn",onClick:n,children:_(Kr,{})})]}),_("div",{className:"wcm-divider"}),de("div",{className:"wcm-body",children:[a.map(d=>{let l=Dt(d),s=l.rdns?o(l.rdns):!1;return _(Yr,{wallet:l,detected:s,onConnect:()=>{e[d]?.(),n()}},d)}),a.length>0&&c.length>0&&de("div",{className:"wcm-separator",children:[_("div",{className:"wcm-separator-line"}),_("span",{className:"wcm-separator-text",children:"or"}),_("div",{className:"wcm-separator-line"})]}),_("div",{className:"wcm-wallet-list",children:c.map(d=>{let l=Dt(d),s=l.rdns?o(l.rdns):!1;return _(Yr,{wallet:l,detected:s,onConnect:()=>{e[d]?.(),n()}},d)})}),de("div",{className:"wcm-help",children:[_("p",{className:"wcm-help-title",children:"Wallet not detected?"}),de("ul",{className:"wcm-help-list",children:[_("li",{children:"Ensure your wallet extension is installed and unlocked"}),_("li",{children:"Try refreshing the page"}),_("li",{children:"Some wallets may require you to first open the extension"}),_("li",{children:"You can try clicking the wallet anyway"})]})]}),_("div",{className:"wcm-divider"}),_("p",{className:"wcm-terms",children:"By connecting your wallet and accessing this service, you acknowledge and agree to be bound by the applicable terms and conditions."})]})]})}function Xr({className:e}){let{isMobile:t,theme:o,portalStyle:n}=Yt();return t?de(En.Portal,{children:[_(En.Overlay,{className:"wcm-overlay"}),de(En.Content,{className:K("wcm-drawer-content",e),"data-theme":o,style:n,children:[_(En.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),_("div",{className:"wcm-drawer-handle"}),_("div",{className:"wcm-drawer-body",children:_(Qr,{})})]})]}):de(rt.Portal,{children:[_(rt.Overlay,{className:"wcm-overlay"}),de(rt.Content,{className:K("wcm-dialog-content",e),"data-theme":o,style:n,children:[_(rt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),_("div",{className:"wcm-dialog-body",children:_(Qr,{})})]})]})}O(`[data-theme=dark]{--wcm-primary: var(--cck-primary, #9b8cef);--wcm-secondary: var(--cck-secondary, #ff3aa3);--wcm-surface-bg: var(--cck-surface-bg, #202530);--wcm-surface-default: var(--cck-surface-default, #292f40);--wcm-surface-subtle: var(--cck-surface-subtle, #313b51);--wcm-border-default: var(--cck-border-default, #313b51);--wcm-border-subtle: var(--cck-border-subtle, #49556e);--wcm-texticon-primary: var(--cck-texticon-primary, #ffffff);--wcm-texticon-secondary: var(--cck-texticon-secondary, #eff0f4);--wcm-texticon-tertiary: var(--cck-texticon-tertiary, #717d97)}[data-theme=light]{--wcm-primary: var(--cck-primary, #019d92);--wcm-secondary: var(--cck-secondary, #e70077);--wcm-surface-bg: var(--cck-surface-bg, #ffffff);--wcm-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wcm-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wcm-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wcm-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wcm-texticon-primary: var(--cck-texticon-primary, #121212);--wcm-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wcm-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5))}
|
|
14
|
-
`);
|
|
15
|
-
`);
|
|
16
|
-
`);import{jsx as
|
|
1
|
+
function ge(e){if(e)return Co(e);let t=typeof process<"u"?process.env?.NEXT_PUBLIC_CROSSX_ENVIRONMENT:void 0;return Co(t)}function Co(e){switch(e?.toLowerCase()){case"dev":case"development":return"dev";case"stage":case"staging":case"stg":return"stage";default:return"production"}}import*as Rt from"react";import*as No from"@radix-ui/react-popover";import{Drawer as wi}from"vaul";import{createContext as mi,useContext as fi}from"react";var On=mi(null);function nn(){let e=fi(On);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as ui,useEffect as gi}from"react";function Lt(e){let[t,o]=ui(!1);return gi(()=>{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 D(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))}D(`[data-theme=dark]{--al-bg: var(--cck-surface-bg, #1e232e);--al-bg-hover: var(--cck-surface-default, #252b39);--al-text: var(--cck-texticon-primary, hsla(200, 19%, 94%, 1));--al-text-secondary: var(--cck-texticon-secondary, hsla(200, 10%, 70%, 1));--al-border: var(--cck-border-subtle, #3b4153);--al-shadow: 0 2px 8px -1px rgba(0, 0, 0, .15);--al-badge-bg: #123f3c;--al-badge-text: hsla(168, 85%, 47%, 1);--al-badge-new-text: #000;--al-drawer-overlay: rgba(0, 0, 0, .6)}[data-theme=light]{--al-bg: var(--cck-surface-bg, #fff);--al-bg-hover: var(--cck-surface-default, #f3f6f8);--al-text: var(--cck-texticon-primary, hsla(221, 21%, 15%, 1));--al-text-secondary: var(--cck-texticon-secondary, hsla(220, 10%, 40%, 1));--al-border: var(--cck-border-subtle, #ecf0f2);--al-shadow: 0 2px 8px -1px rgba(0, 0, 0, .15);--al-badge-bg: #cdf4ed;--al-badge-text: hsla(170, 82%, 32%, 1);--al-badge-new-text: #fff;--al-drawer-overlay: rgba(0, 0, 0, .4)}
|
|
2
|
+
`);D(`.al-trigger-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px;border:none;background:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease}.al-trigger-btn[data-theme=dark]{color:#edf1f3}.al-trigger-btn[data-theme=light]{color:#1e232e}
|
|
3
|
+
`);D(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
|
|
4
|
+
`);D(`.al-popover-content{z-index:100001;border-radius:16px;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}.al-popover-content .al-grid-item{flex-direction:column;justify-content:flex-start;align-items:center;gap:6px;padding:6px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:6px;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{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:10px 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(--al-text);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:transparent;border-radius:8px;cursor:pointer;transition:background-color .15s ease;color:var(--al-text);text-align:left;font-family:Inter,sans-serif;flex-shrink:0}.al-grid-item:hover,.al-grid-item[data-active=true]{background:var(--al-bg-hover)}.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:#7346f3;color:var(--al-badge-new-text);font-family:Pretendard,Inter,sans-serif;font-size:9px;font-weight:700;flex-shrink:0}
|
|
5
|
+
`);D("");import{jsx as Fn}from"react/jsx-runtime";function Lo({env:e,theme:t="dark",mobileBreakpoint:o=768,domain:n,children:r}){let i=Lt(`(max-width: ${o}px)`),[s,l]=Rt.useState(!1),d=Rt.useCallback(()=>l(!1),[]),c=ge(e),a=Rt.useMemo(()=>({env:c,theme:t,isMobile:i,open:s,domain:n,close:d}),[c,t,i,s,n,d]);return Fn(On.Provider,{value:a,children:i?Fn(wi.Root,{direction:"right",open:s,onOpenChange:l,noBodyStyles:!0,children:r},"drawer"):Fn(No.Root,{open:s,onOpenChange:l,children:r},"popover")})}import*as So from"@radix-ui/react-popover";import{Drawer as xi}from"vaul";import{jsx as we,jsxs as hi}from"react/jsx-runtime";function Ro({size:e=18}){return hi("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[we("rect",{width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),we("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),we("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Eo(){return we("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Po(){return we("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:we("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as on}from"react/jsx-runtime";function Io({asChild:e,children:t}){let{isMobile:o,theme:n}=nn(),r=t!=null,i=e??!0,s=r?t:on("button",{type:"button",className:"al-trigger-btn","data-theme":n,children:on(Ro,{size:o?12:18})});return o?on(xi.Trigger,{asChild:i,children:s}):on(So.Trigger,{asChild:i,children:s})}import*as gt from"react";import*as an from"@radix-ui/react-popover";import{Drawer as Et}from"vaul";import{useQuery as yi}from"@tanstack/react-query";var To={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 bi="https://stg-contents.crosstoken.io/frontend/common/app-launcher/icons",vi="https://contents.crosstoken.io/frontend/common/app-launcher/icons";function We(e,t){return`${e==="production"?vi:bi}/${t}.png`}function Mo(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:We(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:We(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:We(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:We(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:We(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:We(t,"nft"),order:8e3,type:"nft",badge:null,isNew:!1},{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:We(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:We(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:We(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:We(t,"explorer"),order:12e3,type:"explorer",badge:null,isNew:!1}]}}function rn(e){let t=ge(e);return yi({queryKey:["global-menu",t],queryFn:async({signal:o})=>{try{let n=await fetch(To[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 Mo(t)}},staleTime:0,gcTime:0,retry:!1,refetchOnMount:!0})}function Y(...e){return e.filter(Boolean).join(" ")}import{jsx as oe,jsxs as zt}from"react/jsx-runtime";function ki(e){return e.id==="cross-staking"||e.type==="cross-staking"}function _o({align:e="end",sideOffset:t=12,className:o}){let{env:n,theme:r,isMobile:i,domain:s,close:l}=nn(),{data:d}=rn(n),c=gt.useMemo(()=>(d?.items??[]).sort((w,L)=>w.order-L.order),[d]),a=8,p=gt.useRef(null),x=gt.useCallback(w=>{p.current={x:w.clientX,y:w.clientY}},[]),h=typeof window<"u"?window.location.pathname:"",v=gt.useCallback((w,L)=>{if(p.current){let N=w.clientX-p.current.x,$=w.clientY-p.current.y;if(p.current=null,Math.abs(N)>a||Math.abs($)>a)return}let M=L.url[n]??L.url.production,T=Ao(M,s);if(!T)try{let N=new URL(M).pathname;if(h===N||h.startsWith(N+"/")){l();return}}catch{}T?window.open(M,"_blank","noopener,noreferrer"):window.location.href=M,l()},[n,s,l,h]),g=oe("div",{className:"al-grid","data-theme":r,children:c.map(w=>{let L=w.url[n]??w.url.production,M=Ao(L,s),T=!1;if(!M)try{let N=new URL(L).pathname;T=h===N||h.startsWith(N+"/")}catch{T=!1}return zt("button",{type:"button",className:"al-grid-item","data-active":T||void 0,onPointerDown:x,onClick:N=>v(N,w),children:[zt("div",{className:"al-grid-item-left",children:[oe("div",{className:"al-grid-item-icon",children:oe("img",{src:w.iconUrl,alt:w.label,width:24,height:24,loading:"lazy"})}),oe("span",{className:"al-grid-item-label",children:w.label}),w.isNew&&oe("span",{className:"al-badge-new",children:"N"})]}),oe("div",{className:"al-grid-item-right",children:w.badge&&!ki(w)&&oe("span",{className:"al-badge",children:w.badge})})]},w.id)})});return i?zt(Et.Portal,{children:[oe(Et.Overlay,{className:"al-drawer-overlay"}),zt(Et.Content,{className:Y("al-drawer-content",o),"data-theme":r,children:[zt("div",{className:"al-drawer-header",children:[oe(Et.Close,{className:"al-drawer-close",children:oe(Eo,{})}),oe(Et.Title,{className:"al-drawer-title",children:"CROSS Services"}),oe(Et.Close,{className:"al-drawer-close",children:oe(Po,{})})]}),oe("div",{className:"al-drawer-body",children:g})]})]}):oe(an.Portal,{children:oe(an.Content,{align:e,sideOffset:t,className:Y("al-popover-content",o),"data-theme":r,children:g})})}function Ao(e,t){try{let o=new URL(e).hostname;return typeof window>"u"?!0:o!==(t??window.location.hostname)}catch{return!1}}import*as ce from"react";import*as jr from"@radix-ui/react-popover";import{Drawer as ss}from"vaul";import{createContext as Ci,useContext as Ni}from"react";var Dn=Ci(null);function tt(){let e=Ni(Dn);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Wn=(n=>(n.CROSSx="crossx",n.MetaMask="io.metamask",n.Binance="com.binance.wallet",n))(Wn||{}),sn={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 E from"react";import wt from"bignumber.js";function Li(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 ht(e,t){if(!e||e==="0")return"0.00";let o=new wt(e).shiftedBy(-t),n=o.isGreaterThanOrEqualTo(1)?2:4;return o.toFormat(n,wt.ROUND_DOWN)}function Re(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Bn(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 Oo(e,t,o){let r=new wt(e).shiftedBy(-t).multipliedBy(new wt(o));return r.isZero()||r.isNaN()?"$0.00":`$${(r.integerValue(wt.ROUND_DOWN).isGreaterThanOrEqualTo(1)?r.decimalPlaces(2,wt.ROUND_DOWN):r.decimalPlaces(4,wt.ROUND_DOWN)).toFormat()}`}function Fo(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 s=Number(o);if(!Number.isFinite(s)||s===0)return{displayValue:"0",isLowerBound:!1};o=Li(s.toFixed(18))}let[n="0",r=""]=o.split(".");if(Number(n)>=1){let s=r.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(n).toLocaleString("en-US")}.${s}`,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}}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"},me={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var zn={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"},Do={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function $n(e,t){let o=me[e];if(t===o.cross)return Do.cross;if(t===o.bsc)return Do.bsc}var Ri={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function xt(e,t,o={}){if(!t||!t.startsWith("0x"))return;let{size:n=120,bg:r,format:i="png"}=o,s=Ri[e],l=r?`&bg=${r}`:"";return`${s}/portrait/evm/${t}.${i}?size=${n}${l}`}import{jsx as U,jsxs as ln}from"react/jsx-runtime";function Wo({size:e=16,className:t}){return ln("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[U("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"}),U("path",{d:"M2 3.33325V12.6666C2 13.0202 2.14048 13.3593 2.39052 13.6094C2.64057 13.8594 2.97971 13.9999 3.33333 13.9999H13.3333C13.5101 13.9999 13.6797 13.9297 13.8047 13.8047C13.9298 13.6796 14 13.5101 14 13.3333V10.6666",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vn({size:e=16,className:t}){return U("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("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 $t({size:e=16,className:t}){return U("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Hn({size:e=24,className:t}){return U("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bo({size:e=20,className:t}){return ln("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[U("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"}),U("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 zo({size:e=20,className:t}){return U("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:U("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 $o({size:e=20,className:t}){return U("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Vo({size:e=20,className:t}){return U("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ho({size:e=20,className:t}){return U("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:U("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function jo({size:e=16,className:t}){return ln("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[U("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"}),U("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 Go({size:e=16,className:t}){return ln("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[U("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"}),U("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Uo({size:e=42,className:t}){return U("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:U("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})})}import{useMemo as Ei}from"react";import{useQuery as Pi}from"@tanstack/react-query";var Si="send:chain-info";function Ii(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 jn(e,...t){let o=e.replace(/\/+$/,""),n=t.map(r=>r.replace(/^\/+|\/+$/g,"")).filter(Boolean);return[o,...n].join("/")}function Ti(e,t,o,n){if(n)return t===me[e].cross?qo(t,n):o?.explorer_url?jn(o.explorer_url,o.explorer_postfix?.transaction??"tx",n):Mi(e,t,n)}function qo(e,t){return jn("https://explorer.crosstoken.io",String(e),"tx",t)}function Mi(e,t,o){let n=me[e];if(t===n.cross)return qo(t,o);if(t===n.bsc)return jn(e==="production"?"https://bscscan.com":"https://testnet.bscscan.com","tx",o)}function Zo(e,t,o,n=!0){let r=Ee[e],i=Pi({queryKey:[Si,e,t],queryFn:async({signal:d})=>{let c=await fetch(`${r}/v1/public/chain/info/${t}`,{cache:"no-store",signal:d});if(!c.ok)throw new Error(`Failed to fetch chain info: ${c.status}`);let a=await c.json();if("code"in a&&a.code!==void 0&&a.code!==200)throw new Error(`Chain info API error: ${a.code}`);return Ii(a)},enabled:n,staleTime:300*1e3}),s=i.data;return{transactionUrl:Ei(()=>Ti(e,t,s,o),[t,s,e,o]),chainInfo:s,...i}}var Yo="0x0000000000000000000000000000000000000001";var Ai="0xa9059cbb",_i=/^0x[a-fA-F0-9]{40}$/,Oi="nexus-cross:dapp-ui:send:recent:",Ko=10;function Fi(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===48;)t--;return e.slice(0,t)}function Vt(e){return e.toLowerCase()}function Ht(e){return _i.test(e)}function Gn(e){return Vt(e.address)===Yo}function Un(e){return`${Oi}${e.toLowerCase()}`}function Pt(e){if(typeof window>"u")return[];try{let t=window.localStorage.getItem(Un(e));if(!t)return[];let o=JSON.parse(t);return Array.isArray(o)?o.filter(n=>n!==null&&typeof n=="object"&&Ht(n.address)&&typeof n.updatedAt=="number").slice(0,Ko):[]}catch{return[]}}function qn(e,t){if(typeof window>"u")return[];let o=Vt(t),n=[{address:o,updatedAt:Date.now()},...Pt(e).filter(r=>r.address!==o)].slice(0,Ko);try{window.localStorage.setItem(Un(e),JSON.stringify(n))}catch{return Pt(e)}return n}function Zn(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(Un(e))}catch{}}function Yn(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"),s=r.padEnd(t,"0"),l=s?BigInt(s):0n,d=10n**BigInt(t),c=i*d+l;return c<=0n?{error:"Amount must be greater than 0."}:{value:c}}function Kn(e,t){let o=BigInt(e||"0"),n=10n**BigInt(t),r=o/n,i=o%n;if(i===0n)return r.toString();let s=Fi(i.toString().padStart(t,"0"));return`${r.toString()}.${s}`}function Qn(e,t){let o=e.replace(/^0x/,"").toLowerCase().padStart(64,"0"),n=t.toString(16).padStart(64,"0");return`${Ai}${o}${n}`}var Di=2000000000n,Wi=1000000000n;async function cn(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:o})});if(!n.ok)throw new Error(`RPC ${t} HTTP ${n.status}`);let r=await n.json();if(r.error)throw new Error(`RPC ${t}: ${r.error.message}`);if(r.result===void 0)throw new Error(`RPC ${t}: empty result`);return r.result}function dn(e){return BigInt(e)}function Bi(e){return`0x${e.toString(16)}`}function zi(e){let t={to:e.to};return e.from&&(t.from=e.from),e.value!==void 0&&e.value>0n&&(t.value=Bi(e.value)),e.data&&(t.data=e.data),t}function $i(e){return e===56||e===97}async function Qo(e){try{let t=await cn(e,"eth_gasPrice",[]);return{gasPrice:dn(t)}}catch{return{gasPrice:Di}}}async function Vi(e,t){let o=Wi;try{let n=await cn(e,"eth_maxPriorityFeePerGas",[]);o=dn(n)}catch{}return{maxFeePerGas:t+o,maxPriorityFeePerGas:o}}async function Hi(e,t){if(t)return Qo(e);let o;try{o=(await cn(e,"eth_getBlockByNumber",["latest",!1]))?.baseFeePerGas}catch{}return o?Vi(e,dn(o)):Qo(e)}async function Xo(e,t){let o=$i(t.chainId),n=zi(t),[r,i]=await Promise.all([cn(e,"eth_estimateGas",[n]),Hi(e,o)]);return{gasLimit:dn(r),gasPrice:i.gasPrice,maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}}function Jo(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(Jo(o.cause,t+1)),n.join(`
|
|
6
|
+
`).toLowerCase()}function ji(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 Xn(e,t={},o="Failed to send transaction."){let n=Jo(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 s=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.":ji(e)||o}D(`.wi-token-item--button{position:relative;width:100%;border:none;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:12px;padding:6px 8px;margin:-2px -8px;transition:background-color .15s ease,transform .15s ease}.wi-token-item--button:before{content:"";position:absolute;inset:-6px -16px;border-radius:16px}.wi-token-item--button:active{transform:scale(.99)}.wi-token-item--button:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.wi-view-send{animation:wi-slide-in-right .25s ease-out}.wi-send-body{flex:1;min-height:0;overflow:hidden}.wi-drawer-content[data-direction=bottom][data-view=send]{max-height:100dvh}.send-page{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.send-scroll{flex:1;min-height:0;display:flex;flex-direction:column;gap:16px;overflow-y:auto;overflow-x:hidden;padding:16px 24px 18px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .send-scroll{scrollbar-color:rgba(0,0,0,.12) transparent}.send-scroll::-webkit-scrollbar{width:4px}.send-scroll::-webkit-scrollbar-track{background:transparent}.send-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}[data-theme=light] .send-scroll::-webkit-scrollbar-thumb{background:#0000001f}.send-section{display:flex;flex-direction:column;gap:8px}.send-asset-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color .15s ease,background-color .15s ease}.send-asset-card:disabled{cursor:default}.send-asset-card:not(:disabled):hover,.send-asset-card[aria-expanded=true]{border-color:var(--wi-primary);background:var(--wi-surface-subtle)}.send-token-list{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto;padding:6px;border:1px solid var(--wi-border-subtle);border-radius:16px;background:var(--wi-surface-default)}.send-token-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;border:none;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer}.send-token-option:hover,.send-token-option[data-selected]{background:var(--wi-surface-subtle)}.send-token-option:focus-visible,.send-asset-card:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-token-option-icon{flex-shrink:0;width:28px;height:28px;object-fit:contain;background:transparent}.send-token-option-symbol{color:var(--wi-texticon-primary);font-size:13px;font-weight:700;line-height:1.3}.send-token-option-balance{color:var(--wi-texticon-secondary);font-size:12px;font-weight:600;line-height:1.3;white-space:nowrap}.send-asset-left{display:flex;align-items:center;gap:12px;min-width:0}.send-asset-icon{flex-shrink:0;width:40px;height:40px;object-fit:contain;background:transparent}.send-asset-info,.send-asset-balance{min-width:0;display:flex;flex-direction:column}.send-asset-symbol{color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.3}.send-asset-name,.send-balance-label{color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.send-asset-balance{align-items:flex-end;text-align:right}.send-balance-value{color:var(--wi-texticon-primary);font-size:13px;font-weight:600;line-height:1.35;white-space:nowrap}.send-form{display:flex;flex-direction:column;gap:14px}.send-field{display:flex;flex-direction:column;gap:8px}.send-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.send-label{color:var(--wi-texticon-secondary);font-size:13px;font-weight:600;line-height:1.3}.send-input,.send-amount-wrap{width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);color:var(--wi-texticon-primary);font:inherit}.send-input{min-height:46px;padding:0 14px;font-size:16px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.send-input:focus{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-address-wrap[data-invalid],.send-amount-wrap[data-invalid]{border-color:#ff6b6b}.send-address-wrap[data-invalid]:focus-within,.send-amount-wrap[data-invalid]:focus-within{border-color:#ff6b6b;box-shadow:0 0 0 3px #ff6b6b29}.send-input::placeholder{color:var(--wi-texticon-tertiary)}.send-address-wrap{display:flex;align-items:center;width:100%;box-sizing:border-box;border:1px solid var(--wi-border-subtle);border-radius:14px;background:var(--wi-surface-default);transition:border-color .15s ease,box-shadow .15s ease}.send-address-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--address{flex:1;min-width:0;border:none;background:transparent;box-shadow:none}.send-input--address:focus{box-shadow:none}.send-address-book-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;margin-right:2px;border:none;border-radius:12px;background:transparent;color:var(--wi-texticon-tertiary);cursor:pointer;transition:background-color .15s ease,color .15s ease}.send-address-book-btn:hover,.send-address-book-btn[aria-expanded=true]{background:var(--wi-surface-subtle);color:var(--wi-primary)}.send-address-book-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-picker{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default)}.send-address-tabs{display:flex;align-items:center;gap:22px;border-bottom:1px solid var(--wi-border-subtle)}.send-address-tab{position:relative;border:none;background:transparent;color:var(--wi-texticon-tertiary);font:inherit;font-size:14px;font-weight:800;line-height:1.3;padding:0 0 12px;cursor:pointer}.send-address-tab[data-active]{color:var(--wi-primary)}.send-address-tab[data-active]:after{content:"";position:absolute;left:50%;bottom:-1px;width:34px;height:4px;border-radius:999px;background:var(--wi-primary);transform:translate(-50%)}.send-address-list{display:flex;flex-direction:column;gap:10px;max-height:224px;overflow-y:auto;padding-right:10px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}[data-theme=light] .send-address-list{scrollbar-color:rgba(0,0,0,.14) transparent}.send-address-list::-webkit-scrollbar{width:3px}.send-address-list::-webkit-scrollbar-track{background:transparent}.send-address-list::-webkit-scrollbar-thumb{background:#ffffff2e;border-radius:999px}[data-theme=light] .send-address-list::-webkit-scrollbar-thumb{background:#00000024}.send-address-option{display:flex;align-items:center;gap:12px;width:100%;min-height:54px;border:none;border-radius:14px;background:transparent;color:inherit;font:inherit;text-align:left;padding:8px;cursor:pointer;transition:background-color .15s ease}.send-address-option:hover{background:var(--wi-surface-subtle)}.send-address-option:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-address-avatar{flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:var(--wi-surface-subtle);color:var(--wi-primary);font-size:12px;font-weight:800;overflow:hidden}.send-address-avatar-img{position:relative;z-index:1;width:36px;height:36px;border-radius:50%;object-fit:cover}.send-address-avatar-fallback{position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center}.send-address-copy{min-width:0;display:flex;flex-direction:column;gap:2px}.send-address-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:800;line-height:1.3}.send-address-value{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:600;line-height:1.3}.send-address-empty{display:flex;align-items:center;justify-content:center;min-height:120px;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:700}.send-amount-wrap{display:flex;align-items:center;padding-right:12px}.send-amount-wrap:focus-within{border-color:var(--wi-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--wi-primary) 18%,transparent)}.send-input--amount{border:none;background:transparent;box-shadow:none;flex:1;min-width:0}.send-input--amount:focus{box-shadow:none}.send-amount-symbol{color:var(--wi-texticon-secondary);font-size:13px;font-weight:700}.send-field-error{margin:-2px 0 0;color:#ff6b6b;font-size:12px;font-weight:600;line-height:1.35}.send-max-btn{border:none;border-radius:999px;background:var(--wi-surface-subtle);color:var(--wi-primary);font:inherit;font-size:12px;font-weight:700;padding:4px 10px;cursor:pointer}.send-max-btn:disabled{cursor:not-allowed;opacity:.45}.send-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--wi-texticon-tertiary);font-size:12px;line-height:1.4}.send-meta span:last-child{color:var(--wi-texticon-secondary);font-weight:600}.send-message{border-radius:14px;padding:10px 12px;font-size:12px;line-height:1.45}.send-message--error{background:#ff50501f;color:#ff6b6b}.send-message--success{background:color-mix(in srgb,var(--wi-primary) 12%,transparent);color:var(--wi-primary)}.send-message span{font-weight:700}.send-submit-btn{width:100%;min-height:48px;border:none;border-radius:999px;background:var(--wi-primary);color:var(--wi-primary-contrast, #001410);font:inherit;font-size:15px;font-weight:800;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-submit-btn:hover:not(:disabled):not([data-disabled]){transform:translateY(-1px)}.send-submit-btn:disabled,.send-submit-btn[data-disabled]{cursor:not-allowed;opacity:.45}.send-footer{flex-shrink:0;padding:14px 24px 24px;border-top:1px solid var(--wi-border-subtle);background:var(--wi-surface-bg)}.send-page--success{background:var(--wi-surface-bg)}.send-success-body{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:32px 24px;text-align:center}.send-success-icon{display:inline-flex;align-items:center;justify-content:center}.send-success-icon[data-pending]{width:56px;height:56px;border-radius:50%;background:color-mix(in srgb,var(--wi-primary) 14%,transparent)}.send-success-spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--wi-primary) 22%,transparent);border-top-color:var(--wi-primary);border-radius:50%;animation:cross-send-spin .8s linear infinite}.send-success-copy{display:flex;flex-direction:column;gap:8px}.send-success-title{margin:0;color:var(--wi-texticon-primary);font-size:22px;font-weight:800;line-height:1.25}.send-success-desc{margin:0;color:var(--wi-texticon-tertiary);font-size:14px;font-weight:600;line-height:1.45}.send-success-hash-card{width:100%;display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--wi-border-subtle);border-radius:18px;background:var(--wi-surface-default);box-sizing:border-box}.send-success-hash-label{color:var(--wi-texticon-tertiary);font-size:12px;font-weight:700;line-height:1.3;text-align:left}.send-success-hash-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;border:none;border-radius:12px;background:var(--wi-surface-subtle);color:var(--wi-texticon-primary);font:inherit;font-size:14px;font-weight:800;padding:12px}.send-success-hash-link{flex:1;display:inline-flex;align-items:center;align-self:stretch;min-width:0;border:none;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;text-align:left;text-decoration:none;cursor:pointer;user-select:none}.send-success-hash-link:hover{color:var(--wi-primary)}.send-success-hash-link:focus-visible,.send-success-copy-btn:focus-visible{outline:2px solid var(--wi-primary);outline-offset:2px}.send-success-copy-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;border:none;background:transparent;color:var(--wi-primary);font:inherit;font-size:12px;font-weight:800;padding:0;cursor:pointer}@keyframes cross-send-spin{to{transform:rotate(360deg)}}.send-page--review{background:var(--wi-surface-bg)}.send-review-scroll{gap:16px;padding-top:12px}.send-review-amount{display:flex;align-items:center;justify-content:center;gap:4px;padding:12px 0}.send-review-amount-icon{width:32px;height:32px;object-fit:contain;flex-shrink:0}.send-review-amount-value{color:var(--wi-texticon-primary);font-size:26px;font-weight:800;line-height:1.3;letter-spacing:-.01em}.send-review-parties{display:flex;flex-direction:column;gap:4px;width:100%}.send-review-party{display:flex;align-items:flex-start;gap:8px;padding:16px;border-radius:8px;background:var(--wi-surface-subtle)}.send-review-party-label{flex-shrink:0;width:80px;color:var(--wi-texticon-tertiary);font-size:14px;line-height:1.4}.send-review-party-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px;align-items:flex-end;text-align:right}.send-review-party-name{color:var(--wi-texticon-primary);font-size:14px;font-weight:700;line-height:1.3}.send-review-party-addr{width:100%;color:var(--wi-texticon-primary);font-size:12px;line-height:1.4;word-break:break-all}.send-review-section{display:flex;flex-direction:column;gap:8px;width:100%}.send-review-section-title{margin:0;color:var(--wi-texticon-primary);font-size:15px;font-weight:700;line-height:1.6}.send-review-row{display:flex;align-items:flex-start;gap:20px;padding:2px 0}.send-review-row-label{flex-shrink:0;min-width:100px;color:var(--wi-texticon-tertiary);font-size:13px;line-height:1.3;white-space:nowrap}.send-review-row-value{flex:1;min-width:0;color:var(--wi-texticon-primary);font-size:13px;line-height:1.3;text-align:right;word-break:break-all}.send-review-row-value--accent{color:var(--wi-primary)}.send-review-network{display:inline-flex;align-items:center;gap:4px;justify-content:flex-end}.send-review-network-dot{width:6px;height:6px;border-radius:999px;background:var(--wi-primary);flex-shrink:0}.send-footer--review{display:flex;gap:8px}.send-review-btn{flex:1;min-width:0;min-height:48px;padding:12px 16px;border-radius:12px;font:inherit;font-size:16px;font-weight:700;line-height:1.3;cursor:pointer;transition:opacity .15s ease,transform .15s ease}.send-review-btn:disabled{cursor:not-allowed;opacity:.55}.send-review-btn--cancel{background:transparent;border:1px solid var(--wi-primary);color:var(--wi-primary)}.send-review-btn--confirm{background:var(--wi-primary);border:1px solid var(--wi-primary);color:var(--wi-primary-contrast, #001410)}.send-review-btn:not(:disabled):hover{transform:translateY(-1px)}
|
|
7
|
+
`);import{Fragment as ta,jsx as u,jsxs as k}from"react/jsx-runtime";var Gi=1500,Ui=120;function Jn(e){return`${e.chainId}:${e.address.toLowerCase()}`}function er(e,t){return e.name||`Account ${(e.index??t)+1}`}function tr(e){return e.trim().slice(0,1).toUpperCase()||"A"}function qi(e){return new Promise(t=>setTimeout(t,e))}function Zi(e){let{status:t}=e;return t==="reverted"||t==="0x0"||t===0||t===0n||t===!1}function Yi(e){return!!(e.token||e.recipient||e.amount)}function no(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 l=i.toString().padStart(t,"0").slice(0,Math.max(0,Math.min(o,t)));return l=l.replace(/0+$/,""),l?`${r.toString()}.${l}`:r.toString()}function eo(e,t){return no(e,t,6)}function to(e){return no(e,9,2)}function Ki(e){return e.toLocaleString("en-US")}function Qi(e){return e.maxFeePerGas!==void 0?"dynamic":e.gasPrice!==void 0?"legacy":null}function Xi(e){return e.maxFeePerGas!==void 0?e.gasLimit*e.maxFeePerGas:e.gasPrice!==void 0?e.gasLimit*e.gasPrice:null}function Ji(){return k("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[u("path",{d:"M4.5 4.5C4.5 3.67 5.17 3 6 3h8.25c.69 0 1.25.56 1.25 1.25V16.5H6A1.5 1.5 0 0 1 4.5 15V4.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),u("path",{d:"M4.5 14.5C4.5 13.67 5.17 13 6 13h9.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),u("path",{d:"M8 6.5h4M8 9h3",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function ea(){return k("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none","aria-hidden":"true",children:[u("circle",{cx:"28",cy:"28",r:"28",fill:"var(--wi-primary)"}),u("path",{d:"M17 28.5L24.2 35.5L39 20.5",stroke:"var(--wi-primary-contrast, #001410)",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function pn({env:e,theme:t="dark",walletAddress:o,accountName:n,accounts:r=[],token:i,tokens:s=[],onTokenChange:l,sendTransaction:d,getTransactionReceipt:c,estimateGas:a,onSuccess:p,onConfirmSuccess:x,onOutlink:h}){let[v,g]=E.useState(""),[w,L]=E.useState(""),[M,T]=E.useState(""),[N,$]=E.useState({}),[y,I]=E.useState(""),[S,C]=E.useState(!1),[q,W]=E.useState(!1),[ve,at]=E.useState(!1),[ae,He]=E.useState("account"),Se=E.useRef(void 0),K=E.useRef(void 0),Ke=E.useRef(null),Qe=E.useRef(null),[fe,Xe]=E.useState(()=>Pt(o)),[ye,X]=E.useState("idle"),[Z,je]=E.useState(null),[de,Fe]=E.useState(!1),[ke,pe]=E.useState(""),Ce=E.useRef(0),[J,Ie]=E.useState(null),[te,st]=E.useState(""),Ne=Gn(i),Je=E.useMemo(()=>BigInt(i.quantity.numeric||"0"),[i.quantity.numeric]),Ge=E.useMemo(()=>ht(i.quantity.numeric,i.quantity.decimals),[i.quantity.numeric,i.quantity.decimals]),Ue=E.useMemo(()=>r.filter(f=>f.address.toLowerCase()!==o.toLowerCase()),[r,o]),lt=E.useMemo(()=>{let f=new Map;return Ue.forEach((R,O)=>{f.set(R.address.toLowerCase(),{account:R,index:O})}),f},[Ue]),Te=Ue.length>0,qe=E.useMemo(()=>ge(e),[e]),Me=t==="dark"?"1A1A2E":"F3F6F8",et=s.length>0?s:[i],Ze=et.length>1&&!!l,{transactionUrl:Ae,chainInfo:ue}=Zo(qe,i.chainId,y||void 0,!0),_e=ue?.currency_symbol??"",Le=ue?.name??`Chain ID ${i.chainId}`;E.useEffect(()=>{T(""),$({}),I(""),X("idle"),je(null),pe(""),Fe(!1),Ce.current+=1},[i.address,i.chainId,v,w]),E.useEffect(()=>{L(""),C(!1)},[i.address,i.chainId]),E.useEffect(()=>{Xe(Pt(o))},[o]),E.useEffect(()=>()=>{clearTimeout(Se.current),clearTimeout(K.current)},[]),E.useEffect(()=>{!Te&&ae==="account"&&He("recent")},[ae,Te]),E.useEffect(()=>{let f=window.visualViewport,R=Ke.current;if(!f||!R)return;let O=()=>{let se=document.activeElement;return R.contains(se)&&(se instanceof HTMLInputElement||se instanceof HTMLTextAreaElement)},_=48,j=()=>{R.style.paddingBottom=""},ne=()=>{if(!O()){j();return}let se=Math.max(0,window.innerHeight-f.height-f.offsetTop);se>0?R.style.paddingBottom=`${se+_}px`:j();let mt=document.activeElement;mt instanceof HTMLElement&&requestAnimationFrame(()=>{let Dt=mt.getBoundingClientRect(),en=R.getBoundingClientRect().bottom-se-_,Bt=Dt.bottom-en;Bt>0&&R.scrollBy({top:Bt,behavior:"smooth"})})},pt=()=>{setTimeout(()=>{O()||j()},0)};return f.addEventListener("resize",ne),window.addEventListener("resize",ne),R.addEventListener("focusout",pt),()=>{f.removeEventListener("resize",ne),window.removeEventListener("resize",ne),R.removeEventListener("focusout",pt),j()}},[]);let De=E.useCallback(()=>{clearTimeout(K.current),K.current=setTimeout(()=>{Qe.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},10)},[]),Mn=E.useCallback(()=>{L(Kn(i.quantity.numeric,i.quantity.decimals))},[i.quantity.numeric,i.quantity.decimals]),Kt=E.useCallback(f=>{g(f),W(!1)},[]),Qt=E.useCallback(()=>{let f={},R=v.trim(),O=Yn(w,i.quantity.decimals),_;return R?Ht(R)||(f.recipient="Enter a valid EVM recipient address."):f.recipient="Enter a recipient address.","error"in O?f.amount=O.error:(_=O.value,_>Je&&(f.amount="Amount exceeds available balance.")),!Ne&&!Ht(i.address)&&(f.token="Token contract address is invalid."),{errors:f,rawAmount:_,trimmedRecipient:R}},[w,Je,Ne,v,i.address,i.quantity.decimals]),Xt=E.useCallback(async()=>{if(y)try{await navigator.clipboard.writeText(y),at(!0),clearTimeout(Se.current),Se.current=setTimeout(()=>at(!1),2e3)}catch{}},[y]),ct=E.useCallback(()=>{if(!Ae||!y)return;let f=_=>{typeof window>"u"||window.open(_,"_blank","noopener,noreferrer")};if(!h){f(Ae);return}let R=h(Ae,{category:"send",origin:"send-transaction",payload:{chainId:i.chainId,txHash:y}});if(R&&(typeof R=="object"||typeof R=="function")&&typeof R.then=="function"){let _=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null;R.then(j=>{if(j===null){_?.close();return}let ne=j??Ae;if(_)try{_.location.href=ne}catch{_.close(),f(ne)}else f(ne)});return}let O=R;O!==null&&f(O??Ae)},[h,i.chainId,Ae,y]),dt=E.useCallback((f,R)=>Ne?{to:f,value:R,chainId:i.chainId,from:o}:{to:Vt(i.address),data:Qn(f,R),value:0n,chainId:i.chainId,from:o},[Ne,i.address,i.chainId,o]),Ct=E.useCallback(async(f,R,O)=>{if(!a&&!O)return;let _=++Ce.current;Fe(!0),pe("");try{let j=dt(f,R),ne=a?await a(j):await Xo(O,j);if(Ce.current!==_)return;je(ne)}catch(j){if(Ce.current!==_)return;pe(Xn(j,{nativeSymbol:_e||void 0,networkName:Le,tokenSymbol:i.symbol},"Failed to estimate gas."))}finally{Ce.current===_&&Fe(!1)}},[dt,a,_e,Le,i.symbol]),Jt=E.useCallback(f=>{if(f.preventDefault(),T(""),I(""),!d){X("error"),T("Sending is not available for this wallet.");return}let{errors:R,rawAmount:O,trimmedRecipient:_}=Qt();if($(R),Yi(R)||O===void 0){X("error");return}let j=_;Ie(O),st(j),je(null),pe(""),X("review")},[d,Qt]);E.useEffect(()=>{ye==="review"&&(!te||J===null||Z===null&&(de||ke||!a&&!ue?.rpc||Ct(te,J,ue?.rpc)))},[ue?.rpc,a,Ct,Z,ke,de,J,te,ye]);let Ot=E.useCallback(async()=>{if(!(!d||!te||J===null)){T(""),I("");try{X("submitting");let f=await d(dt(te,J));if(I(f),X("confirming"),Xe(qn(o,te)),p?.(f),!c){X("success");return}for(let R=0;R<Ui;R+=1){let O=await c({hash:f,chainId:i.chainId}).catch(()=>null);if(O){if(Zi(O)){X("error"),T("Transaction reverted on-chain.");return}X("success");return}await qi(Gi)}X("error"),T("Transaction receipt was not found. Please check again later.")}catch(f){X("error"),T(Xn(f,{nativeSymbol:_e||void 0,networkName:Le,tokenSymbol:i.symbol}))}}},[dt,c,_e,Le,p,J,te,d,i.chainId,i.symbol,o]),An=E.useCallback(()=>{Ce.current+=1,je(null),pe(""),Fe(!1),T(""),X("idle")},[]),Ft=Je<=0n||!v.trim()||!w.trim();if(ye==="review"||ye==="submitting"){let f=ye==="submitting",R=J!==null?no(J,i.quantity.decimals):w.trim(),O=n?.trim()||`Account ${(r[0]?.index??0)+1}`,_="\u2014",j=_e||(Ne?i.symbol:""),ne=ue?.currency_decimals??(Ne?i.quantity.decimals:18),pt=Z?Qi(Z):null,se=Z?Xi(Z):null,mt=se!==null&&j?`${eo(se,ne)} ${j}`:_,Dt=Z?Ki(Z.gasLimit):_,Wt=Z?.maxPriorityFeePerGas!==void 0?`${to(Z.maxPriorityFeePerGas)} Gwei`:_,en=Z?.maxFeePerGas!==void 0?`${to(Z.maxFeePerGas)} Gwei`:_,Bt=Z?.gasPrice!==void 0?`${to(Z.gasPrice)} Gwei`:_,ko=`${R} ${i.symbol}`,tn=(()=>{if(!Z||se===null)return _;if(Ne&&J!==null){let Nt=J+se;return`${eo(Nt,ne)} ${j||i.symbol}`}return j?`${eo(se,ne)} ${j}`:_})();return k("div",{className:"send-page send-page--review",children:[k("div",{className:"send-scroll send-review-scroll","data-vaul-no-drag":!0,children:[k("div",{className:"send-review-amount",children:[u("img",{className:"send-review-amount-icon",src:i.icon_url,alt:"",width:32,height:32,draggable:!1,onError:Nt=>{Nt.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),k("span",{className:"send-review-amount-value",children:[R," ",i.symbol]})]}),k("div",{className:"send-review-parties",children:[k("div",{className:"send-review-party",children:[u("span",{className:"send-review-party-label",children:"From"}),k("div",{className:"send-review-party-info",children:[u("span",{className:"send-review-party-name",children:O}),u("span",{className:"send-review-party-addr",children:o})]})]}),k("div",{className:"send-review-party",children:[u("span",{className:"send-review-party-label",children:"To"}),u("div",{className:"send-review-party-info",children:u("span",{className:"send-review-party-addr",children:te})})]})]}),k("section",{className:"send-review-section",children:[u("h3",{className:"send-review-section-title",children:"Summary"}),k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Network"}),k("span",{className:"send-review-row-value send-review-network",children:[u("span",{className:"send-review-network-dot","aria-hidden":!0}),Le]})]}),k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Est. Tx Fee"}),u("span",{className:"send-review-row-value",children:de?"\u2026":mt})]}),pt==="dynamic"?k(ta,{children:[k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Max Priority Fee"}),u("span",{className:"send-review-row-value",children:de?"\u2026":Wt})]}),k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Max Gas Fee"}),u("span",{className:"send-review-row-value",children:de?"\u2026":en})]})]}):pt==="legacy"?k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Gas Price"}),u("span",{className:"send-review-row-value",children:de?"\u2026":Bt})]}):null,k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Gas Limit"}),u("span",{className:"send-review-row-value",children:de?"\u2026":Dt})]})]}),k("section",{className:"send-review-section",children:[u("h3",{className:"send-review-section-title",children:"Total"}),k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Total Amount"}),u("span",{className:"send-review-row-value",children:ko})]}),k("div",{className:"send-review-row",children:[u("span",{className:"send-review-row-label",children:"Max. Total Amount"}),u("span",{className:"send-review-row-value",children:de?"\u2026":tn})]})]}),ke&&u("div",{className:"send-message send-message--error",role:"alert",children:ke}),M&&u("div",{className:"send-message send-message--error",role:"alert",children:M})]}),k("div",{className:"send-footer send-footer--review",children:[u("button",{type:"button",className:"send-review-btn send-review-btn--cancel",onClick:An,disabled:f,children:"Cancel"}),u("button",{type:"button",className:"send-review-btn send-review-btn--confirm",onClick:Ot,disabled:f,children:f?"Sending...":"Send"})]})]})}if((ye==="confirming"||ye==="success")&&y){let f=ye==="success";return k("div",{className:"send-page send-page--success",children:[k("div",{className:"send-success-body","data-vaul-no-drag":!0,children:[u("div",{className:"send-success-icon","data-pending":!f||void 0,children:f?u(ea,{}):u("span",{className:"send-success-spinner"})}),k("div",{className:"send-success-copy",children:[u("h3",{className:"send-success-title",children:f?"Transaction Complete":"Transaction in Progress"}),u("p",{className:"send-success-desc",children:f?"Your transfer was sent successfully.":"Transfer in progress. Waiting for confirmation."})]}),k("div",{className:"send-success-hash-card",children:[u("span",{className:"send-success-hash-label",children:"Transaction Hash"}),k("div",{className:"send-success-hash-row","data-vaul-no-drag":!0,children:[u("button",{type:"button",className:"send-success-hash-link",onClick:ct,"aria-label":"Open transaction in explorer",children:Re(y)}),u("button",{type:"button",className:"send-success-copy-btn",onClick:Xt,"aria-label":"Copy transaction hash",children:ve?u($t,{size:16}):"Copy"})]})]})]}),u("div",{className:"send-footer",children:u("button",{type:"button",className:"send-submit-btn",onClick:x,disabled:!f,children:f?"All done":"Sending..."})})]})}return k("form",{className:"send-page",onSubmit:Jt,children:[k("div",{className:"send-scroll","data-vaul-no-drag":!0,ref:Ke,children:[k("section",{className:"send-section","aria-label":"Select token to send",children:[u("span",{className:"send-label",children:"Token"}),k("button",{type:"button",className:"send-asset-card",onClick:()=>{Ze&&C(f=>!f)},disabled:!Ze,"aria-expanded":Ze?S:void 0,children:[k("span",{className:"send-asset-left",children:[u("img",{className:"send-asset-icon",src:i.icon_url,alt:i.symbol,width:40,height:40,draggable:!1,onError:f=>{f.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),k("span",{className:"send-asset-info",children:[u("span",{className:"send-asset-symbol",children:i.symbol}),u("span",{className:"send-asset-name",children:i.name})]})]}),k("span",{className:"send-asset-balance",children:[u("span",{className:"send-balance-label",children:"Available"}),k("span",{className:"send-balance-value",children:[Ge," ",i.symbol]})]})]}),Ze&&S&&u("div",{className:"send-token-list",role:"listbox",children:et.map(f=>{let R=Jn(f)===Jn(i);return k("button",{type:"button",role:"option","aria-selected":R,className:"send-token-option","data-selected":R||void 0,onClick:()=>l?.(f),children:[k("span",{className:"send-asset-left",children:[u("img",{className:"send-token-option-icon",src:f.icon_url,alt:f.symbol,width:28,height:28,draggable:!1,onError:O=>{O.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),k("span",{className:"send-asset-info",children:[u("span",{className:"send-token-option-symbol",children:f.symbol}),u("span",{className:"send-asset-name",children:f.name})]})]}),u("span",{className:"send-token-option-balance",children:ht(f.quantity.numeric,f.quantity.decimals)})]},Jn(f))})}),N.token&&u("p",{className:"send-field-error",role:"alert",children:N.token})]}),k("section",{className:"send-field","aria-label":"Recipient address",children:[u("span",{className:"send-label",children:"To"}),k("div",{className:"send-address-wrap","data-invalid":N.recipient||void 0,children:[u("input",{className:"send-input send-input--address",value:v,onChange:f=>g(f.target.value),placeholder:"0x...",autoComplete:"off",spellCheck:!1,"aria-invalid":!!N.recipient,"aria-describedby":N.recipient?"send-recipient-error":void 0}),u("button",{type:"button",className:"send-address-book-btn",onClick:()=>W(f=>!f),"aria-label":"Open address book","aria-expanded":q,children:u(Ji,{})})]}),N.recipient&&u("p",{id:"send-recipient-error",className:"send-field-error",role:"alert",children:N.recipient}),q&&k("div",{className:"send-address-picker",children:[k("div",{className:"send-address-tabs",role:"tablist",children:[Te&&u("button",{type:"button",role:"tab",className:"send-address-tab","data-active":ae==="account"||void 0,"aria-selected":ae==="account",onClick:()=>He("account"),children:"My Account"}),u("button",{type:"button",role:"tab",className:"send-address-tab","data-active":ae==="recent"||void 0,"aria-selected":ae==="recent",onClick:()=>He("recent"),children:"Recent"})]}),Te&&ae==="account"?u("div",{className:"send-address-list",children:Ue.map((f,R)=>{let O=er(f,R),_=xt(qe,f.address,{size:56,bg:Me});return k("button",{type:"button",className:"send-address-option",onClick:()=>Kt(f.address),children:[k("span",{className:"send-address-avatar","aria-hidden":!0,children:[_&&u("img",{className:"send-address-avatar-img",src:_,alt:"",width:36,height:36,draggable:!1,onError:j=>{j.currentTarget.style.display="none"}}),u("span",{className:"send-address-avatar-fallback",children:tr(O)})]}),k("span",{className:"send-address-copy",children:[u("span",{className:"send-address-name",children:O}),u("span",{className:"send-address-value",children:Re(f.address)})]})]},f.address)})}):fe.length>0?u("div",{className:"send-address-list",children:fe.map(f=>{let R=lt.get(f.address.toLowerCase()),O=R?er(R.account,R.index):void 0,_=xt(qe,f.address,{size:56,bg:Me});return k("button",{type:"button",className:"send-address-option",onClick:()=>Kt(f.address),children:[k("span",{className:"send-address-avatar","aria-hidden":!0,children:[_&&u("img",{className:"send-address-avatar-img",src:_,alt:"",width:36,height:36,draggable:!1,onError:j=>{j.currentTarget.style.display="none"}}),u("span",{className:"send-address-avatar-fallback",children:O?tr(O):f.address.slice(2,4).toUpperCase()})]}),k("span",{className:"send-address-copy",children:[u("span",{className:"send-address-name",children:O??Re(f.address)}),u("span",{className:"send-address-value",children:R?Re(R.account.address):"Recently sent"})]})]},f.address)})}):u("div",{className:"send-address-empty",children:"No Send History"})]})]}),k("section",{className:"send-field","aria-labelledby":"send-amount-label",children:[k("span",{className:"send-label-row",children:[u("span",{id:"send-amount-label",className:"send-label",children:"Amount"}),u("button",{type:"button",className:"send-max-btn",onClick:Mn,disabled:Je<=0n,children:"Max"})]}),k("div",{className:"send-amount-wrap","data-invalid":N.amount||void 0,children:[u("input",{ref:Qe,className:"send-input send-input--amount",value:w,onChange:f=>L(f.target.value),onFocus:De,placeholder:"0.00",inputMode:"decimal",autoComplete:"off","aria-labelledby":"send-amount-label","aria-invalid":!!N.amount,"aria-describedby":N.amount?"send-amount-error":void 0}),u("span",{className:"send-amount-symbol",children:i.symbol})]}),N.amount&&u("p",{id:"send-amount-error",className:"send-field-error",role:"alert",children:N.amount})]}),k("div",{className:"send-meta",children:[u("span",{children:"From"}),u("span",{children:Re(o)})]}),k("div",{className:"send-meta",children:[u("span",{children:"Network"}),k("span",{children:["Chain ID ",i.chainId]})]}),M&&u("div",{className:"send-message send-message--error",role:"alert",children:M})]}),u("div",{className:"send-footer",children:u("button",{type:"submit",className:"send-submit-btn","data-disabled":Ft||void 0,"aria-disabled":Ft,children:"Send"})})]})}import*as nr from"@radix-ui/react-popover";import{Drawer as na}from"vaul";import{jsx as mn,jsxs as oa}from"react/jsx-runtime";function or({asChild:e,className:t,children:o}){let{isMobile:n,theme:r,walletAddress:i}=tt(),s=o!=null,l=e??!0,d=s?o:oa("button",{type:"button",className:Y("wi-trigger-btn",t),"data-theme":r,"data-mobile":n||void 0,children:[mn(Wo,{size:n?14:16}),mn("span",{className:"wi-trigger-address",children:Re(i)})]});return n?mn(na.Trigger,{asChild:l,children:d}):mn(nr.Trigger,{asChild:l,children:d})}import*as H from"react";import*as kn from"@radix-ui/react-popover";import{Drawer as yn}from"vaul";import Ut from"bignumber.js";import{useQueries as ra}from"@tanstack/react-query";import{useMemo as ia}from"react";var oo="user-balance";async function aa(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 s=await i.json();if(s.code!==200)throw new Error(`Token balance API error: ${s.code}`);return s.data}function St(e,t,o=!0){let n=Ee[e],r=me[e],i=[r.cross,r.bsc],s=ra({queries:i.map(a=>({queryKey:[oo,e,t,a],queryFn:({signal:p})=>aa(n,a,t,p),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1}))}),l=s.some(a=>a.isLoading),d=s.some(a=>a.isError);return{tokens:ia(()=>{let a=[];for(let p of s)p.data&&a.push(...p.data);return a},[s]),isLoading:l,isError:d}}import{useQuery as sa,useQueries as la}from"@tanstack/react-query";import{useMemo as ca}from"react";var da="forge-holdings",pa="forge-token-image";async function ma(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 fa(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 rr(e,t,o=!0){let n=zn[e],{data:r,...i}=sa({queryKey:[da,e,t],queryFn:({signal:s})=>ma(n,t,s),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1});return{holdings:r??[],...i}}function ir(e,t,o=!0){let n=zn[e],r=la({queries:t.map(s=>({queryKey:[pa,e,s],queryFn:({signal:l})=>fa(n,s,l),enabled:o,staleTime:1/0}))});return{imageMap:ca(()=>{let s=new Map;for(let l of r)l.data&&s.set(l.data.address,l.data.image_url);return s},[r])}}import{useQuery as ua}from"@tanstack/react-query";import{useMemo as ga}from"react";var ro="token-stats";function bt(e,t){return`${e}:${t.toLowerCase()}`}function It(e,t=!0){let o=Ee[e],{data:n,...r}=ua({queryKey:[ro,e],queryFn:async({signal:s})=>{let l=await fetch(`${o}/v1/public/token/stats`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Failed to fetch token stats: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token stats API error: ${d.code}`);return d},enabled:t,staleTime:3e4});return{statsMap:ga(()=>{let s=new Map;if(!n?.data)return s;for(let l of n.data){let d=bt(l.chain_id,l.address);s.set(d,l)}return s},[n]),...r}}import{useQuery as wa}from"@tanstack/react-query";import{useMemo as ha}from"react";var xa="token-info";function io(e,t){return`${t.toLowerCase()}_${e}`}function ar(e,t=!0){let o=Ee[e],{data:n,...r}=wa({queryKey:[xa,e],queryFn:async({signal:s})=>{let l=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:s});if(!l.ok)throw new Error(`Failed to fetch token info: ${l.status}`);let d=await l.json();if(d.code!==200)throw new Error(`Token info API error: ${d.code}`);return d},enabled:t,staleTime:1/0});return{categoryMap:ha(()=>{let s=new Map;if(!n?.data)return s;for(let l of n.data){let d=io(l.chain_id,l.address);s.set(d,l.category)}return s},[n]),...r}}import{useMemo as ba}from"react";import ao from"bignumber.js";function sr(e,t,o){let{tokens:n,isLoading:r}=St(e,t,o),{statsMap:i}=It(e,o);return ba(()=>{let s=new ao(0);for(let a of n){let p=i.get(bt(a.chainId,a.address));if(!p)continue;let h=new ao(a.quantity.numeric).shiftedBy(-a.quantity.decimals).multipliedBy(new ao(p.price));h.isNaN()||(s=s.plus(h))}let l=s.toFixed(),{displayValue:d,isLowerBound:c}=Fo(l);return{totalUsd:l,displayValue:d,isLowerBound:c,isLoading:r}},[n,i,r])}import{QRCodeSVG as os}from"qrcode.react";function Be(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(c){console.error("[dapp-ui] onOutlink threw:",c);return}let i=c=>{typeof window>"u"||window.open(c,"_blank","noopener,noreferrer")};if((c=>!!c&&(typeof c=="object"||typeof c=="function")&&typeof c.then=="function")(r)){let c=typeof window<"u"?window.open("","_blank","noopener,noreferrer"):null,a=p=>{if(p===null){c?.close();return}let x=p??t;if(c)try{c.location.href=x}catch{c.close(),i(x)}else i(x)};r.then(a,p=>{console.error("[dapp-ui] onOutlink rejected:",p),c?.close()});return}let l=r;if(l===null)return;i(l??t)}import*as kt from"react";import{Drawer as ts}from"vaul";import{createContext as va,useContext as ya}from"react";var jt=va(null);function Pe(){let e=ya(jt);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as ka}from"vaul";import{jsx as lr}from"react/jsx-runtime";function cr({asChild:e,children:t}){let{walletAddress:o}=Pe(),n=t!=null,r=e??!0,i=n?t:lr("button",{type:"button",children:Re(o)});return lr(ka.Trigger,{asChild:r,children:i})}import{Drawer as vn}from"vaul";import*as be from"react";import{useQueryClient as Xa}from"@tanstack/react-query";import{useMemo as Pa}from"react";import so from"bignumber.js";import{useQuery as Ca}from"@tanstack/react-query";import{useMemo as mr}from"react";var fn={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"},dr={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},un={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"},gn={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Tt={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"},pr={dev:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},stage:{cross:"https://stg-dex-api.crosstoken.io/dex",crossd:"https://stg-crossd-dex-api.crosstoken.io/dex",forge:"https://stg-forge-dex-api.crosstoken.io/dex"},production:{cross:"https://dex-api.crosstoken.io/dex",crossd:"https://crossd-dex-api.crosstoken.io/dex",forge:"https://forge-dex-api.crosstoken.io/dex"}};var Na="wp:reward-pools";function wn(e,t=!0){let o=fn[e],{data:n,...r}=Ca({queryKey:[Na,e],queryFn:async({signal:l})=>{let d=await fetch(`${o}/v1/pools`,{cache:"no-store",signal:l});if(!d.ok)throw new Error(`Failed to fetch pools: ${d.status}`);let c=await d.json();if(c.code!==200)throw new Error(`Pools API error: ${c.code}`);return c},enabled:t,staleTime:0}),i=mr(()=>n?.data.pools.filter(l=>l.pool_type==="CrossPool")??[],[n]),s=mr(()=>n?.data.pools.filter(l=>l.pool_type==="GamePool")??[],[n]);return{crossPools:i,gamePools:s,allPools:n?.data.pools??[],...r}}import{useQuery as La}from"@tanstack/react-query";import{useMemo as Ra}from"react";var Ea="wp:user-deposits";function hn(e,t,o=!0){let n=fn[e],r=o&&!!t,{data:i,...s}=La({queryKey:[Ea,e,t],queryFn:async({signal:d})=>{let c=await fetch(`${n}/v1/users/${t}/deposits`,{cache:"no-store",signal:d});if(!c.ok)throw new Error(`Deposits fetch failed: ${c.status}`);let a=await c.json();if(a.code!==200)throw new Error(`Deposits API error: ${a.code}`);return a},enabled:r,staleTime:0});return{depositMap:Ra(()=>{let d=new Map;if(!i?.data.user_deposits)return d;for(let c of i.data.user_deposits)d.set(c.pool_address.toLowerCase(),c);return d},[i]),deposits:i?.data.user_deposits??[],...s}}import{useQuery as fr}from"@tanstack/react-query";import{useMemo as ur}from"react";function nt(e,t,o,n=!0){let r=pr[e][t],i=n&&!!o,{data:s,...l}=fr({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:v})=>{let g=await fetch(`${r}/pair-info`,{cache:"no-store",signal:v});if(!g.ok)throw new Error(`pair-info fetch failed: ${g.status}`);let w=await g.json();if(w.code!==200)throw new Error(`pair-info API error: ${w.code}`);return w},enabled:n,staleTime:0}),d=s?.data??[],c=ur(()=>{let v=new Map;for(let g of d)v.set(g.pair_address.toLowerCase(),g);return v},[d]),{data:a,...p}=fr({queryKey:["wp:dex-orders",e,t,o],queryFn:async({signal:v})=>{let g=Math.floor(Date.now()/1e3),w=new URLSearchParams({owner:o,size:"200",start_date:"0",end_date:String(g)}),L=await fetch(`${r}/open-order?${w}`,{cache:"no-store",signal:v});if(!L.ok)throw new Error(`open-order fetch failed: ${L.status}`);let M=await L.json();if(M.code!==200)throw new Error(`open-order API error: ${M.code}`);return M.data?.data??[]},enabled:i,staleTime:0}),x=a??[],h=ur(()=>{let v=new Map;for(let g of x){let w=g.pair.toLowerCase();v.has(w)||v.set(w,{buys:[],sells:[]});let L=v.get(w);g.order_side===1?L.buys.push(g):L.sells.push(g)}return v},[x]);return{allPairs:d,pairMap:c,orders:x,ordersByPair:h,isEmpty:x.length===0,isLoading:l.isLoading||p.isLoading}}var Sa=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],gr="var(--wp-green)",wr=4;function hr(e,t,o=!0){let n=o&&!!t,{allPools:r}=wn(e,n),{depositMap:i}=hn(e,t,n),{allPairs:s,pairMap:l,ordersByPair:d}=nt(e,"cross",t,n),{allPairs:c,pairMap:a,ordersByPair:p}=nt(e,"crossd",t,n),{allPairs:x,pairMap:h,ordersByPair:v}=nt(e,"forge",t,n);return Pa(()=>{let g=new Map,w=new Map,L=(y,I)=>{!Number.isFinite(I)||I<=0||w.set(y,(w.get(y)??0)+I)};for(let y of r){let I=Number(y.deposit_token.price);I>0&&g.set(y.deposit_token.symbol,I);for(let S of y.reward_tokens){let C=Number(S.price);C>0&&g.set(S.symbol,C)}}for(let y of[...s,...c,...x]){let I=g.get(y.quote_symbol),S=Number(y.billboard?.price);I&&S>0&&!g.has(y.base_symbol)&&g.set(y.base_symbol,S*I)}for(let y of r){let I=i.get(y.pool_address.toLowerCase());if(!I)continue;let S=new so(I.deposited_amount).shiftedBy(-y.deposit_token.decimals).toNumber();if(L(y.deposit_token.symbol,S),y.reward_tokens.length>0){let C=y.reward_tokens[0],q=new so(I.claimable_reward).shiftedBy(-C.decimals).toNumber();L(C.symbol,q)}}let M=[{pairMap:l,ordersByPair:d},{pairMap:a,ordersByPair:p},{pairMap:h,ordersByPair:v}];for(let{pairMap:y,ordersByPair:I}of M)for(let[S,C]of I){let q=y.get(S);if(q){for(let W of C.buys){let ve=Number(W.amount)-Number(W.filled);L(q.quote_symbol,ve*Number(W.price))}for(let W of C.sells){let ve=Number(W.amount)-Number(W.filled);L(q.base_symbol,ve)}}}let T=[],N=0;for(let[y,I]of w){let S=g.get(y)??0,C=I*S;C>0&&(T.push({symbol:y,usdValue:C}),N+=C)}T.sort((y,I)=>I.usdValue-y.usdValue);let $=[];if(N>0){let y=T.slice(0,wr),I=T.slice(wr);for(let C=0;C<y.length;C++)$.push({symbol:y[C].symbol,usdValue:y[C].usdValue,percentage:Math.round(y[C].usdValue/N*100),color:Sa[C]??gr});if(I.length>0){let C=I.reduce((q,W)=>q+W.usdValue,0);$.push({symbol:"Others",usdValue:C,percentage:Math.round(C/N*100),color:gr})}let S=$.reduce((C,q)=>C+q.percentage,0);S!==100&&$.length>0&&($[0].percentage+=100-S)}return{totalUsd:N,formattedTotal:N>0?`$${new so(N).toFormat(2)}`:"$0.00",segments:$}},[r,i,s,l,d,c,a,p,x,h,v])}import{jsx as Oe,jsxs as kr}from"react/jsx-runtime";function xr({size:e=22,className:t}){return Oe("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Oe("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function br({size:e=22,className:t}){return kr("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[Oe("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),Oe("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 vr({size:e=12,className:t}){return Oe("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Oe("path",{d:"M6 11A5 5 0 106 1a5 5 0 000 10zM6 8V6M6 4h.005",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}function yr({size:e=6,className:t}){return Oe("svg",{width:e,height:e*4/6,viewBox:"0 0 6 4",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Oe("path",{d:"M1 1l2 2 2-2",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})})}function vt({size:e=12,className:t}){return kr("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:[Oe("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"}),Oe("path",{d:"M7 1H11V5",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),Oe("path",{d:"M11 1L6 6",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"})]})}import lo from"bignumber.js";var co={included:["CROSS Rewards deposited assets","CROSS Rewards claimable rewards","Gametoken open buy/sell orders"],excluded:["Forge LP value","Wallet balances outside Portfolio"]};function Cr(e){return e!=="production"}function Nr(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function po(e,t){let o=new lo(e).shiftedBy(-t);return!o.isFinite()||o.isZero()?"0":o.isGreaterThanOrEqualTo(1)?o.toFormat(2,lo.ROUND_DOWN):o.toFormat(4,lo.ROUND_DOWN)}import{useQuery as Ia}from"@tanstack/react-query";import{useMemo as Ta}from"react";var Ma="wp:token-info";function xn(e,t=!0){let o=Ee[e],n=me[e].cross,{data:r,...i}=Ia({queryKey:[Ma,e],queryFn:async({signal:c})=>{let a=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:c});if(!a.ok)throw new Error(`Failed to fetch token info: ${a.status}`);let p=await a.json();if(p.code!==200)throw new Error(`Token info API error: ${p.code}`);return p},enabled:t,staleTime:300*1e3}),{byChainAddr:s,byChainSym:l}=Ta(()=>{let c=new Map,a=new Map;if(!r?.data)return{byChainAddr:c,byChainSym:a};for(let p of r.data){let x=p.address.toLowerCase();c.set(`${p.chain_id}:${x}`,p),c.set(x,p);let h=p.symbol.replace(/^t/,"").toUpperCase(),v=`${p.chain_id}:${h}`;a.has(v)||a.set(v,p),a.has(h)||a.set(h,p)}return{byChainAddr:c,byChainSym:a}},[r]);return{getTokenImage:(c,a)=>{let p=c.toLowerCase(),x=s.get(`${n}:${p}`);if(x?.image)return x.image;let h=s.get(p);if(h?.image)return h.image;if(a){let v=a.replace(/^t/,"").toUpperCase(),g=l.get(`${n}:${v}`);if(g?.image)return g.image;let w=l.get(v);if(w?.image)return w.image}return""},...i}}import{jsx as bn,jsxs as Lr}from"react/jsx-runtime";function Mt({title:e,icon:t,iconFit:o="cover",isEmpty:n,children:r}){return Lr("div",{className:"wp-svc-card",children:[Lr("div",{className:"wp-svc-card-head",children:[bn("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:o}}),bn("span",{className:"wp-svc-card-title",children:e})]}),n?bn("div",{className:"wp-svc-empty",children:"No assets yet"}):bn("div",{className:"wp-svc-items",children:r})]})}import Gt from"bignumber.js";import{jsx as le,jsxs as he}from"react/jsx-runtime";var Aa="CROSS Rewards";function _a(e){return new Gt(e||"0").isGreaterThan(0)}function Oa(e,t,o){let n=new Gt(e||"0").shiftedBy(-t).times(o||"0");return!n.isFinite()||n.isZero()?"$0.00":`$${n.toFormat(2,Gt.ROUND_DOWN)}`}function Rr(){let{env:e,walletAddress:t,onOutlink:o}=Pe(),n=!!t,{allPools:r}=wn(e,n),{depositMap:i}=hn(e,t,n),{getTokenImage:s}=xn(e,n),l=(a,p)=>`${dr[e]}/rewards/${a.pool_address}?action=${p}`,d=`${Tt[e]}/reward.png`,c=r.filter(a=>{let p=i.get(a.pool_address.toLowerCase()),x=p?.deposited_amount??"0",h=p?.claimable_reward??"0";return!(new Gt(x).isZero()&&new Gt(h).isZero())});return le(Mt,{title:Aa,icon:d,isEmpty:c.length===0,children:c.map(a=>{let p=i.get(a.pool_address.toLowerCase()),x=p?.deposited_amount??"0",h=p?.claimable_reward??"0",v=l(a,"withdraw"),g=l(a,"claim"),w=s(a.deposit_token.address,a.deposit_token.symbol),L=a.reward_tokens[0],M=L?s(L.address,L.symbol):"",T=a.reward_tokens.map(C=>C.symbol),N=T.length>0?`${a.deposit_token.symbol}-${T.join("/")}`:a.deposit_token.symbol,$=L?po(h,L.decimals):"0",y=L?.symbol??"Reward",I=L?Oa(h,L.decimals,L.price):"$0.00",S=!!p&&_a(h);return he("article",{className:"wp-item","data-side":"reward",children:[he("div",{className:"wp-item-body",children:[he("div",{className:"wp-item-line",children:[le("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:[w&&le("img",{className:"wp-svc-token-icon",src:w,alt:""}),M&&le("img",{className:"wp-svc-token-icon",src:M,alt:""})]}),le("span",{children:N})]})]}),he("div",{className:"wp-item-line",children:[le("span",{className:"wp-item-label",children:"Deposited"}),he("div",{className:"wp-svc-token",children:[w&&le("img",{className:"wp-svc-token-icon",src:w,alt:""}),le("span",{children:po(x,a.deposit_token.decimals)})]})]}),he("div",{className:"wp-item-line",children:[he("span",{className:"wp-item-label",children:["Claimable (",y,")"]}),he("div",{className:"wp-svc-token",children:[M&&le("img",{className:"wp-svc-token-icon",src:M,alt:""}),le("span",{children:$}),le("span",{className:"wp-item-usd",children:I})]})]})]}),he("div",{className:"wp-item-tags",children:[he("a",{className:"wp-tag wp-tag--muted",href:v,target:"_blank",rel:"noopener noreferrer",onClick:C=>Be(C,v,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:a,userDeposit:p}},o),children:[le("span",{className:"wp-tag-label",children:"Withdraw"}),le(vt,{size:12,className:"wp-tag-icon"})]}),he("a",{className:"wp-tag wp-tag--mint","data-disabled":!S||void 0,"aria-disabled":!S||void 0,href:S?g:void 0,target:S?"_blank":void 0,rel:S?"noopener noreferrer":void 0,onClick:C=>{if(!S){C.preventDefault();return}Be(C,g,{category:"portfolio",origin:"portfolio-rewards",payload:{pool:a,userDeposit:p}},o)},children:[le("span",{className:"wp-tag-label",children:"Claim"}),le(vt,{size:12,className:"wp-tag-icon"})]})]})]},a.pool_address)})})}import Er from"bignumber.js";import{Fragment as Da,jsx as re,jsxs as Ye}from"react/jsx-runtime";function Pr(e){let t=new Er(e);if(t.isNaN())return e;let o=t.decimalPlaces()??0;return t.toFormat(o)}function Fa(e){let t=new Er(e.amount).minus(e.filled);return Pr(t.toString())}function Sr({market:e,pairMap:t,ordersByPair:o,getDexUrl:n,getTokenImage:r}){let{onOutlink:i}=Pe(),s=[];for(let[l,d]of o){let c=t.get(l),a=c?r(c.base_address,c.base_symbol):"",p=c?r(c.quote_address,c.quote_symbol):"",x=n(l),h=c?`${c.base_symbol}/${c.quote_symbol}`:"Unknown Pair",v=(g,w)=>Ye("a",{className:"wp-item","data-side":w,href:x,target:"_blank",rel:"noopener noreferrer",onClick:L=>Be(L,x,{category:"portfolio",origin:"portfolio-dex-order",payload:{market:e,side:w,order:g,pair:c}},i),children:[Ye("div",{className:"wp-item-body",children:[re("div",{className:"wp-order-head",children:Ye("div",{className:"wp-svc-token",children:[a&&re("img",{className:"wp-svc-token-icon",src:a,alt:""}),re("span",{children:c?.base_symbol??"Token"}),re("span",{className:"wp-token-subtle",children:h})]})}),Ye("div",{className:"wp-item-line",children:[re("span",{className:"wp-item-label",children:"Price"}),Ye("div",{className:"wp-svc-token",children:[p&&re("img",{className:"wp-svc-token-icon",src:p,alt:""}),re("span",{children:Pr(g.price)})]})]}),Ye("div",{className:"wp-item-line",children:[re("span",{className:"wp-item-label",children:"Amount"}),Ye("div",{className:"wp-svc-token",children:[a&&re("img",{className:"wp-svc-token-icon",src:a,alt:""}),re("span",{children:Fa(g)})]})]}),Ye("div",{className:"wp-item-line",children:[re("span",{className:"wp-item-label",children:"Type"}),re("span",{className:`wp-order-side wp-order-side--${w}`,children:w==="buy"?"Buy":"Sell"})]})]}),re("div",{className:"wp-item-tags",children:Ye("span",{className:"wp-tag wp-tag--muted",children:[re("span",{className:"wp-tag-label",children:"Cancel"}),re(vt,{size:12,className:"wp-tag-icon"})]})})]},`${w}-${g.order_id}`);for(let g of d.buys)s.push(v(g,"buy"));for(let g of d.sells)s.push(v(g,"sell"))}return re(Da,{children:s})}import{jsx as Ir}from"react/jsx-runtime";var Wa="Gametoken";function Ba(e){return e==="cross"?"cross":e==="crossd"?"crossd":"forge"}function Tr(){let{env:e,walletAddress:t}=Pe(),o=!!t,n=nt(e,"cross",t,o),r=nt(e,"crossd",t,o),i=nt(e,"forge",t,o),{getTokenImage:s}=xn(e,o),l=`${Tt[e]}/dex.png`,d=[{market:"cross",data:n},{market:"crossd",data:r},{market:"forge",data:i}],c=d.every(({data:a})=>a.isEmpty);return Ir(Mt,{title:Wa,icon:l,isEmpty:c,children:d.map(({market:a,data:p})=>Ir(Sr,{market:a,pairMap:p.pairMap,ordersByPair:p.ordersByPair,getDexUrl:x=>{let h=p.pairMap.get(x.toLowerCase());return`${gn[e]}/gametoken/${Ba(a)}/${h?.base_symbol??""}`},getTokenImage:s},a))})}import mo from"bignumber.js";import{useMemo as Ua}from"react";import{useQuery as za}from"@tanstack/react-query";var $a="wp:forge-pools";function Mr(e,t,o=!0){let n=un[e],r=o&&!!t,{data:i,...s}=za({queryKey:[$a,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}),l=i??[];return{pools:l,isEmpty:l.length===0,...s}}import{useQueries as Va}from"@tanstack/react-query";import{useMemo as Ha}from"react";var ja="wp:forge-token-detail";async function Ga(e,t){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return o.ok?(await o.json())?.data?.token??null:null}function Ar(e,t,o=!0){let n=un[e],r=Va({queries:t.map(l=>({queryKey:[ja,e,l],queryFn:()=>Ga(n,l),enabled:o&&!!l,staleTime:3e4}))}),i=Ha(()=>{let l=new Map;for(let d=0;d<r.length;d++){let c=r[d]?.data,a=t[d];c&&a&&l.set(a.toLowerCase(),c)}return l},[r,t]),s=r.some(l=>l.isLoading);return{detailMap:i,isLoading:s}}import{jsx as xe,jsxs as yt}from"react/jsx-runtime";var qa="Forge",Za=18,Ya="https://contents.crosstoken.io/wallet/token/images/FT.png";function Ka(e){if(!e||e==="0")return"0";let t=new mo(e).shiftedBy(-Za);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,mo.ROUND_DOWN):t.toFormat(4,mo.ROUND_DOWN)}function Qa(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 _r(){let{env:e,walletAddress:t,onOutlink:o}=Pe(),n=!!t,{pools:r,isEmpty:i}=Mr(e,t,n),s=Ua(()=>r.map(a=>a.token.address),[r]),{detailMap:l}=Ar(e,s,n&&s.length>0),d=a=>`${gn[e]}/forge/token/${a.token.address}`,c=`${Tt[e]}/forge.png`;return xe(Mt,{title:qa,icon:c,iconFit:"contain",isEmpty:i,children:r.map(a=>{let p=l.get(a.token.address.toLowerCase()),x=p?.image_url||p?.image||a.token.image||Ya,h=p?.symbol||a.token.symbol,v=d(a);return yt("a",{className:"wp-item","data-side":"lp",href:v,target:"_blank",rel:"noopener noreferrer",onClick:g=>Be(g,v,{category:"portfolio",origin:"portfolio-forge",payload:{pool:a,tokenDetail:p}},o),children:[yt("div",{className:"wp-item-body",children:[yt("div",{className:"wp-item-line",children:[xe("span",{className:"wp-item-label",children:"Asset"}),yt("div",{className:"wp-svc-token",children:[xe("img",{className:"wp-svc-token-icon",src:x,alt:""}),xe("span",{children:h}),p?.name&&xe("span",{className:"wp-token-subtle",children:p.name})]})]}),yt("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:Ka(a.lp_balance)})})]}),yt("div",{className:"wp-item-line",children:[xe("span",{className:"wp-item-label",children:"Ownership"}),xe("span",{className:"wp-line-value",children:Qa(a.pool_ownership)})]})]}),xe("div",{className:"wp-item-tags",children:yt("span",{className:"wp-tag wp-tag--muted",children:[xe("span",{className:"wp-tag-label",children:"Withdraw"}),xe(vt,{size:12,className:"wp-tag-icon"})]})})]},a.pair_address)})})}D(`.wp-fullscreen[data-theme=dark],.wp-embed[data-theme=dark]{--wp-bg: var(--cck-surface-bg, #202530);--wp-card: var(--cck-surface-default, #252b39);--wp-control: #292f40;--wp-border: var(--cck-border-default, #292f40);--wp-text: var(--cck-texticon-primary, #ffffff);--wp-text-60: var(--cck-texticon-secondary, #d3d7df);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #717d97);--wp-chrome-text: #ffffff;--wp-tooltip-bg: #151a23;--wp-tooltip-text: #ffffff;--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #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: #e6edf4;--wp-card: #ffffff;--wp-control: #edf2f6;--wp-border: #d6dee8;--wp-text: var(--cck-texticon-primary, #192023);--wp-text-60: var(--cck-texticon-secondary, #4c5863);--wp-text-40: #8c97ad;--wp-text-30: var(--cck-texticon-tertiary, #a0a9b8);--wp-chrome-text: var(--cck-texticon-primary, #192023);--wp-card-shadow: 0 1px 2px rgba(25, 32, 35, .04), 0 8px 24px rgba(25, 32, 35, .05);--wp-tooltip-bg: #192023;--wp-tooltip-text: #ffffff;--wp-mint: #00d4aa;--wp-green: var(--cck-primary, #019d92);--wp-red: var(--cck-error, #e70077);--wp-blue: #0488fc;--wp-purple: #7346f3;--wp-orange: #ff9d00;--wp-claim-primary: #7346f3;--wp-claim-primary-text: #ffffff;--wp-claim-secondary-bg: #ffffff;--wp-claim-success: #019d92;--wp-claim-success-soft: rgba(1, 157, 146, .15);--wp-claim-error: #e70077;--wp-claim-error-soft: rgba(231, 0, 119, .12)}.wp-fullscreen{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:50;background:var(--wp-bg);display:flex;flex-direction:column;overflow:hidden;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-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;gap:20px;height:60px;padding:0 20px;flex-shrink:0}.wp-header-btn{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wp-chrome-text);flex-shrink:0}.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:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-chrome-text);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:rgba(255,255,255,.08) transparent}.wp-body::-webkit-scrollbar{width:4px}.wp-body::-webkit-scrollbar-track{background:transparent}.wp-body::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:4px}.wp-body-inner{padding:0 16px 128px;display:flex;flex-direction:column;gap:24px}.wp-summary-card{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px;border-radius:8px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box}.wp-summary-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.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:18px;height:18px;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-size:28px;font-weight:600;line-height:1.3;letter-spacing:0;color:var(--wp-text);margin:0}.wp-svc-card{display:flex;flex-direction:column;gap:12px}.wp-svc-card-head{display:flex;align-items:center;gap:8px}.wp-svc-card-icon{width:20px;height:20px;border-radius:4px;flex-shrink:0;object-fit:cover}.wp-svc-card-title{font-size:16px;font-weight:600;line-height:1.3;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:20px;width:100%;padding:20px 16px;border-radius:8px;background:var(--wp-card);box-shadow:var(--wp-card-shadow, none);box-sizing:border-box}.wp-item{position:relative;display:flex;flex-direction:column;gap:16px;color:inherit;text-decoration:none;cursor:pointer;outline:none;transition:opacity .15s ease}.wp-item+.wp-item{padding-top:20px;border-top:1px solid var(--wp-control)}.wp-item:hover{opacity:.88}.wp-item-body{display:flex;flex-direction:column;gap:8px;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:16px;width:100%;min-height:18px;min-width:0}.wp-item-label{flex-shrink:0;font-size:12px;font-weight:400;line-height:1.4;letter-spacing:0;color:var(--wp-text-40);white-space:nowrap}.wp-line-value,.wp-order-side{font-size:14px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text);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:4px;min-width:0;min-height:20px}.wp-svc-token>span{font-size:13px;font-weight:400;line-height:1.3;letter-spacing:0;color:var(--wp-text);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{color:var(--wp-text-40)!important}.wp-order-head .wp-svc-token{justify-content:flex-start}.wp-order-head .wp-svc-token>span:first-of-type{font-size:14px}.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:6px;min-width:0;min-height:34px;padding:8px 12px;border-radius:999px;border:1px solid var(--wp-border);background:transparent;font-family:inherit;font-size:14px;font-weight:500;line-height:1.3;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:translateY(-1px)}.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{flex-shrink:0;opacity:.85;transition:transform .15s ease,opacity .15s ease}.wp-tag:hover .wp-tag-icon{opacity:1;transform:translate(1px,-1px)}.wp-tag--mint{color:var(--wp-mint);border-color:color-mix(in srgb,var(--wp-mint) 45%,transparent);background:color-mix(in srgb,var(--wp-mint) 10%,transparent)}.wp-tag--mint:hover{background:color-mix(in srgb,var(--wp-mint) 18%,transparent);border-color:var(--wp-mint)}.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:8px;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}
|
|
8
|
+
`);import{Fragment as es,jsx as G,jsxs as ze}from"react/jsx-runtime";var fo=5,Ja="wp:";function At({env:e,theme:t="dark",walletAddress:o,walletName:n,onBack:r,showHeader:i=!0,variant:s="embed",className:l,onOutlink:d}){let c=ge(e),a=!!o,p=Xa(),x=be.useId(),h=Cr(c),{formattedTotal:v}=hr(c,o,a),[,g]=be.useState(fo),[w,L]=be.useState(!1),M=be.useCallback(()=>{p.invalidateQueries({predicate:S=>typeof S.queryKey[0]=="string"&&S.queryKey[0].startsWith(Ja)})},[p]),T=be.useCallback(()=>{M(),L(!0),setTimeout(()=>L(!1),600),g(fo)},[M]);be.useEffect(()=>{if(!a)return;let S=setInterval(()=>{g(C=>C<=1?(T(),fo):C-1)},1e3);return()=>clearInterval(S)},[a,T]);let N=be.useCallback(()=>{r?.()},[r]),$=a?xt(c,o,{size:64}):void 0,y=be.useMemo(()=>({env:c,theme:t,open:!0,walletAddress:o,close:N,onOutlink:d}),[c,t,o,N,d]),I=ze(es,{children:[i&&ze("div",{className:"wp-header",children:[ze("div",{className:"wp-header-account",children:[r?G("button",{type:"button",className:"wp-header-btn",onClick:r,children:G(xr,{})}):G("span",{className:"wp-header-avatar","aria-hidden":!0,children:$&&G("img",{src:$,alt:"",className:"wp-header-avatar-img",draggable:!1})}),n&&G("span",{className:"wp-header-wallet-name",title:n,children:n})]}),G("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:T,children:G(br,{className:w?"wp-spin-once":void 0})})]}),G("div",{className:"wp-body",children:ze("div",{className:"wp-body-inner",children:[ze("section",{className:"wp-summary-card","aria-label":"Estimated portfolio value",children:[ze("div",{className:"wp-summary-head",children:[ze("div",{className:"wp-address",children:[G("span",{className:"wp-address-avatar","aria-hidden":!0}),G("span",{className:"wp-address-label",children:Nr(o)}),G(yr,{className:"wp-address-chevron"})]}),ze("div",{className:"wp-summary-estimate",children:[G("span",{className:"wp-summary-badge",children:"Estimated"}),h&&ze("button",{type:"button",className:"wp-estimate-info","aria-label":"USD estimate details","aria-describedby":x,children:[G(vr,{size:14}),ze("span",{id:x,role:"tooltip",className:"wp-estimate-tooltip",children:[G("span",{className:"wp-estimate-tooltip-title",children:"USD estimate includes"}),G("span",{className:"wp-estimate-tooltip-group",children:co.included.map(S=>G("span",{className:"wp-estimate-tooltip-item",children:S},S))}),G("span",{className:"wp-estimate-tooltip-title",children:"Not included"}),G("span",{className:"wp-estimate-tooltip-group",children:co.excluded.map(S=>G("span",{className:"wp-estimate-tooltip-item",children:S},S))})]})]})]})]}),G("p",{className:"wp-total",children:v})]}),G(Rr,{}),G(Tr,{}),G(_r,{})]})})]});return G(jt.Provider,{value:y,children:s==="none"?I:G("div",{className:Y(s==="fullscreen"?"wp-fullscreen":"wp-embed",l),"data-theme":t,children:I})})}import{jsx as uo,jsxs as Or}from"react/jsx-runtime";function Fr({className:e}){let{env:t,theme:o,walletAddress:n,close:r,onOutlink:i}=Pe();return Or(vn.Portal,{children:[uo(vn.Overlay,{className:"wp-overlay"}),Or(vn.Content,{className:Y("wp-fullscreen",e),"data-theme":o,children:[uo(vn.Title,{className:"wp-sr-only",children:"My Portfolio"}),uo(At,{env:t,theme:o,walletAddress:n,onBack:r,variant:"none",onOutlink:i})]})]})}import{jsx as Dr}from"react/jsx-runtime";function ns({env:e,theme:t="dark",walletAddress:o,open:n,onOpenChange:r,onOutlink:i,children:s}){let l=ge(e),d=n!==void 0,[c,a]=kt.useState(!1),p=d?n:c,x=kt.useCallback(g=>{d||a(g),r?.(g)},[d,r]),h=kt.useCallback(()=>x(!1),[x]),v=kt.useMemo(()=>({env:l,theme:t,open:p,walletAddress:o,close:h,onOutlink:i}),[l,t,p,o,h,i]);return Dr(jt.Provider,{value:v,children:Dr(ts.Root,{direction:"bottom",open:p,onOpenChange:x,noBodyStyles:!0,children:s})})}var Wr=Object.assign(ns,{Trigger:cr,Content:Fr});import{Fragment as wo,jsx as m,jsxs as P}from"react/jsx-runtime";function go(e,t,o){let n=me[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 rs(e){return parseInt(e.split(":")[1],10)}function is(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function as(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 Br({align:e="end",sideOffset:t=12,className:o,children:n}){let{env:r,theme:i,isMobile:s,open:l,drawerDirection:d,modal:c,showBalance:a,showForgeToken:p,showGameToken:x,showQR:h,qrLogoSrc:v,walletAddress:g,accountName:w,sendAccounts:L,profileImageUrl:M,preferredTokens:T,close:N,onSelectWallet:$,onCopyAddress:y,onDisconnect:I,disconnectLabel:S,termsUrl:C,termsLabel:q,privacyUrl:W,privacyLabel:ve,portalStyle:at,navContent:ae,navPosition:He,footerContent:Se,view:K,setView:Ke,selectedSendToken:Qe,setSelectedSendToken:fe,showPortfolio:Xe,portfolioTitle:ye,showTotalAssets:X,totalAssetsLabel:Z,sendTransaction:je,getTransactionReceipt:de,estimateGas:Fe,onOutlink:ke}=tt(),{tokens:pe,isLoading:Ce}=St(r,g,l&&a),{statsMap:J}=It(r,a),{categoryMap:Ie}=ar(r,a),te=a&&X,{displayValue:st,isLowerBound:Ne,isLoading:Je}=sr(r,g,l&&te),[Ge,Ue]=H.useState(!1),lt=H.useRef(null),[Te,qe]=H.useState(0),{holdings:Me,isLoading:et}=rr(r,g,l&&a&&p),Ze=H.useMemo(()=>Me.map(b=>b.token),[Me]),{imageMap:Ae}=ir(r,Ze,p&&Me.length>0),ue=H.useMemo(()=>{let b=[],B=[],V=[],ee=new Map((T??[]).map((z,Q)=>[`${rs(z.chainId)}:${z.address.toLowerCase()}`,Q]));for(let z of pe){let Q=go(r,z.chainId,z.symbol)!==void 0,ft=`${z.chainId}:${z.address.toLowerCase()}`,ut=ee.get(ft),_n=new Ut(z.quantity.numeric).shiftedBy(-z.quantity.decimals);if(Q)b.push(z);else if(ut!==void 0)B.push(z);else if(_n.isGreaterThan(0)){if(!x&&Ie.get(io(z.chainId,z.address))==="game")continue;V.push(z)}}return b.sort((z,Q)=>{let ft=go(r,z.chainId,z.symbol)??99,ut=go(r,Q.chainId,Q.symbol)??99;return ft-ut}),B.sort((z,Q)=>{let ft=ee.get(`${z.chainId}:${z.address.toLowerCase()}`)??99,ut=ee.get(`${Q.chainId}:${Q.address.toLowerCase()}`)??99;return ft-ut}),V.sort((z,Q)=>{let ft=J.get(bt(z.chainId,z.address)),ut=J.get(bt(Q.chainId,Q.address)),_n=new Ut(z.quantity.numeric).shiftedBy(-z.quantity.decimals).multipliedBy(ft?.price??0);return new Ut(Q.quantity.numeric).shiftedBy(-Q.quantity.decimals).multipliedBy(ut?.price??0).minus(_n).toNumber()}),[...b,...B,...V]},[pe,r,J,x,Ie,T]),_e=H.useMemo(()=>{if(!p)return[];let b=new Set(pe.map(B=>B.address.toLowerCase()));return[...Me].filter(B=>!b.has(B.token.toLowerCase())).sort((B,V)=>{let ee=new Ut(B.value);return new Ut(V.value).minus(ee).toNumber()})},[Me,p,pe]),Le=H.useRef(!1),De=H.useCallback(b=>{Le.current=!0,Ke(b)},[Ke]),Mn=H.useCallback(()=>{fe(null),De("wallet")},[fe,De]),Kt=H.useCallback(b=>{fe(b),De("send")},[fe,De]),Qt=H.useCallback(()=>{fe(null),De("wallet")},[fe,De]);H.useEffect(()=>{l||(Le.current=!1)},[l]);let Xt=H.useRef(null);H.useEffect(()=>{let b=Xt.current;if(!b||!s)return;let B=V=>{V.pointerType==="touch"&&V.stopPropagation()};return b.addEventListener("pointerdown",B),()=>b.removeEventListener("pointerdown",B)},[s]);let[ct,dt]=H.useState(!1),Ct=H.useRef(void 0);H.useEffect(()=>()=>clearTimeout(Ct.current),[]),H.useEffect(()=>{let b=lt.current;if(!b||Se===null){qe(0);return}let B=()=>{qe(b.offsetHeight)};if(B(),typeof ResizeObserver>"u")return;let V=new ResizeObserver(B);return V.observe(b),()=>V.disconnect()},[Se]);let Jt=H.useCallback(async()=>{if(!ct)try{await navigator.clipboard.writeText(g),dt(!0),clearTimeout(Ct.current),Ct.current=setTimeout(()=>dt(!1),2e3),y?.(g,!0)}catch{y?.(g,!1)}},[g,y,ct]),Ot=H.useCallback(b=>{b.currentTarget.setAttribute("data-loaded","true")},[]),An=H.useMemo(()=>({background:as(g)}),[g]),Ft=H.useMemo(()=>M||xt(r,g,{size:120,bg:i==="dark"?"1A1A2E":"F3F6F8"}),[M,r,g,i]),f=H.useMemo(()=>is(st),[st]),R=C||W?P("div",{className:"wi-legal-links",children:[C&&m("a",{className:"wi-legal-link",href:C,target:"_blank",rel:"noopener noreferrer",onClick:b=>Be(b,C,{category:"terms",origin:"terms"},ke),children:q}),C&&W&&m("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),W&&m("a",{className:"wi-legal-link",href:W,target:"_blank",rel:"noopener noreferrer",onClick:b=>Be(b,W,{category:"privacy",origin:"privacy"},ke),children:ve})]}):null,O=I?P("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{I(),N()},children:[m(Bo,{size:12}),m("span",{className:"wi-disconnect-label",children:S})]}):null,_=P("div",{className:Y("wi-view-inner",Le.current&&"wi-view-wallet"),children:[te&&(()=>{let b=Xe;return P(b?"button":"div",{...b?{type:"button",onClick:()=>De("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":b||void 0,children:[P("div",{className:"wi-total-head",children:[m("span",{className:"wi-total-label",children:Z}),m("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:V=>{V.stopPropagation(),Ue(ee=>!ee)},onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),V.stopPropagation(),Ue(ee=>!ee))},"aria-label":Ge?"Show balance":"Hide balance",children:Ge?m(Go,{}):m(jo,{})})]}),P("div",{className:"wi-total-body",children:[Je?m("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):m("div",{className:"wi-total-value","data-hidden":Ge||void 0,children:Ge?m("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):P(wo,{children:[Ne&&m("span",{className:"wi-total-lte",children:"\u2264"}),m("span",{className:"wi-total-currency",children:"$"}),m("span",{className:"wi-total-amount",children:f.main}),f.decimal&&m("span",{className:"wi-total-decimal",children:f.decimal})]})}),b&&m("span",{className:"wi-total-chevron","aria-hidden":!0,children:m(Vo,{size:18})})]})]})})(),He==="top"&&ae&&m("div",{className:"wi-nav-fixed",children:ae}),a&&m("div",{ref:Xt,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:P("div",{className:"wi-token-list",children:[Ce&&Array.from({length:5},(b,B)=>P("div",{className:"wi-skeleton-item",children:[P("div",{className:"wi-skeleton-left",children:[m("div",{className:"wi-skeleton-block wi-skeleton-icon"}),P("div",{className:"wi-skeleton-lines",children:[m("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),m("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),P("div",{className:"wi-skeleton-right",children:[m("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),m("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},B)),!Ce&&ue.length===0&&!p&&m("div",{className:"wi-empty",children:"No Tokens Found"}),ue.map(b=>{let B=J.get(bt(b.chainId,b.address)),V=B?parseFloat(B.percent_change_24h):null,ee=V!==null&&V>=0,z=$n(r,b.chainId);return P("button",{type:"button",className:"wi-token-item wi-token-item--button",onClick:()=>Kt(b),"aria-label":`Send ${b.symbol}`,children:[P("div",{className:"wi-token-left",children:[P("div",{className:"wi-token-icon-wrap",children:[m("img",{src:b.icon_url,alt:b.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Ot,onError:Q=>{Q.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),z&&m("img",{src:z,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:Q=>{Q.currentTarget.style.display="none"}})]}),P("div",{className:"wi-token-info",children:[m("span",{className:"wi-token-name",children:b.symbol}),B&&P("div",{className:"wi-token-price-row",children:[m("span",{className:"wi-token-price",children:Bn(B.price)}),m("span",{className:"wi-token-change","data-positive":ee,"data-zero":V===0||void 0,children:V!==null&&(V===0?"0%":`${ee?"+":"-"}${(ee?Math.floor:Math.ceil)(Math.abs(V)*100)/100}%`)})]})]})]}),P("div",{className:"wi-token-right",children:[m("span",{className:"wi-token-balance",children:ht(b.quantity.numeric,b.quantity.decimals)}),B&&m("span",{className:"wi-token-value",children:Oo(b.quantity.numeric,b.quantity.decimals,B.price)})]})]},`${b.address}-${b.chainId}`)}),p&&et&&Array.from({length:3},(b,B)=>P("div",{className:"wi-skeleton-item",children:[P("div",{className:"wi-skeleton-left",children:[m("div",{className:"wi-skeleton-block wi-skeleton-icon"}),P("div",{className:"wi-skeleton-lines",children:[m("div",{className:"wi-skeleton-block",style:{width:64,height:14}}),m("div",{className:"wi-skeleton-block",style:{width:80,height:12}})]})]}),P("div",{className:"wi-skeleton-right",children:[m("div",{className:"wi-skeleton-block",style:{width:72,height:14}}),m("div",{className:"wi-skeleton-block",style:{width:48,height:12}})]})]},`forge-sk-${B}`)),p&&!et&&!Ce&&ue.length===0&&_e.length===0&&m("div",{className:"wi-empty",children:"No Tokens Found"}),p&&_e.map(b=>{let B=Ae.get(b.token)||"",V=$n(r,me[r].cross);return P("div",{className:"wi-token-item",children:[P("div",{className:"wi-token-left",children:[P("div",{className:"wi-token-icon-wrap",children:[m("img",{src:B||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:b.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Ot,onError:ee=>{ee.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),V&&m("img",{src:V,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:ee=>{ee.currentTarget.style.display="none"}})]}),P("div",{className:"wi-token-info",children:[m("span",{className:"wi-token-name",children:b.token_name}),m("div",{className:"wi-token-price-row",children:P("span",{className:"wi-token-price",children:[ht(b.current_price,18)," CROSS"]})})]})]}),P("div",{className:"wi-token-right",children:[m("span",{className:"wi-token-balance",children:ht(b.balance,18)}),m("span",{className:"wi-token-value",children:Bn(b.current_value_usd)})]})]},`forge-${b.token}`)})]})}),He==="bottom"&&ae&&m("div",{className:"wi-nav-fixed",children:ae}),O&&m("div",{className:"wi-wallet-disconnect-row",children:O})]},"wallet"),j=Xe?m("div",{className:Y("wi-view-inner wi-portfolio-body",Le.current&&"wi-view-portfolio"),children:m(At,{env:r,theme:i,walletAddress:g,showHeader:!1,onOutlink:ke})},"portfolio"):null,ne=Qe?m("div",{className:Y("wi-view-inner wi-send-body",Le.current&&"wi-view-send"),children:m(pn,{env:r,theme:i,walletAddress:g,accountName:w,accounts:L,token:Qe,tokens:ue,onTokenChange:fe,sendTransaction:je,getTransactionReceipt:de,estimateGas:Fe,onConfirmSuccess:Qt,onOutlink:ke})},"send"):null,pt=m("div",{className:Y("wi-view-inner wi-qr-body",Le.current&&"wi-view-qr"),children:P("div",{className:"wi-qr-section",children:[P("div",{className:"wi-qr-card",children:[P("div",{className:"wi-qr-code",children:[m(os,{value:g,size:180,level:"H",marginSize:2,...v&&{imageSettings:{src:v,height:33,width:33,excavate:!0}}}),!v&&m("div",{className:"wi-qr-logo",children:m(Uo,{size:33})})]}),m("p",{className:"wi-qr-address",children:g}),P("button",{type:"button",className:"wi-qr-copy-btn",onClick:Jt,children:[m("span",{className:"wi-qr-copy-icon",children:ct?m($t,{size:16}):m(Vn,{size:16})}),m("span",{className:"wi-qr-copy-text",children:ct?"Copied!":"Copy address"})]})]}),R]})},"qr"),se=K==="qr"||K==="portfolio"||K==="send",mt=Se!==null?m("div",{className:"wi-builtin-footer",children:Se}):null,Dt=!!$&&w?.trim().toLowerCase()!=="my wallet",Wt=P("div",{className:"wi-account-text",children:[Dt?P("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:$,"aria-label":"Switch account",children:[m("span",{className:"wi-account-name",children:w??"Account 1"}),m("span",{className:"wi-account-switch","aria-hidden":"true",children:m(Ho,{size:12})})]}):m("div",{className:"wi-account-row",children:m("span",{className:"wi-account-name",children:w??"Account 1"})}),P("button",{type:"button",className:"wi-address-row-btn",onClick:Jt,"aria-label":"Copy address",children:[m("span",{className:"wi-account-address",children:Re(g)}),m("span",{className:"wi-account-copy",children:ct?m($t,{size:14}):m(Vn,{size:14})})]})]}),tn=P(wo,{children:[n,se?P("div",{className:"wi-sticky-header",children:[P("div",{className:"wi-header wi-header--wallet wi-header--sub-account",children:[m("button",{type:"button",className:"wi-header-back",onClick:Mn,"aria-label":"Back",children:m($o,{})}),m("div",{className:"wi-account-block wi-account-block--sub-account",children:Wt}),m("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:m(Hn,{size:24})})]}),m("hr",{className:"wi-divider"})]}):P("div",{className:"wi-sticky-header",children:[P("div",{className:"wi-header wi-header--wallet",children:[P("div",{className:"wi-account-block",children:[P("div",{className:"wi-avatar",children:[m("div",{className:"wi-avatar-fallback",style:An}),Ft&&m("img",{src:Ft,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Ot,onError:b=>{b.currentTarget.style.display="none"}})]}),Wt]}),P("div",{className:"wi-header-actions",children:[h&&m("button",{type:"button",className:"wi-header-action",onClick:()=>De("qr"),"aria-label":"Show QR code",children:m(zo,{size:20})}),m("button",{type:"button",className:"wi-header-action",onClick:N,"aria-label":"Close",children:m(Hn,{size:24})})]})]}),m("hr",{className:"wi-divider"})]}),P("div",{className:"wi-view-container",children:[K==="wallet"&&_,K==="qr"&&pt,K==="portfolio"&&j,K==="send"&&ne]}),mt&&K!=="portfolio"&&K!=="send"&&m("div",{className:"wi-sticky-footer",children:m("div",{className:"wi-footer",ref:lt,children:mt})})]}),Nt={...at,...Te>0?{"--wi-footer-height":`${Te}px`}:null};return s?P(yn.Portal,{children:[c&&m(yn.Overlay,{className:"wi-drawer-overlay"}),P(yn.Content,{className:Y("wi-drawer-content",o),"data-theme":i,style:Nt,"data-direction":d,"data-no-balance":!a||void 0,"data-has-footer":Te>0||void 0,"data-view":K,children:[m(yn.Title,{className:"wi-sr-only",children:"My Wallet"}),tn]})]}):P(wo,{children:[c&&l&&m("div",{className:"wi-drawer-overlay",onClick:N}),m(kn.Portal,{children:m(kn.Content,{align:e,sideOffset:t,className:Y("wi-popover-content",o),"data-theme":i,style:Nt,"data-no-balance":!a||void 0,"data-has-footer":Te>0||void 0,"data-view":K,children:tn})})]})}import*as zr from"react";function $r({position:e="top",children:t}){let{setNavContent:o,setNavPosition:n}=tt();return zr.useEffect(()=>(o(t),n(e),()=>o(null)),[t,e,o,n]),null}import*as Vr from"react";function Hr({children:e}){let{setFooterContent:t}=tt();return Vr.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}D(`[data-theme=dark].wi-popover-content,[data-theme=dark].wi-drawer-content{--wi-primary: var(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #121212);--wi-surface-default: var(--cck-surface-default, rgba(255, 255, 255, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(255, 255, 255, .1));--wi-border-default: var(--cck-border-default, rgba(255, 255, 255, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(255, 255, 255, .1));--wi-texticon-primary: var(--cck-texticon-primary, #ffffff);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(255, 255, 255, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(255, 255, 255, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #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(--cck-primary, #019d92);--wi-secondary: var(--cck-secondary, #e70077);--wi-surface-bg: var(--cck-surface-bg, #ffffff);--wi-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wi-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wi-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wi-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wi-texticon-primary: var(--cck-texticon-primary, #121212);--wi-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wi-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5));--wi-on-primary: var(--cck-on-primary, #ffffff);--wi-error: var(--cck-error, #e70077);--wi-shadow: 0 2px 16px -2px rgba(0, 0, 0, .15)}
|
|
9
|
+
`);D(`.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
|
+
`);D(`@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
|
+
`);D(`.wi-popover-content{z-index:100001;width:343px;border-radius:24px;border:1px solid var(--wi-border-default);background:var(--wi-surface-bg);box-shadow:var(--wi-shadow);animation:wi-fade-in .15s ease-out;height:552px;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(552px + var(--wi-footer-height, 0px)),calc(100dvh - 32px))}.wi-drawer-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wi-drawer-content{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]{height:auto;max-height:calc(100dvh - 32px);overflow-y:auto}.wi-drawer-content[data-view=qr]{overflow-y:auto}.wi-sticky-header{flex-shrink:0}.wi-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:20px 24px}.wi-header--wallet{align-items:flex-start}.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:38px;height:38px;padding:4px;border-radius:50%;background:var(--wi-surface-bg);box-sizing:border-box;overflow:hidden}.wi-avatar-fallback{position:absolute;inset:4px;border-radius:50%;z-index:0}.wi-avatar-img{position:relative;z-index:1;width:30px;height:30px;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 4px;margin:-2px -4px;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:14px;font-weight:600;line-height:1.4;color:var(--wi-texticon-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wi-account-switch{display:inline-flex;align-items:center;justify-content:center;padding:2px;border:none;background:transparent;color:var(--wi-texticon-tertiary);border-radius:4px;flex-shrink:0}.wi-address-row-btn{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:transparent;cursor:pointer;color:inherit;font:inherit;text-align:left;min-width:0;transition:opacity .15s ease}.wi-address-row-btn:hover{opacity:.7}.wi-account-address{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary);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}.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:34px;height:34px;padding:0;border:none;background:var(--wi-surface-default);border-radius:8px;cursor:pointer;color:var(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease,background .15s ease}.wi-header-action:hover{opacity:.75}.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(--wi-texticon-primary);transition:opacity .15s ease}.wi-header-close:hover{opacity:.7}.wi-total-section{margin:16px 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}button.wi-total-section{cursor:pointer;transition:opacity .15s ease}button.wi-total-section:hover,button.wi-total-section:focus-visible{outline:none;opacity:.85}.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-chevron{display:inline-flex;align-items:center;justify-content:center;color:var(--wi-texticon-tertiary);flex-shrink:0;transition:transform .15s ease,color .15s ease}button.wi-total-section:hover .wi-total-chevron,button.wi-total-section:focus-visible .wi-total-chevron{color:var(--wi-texticon-primary);transform:translate(2px)}.wi-total-label{font-family:inherit;font-size:12px;font-weight:400;line-height:1.4;color:var(--wi-texticon-tertiary)}.wi-total-eye{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;color:var(--wi-texticon-tertiary);cursor:pointer;transition:opacity .15s ease;border-radius:4px}.wi-total-eye:hover{opacity:.7}.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.3;color:var(--wi-texticon-primary);font-variant-numeric:tabular-nums;min-height:36px;white-space:nowrap}.wi-total-currency,.wi-total-amount{font-size:28px}.wi-total-decimal{font-size:20px;color:var(--wi-texticon-primary)}.wi-total-lte{margin-right:2px;font-weight:500;font-size:20px;color:var(--wi-texticon-secondary)}.wi-total-mask{letter-spacing:2px;font-size:28px;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:16px 24px 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:12px}.wi-token-item{display:flex;align-items:center;justify-content:space-between;padding:4px 0}.wi-token-left{display:flex;align-items:center;gap:12px;min-width:0}.wi-token-icon-wrap{position:relative;width:32px;height:32px;flex-shrink:0}.wi-token-icon{width:28px;height:28px;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:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-price-row{display:flex;align-items:center;gap:4px}.wi-token-price{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}.wi-token-change{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;white-space:nowrap}.wi-token-change[data-positive=true]{color:var(--wi-primary)}.wi-token-change[data-positive=false]{color:var(--wi-secondary)}.wi-token-change[data-zero]{opacity:.8}.wi-token-right{display:flex;flex-direction:column;align-items:flex-end;flex-shrink:0}.wi-token-balance{font-family:inherit;font-size:14px;font-weight:600;line-height:1.3;color:var(--wi-texticon-primary);white-space:nowrap}.wi-token-value{font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;color:var(--wi-texticon-secondary);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:8px 24px 16px}.wi-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:16px;padding:0;border:none;background:transparent;color:var(--wi-texticon-tertiary);font-family:inherit;font-size:12px;font-weight:400;line-height:1.3;cursor:pointer;transition:opacity .15s ease}.wi-disconnect-btn:hover{opacity:.75}.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;margin-top:16px;font-family:inherit;font-size:10px;font-weight:400;line-height:1.3;color:var(--wi-texticon-tertiary)}.wi-legal-link{color:inherit;text-decoration:underline;text-underline-offset:2px;transition:opacity .15s ease}.wi-legal-link:hover{opacity:.75}.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;padding:0;border:none;background:transparent;cursor:pointer;color:var(--wi-texticon-primary);flex-shrink:0;transition:opacity .15s ease}.wi-header-back:hover{opacity:.7}.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:0 0 auto;min-height:424px;overflow:visible}.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-top{padding:16px 20px;gap:14px}.wi-portfolio-body .wp-body-inner{padding:4px 20px 24px;gap:16px}.wi-qr-section{flex:0 0 auto;min-height:424px;display:flex;flex-direction:column;overflow:visible;padding:16px 24px}.wi-qr-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;flex:0 0 auto;min-height:356px;padding:32px 24px;background:var(--wi-border-default);border:1px solid var(--wi-border-default);border-radius:12px}.wi-qr-code{position:relative;display:flex;align-items:center;justify-content:center}.wi-qr-logo{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none}.wi-qr-address{font-family:inherit;font-size:14px;font-weight:400;line-height:1.3;color:var(--wi-texticon-primary);text-align:center;word-break:break-all;max-width:247px;margin:0}.wi-qr-copy-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px;border:1px solid var(--wi-border-subtle);background:var(--wi-surface-default);border-radius:8px;cursor:pointer;transition:opacity .15s ease}.wi-qr-copy-btn:hover{opacity:.7}.wi-qr-copy-icon{display:inline-flex;color:var(--wi-texticon-secondary)}.wi-qr-copy-text{font-family:inherit;font-size:12px;font-weight:600;line-height:1.3;color:var(--wi-texticon-secondary);white-space:nowrap}
|
|
12
|
+
`);D(`.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 ho}from"react/jsx-runtime";var ls="https://terms.crosstoken.io/docs/cross-terms-of-use",cs="https://terms.crosstoken.io/docs/nexus-privacy-policy";function ds({env:e,theme:t="dark",mobileBreakpoint:o=768,drawerDirection:n,modal:r,showBalance:i=!1,showForgeToken:s=!1,showGameToken:l=!0,showQR:d=!0,qrLogoSrc:c,walletAddress:a,accountName:p,sendAccounts:x,profileImageUrl:h,connectorId:v,connectorName:g,connectorIconUrl:w,preferredTokens:L=[],onSelectWallet:M,onCopyAddress:T,onDisconnect:N,disconnectLabel:$="Disconnect",termsUrl:y=ls,termsLabel:I="Terms of Service",privacyUrl:S=cs,privacyLabel:C="Privacy Policy",open:q,onOpenChange:W,showPortfolio:ve=!1,portfolioTitle:at="My Portfolio",showTotalAssets:ae=!0,totalAssetsLabel:He="Total Assets USD",sendTransaction:Se,getTransactionReceipt:K,estimateGas:Ke,onOutlink:Qe,style:fe,children:Xe}){let ye=ge(e),X=v?sn[v]:void 0,Z=g??X?.name,je=w??X?.iconUrl,de=Lt(`(max-width: ${o}px)`),Fe=n??(i?"right":"bottom"),ke=r??!1,pe=q!==void 0,[Ce,J]=ce.useState(!1),Ie=pe?q:Ce,te=ce.useCallback(_e=>{pe||J(_e),W?.(_e)},[pe,W]),st=ce.useCallback(()=>te(!1),[te]),[Ne,Je]=ce.useState(null),[Ge,Ue]=ce.useState("top"),[lt,Te]=ce.useState(null),[qe,Me]=ce.useState("wallet"),[et,Ze]=ce.useState(null);ce.useEffect(()=>{Ie||(Me("wallet"),Ze(null))},[Ie]);let Ae=ce.useCallback(()=>{Zn(a),N?.()},[N,a]),ue=ce.useMemo(()=>({env:ye,theme:t,isMobile:de,open:Ie,drawerDirection:Fe,modal:ke,showBalance:i,showForgeToken:s,showGameToken:l,showQR:d,qrLogoSrc:c,walletAddress:a,accountName:p,sendAccounts:x,profileImageUrl:h,connectorName:Z,connectorIconUrl:je,preferredTokens:L,close:st,onSelectWallet:M,onCopyAddress:T,onDisconnect:N?Ae:void 0,disconnectLabel:$,termsUrl:y,termsLabel:I,privacyUrl:S,privacyLabel:C,portalStyle:fe,navContent:Ne,navPosition:Ge,setNavContent:Je,setNavPosition:Ue,footerContent:lt,setFooterContent:Te,view:qe,setView:Me,selectedSendToken:et,setSelectedSendToken:Ze,showPortfolio:ve,portfolioTitle:at,showTotalAssets:ae,totalAssetsLabel:He,sendTransaction:Se,getTransactionReceipt:K,estimateGas:Ke,onOutlink:Qe}),[ye,t,de,Ie,Fe,ke,i,s,l,d,c,a,p,x,h,Z,je,L,st,M,T,N,Ae,$,y,I,S,C,fe,Ne,Ge,lt,qe,et,ve,at,ae,He,Se,K,Ke,Qe]);return ho(Dn.Provider,{value:ue,children:de?ho(ss.Root,{direction:Fe,open:Ie,onOpenChange:te,noBodyStyles:!0,repositionInputs:!1,children:Xe},"drawer"):ho(jr.Root,{open:Ie,onOpenChange:te,children:Xe},"popover")})}var _t=Object.assign(ds,{Trigger:or,Content:Br,Nav:$r,Footer:Hr});import*as Ve from"react";import*as si from"@radix-ui/react-dialog";import{Drawer as xs}from"vaul";import{createContext as ps,useContext as ms}from"react";var Cn=ps(null);function qt(){let e=ms(Cn);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as Gr,useEffect as fs,useCallback as us}from"react";function Nn(){let[e,t]=Gr([]),[o,n]=Gr(!0);fs(()=>{if(typeof window>"u"){n(!1);return}let i=[],s=d=>{let{info:c}=d.detail;c?.rdns&&!i.some(a=>a.rdns===c.rdns)&&(i.push({rdns:c.rdns,name:c.name,icon:c.icon}),t([...i]))};window.addEventListener("eip6963:announceProvider",s),window.addEventListener("eip6963:crossAnnounceProvider",s),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let l=setTimeout(()=>n(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",s),window.removeEventListener("eip6963:crossAnnounceProvider",s),clearTimeout(l)}},[]);let r=us(i=>e.some(s=>s.rdns===i),[e]);return{wallets:e,isDetected:r,isLoading:o}}import*as qr from"@radix-ui/react-dialog";import{Drawer as gs}from"vaul";import{jsx as Ur}from"react/jsx-runtime";function Zr({asChild:e,children:t}){let{isMobile:o}=qt(),n=o?gs.Trigger:qr.Trigger;return Ur(n,{asChild:e??t!=null,children:t??Ur("button",{type:"button",children:"Connect Wallet"})})}import*as $e from"@radix-ui/react-dialog";import{Drawer as Rn}from"vaul";import{jsx as F,jsxs as ot}from"react/jsx-runtime";function Ln(){return ot("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[F("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),F("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 Yr(){return ot("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[ot("g",{clipPath:"url(#clip0_1331_27065)",children:[F("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"}),F("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"}),F("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"}),F("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"}),F("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"}),F("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),F("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"})]}),F("defs",{children:F("clipPath",{id:"clip0_1331_27065",children:F("rect",{width:"40",height:"40",fill:"white"})})})]})}function Kr(){return ot("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[F("path",{d:"M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z",fill:"#F3BA2F"}),F("path",{d:"M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z",fill:"#F3BA2F"}),F("path",{d:"M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z",fill:"#F3BA2F"}),F("path",{d:"M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z",fill:"#F3BA2F"}),F("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 Qr(){return ot("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[F("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),F("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"}),F("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),F("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 Xr(){return ot("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ot("g",{clipPath:"url(#clip0_1185_7785)",children:[F("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"}),F("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"})]}),F("defs",{children:F("clipPath",{id:"clip0_1185_7785",children:F("rect",{width:"28",height:"28",fill:"white"})})})]})}function Jr(){return ot("svg",{width:"40",height:"40",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[F("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"}),F("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"}),F("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"}),F("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 ei(){return F("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:F("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 ti(){return F("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:F("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:Ln},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Ln,featured:!0},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Ln,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:Yr,rdns:"io.metamask"},binance:{id:"binance",name:"Binance",description:"Mobile app only \u2014 Add CROSS network first",icon:Kr},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Qr,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Xr,badge:"For SHOP"}};function bo(e){return xo[e]}var vo={google:{id:"google",name:"Google",icon:Jr},apple:{id:"apple",name:"Apple",icon:ei}};function ni(e){return vo[e]}import{Fragment as ii,jsx as A,jsxs as ie}from"react/jsx-runtime";function ws({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 ie("button",{type:"button",className:Y("wcm-wallet-item",i&&"wcm-wallet-item--featured"),onClick:n,children:[ie("div",{className:"wcm-wallet-item-left",children:[A("div",{className:"wcm-wallet-icon",children:A(r,{})}),ie("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 hs({social:e,onSignIn:t}){let o=e.icon,n=`Sign in with ${e.name}`;return ie("button",{type:"button",className:"wcm-social-item",onClick:t,"aria-label":n,children:[A("span",{className:"wcm-social-icon",children:A(o,{})}),A("span",{className:"wcm-social-name",children:n})]})}function oi(){let{wallets:e,activeWalletIds:t,socialProviders:o,activeSocialIds:n,termsUrl:r,privacyUrl:i,isDetected:s,close:l,isMobile:d}=qt(),c=t.filter(x=>{let h=bo(x).visibility;return!h||h==="always"?!0:h==="desktop-only"?!d:h==="mobile-only"?d:!0}),a=n.length>0,p=c.length>0;return ie(ii,{children:[ie("div",{className:"wcm-header",children:[ie("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:l,"aria-label":"Close",children:A(ti,{})})]}),A("div",{className:"wcm-divider"}),ie("div",{className:"wcm-body",children:[a&&ie(ii,{children:[!d&&ie("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(x=>{let h=ni(x);return A(hs,{social:h,onSignIn:()=>{o[x]?.(),l()}},x)})}),p&&ie("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"})]})]}),p&&A("div",{className:"wcm-wallet-list",children:c.map(x=>{let h=bo(x),v=h.rdns?s(h.rdns):!1;return A(ws,{wallet:h,detected:v,onConnect:()=>{e[x]?.(),l()}},x)})}),ie("p",{className:"wcm-terms",children:["By continuing, you agree to NEXUS"," ",A(ri,{href:r,children:"Terms of Service"})," and consent to its ",A(ri,{href:i,children:"Privacy Policy"}),"."]})]})]})}function ri({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 ai({className:e}){let{isMobile:t,theme:o,portalStyle:n}=qt();return t?ie(Rn.Portal,{children:[A(Rn.Overlay,{className:"wcm-overlay"}),ie(Rn.Content,{className:Y("wcm-drawer-content",e),"data-theme":o,style:n,children:[A(Rn.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),A("div",{className:"wcm-drawer-handle"}),A("div",{className:"wcm-drawer-body",children:A(oi,{})})]})]}):ie($e.Portal,{children:[A($e.Overlay,{className:"wcm-overlay"}),ie($e.Content,{className:Y("wcm-dialog-content",e),"data-theme":o,style:n,children:[A($e.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),A($e.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(oi,{})})]})]})}D(`[data-theme=dark]{--wcm-primary: var(--cck-primary, #9b8cef);--wcm-secondary: var(--cck-secondary, #ff3aa3);--wcm-surface-bg: var(--cck-surface-bg, #202530);--wcm-surface-default: var(--cck-surface-default, #292f40);--wcm-surface-subtle: var(--cck-surface-subtle, #313b51);--wcm-border-default: var(--cck-border-default, #313b51);--wcm-border-subtle: var(--cck-border-subtle, #49556e);--wcm-texticon-primary: var(--cck-texticon-primary, #ffffff);--wcm-texticon-secondary: var(--cck-texticon-secondary, #eff0f4);--wcm-texticon-tertiary: var(--cck-texticon-tertiary, #717d97)}[data-theme=light]{--wcm-primary: var(--cck-primary, #019d92);--wcm-secondary: var(--cck-secondary, #e70077);--wcm-surface-bg: var(--cck-surface-bg, #ffffff);--wcm-surface-default: var(--cck-surface-default, rgba(18, 18, 18, .05));--wcm-surface-subtle: var(--cck-surface-subtle, rgba(18, 18, 18, .1));--wcm-border-default: var(--cck-border-default, rgba(18, 18, 18, .05));--wcm-border-subtle: var(--cck-border-subtle, rgba(18, 18, 18, .1));--wcm-texticon-primary: var(--cck-texticon-primary, #121212);--wcm-texticon-secondary: var(--cck-texticon-secondary, rgba(18, 18, 18, .7));--wcm-texticon-tertiary: var(--cck-texticon-tertiary, rgba(18, 18, 18, .5))}
|
|
14
|
+
`);D(`.wcm-overlay{position:fixed;inset:0;z-index:100000;background:#0009}.wcm-dialog-content{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(--wcm-surface-bg);border:1px solid var(--wcm-border-default);border-radius:24px;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:rgba(255,255,255,.15) transparent}[data-theme=light] .wcm-dialog-body,[data-theme=light] .wcm-drawer-body{scrollbar-color:rgba(0,0,0,.12) 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:#ffffff26;border-radius:4px}.wcm-dialog-body::-webkit-scrollbar-thumb:hover,.wcm-drawer-body::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wcm-dialog-body::-webkit-scrollbar-thumb,[data-theme=light] .wcm-drawer-body::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wcm-dialog-body::-webkit-scrollbar-thumb:hover,[data-theme=light] .wcm-drawer-body::-webkit-scrollbar-thumb:hover{background:#0003}.wcm-drawer-content{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(--wcm-surface-bg);border-top-left-radius:24px;border-top-right-radius:24px;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:24px 0 0 24px}.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 24px 24px 0}.wcm-drawer-content[data-vaul-drawer-direction=top]{inset:0 0 auto;border-radius:0 0 24px 24px}.wcm-drawer-handle{width:60px;height:4px;border-radius:999px;background:var(--wcm-border-subtle);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{position:relative;display:flex;flex-direction:column;align-items:center;padding:24px 24px 20px}.wcm-header-text{display:flex;flex-direction:column;gap:4px;width:100%;padding-right:48px}.wcm-title{font-family:inherit;font-weight:600;font-size:22px;line-height:1.3;color:var(--wcm-texticon-primary);margin:0}.wcm-subtitle{font-family:inherit;font-weight:400;font-size:14px;line-height:1.3;color:var(--wcm-texticon-secondary);margin:0}.wcm-section-header{display:flex;align-items:center;gap:8px;width:100%}.wcm-section-title{font-family:inherit;font-weight:600;font-size:18px;line-height:1.3;color:var(--wcm-texticon-primary)}.wcm-recommended-badge{display:inline-flex;align-items:center;justify-content:center;height:24px;padding:0 8px;background:var(--wcm-primary);border-radius:8px;font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:#fff;white-space:nowrap}.wcm-close-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:48px;height:48px;border:none;border-radius:999px;background:transparent;color:var(--wcm-texticon-primary);cursor:pointer;padding:0}.wcm-close-btn:hover{color:var(--wcm-texticon-secondary)}.wcm-divider{width:100%;height:1px;background:var(--wcm-border-default);border:none;margin:0}.wcm-body{display:flex;flex-direction:column;gap:16px;padding:20px 24px 24px}.wcm-wallet-item{display:flex;align-items:center;gap:8px;width:100%;height:75px;padding:16px;background:var(--wcm-surface-default);border:1px solid var(--wcm-border-default);border-radius:12px;cursor:pointer;text-align:left;transition:border-color .15s;font-family:inherit}.wcm-wallet-item:hover,.wcm-wallet-item--featured{border-color:var(--wcm-primary)}.wcm-wallet-item-left{display:flex;align-items:center;gap:16px;flex:1;min-width:0}.wcm-wallet-icon{flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg{width:32px;height:32px}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px;min-width:0}.wcm-wallet-name{font-family:inherit;font-weight:600;font-size:18px;line-height:1.3;color:var(--wcm-texticon-primary);white-space:nowrap}.wcm-wallet-badge{display:inline-flex;align-items:center;justify-content:center;height:20px;padding:0 8px;border:1px solid var(--wcm-secondary);border-radius:999px;font-family:inherit;font-weight:700;font-size:12px;line-height:1.3;color:var(--wcm-secondary);white-space:nowrap}.wcm-install-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;background:var(--wcm-primary);border-radius:12px;font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-surface-bg);white-space:nowrap}.wcm-installed-label{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;background:var(--wcm-surface-subtle);border-radius:12px;font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary);white-space:nowrap}.wcm-terms-link{color:var(--wcm-primary);text-decoration:none}.wcm-terms-link:hover{text-decoration:underline}.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(--wcm-surface-default);border:1px solid var(--wcm-border-default);border-radius:12px;cursor:pointer;transition:border-color .15s;font-family:inherit;color:var(--wcm-texticon-primary)}.wcm-social-item:hover{border-color:var(--wcm-primary)}.wcm-dialog-body .wcm-social-item{flex-direction:column;align-items:flex-start;justify-content:center;gap:8px;height:111px;padding:24px 16px}.wcm-drawer-body .wcm-social-item{flex-direction:row;align-items:center;justify-content:flex-start;gap:16px;padding:16px;min-height:60px}.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:inherit;font-weight:600;font-size:18px;line-height:1.3;color:var(--wcm-texticon-primary);white-space:nowrap}.wcm-separator{display:flex;align-items:center;gap:16px;width:100%}.wcm-separator-line{flex:1;height:1px;background:var(--wcm-border-default)}.wcm-separator-text{font-family:inherit;font-weight:400;font-size:16px;line-height:1.3;color:var(--wcm-texticon-tertiary);white-space:nowrap}.wcm-wallet-list{display:flex;flex-direction:column;gap:8px}.wcm-terms{font-family:inherit;font-weight:400;font-size:12px;line-height:1.3;color:var(--wcm-texticon-secondary);text-align:center;margin:0}.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}
|
|
15
|
+
`);D(`@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)}}
|
|
16
|
+
`);import{jsx as Zt}from"react/jsx-runtime";var bs={};function vs({wallets:e,socialProviders:t=bs,termsUrl:o,privacyUrl:n,theme:r="dark",mobileBreakpoint:i=768,drawerDirection:s="bottom",dialogWidth:l,drawerMaxWidth:d,drawerMinWidth:c,style:a,open:p,onOpenChange:x,children:h}){let v=Lt(`(max-width: ${i}px)`),[g,w]=Ve.useState(!1),L=p!==void 0,M=L?p:g,T=Ve.useCallback(W=>{L||w(W),x?.(W)},[L,x]),N=Ve.useCallback(()=>T(!1),[T]),{isDetected:$}=Nn(),y=Ve.useMemo(()=>Object.keys(e),[e]),I=Ve.useMemo(()=>Object.keys(t),[t]),S=Ve.useMemo(()=>{let W={};return l&&(W["--wcm-dialog-width"]=l),d&&(W["--wcm-drawer-max-width"]=d),c&&(W["--wcm-drawer-min-width"]=c),{...W,...a}},[l,d,c,a]),C=Ve.useMemo(()=>({theme:r,isMobile:v,open:M,setOpen:T,close:N,wallets:e,activeWalletIds:y,socialProviders:t,activeSocialIds:I,termsUrl:o,privacyUrl:n,isDetected:$,portalStyle:S}),[r,v,M,T,N,e,y,t,I,o,n,$,S]),q=Zt("div",{"data-theme":r,style:S,children:h});return v?Zt(Cn.Provider,{value:C,children:Zt(xs.Root,{direction:s,open:M,onOpenChange:T,noBodyStyles:!0,children:q},"drawer")}):Zt(Cn.Provider,{value:C,children:Zt(si.Root,{open:M,onOpenChange:T,children:q})})}var li=Object.assign(vs,{Trigger:Zr,Content:ai});var ys='<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>',ks='<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>',Cs='<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>',Ns='<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>',Ls='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><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 Yt(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var En=Yt(ys),Pn=Yt(ks),Sn=Yt(Cs),In=Yt(Ns),Tn=Yt(Ls);import{jsx as it,jsxs as yo}from"react/jsx-runtime";function di({isConnecting:e,address:t,provider:o,providerName:n,accountName:r,sendAccounts:i,onConnect:s,onDisconnect:l,onCopy:d,onSelectWallet:c,label:a="Connect Wallet",connectingLabel:p="Connecting...",disconnectLabel:x,className:h,theme:v="dark",env:g,showBalance:w=!0,showPortfolio:L,drawerDirection:M,modal:T,connectorId:N,style:$,sendTransaction:y,getTransactionReceipt:I,estimateGas:S}){if(e)return yo("button",{type:"button",disabled:!0,className:h,style:h?void 0:{...rt.button,...rt.buttonLoading},"aria-busy":"true",children:[it("style",{children:Ss}),it("span",{style:rt.spinner,"aria-hidden":"true"}),p]});if(t){let C=n??Ps(o),q=o?Rs[o]:void 0;return yo(_t,{env:g,theme:v,drawerDirection:M,modal:T,showBalance:w,showPortfolio:L,walletAddress:t,accountName:r,sendAccounts:i,connectorId:N,onSelectWallet:c,onCopyAddress:d?(W,ve)=>{ve&&d()}:void 0,onDisconnect:l,disconnectLabel:x,style:$,sendTransaction:y,getTransactionReceipt:I,estimateGas:S,children:[it(_t.Trigger,{asChild:!0,children:yo("button",{type:"button",className:h,style:h?void 0:rt.connectedBtn,"aria-label":`Connected with ${C}: ${ci(t)}`,children:[q?it("img",{src:q,alt:"",width:20,height:20,style:rt.connectedIcon}):it("span",{style:rt.connectedIconPlaceholder,"aria-hidden":"true"}),it("span",{style:rt.connectedAddress,children:ci(t)})]})}),it(_t.Content,{align:"end",sideOffset:8})]})}return it("button",{type:"button",onClick:s,className:h,style:h?void 0:rt.button,children:a})}var Rs={google:In,apple:Tn,cross:En,metamask:Pn,binance:Sn},Es={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Ps(e){return e?Es[e]:"Wallet"}function ci(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}var Ss="@keyframes cross-cb-spin{to{transform:rotate(360deg)}}",rt={button:{padding:"10px 24px",borderRadius:"12px",border:"none",background:"#00D5AA",color:"#000",fontWeight:700,fontSize:"14px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"8px",transition:"opacity 0.15s",fontFamily:"inherit"},buttonLoading:{opacity:.7,cursor:"default"},spinner:{display:"inline-block",width:"14px",height:"14px",border:"2px solid #00000030",borderTopColor:"#000",borderRadius:"50%",animation:"cross-cb-spin 0.6s linear infinite"},connectedBtn:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",borderRadius:"999px",border:"1px solid var(--wi-border-default, #2a2d3a)",background:"var(--wi-surface-default, #1e232e)",color:"var(--wi-texticon-primary, #ffffff)",fontWeight:600,fontSize:"14px",cursor:"pointer",fontFamily:"inherit"},connectedIcon:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"contain",flexShrink:0,background:"transparent"},connectedIconPlaceholder:{display:"inline-block",width:"20px",height:"20px",borderRadius:"50%",background:"var(--wi-surface-subtle, #2a2d3a)",flexShrink:0},connectedAddress:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"13px",letterSpacing:"0.02em"}};export{Tn as APPLE_ICON,Lo as AppLauncher,_o as AppLauncherContent,Io as AppLauncherTrigger,Sn as BINANCE_ICON,sn as CONNECTOR_REGISTRY,En as CROSSX_ICON,di as ConnectButton,Wn as ConnectorId,In as GOOGLE_ICON,Pn as METAMASK_ICON,vo as SOCIAL_REGISTRY,pn as SendPage,ro as TOKEN_STATS_QUERY_KEY,oo as USER_BALANCE_QUERY_KEY,xo as WALLET_REGISTRY,li as WalletConnectModal,_t as WalletInfo,Wr as WalletPortfolio,At as WalletPortfolioBody,ge as resolveEnvironment,rn as useGlobalMenu,St as useTokenBalance,It as useTokenStats,Nn as useWalletDetect};
|