@aori/mega-swap-widget 0.1.2 → 0.1.4

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 (59) hide show
  1. package/README.md +31 -0
  2. package/dist/AssetSelectionMenu-KOJBN3OR.js +2 -0
  3. package/dist/AssetSelectionMenu-M7HHUUWM.cjs +2 -0
  4. package/dist/ChainSelectionMenu-EJANKMWU.cjs +2 -0
  5. package/dist/ChainSelectionMenu-YCFDREZO.js +2 -0
  6. package/dist/SwapFormHorizontal-6YSJJM2S.cjs +2 -0
  7. package/dist/SwapFormHorizontal-E32W3PHA.js +2 -0
  8. package/dist/SwapFormSplit-6Y2B4VU3.cjs +2 -0
  9. package/dist/SwapFormSplit-M4YIQNAW.js +2 -0
  10. package/dist/WidgetWalletPanel-LKFDBFYR.cjs +2 -0
  11. package/dist/WidgetWalletPanel-T5L5224H.js +2 -0
  12. package/dist/WidgetWalletTradeHistory-PZLWJ2IK.js +2 -0
  13. package/dist/WidgetWalletTradeHistory-SDYMU4HL.cjs +2 -0
  14. package/dist/chunk-3RAZPKY5.js +2 -0
  15. package/dist/chunk-4CM44UII.cjs +2 -0
  16. package/dist/chunk-52HJQZWW.cjs +2 -0
  17. package/dist/chunk-5WTODHGO.cjs +2 -0
  18. package/dist/chunk-7QJJOVSV.js +2 -0
  19. package/dist/chunk-BJYKILHS.cjs +2 -0
  20. package/dist/chunk-EXGKQSDI.cjs +2 -0
  21. package/dist/chunk-GDIG4JLQ.cjs +2 -0
  22. package/dist/chunk-JVRQLJXZ.js +2 -0
  23. package/dist/chunk-SBQ3EQ2U.js +2 -0
  24. package/dist/chunk-SE6JOLEM.cjs +27 -0
  25. package/dist/chunk-TCAVGM6Y.cjs +2 -0
  26. package/dist/chunk-VI4ISTPB.js +2 -0
  27. package/dist/chunk-ZA7N764R.js +2 -0
  28. package/dist/chunk-ZFVYFTDI.js +2 -0
  29. package/dist/chunk-ZKDVXDQF.cjs +2 -0
  30. package/dist/chunk-ZWGBVGLP.js +2 -0
  31. package/dist/chunk-ZWNDO5OZ.js +27 -0
  32. package/dist/index.cjs +2 -2
  33. package/dist/index.css +1 -1
  34. package/dist/index.d.cts +3 -1
  35. package/dist/index.d.ts +3 -1
  36. package/dist/index.js +2 -2
  37. package/package.json +1 -1
  38. package/dist/AssetSelectionMenu-4E576X3D.cjs +0 -2
  39. package/dist/AssetSelectionMenu-ZFY7XFRX.js +0 -2
  40. package/dist/ChainSelectionMenu-SKXLHK3S.js +0 -2
  41. package/dist/ChainSelectionMenu-VU3SIBVL.cjs +0 -2
  42. package/dist/SwapFormHorizontal-GI4X7ISS.js +0 -2
  43. package/dist/SwapFormHorizontal-V557YBX2.cjs +0 -2
  44. package/dist/SwapFormSplit-52RBMJIO.js +0 -2
  45. package/dist/SwapFormSplit-PQCS3BPT.cjs +0 -2
  46. package/dist/WidgetWalletPanel-XYV3YL4I.js +0 -2
  47. package/dist/WidgetWalletPanel-YBMN5KZH.cjs +0 -2
  48. package/dist/chunk-4BQRVCQR.js +0 -2
  49. package/dist/chunk-4LJJMEOG.js +0 -2
  50. package/dist/chunk-726CI6GC.js +0 -2
  51. package/dist/chunk-DUIRZSBV.cjs +0 -2
  52. package/dist/chunk-EW2OR6CJ.js +0 -27
  53. package/dist/chunk-FDQKBTWP.js +0 -2
  54. package/dist/chunk-HTWUZKYO.cjs +0 -2
  55. package/dist/chunk-LXEKOQAG.cjs +0 -27
  56. package/dist/chunk-MCT3UZTP.cjs +0 -2
  57. package/dist/chunk-UZWGYG2S.cjs +0 -2
  58. package/dist/chunk-XYF2YBR3.js +0 -2
  59. package/dist/chunk-XZRXVBSB.cjs +0 -2
package/README.md CHANGED
@@ -341,6 +341,37 @@ See [`AoriSwapWidgetConfig`](./src/config/types.ts) for the full type. Only non-
341
341
  | `vtApiBaseUrl` | `string` | Base URL for the Aori transfer API. Use a relative path (e.g. `'/api/vt'`) to proxy through your server and keep the API key off the client. |
342
342
  | `rpcOverrides` | `Record<number, string \| string[]>` | Override RPCs for the widget's internal viem clients. Accepts direct URLs or relative paths to your own proxy routes. |
343
343
 
344
+ ### Invertible Token Lists
345
+
346
+ When `disableInverting` is `false` (or omitted), users can flip the swap direction using the invert button. When they do, `supportedInputTokens` and `supportedOutputTokens` swap sides — meaning token list A becomes the output whitelist and token list B becomes the input whitelist.
347
+
348
+ This enables **bidirectional bridge** configurations with a single config. For example, a USDM stablecoin bridge:
349
+
350
+ ```ts
351
+ tokens: {
352
+ supportedInputTokens: [
353
+ { chainId: 1, address: '0x...' }, // USDC Ethereum
354
+ { chainId: 8453, address: '0x...' }, // USDC Base
355
+ { chainId: 42161, address: '0x...' }, // USDC Arbitrum
356
+ // ... other stablecoins
357
+ ],
358
+ supportedOutputTokens: [
359
+ { chainId: 4326, address: '0x...' }, // USDM MegaETH
360
+ ],
361
+ supportedInputChains: [1, 8453, 42161],
362
+ supportedOutputChains: [4326],
363
+ disableInverting: false,
364
+ lockBase: false,
365
+ lockQuote: false,
366
+ }
367
+ ```
368
+
369
+ In the default direction, the user picks a stablecoin as input and receives USDM. After inverting, the lists flip — USDM becomes the only input option and the stablecoins become the output options.
370
+
371
+ **Dynamic locking:** When a side's effective token list contains exactly one token, that side's token selection is automatically disabled and the dropdown icon is hidden. No need to set `lockBase` or `lockQuote` — locking is inferred from the list length and updates dynamically on invert.
372
+
373
+ Set `disableInverting: true` to prevent flipping and keep the lists fixed to their configured sides.
374
+
344
375
  ## Display Patterns
345
376
 
346
377
  The widget is a standard React component — place it anywhere in your layout.
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-ZWGBVGLP.js";import"./chunk-SBQ3EQ2U.js";import"./chunk-7QJJOVSV.js";import"./chunk-VI4ISTPB.js";import"./chunk-ZWNDO5OZ.js";import"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";export{a as default};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunk5WTODHGOcjs = require('./chunk-5WTODHGO.cjs');require('./chunk-ZKDVXDQF.cjs');require('./chunk-BJYKILHS.cjs');require('./chunk-TCAVGM6Y.cjs');require('./chunk-SE6JOLEM.cjs');require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunk5WTODHGOcjs.a;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunk4CM44UIIcjs = require('./chunk-4CM44UII.cjs');require('./chunk-TCAVGM6Y.cjs');require('./chunk-SE6JOLEM.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunk4CM44UIIcjs.a;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-ZA7N764R.js";import"./chunk-VI4ISTPB.js";import"./chunk-ZWNDO5OZ.js";import"./chunk-73CB2I7U.js";export{a as default};
@@ -0,0 +1,2 @@
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
+ "use client";var _chunkEXGKQSDIcjs = require('./chunk-EXGKQSDI.cjs');var _chunkGDIG4JLQcjs = require('./chunk-GDIG4JLQ.cjs');var _chunk5WTODHGOcjs = require('./chunk-5WTODHGO.cjs');var _chunkZKDVXDQFcjs = require('./chunk-ZKDVXDQF.cjs');var _chunk4CM44UIIcjs = require('./chunk-4CM44UII.cjs');require('./chunk-KH57FLST.cjs');var _chunkBJYKILHScjs = require('./chunk-BJYKILHS.cjs');var _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');require('./chunk-SE6JOLEM.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var O=()=>{},Ve=({onSwapComplete:me,onSwapInitiated:ge,onBackToSwap:S,onMoreChainsClick:De})=>{let{web3ConnectionType:je,hasConnectHandler:fe,lockBase:T,lockQuote:q,disableInverting:we,swapButtonVariant:R,tokenDisplay:U,tokenBadgeOrientation:C,widgetType:he,assetMenuVariant:ve}=_chunkTCAVGM6Ycjs.b.call(void 0, ),{effectiveInputTokens:be,effectiveOutputTokens:xe}=_chunkZKDVXDQFcjs.a.call(void 0, ),h=be.length===1,v=xe.length===1,V=U==="pill"||U==="ghost",F=he==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:Se,isQuoteGasToken:Ce,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Ge,setBaseAmount:I,setQuoteAmount:c,swapTokens:D,clearForm:j}=_chunkBJYKILHScjs.f.call(void 0, ),{rfqQuote:ze,status:Ee,handleInputChange:M,ensureForParams:G,stop:Le,clear:y,refresh:z}=_chunkGDIG4JLQcjs.e.call(void 0, ),{address:m}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:ye}=_chunkGDIG4JLQcjs.g.call(void 0, ),{isRecipientInputOpen:W,txStatus:E,view:b,selectedChainFilterChainId:L}=_chunkBJYKILHScjs.c.call(void 0, _shallow.useShallow.call(void 0, n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([n, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[k,ke]=_react.useState.call(void 0, null),[A,_]=_react.useState.call(void 0, null),Ae=_react.useRef.call(void 0, !1),s=!1,Pe=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Oe=_react.useCallback.call(void 0, n=>{_(n),_chunkBJYKILHScjs.c.getState().startTracking(n)},[]),Ne=_react.useCallback.call(void 0, ()=>{Ae.current=!0,z()},[z]);_react.useEffect.call(void 0, ()=>{if(k===null&&!(!t||!o)){if(!i||i<=0){M({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}M({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[k,i,t,o,a,l,M,c]);let B=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().setView("baseSelection")},[]),$=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().setView("quoteSelection")},[]),Te=_react.useCallback.call(void 0, ()=>{D(),c(null)},[D,c]),qe=_react.useCallback.call(void 0, ()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let x=n*.9999999999;a||l?(I(x),c(x),y()):(I(x),c(null),G({inputToken:t,outputToken:o,inputAmount:x.toString(),setOutputAmount:P=>c(P)}))},[g.formatted,t,o,a,l,I,c,y,G]),Re=_react.useCallback.call(void 0, ()=>{y(),j()},[y,j]),J=g.formatted?parseFloat(g.formatted):null,Fe=!!(i||u),K=ve==="split",X=K&&(b==="baseSelection"||b==="baseChainSelection"),Y=K&&(b==="quoteSelection"||b==="quoteChainSelection"),Z=_react.useCallback.call(void 0, n=>{let P=_chunkBJYKILHScjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunkBJYKILHScjs.c.getState().setChainFilter({chainId:n,side:P}),_chunkBJYKILHScjs.c.getState().pushRecentChain(n),_chunkBJYKILHScjs.c.getState().transitionToView(P==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ie=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().transitionToView("baseChainSelection","chainSelection")},[]),Me=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),We=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Be=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",ee=k==="trackingTx"&&!!A&&!!t&&!!o&&!!i&&!!u,te={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[ee&&A&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.w,{orderHash:A,base:t,quote:o,baseAmount:i,quoteAmount:u,status:E})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${X?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:X?b==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunk4CM44UIIcjs.a,{toggle:_nullishCoalesce(S, () => (O)),side:"base",onChainSelect:Z}):_jsxruntime.jsx.call(void 0, _chunk5WTODHGOcjs.a,{toggle:_nullishCoalesce(S, () => (O)),side:"base",otherAsset:o,onMoreChainsClick:Ie,selectedChainFilter:L}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[V?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:We}),m&&J!==null&&J>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:qe,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center px-1",children:we?_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Te,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2194"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?b==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunk4CM44UIIcjs.a,{toggle:_nullishCoalesce(S, () => (O)),side:"quote",onChainSelect:Z}):_jsxruntime.jsx.call(void 0, _chunk5WTODHGOcjs.a,{toggle:_nullishCoalesce(S, () => (O)),side:"quote",otherAsset:t,onMoreChainsClick:Me,selectedChainFilter:L}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[V?F?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Be}),Fe&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Re,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.j,{})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunkEXGKQSDIcjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.v,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:Se,isQuoteGasToken:Ce,reviewActionProps:Pe,reviewState:k,setReviewState:ke,trackedOrderHash:A,setTrackedOrderHash:_,onSwapComplete:me,onSwapInitiated:ge,onOrderSubmitted:Oe,onStaleQuoteRestart:Ne,txStatus:E}):!m&&fe?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>ye(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:te,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:te,children:m?"Enter Amount":"Connect Wallet"})})]})},pt= exports.default =Ve;exports.default = pt;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a as le}from"./chunk-ZFVYFTDI.js";import{e as se,g as re,h as f,i as w,j as de,v as ue,w as ce}from"./chunk-JVRQLJXZ.js";import{a as Q}from"./chunk-ZWGBVGLP.js";import{a as ae}from"./chunk-SBQ3EQ2U.js";import{a as H}from"./chunk-ZA7N764R.js";import"./chunk-OPN7WCJR.js";import{c as d,f as ne}from"./chunk-7QJJOVSV.js";import{b as oe}from"./chunk-VI4ISTPB.js";import"./chunk-ZWNDO5OZ.js";import{a as ie}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as p,useEffect as $e,useMemo as Qe,useRef as He,useState as pe}from"react";import{useShallow as Ue}from"zustand/react/shallow";import{Fragment as N,jsx as e,jsxs as r}from"react/jsx-runtime";var O=()=>{},Ve=({onSwapComplete:me,onSwapInitiated:ge,onBackToSwap:S,onMoreChainsClick:De})=>{let{web3ConnectionType:je,hasConnectHandler:fe,lockBase:T,lockQuote:q,disableInverting:we,swapButtonVariant:R,tokenDisplay:U,tokenBadgeOrientation:C,widgetType:he,assetMenuVariant:ve}=oe(),{effectiveInputTokens:be,effectiveOutputTokens:xe}=ae(),h=be.length===1,v=xe.length===1,V=U==="pill"||U==="ghost",F=he==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:Se,isQuoteGasToken:Ce,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Ge,setBaseAmount:I,setQuoteAmount:c,swapTokens:D,clearForm:j}=ne(),{rfqQuote:ze,status:Ee,handleInputChange:M,ensureForParams:G,stop:Le,clear:y,refresh:z}=se(),{address:m}=ie(),{openConnectModal:ye}=re(),{isRecipientInputOpen:W,txStatus:E,view:b,selectedChainFilterChainId:L}=d(Ue(n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:n.selectedChainFilter?.chainId??null}))),[k,ke]=pe(null),[A,_]=pe(null),Ae=He(!1),s=!1,Pe=Qe(()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Oe=p(n=>{_(n),d.getState().startTracking(n)},[]),Ne=p(()=>{Ae.current=!0,z()},[z]);$e(()=>{if(k===null&&!(!t||!o)){if(!i||i<=0){M({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}M({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[k,i,t,o,a,l,M,c]);let B=p(()=>{d.getState().setView("baseSelection")},[]),$=p(()=>{d.getState().setView("quoteSelection")},[]),Te=p(()=>{D(),c(null)},[D,c]),qe=p(()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let x=n*.9999999999;a||l?(I(x),c(x),y()):(I(x),c(null),G({inputToken:t,outputToken:o,inputAmount:x.toString(),setOutputAmount:P=>c(P)}))},[g.formatted,t,o,a,l,I,c,y,G]),Re=p(()=>{y(),j()},[y,j]),J=g.formatted?parseFloat(g.formatted):null,Fe=!!(i||u),K=ve==="split",X=K&&(b==="baseSelection"||b==="baseChainSelection"),Y=K&&(b==="quoteSelection"||b==="quoteChainSelection"),Z=p(n=>{let P=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:n,side:P}),d.getState().pushRecentChain(n),d.getState().transitionToView(P==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ie=p(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Me=p(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),We=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Be=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",ee=k==="trackingTx"&&!!A&&!!t&&!!o&&!!i&&!!u,te={backgroundColor:R==="default"?"var(--widget-primary)":"transparent",color:R==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:R!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[ee&&A&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(ce,{orderHash:A,base:t,quote:o,baseAmount:i,quoteAmount:u,status:E})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${F?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${X?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:X?b==="baseChainSelection"?e(H,{toggle:S??O,side:"base",onChainSelect:Z}):e(Q,{toggle:S??O,side:"base",otherAsset:o,onMoreChainsClick:Ie,selectedChainFilter:L}):r(N,{children:[V?F?r("div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||T||h,hideDropdown:h}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:We}),m&&J!==null&&J>0&&e("button",{type:"button",onClick:qe,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),e("div",{className:"flex items-center justify-center px-1",children:we?e("div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:e("span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):e("button",{type:"button",onClick:Te,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer transition-colors bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground)",style:{border:"1px solid var(--widget-border)"},children:e("span",{className:"text-2xs",children:"\u2194"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?b==="quoteChainSelection"?e(H,{toggle:S??O,side:"quote",onChainSelect:Z}):e(Q,{toggle:S??O,side:"quote",otherAsset:t,onMoreChainsClick:Me,selectedChainFilter:L}):r(N,{children:[V?F?r("div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(N,{children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||q||v,hideDropdown:v}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:Be}),Fe&&e("button",{type:"button",onClick:Re,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(de,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(le,{})}),e("div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?e(ue,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:Se,isQuoteGasToken:Ce,reviewActionProps:Pe,reviewState:k,setReviewState:ke,trackedOrderHash:A,setTrackedOrderHash:_,onSwapComplete:me,onSwapInitiated:ge,onOrderSubmitted:Oe,onStaleQuoteRestart:Ne,txStatus:E}):!m&&fe?e("button",{onClick:()=>ye(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:te,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:te,children:m?"Enter Amount":"Connect Wallet"})})]})},pt=Ve;export{pt as default};
@@ -0,0 +1,2 @@
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
+ "use client";var _chunkGDIG4JLQcjs = require('./chunk-GDIG4JLQ.cjs');var _chunk5WTODHGOcjs = require('./chunk-5WTODHGO.cjs');var _chunkZKDVXDQFcjs = require('./chunk-ZKDVXDQF.cjs');var _chunk4CM44UIIcjs = require('./chunk-4CM44UII.cjs');require('./chunk-KH57FLST.cjs');var _chunkBJYKILHScjs = require('./chunk-BJYKILHS.cjs');var _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');var _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var ve=()=>{},Ze=({onSwapComplete:we,onSwapInitiated:he,onBackToSwap:E,onMoreChainsClick:et})=>{let{web3ConnectionType:tt,hasConnectHandler:be,lockBase:q,lockQuote:R,disableInverting:Se,swapButtonVariant:F,tokenDisplay:j,tokenBadgeOrientation:N,widgetType:ye,assetMenuVariant:Ce}=_chunkTCAVGM6Ycjs.b.call(void 0, ),{effectiveInputTokens:Ne,effectiveOutputTokens:ke}=_chunkZKDVXDQFcjs.a.call(void 0, ),S=Ne.length===1,y=ke.length===1,z=j==="pill"||j==="ghost",k=ye==="compact",{baseToken:d,quoteToken:c,baseAmount:i,quoteAmount:n,isBaseGasToken:Ae,isQuoteGasToken:Pe,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:I,setQuoteAmount:g,swapTokens:G,clearForm:L}=_chunkBJYKILHScjs.f.call(void 0, ),{handleInputChange:M,ensureForParams:_,clear:A,refresh:J,liquidityError:Te,routingError:Oe}=_chunkGDIG4JLQcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:qe}=_chunkGDIG4JLQcjs.g.call(void 0, ),{isRecipientInputOpen:$,txStatus:K,view:v,selectedChainFilterChainId:Re}=_chunkBJYKILHScjs.c.call(void 0, _shallow.useShallow.call(void 0, a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:_nullishCoalesce(a.selectedChainFilterChainId, () => (null))}))),[P,Fe]=_react.useState.call(void 0, null),[T,X]=_react.useState.call(void 0, null),Ie=_react.useRef.call(void 0, !1),r=!1,Me=_react.useMemo.call(void 0, ()=>!d||!c||typeof i!="number"||!n||!x||parseFloat(w.formatted)<i?null:{base:d,quote:c,baseAmount:i,quoteAmount:n,userAddress:x},[d,c,i,n,x,w.formatted]),$e=_react.useCallback.call(void 0, a=>{X(a),_chunkBJYKILHScjs.c.getState().startTracking(a)},[]),We=_react.useCallback.call(void 0, ()=>{Ie.current=!0,J()},[J]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!d||!c)){if(!i||i<=0){M({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(i);return}M({amount:i,inputToken:d,outputToken:c,setOutputAmount:g})}},[P,i,d,c,u,p,M,g]);let Y=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().setView("baseSelection")},[]),B=_react.useCallback.call(void 0, ()=>{_chunkBJYKILHScjs.c.getState().setView("quoteSelection")},[]),Be=_react.useCallback.call(void 0, ()=>{G(),g(null)},[G,g]),Qe=_react.useCallback.call(void 0, ()=>{if(!w.formatted||!d||!c)return;let a=parseFloat(w.formatted);if(!a||a<=0)return;let m=a*.9999999999;u||p?(I(m),g(m),A()):(I(m),g(null),_({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:C=>g(C)}))},[w.formatted,d,c,u,p,I,g,A,_]),De=_react.useCallback.call(void 0, ()=>{A(),L()},[A,L]),Z=w.formatted?parseFloat(w.formatted):null,Ue=!!(i||n),s=d,o=c,Ve=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",He=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Ee=!!(s&&o&&i&&n),je=Te||Oe,ee=P==="trackingTx"&&!!T&&!!s&&!!o&&!!i&&!!n,Q=Ce==="split",D=Q&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),U=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",ze=U==="base"?o:s,te=_react.useRef.call(void 0, null),[Ge,Le]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!Q)return;let a=te.current;if(!a)return;let m=new ResizeObserver(C=>{for(let Ke of C)Le(Ke.contentRect.height)});return m.observe(a),()=>m.disconnect()},[Q]);let _e=_react.useCallback.call(void 0, a=>{let C=_chunkBJYKILHScjs.c.getState().view==="baseChainSelection"?"base":"quote";_chunkBJYKILHScjs.c.getState().setChainFilter({chainId:a,side:C}),_chunkBJYKILHScjs.c.getState().pushRecentChain(a),_chunkBJYKILHScjs.c.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Je=_react.useCallback.call(void 0, ()=>{let a=_chunkBJYKILHScjs.c.getState().view;a==="baseSelection"?_chunkBJYKILHScjs.c.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&_chunkBJYKILHScjs.c.getState().transitionToView("quoteChainSelection","chainSelection")},[]),se={backgroundColor:F==="default"?"var(--widget-primary)":"transparent",color:F==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:F!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:te,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[ee&&T&&s&&o&&i&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.w,{orderHash:T,base:s,quote:o,baseAmount:i,quoteAmount:n,status:K})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${k?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?k?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ve}),x&&Z!==null&&Z>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Qe,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Se&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:Be,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${k?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?k?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:He}),Ue&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:De,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:$?"1px solid var(--widget-border)":"none",maxHeight:$?"60px":"0px",opacity:$?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.j,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:x&&s&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunkGDIG4JLQcjs.v,{base:s,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Ae,isQuoteGasToken:Pe,reviewActionProps:Me,reviewState:P,setReviewState:Fe,trackedOrderHash:T,setTrackedOrderHash:X,onSwapComplete:we,onSwapInitiated:he,onOrderSubmitted:$e,onStaleQuoteRestart:We,txStatus:K}):!x&&be?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>qe(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:se,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:se,children:x?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${D?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...D?{height:`${Ge}px`}:{}},children:D?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunk4CM44UIIcjs.a,{toggle:_nullishCoalesce(E, () => (ve)),side:U,onChainSelect:_e}):_jsxruntime.jsx.call(void 0, _chunk5WTODHGOcjs.a,{toggle:_nullishCoalesce(E, () => (ve)),side:U,otherAsset:ze,onMoreChainsClick:Je,selectedChainFilter:Re})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-3 px-4 py-4",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Ee&&s&&o?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-mono text-xs uppercase",children:["1 ",o.symbol]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Y.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-mono text-xs uppercase",children:s.symbol})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-mono text-xs",children:["$",s.price?(s.price*Y*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-mono",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-mono",children:"Cross-chain"})]})]})]}):je?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.V,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,m)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},bt= exports.default =Ze;exports.default = bt;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{e as ne,g as le,h,i as b,j as ce,v as ue,w as pe}from"./chunk-JVRQLJXZ.js";import{a as me}from"./chunk-ZWGBVGLP.js";import{a as de}from"./chunk-SBQ3EQ2U.js";import{a as ge}from"./chunk-ZA7N764R.js";import"./chunk-OPN7WCJR.js";import{c as l,f as re}from"./chunk-7QJJOVSV.js";import{b as oe}from"./chunk-VI4ISTPB.js";import{N as V,V as ie}from"./chunk-ZWNDO5OZ.js";import{a as ae}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as f,useEffect as fe,useMemo as Xe,useRef as xe,useState as H}from"react";import{useShallow as Ye}from"zustand/react/shallow";import{Fragment as O,jsx as e,jsxs as t}from"react/jsx-runtime";var ve=()=>{},Ze=({onSwapComplete:we,onSwapInitiated:he,onBackToSwap:E,onMoreChainsClick:et})=>{let{web3ConnectionType:tt,hasConnectHandler:be,lockBase:q,lockQuote:R,disableInverting:Se,swapButtonVariant:F,tokenDisplay:j,tokenBadgeOrientation:N,widgetType:ye,assetMenuVariant:Ce}=oe(),{effectiveInputTokens:Ne,effectiveOutputTokens:ke}=de(),S=Ne.length===1,y=ke.length===1,z=j==="pill"||j==="ghost",k=ye==="compact",{baseToken:d,quoteToken:c,baseAmount:i,quoteAmount:n,isBaseGasToken:Ae,isQuoteGasToken:Pe,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:I,setQuoteAmount:g,swapTokens:G,clearForm:L}=re(),{handleInputChange:M,ensureForParams:_,clear:A,refresh:J,liquidityError:Te,routingError:Oe}=ne(),{address:x}=ae(),{openConnectModal:qe}=le(),{isRecipientInputOpen:$,txStatus:K,view:v,selectedChainFilterChainId:Re}=l(Ye(a=>({isRecipientInputOpen:a.isRecipientInputOpen,txStatus:a.txStatus,view:a.view,selectedChainFilterChainId:a.selectedChainFilterChainId??null}))),[P,Fe]=H(null),[T,X]=H(null),Ie=xe(!1),r=!1,Me=Xe(()=>!d||!c||typeof i!="number"||!n||!x||parseFloat(w.formatted)<i?null:{base:d,quote:c,baseAmount:i,quoteAmount:n,userAddress:x},[d,c,i,n,x,w.formatted]),$e=f(a=>{X(a),l.getState().startTracking(a)},[]),We=f(()=>{Ie.current=!0,J()},[J]);fe(()=>{if(P===null&&!(!d||!c)){if(!i||i<=0){M({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(i);return}M({amount:i,inputToken:d,outputToken:c,setOutputAmount:g})}},[P,i,d,c,u,p,M,g]);let Y=i&&n&&parseFloat(n.toString())?parseFloat(i.toString())/parseFloat(n.toString()):0,W=f(()=>{l.getState().setView("baseSelection")},[]),B=f(()=>{l.getState().setView("quoteSelection")},[]),Be=f(()=>{G(),g(null)},[G,g]),Qe=f(()=>{if(!w.formatted||!d||!c)return;let a=parseFloat(w.formatted);if(!a||a<=0)return;let m=a*.9999999999;u||p?(I(m),g(m),A()):(I(m),g(null),_({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:C=>g(C)}))},[w.formatted,d,c,u,p,I,g,A,_]),De=f(()=>{A(),L()},[A,L]),Z=w.formatted?parseFloat(w.formatted):null,Ue=!!(i||n),s=d,o=c,Ve=s?.price&&i?`$${(s.price*i).toFixed(2)}`:"$0.00",He=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",Ee=!!(s&&o&&i&&n),je=Te||Oe,ee=P==="trackingTx"&&!!T&&!!s&&!!o&&!!i&&!!n,Q=Ce==="split",D=Q&&(v==="baseSelection"||v==="quoteSelection"||v==="baseChainSelection"||v==="quoteChainSelection"),U=v==="baseSelection"||v==="baseChainSelection"?"base":"quote",ze=U==="base"?o:s,te=xe(null),[Ge,Le]=H(380);fe(()=>{if(!Q)return;let a=te.current;if(!a)return;let m=new ResizeObserver(C=>{for(let Ke of C)Le(Ke.contentRect.height)});return m.observe(a),()=>m.disconnect()},[Q]);let _e=f(a=>{let C=l.getState().view==="baseChainSelection"?"base":"quote";l.getState().setChainFilter({chainId:a,side:C}),l.getState().pushRecentChain(a),l.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Je=f(()=>{let a=l.getState().view;a==="baseSelection"?l.getState().transitionToView("baseChainSelection","chainSelection"):a==="quoteSelection"&&l.getState().transitionToView("quoteChainSelection","chainSelection")},[]),se={backgroundColor:F==="default"?"var(--widget-primary)":"transparent",color:F==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:F!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:te,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[ee&&T&&s&&o&&i&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(pe,{orderHash:T,base:s,quote:o,baseAmount:i,quoteAmount:n,status:K})}):t(O,{children:[t("div",{className:`relative ${k?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?k?t("div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e("div",{className:"flex-1 min-w-0",children:e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(O,{children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ve}),x&&Z!==null&&Z>0&&e("button",{type:"button",onClick:Qe,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Se&&e("div",{className:"flex justify-center -my-4 relative z-10",children:t("button",{type:"button",onClick:Be,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:[e("span",{className:"text-2xs",children:"\u2191"}),e("span",{className:"text-2xs",children:"\u2193"})]})}),t("div",{className:`relative ${k?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?k?t("div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e("div",{className:"flex-1 min-w-0",children:e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(O,{children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:He}),Ue&&e("button",{type:"button",onClick:De,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:$?"1px solid var(--widget-border)":"none",maxHeight:$?"60px":"0px",opacity:$?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(ce,{})}),e("div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:x&&s&&o&&i&&i>0?e(ue,{base:s,baseAmount:i,quote:o,quoteAmount:n??0,userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Ae,isQuoteGasToken:Pe,reviewActionProps:Me,reviewState:P,setReviewState:Fe,trackedOrderHash:T,setTrackedOrderHash:X,onSwapComplete:we,onSwapInitiated:he,onOrderSubmitted:$e,onStaleQuoteRestart:We,txStatus:K}):!x&&be?e("button",{onClick:()=>qe(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:se,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:se,children:x?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${D?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...D?{height:`${Ge}px`}:{}},children:D?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:v==="baseChainSelection"||v==="quoteChainSelection"?e(ge,{toggle:E??ve,side:U,onChainSelect:_e}):e(me,{toggle:E??ve,side:U,otherAsset:ze,onMoreChainsClick:Je,selectedChainFilter:Re})}):t("div",{className:"flex flex-col gap-3 px-4 py-4",children:[e("span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),Ee&&s&&o?t(O,{children:[t("div",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),t("div",{className:"flex items-center gap-1",children:[e(V,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-mono text-xs uppercase",children:["1 ",o.symbol]})]}),e("div",{className:"flex items-center gap-1 pl-4",children:t("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Y.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(V,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-mono text-xs uppercase",children:s.symbol})]})]}),t("div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),t("span",{className:"font-mono text-xs",children:["$",s.price?(s.price*Y*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),e("span",{className:"text-2xs font-mono",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),e("span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),e("span",{className:"text-2xs font-mono",children:"Cross-chain"})]})]})]}):je?t("div",{className:"flex flex-col gap-1",children:[e(ie,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),e("span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):t("div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((a,m)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},bt=Ze;export{bt as default};
@@ -0,0 +1,2 @@
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
+ "use client";var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkBJYKILHScjs = require('./chunk-BJYKILHS.cjs');var _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');var _chunk52HJQZWWcjs = require('./chunk-52HJQZWW.cjs');var _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _wagmi = require('wagmi');function Y(s){let{address:n,isConnected:c}=_chunk34N36GUDcjs.a.call(void 0, ),{chainDataMap:y}=_chunkSE6JOLEMcjs.G.call(void 0, ),i=_chunkTCAVGM6Ycjs.c.call(void 0, ),{getToken:W,tokenRegistry:f}=_chunkSE6JOLEMcjs.D.call(void 0, ),{supportedInputTokens:x,supportedOutputTokens:w}=_chunkTCAVGM6Ycjs.b.call(void 0, ),a=_react.useMemo.call(void 0, ()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=_chunkSE6JOLEMcjs.J.call(void 0, n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=_react.useMemo.call(void 0, ()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=_react.useMemo.call(void 0, ()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):_chunkSE6JOLEMcjs.i.call(void 0, r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=_react.useMemo.call(void 0, ()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=_react.useMemo.call(void 0, ()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=_chunkSE6JOLEMcjs.c.call(void 0, r);return e[r.toString()]={chainId:r,name:_optionalChain([T, 'optionalAccess', _2 => _2.displayName])||_optionalChain([d, 'optionalAccess', _3 => _3.chainKey])||`Chain ${r}`},e},{}),[i,y]),v=_react.useMemo.call(void 0, ()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=_react.useCallback.call(void 0, ()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:_chunkSE6JOLEMcjs.F,tokenRegistry:v,refetchBalances:I}}var Z=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var _jsxruntime = require('react/jsx-runtime');var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return _jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"absolute inset-0 z-0",children:[_jsxruntime.jsx.call(void 0, "img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs uppercase mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.Q,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):_jsxruntime.jsx.call(void 0, "p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center",children:_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.P,{text:s,type:"address",children:_jsxruntime.jsx.call(void 0, "p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=_react.useState.call(void 0, !1),a=c!==void 0?parseFloat(n)/10**c:0,k=_optionalChain([f, 'optionalCall', _4 => _4(s.chainId,s.address), 'optionalAccess', _5 => _5.token]),g=_nullishCoalesce(y, () => (null));return _chunkSE6JOLEMcjs.i.call(void 0, s)&&g==null&&(_optionalChain([k, 'optionalAccess', _6 => _6.price])!=null?g=k.price:W&&(g=_nullishCoalesce(_optionalChain([W, 'call', _7 => _7(s.chainId,s.address), 'optionalAccess', _8 => _8.price]), () => (null)))),_jsxruntime.jsx.call(void 0, "div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>_optionalChain([i, 'optionalCall', _9 => _9(s)]),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),_optionalChain([i, 'optionalCall', _10 => _10(s)]))},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:s,size:"sm"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&_jsxruntime.jsx.call(void 0, "p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=_chunkSE6JOLEMcjs.f.call(void 0, ),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=_react.useState.call(void 0, new Set),w=_react.useCallback.call(void 0, t=>_optionalChain([n, 'optionalAccess', _11 => _11[t], 'optionalAccess', _12 => _12.name])||me[t]||`Chain ${t}`,[n]),a=_react.useMemo.call(void 0, ()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=_react.useCallback.call(void 0, t=>t.decimals===void 0||!_optionalChain([t, 'access', _13 => _13.assetInfo, 'optionalAccess', _14 => _14.price])?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=_react.useMemo.call(void 0, ()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?_chunkSE6JOLEMcjs.i.call(void 0, e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${_nullishCoalesce(_optionalChain([e, 'access', _15 => _15.assetInfo, 'access', _16 => _16.address, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => (""))}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(_nullishCoalesce(u[m[0]], () => (0)))-(_nullishCoalesce(u[v[0]], () => (0)))),chainTotals:u}},[s,a,l]),h=_react.useCallback.call(void 0, t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center p-6",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):_jsxruntime.jsx.call(void 0, "div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return _jsxruntime.jsxs.call(void 0, "div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex flex-row items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.M,{chain:b,size:"sm"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),_jsxruntime.jsx.call(void 0, "span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:_jsxruntime.jsx.call(void 0, "svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_jsxruntime.jsx.call(void 0, "path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:_jsxruntime.jsx.call(void 0, "div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?_jsxruntime.jsx.call(void 0, te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:_nullishCoalesce(_optionalChain([e, 'access', _19 => _19.assetInfo, 'optionalAccess', _20 => _20.price]), () => (null)),onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};var ve=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsx.call(void 0, "div",{className:"p-2 w-full flex justify-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),_jsxruntime.jsx.call(void 0, "div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between py-1.5",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e= exports.WidgetWalletPanel =()=>{let s=_chunkBJYKILHScjs.c.call(void 0, N=>N.walletTab),[n,c]=_react.useState.call(void 0, !1),{disconnect:y}=_wagmi.useDisconnect.call(void 0, ),{setQuoteToken:i}=_chunkBJYKILHScjs.f.call(void 0, ),W=_react.useCallback.call(void 0, async N=>{await i(N),_chunkBJYKILHScjs.c.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?_jsxruntime.jsx.call(void 0, ve,{}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full h-full overflow-hidden",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ee,{address:f,totalBalance:w,isLoading:a}),_jsxruntime.jsx.call(void 0, se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&_jsxruntime.jsx.call(void 0, _chunk52HJQZWWcjs.a,{isActive:s==="activity"})]}),_jsxruntime.jsx.call(void 0, "div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>{y(),_chunkBJYKILHScjs.c.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center justify-center h-full p-4",children:_jsxruntime.jsx.call(void 0, "p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};exports.WidgetWalletPanel = _e;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a as oe}from"./chunk-OPN7WCJR.js";import{c as F,f as J}from"./chunk-7QJJOVSV.js";import{b as B,c as q}from"./chunk-VI4ISTPB.js";import{a as X}from"./chunk-3RAZPKY5.js";import{D as j,F as G,G as H,J as O,M as U,N as V,P as K,Q,c as E,f as M,i as S}from"./chunk-ZWNDO5OZ.js";import{a as _}from"./chunk-46H44R7V.js";import{b as ae}from"./chunk-73CB2I7U.js";import{useCallback as fe,useState as pe}from"react";import{useDisconnect as ge}from"wagmi";import{useCallback as ne,useEffect as ie,useMemo as L,useRef as le}from"react";function Y(s){let{address:n,isConnected:c}=_(),{chainDataMap:y}=H(),i=q(),{getToken:W,tokenRegistry:f}=j(),{supportedInputTokens:x,supportedOutputTokens:w}=B(),a=L(()=>{if(!x.length&&!w.length)return[];let e=new Set,r=[];for(let d of[...x,...w]){let T=`${d.chainId}-${d.address.toLowerCase()}`;e.has(T)||(e.add(T),r.push(d))}return r},[x,w]),{balances:l,isLoading:k,isError:g,refetch:h}=O(n,i,{enabled:c&&s&&!!n,refetchOnWindowFocus:!1},a.length>0?a:void 0),N=L(()=>a.length?new Set(a.map(e=>`${e.chainId}-${e.address.toLowerCase()}`)):null,[a]),t=L(()=>!l||l.length===0?{}:l.filter(r=>!r.assetInfo||!r.balance||r.balance==="0"?!1:N?N.has(`${r.chainId}-${r.address.toLowerCase()}`):S(r.assetInfo)||f.length===0?!0:f.some(d=>d.address.toLowerCase()===r.address.toLowerCase()&&d.chainId===r.chainId)).reduce((r,d)=>{let T=String(d.chainId);return r[T]||(r[T]=[]),r[T].push({token:d.address,amount:d.balance,decimals:d.decimals,assetInfo:d.assetInfo}),r},{}),[l,f,N]),u=L(()=>!l||l.length===0?0:l.reduce((e,r)=>!r.assetInfo||r.decimals===void 0?e:e+parseFloat(r.balance)/10**r.decimals*(r.assetInfo.price||0),0),[l]),b=L(()=>i.length===0?{}:i.reduce((e,r)=>{let d=y[r],T=E(r);return e[r.toString()]={chainId:r,name:T?.displayName||d?.chainKey||`Chain ${r}`},e},{}),[i,y]),v=L(()=>f.map(e=>({address:e.address,chainId:e.chainId})),[f]),m=le(null);ie(()=>()=>{m.current&&clearTimeout(m.current)},[]);let I=ne(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>h(),2e3)},[h]);return{address:n,isConnected:c,groupedAssets:t,totalBalance:u,balancesLoading:k,balancesError:g,chains:b,getToken:W,useTokenWithLazyLoad:G,tokenRegistry:v,refetchBalances:I}}var Z=ae(oe(),1);import{jsx as C,jsxs as $}from"react/jsx-runtime";var ee=({address:s,totalBalance:n,isLoading:c=!1})=>{let y=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(i);return C("div",{className:"p-2 w-full flex justify-center",children:$("div",{className:"relative w-full h-[140px] overflow-hidden",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)"},children:[$("div",{className:"absolute inset-0 z-0",children:[C("img",{className:"w-full h-full object-cover opacity-60",src:(0,Z.makeGradient)(s),alt:"address gradient"}),C("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent"})]}),$("div",{className:"relative z-10 flex h-full flex-col justify-between p-3",children:[$("div",{children:[C("p",{className:"text-2xs uppercase mono",style:{color:"var(--widget-muted-foreground)",opacity:.7},children:"Token Balance:"}),c?C(Q,{className:"h-8 w-28 bg-white/10 rounded mt-1"}):C("p",{className:"text-2xl font-bold mt-0.5",style:{color:"var(--widget-foreground)"},children:y(n)})]}),C("div",{className:"flex items-center",children:C(K,{text:s,type:"address",children:C("p",{className:"mono text-2xs",style:{color:"var(--widget-foreground)",opacity:.7},children:s})})})]})]})})};import{useCallback as P,useMemo as re,useState as ue}from"react";import{useState as de}from"react";import{jsx as R,jsxs as z}from"react/jsx-runtime";var te=({asset:s,balanceAmount:n,balanceDecimals:c,price:y,onSelect:i,getToken:W,useTokenWithLazyLoad:f})=>{let[x,w]=de(!1),a=c!==void 0?parseFloat(n)/10**c:0,k=f?.(s.chainId,s.address)?.token,g=y??null;return S(s)&&g==null&&(k?.price!=null?g=k.price:W&&(g=W(s.chainId,s.address)?.price??null)),R("div",{role:"button",tabIndex:0,className:"flex h-[52px] w-full flex-row items-center p-3 cursor-pointer transition-colors",style:{borderBottom:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:x?"var(--widget-secondary)":"transparent"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),onClick:()=>i?.(s),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i?.(s))},children:z("div",{className:"flex h-full w-full flex-row items-center justify-between",children:[z("div",{className:"flex h-full flex-row items-center gap-2",children:[R(V,{asset:s,size:"sm"}),z("div",{className:"flex flex-col items-start",children:[R("p",{className:"text-sm font-medium uppercase",style:{color:"var(--widget-foreground)"},children:s.symbol}),a>0&&R("p",{className:"mono text-xs",style:{color:"var(--widget-muted-foreground)"},children:a.toFixed(4)})]})]}),R("p",{className:"text-sm font-medium",style:{color:"var(--widget-foreground)"},children:g!=null?`$${(g*a).toFixed(2)}`:"\u2014"})]})})};import{jsx as p,jsxs as D}from"react/jsx-runtime";var ce=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),me=M(),se=({groupedAssets:s,chains:n,tokenRegistry:c=[],getToken:y,useTokenWithLazyLoad:i,onAssetSelect:W})=>{let[f,x]=ue(new Set),w=P(t=>n?.[t]?.name||me[t]||`Chain ${t}`,[n]),a=re(()=>{let t=new Set;for(let u of c)t.add(`${u.chainId}-${u.address.toLowerCase()}`);return t},[c]),l=P(t=>t.decimals===void 0||!t.assetInfo?.price?0:parseFloat(t.amount)/10**t.decimals*t.assetInfo.price,[]),{filteredGroupedAssets:k,chainTotals:g}=re(()=>{let t=Object.entries(s).map(([v,m])=>{let I=m.filter(e=>e.assetInfo?S(e.assetInfo)?!0:a.size>0?a.has(`${e.assetInfo.chainId}-${e.assetInfo.address?.toLowerCase()??""}`):!0:!1);return[v,I]}).filter(([,v])=>v.length>0),u={};for(let[v,m]of t)u[v]=m.reduce((I,e)=>I+l(e),0);return{filteredGroupedAssets:[...t].sort((v,m)=>(u[m[0]]??0)-(u[v[0]]??0)),chainTotals:u}},[s,a,l]),h=P(t=>{x(u=>{let b=new Set(u);return b.has(t)?b.delete(t):b.add(t),b})},[]),N=t=>ce.format(t);return k.length===0?p("div",{className:"flex items-center justify-center p-6",children:p("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"No token balances found"})}):p("div",{className:"pb-2 pt-1",children:k.map(([t,u])=>{let b=parseInt(t),v=w(b),m=g[t]||0,I=f.has(t);return D("div",{className:"mx-2 mb-2",style:{border:"1px var(--widget-border-style) var(--widget-border)",borderRadius:"var(--widget-radius)",overflow:"hidden"},children:[D("button",{type:"button",onClick:()=>h(t),className:"flex w-full flex-row items-center justify-between p-2 cursor-pointer transition-colors hover:bg-(--widget-secondary)",style:{backgroundColor:"transparent"},children:[D("div",{className:"inline-flex flex-row items-center gap-2",children:[p(U,{chain:b,size:"sm"}),p("p",{className:"text-sm font-medium capitalize",style:{color:"var(--widget-foreground)"},children:v})]}),D("div",{className:"flex items-center gap-2",children:[p("p",{className:"text-sm font-semibold",style:{color:"var(--widget-foreground)"},children:N(m)}),p("span",{className:`transition-transform duration-200 ${I?"rotate-180":""}`,style:{color:"var(--widget-muted-foreground)"},children:p("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:p("path",{d:"M2.5 4.5L6 8L9.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),p("div",{className:`overflow-hidden transition-all duration-200 ease-out ${I?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:p("div",{style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:u.map(e=>e.assetInfo?p(te,{asset:e.assetInfo,balanceAmount:e.amount,balanceDecimals:e.decimals,price:e.assetInfo?.price??null,onSelect:W,getToken:y,useTokenWithLazyLoad:i},`${e.assetInfo.chainId}-${e.token}`):null)})})]},t)})})};import{Fragment as ye,jsx as o,jsxs as A}from"react/jsx-runtime";var ve=()=>A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[o("div",{className:"p-2 w-full flex justify-center",children:o("div",{className:"relative w-full h-[140px] animate-pulse",style:{borderRadius:"var(--widget-radius)",border:"1px var(--widget-border-style) var(--widget-border)",backgroundColor:"var(--widget-secondary)"}})}),o("div",{className:"px-2 flex flex-col gap-1.5 mt-1",children:[80,60,72,55,65].map((s,n)=>A("div",{className:"flex items-center justify-between py-1.5",children:[A("div",{className:"flex items-center gap-2",children:[o("div",{className:"h-6 w-6 rounded-full animate-pulse shrink-0",style:{backgroundColor:"var(--widget-secondary)"}}),o("div",{className:"h-3.5 animate-pulse",style:{width:`${s}px`,backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}})]}),o("div",{className:"h-3.5 w-14 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}})]},n))}),o("div",{className:"mt-auto shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("div",{className:"w-full animate-pulse",style:{height:"34px",backgroundColor:"var(--widget-secondary)",opacity:.35,borderRadius:"var(--widget-radius)"}})})]}),_e=()=>{let s=F(N=>N.walletTab),[n,c]=pe(!1),{disconnect:y}=ge(),{setQuoteToken:i}=J(),W=fe(async N=>{await i(N),F.getState().setView("swap")},[i]),{address:f,groupedAssets:x,totalBalance:w,balancesLoading:a,chains:l,getToken:k,useTokenWithLazyLoad:g,tokenRegistry:h}=Y(!0);return f?a&&s==="wallet"?o(ve,{}):A("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[A("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0},children:[s==="wallet"&&A(ye,{children:[o(ee,{address:f,totalBalance:w,isLoading:a}),o(se,{groupedAssets:x,chains:l,tokenRegistry:h,getToken:k,useTokenWithLazyLoad:g,onAssetSelect:W})]}),s==="activity"&&o(X,{isActive:s==="activity"})]}),o("div",{className:"shrink-0 p-2",style:{borderTop:"1px var(--widget-border-style) var(--widget-border)"},children:o("button",{type:"button",onClick:()=>{y(),F.getState().setView("swap")},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:"w-full py-2 text-xs mono uppercase cursor-pointer transition-colors",style:{backgroundColor:n?"var(--widget-destructive)":"transparent",color:n?"var(--widget-destructive-foreground)":"var(--widget-destructive)",border:"1px var(--widget-border-style) var(--widget-destructive)",borderRadius:"var(--widget-radius)"},children:"Sign Out"})})]}):o("div",{className:"flex flex-col items-center justify-center h-full p-4",children:o("p",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Connect your wallet to view your portfolio"})})};export{_e as WidgetWalletPanel};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a}from"./chunk-3RAZPKY5.js";import"./chunk-ZWNDO5OZ.js";import"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";export{a as WidgetWalletTradeHistory};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+ "use client";var _chunk52HJQZWWcjs = require('./chunk-52HJQZWW.cjs');require('./chunk-SE6JOLEM.cjs');require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');exports.WidgetWalletTradeHistory = _chunk52HJQZWWcjs.a;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{D as E,N as A,o as R,p as W,z as N}from"./chunk-ZWNDO5OZ.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 mono uppercase",style:{color:p},children:c})]}),l("div",{className:"flex flex-row items-center space-x-2",children:[l("span",{className:"text-2xs mono",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 mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&t("span",{className:"text-2xs mono 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};
@@ -0,0 +1,2 @@
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 _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');var _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var y=({toggle:x,side:w,onChainSelect:i,onChainHover:l,containerHeight:N})=>{let[a,d]=_react.useState.call(void 0, ""),r=_chunkSE6JOLEMcjs.x.call(void 0, a,300),v=_chunkTCAVGM6Ycjs.c.call(void 0, ),s=_chunkSE6JOLEMcjs.e.call(void 0, v),u=_react2.default.useMemo(()=>{if(!r)return s;let e=r.toLowerCase();return s.filter(n=>n.displayName.toLowerCase().includes(e)||n.name.toLowerCase().includes(e)||n.id.toString().includes(e))},[s,r]),f=_react.useCallback.call(void 0, e=>i(e),[i]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col",children:[_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 chains by name or chain ID...",autoComplete:"off",value:a,onChange:e=>d(e.target.value.toLowerCase())}),a&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>d(""),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:[_jsxruntime.jsx.call(void 0, "p",{className:"my-2 ml-4 text-xs",style:{color:"var(--widget-muted-foreground)"},children:a?"Search Results":"Available Chains"}),u.length===0?_jsxruntime.jsx.call(void 0, "div",{className:"px-4 py-3 text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Chain Not Found"}):u.map(e=>_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"w-full flex items-center justify-between p-3 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--widget-border)"},onClick:()=>f(e.id),onMouseEnter:()=>_optionalChain([l, 'optionalCall', _ => _(e.displayName)]),onMouseLeave:()=>_optionalChain([l, 'optionalCall', _2 => _2(null)]),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:"flex-shrink-0",children:_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.M,{chain:e.id,size:"md"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:e.displayName})]}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-muted-foreground)"},children:["Chain ID: ",e.id]})]},e.id))]})]})},M= exports.a =y;exports.a = M;
@@ -0,0 +1,2 @@
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 _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.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=_chunkSE6JOLEMcjs.z.call(void 0, e.inputChain),r=_chunkSE6JOLEMcjs.z.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}=_chunkSE6JOLEMcjs.D.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 _chunkSE6JOLEMcjs.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 mono 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 mono",style:{color:r?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:["\xAC ",_chunkSE6JOLEMcjs.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, _chunkSE6JOLEMcjs.N,{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, _chunkSE6JOLEMcjs.N,{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 mono whitespace-nowrap",style:{color:"var(--widget-muted-foreground)"},children:d.date}),d.time&&_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mono 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;
@@ -0,0 +1,2 @@
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 _chunkZKDVXDQFcjs = require('./chunk-ZKDVXDQF.cjs');var _chunkBJYKILHScjs = require('./chunk-BJYKILHS.cjs');var _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');var _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.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 G=_react2.default.memo(({asset:o,otherAsset:i,handleFormSelection:c,getToken:_})=>{let{token:w}=_chunkSE6JOLEMcjs.F.call(void 0, o.chainId,o.address),S=_(o.chainId,o.address),a=w||S||o.assetInfo;if(!a)return null;let p=a.price!=null&&o.decimals!==void 0?_chunkSE6JOLEMcjs.u.call(void 0, a,o.balance,o.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:()=>c(a,i),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, _chunkSE6JOLEMcjs.N,{asset:a,size:"md",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-base font-medium",style:{color:"var(--widget-foreground)"},children:a.symbol.length>20?`${a.symbol.substring(0,20)}...`:a.symbol}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-foreground)",opacity:.6},children:a.name.length>20?`${a.name.substring(0,20)}...`:a.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-mono",style:{color:"var(--widget-foreground)",opacity:.5},children:"Balance:"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-mono",style:{color:"var(--widget-foreground)"},children:p!=null?`$${p.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(o,i)=>o.asset.address===i.asset.address&&o.asset.chainId===i.asset.chainId&&o.asset.balance===i.asset.balance&&_optionalChain([o, 'access', _2 => _2.asset, 'access', _3 => _3.assetInfo, 'optionalAccess', _4 => _4.price])===_optionalChain([i, 'access', _5 => _5.asset, 'access', _6 => _6.assetInfo, 'optionalAccess', _7 => _7.price])&&o.otherAsset.address===i.otherAsset.address);G.displayName="AssetSelectionBalanceItem";var Le=({toggle:o,side:i,otherAsset:c,containerHeight:_,onChainHover:w,onMoreChainsClick:S,selectedChainFilter:a})=>{let{address:W}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:p,assetSelectionChain:u,assetSelectionCategory:ce,recentChainIds:q}=_chunkBJYKILHScjs.c.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),B=_chunkSE6JOLEMcjs.x.call(void 0, p,300),y=_chunkTCAVGM6Ycjs.c.call(void 0, ),{inputSelectionSearch:ue,outputSelectionSearch:me,showInputSelectionTokenBalances:fe,showOutputSelectionTokenBalances:pe}=_chunkTCAVGM6Ycjs.b.call(void 0, ),{effectiveInputTokens:ge,effectiveOutputTokens:he,effectiveInputChains:we,effectiveOutputChains:be}=_chunkZKDVXDQFcjs.a.call(void 0, ),ye=i==="base"?ue:me,ve=i==="base"?fe:pe,{setBaseToken:V,setQuoteToken:j}=_chunkBJYKILHScjs.f.call(void 0, ),v=i==="base"?ge:he,b=i==="base"?we:be,M=b.length===1,I=_react.useMemo.call(void 0, ()=>{if(v.length===0)return null;let e=new Set;for(let s of v)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[v]);_react.useEffect.call(void 0, ()=>{M?_chunkBJYKILHScjs.c.getState().setAssetSelectionChain(b[0]):a&&_chunkBJYKILHScjs.c.getState().setAssetSelectionChain(a)},[a,M,b]);let Ie=_react2.default.useMemo(()=>{let r=b.length>0?new Set(b):null,t=_chunkSE6JOLEMcjs.e.call(void 0, y).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(t.map(l=>[l.chainId,l])),m=[],h=new Set,U=d.get(4326);U&&(m.push(U),h.add(4326));for(let l of q){if(m.length>=5)break;if(h.has(l))continue;let Y=d.get(l);Y&&(m.push(Y),h.add(l))}for(let l of t){if(m.length>=5)break;h.has(l.chainId)||m.push(l)}return m},[y,q,b]),{enrichedTokens:D,isLoading:xe}=_chunkSE6JOLEMcjs.E.call(void 0, u==="all"?"all":u),{tokenRegistry:O,getToken:E}=_chunkSE6JOLEMcjs.D.call(void 0, ),Ce=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let s of O)e.add(`${s.chainId}-${s.address.toLowerCase()}`);return e},[O]),R=_react.useMemo.call(void 0, ()=>I?D.filter(e=>I.has(`${e.chainId}-${e.address.toLowerCase()}`)):D,[D,I]),F=_react.useMemo.call(void 0, ()=>c?R.filter(e=>!(e.chainId===c.chainId&&e.address.toLowerCase()===c.address.toLowerCase())):R,[R,c]),H=_react2.default.useMemo(()=>{if(!B)return F;let e=B.toLowerCase();return F.filter(s=>(s.symbol||"").toLowerCase().includes(e)||(s.name||"").toLowerCase().includes(e)||s.address.toLowerCase().includes(e))},[F,B]),P=_react2.default.useMemo(()=>{let e=u==="all"?(H||[]).filter(t=>y.includes(t.chainId)):H||[],s=new Set;return[...e.filter(t=>{let d=`${t.chainId}-${t.address.toLowerCase()}`;return s.has(d)?!1:(s.add(d),!0)})].sort((t,d)=>{let m=_chunkSE6JOLEMcjs.i.call(void 0, t),h=_chunkSE6JOLEMcjs.i.call(void 0, d);return m&&!h?-1:!m&&h?1:t.marketCap&&!d.marketCap?-1:!t.marketCap&&d.marketCap?1:!t.marketCap&&!d.marketCap?0:d.marketCap-t.marketCap})},[H,u,y]),{balances:k,isLoading:Se}=_chunkSE6JOLEMcjs.J.call(void 0, W,y,void 0,v.length>0?v:void 0),Q=_react2.default.useMemo(()=>{if(!k)return[];let e=u==="all"?k:k.filter(r=>r.chainId===u),s=new Set;return e.filter(r=>{let t=`${r.chainId}-${(r.address||"").toLowerCase()}`;return s.has(t)?!1:(s.add(t),!0)})},[k,u]),ke=_react.useCallback.call(void 0, e=>{let s=e.target.value.toLowerCase(),r=_chunkSE6JOLEMcjs.v.call(void 0, s),t=_chunkBJYKILHScjs.c.getState();r?(t.setAssetSelectionSearch(r),t.setAssetSelectionAddressInput(r)):(t.setAssetSelectionAddressInput(""),t.setAssetSelectionSearch(s))},[]),z=_react.useCallback.call(void 0, async e=>{i==="base"?await V(e):i==="quote"&&await j(e),o()},[o,i,V,j]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-2.5",children:[!M&&_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",style:{backgroundColor:u==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:u==="all"&&!a?"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(),_chunkBJYKILHScjs.c.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([w, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([w, 'optionalCall', _9 => _9(null)]),children:"All"}),Ie.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:u===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:u===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(),_chunkBJYKILHScjs.c.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([w, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([w, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.M,{chain:e.chainId,size:"xs"})})},e.chainId)),S&&_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(),S()},children:"More"})]}),ye&&_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:p,onChange:ke}),p&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkBJYKILHScjs.c.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:[ve&&!Se&&Q.length>0&&!p&&ce==="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"}),Q.filter(e=>!e.assetInfo||c&&e.assetInfo.chainId===c.chainId&&e.assetInfo.address.toLowerCase()===c.address.toLowerCase()?!1:I?I.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunkSE6JOLEMcjs.i.call(void 0, e.assetInfo)||Ce.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`)).sort((e,s)=>{let r=E(e.chainId,e.address)||e.assetInfo,t=E(s.chainId,s.address)||s.assetInfo,d=r&&e.decimals!==void 0?_chunkSE6JOLEMcjs.u.call(void 0, r,e.balance,e.decimals):0;return(t&&s.decimals!==void 0?_chunkSE6JOLEMcjs.u.call(void 0, t,s.balance,s.decimals):0)-d}).map(e=>!e.assetInfo||!c?null:_jsxruntime.jsx.call(void 0, G,{asset:e,otherAsset:c,handleFormSelection:z,getToken:E},`${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:p?"Search Results":"Supported Tokens"}),xe?_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..."})}):P.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"}):P.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:()=>z(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),z(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, _chunkSE6JOLEMcjs.N,{asset:e,size:"md",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-base font-medium truncate",style:{color:"var(--widget-foreground)"},children:(e.symbol||"").length>20?`${e.symbol.substring(0,20)}...`:e.symbol||"\u2014"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm 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-mono",style:{color:"var(--widget-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-mono",style:{color:"var(--widget-muted-foreground)"},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}`))]})]})},Je= exports.a =Le;exports.a = Je;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{B as H,C as B,K as P,c as k}from"./chunk-ZWNDO5OZ.js";import{a as O}from"./chunk-46H44R7V.js";import{create as ee}from"zustand";import{useCallback as q,useEffect as te,useRef as ne}from"react";var x=ee()(n=>({baseToken:null,quoteToken:null,setBaseTokenDirect:e=>n({baseToken:e}),setQuoteTokenDirect:e=>n({quoteToken:e}),swapTokensDirect:()=>n(e=>({baseToken:e.quoteToken,quoteToken:e.baseToken}))}));function W(n){let{data:e,isLoading:c}=H(),o=x(),T=ne(!1),t=n?.defaultBaseToken??null,l=n?.defaultQuoteToken??null;te(()=>{if(!e||e.length===0||T.current)return;T.current=!0;let u=g=>e.find(m=>m.chainId===g.chainId&&m.address.toLowerCase()===g.address.toLowerCase())??null,r=t?u(t):null,p=l?u(l):null;r&&p&&r.chainId===p.chainId&&r.address.toLowerCase()===p.address.toLowerCase()?(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(p))},[e,t,l,o]);let h=q(u=>{if(!u){o.setBaseTokenDirect(null);return}let r=x.getState();r.quoteToken&&u.chainId===r.quoteToken.chainId&&u.address.toLowerCase()===r.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),f=q(u=>{if(!u){o.setQuoteTokenDirect(null);return}let r=x.getState();r.baseToken&&u.chainId===r.baseToken.chainId&&u.address.toLowerCase()===r.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),w=q(()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:c}}import{create as se}from"zustand";var F=se()(n=>({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",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],toggleInverted:()=>n(e=>({isInverted:!e.isInverted})),setView:e=>n({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>n({walletTab:e}),setIsTransitioning:e=>n({isTransitioning:e}),transitionToView:(e,c="navigation")=>n({isTransitioning:!0,transitionType:c,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>n({selectedChainFilter:e}),setHoveredChainName:e=>n({hoveredChainName:e}),toggleRecipientInput:()=>n(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>n({recipient:e}),setHasAllowanceError:e=>n({hasAllowanceError:e}),setBaseAmount:e=>n({baseAmount:e}),setQuoteAmount:e=>n({quoteAmount:e}),clearAmounts:()=>n({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>n({isTrackingTx:e}),setTrackingOrderHash:e=>n({trackingOrderHash:e}),setTxStatus:e=>n({txStatus:e}),startTracking:e=>n({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending"}),stopTracking:()=>n({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending"}),setAssetSelectionSearch:e=>n({assetSelectionSearch:e}),setAssetSelectionChain:e=>n({assetSelectionChain:e}),setAssetSelectionCategory:e=>n({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>n({assetSelectionAddressInput:e}),pushRecentChain:e=>n(c=>{if(e===4326)return c;let T=c.recentChainIds.filter(t=>t!==e);return{recentChainIds:[e,...T].slice(0,3)}}),resetAssetSelection:()=>n({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>n({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",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));import{useCallback as S,useMemo as d}from"react";import{parseUnits as E}from"viem";import{useShallow as oe}from"zustand/react/shallow";var U=(n,e,c,o)=>{let{address:T}=O(),{baseToken:t,quoteToken:l,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:u}=W({defaultBaseToken:n,defaultQuoteToken:e}),{baseAmount:r,quoteAmount:p,setBaseAmount:g,setQuoteAmount:m,clearAmounts:Q}=F(oe(s=>({baseAmount:s.baseAmount,quoteAmount:s.quoteAmount,setBaseAmount:s.setBaseAmount,setQuoteAmount:s.setQuoteAmount,clearAmounts:s.clearAmounts}))),{data:R}=B(t?.address,t?.chainId),{data:L}=B(l?.address,l?.chainId),a=d(()=>{if(!t)return null;let s=R?.price??t.price;return s===t.price?t:{...t,price:s}},[t,R?.price]),i=d(()=>{if(!l)return null;let s=L?.price??l.price;return s===l.price?l:{...l,price:s}},[l,L?.price]),{baseBalance:A,quoteBalance:I,isLoading:D}=P(T,a,i),b=d(()=>!A||A.raw==="0"?null:A,[A]),C=d(()=>!I||I.raw==="0"?null:I,[I]),v=d(()=>{if(!a?.chainId)return!1;let s=k(a.chainId);return a.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[a]),y=d(()=>{if(!i?.chainId)return!1;let s=k(i.chainId);return i.address.toLowerCase()===s?.gasToken.address?.toLowerCase()},[i]),V=d(()=>{if(!v||!a?.chainId||!i||a.chainId!==i.chainId||a.chainId===988)return!1;let s=k(a.chainId);return i.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[v,a,i]),G=d(()=>{if(!a?.chainId||!i||!y||a.chainId!==i.chainId||a.chainId===988)return!1;let s=k(a.chainId);return a.address.toLowerCase()===s?.wrappedAsset.address?.toLowerCase()},[a,i,y]),M=d(()=>({raw:b?.raw??"0",formatted:b?.formatted??"0"}),[b]),_=d(()=>({raw:C?.raw??"0",formatted:C?.formatted??"0"}),[C]),z=d(()=>!a||typeof r!="number"||a.decimals===void 0||a.decimals===null?null:E(r.toFixed(a.decimals),a.decimals).toString(),[a,r]),J=d(()=>!i||typeof p!="number"||i.decimals===void 0||i.decimals===null?null:E(p.toFixed(i.decimals),i.decimals).toString(),[i,p]),K=S(async s=>{h(s),m(null),c?.(s)},[h,m,c]),X=S(async s=>{f(s),o?.(s)},[f,o]),Y=S(s=>g(s),[g]),Z=S(s=>m(s),[m]),$=S(()=>{w(),F.getState().toggleInverted(),l&&c?.(l),t&&o?.(t)},[w,t,l,c,o]),j=S(()=>Q(),[Q]);return{baseToken:a,baseAmount:r,quoteToken:i,quoteAmount:p,isBaseGasToken:v,isQuoteGasToken:y,isWrappingPair:V,isUnwrappingPair:G,baseBalance:M,quoteBalance:_,baseAmountRaw:z,quoteAmountRaw:J,isBaseBalanceLoading:D,isQuoteBalanceLoading:D,isRegistryLoading:u,setBaseToken:K,setQuoteToken:X,setBaseAmount:Y,setQuoteAmount:Z,swapTokens:$,clearForm:j}};import{createContext as ae,useContext as ie,useMemo as re}from"react";import{jsx as le}from"react/jsx-runtime";var N=ae(null),Be=({children:n,defaultBaseToken:e,defaultQuoteToken:c,onBaseTokenChange:o,onQuoteTokenChange:T})=>{let t=U(e,c,o,T),l=re(()=>t,[t.baseToken,t.quoteToken,t.baseAmount,t.quoteAmount,t.isBaseGasToken,t.isQuoteGasToken,t.isWrappingPair,t.isUnwrappingPair,t.baseBalance,t.quoteBalance,t.baseAmountRaw,t.quoteAmountRaw,t.isBaseBalanceLoading,t.isQuoteBalanceLoading,t.setBaseToken,t.setQuoteToken,t.setBaseAmount,t.setQuoteAmount,t.swapTokens,t.clearForm,t.isRegistryLoading]);return le(N.Provider,{value:l,children:n})},qe=()=>{let n=ie(N);if(!n)throw new Error("useSwapFormContext must be used within SwapFormProvider");return n};export{x as a,W as b,F as c,U as d,Be as e,qe as f};
@@ -0,0 +1,2 @@
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 _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _zustand = require('zustand');var _react = require('react');var x=_zustand.create.call(void 0, )(n=>({baseToken:null,quoteToken:null,setBaseTokenDirect:e=>n({baseToken:e}),setQuoteTokenDirect:e=>n({quoteToken:e}),swapTokensDirect:()=>n(e=>({baseToken:e.quoteToken,quoteToken:e.baseToken}))}));function W(n){let{data:e,isLoading:c}=_chunkSE6JOLEMcjs.B.call(void 0, ),o=x(),T=_react.useRef.call(void 0, !1),t=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _2 => _2.defaultBaseToken]), () => (null)),l=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _3 => _3.defaultQuoteToken]), () => (null));_react.useEffect.call(void 0, ()=>{if(!e||e.length===0||T.current)return;T.current=!0;let u=g=>_nullishCoalesce(e.find(m=>m.chainId===g.chainId&&m.address.toLowerCase()===g.address.toLowerCase()), () => (null)),r=t?u(t):null,p=l?u(l):null;r&&p&&r.chainId===p.chainId&&r.address.toLowerCase()===p.address.toLowerCase()?(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(null)):(o.setBaseTokenDirect(r),o.setQuoteTokenDirect(p))},[e,t,l,o]);let h=_react.useCallback.call(void 0, u=>{if(!u){o.setBaseTokenDirect(null);return}let r=x.getState();r.quoteToken&&u.chainId===r.quoteToken.chainId&&u.address.toLowerCase()===r.quoteToken.address.toLowerCase()?o.swapTokensDirect():o.setBaseTokenDirect(u)},[o]),f=_react.useCallback.call(void 0, u=>{if(!u){o.setQuoteTokenDirect(null);return}let r=x.getState();r.baseToken&&u.chainId===r.baseToken.chainId&&u.address.toLowerCase()===r.baseToken.address.toLowerCase()?o.swapTokensDirect():o.setQuoteTokenDirect(u)},[o]),w=_react.useCallback.call(void 0, ()=>{o.swapTokensDirect()},[o]);return{baseToken:o.baseToken,quoteToken:o.quoteToken,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:c}}var F=_zustand.create.call(void 0, )(n=>({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",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:"",recentChainIds:[],toggleInverted:()=>n(e=>({isInverted:!e.isInverted})),setView:e=>n({view:e,isTransitioning:!0,...e!=="wallet"&&{walletTab:"wallet"}}),setWalletTab:e=>n({walletTab:e}),setIsTransitioning:e=>n({isTransitioning:e}),transitionToView:(e,c="navigation")=>n({isTransitioning:!0,transitionType:c,view:e,...e!=="wallet"&&{walletTab:"wallet"}}),setChainFilter:e=>n({selectedChainFilter:e}),setHoveredChainName:e=>n({hoveredChainName:e}),toggleRecipientInput:()=>n(e=>({isRecipientInputOpen:!e.isRecipientInputOpen,recipient:e.isRecipientInputOpen?null:e.recipient})),setRecipient:e=>n({recipient:e}),setHasAllowanceError:e=>n({hasAllowanceError:e}),setBaseAmount:e=>n({baseAmount:e}),setQuoteAmount:e=>n({quoteAmount:e}),clearAmounts:()=>n({baseAmount:null,quoteAmount:null}),setIsTrackingTx:e=>n({isTrackingTx:e}),setTrackingOrderHash:e=>n({trackingOrderHash:e}),setTxStatus:e=>n({txStatus:e}),startTracking:e=>n({isTrackingTx:!0,trackingOrderHash:e,txStatus:"pending"}),stopTracking:()=>n({isTrackingTx:!1,trackingOrderHash:null,txStatus:"pending"}),setAssetSelectionSearch:e=>n({assetSelectionSearch:e}),setAssetSelectionChain:e=>n({assetSelectionChain:e}),setAssetSelectionCategory:e=>n({assetSelectionCategory:e}),setAssetSelectionAddressInput:e=>n({assetSelectionAddressInput:e}),pushRecentChain:e=>n(c=>{if(e===4326)return c;let T=c.recentChainIds.filter(t=>t!==e);return{recentChainIds:[e,...T].slice(0,3)}}),resetAssetSelection:()=>n({assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""}),resetUI:()=>n({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",walletTab:"wallet",assetSelectionSearch:"",assetSelectionChain:"all",assetSelectionCategory:"all",assetSelectionAddressInput:""})}));var _viem = require('viem');var _shallow = require('zustand/react/shallow');var U=(n,e,c,o)=>{let{address:T}=_chunk34N36GUDcjs.a.call(void 0, ),{baseToken:t,quoteToken:l,setBaseToken:h,setQuoteToken:f,swapTokens:w,isLoading:u}=W({defaultBaseToken:n,defaultQuoteToken:e}),{baseAmount:r,quoteAmount:p,setBaseAmount:g,setQuoteAmount:m,clearAmounts:Q}=F(_shallow.useShallow.call(void 0, s=>({baseAmount:s.baseAmount,quoteAmount:s.quoteAmount,setBaseAmount:s.setBaseAmount,setQuoteAmount:s.setQuoteAmount,clearAmounts:s.clearAmounts}))),{data:R}=_chunkSE6JOLEMcjs.C.call(void 0, _optionalChain([t, 'optionalAccess', _4 => _4.address]),_optionalChain([t, 'optionalAccess', _5 => _5.chainId])),{data:L}=_chunkSE6JOLEMcjs.C.call(void 0, _optionalChain([l, 'optionalAccess', _6 => _6.address]),_optionalChain([l, 'optionalAccess', _7 => _7.chainId])),a=_react.useMemo.call(void 0, ()=>{if(!t)return null;let s=_nullishCoalesce(_optionalChain([R, 'optionalAccess', _8 => _8.price]), () => (t.price));return s===t.price?t:{...t,price:s}},[t,_optionalChain([R, 'optionalAccess', _9 => _9.price])]),i=_react.useMemo.call(void 0, ()=>{if(!l)return null;let s=_nullishCoalesce(_optionalChain([L, 'optionalAccess', _10 => _10.price]), () => (l.price));return s===l.price?l:{...l,price:s}},[l,_optionalChain([L, 'optionalAccess', _11 => _11.price])]),{baseBalance:A,quoteBalance:I,isLoading:D}=_chunkSE6JOLEMcjs.K.call(void 0, T,a,i),b=_react.useMemo.call(void 0, ()=>!A||A.raw==="0"?null:A,[A]),C=_react.useMemo.call(void 0, ()=>!I||I.raw==="0"?null:I,[I]),v=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([a, 'optionalAccess', _12 => _12.chainId]))return!1;let s=_chunkSE6JOLEMcjs.c.call(void 0, a.chainId);return a.address.toLowerCase()===_optionalChain([s, 'optionalAccess', _13 => _13.gasToken, 'access', _14 => _14.address, 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16()])},[a]),y=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([i, 'optionalAccess', _17 => _17.chainId]))return!1;let s=_chunkSE6JOLEMcjs.c.call(void 0, i.chainId);return i.address.toLowerCase()===_optionalChain([s, 'optionalAccess', _18 => _18.gasToken, 'access', _19 => _19.address, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()])},[i]),V=_react.useMemo.call(void 0, ()=>{if(!v||!_optionalChain([a, 'optionalAccess', _22 => _22.chainId])||!i||a.chainId!==i.chainId||a.chainId===988)return!1;let s=_chunkSE6JOLEMcjs.c.call(void 0, a.chainId);return i.address.toLowerCase()===_optionalChain([s, 'optionalAccess', _23 => _23.wrappedAsset, 'access', _24 => _24.address, 'optionalAccess', _25 => _25.toLowerCase, 'call', _26 => _26()])},[v,a,i]),G=_react.useMemo.call(void 0, ()=>{if(!_optionalChain([a, 'optionalAccess', _27 => _27.chainId])||!i||!y||a.chainId!==i.chainId||a.chainId===988)return!1;let s=_chunkSE6JOLEMcjs.c.call(void 0, a.chainId);return a.address.toLowerCase()===_optionalChain([s, 'optionalAccess', _28 => _28.wrappedAsset, 'access', _29 => _29.address, 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()])},[a,i,y]),M=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _32 => _32.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _33 => _33.formatted]), () => ("0"))}),[b]),_=_react.useMemo.call(void 0, ()=>({raw:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _34 => _34.raw]), () => ("0")),formatted:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _35 => _35.formatted]), () => ("0"))}),[C]),z=_react.useMemo.call(void 0, ()=>!a||typeof r!="number"||a.decimals===void 0||a.decimals===null?null:_viem.parseUnits.call(void 0, r.toFixed(a.decimals),a.decimals).toString(),[a,r]),J=_react.useMemo.call(void 0, ()=>!i||typeof p!="number"||i.decimals===void 0||i.decimals===null?null:_viem.parseUnits.call(void 0, p.toFixed(i.decimals),i.decimals).toString(),[i,p]),K=_react.useCallback.call(void 0, async s=>{h(s),m(null),_optionalChain([c, 'optionalCall', _36 => _36(s)])},[h,m,c]),X=_react.useCallback.call(void 0, async s=>{f(s),_optionalChain([o, 'optionalCall', _37 => _37(s)])},[f,o]),Y=_react.useCallback.call(void 0, s=>g(s),[g]),Z=_react.useCallback.call(void 0, s=>m(s),[m]),$=_react.useCallback.call(void 0, ()=>{w(),F.getState().toggleInverted(),l&&_optionalChain([c, 'optionalCall', _38 => _38(l)]),t&&_optionalChain([o, 'optionalCall', _39 => _39(t)])},[w,t,l,c,o]),j=_react.useCallback.call(void 0, ()=>Q(),[Q]);return{baseToken:a,baseAmount:r,quoteToken:i,quoteAmount:p,isBaseGasToken:v,isQuoteGasToken:y,isWrappingPair:V,isUnwrappingPair:G,baseBalance:M,quoteBalance:_,baseAmountRaw:z,quoteAmountRaw:J,isBaseBalanceLoading:D,isQuoteBalanceLoading:D,isRegistryLoading:u,setBaseToken:K,setQuoteToken:X,setBaseAmount:Y,setQuoteAmount:Z,swapTokens:$,clearForm:j}};var _jsxruntime = require('react/jsx-runtime');var N=_react.createContext.call(void 0, null),Be= exports.e =({children:n,defaultBaseToken:e,defaultQuoteToken:c,onBaseTokenChange:o,onQuoteTokenChange:T})=>{let t=U(e,c,o,T),l=_react.useMemo.call(void 0, ()=>t,[t.baseToken,t.quoteToken,t.baseAmount,t.quoteAmount,t.isBaseGasToken,t.isQuoteGasToken,t.isWrappingPair,t.isUnwrappingPair,t.baseBalance,t.quoteBalance,t.baseAmountRaw,t.quoteAmountRaw,t.isBaseBalanceLoading,t.isQuoteBalanceLoading,t.setBaseToken,t.setQuoteToken,t.setBaseAmount,t.setQuoteAmount,t.swapTokens,t.clearForm,t.isRegistryLoading]);return _jsxruntime.jsx.call(void 0, N.Provider,{value:l,children:n})},qe= exports.f =()=>{let n=_react.useContext.call(void 0, N);if(!n)throw new Error("useSwapFormContext must be used within SwapFormProvider");return n};exports.a = x; exports.b = W; exports.c = F; exports.d = U; exports.e = Be; exports.f = qe;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkGDIG4JLQcjs = require('./chunk-GDIG4JLQ.cjs');var _chunkBJYKILHScjs = require('./chunk-BJYKILHS.cjs');var _chunkTCAVGM6Ycjs = require('./chunk-TCAVGM6Y.cjs');var _chunkSE6JOLEMcjs = require('./chunk-SE6JOLEM.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');function x(a){if(a===0)return"0";let o=Math.abs(a);return o>=1e4?a.toFixed(0):o>=1e3?a.toFixed(1):o>=100?a.toFixed(2):o>=1?a.toFixed(4):o>=.01?a.toFixed(6):a.toExponential(3)}var N=_react2.default.memo(()=>{let[a,o]=_react.useState.call(void 0, !1),{liquidityError:b,routingError:h}=_chunkGDIG4JLQcjs.e.call(void 0, ),{baseAmount:r,baseToken:s,quoteAmount:l,quoteToken:i}=_chunkBJYKILHScjs.f.call(void 0, ),{quoteLoaderVariant:p,widgetType:F}=_chunkTCAVGM6Ycjs.b.call(void 0, ),u=F==="compact",n=r&&l&&parseFloat(l.toString())?parseFloat(r.toString())/parseFloat(l.toString()):0,v=b||h,c=s&&i&&r&&parseFloat(r.toString())&&l;return _react.useEffect.call(void 0, ()=>{p==="expanded"&&c&&o(!0)},[p,c]),p==="none"?null:p==="default"?_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center${u?" justify-start overflow-x-auto":" justify-center"}`,children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _ => _.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _2 => _2.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _3 => _3.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.V,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.V,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${u?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>c&&o(d=>!d),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c&&o(S=>!S))},children:_jsxruntime.jsx.call(void 0, "div",{className:`flex h-full items-center${u?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&i?r&&parseFloat(r.toString())?l?_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-mono flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:i,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:["1 ",_optionalChain([i, 'optionalAccess', _4 => _4.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.N,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",children:[x(n)," ",_optionalChain([s, 'optionalAccess', _5 => _5.symbol])]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:_optionalChain([s, 'optionalAccess', _6 => _6.price])?`\u2248 $${(s.price*n).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:a?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):v?_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.V,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),_jsxruntime.jsx.call(void 0, _chunkSE6JOLEMcjs.V,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"}):_jsxruntime.jsx.call(void 0, "div",{className:"text-xs pb-1",style:{color:"var(--widget-foreground)",opacity:.4},children:"Enter Amount"})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:a&&c?"80px":"0px",opacity:a&&c?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5 pb-1 font-mono",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{children:["$",_optionalChain([s, 'optionalAccess', _7 => _7.price])&&l?(s.price*n*parseFloat(l.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Rate"}),_jsxruntime.jsx.call(void 0, "span",{className:"uppercase",children:n>0?`${x(n)} ${_nullishCoalesce(_optionalChain([s, 'optionalAccess', _8 => _8.symbol]), () => (""))}`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{children:"RFQ (Exact Fill)"})]})]})})]})});N.displayName="QuoteLoader";var R=N;exports.a = R;