@aori/mega-swap-widget 0.1.13 → 0.1.15

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.
Files changed (47) hide show
  1. package/dist/AssetSelectionMenu-6CVRQVYF.cjs +2 -0
  2. package/dist/AssetSelectionMenu-L4HLQ6EE.js +2 -0
  3. package/dist/ChainSelectionMenu-OEUXOW4U.cjs +2 -0
  4. package/dist/ChainSelectionMenu-ZBCBZLUJ.js +2 -0
  5. package/dist/SwapFormHorizontal-PKQLLSWV.cjs +2 -0
  6. package/dist/SwapFormHorizontal-TN7TRDH6.js +2 -0
  7. package/dist/SwapFormSplit-P3SM3A7K.cjs +2 -0
  8. package/dist/SwapFormSplit-ULDMGQV4.js +2 -0
  9. package/dist/{WidgetWalletPanel-7L7E7IA5.js → WidgetWalletPanel-5PATFPG7.js} +1 -1
  10. package/dist/{WidgetWalletPanel-B3VZ6AIJ.cjs → WidgetWalletPanel-YDJROJ5X.cjs} +1 -1
  11. package/dist/WidgetWalletTradeHistory-OMFNUGLQ.cjs +2 -0
  12. package/dist/WidgetWalletTradeHistory-TVZXVRI4.js +2 -0
  13. package/dist/{chunk-GIDTBDDC.cjs → chunk-4DL25Q57.cjs} +1 -1
  14. package/dist/{chunk-W63DXT5E.js → chunk-5ETKDN5C.js} +1 -1
  15. package/dist/chunk-62ZNAMP7.js +2 -0
  16. package/dist/{chunk-TLVNPEBL.cjs → chunk-7HIUB5W6.cjs} +1 -1
  17. package/dist/{chunk-FWH744XA.js → chunk-7ZT3SGKA.js} +1 -1
  18. package/dist/{chunk-PFQ7GSLH.js → chunk-BKAIYAE7.js} +1 -1
  19. package/dist/{chunk-MJMI6IZW.js → chunk-DNOZXHWQ.js} +1 -1
  20. package/dist/{chunk-XCPMBMS7.js → chunk-GGP6UREO.js} +1 -1
  21. package/dist/{chunk-MVF5PRDZ.js → chunk-GQ63BSRF.js} +1 -1
  22. package/dist/{chunk-R36QQMHJ.cjs → chunk-KJGKWM6Y.cjs} +1 -1
  23. package/dist/{chunk-6BEXSHIC.js → chunk-LAJ3ELJV.js} +1 -1
  24. package/dist/{chunk-4S3B2JQY.cjs → chunk-NVCIA743.cjs} +3 -3
  25. package/dist/{chunk-N2SES3FP.cjs → chunk-OOKW3V5M.cjs} +1 -1
  26. package/dist/chunk-OPACGOVQ.cjs +2 -0
  27. package/dist/{chunk-E7O7PKZA.cjs → chunk-RRDWIVV4.cjs} +1 -1
  28. package/dist/{chunk-NNNQNB5T.js → chunk-SJMURCHX.js} +5 -5
  29. package/dist/{chunk-GK3MOEYU.cjs → chunk-TN27ALOV.cjs} +1 -1
  30. package/dist/{chunk-3PGCHNG2.cjs → chunk-TTVEGOCZ.cjs} +1 -1
  31. package/dist/index.cjs +2 -2
  32. package/dist/index.d.cts +4 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.js +2 -2
  35. package/package.json +1 -1
  36. package/dist/AssetSelectionMenu-F2JUPXHM.js +0 -2
  37. package/dist/AssetSelectionMenu-U7S42AGB.cjs +0 -2
  38. package/dist/ChainSelectionMenu-BGZDH2WA.js +0 -2
  39. package/dist/ChainSelectionMenu-QGLWZEIZ.cjs +0 -2
  40. package/dist/SwapFormHorizontal-MEYPUSEU.js +0 -2
  41. package/dist/SwapFormHorizontal-QI3GS2BO.cjs +0 -2
  42. package/dist/SwapFormSplit-7VZ7IIJR.js +0 -2
  43. package/dist/SwapFormSplit-LI3MH5YB.cjs +0 -2
  44. package/dist/WidgetWalletTradeHistory-AQOIIO2U.cjs +0 -2
  45. package/dist/WidgetWalletTradeHistory-ES3FEDM7.js +0 -2
  46. package/dist/chunk-GF37SKBJ.js +0 -2
  47. package/dist/chunk-HFX3K3RG.cjs +0 -2
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunk4S3B2JQYcjs = require('./chunk-4S3B2JQY.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react');var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=_chunk4S3B2JQYcjs.E.call(void 0, e.inputChain),r=_chunk4S3B2JQYcjs.E.call(void 0, e.outputChain),u=o?_nullishCoalesce(s(o,e.inputToken), () => (null)):null,c=r?_nullishCoalesce(s(r,e.outputToken), () => (null)):null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=_chunk4S3B2JQYcjs.B.call(void 0, ),[r,u]=_react.useState.call(void 0, []),[c,f]=_react.useState.call(void 0, !1),[p,h]=_react.useState.call(void 0, null),[d,m]=_react.useState.call(void 0, b),n=_react.useRef.call(void 0, null),i=_react.useCallback.call(void 0, async()=>{if(!e)return;_optionalChain([n, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.abort, 'call', _4 => _4()]);let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=_optionalChain([L, 'optionalAccess', _5 => _5.ok])?await L.json():null,$=_optionalChain([I, 'optionalAccess', _6 => _6.ok])?await I.json():null,H=new Set,C=[];for(let x of[..._nullishCoalesce(_optionalChain([_, 'optionalAccess', _7 => _7.orders]), () => ([])),..._nullishCoalesce(_optionalChain([$, 'optionalAccess', _8 => _8.orders]), () => ([]))])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(_optionalChain([y, 'optionalAccess', _9 => _9.name])==="AbortError")return;h(_nullishCoalesce(_optionalChain([y, 'optionalAccess', _10 => _10.message]), () => ("Failed to load order history")))}finally{g.signal.aborted||f(!1)}},[e]);_react.useEffect.call(void 0, ()=>{if(!s||!e){u([]),m(b);return}return i(),()=>_optionalChain([n, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.abort, 'call', _13 => _13()])},[s,e,i]);let v=d<r.length,q=_react.useCallback.call(void 0, async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:_react.useMemo.call(void 0, ()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}var _jsxruntime = require('react/jsx-runtime');var J=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:_jsxruntime.jsx.call(void 0, J,{}),color:"var(--widget-primary)"};case"received":return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:_jsxruntime.jsx.call(void 0, Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:_jsxruntime.jsx.call(void 0, ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _14 => _14.decimals]), () => (18));return _chunk4S3B2JQYcjs.o.call(void 0, o/10**r)}catch (e2){return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=_react.useState.call(void 0, !1),c=_optionalChain([e, 'optionalAccess', _15 => _15.status])||_optionalChain([e, 'optionalAccess', _16 => _16.eventType])||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(_optionalChain([e, 'optionalAccess', _17 => _17.timestamp])||_optionalChain([e, 'optionalAccess', _18 => _18.createdAt])||""),m=s?{asset:s,symbol:s.symbol,amount:k(_optionalChain([e, 'optionalAccess', _19 => _19.inputAmount]),s)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _20 => _20.inputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _21 => _21.inputAmount]),null)},n=o?{asset:o,symbol:o.symbol,amount:k(_optionalChain([e, 'optionalAccess', _22 => _22.outputAmount]),o)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _23 => _23.outputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _24 => _24.outputAmount]),null)};return _jsxruntime.jsxs.call(void 0, "a",{href:_optionalChain([e, 'optionalAccess', _25 => _25.explorerUrl])||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between space-x-1",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"-translate-y-px",style:{color:p},children:f}),_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunk4S3B2JQYcjs.p.call(void 0, _optionalChain([e, 'optionalAccess', _26 => _26.quoteId])||_optionalChain([e, 'optionalAccess', _27 => _27.orderHash])||"")]}),_jsxruntime.jsx.call(void 0, "svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col w-full h-full p-2",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:m.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),_jsxruntime.jsx.call(void 0, "span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:n.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};var j=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2 p-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be= exports.a =({isActive:e})=>{let{address:s}=_chunk34N36GUDcjs.a.call(void 0, ),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=_react.useState.call(void 0, !1),d=_react.useRef.call(void 0, null),m=_react.useCallback.call(void 0, async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):_jsxruntime.jsx.call(void 0, "div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>_jsxruntime.jsx.call(void 0, j,{},i)):o.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[o.map(n=>_jsxruntime.jsx.call(void 0, B,{order:n,baseToken:_nullishCoalesce(_optionalChain([n, 'access', _28 => _28.enrichedTokens, 'optionalAccess', _29 => _29.base]), () => (null)),quoteToken:_nullishCoalesce(_optionalChain([n, 'access', _30 => _30.enrichedTokens, 'optionalAccess', _31 => _31.quote]), () => (null))},n.orderHash)),p&&_jsxruntime.jsx.call(void 0, j,{})]})}):_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};exports.a = be;
2
+ var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react');var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=_chunkNVCIA743cjs.E.call(void 0, e.inputChain),r=_chunkNVCIA743cjs.E.call(void 0, e.outputChain),u=o?_nullishCoalesce(s(o,e.inputToken), () => (null)):null,c=r?_nullishCoalesce(s(r,e.outputToken), () => (null)):null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=_chunkNVCIA743cjs.B.call(void 0, ),[r,u]=_react.useState.call(void 0, []),[c,f]=_react.useState.call(void 0, !1),[p,h]=_react.useState.call(void 0, null),[d,m]=_react.useState.call(void 0, b),n=_react.useRef.call(void 0, null),i=_react.useCallback.call(void 0, async()=>{if(!e)return;_optionalChain([n, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.abort, 'call', _4 => _4()]);let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=_optionalChain([L, 'optionalAccess', _5 => _5.ok])?await L.json():null,$=_optionalChain([I, 'optionalAccess', _6 => _6.ok])?await I.json():null,H=new Set,C=[];for(let x of[..._nullishCoalesce(_optionalChain([_, 'optionalAccess', _7 => _7.orders]), () => ([])),..._nullishCoalesce(_optionalChain([$, 'optionalAccess', _8 => _8.orders]), () => ([]))])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(_optionalChain([y, 'optionalAccess', _9 => _9.name])==="AbortError")return;h(_nullishCoalesce(_optionalChain([y, 'optionalAccess', _10 => _10.message]), () => ("Failed to load order history")))}finally{g.signal.aborted||f(!1)}},[e]);_react.useEffect.call(void 0, ()=>{if(!s||!e){u([]),m(b);return}return i(),()=>_optionalChain([n, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.abort, 'call', _13 => _13()])},[s,e,i]);let v=d<r.length,q=_react.useCallback.call(void 0, async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:_react.useMemo.call(void 0, ()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}var _jsxruntime = require('react/jsx-runtime');var J=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>_jsxruntime.jsxs.call(void 0, "svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:_jsxruntime.jsx.call(void 0, J,{}),color:"var(--widget-primary)"};case"received":return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:_jsxruntime.jsx.call(void 0, Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:_jsxruntime.jsx.call(void 0, ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:_jsxruntime.jsx.call(void 0, F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _14 => _14.decimals]), () => (18));return _chunkNVCIA743cjs.o.call(void 0, o/10**r)}catch (e2){return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=_react.useState.call(void 0, !1),c=_optionalChain([e, 'optionalAccess', _15 => _15.status])||_optionalChain([e, 'optionalAccess', _16 => _16.eventType])||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(_optionalChain([e, 'optionalAccess', _17 => _17.timestamp])||_optionalChain([e, 'optionalAccess', _18 => _18.createdAt])||""),m=s?{asset:s,symbol:s.symbol,amount:k(_optionalChain([e, 'optionalAccess', _19 => _19.inputAmount]),s)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _20 => _20.inputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _21 => _21.inputAmount]),null)},n=o?{asset:o,symbol:o.symbol,amount:k(_optionalChain([e, 'optionalAccess', _22 => _22.outputAmount]),o)}:{asset:null,symbol:(_optionalChain([e, 'optionalAccess', _23 => _23.outputToken])||"").slice(0,6)+"...",amount:k(_optionalChain([e, 'optionalAccess', _24 => _24.outputAmount]),null)};return _jsxruntime.jsxs.call(void 0, "a",{href:_optionalChain([e, 'optionalAccess', _25 => _25.explorerUrl])||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between space-x-1",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"-translate-y-px",style:{color:p},children:f}),_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center space-x-2",children:[_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunkNVCIA743cjs.p.call(void 0, _optionalChain([e, 'optionalAccess', _26 => _26.quoteId])||_optionalChain([e, 'optionalAccess', _27 => _27.orderHash])||"")]}),_jsxruntime.jsx.call(void 0, "svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col w-full h-full p-2",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:m.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),_jsxruntime.jsx.call(void 0, "span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:n.asset,size:"xs",className:"h-3 w-3"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};var j=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-2 p-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-8 w-full items-center justify-between px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be= exports.a =({isActive:e})=>{let{address:s}=_chunk34N36GUDcjs.a.call(void 0, ),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=_react.useState.call(void 0, !1),d=_react.useRef.call(void 0, null),m=_react.useCallback.call(void 0, async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):_jsxruntime.jsx.call(void 0, "div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>_jsxruntime.jsx.call(void 0, j,{},i)):o.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[o.map(n=>_jsxruntime.jsx.call(void 0, B,{order:n,baseToken:_nullishCoalesce(_optionalChain([n, 'access', _28 => _28.enrichedTokens, 'optionalAccess', _29 => _29.base]), () => (null)),quoteToken:_nullishCoalesce(_optionalChain([n, 'access', _30 => _30.enrichedTokens, 'optionalAccess', _31 => _31.quote]), () => (null))},n.orderHash)),p&&_jsxruntime.jsx.call(void 0, j,{})]})}):_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};exports.a = be;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{d as C}from"./chunk-XCPMBMS7.js";import{A as Q,L as U,c as w,z as x}from"./chunk-NNNQNB5T.js";import{a as W}from"./chunk-46H44R7V.js";import{create as ee}from"zustand";import{useCallback as D,useEffect as te,useRef as oe}from"react";var F=ee()(c=>({baseToken:null,quoteToken:null,setBaseTokenDirect:i=>c({baseToken:i}),setQuoteTokenDirect:i=>c({quoteToken:i}),swapTokensDirect:()=>c(i=>({baseToken:i.quoteToken,quoteToken:i.baseToken}))}));function G(c){let{data:i,isLoading:m}=x(),o=F(),f=oe(!1),e=c?.defaultBaseToken??null,r=c?.defaultQuoteToken??null;te(()=>{if(!i||i.length===0||f.current)return;f.current=!0;let u=T=>i.find(p=>p.chainId===T.chainId&&p.address.toLowerCase()===T.address.toLowerCase())??null,a=e?u(e):null,l=r?u(r):null;a&&l&&a.chainId===l.chainId&&a.address.toLowerCase()===l.address.toLowerCase()?(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(l))},[i,e,r,o]);let A=D(u=>{if(!u){o.setBaseTokenDirect(null);return}let a=F.getState();a.quoteToken&&u.chainId===a.quoteToken.chainId&&u.address.toLowerCase()===a.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),S=D(u=>{if(!u){o.setQuoteTokenDirect(null);return}let a=F.getState();a.baseToken&&u.chainId===a.baseToken.chainId&&u.address.toLowerCase()===a.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),h=D(()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:m}}import{useCallback as k,useMemo as d}from"react";import{parseUnits as E}from"viem";import{useShallow as ne}from"zustand/react/shallow";var M=(c,i,m,o)=>{let{address:f}=W(),{baseToken:e,quoteToken:r,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:u}=G({defaultBaseToken:c,defaultQuoteToken:i}),{baseAmount:a,quoteAmount:l,setBaseAmount:T,setQuoteAmount:p,clearAmounts:v}=C(ne(t=>({baseAmount:t.baseAmount,quoteAmount:t.quoteAmount,setBaseAmount:t.setBaseAmount,setQuoteAmount:t.setQuoteAmount,clearAmounts:t.clearAmounts}))),{data:y}=Q(e?.address,e?.chainId),{data:P}=Q(r?.address,r?.chainId),n=d(()=>{if(!e)return null;let t=y?.price??e.price;return t===e.price?e:{...e,price:t}},[e,y?.price]),s=d(()=>{if(!r)return null;let t=P?.price??r.price;return t===r.price?r:{...r,price:t}},[r,P?.price]),{baseBalance:B,quoteBalance:b,isLoading:R}=U(f,n,s),g=d(()=>!B||B.raw==="0"?null:B,[B]),I=d(()=>!b||b.raw==="0"?null:b,[b]),q=d(()=>{if(!n?.chainId)return!1;let t=w(n.chainId);return n.address.toLowerCase()===t?.gasToken.address?.toLowerCase()},[n]),L=d(()=>{if(!s?.chainId)return!1;let t=w(s.chainId);return s.address.toLowerCase()===t?.gasToken.address?.toLowerCase()},[s]),O=d(()=>{if(!q||!n?.chainId||!s||n.chainId!==s.chainId||n.chainId===988)return!1;let t=w(n.chainId);return s.address.toLowerCase()===t?.wrappedAsset.address?.toLowerCase()},[q,n,s]),z=d(()=>{if(!n?.chainId||!s||!L||n.chainId!==s.chainId||n.chainId===988)return!1;let t=w(n.chainId);return n.address.toLowerCase()===t?.wrappedAsset.address?.toLowerCase()},[n,s,L]),H=d(()=>({raw:g?.raw??"0",formatted:g?.formatted??"0"}),[g]),J=d(()=>({raw:I?.raw??"0",formatted:I?.formatted??"0"}),[I]),K=d(()=>!n||typeof a!="number"||n.decimals===void 0||n.decimals===null?null:E(a.toFixed(n.decimals),n.decimals).toString(),[n,a]),V=d(()=>!s||typeof l!="number"||s.decimals===void 0||s.decimals===null?null:E(l.toFixed(s.decimals),s.decimals).toString(),[s,l]),X=k(async t=>{A(t),p(null),m?.(t)},[A,p,m]),Y=k(async t=>{S(t),o?.(t)},[S,o]),Z=k(t=>T(t),[T]),_=k(t=>p(t),[p]),$=k(()=>{h(),C.getState().toggleInverted(),r&&m?.(r),e&&o?.(e)},[h,e,r,m,o]),j=k(()=>v(),[v]);return{baseToken:n,baseAmount:a,quoteToken:s,quoteAmount:l,isBaseGasToken:q,isQuoteGasToken:L,isWrappingPair:O,isUnwrappingPair:z,baseBalance:H,quoteBalance:J,baseAmountRaw:K,quoteAmountRaw:V,isBaseBalanceLoading:R,isQuoteBalanceLoading:R,isRegistryLoading:u,setBaseToken:X,setQuoteToken:Y,setBaseAmount:Z,setQuoteAmount:_,swapTokens:$,clearForm:j}};import{createContext as se,useContext as ae,useMemo as re}from"react";import{jsx as ie}from"react/jsx-runtime";var N=se(null),Ie=({children:c,defaultBaseToken:i,defaultQuoteToken:m,onBaseTokenChange:o,onQuoteTokenChange:f})=>{let e=M(i,m,o,f),r=re(()=>e,[e.baseToken,e.quoteToken,e.baseAmount,e.quoteAmount,e.isBaseGasToken,e.isQuoteGasToken,e.isWrappingPair,e.isUnwrappingPair,e.baseBalance,e.quoteBalance,e.baseAmountRaw,e.quoteAmountRaw,e.isBaseBalanceLoading,e.isQuoteBalanceLoading,e.setBaseToken,e.setQuoteToken,e.setBaseAmount,e.setQuoteAmount,e.swapTokens,e.clearForm,e.isRegistryLoading]);return ie(N.Provider,{value:r,children:c})},qe=()=>{let c=ae(N);if(!c)throw new Error("useSwapFormContext must be used within SwapFormProvider");return c};export{F as a,G as b,M as c,Ie as d,qe as e};
2
+ import{d as C}from"./chunk-GGP6UREO.js";import{A as Q,L as U,c as w,z as x}from"./chunk-SJMURCHX.js";import{a as W}from"./chunk-46H44R7V.js";import{create as ee}from"zustand";import{useCallback as D,useEffect as te,useRef as oe}from"react";var F=ee()(c=>({baseToken:null,quoteToken:null,setBaseTokenDirect:i=>c({baseToken:i}),setQuoteTokenDirect:i=>c({quoteToken:i}),swapTokensDirect:()=>c(i=>({baseToken:i.quoteToken,quoteToken:i.baseToken}))}));function G(c){let{data:i,isLoading:m}=x(),o=F(),f=oe(!1),e=c?.defaultBaseToken??null,r=c?.defaultQuoteToken??null;te(()=>{if(!i||i.length===0||f.current)return;f.current=!0;let u=T=>i.find(p=>p.chainId===T.chainId&&p.address.toLowerCase()===T.address.toLowerCase())??null,a=e?u(e):null,l=r?u(r):null;a&&l&&a.chainId===l.chainId&&a.address.toLowerCase()===l.address.toLowerCase()?(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(a),o.setQuoteTokenDirect(l))},[i,e,r,o]);let A=D(u=>{if(!u){o.setBaseTokenDirect(null);return}let a=F.getState();a.quoteToken&&u.chainId===a.quoteToken.chainId&&u.address.toLowerCase()===a.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),S=D(u=>{if(!u){o.setQuoteTokenDirect(null);return}let a=F.getState();a.baseToken&&u.chainId===a.baseToken.chainId&&u.address.toLowerCase()===a.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),h=D(()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:m}}import{useCallback as k,useMemo as d}from"react";import{parseUnits as E}from"viem";import{useShallow as ne}from"zustand/react/shallow";var M=(c,i,m,o)=>{let{address:f}=W(),{baseToken:e,quoteToken:r,setBaseToken:A,setQuoteToken:S,swapTokens:h,isLoading:u}=G({defaultBaseToken:c,defaultQuoteToken:i}),{baseAmount:a,quoteAmount:l,setBaseAmount:T,setQuoteAmount:p,clearAmounts:v}=C(ne(t=>({baseAmount:t.baseAmount,quoteAmount:t.quoteAmount,setBaseAmount:t.setBaseAmount,setQuoteAmount:t.setQuoteAmount,clearAmounts:t.clearAmounts}))),{data:y}=Q(e?.address,e?.chainId),{data:P}=Q(r?.address,r?.chainId),n=d(()=>{if(!e)return null;let t=y?.price??e.price;return t===e.price?e:{...e,price:t}},[e,y?.price]),s=d(()=>{if(!r)return null;let t=P?.price??r.price;return t===r.price?r:{...r,price:t}},[r,P?.price]),{baseBalance:B,quoteBalance:b,isLoading:R}=U(f,n,s),g=d(()=>!B||B.raw==="0"?null:B,[B]),I=d(()=>!b||b.raw==="0"?null:b,[b]),q=d(()=>{if(!n?.chainId)return!1;let t=w(n.chainId);return n.address.toLowerCase()===t?.gasToken.address?.toLowerCase()},[n]),L=d(()=>{if(!s?.chainId)return!1;let t=w(s.chainId);return s.address.toLowerCase()===t?.gasToken.address?.toLowerCase()},[s]),O=d(()=>{if(!q||!n?.chainId||!s||n.chainId!==s.chainId||n.chainId===988)return!1;let t=w(n.chainId);return s.address.toLowerCase()===t?.wrappedAsset.address?.toLowerCase()},[q,n,s]),z=d(()=>{if(!n?.chainId||!s||!L||n.chainId!==s.chainId||n.chainId===988)return!1;let t=w(n.chainId);return n.address.toLowerCase()===t?.wrappedAsset.address?.toLowerCase()},[n,s,L]),H=d(()=>({raw:g?.raw??"0",formatted:g?.formatted??"0"}),[g]),J=d(()=>({raw:I?.raw??"0",formatted:I?.formatted??"0"}),[I]),K=d(()=>!n||typeof a!="number"||n.decimals===void 0||n.decimals===null?null:E(a.toFixed(n.decimals),n.decimals).toString(),[n,a]),V=d(()=>!s||typeof l!="number"||s.decimals===void 0||s.decimals===null?null:E(l.toFixed(s.decimals),s.decimals).toString(),[s,l]),X=k(async t=>{A(t),p(null),m?.(t)},[A,p,m]),Y=k(async t=>{S(t),o?.(t)},[S,o]),Z=k(t=>T(t),[T]),_=k(t=>p(t),[p]),$=k(()=>{h(),C.getState().toggleInverted(),r&&m?.(r),e&&o?.(e)},[h,e,r,m,o]),j=k(()=>v(),[v]);return{baseToken:n,baseAmount:a,quoteToken:s,quoteAmount:l,isBaseGasToken:q,isQuoteGasToken:L,isWrappingPair:O,isUnwrappingPair:z,baseBalance:H,quoteBalance:J,baseAmountRaw:K,quoteAmountRaw:V,isBaseBalanceLoading:R,isQuoteBalanceLoading:R,isRegistryLoading:u,setBaseToken:X,setQuoteToken:Y,setBaseAmount:Z,setQuoteAmount:_,swapTokens:$,clearForm:j}};import{createContext as se,useContext as ae,useMemo as re}from"react";import{jsx as ie}from"react/jsx-runtime";var N=se(null),Ie=({children:c,defaultBaseToken:i,defaultQuoteToken:m,onBaseTokenChange:o,onQuoteTokenChange:f})=>{let e=M(i,m,o,f),r=re(()=>e,[e.baseToken,e.quoteToken,e.baseAmount,e.quoteAmount,e.isBaseGasToken,e.isQuoteGasToken,e.isWrappingPair,e.isUnwrappingPair,e.baseBalance,e.quoteBalance,e.baseAmountRaw,e.quoteAmountRaw,e.isBaseBalanceLoading,e.isQuoteBalanceLoading,e.setBaseToken,e.setQuoteToken,e.setBaseAmount,e.setQuoteAmount,e.swapTokens,e.clearForm,e.isRegistryLoading]);return ie(N.Provider,{value:r,children:c})},qe=()=>{let c=ae(N);if(!c)throw new Error("useSwapFormContext must be used within SwapFormProvider");return c};export{F as a,G as b,M as c,Ie as d,qe as e};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{b as s,d as r}from"./chunk-XCPMBMS7.js";import{useMemo as d}from"react";function C(){let{supportedInputTokens:t,supportedOutputTokens:i,supportedInputChains:n,supportedOutputChains:o,prioritizedInputTokens:p,prioritizedInputChains:u}=s(),e=r(f=>f.isInverted);return d(()=>({effectiveInputTokens:e?i:t,effectiveOutputTokens:e?t:i,effectiveInputChains:e?o:n,effectiveOutputChains:e?n:o,effectivePrioritizedInputTokens:e?[]:p,effectivePrioritizedInputChains:e?[]:u}),[e,t,i,n,o,p,u])}export{C as a};
2
+ import{b as s,d as r}from"./chunk-GGP6UREO.js";import{useMemo as d}from"react";function C(){let{supportedInputTokens:t,supportedOutputTokens:i,supportedInputChains:n,supportedOutputChains:o,prioritizedInputTokens:p,prioritizedInputChains:u}=s(),e=r(f=>f.isInverted);return d(()=>({effectiveInputTokens:e?i:t,effectiveOutputTokens:e?t:i,effectiveInputChains:e?o:n,effectiveOutputChains:e?n:o,effectivePrioritizedInputTokens:e?[]:p,effectivePrioritizedInputChains:e?[]:u}),[e,t,i,n,o,p,u])}export{C as a};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as ge}from"./chunk-PFQ7GSLH.js";import{e as he}from"./chunk-FWH744XA.js";import{b as ne,c as pe,d as b}from"./chunk-XCPMBMS7.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-NNNQNB5T.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};
2
+ import{a as ge}from"./chunk-BKAIYAE7.js";import{e as he}from"./chunk-7ZT3SGKA.js";import{b as ne,c as pe,d as b}from"./chunk-GGP6UREO.js";import{B as de,C as le,D as ce,K as ue,N as fe,O as D,e as oe,i as R,u as $,v as re,x as ie}from"./chunk-SJMURCHX.js";import{a as me}from"./chunk-46H44R7V.js";import F,{useCallback as we,useEffect as De,useMemo as A}from"react";import{useShallow as ze}from"zustand/react/shallow";import Re from"react";import{jsx as T,jsxs as z}from"react/jsx-runtime";var Q=Re.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=ce(i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?$(o,i.balance,i.decimals):null;return z("button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[z("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[T(D,{asset:o,size:"sm",className:"flex-shrink-0"}),z("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[T("span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),T("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),z("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[T("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),T("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&i.asset.assetInfo?.price===d.asset.assetInfo?.price&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";import{jsx as a,jsxs as c}from"react/jsx-runtime";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=me(),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=b(ze(e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=ie(h,300),I=pe(),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=ne(),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=ge(),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=he(),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=A(()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);De(()=>{W?b.getState().setAssetSelectionChain(x[0]):o&&b.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=F.useMemo(()=>{let s=x.length>0?new Set(x):null,r=oe(I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=le(m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=de(),Be=A(()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=A(()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=A(()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=F.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=A(()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=F.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=R(n),t=R(u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=ue(H,I,void 0,C.length>0?C:void 0),ae=F.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=we(e=>{let s=e.target.value.toLowerCase(),r=re(s),n=b.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=we(async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return c("div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&c("div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[a("button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),b.getState().setAssetSelectionChain("all")},onMouseEnter:()=>v?.("All Chains"),onMouseLeave:()=>v?.(null),children:"All"}),Ae.map((e,s)=>a("button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),b.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>v?.(e.name),onMouseLeave:()=>v?.(null),children:a("div",{className:"mb-px h-4 w-4",children:a(fe,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&a("button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&a("div",{className:"flex-shrink-0",children:c("div",{className:"relative mt-1",children:[a("input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&a("button",{type:"button",onClick:()=>b.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),c("div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>c("div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a("div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),c("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[a("div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),c("div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[a("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),a("div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&c("div",{children:[a("p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):R(e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?$(N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?$(w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:a(Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),a("p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?a("div",{className:"flex items-center justify-center p-8",children:a("span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?a("div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>c("div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[c("div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[a(D,{asset:e,size:"sm",className:"flex-shrink-0"}),c("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[a("span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),a("span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),c("div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[a("span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),c("span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[e.address?.slice(0,6),"...",e.address?.slice(-4)]})]})]},`${e.chainId}-${e.address}`))]})]})},ns=Fe;export{ns as a};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{G as s}from"./chunk-NNNQNB5T.js";import{createContext as p,useContext as c,useMemo as g}from"react";var h=p({apiKey:void 0,web3ConnectionType:"custom",enabledChains:[],supportedInputTokens:[],supportedOutputTokens:[],supportedInputChains:[],supportedOutputChains:[],prioritizedInputTokens:[],prioritizedInputChains:[],inputSelectionSearch:!0,outputSelectionSearch:!0,showInputSelectionTokenBalances:!0,showOutputSelectionTokenBalances:!0,lockBase:!1,lockQuote:!1,disableInverting:!1,defaultSlippage:.01,widgetType:"default",tokenDisplay:"default",tokenBadgeOrientation:"left",assetMenuVariant:"default",amountInputVariant:"default",hideAmountInputSymbol:!1,swapButtonVariant:"default",swapHeaderVariant:"default",quoteLoaderVariant:"default",walletButtonEnabled:!0,hasConnectHandler:!1,customWalletUI:"builtin"});function r(){let t=c(h);return g(()=>t.widgetType==="compact"?{...t,amountInputVariant:"normal"}:t,[t])}import{useMemo as S}from"react";function v(){let{availableChainIds:t}=s(),{enabledChains:e,supportedInputTokens:n,supportedOutputTokens:a}=r();return S(()=>{let i=t,u=n.length>0,d=a.length>0;if(u&&d){let l=new Set([...n.map(o=>o.chainId),...a.map(o=>o.chainId)]);i=i.filter(o=>l.has(o))}else e.length>0&&(i=i.filter(l=>e.includes(l)));return i},[t,e,n,a])}import{create as T}from"zustand";var A=T()(t=>({view:"swap",isTransitioning:!1,transitionType:"navigation",isInverted:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null,walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],toggleInverted:()=>t(e=>({isInverted:!e.isInverted})),setView:e=>t({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>t({walletTab:e}),setIsTransitioning:e=>t({isTransitioning:e}),transitionToView:(e,n="navigation")=>t({isTransitioning:!0,transitionType:n,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>t({selectedChainFilter:e}),setHoveredChainName:e=>t({hoveredChainName:e}),toggleRecipientInput:()=>t(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>t({recipient:e}),setHasAllowanceError:e=>t({hasAllowanceError:e}),setBaseAmount:e=>t({baseAmount:e}),setQuoteAmount:e=>t({quoteAmount:e}),clearAmounts:()=>t({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>t({isTrackingTx:e}),setTrackingOrderHash:e=>t({trackingOrderHash:e}),setTxStatus:e=>t({txStatus:e}),setExplorerUrl:e=>t({explorerUrl:e}),startTracking:e=>t({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending",explorerUrl:null}),stopTracking:()=>t({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null}),setExitHandler:e=>t({exitHandler:e}),setAssetSelectionSearch:e=>t({assetSelectionSearch:e}),setAssetSelectionChain:e=>t({assetSelectionChain:e}),setAssetSelectionCategory:e=>t({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>t({assetSelectionAddressInput:e}),pushRecentChain:e=>t(n=>{let a=n.recentChainIds.filter(i=>i!==e);return{recentChainIds:[e,...a].slice(0,3)}}),resetAssetSelection:()=>t({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>t({view:"swap",isTransitioning:!1,isInverted:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null,walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));export{h as a,r as b,v as c,A as d};
2
+ import{G as s}from"./chunk-SJMURCHX.js";import{createContext as p,useContext as c,useMemo as g}from"react";var h=p({apiKey:void 0,web3ConnectionType:"custom",enabledChains:[],supportedInputTokens:[],supportedOutputTokens:[],supportedInputChains:[],supportedOutputChains:[],prioritizedInputTokens:[],prioritizedInputChains:[],inputSelectionSearch:!0,outputSelectionSearch:!0,showInputSelectionTokenBalances:!0,showOutputSelectionTokenBalances:!0,lockBase:!1,lockQuote:!1,disableInverting:!1,defaultSlippage:.01,widgetType:"default",tokenDisplay:"default",tokenBadgeOrientation:"left",assetMenuVariant:"default",amountInputVariant:"default",hideAmountInputSymbol:!1,swapButtonVariant:"default",swapHeaderVariant:"default",quoteLoaderVariant:"default",walletButtonEnabled:!0,hasConnectHandler:!1,customWalletUI:"builtin"});function r(){let t=c(h);return g(()=>t.widgetType==="compact"?{...t,amountInputVariant:"normal"}:t,[t])}import{useMemo as S}from"react";function v(){let{availableChainIds:t}=s(),{enabledChains:e,supportedInputTokens:n,supportedOutputTokens:a}=r();return S(()=>{let i=t,u=n.length>0,d=a.length>0;if(u&&d){let l=new Set([...n.map(o=>o.chainId),...a.map(o=>o.chainId)]);i=i.filter(o=>l.has(o))}else e.length>0&&(i=i.filter(l=>e.includes(l)));return i},[t,e,n,a])}import{create as T}from"zustand";var A=T()(t=>({view:"swap",isTransitioning:!1,transitionType:"navigation",isInverted:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null,walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],toggleInverted:()=>t(e=>({isInverted:!e.isInverted})),setView:e=>t({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>t({walletTab:e}),setIsTransitioning:e=>t({isTransitioning:e}),transitionToView:(e,n="navigation")=>t({isTransitioning:!0,transitionType:n,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>t({selectedChainFilter:e}),setHoveredChainName:e=>t({hoveredChainName:e}),toggleRecipientInput:()=>t(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>t({recipient:e}),setHasAllowanceError:e=>t({hasAllowanceError:e}),setBaseAmount:e=>t({baseAmount:e}),setQuoteAmount:e=>t({quoteAmount:e}),clearAmounts:()=>t({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>t({isTrackingTx:e}),setTrackingOrderHash:e=>t({trackingOrderHash:e}),setTxStatus:e=>t({txStatus:e}),setExplorerUrl:e=>t({explorerUrl:e}),startTracking:e=>t({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending",explorerUrl:null}),stopTracking:()=>t({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null}),setExitHandler:e=>t({exitHandler:e}),setAssetSelectionSearch:e=>t({assetSelectionSearch:e}),setAssetSelectionChain:e=>t({assetSelectionChain:e}),setAssetSelectionCategory:e=>t({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>t({assetSelectionAddressInput:e}),pushRecentChain:e=>t(n=>{let a=n.recentChainIds.filter(i=>i!==e);return{recentChainIds:[e,...a].slice(0,3)}}),resetAssetSelection:()=>t({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>t({view:"swap",isTransitioning:!1,isInverted:!1,selectedChainFilter:null,hoveredChainName:null,isRecipientInputOpen:!1,recipient:null,hasAllowanceError:!1,baseAmount:null,quoteAmount:null,isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending",explorerUrl:null,exitHandler:null,walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));export{h as a,r as b,v as c,A as d};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{f as F}from"./chunk-GF37SKBJ.js";import{e as _}from"./chunk-FWH744XA.js";import{b as k}from"./chunk-XCPMBMS7.js";import{O as u,W as m,c as g}from"./chunk-NNNQNB5T.js";import Q,{useEffect as R,useState as A}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var q=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),V=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function j(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e9?`${(o/1e9).toFixed(2)}B`:r>=1e6?`${(o/1e6).toFixed(2)}M`:r>=1e4?`${(o/1e3).toFixed(2)}K`:r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):o.toFixed(6)}var E=Q.memo(()=>{let[o,r]=A(!1),{liquidityError:L,routingError:S}=F(),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:a}=_(),{quoteLoaderVariant:f,widgetType:T}=k(),p=T==="compact",l=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,x=l>0&&l<1,C=x?1/l:l,v=x?s:a,w=x?a:s,y=s?.price?`\u2248 $${(x?s.price:s.price*l).toFixed(2)}`:"",M=s&&a&&s.chainId!==a.chainId,h=s?g(s.chainId)?.estimatedTimeMs??0:0,$=a?g(a.chainId)?.estimatedTimeMs??0:0,N=(M?h+$:h)/1e3,b=L||S,d=s&&a&&n&&parseFloat(n.toString())&&i;return R(()=>{f==="expanded"&&d&&r(!0)},[f,d]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>d&&r(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d&&r(I=>!I))},children:e("div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&d?"120px":"0px",opacity:o&&d?1:0},children:t("div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",s?.price&&i?(s.price*l*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Estimated Time"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:N>0?`${N.toFixed(2)}s`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[e(V,{}),"Aori",e(q,{})]})]})]})})]})});E.displayName="QuoteLoader";var O=E;export{O as a};
2
+ import{f as F}from"./chunk-62ZNAMP7.js";import{e as _}from"./chunk-7ZT3SGKA.js";import{b as k}from"./chunk-GGP6UREO.js";import{O as u,W as m,c as g}from"./chunk-SJMURCHX.js";import Q,{useEffect as R,useState as A}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var q=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),V=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function j(o){if(o===0)return"0";let r=Math.abs(o);return r>=1e9?`${(o/1e9).toFixed(2)}B`:r>=1e6?`${(o/1e6).toFixed(2)}M`:r>=1e4?`${(o/1e3).toFixed(2)}K`:r>=1e3?o.toFixed(1):r>=100?o.toFixed(2):r>=1?o.toFixed(4):o.toFixed(6)}var E=Q.memo(()=>{let[o,r]=A(!1),{liquidityError:L,routingError:S}=F(),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:a}=_(),{quoteLoaderVariant:f,widgetType:T}=k(),p=T==="compact",l=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,x=l>0&&l<1,C=x?1/l:l,v=x?s:a,w=x?a:s,y=s?.price?`\u2248 $${(x?s.price:s.price*l).toFixed(2)}`:"",M=s&&a&&s.chainId!==a.chainId,h=s?g(s.chainId)?.estimatedTimeMs??0:0,$=a?g(a.chainId)?.estimatedTimeMs??0:0,N=(M?h+$:h)/1e3,b=L||S,d=s&&a&&n&&parseFloat(n.toString())&&i;return R(()=>{f==="expanded"&&d&&r(!0)},[f,d]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>d&&r(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),d&&r(I=>!I))},children:e("div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&a?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:v,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",v?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:w,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[j(C)," ",w?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:y})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):b?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&d?"120px":"0px",opacity:o&&d?1:0},children:t("div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",s?.price&&i?(s.price*l*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Estimated Time"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:N>0?`${N.toFixed(2)}s`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[e(V,{}),"Aori",e(q,{})]})]})]})})]})});E.displayName="QuoteLoader";var O=E;export{O as a};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
- var _chunkGIDTBDDCcjs = require('./chunk-GIDTBDDC.cjs');var _chunkGK3MOEYUcjs = require('./chunk-GK3MOEYU.cjs');var _chunk3PGCHNG2cjs = require('./chunk-3PGCHNG2.cjs');var _chunk4S3B2JQYcjs = require('./chunk-4S3B2JQY.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var Q=_react2.default.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=_chunk4S3B2JQYcjs.D.call(void 0, i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?_chunk4S3B2JQYcjs.u.call(void 0, o,i.balance,i.decimals):null;return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:o,size:"sm",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&_optionalChain([i, 'access', _2 => _2.asset, 'access', _3 => _3.assetInfo, 'optionalAccess', _4 => _4.price])===_optionalChain([d, 'access', _5 => _5.asset, 'access', _6 => _6.assetInfo, 'optionalAccess', _7 => _7.price])&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=_chunk3PGCHNG2cjs.d.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=_chunk4S3B2JQYcjs.x.call(void 0, h,300),I=_chunk3PGCHNG2cjs.c.call(void 0, ),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=_chunk3PGCHNG2cjs.b.call(void 0, ),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=_chunkGIDTBDDCcjs.a.call(void 0, ),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=_chunkGK3MOEYUcjs.e.call(void 0, ),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=_react.useMemo.call(void 0, ()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);_react.useEffect.call(void 0, ()=>{W?_chunk3PGCHNG2cjs.d.getState().setAssetSelectionChain(x[0]):o&&_chunk3PGCHNG2cjs.d.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=_react2.default.useMemo(()=>{let s=x.length>0?new Set(x):null,r=_chunk4S3B2JQYcjs.e.call(void 0, I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=_chunk4S3B2JQYcjs.C.call(void 0, m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=_chunk4S3B2JQYcjs.B.call(void 0, ),Be=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=_react.useMemo.call(void 0, ()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=_react.useMemo.call(void 0, ()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=_react2.default.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=_react.useMemo.call(void 0, ()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=_react2.default.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=_chunk4S3B2JQYcjs.i.call(void 0, n),t=_chunk4S3B2JQYcjs.i.call(void 0, u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=_chunk4S3B2JQYcjs.K.call(void 0, H,I,void 0,C.length>0?C:void 0),ae=_react2.default.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=_react.useCallback.call(void 0, e=>{let s=e.target.value.toLowerCase(),r=_chunk4S3B2JQYcjs.v.call(void 0, s),n=_chunk3PGCHNG2cjs.d.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=_react.useCallback.call(void 0, async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),_chunk3PGCHNG2cjs.d.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([v, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([v, 'optionalCall', _9 => _9(null)]),children:"All"}),Ae.map((e,s)=>_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),_chunk3PGCHNG2cjs.d.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([v, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([v, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.N,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-1",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunk3PGCHNG2cjs.d.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>_jsxruntime.jsxs.call(void 0, "div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunk4S3B2JQYcjs.i.call(void 0, e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?_chunk4S3B2JQYcjs.u.call(void 0, N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?_chunk4S3B2JQYcjs.u.call(void 0, w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:_jsxruntime.jsx.call(void 0, Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-8",children:_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>_jsxruntime.jsxs.call(void 0, "div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunk4S3B2JQYcjs.O,{asset:e,size:"sm",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[_optionalChain([e, 'access', _12 => _12.address, 'optionalAccess', _13 => _13.slice, 'call', _14 => _14(0,6)]),"...",_optionalChain([e, 'access', _15 => _15.address, 'optionalAccess', _16 => _16.slice, 'call', _17 => _17(-4)])]})]})]},`${e.chainId}-${e.address}`))]})]})},ns= exports.a =Fe;exports.a = ns;
2
+ var _chunk4DL25Q57cjs = require('./chunk-4DL25Q57.cjs');var _chunkTN27ALOVcjs = require('./chunk-TN27ALOV.cjs');var _chunkTTVEGOCZcjs = require('./chunk-TTVEGOCZ.cjs');var _chunkNVCIA743cjs = require('./chunk-NVCIA743.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var Q=_react2.default.memo(({asset:i,otherAsset:d,handleFormSelection:f,getToken:Y})=>{let{token:v}=_chunkNVCIA743cjs.D.call(void 0, i.chainId,i.address),L=Y(i.chainId,i.address),o=v||L||i.assetInfo;if(!o)return null;let h=o.price!=null&&i.decimals!==void 0?_chunkNVCIA743cjs.u.call(void 0, o,i.balance,i.decimals):null;return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(o,d),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:o,size:"sm",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin",style:{color:"var(--widget-secondary-foreground)"},children:o.symbol.length>20?`${o.symbol.substring(0,20)}...`:o.symbol}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:o.name.length>20?`${o.name.substring(0,20)}...`:o.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:"Balance:"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:h!=null?`$${h.toFixed(2)}`:"\u2014"})]})]},`${o.chainId}-${o.address}`)},(i,d)=>i.asset.address===d.asset.address&&i.asset.chainId===d.asset.chainId&&i.asset.balance===d.asset.balance&&_optionalChain([i, 'access', _2 => _2.asset, 'access', _3 => _3.assetInfo, 'optionalAccess', _4 => _4.price])===_optionalChain([d, 'access', _5 => _5.asset, 'access', _6 => _6.assetInfo, 'optionalAccess', _7 => _7.price])&&i.otherAsset.address===d.otherAsset.address);Q.displayName="AssetSelectionBalanceItem";var Fe=({toggle:i,side:d,otherAsset:f,containerHeight:Y,onChainHover:v,onMoreChainsClick:L,selectedChainFilter:o})=>{let{address:H}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:h,assetSelectionChain:m,assetSelectionCategory:U,recentChainIds:_}=_chunkTTVEGOCZcjs.d.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),E=_chunkNVCIA743cjs.x.call(void 0, h,300),I=_chunkTTVEGOCZcjs.c.call(void 0, ),{inputSelectionSearch:ye,outputSelectionSearch:be,showInputSelectionTokenBalances:ve,showOutputSelectionTokenBalances:xe}=_chunkTTVEGOCZcjs.b.call(void 0, ),{effectiveInputTokens:Ie,effectiveOutputTokens:Ce,effectiveInputChains:Se,effectiveOutputChains:ke,effectivePrioritizedInputTokens:Ne,effectivePrioritizedInputChains:$e}=_chunk4DL25Q57cjs.a.call(void 0, ),Te=d==="base"?ye:be,J=d==="base"?ve:xe,{setBaseToken:X,setQuoteToken:Z}=_chunkTN27ALOVcjs.e.call(void 0, ),C=d==="base"?Ie:Ce,x=d==="base"?Se:ke,P=d==="base"?Ne:[],B=d==="base"?$e:[],W=x.length===1,S=_react.useMemo.call(void 0, ()=>{if(C.length===0)return null;let e=new Set;for(let s of C)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[C]);_react.useEffect.call(void 0, ()=>{W?_chunkTTVEGOCZcjs.d.getState().setAssetSelectionChain(x[0]):o&&_chunkTTVEGOCZcjs.d.getState().setAssetSelectionChain(o)},[o,W,x]);let Ae=_react2.default.useMemo(()=>{let s=x.length>0?new Set(x):null,r=_chunkNVCIA743cjs.e.call(void 0, I).filter(t=>!s||s.has(t.id)).map(t=>({chainId:t.id,name:t.displayName})),n=new Map(r.map(t=>[t.chainId,t])),u=new Set(B),g=_.filter(t=>!u.has(t)&&n.has(t)),w=5-Math.min(g.length,5),l=[],p=new Set;for(let t of B){if(l.length>=w)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of g){if(l.length>=5)break;let y=n.get(t);y&&!p.has(t)&&(l.push(y),p.add(t))}for(let t of B){if(l.length>=5)break;if(p.has(t))continue;let y=n.get(t);y&&(l.push(y),p.add(t))}for(let t of r){if(l.length>=5)break;p.has(t.chainId)||l.push(t)}return l},[I,_,x,B]),{enrichedTokens:j,isLoading:Le}=_chunkNVCIA743cjs.C.call(void 0, m==="all"?"all":m),{tokenRegistry:ee,getToken:K}=_chunkNVCIA743cjs.B.call(void 0, ),Be=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let s of ee)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[ee]),q=_react.useMemo.call(void 0, ()=>S?j.filter(e=>S.has(`${e.chainId}-${e.address.toLowerCase()}`)):j,[j,S]),G=_react.useMemo.call(void 0, ()=>f?q.filter(e=>!(e.chainId===f.chainId&&e.address.toLowerCase()===f.address.toLowerCase())):q,[q,f]),V=_react2.default.useMemo(()=>{if(!E)return G;let e=E.toLowerCase();return G.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[G,E]),k=_react.useMemo.call(void 0, ()=>{let e=new Map;for(let s=0;s<P.length;s++){let r=P[s];e.set(`${r.chainId}-${r.address.toLowerCase()}`,s)}return e},[P]),se=_react2.default.useMemo(()=>{let e=m==="all"?(V||[]).filter(n=>I.includes(n.chainId)):V||[],s=new Set;return[...e.filter(n=>{let u=`${n.chainId}-${n.address.toLowerCase()}`;return s.has(u)?!1:(s.add(u),!0)})].sort((n,u)=>{let g=`${n.chainId}-${n.address.toLowerCase()}`,N=`${u.chainId}-${u.address.toLowerCase()}`,w=k.get(g),l=k.get(N);if(w!==void 0&&l!==void 0)return w-l;if(w!==void 0)return-1;if(l!==void 0)return 1;let p=_chunkNVCIA743cjs.i.call(void 0, n),t=_chunkNVCIA743cjs.i.call(void 0, u);return p&&!t?-1:!p&&t?1:0})},[V,m,I,k]),{balances:M,isLoading:te}=_chunkNVCIA743cjs.K.call(void 0, H,I,void 0,C.length>0?C:void 0),ae=_react2.default.useMemo(()=>{if(!M)return[];let e=m==="all"?M:M.filter(r=>r.chainId===m),s=new Set;return e.filter(r=>{let n=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(n)?!1:(s.add(n),!0)})},[M,m]),Me=_react.useCallback.call(void 0, e=>{let s=e.target.value.toLowerCase(),r=_chunkNVCIA743cjs.v.call(void 0, s),n=_chunkTTVEGOCZcjs.d.getState();r?(n.setAssetSelectionSearch(r),n.setAssetSelectionAddressInput(r)):(n.setAssetSelectionAddressInput(""),n.setAssetSelectionSearch(s))},[]),O=_react.useCallback.call(void 0, async e=>{d==="base"?await X(e):d==="quote"&&await Z(e),i()},[i,d,X,Z]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-1",children:[!W&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row justify-between py-1 flex-shrink-0 h-10",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row items-center w-full h-full px-2.5 whitespace-nowrap font-bold uppercase text-xs cursor-pointer text-center justify-center",style:{backgroundColor:m==="all"&&!o?"var(--widget-primary)":"var(--widget-secondary)",color:m==="all"&&!o?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"var(--widget-radius) 0 0 var(--widget-radius)"},onClick:e=>{e.stopPropagation(),_chunkTTVEGOCZcjs.d.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([v, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([v, 'optionalCall', _9 => _9(null)]),children:"All"}),Ae.map((e,s)=>_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:m===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:m===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:s===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),_chunkTTVEGOCZcjs.d.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([v, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([v, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.N,{chain:e.chainId,size:"xs"})})},e.chainId)),L&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex flex-row cursor-pointer items-center w-full h-full px-2.5 whitespace-nowrap uppercase font-bold text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)",borderRadius:"0 var(--widget-radius) var(--widget-radius) 0"},onClick:e=>{e.stopPropagation(),L()},children:"More"})]}),Te&&_jsxruntime.jsx.call(void 0, "div",{className:"flex-shrink-0",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative mt-1",children:[_jsxruntime.jsx.call(void 0, "input",{className:"w-full h-10 px-4 text-sm",style:{backgroundColor:"var(--widget-card)",color:"var(--widget-card-foreground)",border:"1px solid var(--widget-border)"},placeholder:"Search tokens by name, symbol, or address...",autoComplete:"off",value:h,onChange:Me}),h&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkTTVEGOCZcjs.d.getState().setAssetSelectionSearch(""),className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer rounded-full px-2 py-1 text-xs",style:{backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)",border:"1px solid var(--widget-border)"},children:"clear"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 min-h-0 overflow-auto mt-2",style:{backgroundColor:"var(--widget-background)"},children:[J&&te&&!h&&U==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),Array.from({length:3}).map((e,s)=>_jsxruntime.jsxs.call(void 0, "div",{className:"w-full flex items-center justify-between p-3",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8 flex-shrink-0 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"9999px"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-16 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-24 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.6,borderRadius:"0.25rem"}})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end gap-1.5 flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-10 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]})]},s))]}),J&&!te&&ae.length>0&&!h&&U==="all"&&_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"my-1 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:"Your Tokens"}),ae.filter(e=>!e.assetInfo||f&&e.assetInfo.chainId===f.chainId&&e.assetInfo.address.toLowerCase()===f.address.toLowerCase()?!1:S?S.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunkNVCIA743cjs.i.call(void 0, e.assetInfo)||Be.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=`${e.chainId}-${(e.address||"").toLowerCase()}`,n=`${s.chainId}-${(s.address||"").toLowerCase()}`,u=k.get(r),g=k.get(n);if(u!==void 0&&g!==void 0)return u-g;if(u!==void 0)return-1;if(g!==void 0)return 1;let N=K(e.chainId,e.address)||e.assetInfo,w=K(s.chainId,s.address)||s.assetInfo,l=N&&e.decimals!==void 0?_chunkNVCIA743cjs.u.call(void 0, N,e.balance,e.decimals):0;return(w&&s.decimals!==void 0?_chunkNVCIA743cjs.u.call(void 0, w,s.balance,s.decimals):0)-l}).map(e=>!e.assetInfo||!f?null:_jsxruntime.jsx.call(void 0, Q,{asset:e,otherAsset:f,handleFormSelection:O,getToken:K},`${e.assetInfo.chainId}-${e.assetInfo.address}`))]}),_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:h?"Search Results":"Supported Tokens"}),Le?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-8",children:_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Loading tokens..."})}):se.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Token Not Found"}):se.map(e=>_jsxruntime.jsxs.call(void 0, "div",{role:"button",tabIndex:0,className:"w-full flex items-center justify-between p-3 cursor-pointer",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>O(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),O(e))},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center space-x-3 min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, _chunkNVCIA743cjs.O,{asset:e,size:"sm",className:"flex-shrink-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start min-w-0 flex-1",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin truncate",style:{color:"var(--widget-secondary-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs truncate",style:{color:"var(--widget-muted-foreground)"},children:(e.name||"").length>20?`${e.name.substring(0,20)}...`:e.name||"\u2014"})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-end text-right flex-shrink-0",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:e.price?`$${e.price>=999999?`${(e.price/1e6).toFixed(2)}M`:e.price.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e.price<1?5:2})}`:"\u2014"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)",opacity:.5},children:[_optionalChain([e, 'access', _12 => _12.address, 'optionalAccess', _13 => _13.slice, 'call', _14 => _14(0,6)]),"...",_optionalChain([e, 'access', _15 => _15.address, 'optionalAccess', _16 => _16.slice, 'call', _17 => _17(-4)])]})]})]},`${e.chainId}-${e.address}`))]})]})},ns= exports.a =Fe;exports.a = ns;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{B as E,E as N,O as A,o as R,p as W}from"./chunk-NNNQNB5T.js";import{a as S}from"./chunk-46H44R7V.js";import{useCallback as se,useRef as oe,useState as ne}from"react";import{useCallback as M,useEffect as Q,useMemo as Z,useRef as z,useState as w}from"react";var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=N(e.inputChain),r=N(e.outputChain),u=o?s(o,e.inputToken)??null:null,c=r?s(r,e.outputToken)??null:null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=E(),[r,u]=w([]),[c,f]=w(!1),[p,h]=w(null),[d,m]=w(b),n=z(null),i=M(async()=>{if(!e)return;n.current?.abort();let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=L?.ok?await L.json():null,$=I?.ok?await I.json():null,H=new Set,C=[];for(let x of[..._?.orders??[],...$?.orders??[]])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(y?.name==="AbortError")return;h(y?.message??"Failed to load order history")}finally{g.signal.aborted||f(!1)}},[e]);Q(()=>{if(!s||!e){u([]),m(b);return}return i(),()=>n.current?.abort()},[s,e,i]);let v=d<r.length,q=M(async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:Z(()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}import{useState as X}from"react";import{jsx as t,jsxs as l}from"react/jsx-runtime";var J=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:t(J,{}),color:"var(--widget-primary)"};case"received":return{icon:t(F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:t(Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:t(ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:t(F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=s?.decimals??18;return R(o/10**r)}catch{return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=X(!1),c=e?.status||e?.eventType||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),m=s?{asset:s,symbol:s.symbol,amount:k(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:k(e?.inputAmount,null)},n=o?{asset:o,symbol:o.symbol,amount:k(e?.outputAmount,o)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:k(e?.outputAmount,null)};return l("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[l("div",{className:"flex flex-row items-center justify-between space-x-1",children:[l("div",{className:"flex flex-row items-center space-x-1",children:[t("div",{className:"-translate-y-px",style:{color:p},children:f}),t("p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),l("div",{className:"flex flex-row items-center space-x-2",children:[l("span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",W(e?.quoteId||e?.orderHash||"")]}),t("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:t("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),l("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[t("div",{className:"flex flex-col w-full h-full p-2",children:t("div",{className:"flex h-8 w-full items-center justify-between px-2",children:l("div",{className:"flex items-center space-x-1",children:[t(A,{asset:m.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),t("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),t(A,{asset:n.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),l("div",{className:"flex flex-col items-end text-right shrink-0",children:[t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};import{Fragment as ae,jsx as a,jsxs as T}from"react/jsx-runtime";var j=()=>T("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[T("div",{className:"flex items-center space-x-2 p-2",children:[a("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),a("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),T("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[a("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>a("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),a("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be=({isActive:e})=>{let{address:s}=S(),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=ne(!1),d=oe(null),m=se(async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):a("div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>a(j,{},i)):o.length===0?a("div",{className:"flex flex-col items-center justify-center h-full p-6",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):T(ae,{children:[o.map(n=>a(B,{order:n,baseToken:n.enrichedTokens?.base??null,quoteToken:n.enrichedTokens?.quote??null},n.orderHash)),p&&a(j,{})]})}):a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};export{be as a};
2
+ import{B as E,E as N,O as A,o as R,p as W}from"./chunk-SJMURCHX.js";import{a as S}from"./chunk-46H44R7V.js";import{useCallback as se,useRef as oe,useState as ne}from"react";import{useCallback as M,useEffect as Q,useMemo as Z,useRef as z,useState as w}from"react";var O="https://api.aori.io",b=50,G=100,D="0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",U="megaeth";function K(e,s){let o=N(e.inputChain),r=N(e.outputChain),u=o?s(o,e.inputToken)??null:null,c=r?s(r,e.outputToken)??null:null;return{orderHash:e.orderHash,quoteId:e.orderHash,status:e.status.toLowerCase(),eventType:e.status.toLowerCase(),inputToken:e.inputToken,inputAmount:e.inputAmount,inputChain:e.inputChain,outputToken:e.outputToken,outputAmount:e.outputAmount,outputChain:e.outputChain,timestamp:e.timestamp,createdAt:e.startTime,srcTx:e.srcTx,dstTx:e.dstTx,explorerUrl:`https://aoriscan.io/order/${e.orderHash}`,enrichedTokens:{base:u,quote:c}}}function P(e,s){let{getToken:o}=E(),[r,u]=w([]),[c,f]=w(!1),[p,h]=w(null),[d,m]=w(b),n=z(null),i=M(async()=>{if(!e)return;n.current?.abort();let g=new AbortController;n.current=g,f(!0),h(null);try{let y={offerer:e,limit:String(G),page:"0"},[L,I]=await Promise.all([fetch(`${O}/data/query?${new URLSearchParams({...y,inputChain:U,inputToken:D})}`,{signal:g.signal}),fetch(`${O}/data/query?${new URLSearchParams({...y,outputChain:U,outputToken:D})}`,{signal:g.signal})]),_=L?.ok?await L.json():null,$=I?.ok?await I.json():null,H=new Set,C=[];for(let x of[..._?.orders??[],...$?.orders??[]])H.has(x.orderHash)||(H.add(x.orderHash),C.push(x));C.sort((x,V)=>V.timestamp-x.timestamp),u(C),m(b)}catch(y){if(y?.name==="AbortError")return;h(y?.message??"Failed to load order history")}finally{g.signal.aborted||f(!1)}},[e]);Q(()=>{if(!s||!e){u([]),m(b);return}return i(),()=>n.current?.abort()},[s,e,i]);let v=d<r.length,q=M(async()=>{v&&m(g=>Math.min(g+b,r.length))},[v,r.length]);return{orders:Z(()=>r.slice(0,d).map(g=>K(g,o)),[r,d,o]),isLoading:c,error:p,hasMore:v,loadMore:q,totalOrders:r.length}}import{useState as X}from"react";import{jsx as t,jsxs as l}from"react/jsx-runtime";var J=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3 5.2L4.3 6.5L7 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M3.5 3.5L6.5 6.5M6.5 3.5L3.5 6.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),ee=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("path",{d:"M5 3V5.5L6.5 6.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),F=()=>l("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:[t("circle",{cx:"5",cy:"5",r:"4",stroke:"currentColor",strokeWidth:"1.2"}),t("circle",{cx:"5",cy:"5",r:"1.5",fill:"currentColor"})]}),te=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return{icon:t(J,{}),color:"var(--widget-primary)"};case"received":return{icon:t(F,{}),color:"var(--widget-accent)"};case"failed":case"error":case"expired":return{icon:t(Y,{}),color:"var(--widget-destructive)"};case"pending":case"created":case"placed":return{icon:t(ee,{}),color:"var(--widget-muted-foreground)"};default:return{icon:t(F,{}),color:"var(--widget-muted-foreground)"}}},re=e=>{switch((e||"").toLowerCase()){case"completed":case"settled":case"success":case"swapped":case"swap":return"color-mix(in srgb, var(--widget-primary) 5%, transparent)";case"failed":case"error":case"expired":return"color-mix(in srgb, var(--widget-destructive) 5%, transparent)";case"pending":case"created":case"placed":return"color-mix(in srgb, var(--widget-accent) 5%, transparent)";default:return"var(--widget-secondary)"}},k=(e,s)=>{try{let o=parseFloat(e||"0");if(isNaN(o)||o===0)return"0";let r=s?.decimals??18;return R(o/10**r)}catch{return"0"}},B=({order:e,baseToken:s,quoteToken:o})=>{let[r,u]=X(!1),c=e?.status||e?.eventType||"unknown",{icon:f,color:p}=te(c),d=(i=>{if(!i)return{date:"",time:""};let v=new Date(typeof i=="number"?i:Number(i)||i);return{date:v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),time:v.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC"}})(e?.timestamp||e?.createdAt||""),m=s?{asset:s,symbol:s.symbol,amount:k(e?.inputAmount,s)}:{asset:null,symbol:(e?.inputToken||"").slice(0,6)+"...",amount:k(e?.inputAmount,null)},n=o?{asset:o,symbol:o.symbol,amount:k(e?.outputAmount,o)}:{asset:null,symbol:(e?.outputToken||"").slice(0,6)+"...",amount:k(e?.outputAmount,null)};return l("a",{href:e?.explorerUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col cursor-pointer transition-all duration-200 ease-in-out no-underline",style:{border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:r?re(c):"transparent",marginBottom:"0.5rem",padding:"0.25rem"},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[l("div",{className:"flex flex-row items-center justify-between space-x-1",children:[l("div",{className:"flex flex-row items-center space-x-1",children:[t("div",{className:"-translate-y-px",style:{color:p},children:f}),t("p",{className:"text-2xs font-sans uppercase",style:{color:p},children:c})]}),l("div",{className:"flex flex-row items-center space-x-2",children:[l("span",{className:"text-2xs font-sans",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",W(e?.quoteId||e?.orderHash||"")]}),t("svg",{className:"w-2.5 -translate-y-px opacity-70 group-hover:rotate-[-45deg] group-hover:opacity-100 duration-200",style:{color:"var(--widget-foreground)"},viewBox:"0 0 684 684",fill:"none",children:t("path",{d:"M0.666687 384.667L519.92 384.667L281.627 622.96L342 683.333L683.333 342L342 0.666687L281.627 61.04L519.92 299.333L0.666687 299.333V384.667Z",fill:"currentColor"})})]})]}),l("div",{className:"flex flex-row items-center justify-between pr-2",style:{backgroundColor:r?"transparent":"var(--widget-secondary)"},children:[t("div",{className:"flex flex-col w-full h-full p-2",children:t("div",{className:"flex h-8 w-full items-center justify-between px-2",children:l("div",{className:"flex items-center space-x-1",children:[t(A,{asset:m.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:m.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:m.symbol})]}),t("span",{className:"px-1",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"}),t(A,{asset:n.asset,size:"xs",className:"h-3 w-3"}),l("div",{className:"flex flex-col",children:[t("span",{className:"text-sm h-4",style:{color:"var(--widget-muted-foreground)"},children:n.amount}),t("span",{className:"text-xs",style:{color:"var(--widget-foreground)"},children:n.symbol})]})]})})}),l("div",{className:"flex flex-col items-end text-right shrink-0",children:[t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&t("span",{className:"text-2xs font-sans whitespace-nowrap",style:{color:"var(--widget-muted-foreground)",opacity:.6},children:d.time})]})]})]})};import{Fragment as ae,jsx as a,jsxs as T}from"react/jsx-runtime";var j=()=>T("div",{className:"mt-2 flex flex-col",style:{height:"4rem",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"},children:[T("div",{className:"flex items-center space-x-2 p-2",children:[a("div",{className:"h-4 w-4 rounded",style:{backgroundColor:"var(--widget-muted)"}}),a("div",{className:"h-3 w-24 rounded",style:{backgroundColor:"var(--widget-muted)"}})]}),T("div",{className:"flex h-8 w-full items-center justify-between px-4",children:[a("div",{className:"flex items-center space-x-1",children:[4,16,10,4,16,10].map((e,s)=>a("div",{className:"h-3 rounded",style:{width:`${e*4}px`,backgroundColor:"var(--widget-muted)"}},s))}),a("div",{className:"h-3 w-10 rounded",style:{backgroundColor:"var(--widget-muted)"}})]})]}),be=({isActive:e})=>{let{address:s}=S(),{orders:o,isLoading:r,error:u,hasMore:c,loadMore:f}=P(s,e),[p,h]=ne(!1),d=oe(null),m=se(async n=>{let i=n.currentTarget;if(i.scrollTop+i.clientHeight>=i.scrollHeight-100&&!r&&!p&&c){h(!0);try{await f()}finally{h(!1)}}},[r,p,c,f]);return s?u?a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-destructive)"},children:"Error loading activity"})}):a("div",{ref:d,className:"flex flex-col flex-1 min-h-0 overflow-y-auto p-2",onScroll:m,style:{backgroundColor:"transparent"},children:r?Array.from({length:5}).map((n,i)=>a(j,{},i)):o.length===0?a("div",{className:"flex flex-col items-center justify-center h-full p-6",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No Activity"})}):T(ae,{children:[o.map(n=>a(B,{order:n,baseToken:n.enrichedTokens?.base??null,quoteToken:n.enrichedTokens?.quote??null},n.orderHash)),p&&a(j,{})]})}):a("div",{className:"flex items-center justify-center p-4",children:a("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view activity"})})};export{be as a};