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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import*as Te from"react";import*as lo from"@radix-ui/react-popover";import{Drawer as Gr}from"vaul";import{createContext as $r,useContext as qr}from"react";var Wt=$r(null);function it(){let e=qr(Wt);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as jr,useEffect as zr}from"react";function Re(e){let[t,r]=jr(!1);return zr(()=>{let o=window.matchMedia(e);r(o.matches);let n=l=>r(l.matches);return o.addEventListener("change",n),()=>o.removeEventListener("change",n)},[e]),t}function P(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}P(`[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)}
1
+ import*as Me from"react";import*as vo from"@radix-ui/react-popover";import{Drawer as an}from"vaul";import{createContext as tn,useContext as on}from"react";var Ut=tn(null);function dt(){let e=on(Ut);if(!e)throw new Error("AppLauncher compound components must be used within <AppLauncher>");return e}import{useState as rn,useEffect as nn}from"react";function Ee(e){let[t,o]=rn(!1);return nn(()=>{let r=window.matchMedia(e);o(r.matches);let n=l=>o(l.matches);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},[e]),t}function P(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}P(`[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
2
  `);P(`.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
3
  `);P(`@keyframes al-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
4
- `);P(`.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:24px 4px;box-sizing:border-box}.al-popover-content .al-grid{grid-template-columns:repeat(4,100px);row-gap:24px;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:8px;padding:8px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:8px;width:100%;overflow:visible}.al-popover-content .al-grid-item-icon{width:54px;height:54px;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;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{grid-template-columns:1fr;max-width:100%;overflow:hidden;flex-shrink:0;gap:4px}.al-drawer-content .al-grid-item{max-width:100%;overflow:hidden}.al-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;flex-shrink:0}.al-drawer-title{font-family:Inter,sans-serif;font-size:18px;font-weight:700;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:-.16px;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:-.1px;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
- `);P("");import{jsx as _t}from"react/jsx-runtime";function co({env:e="production",theme:t="dark",mobileBreakpoint:r=768,domain:o,children:n}){let l=Re(`(max-width: ${r}px)`),[i,a]=Te.useState(!1),s=Te.useCallback(()=>a(!1),[]),c=Te.useMemo(()=>({env:e,theme:t,isMobile:l,open:i,domain:o,close:s}),[e,t,l,i,o,s]);return _t(Wt.Provider,{value:c,children:l?_t(Gr.Root,{direction:"right",open:i,onOpenChange:a,noBodyStyles:!0,children:n},"drawer"):_t(lo.Root,{open:i,onOpenChange:a,children:n},"popover")})}import*as uo from"@radix-ui/react-popover";import{Drawer as Yr}from"vaul";import{jsx as Z,jsxs as Zr}from"react/jsx-runtime";function po({size:e=18}){return Zr("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Z("rect",{width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function mo(){return Z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Z("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fo(){return Z("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Z("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as st}from"react/jsx-runtime";function wo({asChild:e,children:t}){let{isMobile:r,theme:o}=it(),n=t!=null,l=e??!0,i=n?t:st("button",{type:"button",className:"al-trigger-btn","data-theme":o,children:st(po,{size:r?12:18})});return r?st(Yr.Trigger,{asChild:l,children:i}):st(uo.Trigger,{asChild:l,children:i})}import*as ve from"react";import*as ct from"@radix-ui/react-popover";import{Drawer as Ee}from"vaul";import{useQuery as Kr}from"@tanstack/react-query";var go={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"};function lt(e="production"){return Kr({queryKey:["global-menu",e],queryFn:async({signal:t})=>{let r=await fetch(go[e],{cache:"no-store",signal:t});if(!r.ok)throw new Error(`Failed to fetch global menu: ${r.status}`);return r.json()},staleTime:0,gcTime:0,refetchOnMount:!0})}function V(...e){return e.filter(Boolean).join(" ")}import{jsx as $,jsxs as Ze}from"react/jsx-runtime";function xo({align:e="end",sideOffset:t=12,className:r}){let{env:o,theme:n,isMobile:l,domain:i,close:a}=it(),{data:s}=lt(o),c=ve.useMemo(()=>(s?.items??[]).sort((u,C)=>u.order-C.order),[s]),d=8,m=ve.useRef(null),R=ve.useCallback(u=>{m.current={x:u.clientX,y:u.clientY}},[]),k=typeof window<"u"?window.location.pathname:"",b=ve.useCallback((u,C)=>{if(m.current){let N=u.clientX-m.current.x,O=u.clientY-m.current.y;if(m.current=null,Math.abs(N)>d||Math.abs(O)>d)return}let M=C.url[o]??C.url.production,x=ho(M,i);if(!x)try{let N=new URL(M).pathname;if(k===N||k.startsWith(N+"/")){a();return}}catch{}x?window.open(M,"_blank","noopener,noreferrer"):window.location.href=M,a()},[o,i,a,k]),f=$("div",{className:"al-grid","data-theme":n,children:c.map(u=>{let C=u.url[o]??u.url.production,M=ho(C,i),x=!1;if(!M)try{let N=new URL(C).pathname;x=k===N||k.startsWith(N+"/")}catch{x=!1}return Ze("button",{type:"button",className:"al-grid-item","data-active":x||void 0,onPointerDown:R,onClick:N=>b(N,u),children:[Ze("div",{className:"al-grid-item-left",children:[$("div",{className:"al-grid-item-icon",children:$("img",{src:u.iconUrl,alt:u.label,width:24,height:24,loading:"lazy"})}),$("span",{className:"al-grid-item-label",children:u.label}),u.isNew&&$("span",{className:"al-badge-new",children:"N"})]}),$("div",{className:"al-grid-item-right",children:u.badge&&$("span",{className:"al-badge",children:u.badge})})]},u.id)})});return l?Ze(Ee.Portal,{children:[$(Ee.Overlay,{className:"al-drawer-overlay"}),Ze(Ee.Content,{className:V("al-drawer-content",r),"data-theme":n,children:[Ze("div",{className:"al-drawer-header",children:[$(Ee.Close,{className:"al-drawer-close",children:$(mo,{})}),$(Ee.Title,{className:"al-drawer-title",children:"CROSS Services"}),$(Ee.Close,{className:"al-drawer-close",children:$(fo,{})})]}),$("div",{className:"al-drawer-body",children:f})]})]}):$(ct.Portal,{children:$(ct.Content,{align:e,sideOffset:t,className:V("al-popover-content",r),"data-theme":n,children:f})})}function ho(e,t){try{let r=new URL(e).hostname;return typeof window>"u"?!0:r!==(t??window.location.hostname)}catch{return!1}}import*as Y from"react";import*as vr from"@radix-ui/react-popover";import{Drawer as pa}from"vaul";import{createContext as Qr,useContext as Xr}from"react";var St=Qr(null);function le(){let e=Xr(St);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var Dt=(o=>(o.CROSSx="crossx",o.MetaMask="io.metamask",o.Binance="com.binance.wallet",o))(Dt||{}),pt={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 Eo from"@radix-ui/react-popover";import{Drawer as Jr}from"vaul";import{jsx as W,jsxs as dt}from"react/jsx-runtime";function bo({size:e=16,className:t}){return dt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 At({size:e=16,className:t}){return W("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("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 Ot({size:e=16,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Bt({size:e=24,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function vo({size:e=20,className:t}){return dt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 yo({size:e=20,className:t}){return W("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:W("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 ko({size:e=20,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Co({size:e=20,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function No({size:e=20,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Lo({size:e=16,className:t}){return dt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 Io({size:e=16,className:t}){return dt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Po({size:e=42,className:t}){return W("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:W("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 ye from"bignumber.js";function mt(e,t){if(!e||e==="0")return"0.00";let r=new ye(e).shiftedBy(-t),o=r.isGreaterThanOrEqualTo(1)?2:4;return r.toFormat(o,ye.ROUND_DOWN)}function Me(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ft(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let r=t>=1?2:4,o=Math.pow(10,r);return`$${(Math.floor(t*o)/o).toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}function Ro(e,t,r){let n=new ye(e).shiftedBy(-t).multipliedBy(new ye(r));return n.isZero()||n.isNaN()?"$0.00":`$${(n.integerValue(ye.ROUND_DOWN).isGreaterThanOrEqualTo(1)?n.decimalPlaces(2,ye.ROUND_DOWN):n.decimalPlaces(4,ye.ROUND_DOWN)).toFormat()}`}function To(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 r=t;if(r.includes("e")||r.includes("E")){let i=Number(r);if(!Number.isFinite(i)||i===0)return{displayValue:"0",isLowerBound:!1};r=i.toFixed(18).replace(/\.?0+$/,"")}let[o="0",n=""]=r.split(".");if(Number(o)>=1){let i=n.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(o).toLocaleString("en-US")}.${i}`,isLowerBound:!1}}return n.length<4?{displayValue:`${o}.${n}`,isLowerBound:!1}:n.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${n.slice(0,4)}`,isLowerBound:!1}}import{jsx as ft,jsxs as en}from"react/jsx-runtime";function Mo({asChild:e,className:t,children:r}){let{isMobile:o,theme:n,walletAddress:l}=le(),i=r!=null,a=e??!0,s=i?r:en("button",{type:"button",className:V("wi-trigger-btn",t),"data-theme":n,"data-mobile":o||void 0,children:[ft(bo,{size:o?14:16}),ft("span",{className:"wi-trigger-address",children:Me(l)})]});return o?ft(Jr.Trigger,{asChild:a,children:s}):ft(Eo.Trigger,{asChild:a,children:s})}import*as A from"react";import*as yt from"@radix-ui/react-popover";import{Drawer as vt}from"vaul";import Ke from"bignumber.js";import{useQueries as on}from"@tanstack/react-query";import{useMemo as rn}from"react";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"},X={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Vt={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"},Wo={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Ht(e,t){let r=X[e];if(t===r.cross)return Wo.cross;if(t===r.bsc)return Wo.bsc}var tn={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function _o(e,t,r={}){if(!t||!t.startsWith("0x"))return;let{size:o=120,bg:n,format:l="png"}=r,i=tn[e],a=n?`&bg=${n}`:"";return`${i}/portrait/evm/${t}.${l}?size=${o}${a}`}var Ut="user-balance";async function nn(e,t,r,o){let n=new URLSearchParams({networkId:`eip155:${t}`,account:r}),l=await fetch(`${e}/v1/public/token/balance?${n}`,{cache:"no-store",signal:o});if(!l.ok)throw new Error(`Failed to fetch token balance: ${l.status}`);let i=await l.json();if(i.code!==200)throw new Error(`Token balance API error: ${i.code}`);return i.data}function We(e,t,r=!0){let o=ee[e],n=X[e],l=[n.cross,n.bsc],i=on({queries:l.map(d=>({queryKey:[Ut,e,t,d],queryFn:({signal:m})=>nn(o,d,t,m),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1}))}),a=i.some(d=>d.isLoading),s=i.some(d=>d.isError);return{tokens:rn(()=>{let d=[];for(let m of i)m.data&&d.push(...m.data);return d},[i]),isLoading:a,isError:s}}import{useQuery as an,useQueries as sn}from"@tanstack/react-query";import{useMemo as ln}from"react";var cn="forge-holdings",pn="forge-token-image";async function dn(e,t,r){let o=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:r});if(!o.ok)throw new Error(`Failed to fetch forge holdings: ${o.status}`);let n=await o.json();if(!n.success)throw new Error("Forge holdings API error");return n.data.items}async function mn(e,t,r){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:r});if(!o.ok)return{address:t,image_url:""};let n=await o.json();return n.success?{address:t,image_url:n.data.token.image_url}:{address:t,image_url:""}}function So(e,t,r=!0){let o=Vt[e],{data:n,...l}=an({queryKey:[cn,e,t],queryFn:({signal:i})=>dn(o,t,i),enabled:!!t&&r,staleTime:0,refetchInterval:r?5e3:!1});return{holdings:n??[],...l}}function Do(e,t,r=!0){let o=Vt[e],n=sn({queries:t.map(i=>({queryKey:[pn,e,i],queryFn:({signal:a})=>mn(o,i,a),enabled:r,staleTime:1/0}))});return{imageMap:ln(()=>{let i=new Map;for(let a of n)a.data&&i.set(a.data.address,a.data.image_url);return i},[n])}}import{useQuery as fn}from"@tanstack/react-query";import{useMemo as un}from"react";var $t="token-stats";function ke(e,t){return`${e}:${t.toLowerCase()}`}function _e(e,t=!0){let r=ee[e],{data:o,...n}=fn({queryKey:[$t,e],queryFn:async({signal:i})=>{let a=await fetch(`${r}/v1/public/token/stats`,{cache:"no-store",signal:i});if(!a.ok)throw new Error(`Failed to fetch token stats: ${a.status}`);let s=await a.json();if(s.code!==200)throw new Error(`Token stats API error: ${s.code}`);return s},enabled:t,staleTime:3e4});return{statsMap:un(()=>{let i=new Map;if(!o?.data)return i;for(let a of o.data){let s=ke(a.chain_id,a.address);i.set(s,a)}return i},[o]),...n}}import{useQuery as wn}from"@tanstack/react-query";import{useMemo as gn}from"react";var hn="token-info";function qt(e,t){return`${t.toLowerCase()}_${e}`}function Ao(e,t=!0){let r=ee[e],{data:o,...n}=wn({queryKey:[hn,e],queryFn:async({signal:i})=>{let a=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:i});if(!a.ok)throw new Error(`Failed to fetch token info: ${a.status}`);let s=await a.json();if(s.code!==200)throw new Error(`Token info API error: ${s.code}`);return s},enabled:t,staleTime:1/0});return{categoryMap:gn(()=>{let i=new Map;if(!o?.data)return i;for(let a of o.data){let s=qt(a.chain_id,a.address);i.set(s,a.category)}return i},[o]),...n}}import{useMemo as xn}from"react";import jt from"bignumber.js";function Oo(e,t,r){let{tokens:o,isLoading:n}=We(e,t,r),{statsMap:l}=_e(e,r);return xn(()=>{let i=new jt(0);for(let d of o){let m=l.get(ke(d.chainId,d.address));if(!m)continue;let k=new jt(d.quantity.numeric).shiftedBy(-d.quantity.decimals).multipliedBy(new jt(m.price));k.isNaN()||(i=i.plus(k))}let a=i.toFixed(),{displayValue:s,isLowerBound:c}=To(a);return{totalUsd:a,displayValue:s,isLowerBound:c,isLoading:n}},[o,l,n])}import{QRCodeSVG as ia}from"qrcode.react";import*as Ne from"react";import{Drawer as na}from"vaul";import{createContext as bn,useContext as vn}from"react";var Ye=bn(null);function j(){let e=vn(Ye);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as yn}from"vaul";import{jsx as Bo}from"react/jsx-runtime";function Fo({asChild:e,children:t}){let{walletAddress:r}=j(),o=t!=null,n=e??!0,l=o?t:Bo("button",{type:"button",children:Me(r)});return Bo(yn.Trigger,{asChild:n,children:l})}import{Drawer as bt}from"vaul";import*as J from"react";import{useQueryClient as ta}from"@tanstack/react-query";import{useMemo as Pn}from"react";import zt from"bignumber.js";import{useQuery as kn}from"@tanstack/react-query";import{useMemo as Uo}from"react";var ut={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"},Vo={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},wt={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"},ce={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Ho={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 Cn="wp:reward-pools";function gt(e,t=!0){let r=ut[e],{data:o,...n}=kn({queryKey:[Cn,e],queryFn:async({signal:a})=>{let s=await fetch(`${r}/v1/pools`,{cache:"no-store",signal:a});if(!s.ok)throw new Error(`Failed to fetch pools: ${s.status}`);let c=await s.json();if(c.code!==200)throw new Error(`Pools API error: ${c.code}`);return c},enabled:t,staleTime:0}),l=Uo(()=>o?.data.pools.filter(a=>a.pool_type==="CrossPool")??[],[o]),i=Uo(()=>o?.data.pools.filter(a=>a.pool_type==="GamePool")??[],[o]);return{crossPools:l,gamePools:i,allPools:o?.data.pools??[],...n}}import{useQuery as Nn}from"@tanstack/react-query";import{useMemo as Ln}from"react";var In="wp:user-deposits";function ht(e,t,r=!0){let o=ut[e],n=r&&!!t,{data:l,...i}=Nn({queryKey:[In,e,t],queryFn:async({signal:s})=>{let c=await fetch(`${o}/v1/users/${t}/deposits`,{cache:"no-store",signal:s});if(!c.ok)throw new Error(`Deposits fetch failed: ${c.status}`);let d=await c.json();if(d.code!==200)throw new Error(`Deposits API error: ${d.code}`);return d},enabled:n,staleTime:0});return{depositMap:Ln(()=>{let s=new Map;if(!l?.data.user_deposits)return s;for(let c of l.data.user_deposits)s.set(c.pool_address.toLowerCase(),c);return s},[l]),deposits:l?.data.user_deposits??[],...i}}import{useQuery as $o}from"@tanstack/react-query";import{useMemo as qo}from"react";function te(e,t,r,o=!0){let n=Ho[e][t],l=o&&!!r,{data:i,...a}=$o({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:b})=>{let f=await fetch(`${n}/pair-info`,{cache:"no-store",signal:b});if(!f.ok)throw new Error(`pair-info fetch failed: ${f.status}`);let u=await f.json();if(u.code!==200)throw new Error(`pair-info API error: ${u.code}`);return u},enabled:o,staleTime:0}),s=i?.data??[],c=qo(()=>{let b=new Map;for(let f of s)b.set(f.pair_address.toLowerCase(),f);return b},[s]),{data:d,...m}=$o({queryKey:["wp:dex-orders",e,t,r],queryFn:async({signal:b})=>{let f=Math.floor(Date.now()/1e3),u=new URLSearchParams({owner:r,size:"200",start_date:"0",end_date:String(f)}),C=await fetch(`${n}/open-order?${u}`,{cache:"no-store",signal:b});if(!C.ok)throw new Error(`open-order fetch failed: ${C.status}`);let M=await C.json();if(M.code!==200)throw new Error(`open-order API error: ${M.code}`);return M.data?.data??[]},enabled:l,staleTime:0}),R=d??[],k=qo(()=>{let b=new Map;for(let f of R){let u=f.pair.toLowerCase();b.has(u)||b.set(u,{buys:[],sells:[]});let C=b.get(u);f.order_side===1?C.buys.push(f):C.sells.push(f)}return b},[R]);return{allPairs:s,pairMap:c,orders:R,ordersByPair:k,isEmpty:R.length===0,isLoading:a.isLoading||m.isLoading}}var Rn=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],jo="var(--wp-green)",zo=4;function Go(e,t,r=!0){let o=r&&!!t,{allPools:n}=gt(e,o),{depositMap:l}=ht(e,t,o),{allPairs:i,pairMap:a,ordersByPair:s}=te(e,"cross",t,o),{allPairs:c,pairMap:d,ordersByPair:m}=te(e,"crossd",t,o),{allPairs:R,pairMap:k,ordersByPair:b}=te(e,"forge",t,o);return Pn(()=>{let f=new Map,u=new Map,C=(h,v)=>{!Number.isFinite(v)||v<=0||u.set(h,(u.get(h)??0)+v)};for(let h of n){let v=Number(h.deposit_token.price);v>0&&f.set(h.deposit_token.symbol,v);for(let _ of h.reward_tokens){let L=Number(_.price);L>0&&f.set(_.symbol,L)}}for(let h of[...i,...c,...R]){let v=f.get(h.quote_symbol),_=Number(h.billboard?.price);v&&_>0&&!f.has(h.base_symbol)&&f.set(h.base_symbol,_*v)}for(let h of n){let v=l.get(h.pool_address.toLowerCase());if(!v)continue;let _=new zt(v.deposited_amount).shiftedBy(-h.deposit_token.decimals).toNumber();if(C(h.deposit_token.symbol,_),h.reward_tokens.length>0){let L=h.reward_tokens[0],B=new zt(v.claimable_reward).shiftedBy(-L.decimals).toNumber();C(L.symbol,B)}}let M=[{pairMap:a,ordersByPair:s},{pairMap:d,ordersByPair:m},{pairMap:k,ordersByPair:b}];for(let{pairMap:h,ordersByPair:v}of M)for(let[_,L]of v){let B=h.get(_);if(B){for(let z of L.buys){let re=Number(z.amount)-Number(z.filled);C(B.quote_symbol,re*Number(z.price))}for(let z of L.sells){let re=Number(z.amount)-Number(z.filled);C(B.base_symbol,re)}}}let x=[],N=0;for(let[h,v]of u){let _=f.get(h)??0,L=v*_;L>0&&(x.push({symbol:h,usdValue:L}),N+=L)}x.sort((h,v)=>v.usdValue-h.usdValue);let O=[];if(N>0){let h=x.slice(0,zo),v=x.slice(zo);for(let L=0;L<h.length;L++)O.push({symbol:h[L].symbol,usdValue:h[L].usdValue,percentage:Math.round(h[L].usdValue/N*100),color:Rn[L]??jo});if(v.length>0){let L=v.reduce((B,z)=>B+z.usdValue,0);O.push({symbol:"Others",usdValue:L,percentage:Math.round(L/N*100),color:jo})}let _=O.reduce((L,B)=>L+B.percentage,0);_!==100&&O.length>0&&(O[0].percentage+=100-_)}return{totalUsd:N,formattedTotal:N>0?`$${new zt(N).toFormat(2)}`:"$0.00",segments:O}},[n,l,i,a,s,c,d,m,R,k,b])}import{jsx as Se,jsxs as Tn}from"react/jsx-runtime";function Zo({size:e=22,className:t}){return Se("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Se("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Yo({size:e=22,className:t}){return Tn("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[Se("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),Se("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 Ko({size:e=12,className:t}){return Se("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Se("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 En}from"@tanstack/react-query";import{useMemo as Mn}from"react";var Wn="wp:token-info";function pe(e,t=!0){let r=ee[e],o=X[e].cross,{data:n,...l}=En({queryKey:[Wn,e],queryFn:async({signal:c})=>{let d=await fetch(`${r}/v1/public/token/info`,{cache:"no-store",signal:c});if(!d.ok)throw new Error(`Failed to fetch token info: ${d.status}`);let m=await d.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:i,byChainSym:a}=Mn(()=>{let c=new Map,d=new Map;if(!n?.data)return{byChainAddr:c,byChainSym:d};for(let m of n.data){let R=m.address.toLowerCase();c.set(`${m.chain_id}:${R}`,m),c.set(R,m);let k=m.symbol.replace(/^t/,"").toUpperCase(),b=`${m.chain_id}:${k}`;d.has(b)||d.set(b,m),d.has(k)||d.set(k,m)}return{byChainAddr:c,byChainSym:d}},[n]);return{getTokenImage:(c,d)=>{let m=c.toLowerCase(),R=i.get(`${o}:${m}`);if(R?.image)return R.image;let k=i.get(m);if(k?.image)return k.image;if(d){let b=d.replace(/^t/,"").toUpperCase(),f=a.get(`${o}:${b}`);if(f?.image)return f.image;let u=a.get(b);if(u?.image)return u.image}return""},...l}}import{jsx as xt,jsxs as Qo}from"react/jsx-runtime";function oe({title:e,icon:t,iconFit:r="cover",isEmpty:o,children:n}){return Qo("div",{className:"wp-svc-card",children:[Qo("div",{className:"wp-svc-card-head",children:[xt("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:r}}),xt("span",{className:"wp-svc-card-title",children:e})]}),o?xt("div",{className:"wp-svc-empty",children:"No assets yet"}):xt("div",{className:"wp-svc-items",children:n})]})}import Gt from"bignumber.js";import{jsx as ae,jsxs as Ce}from"react/jsx-runtime";var _n="CROSS Rewards",Sn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/award.svg";function Xo(e,t){let r=new Gt(e).shiftedBy(-t);return r.isZero()?"0":r.isGreaterThanOrEqualTo(1)?r.toFormat(2,Gt.ROUND_DOWN):r.toFormat(4,Gt.ROUND_DOWN)}function Jo(){let{env:e,walletAddress:t}=j(),r=!!t,{allPools:o}=gt(e,r),{depositMap:n}=ht(e,t,r),{getTokenImage:l}=pe(e,r),i=a=>`${Vo[e]}/rewards/${a.pool_address}?action=withdraw`;return ae(oe,{title:_n,icon:Sn,isEmpty:o.length===0,children:o.map(a=>{let s=n.get(a.pool_address.toLowerCase()),c=s?.deposited_amount??"0";return Ce("a",{className:"wp-item","data-side":"reward",href:i(a),target:"_blank",rel:"noopener noreferrer",children:[Ce("div",{className:"wp-item-body",children:[Ce("div",{className:"wp-item-field",children:[ae("span",{className:"wp-item-label",children:"Deposited"}),Ce("div",{className:"wp-svc-token",children:[l(a.deposit_token.address,a.deposit_token.symbol)&&ae("img",{className:"wp-svc-token-icon",src:l(a.deposit_token.address,a.deposit_token.symbol),alt:""}),ae("span",{children:Xo(c,a.deposit_token.decimals)})]})]}),Ce("div",{className:"wp-item-field",children:[ae("span",{className:"wp-item-label",children:"Rewards"}),a.reward_tokens.map(d=>{let m=l(d.address,d.symbol);return Ce("div",{className:"wp-svc-token",children:[m&&ae("img",{className:"wp-svc-token-icon",src:m,alt:""}),ae("span",{children:s?Xo(s.claimable_reward,d.decimals):"0"})]},d.address)})]})]}),Ce("div",{className:"wp-item-badges",children:[ae("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),ae("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},a.pool_address)})})}import tr from"bignumber.js";import{Fragment as Dn,jsx as U,jsxs as K}from"react/jsx-runtime";function Zt(e){let t=new tr(e);if(t.isNaN())return e;let r=t.decimalPlaces()??0;return t.toFormat(r)}function er(e){let t=new tr(e.amount).minus(e.filled);return Zt(t.toString())}function De({pairMap:e,ordersByPair:t,getDexUrl:r,getTokenImage:o}){let n=[];for(let[l,i]of t){let a=e.get(l),s=a?o(a.base_address,a.base_symbol):"",c=a?o(a.quote_address,a.quote_symbol):"";for(let d of i.buys)n.push(K("a",{className:"wp-item","data-side":"buy",href:r(l),target:"_blank",rel:"noopener noreferrer",children:[K("div",{className:"wp-item-body",children:[K("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label wp-item-label--buy",children:"Buy"}),K("div",{className:"wp-svc-token",children:[s&&U("img",{className:"wp-svc-token-icon",src:s,alt:""}),U("span",{children:er(d)})]})]}),K("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label",children:"Price"}),K("div",{className:"wp-svc-token",children:[c&&U("img",{className:"wp-svc-token-icon",src:c,alt:""}),U("span",{children:Zt(d.price)})]})]})]}),U("div",{className:"wp-item-badges",children:U("span",{className:"wp-badge wp-badge--mint",children:"Claim"})})]},`buy-${d.order_id}`));for(let d of i.sells)n.push(K("a",{className:"wp-item","data-side":"sell",href:r(l),target:"_blank",rel:"noopener noreferrer",children:[K("div",{className:"wp-item-body",children:[K("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label wp-item-label--sell",children:"Sell"}),K("div",{className:"wp-svc-token",children:[s&&U("img",{className:"wp-svc-token-icon",src:s,alt:""}),U("span",{children:er(d)})]})]}),K("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label",children:"Price"}),K("div",{className:"wp-svc-token",children:[c&&U("img",{className:"wp-svc-token-icon",src:c,alt:""}),U("span",{children:Zt(d.price)})]})]})]}),U("div",{className:"wp-item-badges",children:U("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${d.order_id}`))}return U(Dn,{children:n})}import{jsx as or}from"react/jsx-runtime";var An="Gametoken - CROSS",On="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function rr(){let{env:e,walletAddress:t}=j(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:l}=te(e,"cross",t,r),{getTokenImage:i}=pe(e,r);return or(oe,{title:An,icon:On,isEmpty:l,children:or(De,{pairMap:o,ordersByPair:n,getDexUrl:s=>{let c=o.get(s.toLowerCase());return`${ce[e]}/gametoken/cross/${c?.base_symbol??""}`},getTokenImage:i})})}import{jsx as nr}from"react/jsx-runtime";var Bn="Gametoken - CROSSD",Fn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function ar(){let{env:e,walletAddress:t}=j(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:l}=te(e,"crossd",t,r),{getTokenImage:i}=pe(e,r);return nr(oe,{title:Bn,icon:Fn,isEmpty:l,children:nr(De,{pairMap:o,ordersByPair:n,getDexUrl:s=>{let c=o.get(s.toLowerCase());return`${ce[e]}/gametoken/crossd/${c?.base_symbol??""}`},getTokenImage:i})})}import{jsx as ir}from"react/jsx-runtime";var Vn="Gametoken - Forge",Hn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function sr(){let{env:e,walletAddress:t}=j(),r=!!t,{pairMap:o,ordersByPair:n,isEmpty:l}=te(e,"forge",t,r),{getTokenImage:i}=pe(e,r);return ir(oe,{title:Vn,icon:Hn,isEmpty:l,children:ir(De,{pairMap:o,ordersByPair:n,getDexUrl:s=>{let c=o.get(s.toLowerCase());return`${ce[e]}/gametoken/forge/${c?.base_symbol??""}`},getTokenImage:i})})}import Yt from"bignumber.js";import{useMemo as Zn}from"react";import{useQuery as Un}from"@tanstack/react-query";var $n="wp:forge-pools";function lr(e,t,r=!0){let o=wt[e],n=r&&!!t,{data:l,...i}=Un({queryKey:[$n,e,t],queryFn:async()=>{let s=await fetch(`${o}/v1/users/${t}/pools`,{cache:"no-store"});if(!s.ok)throw new Error(`forge pools fetch failed: ${s.status}`);return(await s.json()).data?.items??[]},enabled:n,staleTime:0}),a=l??[];return{pools:a,isEmpty:a.length===0,...i}}import{useQueries as qn}from"@tanstack/react-query";import{useMemo as jn}from"react";var zn="wp:forge-token-detail";async function Gn(e,t){let r=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return r.ok?(await r.json())?.data?.token??null:null}function cr(e,t,r=!0){let o=wt[e],n=qn({queries:t.map(a=>({queryKey:[zn,e,a],queryFn:()=>Gn(o,a),enabled:r&&!!a,staleTime:3e4}))}),l=jn(()=>{let a=new Map;for(let s=0;s<n.length;s++){let c=n[s]?.data,d=t[s];c&&d&&a.set(d.toLowerCase(),c)}return a},[n,t]),i=n.some(a=>a.isLoading);return{detailMap:l,isLoading:i}}import{jsx as Q,jsxs as Ae}from"react/jsx-runtime";var Yn="Forge",Kn="https://x.crosstoken.io/forge/favicon-96x96.png",Qn=18,Xn="https://contents.crosstoken.io/wallet/token/images/FT.png";function Jn(e){if(!e||e==="0")return"0";let t=new Yt(e).shiftedBy(-Qn);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,Yt.ROUND_DOWN):t.toFormat(4,Yt.ROUND_DOWN)}function ea(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 pr(){let{env:e,walletAddress:t}=j(),r=!!t,{pools:o,isEmpty:n}=lr(e,t,r),l=Zn(()=>o.map(s=>s.token.address),[o]),{detailMap:i}=cr(e,l,r&&l.length>0),a=s=>`${ce[e]}/forge/token/${s.token.address}`;return Q(oe,{title:Yn,icon:Kn,iconFit:"contain",isEmpty:n,children:o.map(s=>{let c=i.get(s.token.address.toLowerCase()),d=c?.image_url||c?.image||s.token.image||Xn,m=c?.symbol||s.token.symbol;return Ae("a",{className:"wp-item","data-side":"lp",href:a(s),target:"_blank",rel:"noopener noreferrer",children:[Ae("div",{className:"wp-item-body",children:[Ae("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"Pair"}),Ae("div",{className:"wp-svc-token",children:[Q("img",{className:"wp-svc-token-icon",src:d,alt:""}),Q("span",{children:m})]})]}),Ae("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"LP Balance"}),Q("div",{className:"wp-svc-token",children:Q("span",{children:Jn(s.lp_balance)})})]}),Ae("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"Ownership"}),Q("div",{className:"wp-svc-token",children:Q("span",{children:ea(s.pool_ownership)})})]})]}),Q("div",{className:"wp-item-badges",children:Q("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},s.pair_address)})})}P(`.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:Sora,sans-serif;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:Sora,sans-serif;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-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:Roboto,Sora,sans-serif;font-size:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-text);margin:0}.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}
6
- `);import{Fragment as ra,jsx as S,jsxs as de}from"react/jsx-runtime";var Kt=5,oa="wp:";function Oe({env:e="production",theme:t="dark",walletAddress:r,onBack:o,showHeader:n=!0,variant:l="embed",className:i}){let a=!!r,s=ta(),{segments:c}=Go(e,r,a),[d,m]=J.useState(Kt),[R,k]=J.useState(!1),b=J.useCallback(()=>{s.invalidateQueries({predicate:x=>typeof x.queryKey[0]=="string"&&x.queryKey[0].startsWith(oa)})},[s]),f=J.useCallback(()=>{b(),k(!0),setTimeout(()=>k(!1),600),m(Kt)},[b]);J.useEffect(()=>{if(!a)return;let x=setInterval(()=>{m(N=>N<=1?(f(),Kt):N-1)},1e3);return()=>clearInterval(x)},[a,f]);let u=J.useCallback(()=>{o?.()},[o]),C=J.useMemo(()=>({env:e,theme:t,open:!0,walletAddress:r,close:u}),[e,t,r,u]),M=de(ra,{children:[n&&de("div",{className:"wp-header",children:[o?S("button",{type:"button",className:"wp-header-btn",onClick:o,children:S(Zo,{})}):S("span",{className:"wp-header-btn","aria-hidden":!0}),S("h2",{className:"wp-header-title",children:"My Portfolio"}),de("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:f,children:[S(Yo,{className:R?"wp-spin-once":void 0}),a&&S("span",{className:"wp-refresh-badge",children:d})]})]}),S("div",{className:"wp-top",children:c.length>0&&de("div",{className:"wp-asset",children:[de("div",{className:"wp-asset-head",children:[S("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),S("span",{className:"wp-asset-head-icon",children:S(Ko,{})})]}),S("div",{className:"wp-bar",children:c.map(x=>S("div",{className:"wp-bar-seg",style:{flex:`${x.percentage} 0 0`,background:x.color},children:x.percentage>=5&&de("span",{className:"wp-bar-seg-pct",children:[x.percentage,"%"]})},x.symbol))}),S("div",{className:"wp-legend",children:c.map(x=>de("div",{className:"wp-legend-item",children:[S("span",{className:"wp-legend-dot",style:{background:x.color}}),S("span",{className:"wp-legend-label",children:x.symbol})]},x.symbol))})]})}),S("div",{className:"wp-body",children:de("div",{className:"wp-body-inner",children:[S(Jo,{}),S(rr,{}),S(ar,{}),S(sr,{}),S(pr,{})]})})]});return S(Ye.Provider,{value:C,children:l==="none"?M:S("div",{className:V(l==="fullscreen"?"wp-fullscreen":"wp-embed",i),"data-theme":t,children:M})})}import{jsx as Qt,jsxs as dr}from"react/jsx-runtime";function mr({className:e}){let{env:t,theme:r,walletAddress:o,close:n}=j();return dr(bt.Portal,{children:[Qt(bt.Overlay,{className:"wp-overlay"}),dr(bt.Content,{className:V("wp-fullscreen",e),"data-theme":r,children:[Qt(bt.Title,{className:"wp-sr-only",children:"My Portfolio"}),Qt(Oe,{env:t,theme:r,walletAddress:o,onBack:n,variant:"none"})]})]})}import{jsx as fr}from"react/jsx-runtime";function aa({env:e="production",theme:t="dark",walletAddress:r,open:o,onOpenChange:n,children:l}){let i=o!==void 0,[a,s]=Ne.useState(!1),c=i?o:a,d=Ne.useCallback(k=>{i||s(k),n?.(k)},[i,n]),m=Ne.useCallback(()=>d(!1),[d]),R=Ne.useMemo(()=>({env:e,theme:t,open:c,walletAddress:r,close:m}),[e,t,c,r,m]);return fr(Ye.Provider,{value:R,children:fr(na.Root,{direction:"bottom",open:c,onOpenChange:d,noBodyStyles:!0,children:l})})}var ur=Object.assign(aa,{Trigger:Fo,Content:mr});import{Fragment as Jt,jsx as p,jsxs as w}from"react/jsx-runtime";function Xt(e,t,r){let o=X[e],n=r.toUpperCase();if(t===o.cross&&n.includes("CROSSD"))return 0;if(t===o.cross&&n==="CROSS")return 1;if(t===o.bsc&&n==="CROSS")return 2}function sa(e){return parseInt(e.split(":")[1],10)}function la(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function ca(e){let t=e.toLowerCase().replace(/^0x/,""),r=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),o=parseInt(r.slice(0,4),16)%360,n=(o+60+parseInt(r.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${o} 85% 65%), hsl(${n} 80% 55%))`}function wr({align:e="end",sideOffset:t=12,className:r,children:o}){let{env:n,theme:l,isMobile:i,open:a,drawerDirection:s,modal:c,showBalance:d,showForgeToken:m,showGameToken:R,showQR:k,qrLogoSrc:b,walletAddress:f,accountName:u,profileImageUrl:C,preferredTokens:M,close:x,onSelectWallet:N,onCopyAddress:O,onDisconnect:h,disconnectLabel:v,termsUrl:_,termsLabel:L,privacyUrl:B,privacyLabel:z,portalStyle:re,navContent:fe,navPosition:Ve,footerContent:Je,view:G,setView:He,showPortfolio:Ue,portfolioTitle:et,showTotalAssets:$e,totalAssetsLabel:qe}=le(),{tokens:ue,isLoading:we}=We(n,f,a&&d),{statsMap:Le}=_e(n,d),{categoryMap:tt}=Ao(n,d),ne=d&&$e,{displayValue:ge,isLowerBound:ot,isLoading:rt}=Oo(n,f,a&&ne),[Ie,je]=A.useState(!1),{holdings:he,isLoading:ze}=So(n,f,a&&d&&m),It=A.useMemo(()=>he.map(g=>g.token),[he]),{imageMap:nt}=Do(n,It,m&&he.length>0),Pe=A.useMemo(()=>{let g=[],T=[],E=[],H=new Map((M??[]).map((I,F)=>[`${sa(I.chainId)}:${I.address.toLowerCase()}`,F]));for(let I of ue){let F=Xt(n,I.chainId,I.symbol)!==void 0,xe=`${I.chainId}:${I.address.toLowerCase()}`,be=H.get(xe),Mt=new Ke(I.quantity.numeric).shiftedBy(-I.quantity.decimals);if(F)g.push(I);else if(be!==void 0)T.push(I);else if(Mt.isGreaterThan(0)){if(!R&&tt.get(qt(I.chainId,I.address))==="game")continue;E.push(I)}}return g.sort((I,F)=>{let xe=Xt(n,I.chainId,I.symbol)??99,be=Xt(n,F.chainId,F.symbol)??99;return xe-be}),T.sort((I,F)=>{let xe=H.get(`${I.chainId}:${I.address.toLowerCase()}`)??99,be=H.get(`${F.chainId}:${F.address.toLowerCase()}`)??99;return xe-be}),E.sort((I,F)=>{let xe=Le.get(ke(I.chainId,I.address)),be=Le.get(ke(F.chainId,F.address)),Mt=new Ke(I.quantity.numeric).shiftedBy(-I.quantity.decimals).multipliedBy(xe?.price??0);return new Ke(F.quantity.numeric).shiftedBy(-F.quantity.decimals).multipliedBy(be?.price??0).minus(Mt).toNumber()}),[...g,...T,...E]},[ue,n,Le,R,tt,M]),at=A.useMemo(()=>{if(!m)return[];let g=new Set(ue.map(T=>T.address.toLowerCase()));return[...he].filter(T=>!g.has(T.token.toLowerCase())).sort((T,E)=>{let H=new Ke(T.value);return new Ke(E.value).minus(H).toNumber()})},[he,m,ue]),se=A.useRef(!1),Pt=A.useCallback(g=>{se.current=!0,He(g)},[He]);A.useEffect(()=>{a||(se.current=!1)},[a]);let oo=A.useRef(null);A.useEffect(()=>{let g=oo.current;if(!g||!i)return;let T=E=>{E.pointerType==="touch"&&E.stopPropagation()};return g.addEventListener("pointerdown",T),()=>g.removeEventListener("pointerdown",T)},[i]);let[Ge,ro]=A.useState(!1),Rt=A.useRef(void 0);A.useEffect(()=>()=>clearTimeout(Rt.current),[]);let no=A.useCallback(async()=>{if(!Ge)try{await navigator.clipboard.writeText(f),ro(!0),clearTimeout(Rt.current),Rt.current=setTimeout(()=>ro(!1),2e3),O?.(f,!0)}catch{O?.(f,!1)}},[f,O,Ge]),Tt=A.useCallback(g=>{g.currentTarget.setAttribute("data-loaded","true")},[]),Dr=A.useMemo(()=>({background:ca(f)}),[f]),ao=A.useMemo(()=>C||_o(n,f,{size:120,bg:l==="dark"?"1A1A2E":"F3F6F8"}),[C,n,f,l]),Et=A.useMemo(()=>la(ge),[ge]),Ar=w("div",{className:V("wi-view-inner",se.current&&"wi-view-wallet"),children:[ne&&(()=>{let g=Ue;return w(g?"button":"div",{...g?{type:"button",onClick:()=>Pt("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":g||void 0,children:[w("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:qe}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:E=>{E.stopPropagation(),je(H=>!H)},onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),E.stopPropagation(),je(H=>!H))},"aria-label":Ie?"Show balance":"Hide balance",children:Ie?p(Io,{}):p(Lo,{})})]}),w("div",{className:"wi-total-body",children:[rt?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Ie||void 0,children:Ie?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):w(Jt,{children:[ot&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:Et.main}),Et.decimal&&p("span",{className:"wi-total-decimal",children:Et.decimal})]})}),g&&p("span",{className:"wi-total-chevron","aria-hidden":!0,children:p(Co,{size:18})})]})]})})(),Ve==="top"&&fe&&p("div",{className:"wi-nav-fixed",children:fe}),d&&p("div",{ref:oo,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:w("div",{className:"wi-token-list",children:[we&&Array.from({length:5},(g,T)=>w("div",{className:"wi-skeleton-item",children:[w("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),w("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}})]})]}),w("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}})]})]},T)),!we&&Pe.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),Pe.map(g=>{let T=Le.get(ke(g.chainId,g.address)),E=T?parseFloat(T.percent_change_24h):null,H=E!==null&&E>=0,I=Ht(n,g.chainId);return w("div",{className:"wi-token-item",children:[w("div",{className:"wi-token-left",children:[w("div",{className:"wi-token-icon-wrap",children:[p("img",{src:g.icon_url,alt:g.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Tt,onError:F=>{F.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),I&&p("img",{src:I,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:F=>{F.currentTarget.style.display="none"}})]}),w("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:g.symbol}),T&&w("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:Ft(T.price)}),p("span",{className:"wi-token-change","data-positive":H,"data-zero":E===0||void 0,children:E!==null&&(E===0?"0%":`${H?"+":"-"}${(H?Math.floor:Math.ceil)(Math.abs(E)*100)/100}%`)})]})]})]}),w("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:mt(g.quantity.numeric,g.quantity.decimals)}),T&&p("span",{className:"wi-token-value",children:Ro(g.quantity.numeric,g.quantity.decimals,T.price)})]})]},`${g.address}-${g.chainId}`)}),m&&ze&&Array.from({length:3},(g,T)=>w("div",{className:"wi-skeleton-item",children:[w("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),w("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}})]})]}),w("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-${T}`)),m&&!ze&&!we&&Pe.length===0&&at.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&at.map(g=>{let T=nt.get(g.token)||"",E=Ht(n,X[n].cross);return w("div",{className:"wi-token-item",children:[w("div",{className:"wi-token-left",children:[w("div",{className:"wi-token-icon-wrap",children:[p("img",{src:T||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:g.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Tt,onError:H=>{H.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),E&&p("img",{src:E,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:H=>{H.currentTarget.style.display="none"}})]}),w("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:g.token_name}),p("div",{className:"wi-token-price-row",children:w("span",{className:"wi-token-price",children:[mt(g.current_price,18)," CROSS"]})})]})]}),w("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:mt(g.balance,18)}),p("span",{className:"wi-token-value",children:Ft(g.current_value_usd)})]})]},`forge-${g.token}`)})]})}),Ve==="bottom"&&fe&&p("div",{className:"wi-nav-fixed",children:fe})]},"wallet"),Or=Ue?p("div",{className:V("wi-view-inner wi-portfolio-body",se.current&&"wi-view-portfolio"),children:p(Oe,{env:n,theme:l,walletAddress:f,showHeader:!1})},"portfolio"):null,Br=p("div",{className:V("wi-view-inner wi-qr-body",se.current&&"wi-view-qr"),children:p("div",{className:"wi-qr-section",children:w("div",{className:"wi-qr-card",children:[w("div",{className:"wi-qr-code",children:[p(ia,{value:f,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&p("div",{className:"wi-qr-logo",children:p(Po,{size:33})})]}),p("p",{className:"wi-qr-address",children:f}),w("button",{type:"button",className:"wi-qr-copy-btn",onClick:no,children:[p("span",{className:"wi-qr-copy-icon",children:Ge?p(Ot,{size:16}):p(At,{size:16})}),p("span",{className:"wi-qr-copy-text",children:Ge?"Copied!":"Copy address"})]})]})})},"qr"),Fr=G==="qr"||G==="portfolio",Vr=G==="qr"?"My Address":G==="portfolio"?et:"",io=Je??(!!h||!!_||!!B?w("div",{className:"wi-builtin-footer",children:[h&&w("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{h(),x()},children:[p(vo,{size:20}),p("span",{className:"wi-disconnect-label",children:v})]}),(_||B)&&w("div",{className:"wi-legal-links",children:[_&&p("a",{className:"wi-legal-link",href:_,target:"_blank",rel:"noopener noreferrer",children:L}),_&&B&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),B&&p("a",{className:"wi-legal-link",href:B,target:"_blank",rel:"noopener noreferrer",children:z})]})]}):null),Hr=w("div",{className:"wi-sticky-header",children:[w("div",{className:"wi-header wi-header--wallet",children:[w("div",{className:"wi-account-block",children:[w("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:Dr}),ao&&p("img",{src:ao,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Tt,onError:g=>{g.currentTarget.style.display="none"}})]}),w("div",{className:"wi-account-text",children:[N?w("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:N,"aria-label":"Switch account",children:[p("span",{className:"wi-account-name",children:u??"Account 1"}),p("span",{className:"wi-account-switch","aria-hidden":"true",children:p(No,{size:12})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:u??"Account 1"})}),w("button",{type:"button",className:"wi-address-row-btn",onClick:no,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:Me(f)}),p("span",{className:"wi-account-copy",children:Ge?p(Ot,{size:14}):p(At,{size:14})})]})]})]}),w("div",{className:"wi-header-actions",children:[k&&p("button",{type:"button",className:"wi-header-action",onClick:()=>Pt("qr"),"aria-label":"Show QR code",children:p(yo,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:x,"aria-label":"Close",children:p(Bt,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),so=w(Jt,{children:[o,Fr?w("div",{className:"wi-sticky-header",children:[w("div",{className:"wi-header",children:[p("button",{type:"button",className:"wi-header-back",onClick:()=>Pt("wallet"),"aria-label":"Back",children:p(ko,{})}),p("div",{className:"wi-header-info",children:p("h2",{className:"wi-header-title",children:Vr})}),p("button",{type:"button",className:"wi-header-close",onClick:x,"aria-label":"Close",children:p(Bt,{})})]}),p("hr",{className:"wi-divider"})]}):Hr,w("div",{className:"wi-view-container",children:[G==="wallet"&&Ar,G==="qr"&&Br,G==="portfolio"&&Or]}),io&&G!=="portfolio"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",children:io})})]});return i?w(vt.Portal,{children:[c&&p(vt.Overlay,{className:"wi-drawer-overlay"}),w(vt.Content,{className:V("wi-drawer-content",r),"data-theme":l,style:re,"data-direction":s,"data-no-balance":!d||void 0,"data-view":G,children:[p(vt.Title,{className:"wi-sr-only",children:"My Wallet"}),so]})]}):w(Jt,{children:[c&&a&&p("div",{className:"wi-drawer-overlay",onClick:x}),p(yt.Portal,{children:p(yt.Content,{align:e,sideOffset:t,className:V("wi-popover-content",r),"data-theme":l,style:re,"data-no-balance":!d||void 0,"data-view":G,children:so})})]})}import*as gr from"react";function hr({position:e="top",children:t}){let{setNavContent:r,setNavPosition:o}=le();return gr.useEffect(()=>(r(t),o(e),()=>r(null)),[t,e,r,o]),null}import*as xr from"react";function br({children:e}){let{setFooterContent:t}=le();return xr.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}P(`[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)}
4
+ `);P(`.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:24px 4px;box-sizing:border-box}.al-popover-content .al-grid{grid-template-columns:repeat(4,100px);row-gap:24px;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:8px;padding:8px 0;width:100px;min-width:0;border-radius:10px}.al-popover-content .al-grid-item-left{flex-direction:column;align-items:center;gap:8px;width:100%;overflow:visible}.al-popover-content .al-grid-item-icon{width:54px;height:54px;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;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:16px}.al-drawer-content .al-grid-item{width:100%;max-width:100%;gap:8px;padding:16px 12px;border-radius:8px;overflow:hidden;background:transparent}.al-drawer-content .al-grid-item:hover,.al-drawer-content .al-grid-item[data-active=true]{background:var(--al-bg-hover)}.al-drawer-content .al-grid-item-left{gap:8px;flex:1 1 auto;min-width:0}.al-drawer-content .al-grid-item-icon{width:36px;height:36px;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.5;letter-spacing:-.16px;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:-.16px;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:-.16px;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:-.1px;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
+ `);P("");import{jsx as $t}from"react/jsx-runtime";function yo({env:e="production",theme:t="dark",mobileBreakpoint:o=768,domain:r,children:n}){let l=Ee(`(max-width: ${o}px)`),[s,i]=Me.useState(!1),a=Me.useCallback(()=>i(!1),[]),d=Me.useMemo(()=>({env:e,theme:t,isMobile:l,open:s,domain:r,close:a}),[e,t,l,s,r,a]);return $t(Ut.Provider,{value:d,children:l?$t(an.Root,{direction:"right",open:s,onOpenChange:i,noBodyStyles:!0,children:n},"drawer"):$t(vo.Root,{open:s,onOpenChange:i,children:n},"popover")})}import*as No from"@radix-ui/react-popover";import{Drawer as ln}from"vaul";import{jsx as Z,jsxs as sn}from"react/jsx-runtime";function ko({size:e=18}){return sn("svg",{className:"al-trigger-icon",width:e,height:e,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Z("rect",{width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",y:"7",width:"4",height:"4",fill:"currentColor"}),Z("rect",{y:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"7",y:"14",width:"4",height:"4",fill:"currentColor"}),Z("rect",{x:"14",y:"14",width:"4",height:"4",fill:"currentColor"})]})}function Co(){return Z("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Z("path",{d:"M12 19L5 12M5 12L12 5M5 12H19",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Lo(){return Z("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Z("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as mt}from"react/jsx-runtime";function Io({asChild:e,children:t}){let{isMobile:o,theme:r}=dt(),n=t!=null,l=e??!0,s=n?t:mt("button",{type:"button",className:"al-trigger-btn","data-theme":r,children:mt(ko,{size:o?12:18})});return o?mt(ln.Trigger,{asChild:l,children:s}):mt(No.Trigger,{asChild:l,children:s})}import*as ke from"react";import*as ut from"@radix-ui/react-popover";import{Drawer as Se}from"vaul";import{useQuery as cn}from"@tanstack/react-query";var Po={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"};function ft(e="production"){return cn({queryKey:["global-menu",e],queryFn:async({signal:t})=>{let o=await fetch(Po[e],{cache:"no-store",signal:t});if(!o.ok)throw new Error(`Failed to fetch global menu: ${o.status}`);return o.json()},staleTime:0,gcTime:0,refetchOnMount:!0})}function V(...e){return e.filter(Boolean).join(" ")}import{jsx as $,jsxs as Qe}from"react/jsx-runtime";function To({align:e="end",sideOffset:t=12,className:o}){let{env:r,theme:n,isMobile:l,domain:s,close:i}=dt(),{data:a}=ft(r),d=ke.useMemo(()=>(a?.items??[]).sort((u,k)=>u.order-k.order),[a]),c=8,m=ke.useRef(null),y=ke.useCallback(u=>{m.current={x:u.clientX,y:u.clientY}},[]),L=typeof window<"u"?window.location.pathname:"",b=ke.useCallback((u,k)=>{if(m.current){let h=u.clientX-m.current.x,S=u.clientY-m.current.y;if(m.current=null,Math.abs(h)>c||Math.abs(S)>c)return}let E=k.url[r]??k.url.production,R=Ro(E,s);if(!R)try{let h=new URL(E).pathname;if(L===h||L.startsWith(h+"/")){i();return}}catch{}R?window.open(E,"_blank","noopener,noreferrer"):window.location.href=E,i()},[r,s,i,L]),f=$("div",{className:"al-grid","data-theme":n,children:d.map(u=>{let k=u.url[r]??u.url.production,E=Ro(k,s),R=!1;if(!E)try{let h=new URL(k).pathname;R=L===h||L.startsWith(h+"/")}catch{R=!1}return Qe("button",{type:"button",className:"al-grid-item","data-active":R||void 0,onPointerDown:y,onClick:h=>b(h,u),children:[Qe("div",{className:"al-grid-item-left",children:[$("div",{className:"al-grid-item-icon",children:$("img",{src:u.iconUrl,alt:u.label,width:24,height:24,loading:"lazy"})}),$("span",{className:"al-grid-item-label",children:u.label}),u.isNew&&$("span",{className:"al-badge-new",children:"N"})]}),$("div",{className:"al-grid-item-right",children:u.badge&&$("span",{className:"al-badge",children:u.badge})})]},u.id)})});return l?Qe(Se.Portal,{children:[$(Se.Overlay,{className:"al-drawer-overlay"}),Qe(Se.Content,{className:V("al-drawer-content",o),"data-theme":n,children:[Qe("div",{className:"al-drawer-header",children:[$(Se.Close,{className:"al-drawer-close",children:$(Co,{})}),$(Se.Title,{className:"al-drawer-title",children:"CROSS Services"}),$(Se.Close,{className:"al-drawer-close",children:$(Lo,{})})]}),$("div",{className:"al-drawer-body",children:f})]})]}):$(ut.Portal,{children:$(ut.Content,{align:e,sideOffset:t,className:V("al-popover-content",o),"data-theme":n,children:f})})}function Ro(e,t){try{let o=new URL(e).hostname;return typeof window>"u"?!0:o!==(t??window.location.hostname)}catch{return!1}}import*as K from"react";import*as Mr from"@radix-ui/react-popover";import{Drawer as Ci}from"vaul";import{createContext as pn,useContext as dn}from"react";var qt=pn(null);function le(){let e=dn(qt);if(!e)throw new Error("WalletInfo compound components must be used within <WalletInfo>");return e}var zt=(r=>(r.CROSSx="crossx",r.MetaMask="io.metamask",r.Binance="com.binance.wallet",r))(zt||{}),wt={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 Ho from"@radix-ui/react-popover";import{Drawer as fn}from"vaul";import{jsx as W,jsxs as gt}from"react/jsx-runtime";function Eo({size:e=16,className:t}){return gt("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 jt({size:e=16,className:t}){return W("svg",{width:e,height:e,viewBox:"4 4 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("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 Gt({size:e=16,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M11.6667 3.5L5.25 9.91667L2.33334 7",stroke:"currentColor",strokeWidth:1.16667,strokeLinecap:"round",strokeLinejoin:"round"})})}function Zt({size:e=24,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Mo({size:e=20,className:t}){return gt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 So({size:e=20,className:t}){return W("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 20 20",fill:"none",className:t,children:W("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 W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Wo({size:e=20,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M8 5L13 10L8 15",stroke:"currentColor",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})})}function Do({size:e=20,className:t}){return W("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:W("path",{d:"M5 8L10 13L15 8",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ao({size:e=16,className:t}){return gt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("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 Oo({size:e=16,className:t}){return gt("svg",{width:e,height:e,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[W("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"}),W("path",{d:"M1.667 1.667l16.666 16.666",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Fo({size:e=42,className:t}){return W("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 42 42",fill:"none",className:t,children:W("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 Ce from"bignumber.js";function mn(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 Ce(e).shiftedBy(-t),r=o.isGreaterThanOrEqualTo(1)?2:4;return o.toFormat(r,Ce.ROUND_DOWN)}function _e(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Kt(e){let t=typeof e=="string"?parseFloat(e):e;if(Number.isNaN(t)||t===0)return"$0.00";let o=t>=1?2:4,r=Math.pow(10,o);return`$${(Math.floor(t*r)/r).toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o})}`}function Bo(e,t,o){let n=new Ce(e).shiftedBy(-t).multipliedBy(new Ce(o));return n.isZero()||n.isNaN()?"$0.00":`$${(n.integerValue(Ce.ROUND_DOWN).isGreaterThanOrEqualTo(1)?n.decimalPlaces(2,Ce.ROUND_DOWN):n.decimalPlaces(4,Ce.ROUND_DOWN)).toFormat()}`}function Vo(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=mn(s.toFixed(18))}let[r="0",n=""]=o.split(".");if(Number(r)>=1){let s=n.slice(0,2).padEnd(2,"0");return{displayValue:`${Number(r).toLocaleString("en-US")}.${s}`,isLowerBound:!1}}return n.length<4?{displayValue:`${r}.${n}`,isLowerBound:!1}:n.slice(0,4)==="0000"?{displayValue:"0.0001",isLowerBound:!0}:{displayValue:`0.${n.slice(0,4)}`,isLowerBound:!1}}import{jsx as xt,jsxs as un}from"react/jsx-runtime";function Uo({asChild:e,className:t,children:o}){let{isMobile:r,theme:n,walletAddress:l}=le(),s=o!=null,i=e??!0,a=s?o:un("button",{type:"button",className:V("wi-trigger-btn",t),"data-theme":n,"data-mobile":r||void 0,children:[xt(Eo,{size:r?14:16}),xt("span",{className:"wi-trigger-address",children:_e(l)})]});return r?xt(fn.Trigger,{asChild:i,children:a}):xt(Ho.Trigger,{asChild:i,children:a})}import*as O from"react";import*as It from"@radix-ui/react-popover";import{Drawer as Nt}from"vaul";import Je from"bignumber.js";import{useQueries as gn}from"@tanstack/react-query";import{useMemo as hn}from"react";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"},X={dev:{cross:612044,bsc:97},stage:{cross:612044,bsc:97},production:{cross:612055,bsc:56}};var Yt={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"},$o={cross:"https://contents.crosstoken.io/wallet/token/images/CROSS.svg",bsc:"https://contents.crosstoken.io/wallet/token/images/BSC.svg"};function Qt(e,t){let o=X[e];if(t===o.cross)return $o.cross;if(t===o.bsc)return $o.bsc}var wn={dev:"https://dev-portrait.crosstoken.io",stage:"https://dev-portrait.crosstoken.io",production:"https://portrait.crosstoken.io"};function qo(e,t,o={}){if(!t||!t.startsWith("0x"))return;let{size:r=120,bg:n,format:l="png"}=o,s=wn[e],i=n?`&bg=${n}`:"";return`${s}/portrait/evm/${t}.${l}?size=${r}${i}`}var Xt="user-balance";async function xn(e,t,o,r){let n=new URLSearchParams({networkId:`eip155:${t}`,account:o}),l=await fetch(`${e}/v1/public/token/balance?${n}`,{cache:"no-store",signal:r});if(!l.ok)throw new Error(`Failed to fetch token balance: ${l.status}`);let s=await l.json();if(s.code!==200)throw new Error(`Token balance API error: ${s.code}`);return s.data}function We(e,t,o=!0){let r=ee[e],n=X[e],l=[n.cross,n.bsc],s=gn({queries:l.map(c=>({queryKey:[Xt,e,t,c],queryFn:({signal:m})=>xn(r,c,t,m),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1}))}),i=s.some(c=>c.isLoading),a=s.some(c=>c.isError);return{tokens:hn(()=>{let c=[];for(let m of s)m.data&&c.push(...m.data);return c},[s]),isLoading:i,isError:a}}import{useQuery as bn,useQueries as vn}from"@tanstack/react-query";import{useMemo as yn}from"react";var kn="forge-holdings",Cn="forge-token-image";async function Ln(e,t,o){let r=await fetch(`${e}/v1/users/${t}/holdings`,{cache:"no-store",signal:o});if(!r.ok)throw new Error(`Failed to fetch forge holdings: ${r.status}`);let n=await r.json();if(!n.success)throw new Error("Forge holdings API error");return n.data.items}async function Nn(e,t,o){let r=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store",signal:o});if(!r.ok)return{address:t,image_url:""};let n=await r.json();return n.success?{address:t,image_url:n.data.token.image_url}:{address:t,image_url:""}}function zo(e,t,o=!0){let r=Yt[e],{data:n,...l}=bn({queryKey:[kn,e,t],queryFn:({signal:s})=>Ln(r,t,s),enabled:!!t&&o,staleTime:0,refetchInterval:o?5e3:!1});return{holdings:n??[],...l}}function jo(e,t,o=!0){let r=Yt[e],n=vn({queries:t.map(s=>({queryKey:[Cn,e,s],queryFn:({signal:i})=>Nn(r,s,i),enabled:o,staleTime:1/0}))});return{imageMap:yn(()=>{let s=new Map;for(let i of n)i.data&&s.set(i.data.address,i.data.image_url);return s},[n])}}import{useQuery as In}from"@tanstack/react-query";import{useMemo as Pn}from"react";var Jt="token-stats";function Le(e,t){return`${e}:${t.toLowerCase()}`}function De(e,t=!0){let o=ee[e],{data:r,...n}=In({queryKey:[Jt,e],queryFn:async({signal:s})=>{let i=await fetch(`${o}/v1/public/token/stats`,{cache:"no-store",signal:s});if(!i.ok)throw new Error(`Failed to fetch token stats: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Token stats API error: ${a.code}`);return a},enabled:t,staleTime:3e4});return{statsMap:Pn(()=>{let s=new Map;if(!r?.data)return s;for(let i of r.data){let a=Le(i.chain_id,i.address);s.set(a,i)}return s},[r]),...n}}import{useQuery as Rn}from"@tanstack/react-query";import{useMemo as Tn}from"react";var En="token-info";function eo(e,t){return`${t.toLowerCase()}_${e}`}function Go(e,t=!0){let o=ee[e],{data:r,...n}=Rn({queryKey:[En,e],queryFn:async({signal:s})=>{let i=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:s});if(!i.ok)throw new Error(`Failed to fetch token info: ${i.status}`);let a=await i.json();if(a.code!==200)throw new Error(`Token info API error: ${a.code}`);return a},enabled:t,staleTime:1/0});return{categoryMap:Tn(()=>{let s=new Map;if(!r?.data)return s;for(let i of r.data){let a=eo(i.chain_id,i.address);s.set(a,i.category)}return s},[r]),...n}}import{useMemo as Mn}from"react";import to from"bignumber.js";function Zo(e,t,o){let{tokens:r,isLoading:n}=We(e,t,o),{statsMap:l}=De(e,o);return Mn(()=>{let s=new to(0);for(let c of r){let m=l.get(Le(c.chainId,c.address));if(!m)continue;let L=new to(c.quantity.numeric).shiftedBy(-c.quantity.decimals).multipliedBy(new to(m.price));L.isNaN()||(s=s.plus(L))}let i=s.toFixed(),{displayValue:a,isLowerBound:d}=Vo(i);return{totalUsd:i,displayValue:a,isLowerBound:d,isLoading:n}},[r,l,n])}import{QRCodeSVG as bi}from"qrcode.react";import*as Ie from"react";import{Drawer as hi}from"vaul";import{createContext as Sn,useContext as _n}from"react";var Xe=Sn(null);function z(){let e=_n(Xe);if(!e)throw new Error("WalletPortfolio compound components must be used within <WalletPortfolio>");return e}import{Drawer as Wn}from"vaul";import{jsx as Ko}from"react/jsx-runtime";function Yo({asChild:e,children:t}){let{walletAddress:o}=z(),r=t!=null,n=e??!0,l=r?t:Ko("button",{type:"button",children:_e(o)});return Ko(Wn.Trigger,{asChild:n,children:l})}import{Drawer as Lt}from"vaul";import*as J from"react";import{useQueryClient as ui}from"@tanstack/react-query";import{useMemo as Vn}from"react";import oo from"bignumber.js";import{useQuery as Dn}from"@tanstack/react-query";import{useMemo as Jo}from"react";var bt={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"},Qo={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},vt={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"},ce={dev:"https://stg-x.crosstoken.io",stage:"https://stg-x.crosstoken.io",production:"https://x.crosstoken.io"},Xo={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 An="wp:reward-pools";function yt(e,t=!0){let o=bt[e],{data:r,...n}=Dn({queryKey:[An,e],queryFn:async({signal:i})=>{let a=await fetch(`${o}/v1/pools`,{cache:"no-store",signal:i});if(!a.ok)throw new Error(`Failed to fetch pools: ${a.status}`);let d=await a.json();if(d.code!==200)throw new Error(`Pools API error: ${d.code}`);return d},enabled:t,staleTime:0}),l=Jo(()=>r?.data.pools.filter(i=>i.pool_type==="CrossPool")??[],[r]),s=Jo(()=>r?.data.pools.filter(i=>i.pool_type==="GamePool")??[],[r]);return{crossPools:l,gamePools:s,allPools:r?.data.pools??[],...n}}import{useQuery as On}from"@tanstack/react-query";import{useMemo as Fn}from"react";var Bn="wp:user-deposits";function kt(e,t,o=!0){let r=bt[e],n=o&&!!t,{data:l,...s}=On({queryKey:[Bn,e,t],queryFn:async({signal:a})=>{let d=await fetch(`${r}/v1/users/${t}/deposits`,{cache:"no-store",signal:a});if(!d.ok)throw new Error(`Deposits fetch failed: ${d.status}`);let c=await d.json();if(c.code!==200)throw new Error(`Deposits API error: ${c.code}`);return c},enabled:n,staleTime:0});return{depositMap:Fn(()=>{let a=new Map;if(!l?.data.user_deposits)return a;for(let d of l.data.user_deposits)a.set(d.pool_address.toLowerCase(),d);return a},[l]),deposits:l?.data.user_deposits??[],...s}}import{useQuery as er}from"@tanstack/react-query";import{useMemo as tr}from"react";function te(e,t,o,r=!0){let n=Xo[e][t],l=r&&!!o,{data:s,...i}=er({queryKey:["wp:dex-pairs",e,t],queryFn:async({signal:b})=>{let f=await fetch(`${n}/pair-info`,{cache:"no-store",signal:b});if(!f.ok)throw new Error(`pair-info fetch failed: ${f.status}`);let u=await f.json();if(u.code!==200)throw new Error(`pair-info API error: ${u.code}`);return u},enabled:r,staleTime:0}),a=s?.data??[],d=tr(()=>{let b=new Map;for(let f of a)b.set(f.pair_address.toLowerCase(),f);return b},[a]),{data:c,...m}=er({queryKey:["wp:dex-orders",e,t,o],queryFn:async({signal:b})=>{let f=Math.floor(Date.now()/1e3),u=new URLSearchParams({owner:o,size:"200",start_date:"0",end_date:String(f)}),k=await fetch(`${n}/open-order?${u}`,{cache:"no-store",signal:b});if(!k.ok)throw new Error(`open-order fetch failed: ${k.status}`);let E=await k.json();if(E.code!==200)throw new Error(`open-order API error: ${E.code}`);return E.data?.data??[]},enabled:l,staleTime:0}),y=c??[],L=tr(()=>{let b=new Map;for(let f of y){let u=f.pair.toLowerCase();b.has(u)||b.set(u,{buys:[],sells:[]});let k=b.get(u);f.order_side===1?k.buys.push(f):k.sells.push(f)}return b},[y]);return{allPairs:a,pairMap:d,orders:y,ordersByPair:L,isEmpty:y.length===0,isLoading:i.isLoading||m.isLoading}}var Hn=["var(--wp-blue)","var(--wp-purple)","var(--wp-red)","var(--wp-orange)"],or="var(--wp-green)",rr=4;function nr(e,t,o=!0){let r=o&&!!t,{allPools:n}=yt(e,r),{depositMap:l}=kt(e,t,r),{allPairs:s,pairMap:i,ordersByPair:a}=te(e,"cross",t,r),{allPairs:d,pairMap:c,ordersByPair:m}=te(e,"crossd",t,r),{allPairs:y,pairMap:L,ordersByPair:b}=te(e,"forge",t,r);return Vn(()=>{let f=new Map,u=new Map,k=(x,v)=>{!Number.isFinite(v)||v<=0||u.set(x,(u.get(x)??0)+v)};for(let x of n){let v=Number(x.deposit_token.price);v>0&&f.set(x.deposit_token.symbol,v);for(let _ of x.reward_tokens){let N=Number(_.price);N>0&&f.set(_.symbol,N)}}for(let x of[...s,...d,...y]){let v=f.get(x.quote_symbol),_=Number(x.billboard?.price);v&&_>0&&!f.has(x.base_symbol)&&f.set(x.base_symbol,_*v)}for(let x of n){let v=l.get(x.pool_address.toLowerCase());if(!v)continue;let _=new oo(v.deposited_amount).shiftedBy(-x.deposit_token.decimals).toNumber();if(k(x.deposit_token.symbol,_),x.reward_tokens.length>0){let N=x.reward_tokens[0],F=new oo(v.claimable_reward).shiftedBy(-N.decimals).toNumber();k(N.symbol,F)}}let E=[{pairMap:i,ordersByPair:a},{pairMap:c,ordersByPair:m},{pairMap:L,ordersByPair:b}];for(let{pairMap:x,ordersByPair:v}of E)for(let[_,N]of v){let F=x.get(_);if(F){for(let j of N.buys){let re=Number(j.amount)-Number(j.filled);k(F.quote_symbol,re*Number(j.price))}for(let j of N.sells){let re=Number(j.amount)-Number(j.filled);k(F.base_symbol,re)}}}let R=[],h=0;for(let[x,v]of u){let _=f.get(x)??0,N=v*_;N>0&&(R.push({symbol:x,usdValue:N}),h+=N)}R.sort((x,v)=>v.usdValue-x.usdValue);let S=[];if(h>0){let x=R.slice(0,rr),v=R.slice(rr);for(let N=0;N<x.length;N++)S.push({symbol:x[N].symbol,usdValue:x[N].usdValue,percentage:Math.round(x[N].usdValue/h*100),color:Hn[N]??or});if(v.length>0){let N=v.reduce((F,j)=>F+j.usdValue,0);S.push({symbol:"Others",usdValue:N,percentage:Math.round(N/h*100),color:or})}let _=S.reduce((N,F)=>N+F.percentage,0);_!==100&&S.length>0&&(S[0].percentage+=100-_)}return{totalUsd:h,formattedTotal:h>0?`$${new oo(h).toFormat(2)}`:"$0.00",segments:S}},[n,l,s,i,a,d,c,m,y,L,b])}import{jsx as Ae,jsxs as Un}from"react/jsx-runtime";function ir({size:e=22,className:t}){return Ae("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Ae("path",{d:"M14 4L7 11L14 18",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function ar({size:e=22,className:t}){return Un("svg",{width:e,height:e,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[Ae("path",{d:"M18.333 3.667v5.5h-5.5",stroke:"currentColor",strokeWidth:1.833,strokeLinecap:"round",strokeLinejoin:"round"}),Ae("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 sr({size:e=12,className:t}){return Ae("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:Ae("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 $n}from"@tanstack/react-query";import{useMemo as qn}from"react";var zn="wp:token-info";function pe(e,t=!0){let o=ee[e],r=X[e].cross,{data:n,...l}=$n({queryKey:[zn,e],queryFn:async({signal:d})=>{let c=await fetch(`${o}/v1/public/token/info`,{cache:"no-store",signal:d});if(!c.ok)throw new Error(`Failed to fetch token info: ${c.status}`);let m=await c.json();if(m.code!==200)throw new Error(`Token info API error: ${m.code}`);return m},enabled:t,staleTime:300*1e3}),{byChainAddr:s,byChainSym:i}=qn(()=>{let d=new Map,c=new Map;if(!n?.data)return{byChainAddr:d,byChainSym:c};for(let m of n.data){let y=m.address.toLowerCase();d.set(`${m.chain_id}:${y}`,m),d.set(y,m);let L=m.symbol.replace(/^t/,"").toUpperCase(),b=`${m.chain_id}:${L}`;c.has(b)||c.set(b,m),c.has(L)||c.set(L,m)}return{byChainAddr:d,byChainSym:c}},[n]);return{getTokenImage:(d,c)=>{let m=d.toLowerCase(),y=s.get(`${r}:${m}`);if(y?.image)return y.image;let L=s.get(m);if(L?.image)return L.image;if(c){let b=c.replace(/^t/,"").toUpperCase(),f=i.get(`${r}:${b}`);if(f?.image)return f.image;let u=i.get(b);if(u?.image)return u.image}return""},...l}}import{jsx as Ct,jsxs as lr}from"react/jsx-runtime";function oe({title:e,icon:t,iconFit:o="cover",isEmpty:r,children:n}){return lr("div",{className:"wp-svc-card",children:[lr("div",{className:"wp-svc-card-head",children:[Ct("img",{className:"wp-svc-card-icon",src:t,alt:"",style:{objectFit:o}}),Ct("span",{className:"wp-svc-card-title",children:e})]}),r?Ct("div",{className:"wp-svc-empty",children:"No assets yet"}):Ct("div",{className:"wp-svc-items",children:n})]})}import ro from"bignumber.js";import{jsx as ie,jsxs as Ne}from"react/jsx-runtime";var jn="CROSS Rewards",Gn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/award.svg";function cr(e,t){let o=new ro(e).shiftedBy(-t);return o.isZero()?"0":o.isGreaterThanOrEqualTo(1)?o.toFormat(2,ro.ROUND_DOWN):o.toFormat(4,ro.ROUND_DOWN)}function pr(){let{env:e,walletAddress:t}=z(),o=!!t,{allPools:r}=yt(e,o),{depositMap:n}=kt(e,t,o),{getTokenImage:l}=pe(e,o),s=i=>`${Qo[e]}/rewards/${i.pool_address}?action=withdraw`;return ie(oe,{title:jn,icon:Gn,isEmpty:r.length===0,children:r.map(i=>{let a=n.get(i.pool_address.toLowerCase()),d=a?.deposited_amount??"0";return Ne("a",{className:"wp-item","data-side":"reward",href:s(i),target:"_blank",rel:"noopener noreferrer",children:[Ne("div",{className:"wp-item-body",children:[Ne("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:"Deposited"}),Ne("div",{className:"wp-svc-token",children:[l(i.deposit_token.address,i.deposit_token.symbol)&&ie("img",{className:"wp-svc-token-icon",src:l(i.deposit_token.address,i.deposit_token.symbol),alt:""}),ie("span",{children:cr(d,i.deposit_token.decimals)})]})]}),Ne("div",{className:"wp-item-field",children:[ie("span",{className:"wp-item-label",children:"Rewards"}),i.reward_tokens.map(c=>{let m=l(c.address,c.symbol);return Ne("div",{className:"wp-svc-token",children:[m&&ie("img",{className:"wp-svc-token-icon",src:m,alt:""}),ie("span",{children:a?cr(a.claimable_reward,c.decimals):"0"})]},c.address)})]})]}),Ne("div",{className:"wp-item-badges",children:[ie("span",{className:"wp-badge wp-badge--mint",children:"Claim"}),ie("span",{className:"wp-badge wp-badge--muted",children:"Withdraw"})]})]},i.pool_address)})})}import mr from"bignumber.js";import{Fragment as Zn,jsx as U,jsxs as Y}from"react/jsx-runtime";function no(e){let t=new mr(e);if(t.isNaN())return e;let o=t.decimalPlaces()??0;return t.toFormat(o)}function dr(e){let t=new mr(e.amount).minus(e.filled);return no(t.toString())}function Oe({pairMap:e,ordersByPair:t,getDexUrl:o,getTokenImage:r}){let n=[];for(let[l,s]of t){let i=e.get(l),a=i?r(i.base_address,i.base_symbol):"",d=i?r(i.quote_address,i.quote_symbol):"";for(let c of s.buys)n.push(Y("a",{className:"wp-item","data-side":"buy",href:o(l),target:"_blank",rel:"noopener noreferrer",children:[Y("div",{className:"wp-item-body",children:[Y("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label wp-item-label--buy",children:"Buy"}),Y("div",{className:"wp-svc-token",children:[a&&U("img",{className:"wp-svc-token-icon",src:a,alt:""}),U("span",{children:dr(c)})]})]}),Y("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label",children:"Price"}),Y("div",{className:"wp-svc-token",children:[d&&U("img",{className:"wp-svc-token-icon",src:d,alt:""}),U("span",{children:no(c.price)})]})]})]}),U("div",{className:"wp-item-badges",children:U("span",{className:"wp-badge wp-badge--mint",children:"Claim"})})]},`buy-${c.order_id}`));for(let c of s.sells)n.push(Y("a",{className:"wp-item","data-side":"sell",href:o(l),target:"_blank",rel:"noopener noreferrer",children:[Y("div",{className:"wp-item-body",children:[Y("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label wp-item-label--sell",children:"Sell"}),Y("div",{className:"wp-svc-token",children:[a&&U("img",{className:"wp-svc-token-icon",src:a,alt:""}),U("span",{children:dr(c)})]})]}),Y("div",{className:"wp-item-field",children:[U("span",{className:"wp-item-label",children:"Price"}),Y("div",{className:"wp-svc-token",children:[d&&U("img",{className:"wp-svc-token-icon",src:d,alt:""}),U("span",{children:no(c.price)})]})]})]}),U("div",{className:"wp-item-badges",children:U("span",{className:"wp-badge wp-badge--red",children:"Cancel"})})]},`sell-${c.order_id}`))}return U(Zn,{children:n})}import{jsx as fr}from"react/jsx-runtime";var Kn="Gametoken - CROSS",Yn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function ur(){let{env:e,walletAddress:t}=z(),o=!!t,{pairMap:r,ordersByPair:n,isEmpty:l}=te(e,"cross",t,o),{getTokenImage:s}=pe(e,o);return fr(oe,{title:Kn,icon:Yn,isEmpty:l,children:fr(Oe,{pairMap:r,ordersByPair:n,getDexUrl:a=>{let d=r.get(a.toLowerCase());return`${ce[e]}/gametoken/cross/${d?.base_symbol??""}`},getTokenImage:s})})}import{jsx as wr}from"react/jsx-runtime";var Qn="Gametoken - CROSSD",Xn="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function gr(){let{env:e,walletAddress:t}=z(),o=!!t,{pairMap:r,ordersByPair:n,isEmpty:l}=te(e,"crossd",t,o),{getTokenImage:s}=pe(e,o);return wr(oe,{title:Qn,icon:Xn,isEmpty:l,children:wr(Oe,{pairMap:r,ordersByPair:n,getDexUrl:a=>{let d=r.get(a.toLowerCase());return`${ce[e]}/gametoken/crossd/${d?.base_symbol??""}`},getTokenImage:s})})}import{jsx as hr}from"react/jsx-runtime";var Jn="Gametoken - Forge",ei="https://contents.crosstoken.io/frontend/common/app-launcher/icons/dex.svg";function xr(){let{env:e,walletAddress:t}=z(),o=!!t,{pairMap:r,ordersByPair:n,isEmpty:l}=te(e,"forge",t,o),{getTokenImage:s}=pe(e,o);return hr(oe,{title:Jn,icon:ei,isEmpty:l,children:hr(Oe,{pairMap:r,ordersByPair:n,getDexUrl:a=>{let d=r.get(a.toLowerCase());return`${ce[e]}/gametoken/forge/${d?.base_symbol??""}`},getTokenImage:s})})}import io from"bignumber.js";import{useMemo as si}from"react";import{useQuery as ti}from"@tanstack/react-query";var oi="wp:forge-pools";function br(e,t,o=!0){let r=vt[e],n=o&&!!t,{data:l,...s}=ti({queryKey:[oi,e,t],queryFn:async()=>{let a=await fetch(`${r}/v1/users/${t}/pools`,{cache:"no-store"});if(!a.ok)throw new Error(`forge pools fetch failed: ${a.status}`);return(await a.json()).data?.items??[]},enabled:n,staleTime:0}),i=l??[];return{pools:i,isEmpty:i.length===0,...s}}import{useQueries as ri}from"@tanstack/react-query";import{useMemo as ni}from"react";var ii="wp:forge-token-detail";async function ai(e,t){let o=await fetch(`${e}/v1/tokens/${t}`,{cache:"no-store"});return o.ok?(await o.json())?.data?.token??null:null}function vr(e,t,o=!0){let r=vt[e],n=ri({queries:t.map(i=>({queryKey:[ii,e,i],queryFn:()=>ai(r,i),enabled:o&&!!i,staleTime:3e4}))}),l=ni(()=>{let i=new Map;for(let a=0;a<n.length;a++){let d=n[a]?.data,c=t[a];d&&c&&i.set(c.toLowerCase(),d)}return i},[n,t]),s=n.some(i=>i.isLoading);return{detailMap:l,isLoading:s}}import{jsx as Q,jsxs as Fe}from"react/jsx-runtime";var li="Forge",ci="https://x.crosstoken.io/forge/favicon-96x96.png",pi=18,di="https://contents.crosstoken.io/wallet/token/images/FT.png";function mi(e){if(!e||e==="0")return"0";let t=new io(e).shiftedBy(-pi);return t.isZero()?"0":t.isGreaterThanOrEqualTo(1)?t.toFormat(2,io.ROUND_DOWN):t.toFormat(4,io.ROUND_DOWN)}function fi(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 yr(){let{env:e,walletAddress:t}=z(),o=!!t,{pools:r,isEmpty:n}=br(e,t,o),l=si(()=>r.map(a=>a.token.address),[r]),{detailMap:s}=vr(e,l,o&&l.length>0),i=a=>`${ce[e]}/forge/token/${a.token.address}`;return Q(oe,{title:li,icon:ci,iconFit:"contain",isEmpty:n,children:r.map(a=>{let d=s.get(a.token.address.toLowerCase()),c=d?.image_url||d?.image||a.token.image||di,m=d?.symbol||a.token.symbol;return Fe("a",{className:"wp-item","data-side":"lp",href:i(a),target:"_blank",rel:"noopener noreferrer",children:[Fe("div",{className:"wp-item-body",children:[Fe("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"Pair"}),Fe("div",{className:"wp-svc-token",children:[Q("img",{className:"wp-svc-token-icon",src:c,alt:""}),Q("span",{children:m})]})]}),Fe("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"LP Balance"}),Q("div",{className:"wp-svc-token",children:Q("span",{children:mi(a.lp_balance)})})]}),Fe("div",{className:"wp-item-field",children:[Q("span",{className:"wp-item-label",children:"Ownership"}),Q("div",{className:"wp-svc-token",children:Q("span",{children:fi(a.pool_ownership)})})]})]}),Q("div",{className:"wp-item-badges",children:Q("span",{className:"wp-badge wp-badge--mint",children:"Withdraw"})})]},a.pair_address)})})}P(`.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:Sora,sans-serif;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:Sora,sans-serif;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-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:Roboto,Sora,sans-serif;font-size:16px;font-weight:600;line-height:24px;letter-spacing:.15px;text-align:center;color:var(--wp-text);margin:0}.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}
6
+ `);import{Fragment as gi,jsx as D,jsxs as de}from"react/jsx-runtime";var ao=5,wi="wp:";function Be({env:e="production",theme:t="dark",walletAddress:o,onBack:r,showHeader:n=!0,variant:l="embed",className:s,sendTransaction:i}){let a=!!o,d=ui(),{segments:c}=nr(e,o,a),[m,y]=J.useState(ao),[L,b]=J.useState(!1),f=J.useCallback(()=>{d.invalidateQueries({predicate:h=>typeof h.queryKey[0]=="string"&&h.queryKey[0].startsWith(wi)})},[d]),u=J.useCallback(()=>{f(),b(!0),setTimeout(()=>b(!1),600),y(ao)},[f]);J.useEffect(()=>{if(!a)return;let h=setInterval(()=>{y(S=>S<=1?(u(),ao):S-1)},1e3);return()=>clearInterval(h)},[a,u]);let k=J.useCallback(()=>{r?.()},[r]),E=J.useMemo(()=>({env:e,theme:t,open:!0,walletAddress:o,close:k,sendTransaction:i}),[e,t,o,k,i]),R=de(gi,{children:[n&&de("div",{className:"wp-header",children:[r?D("button",{type:"button",className:"wp-header-btn",onClick:r,children:D(ir,{})}):D("span",{className:"wp-header-btn","aria-hidden":!0}),D("h2",{className:"wp-header-title",children:"My Portfolio"}),de("button",{type:"button",className:"wp-header-btn wp-refresh-btn",onClick:u,children:[D(ar,{className:L?"wp-spin-once":void 0}),a&&D("span",{className:"wp-refresh-badge",children:m})]})]}),D("div",{className:"wp-top",children:c.length>0&&de("div",{className:"wp-asset",children:[de("div",{className:"wp-asset-head",children:[D("span",{className:"wp-asset-head-label",children:"Consolidated Asset"}),D("span",{className:"wp-asset-head-icon",children:D(sr,{})})]}),D("div",{className:"wp-bar",children:c.map(h=>D("div",{className:"wp-bar-seg",style:{flex:`${h.percentage} 0 0`,background:h.color},children:h.percentage>=5&&de("span",{className:"wp-bar-seg-pct",children:[h.percentage,"%"]})},h.symbol))}),D("div",{className:"wp-legend",children:c.map(h=>de("div",{className:"wp-legend-item",children:[D("span",{className:"wp-legend-dot",style:{background:h.color}}),D("span",{className:"wp-legend-label",children:h.symbol})]},h.symbol))})]})}),D("div",{className:"wp-body",children:de("div",{className:"wp-body-inner",children:[D(pr,{}),D(ur,{}),D(gr,{}),D(xr,{}),D(yr,{})]})})]});return D(Xe.Provider,{value:E,children:l==="none"?R:D("div",{className:V(l==="fullscreen"?"wp-fullscreen":"wp-embed",s),"data-theme":t,children:R})})}import{jsx as so,jsxs as kr}from"react/jsx-runtime";function Cr({className:e}){let{env:t,theme:o,walletAddress:r,close:n,sendTransaction:l}=z();return kr(Lt.Portal,{children:[so(Lt.Overlay,{className:"wp-overlay"}),kr(Lt.Content,{className:V("wp-fullscreen",e),"data-theme":o,children:[so(Lt.Title,{className:"wp-sr-only",children:"My Portfolio"}),so(Be,{env:t,theme:o,walletAddress:r,onBack:n,variant:"none",sendTransaction:l})]})]})}import{jsx as Lr}from"react/jsx-runtime";function xi({env:e="production",theme:t="dark",walletAddress:o,open:r,onOpenChange:n,sendTransaction:l,children:s}){let i=r!==void 0,[a,d]=Ie.useState(!1),c=i?r:a,m=Ie.useCallback(b=>{i||d(b),n?.(b)},[i,n]),y=Ie.useCallback(()=>m(!1),[m]),L=Ie.useMemo(()=>({env:e,theme:t,open:c,walletAddress:o,close:y,sendTransaction:l}),[e,t,c,o,y,l]);return Lr(Xe.Provider,{value:L,children:Lr(hi.Root,{direction:"bottom",open:c,onOpenChange:m,noBodyStyles:!0,children:s})})}var Nr=Object.assign(xi,{Trigger:Yo,Content:Cr});import{Fragment as co,jsx as p,jsxs as w}from"react/jsx-runtime";function lo(e,t,o){let r=X[e],n=o.toUpperCase();if(t===r.cross&&n.includes("CROSSD"))return 0;if(t===r.cross&&n==="CROSS")return 1;if(t===r.bsc&&n==="CROSS")return 2}function vi(e){return parseInt(e.split(":")[1],10)}function yi(e){let t=e.lastIndexOf(".");return t===-1?{main:e,decimal:""}:{main:e.slice(0,t),decimal:e.slice(t)}}function ki(e){let t=e.toLowerCase().replace(/^0x/,""),o=t.length>=8?t.slice(0,8):t.padEnd(8,"0"),r=parseInt(o.slice(0,4),16)%360,n=(r+60+parseInt(o.slice(4,8),16)%120)%360;return`linear-gradient(135deg, hsl(${r} 85% 65%), hsl(${n} 80% 55%))`}function Ir({align:e="end",sideOffset:t=12,className:o,children:r}){let{env:n,theme:l,isMobile:s,open:i,drawerDirection:a,modal:d,showBalance:c,showForgeToken:m,showGameToken:y,showQR:L,qrLogoSrc:b,walletAddress:f,accountName:u,profileImageUrl:k,preferredTokens:E,close:R,onSelectWallet:h,onCopyAddress:S,onDisconnect:x,disconnectLabel:v,termsUrl:_,termsLabel:N,privacyUrl:F,privacyLabel:j,portalStyle:re,navContent:we,navPosition:$e,footerContent:rt,view:G,setView:qe,showPortfolio:ze,portfolioTitle:nt,showTotalAssets:it,totalAssetsLabel:je,sendTransaction:Ge}=le(),{tokens:ge,isLoading:he}=We(n,f,i&&c),{statsMap:Pe}=De(n,c),{categoryMap:at}=Go(n,c),ne=c&&it,{displayValue:xe,isLowerBound:st,isLoading:lt}=Zo(n,f,i&&ne),[Re,Ze]=O.useState(!1),{holdings:be,isLoading:Ke}=zo(n,f,i&&c&&m),At=O.useMemo(()=>be.map(g=>g.token),[be]),{imageMap:ct}=jo(n,At,m&&be.length>0),Te=O.useMemo(()=>{let g=[],T=[],M=[],H=new Map((E??[]).map((I,B)=>[`${vi(I.chainId)}:${I.address.toLowerCase()}`,B]));for(let I of ge){let B=lo(n,I.chainId,I.symbol)!==void 0,ve=`${I.chainId}:${I.address.toLowerCase()}`,ye=H.get(ve),Ht=new Je(I.quantity.numeric).shiftedBy(-I.quantity.decimals);if(B)g.push(I);else if(ye!==void 0)T.push(I);else if(Ht.isGreaterThan(0)){if(!y&&at.get(eo(I.chainId,I.address))==="game")continue;M.push(I)}}return g.sort((I,B)=>{let ve=lo(n,I.chainId,I.symbol)??99,ye=lo(n,B.chainId,B.symbol)??99;return ve-ye}),T.sort((I,B)=>{let ve=H.get(`${I.chainId}:${I.address.toLowerCase()}`)??99,ye=H.get(`${B.chainId}:${B.address.toLowerCase()}`)??99;return ve-ye}),M.sort((I,B)=>{let ve=Pe.get(Le(I.chainId,I.address)),ye=Pe.get(Le(B.chainId,B.address)),Ht=new Je(I.quantity.numeric).shiftedBy(-I.quantity.decimals).multipliedBy(ve?.price??0);return new Je(B.quantity.numeric).shiftedBy(-B.quantity.decimals).multipliedBy(ye?.price??0).minus(Ht).toNumber()}),[...g,...T,...M]},[ge,n,Pe,y,at,E]),pt=O.useMemo(()=>{if(!m)return[];let g=new Set(ge.map(T=>T.address.toLowerCase()));return[...be].filter(T=>!g.has(T.token.toLowerCase())).sort((T,M)=>{let H=new Je(T.value);return new Je(M.value).minus(H).toNumber()})},[be,m,ge]),se=O.useRef(!1),Ot=O.useCallback(g=>{se.current=!0,qe(g)},[qe]);O.useEffect(()=>{i||(se.current=!1)},[i]);let uo=O.useRef(null);O.useEffect(()=>{let g=uo.current;if(!g||!s)return;let T=M=>{M.pointerType==="touch"&&M.stopPropagation()};return g.addEventListener("pointerdown",T),()=>g.removeEventListener("pointerdown",T)},[s]);let[Ye,wo]=O.useState(!1),Ft=O.useRef(void 0);O.useEffect(()=>()=>clearTimeout(Ft.current),[]);let go=O.useCallback(async()=>{if(!Ye)try{await navigator.clipboard.writeText(f),wo(!0),clearTimeout(Ft.current),Ft.current=setTimeout(()=>wo(!1),2e3),S?.(f,!0)}catch{S?.(f,!1)}},[f,S,Ye]),Bt=O.useCallback(g=>{g.currentTarget.setAttribute("data-loaded","true")},[]),Gr=O.useMemo(()=>({background:ki(f)}),[f]),ho=O.useMemo(()=>k||qo(n,f,{size:120,bg:l==="dark"?"1A1A2E":"F3F6F8"}),[k,n,f,l]),Vt=O.useMemo(()=>yi(xe),[xe]),Zr=w("div",{className:V("wi-view-inner",se.current&&"wi-view-wallet"),children:[ne&&(()=>{let g=ze;return w(g?"button":"div",{...g?{type:"button",onClick:()=>Ot("portfolio"),"aria-label":"View Portfolio"}:{},className:"wi-total-section","data-clickable":g||void 0,children:[w("div",{className:"wi-total-head",children:[p("span",{className:"wi-total-label",children:je}),p("span",{role:"button",tabIndex:0,className:"wi-total-eye",onClick:M=>{M.stopPropagation(),Ze(H=>!H)},onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),M.stopPropagation(),Ze(H=>!H))},"aria-label":Re?"Show balance":"Hide balance",children:Re?p(Oo,{}):p(Ao,{})})]}),w("div",{className:"wi-total-body",children:[lt?p("div",{className:"wi-skeleton-block wi-total-skeleton",style:{width:160,height:36}}):p("div",{className:"wi-total-value","data-hidden":Re||void 0,children:Re?p("span",{className:"wi-total-mask",children:"\u2022\u2022\u2022\u2022\u2022\u2022"}):w(co,{children:[st&&p("span",{className:"wi-total-lte",children:"\u2264"}),p("span",{className:"wi-total-currency",children:"$"}),p("span",{className:"wi-total-amount",children:Vt.main}),Vt.decimal&&p("span",{className:"wi-total-decimal",children:Vt.decimal})]})}),g&&p("span",{className:"wi-total-chevron","aria-hidden":!0,children:p(Wo,{size:18})})]})]})})(),$e==="top"&&we&&p("div",{className:"wi-nav-fixed",children:we}),c&&p("div",{ref:uo,className:"wi-scrollable-body","data-vaul-no-drag":!0,children:w("div",{className:"wi-token-list",children:[he&&Array.from({length:5},(g,T)=>w("div",{className:"wi-skeleton-item",children:[w("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),w("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}})]})]}),w("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}})]})]},T)),!he&&Te.length===0&&!m&&p("div",{className:"wi-empty",children:"No Tokens Found"}),Te.map(g=>{let T=Pe.get(Le(g.chainId,g.address)),M=T?parseFloat(T.percent_change_24h):null,H=M!==null&&M>=0,I=Qt(n,g.chainId);return w("div",{className:"wi-token-item",children:[w("div",{className:"wi-token-left",children:[w("div",{className:"wi-token-icon-wrap",children:[p("img",{src:g.icon_url,alt:g.symbol,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Bt,onError:B=>{B.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),I&&p("img",{src:I,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:B=>{B.currentTarget.style.display="none"}})]}),w("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:g.symbol}),T&&w("div",{className:"wi-token-price-row",children:[p("span",{className:"wi-token-price",children:Kt(T.price)}),p("span",{className:"wi-token-change","data-positive":H,"data-zero":M===0||void 0,children:M!==null&&(M===0?"0%":`${H?"+":"-"}${(H?Math.floor:Math.ceil)(Math.abs(M)*100)/100}%`)})]})]})]}),w("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:ht(g.quantity.numeric,g.quantity.decimals)}),T&&p("span",{className:"wi-token-value",children:Bo(g.quantity.numeric,g.quantity.decimals,T.price)})]})]},`${g.address}-${g.chainId}`)}),m&&Ke&&Array.from({length:3},(g,T)=>w("div",{className:"wi-skeleton-item",children:[w("div",{className:"wi-skeleton-left",children:[p("div",{className:"wi-skeleton-block wi-skeleton-icon"}),w("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}})]})]}),w("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-${T}`)),m&&!Ke&&!he&&Te.length===0&&pt.length===0&&p("div",{className:"wi-empty",children:"No Tokens Found"}),m&&pt.map(g=>{let T=ct.get(g.token)||"",M=Qt(n,X[n].cross);return w("div",{className:"wi-token-item",children:[w("div",{className:"wi-token-left",children:[w("div",{className:"wi-token-icon-wrap",children:[p("img",{src:T||"https://contents.crosstoken.io/wallet/token/images/FT.png",alt:g.token_name,className:"wi-token-icon",width:32,height:32,loading:"lazy",draggable:!1,onLoad:Bt,onError:H=>{H.currentTarget.src="https://contents.crosstoken.io/wallet/token/images/FT.png"}}),M&&p("img",{src:M,alt:"","aria-hidden":!0,className:"wi-token-chain-badge",width:14,height:14,loading:"lazy",draggable:!1,onError:H=>{H.currentTarget.style.display="none"}})]}),w("div",{className:"wi-token-info",children:[p("span",{className:"wi-token-name",children:g.token_name}),p("div",{className:"wi-token-price-row",children:w("span",{className:"wi-token-price",children:[ht(g.current_price,18)," CROSS"]})})]})]}),w("div",{className:"wi-token-right",children:[p("span",{className:"wi-token-balance",children:ht(g.balance,18)}),p("span",{className:"wi-token-value",children:Kt(g.current_value_usd)})]})]},`forge-${g.token}`)})]})}),$e==="bottom"&&we&&p("div",{className:"wi-nav-fixed",children:we})]},"wallet"),Kr=ze?p("div",{className:V("wi-view-inner wi-portfolio-body",se.current&&"wi-view-portfolio"),children:p(Be,{env:n,theme:l,walletAddress:f,showHeader:!1,sendTransaction:Ge})},"portfolio"):null,Yr=p("div",{className:V("wi-view-inner wi-qr-body",se.current&&"wi-view-qr"),children:p("div",{className:"wi-qr-section",children:w("div",{className:"wi-qr-card",children:[w("div",{className:"wi-qr-code",children:[p(bi,{value:f,size:180,level:"H",marginSize:2,...b&&{imageSettings:{src:b,height:33,width:33,excavate:!0}}}),!b&&p("div",{className:"wi-qr-logo",children:p(Fo,{size:33})})]}),p("p",{className:"wi-qr-address",children:f}),w("button",{type:"button",className:"wi-qr-copy-btn",onClick:go,children:[p("span",{className:"wi-qr-copy-icon",children:Ye?p(Gt,{size:16}):p(jt,{size:16})}),p("span",{className:"wi-qr-copy-text",children:Ye?"Copied!":"Copy address"})]})]})})},"qr"),Qr=G==="qr"||G==="portfolio",Xr=G==="qr"?"My Address":G==="portfolio"?nt:"",xo=rt??(!!x||!!_||!!F?w("div",{className:"wi-builtin-footer",children:[x&&w("button",{type:"button",className:"wi-disconnect-btn",onClick:()=>{x(),R()},children:[p(Mo,{size:20}),p("span",{className:"wi-disconnect-label",children:v})]}),(_||F)&&w("div",{className:"wi-legal-links",children:[_&&p("a",{className:"wi-legal-link",href:_,target:"_blank",rel:"noopener noreferrer",children:N}),_&&F&&p("span",{className:"wi-legal-sep","aria-hidden":!0,children:"\xB7"}),F&&p("a",{className:"wi-legal-link",href:F,target:"_blank",rel:"noopener noreferrer",children:j})]})]}):null),Jr=w("div",{className:"wi-sticky-header",children:[w("div",{className:"wi-header wi-header--wallet",children:[w("div",{className:"wi-account-block",children:[w("div",{className:"wi-avatar",children:[p("div",{className:"wi-avatar-fallback",style:Gr}),ho&&p("img",{src:ho,alt:"",className:"wi-avatar-img",width:30,height:30,draggable:!1,onLoad:Bt,onError:g=>{g.currentTarget.style.display="none"}})]}),w("div",{className:"wi-account-text",children:[h?w("button",{type:"button",className:"wi-account-row wi-account-row--btn",onClick:h,"aria-label":"Switch account",children:[p("span",{className:"wi-account-name",children:u??"Account 1"}),p("span",{className:"wi-account-switch","aria-hidden":"true",children:p(Do,{size:12})})]}):p("div",{className:"wi-account-row",children:p("span",{className:"wi-account-name",children:u??"Account 1"})}),w("button",{type:"button",className:"wi-address-row-btn",onClick:go,"aria-label":"Copy address",children:[p("span",{className:"wi-account-address",children:_e(f)}),p("span",{className:"wi-account-copy",children:Ye?p(Gt,{size:14}):p(jt,{size:14})})]})]})]}),w("div",{className:"wi-header-actions",children:[L&&p("button",{type:"button",className:"wi-header-action",onClick:()=>Ot("qr"),"aria-label":"Show QR code",children:p(So,{size:20})}),p("button",{type:"button",className:"wi-header-action",onClick:R,"aria-label":"Close",children:p(Zt,{size:24})})]})]}),p("hr",{className:"wi-divider"})]}),bo=w(co,{children:[r,Qr?w("div",{className:"wi-sticky-header",children:[w("div",{className:"wi-header",children:[p("button",{type:"button",className:"wi-header-back",onClick:()=>Ot("wallet"),"aria-label":"Back",children:p(_o,{})}),p("div",{className:"wi-header-info",children:p("h2",{className:"wi-header-title",children:Xr})}),p("button",{type:"button",className:"wi-header-close",onClick:R,"aria-label":"Close",children:p(Zt,{})})]}),p("hr",{className:"wi-divider"})]}):Jr,w("div",{className:"wi-view-container",children:[G==="wallet"&&Zr,G==="qr"&&Yr,G==="portfolio"&&Kr]}),xo&&G!=="portfolio"&&p("div",{className:"wi-sticky-footer",children:p("div",{className:"wi-footer",children:xo})})]});return s?w(Nt.Portal,{children:[d&&p(Nt.Overlay,{className:"wi-drawer-overlay"}),w(Nt.Content,{className:V("wi-drawer-content",o),"data-theme":l,style:re,"data-direction":a,"data-no-balance":!c||void 0,"data-view":G,children:[p(Nt.Title,{className:"wi-sr-only",children:"My Wallet"}),bo]})]}):w(co,{children:[d&&i&&p("div",{className:"wi-drawer-overlay",onClick:R}),p(It.Portal,{children:p(It.Content,{align:e,sideOffset:t,className:V("wi-popover-content",o),"data-theme":l,style:re,"data-no-balance":!c||void 0,"data-view":G,children:bo})})]})}import*as Pr from"react";function Rr({position:e="top",children:t}){let{setNavContent:o,setNavPosition:r}=le();return Pr.useEffect(()=>(o(t),r(e),()=>o(null)),[t,e,o,r]),null}import*as Tr from"react";function Er({children:e}){let{setFooterContent:t}=le();return Tr.useEffect(()=>(t(e),()=>t(null)),[e,t]),null}P(`[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)}
7
7
  `);P(`.wi-trigger-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;border:1px solid rgba(255,255,255,.2);background:#1a2332;border-radius:9999px;cursor:pointer;color:#fff;font-family:inherit;font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.3125px;transition:opacity .15s ease}.wi-trigger-btn:hover{opacity:.85}.wi-trigger-btn[data-theme=light]{background:#f3f6f8;border-color:#1212121a;color:#121212}.wi-trigger-btn[data-mobile]{font-size:14px;padding:6px 12px;gap:6px;line-height:20px}.wi-trigger-address{white-space:nowrap}.wi-divider{height:1px;background:var(--wi-border-default);margin:0;border:none;flex-shrink:0}[data-theme=light] .wi-divider{background:#1212121a}[data-theme=dark] .wi-divider{background:#ffffff1a}
8
8
  `);P(`@keyframes wi-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes wi-shimmer{0%{transform:translate(-100%)}to{transform:translate(100%)}}@keyframes wi-slide-in-right{0%{transform:translate(40px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes wi-slide-in-left{0%{transform:translate(-40px);opacity:0}to{transform:translate(0);opacity:1}}
9
9
  `);P(`.wi-popover-content{z-index:100001;width:343px;border-radius:24px;border:4px 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-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:auto;left:0;right:0;width:100%;max-height:60vh;margin:0 auto}.wi-drawer-content[data-direction=bottom][data-view=qr]{max-height:85dvh}.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-account-block{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.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;border-radius:8px;object-fit:contain;opacity:0;transition:opacity .2s ease;background:var(--wi-surface-default)}.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-disconnect-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;height:48px;padding:0 16px;border:none;border-radius:12px;background:var(--wi-surface-default);color:var(--wi-texticon-primary);font-family:inherit;font-size:16px;font-weight:600;line-height:1.3;cursor:pointer;transition:opacity .15s ease,background .15s ease}.wi-disconnect-btn:hover{opacity:.85}.wi-disconnect-label{white-space:nowrap}.wi-legal-links{display:inline-flex;align-items:center;justify-content:center;gap:6px;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-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:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 24px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent;overscroll-behavior:contain}[data-theme=light] .wi-qr-section{scrollbar-color:rgba(0,0,0,.12) transparent}.wi-qr-section::-webkit-scrollbar{width:4px}.wi-qr-section::-webkit-scrollbar-track{background:transparent}.wi-qr-section::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px}.wi-qr-section::-webkit-scrollbar-thumb:hover{background:#ffffff40}[data-theme=light] .wi-qr-section::-webkit-scrollbar-thumb{background:#0000001f}[data-theme=light] .wi-qr-section::-webkit-scrollbar-thumb:hover{background:#0003}.wi-qr-card{display:flex;flex-direction:column;align-items:center;gap:20px;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:16px;font-weight:600;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}
10
10
  `);P(`.wi-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
11
- `);import{jsx as eo}from"react/jsx-runtime";function da({env:e="production",theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o,modal:n,showBalance:l=!1,showForgeToken:i=!1,showGameToken:a=!0,showQR:s=!0,qrLogoSrc:c,walletAddress:d,accountName:m,profileImageUrl:R,connectorId:k,connectorName:b,connectorIconUrl:f,preferredTokens:u=[],onSelectWallet:C,onCopyAddress:M,onDisconnect:x,disconnectLabel:N="Disconnect",termsUrl:O,termsLabel:h="Terms of Service",privacyUrl:v,privacyLabel:_="Privacy Policy",open:L,onOpenChange:B,showPortfolio:z=!1,portfolioTitle:re="My Portfolio",showTotalAssets:fe=!0,totalAssetsLabel:Ve="Total Assets USD",style:Je,children:G}){let He=k?pt[k]:void 0,Ue=b??He?.name,et=f??He?.iconUrl,$e=Re(`(max-width: ${r}px)`),qe=o??(l?"right":"bottom"),ue=n??!1,we=L!==void 0,[Le,tt]=Y.useState(!1),ne=we?L:Le,ge=Y.useCallback(se=>{we||tt(se),B?.(se)},[we,B]),ot=Y.useCallback(()=>ge(!1),[ge]),[rt,Ie]=Y.useState(null),[je,he]=Y.useState("top"),[ze,It]=Y.useState(null),[nt,Pe]=Y.useState("wallet");Y.useEffect(()=>{ne||Pe("wallet")},[ne]);let at=Y.useMemo(()=>({env:e,theme:t,isMobile:$e,open:ne,drawerDirection:qe,modal:ue,showBalance:l,showForgeToken:i,showGameToken:a,showQR:s,qrLogoSrc:c,walletAddress:d,accountName:m,profileImageUrl:R,connectorName:Ue,connectorIconUrl:et,preferredTokens:u,close:ot,onSelectWallet:C,onCopyAddress:M,onDisconnect:x,disconnectLabel:N,termsUrl:O,termsLabel:h,privacyUrl:v,privacyLabel:_,portalStyle:Je,navContent:rt,navPosition:je,setNavContent:Ie,setNavPosition:he,footerContent:ze,setFooterContent:It,view:nt,setView:Pe,showPortfolio:z,portfolioTitle:re,showTotalAssets:fe,totalAssetsLabel:Ve}),[e,t,$e,ne,qe,ue,l,i,a,s,c,d,m,R,Ue,et,u,ot,C,M,x,N,O,h,v,_,Je,rt,je,ze,nt,z,re,fe,Ve]);return eo(St.Provider,{value:at,children:$e?eo(pa.Root,{direction:qe,open:ne,onOpenChange:ge,noBodyStyles:!0,children:G},"drawer"):eo(vr.Root,{open:ne,onOpenChange:ge,children:G},"popover")})}var yr=Object.assign(da,{Trigger:Mo,Content:wr,Nav:hr,Footer:br});import*as ie from"react";import*as _r from"@radix-ui/react-dialog";import{Drawer as xa}from"vaul";import{createContext as ma,useContext as fa}from"react";var kt=ma(null);function Qe(){let e=fa(kt);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as kr,useEffect as ua,useCallback as wa}from"react";function Ct(){let[e,t]=kr([]),[r,o]=kr(!0);ua(()=>{if(typeof window>"u"){o(!1);return}let l=[],i=s=>{let{info:c}=s.detail;c?.rdns&&!l.some(d=>d.rdns===c.rdns)&&(l.push({rdns:c.rdns,name:c.name,icon:c.icon}),t([...l]))};window.addEventListener("eip6963:announceProvider",i),window.addEventListener("eip6963:crossAnnounceProvider",i),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let a=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",i),window.removeEventListener("eip6963:crossAnnounceProvider",i),clearTimeout(a)}},[]);let n=wa(l=>e.some(i=>i.rdns===l),[e]);return{wallets:e,isDetected:n,isLoading:r}}import*as Nr from"@radix-ui/react-dialog";import{Drawer as ga}from"vaul";import{jsx as Cr}from"react/jsx-runtime";function Lr({asChild:e,children:t}){let{isMobile:r}=Qe(),o=r?ga.Trigger:Nr.Trigger;return Cr(o,{asChild:e??t!=null,children:t??Cr("button",{type:"button",children:"Connect Wallet"})})}import*as me from"@radix-ui/react-dialog";import{Drawer as Lt}from"vaul";import{jsx as D,jsxs as Be}from"react/jsx-runtime";function Nt(){return Be("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),D("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 Ir(){return Be("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[Be("g",{clipPath:"url(#clip0_1331_27065)",children:[D("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"}),D("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"}),D("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"}),D("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"}),D("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"}),D("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),D("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"})]}),D("defs",{children:D("clipPath",{id:"clip0_1331_27065",children:D("rect",{width:"40",height:"40",fill:"white"})})})]})}function Pr(){return Be("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[D("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),D("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"}),D("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),D("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 Rr(){return Be("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Be("g",{clipPath:"url(#clip0_1185_7785)",children:[D("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"}),D("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"})]}),D("defs",{children:D("clipPath",{id:"clip0_1185_7785",children:D("rect",{width:"28",height:"28",fill:"white"})})})]})}function Tr(){return D("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var to={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Nt,featured:!0},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Nt},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Nt,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:Ir,rdns:"io.metamask"},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Pr,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Rr,badge:"For SHOP"}};function Fe(e){return to[e]}import{Fragment as ha,jsx as y,jsxs as q}from"react/jsx-runtime";function Er({wallet:e,detected:t,onConnect:r}){let o=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}r()},n=e.icon;return q("button",{type:"button",className:"wcm-wallet-item",onClick:o,children:[q("div",{className:"wcm-wallet-item-left",children:[y("div",{className:"wcm-wallet-icon",children:y(n,{})}),q("div",{className:"wcm-wallet-info",children:[q("div",{className:"wcm-wallet-name-row",children:[y("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&y("span",{className:"wcm-wallet-badge",children:e.badge})]}),y("span",{className:"wcm-wallet-desc",children:e.description})]})]}),e.installUrl&&(t?y("span",{className:"wcm-installed-label",children:"Installed"}):y("span",{className:"wcm-install-btn",children:"Install"}))]})}function Mr(){let{wallets:e,activeWalletIds:t,isDetected:r,close:o,isMobile:n}=Qe(),l=t.filter(s=>{let c=Fe(s).visibility;return!c||c==="always"?!0:c==="desktop-only"?!n:c==="mobile-only"?n:!0}),i=l.filter(s=>Fe(s).featured),a=l.filter(s=>!Fe(s).featured);return q(ha,{children:[q("div",{className:"wcm-header",children:[q("div",{className:"wcm-header-text",children:[y("h2",{className:"wcm-title",children:"Connect Wallet"}),y("p",{className:"wcm-subtitle",children:"Connect with one of our available wallet providers to continue."})]}),y("button",{type:"button",className:"wcm-close-btn",onClick:o,children:y(Tr,{})})]}),y("div",{className:"wcm-divider"}),q("div",{className:"wcm-body",children:[i.map(s=>{let c=Fe(s),d=c.rdns?r(c.rdns):!1;return y(Er,{wallet:c,detected:d,onConnect:()=>{e[s]?.(),o()}},s)}),i.length>0&&a.length>0&&q("div",{className:"wcm-separator",children:[y("div",{className:"wcm-separator-line"}),y("span",{className:"wcm-separator-text",children:"or"}),y("div",{className:"wcm-separator-line"})]}),y("div",{className:"wcm-wallet-list",children:a.map(s=>{let c=Fe(s),d=c.rdns?r(c.rdns):!1;return y(Er,{wallet:c,detected:d,onConnect:()=>{e[s]?.(),o()}},s)})}),q("div",{className:"wcm-help",children:[y("p",{className:"wcm-help-title",children:"Wallet not detected?"}),q("ul",{className:"wcm-help-list",children:[y("li",{children:"Ensure your wallet extension is installed and unlocked"}),y("li",{children:"Try refreshing the page"}),y("li",{children:"Some wallets may require you to first open the extension"}),y("li",{children:"You can try clicking the wallet anyway"})]})]}),y("div",{className:"wcm-divider"}),y("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 Wr({className:e}){let{isMobile:t,theme:r,portalStyle:o}=Qe();return t?q(Lt.Portal,{children:[y(Lt.Overlay,{className:"wcm-overlay"}),q(Lt.Content,{className:V("wcm-drawer-content",e),"data-theme":r,style:o,children:[y(Lt.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),y("div",{className:"wcm-drawer-handle"}),y("div",{className:"wcm-drawer-body",children:y(Mr,{})})]})]}):q(me.Portal,{children:[y(me.Overlay,{className:"wcm-overlay"}),q(me.Content,{className:V("wcm-dialog-content",e),"data-theme":r,style:o,children:[y(me.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),y("div",{className:"wcm-dialog-body",children:y(Mr,{})})]})]})}P(`[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))}
11
+ `);import{jsx as po}from"react/jsx-runtime";var Li="https://terms.crosstoken.io/docs/cross-terms-of-use",Ni="https://terms.crosstoken.io/docs/nexus-privacy-policy";function Ii({env:e="production",theme:t="dark",mobileBreakpoint:o=768,drawerDirection:r,modal:n,showBalance:l=!1,showForgeToken:s=!1,showGameToken:i=!0,showQR:a=!0,qrLogoSrc:d,walletAddress:c,accountName:m,profileImageUrl:y,connectorId:L,connectorName:b,connectorIconUrl:f,preferredTokens:u=[],onSelectWallet:k,onCopyAddress:E,onDisconnect:R,disconnectLabel:h="Disconnect",termsUrl:S=Li,termsLabel:x="Terms of Service",privacyUrl:v=Ni,privacyLabel:_="Privacy Policy",open:N,onOpenChange:F,showPortfolio:j=!1,portfolioTitle:re="My Portfolio",showTotalAssets:we=!0,totalAssetsLabel:$e="Total Assets USD",sendTransaction:rt,style:G,children:qe}){let ze=L?wt[L]:void 0,nt=b??ze?.name,it=f??ze?.iconUrl,je=Ee(`(max-width: ${o}px)`),Ge=r??(l?"right":"bottom"),ge=n??!1,he=N!==void 0,[Pe,at]=K.useState(!1),ne=he?N:Pe,xe=K.useCallback(se=>{he||at(se),F?.(se)},[he,F]),st=K.useCallback(()=>xe(!1),[xe]),[lt,Re]=K.useState(null),[Ze,be]=K.useState("top"),[Ke,At]=K.useState(null),[ct,Te]=K.useState("wallet");K.useEffect(()=>{ne||Te("wallet")},[ne]);let pt=K.useMemo(()=>({env:e,theme:t,isMobile:je,open:ne,drawerDirection:Ge,modal:ge,showBalance:l,showForgeToken:s,showGameToken:i,showQR:a,qrLogoSrc:d,walletAddress:c,accountName:m,profileImageUrl:y,connectorName:nt,connectorIconUrl:it,preferredTokens:u,close:st,onSelectWallet:k,onCopyAddress:E,onDisconnect:R,disconnectLabel:h,termsUrl:S,termsLabel:x,privacyUrl:v,privacyLabel:_,portalStyle:G,navContent:lt,navPosition:Ze,setNavContent:Re,setNavPosition:be,footerContent:Ke,setFooterContent:At,view:ct,setView:Te,showPortfolio:j,portfolioTitle:re,showTotalAssets:we,totalAssetsLabel:$e,sendTransaction:rt}),[e,t,je,ne,Ge,ge,l,s,i,a,d,c,m,y,nt,it,u,st,k,E,R,h,S,x,v,_,G,lt,Ze,Ke,ct,j,re,we,$e,rt]);return po(qt.Provider,{value:pt,children:je?po(Ci.Root,{direction:Ge,open:ne,onOpenChange:xe,noBodyStyles:!0,children:qe},"drawer"):po(Mr.Root,{open:ne,onOpenChange:xe,children:qe},"popover")})}var Ve=Object.assign(Ii,{Trigger:Uo,Content:Ir,Nav:Rr,Footer:Er});import*as ae from"react";import*as $r from"@radix-ui/react-dialog";import{Drawer as _i}from"vaul";import{createContext as Pi,useContext as Ri}from"react";var Pt=Pi(null);function et(){let e=Ri(Pt);if(!e)throw new Error("WalletConnectModal compound components must be used within <WalletConnectModal>");return e}import{useState as Sr,useEffect as Ti,useCallback as Ei}from"react";function Rt(){let[e,t]=Sr([]),[o,r]=Sr(!0);Ti(()=>{if(typeof window>"u"){r(!1);return}let l=[],s=a=>{let{info:d}=a.detail;d?.rdns&&!l.some(c=>c.rdns===d.rdns)&&(l.push({rdns:d.rdns,name:d.name,icon:d.icon}),t([...l]))};window.addEventListener("eip6963:announceProvider",s),window.addEventListener("eip6963:crossAnnounceProvider",s),window.dispatchEvent(new Event("eip6963:requestProvider")),window.dispatchEvent(new Event("eip6963:crossRequestProvider"));let i=setTimeout(()=>r(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",s),window.removeEventListener("eip6963:crossAnnounceProvider",s),clearTimeout(i)}},[]);let n=Ei(l=>e.some(s=>s.rdns===l),[e]);return{wallets:e,isDetected:n,isLoading:o}}import*as Wr from"@radix-ui/react-dialog";import{Drawer as Mi}from"vaul";import{jsx as _r}from"react/jsx-runtime";function Dr({asChild:e,children:t}){let{isMobile:o}=et(),r=o?Mi.Trigger:Wr.Trigger;return _r(r,{asChild:e??t!=null,children:t??_r("button",{type:"button",children:"Connect Wallet"})})}import*as me from"@radix-ui/react-dialog";import{Drawer as Et}from"vaul";import{jsx as A,jsxs as He}from"react/jsx-runtime";function Tt(){return He("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A("circle",{cx:"20",cy:"20",r:"20",fill:"#00D5AA"}),A("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 Ar(){return He("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",children:[He("g",{clipPath:"url(#clip0_1331_27065)",children:[A("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"}),A("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"}),A("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"}),A("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"}),A("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"}),A("path",{d:"M22.1857 36.1951V39.831H17.6699V36.1951H22.1857Z",fill:"#C0C4CD"}),A("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"})]}),A("defs",{children:A("clipPath",{id:"clip0_1331_27065",children:A("rect",{width:"40",height:"40",fill:"white"})})})]})}function Or(){return He("svg",{xmlns:"http://www.w3.org/2000/svg",width:"247",height:"246",viewBox:"0 0 247 246",fill:"none",children:[A("rect",{width:"247.005",height:"245.105",rx:"36",fill:"#121212"}),A("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"}),A("path",{d:"M59.8364 99.8915V59.7551H12.0414L30.4787 77.8377V99.8915H59.8364Z",fill:"#2FD7FF"}),A("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 Fr(){return He("svg",{width:"40",height:"40",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[He("g",{clipPath:"url(#clip0_1185_7785)",children:[A("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"}),A("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"})]}),A("defs",{children:A("clipPath",{id:"clip0_1185_7785",children:A("rect",{width:"28",height:"28",fill:"white"})})})]})}function Br(){return A("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:A("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var mo={cross_embedded:{id:"cross_embedded",name:"CROSSx with Social",description:"Sign in with Google or Apple",icon:Tt,featured:!0},cross_wallet:{id:"cross_wallet",name:"CROSSx",description:"App approval is required",icon:Tt},cross_extension:{id:"cross_extension",name:"CROSSx Extension",description:"Browser extension approval is required",icon:Tt,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:Ar,rdns:"io.metamask"},verse8:{id:"verse8",name:"Verse8 Wallet",description:"Optimized for Forge and Verse8 ecosystem",icon:Or,badge:"For Forge"},tron:{id:"tron",name:"Tron Wallet",description:"Dedicated for Tron-based transactions and assets",icon:Fr,badge:"For SHOP"}};function Ue(e){return mo[e]}import{Fragment as Si,jsx as C,jsxs as q}from"react/jsx-runtime";function Vr({wallet:e,detected:t,onConnect:o}){let r=()=>{if(e.installUrl&&!t){window.open(e.installUrl,"_blank","noopener,noreferrer");return}o()},n=e.icon;return q("button",{type:"button",className:"wcm-wallet-item",onClick:r,children:[q("div",{className:"wcm-wallet-item-left",children:[C("div",{className:"wcm-wallet-icon",children:C(n,{})}),q("div",{className:"wcm-wallet-info",children:[q("div",{className:"wcm-wallet-name-row",children:[C("span",{className:"wcm-wallet-name",children:e.name}),e.badge&&C("span",{className:"wcm-wallet-badge",children:e.badge})]}),C("span",{className:"wcm-wallet-desc",children:e.description})]})]}),e.installUrl&&(t?C("span",{className:"wcm-installed-label",children:"Installed"}):C("span",{className:"wcm-install-btn",children:"Install"}))]})}function Hr(){let{wallets:e,activeWalletIds:t,isDetected:o,close:r,isMobile:n}=et(),l=t.filter(a=>{let d=Ue(a).visibility;return!d||d==="always"?!0:d==="desktop-only"?!n:d==="mobile-only"?n:!0}),s=l.filter(a=>Ue(a).featured),i=l.filter(a=>!Ue(a).featured);return q(Si,{children:[q("div",{className:"wcm-header",children:[q("div",{className:"wcm-header-text",children:[C("h2",{className:"wcm-title",children:"Connect Wallet"}),C("p",{className:"wcm-subtitle",children:"Connect with one of our available wallet providers to continue."})]}),C("button",{type:"button",className:"wcm-close-btn",onClick:r,children:C(Br,{})})]}),C("div",{className:"wcm-divider"}),q("div",{className:"wcm-body",children:[s.map(a=>{let d=Ue(a),c=d.rdns?o(d.rdns):!1;return C(Vr,{wallet:d,detected:c,onConnect:()=>{e[a]?.(),r()}},a)}),s.length>0&&i.length>0&&q("div",{className:"wcm-separator",children:[C("div",{className:"wcm-separator-line"}),C("span",{className:"wcm-separator-text",children:"or"}),C("div",{className:"wcm-separator-line"})]}),C("div",{className:"wcm-wallet-list",children:i.map(a=>{let d=Ue(a),c=d.rdns?o(d.rdns):!1;return C(Vr,{wallet:d,detected:c,onConnect:()=>{e[a]?.(),r()}},a)})}),q("div",{className:"wcm-help",children:[C("p",{className:"wcm-help-title",children:"Wallet not detected?"}),q("ul",{className:"wcm-help-list",children:[C("li",{children:"Ensure your wallet extension is installed and unlocked"}),C("li",{children:"Try refreshing the page"}),C("li",{children:"Some wallets may require you to first open the extension"}),C("li",{children:"You can try clicking the wallet anyway"})]})]}),C("div",{className:"wcm-divider"}),C("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 Ur({className:e}){let{isMobile:t,theme:o,portalStyle:r}=et();return t?q(Et.Portal,{children:[C(Et.Overlay,{className:"wcm-overlay"}),q(Et.Content,{className:V("wcm-drawer-content",e),"data-theme":o,style:r,children:[C(Et.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),C("div",{className:"wcm-drawer-handle"}),C("div",{className:"wcm-drawer-body",children:C(Hr,{})})]})]}):q(me.Portal,{children:[C(me.Overlay,{className:"wcm-overlay"}),q(me.Content,{className:V("wcm-dialog-content",e),"data-theme":o,style:r,children:[C(me.Title,{className:"wcm-sr-only",children:"Connect Wallet"}),C("div",{className:"wcm-dialog-body",children:C(Hr,{})})]})]})}P(`[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))}
12
12
  `);P(`.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:4px 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-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%;padding:16px;background:var(--wcm-surface-default);border:1px solid transparent;border-radius:20px;cursor:pointer;text-align:left;transition:border-color .15s;font-family:inherit}.wcm-wallet-item:hover{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:40px;height:40px;display:flex;align-items:center;justify-content:center}.wcm-wallet-icon>svg{width:40px;height:40px}.wcm-wallet-info{display:flex;flex-direction:column;justify-content:center;min-width:0}.wcm-wallet-name-row{display:flex;align-items:center;gap:8px}.wcm-wallet-name{font-family:inherit;font-weight:700;font-size:18px;line-height:1.3;color:var(--wcm-texticon-primary);white-space:nowrap}.wcm-wallet-desc{font-family:inherit;font-weight:400;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary)}.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-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-help{display:flex;flex-direction:column;gap:4px}.wcm-help-title{font-family:inherit;font-weight:600;font-size:14px;line-height:1.4;color:var(--wcm-texticon-primary);margin:0}.wcm-help-list{list-style:none;padding:0;margin:0}.wcm-help-list li{display:flex;align-items:center;gap:8px;font-family:inherit;font-weight:400;font-size:14px;line-height:1.4;color:var(--wcm-texticon-secondary)}.wcm-help-list li:before{content:"";display:block;flex-shrink:0;width:4px;height:4px;min-width:4px;min-height:4px;background:var(--wcm-texticon-secondary)}.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}
13
13
  `);P(`@keyframes wcm-overlay-show{0%{opacity:0}to{opacity:1}}@keyframes wcm-overlay-hide{0%{opacity:1}to{opacity:0}}@keyframes wcm-dialog-show{0%{opacity:0;transform:translate(-50%,-48%) scale(.96)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes wcm-dialog-hide{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-48%) scale(.96)}}
14
- `);import{jsx as Xe}from"react/jsx-runtime";function ba({wallets:e,theme:t="dark",mobileBreakpoint:r=768,drawerDirection:o="bottom",dialogWidth:n,drawerMaxWidth:l,drawerMinWidth:i,style:a,open:s,onOpenChange:c,children:d}){let m=Re(`(max-width: ${r}px)`),[R,k]=ie.useState(!1),b=s!==void 0,f=b?s:R,u=ie.useCallback(v=>{b||k(v),c?.(v)},[b,c]),C=ie.useCallback(()=>u(!1),[u]),{isDetected:M}=Ct(),x=ie.useMemo(()=>Object.keys(e),[e]),N=ie.useMemo(()=>{let v={};return n&&(v["--wcm-dialog-width"]=n),l&&(v["--wcm-drawer-max-width"]=l),i&&(v["--wcm-drawer-min-width"]=i),{...v,...a}},[n,l,i,a]),O=ie.useMemo(()=>({theme:t,isMobile:m,open:f,setOpen:u,close:C,wallets:e,activeWalletIds:x,isDetected:M,portalStyle:N}),[t,m,f,u,C,e,x,M,N]),h=Xe("div",{"data-theme":t,style:N,children:d});return m?Xe(kt.Provider,{value:O,children:Xe(xa.Root,{direction:o,open:f,onOpenChange:u,noBodyStyles:!0,children:h},"drawer")}):Xe(kt.Provider,{value:O,children:Xe(_r.Root,{open:f,onOpenChange:u,children:h})})}var Sr=Object.assign(ba,{Trigger:Lr,Content:Wr});export{co as AppLauncher,xo as AppLauncherContent,wo as AppLauncherTrigger,pt as CONNECTOR_REGISTRY,Dt as ConnectorId,$t as TOKEN_STATS_QUERY_KEY,Ut as USER_BALANCE_QUERY_KEY,to as WALLET_REGISTRY,Sr as WalletConnectModal,yr as WalletInfo,ur as WalletPortfolio,Oe as WalletPortfolioBody,lt as useGlobalMenu,We as useTokenBalance,_e as useTokenStats,Ct as useWalletDetect};
14
+ `);import{jsx as tt}from"react/jsx-runtime";function Wi({wallets:e,theme:t="dark",mobileBreakpoint:o=768,drawerDirection:r="bottom",dialogWidth:n,drawerMaxWidth:l,drawerMinWidth:s,style:i,open:a,onOpenChange:d,children:c}){let m=Ee(`(max-width: ${o}px)`),[y,L]=ae.useState(!1),b=a!==void 0,f=b?a:y,u=ae.useCallback(v=>{b||L(v),d?.(v)},[b,d]),k=ae.useCallback(()=>u(!1),[u]),{isDetected:E}=Rt(),R=ae.useMemo(()=>Object.keys(e),[e]),h=ae.useMemo(()=>{let v={};return n&&(v["--wcm-dialog-width"]=n),l&&(v["--wcm-drawer-max-width"]=l),s&&(v["--wcm-drawer-min-width"]=s),{...v,...i}},[n,l,s,i]),S=ae.useMemo(()=>({theme:t,isMobile:m,open:f,setOpen:u,close:k,wallets:e,activeWalletIds:R,isDetected:E,portalStyle:h}),[t,m,f,u,k,e,R,E,h]),x=tt("div",{"data-theme":t,style:h,children:c});return m?tt(Pt.Provider,{value:S,children:tt(_i.Root,{direction:r,open:f,onOpenChange:u,noBodyStyles:!0,children:x},"drawer")}):tt(Pt.Provider,{value:S,children:tt($r.Root,{open:f,onOpenChange:u,children:x})})}var qr=Object.assign(Wi,{Trigger:Dr,Content:Ur});var Di='<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>',Ai='<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>',Oi='<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>',Fi='<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>',Bi='<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 ot(e){return`data:image/svg+xml,${encodeURIComponent(e)}`}var Mt=ot(Di),St=ot(Ai),_t=ot(Oi),Wt=ot(Fi),Dt=ot(Bi);import{jsx as ue,jsxs as fo}from"react/jsx-runtime";function jr({isConnecting:e,address:t,provider:o,providerName:r,accountName:n,onConnect:l,onDisconnect:s,onCopy:i,onSelectWallet:a,label:d="Connect Wallet",connectingLabel:c="Connecting...",disconnectLabel:m,className:y,theme:L="dark",env:b,showBalance:f=!0,showPortfolio:u,drawerDirection:k,modal:E,connectorId:R,style:h,sendTransaction:S}){if(e)return fo("button",{type:"button",disabled:!0,className:y,style:y?void 0:{...fe.button,...fe.buttonLoading},"aria-busy":"true",children:[ue("style",{children:$i}),ue("span",{style:fe.spinner,"aria-hidden":"true"}),c]});if(t){let x=r??Ui(o),v=o?Vi[o]:void 0;return fo(Ve,{env:b,theme:L,drawerDirection:k,modal:E,showBalance:f,showPortfolio:u,walletAddress:t,accountName:n,connectorId:R,onSelectWallet:a,onCopyAddress:i?(_,N)=>{N&&i()}:void 0,onDisconnect:s,disconnectLabel:m,style:h,sendTransaction:S,children:[ue(Ve.Trigger,{asChild:!0,children:fo("button",{type:"button",className:y,style:y?void 0:fe.connectedBtn,"aria-label":`Connected with ${x}: ${zr(t)}`,children:[v?ue("img",{src:v,alt:"",width:20,height:20,style:fe.connectedIcon}):ue("span",{style:fe.connectedIconPlaceholder,"aria-hidden":"true"}),ue("span",{style:fe.connectedAddress,children:zr(t)})]})}),ue(Ve.Content,{align:"end",sideOffset:8})]})}return ue("button",{type:"button",onClick:l,className:y,style:y?void 0:fe.button,children:d})}var Vi={google:Wt,apple:Dt,cross:Mt,metamask:St,binance:_t},Hi={google:"Google",apple:"Apple",cross:"CROSSx",metamask:"MetaMask",binance:"Binance Wallet"};function Ui(e){return e?Hi[e]:"Wallet"}function zr(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}var $i="@keyframes cross-cb-spin{to{transform:rotate(360deg)}}",fe={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{Dt as APPLE_ICON,yo as AppLauncher,To as AppLauncherContent,Io as AppLauncherTrigger,_t as BINANCE_ICON,wt as CONNECTOR_REGISTRY,Mt as CROSSX_ICON,jr as ConnectButton,zt as ConnectorId,Wt as GOOGLE_ICON,St as METAMASK_ICON,Jt as TOKEN_STATS_QUERY_KEY,Xt as USER_BALANCE_QUERY_KEY,mo as WALLET_REGISTRY,qr as WalletConnectModal,Ve as WalletInfo,Nr as WalletPortfolio,Be as WalletPortfolioBody,ft as useGlobalMenu,We as useTokenBalance,De as useTokenStats,Rt as useWalletDetect};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/dapp-ui",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Shared DApp UI components for the CROSS ecosystem — AppLauncher, WalletInfo, WalletPortfolio, WalletConnectModal",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",