@aori/mega-swap-widget 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssetSelectionMenu-QAYGXIZN.cjs +2 -0
- package/dist/AssetSelectionMenu-XUE3KY7F.js +2 -0
- package/dist/ChainSelectionMenu-73IHIGGD.cjs +2 -0
- package/dist/ChainSelectionMenu-IFRFS3IB.js +2 -0
- package/dist/SwapFormHorizontal-MGK4QJBZ.js +2 -0
- package/dist/SwapFormHorizontal-PNSM7UFE.cjs +2 -0
- package/dist/SwapFormSplit-GLQEEJSQ.js +2 -0
- package/dist/SwapFormSplit-MT5WGEMG.cjs +2 -0
- package/dist/WidgetWalletPanel-43R52FTI.js +2 -0
- package/dist/WidgetWalletPanel-5H3BVAXR.cjs +2 -0
- package/dist/WidgetWalletTradeHistory-CW34HAHS.cjs +2 -0
- package/dist/WidgetWalletTradeHistory-QXIWCKMB.js +2 -0
- package/dist/chunk-2QYGEJLV.js +2 -0
- package/dist/chunk-35CBCDGI.js +27 -0
- package/dist/chunk-3FVOOU2E.cjs +2 -0
- package/dist/chunk-6CVCMRAL.cjs +27 -0
- package/dist/chunk-6JPANU3S.js +2 -0
- package/dist/chunk-6KEQ2NDQ.cjs +2 -0
- package/dist/chunk-7MGPLHPI.cjs +2 -0
- package/dist/chunk-A3P6SA6P.cjs +2 -0
- package/dist/chunk-IRK2XRZH.js +2 -0
- package/dist/chunk-MNP2YHUY.js +2 -0
- package/dist/chunk-OIE7DWV7.js +2 -0
- package/dist/chunk-PCI6C7N4.js +2 -0
- package/dist/chunk-S2KAWPNR.js +2 -0
- package/dist/{chunk-UZWGYG2S.cjs → chunk-X7THKL37.cjs} +1 -1
- package/dist/chunk-XLIAXB6G.cjs +2 -0
- package/dist/chunk-YQLGWDSC.cjs +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/AssetSelectionMenu-4E576X3D.cjs +0 -2
- package/dist/AssetSelectionMenu-ZFY7XFRX.js +0 -2
- package/dist/ChainSelectionMenu-SKXLHK3S.js +0 -2
- package/dist/ChainSelectionMenu-VU3SIBVL.cjs +0 -2
- package/dist/SwapFormHorizontal-GI4X7ISS.js +0 -2
- package/dist/SwapFormHorizontal-V557YBX2.cjs +0 -2
- package/dist/SwapFormSplit-52RBMJIO.js +0 -2
- package/dist/SwapFormSplit-PQCS3BPT.cjs +0 -2
- package/dist/WidgetWalletPanel-XYV3YL4I.js +0 -2
- package/dist/WidgetWalletPanel-YBMN5KZH.cjs +0 -2
- package/dist/chunk-4BQRVCQR.js +0 -2
- package/dist/chunk-4LJJMEOG.js +0 -2
- package/dist/chunk-726CI6GC.js +0 -2
- package/dist/chunk-DUIRZSBV.cjs +0 -2
- package/dist/chunk-EW2OR6CJ.js +0 -27
- package/dist/chunk-FDQKBTWP.js +0 -2
- package/dist/chunk-HTWUZKYO.cjs +0 -2
- package/dist/chunk-LXEKOQAG.cjs +0 -27
- package/dist/chunk-MCT3UZTP.cjs +0 -2
- package/dist/chunk-XYF2YBR3.js +0 -2
- package/dist/chunk-XZRXVBSB.cjs +0 -2
|
@@ -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 _chunkX7THKL37cjs = require('./chunk-X7THKL37.cjs');var _chunk6KEQ2NDQcjs = require('./chunk-6KEQ2NDQ.cjs');var _chunk6CVCMRALcjs = require('./chunk-6CVCMRAL.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 H=_react2.default.memo(({asset:n,otherAsset:i,handleFormSelection:S,getToken:G})=>{let{token:g}=_chunk6CVCMRALcjs.F.call(void 0, n.chainId,n.address),C=G(n.chainId,n.address),a=g||C||n.assetInfo;if(!a)return null;let f=a.price!=null&&n.decimals!==void 0?_chunk6CVCMRALcjs.u.call(void 0, a,n.balance,n.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:()=>S(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, _chunk6CVCMRALcjs.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:f!=null?`$${f.toFixed(2)}`:"\u2014"})]})]},`${a.chainId}-${a.address}`)},(n,i)=>n.asset.address===i.asset.address&&n.asset.chainId===i.asset.chainId&&n.asset.balance===i.asset.balance&&_optionalChain([n, '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])&&n.otherAsset.address===i.otherAsset.address);H.displayName="AssetSelectionBalanceItem";var Ne=({toggle:n,side:i,otherAsset:S,containerHeight:G,onChainHover:g,onMoreChainsClick:C,selectedChainFilter:a})=>{let{address:_}=_chunk34N36GUDcjs.a.call(void 0, ),{assetSelectionSearch:f,assetSelectionChain:c,assetSelectionCategory:le,recentChainIds:W}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, e=>({assetSelectionSearch:e.assetSelectionSearch,assetSelectionChain:e.assetSelectionChain,assetSelectionCategory:e.assetSelectionCategory,recentChainIds:e.recentChainIds}))),L=_chunk6CVCMRALcjs.x.call(void 0, f,300),b=_chunk6KEQ2NDQcjs.c.call(void 0, ),{supportedInputTokens:de,supportedOutputTokens:ce,supportedInputChains:ue,supportedOutputChains:me,inputSelectionSearch:fe,outputSelectionSearch:pe,showInputSelectionTokenBalances:he,showOutputSelectionTokenBalances:ge}=_chunk6KEQ2NDQcjs.b.call(void 0, ),we=i==="base"?fe:pe,be=i==="base"?he:ge,{setBaseToken:q,setQuoteToken:V}=_chunkX7THKL37cjs.f.call(void 0, ),y=i==="base"?de:ce,w=i==="base"?ue:me,B=w.length===1,v=_react.useMemo.call(void 0, ()=>{if(y.length===0)return null;let e=new Set;for(let t of y)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[y]);_react.useEffect.call(void 0, ()=>{B?_chunkX7THKL37cjs.c.getState().setAssetSelectionChain(w[0]):a&&_chunkX7THKL37cjs.c.getState().setAssetSelectionChain(a)},[a,B,w]);let ye=_react2.default.useMemo(()=>{let r=w.length>0?new Set(w):null,s=_chunk6CVCMRALcjs.e.call(void 0, b).filter(l=>!r||r.has(l.id)).map(l=>({chainId:l.id,name:l.displayName})),d=new Map(s.map(l=>[l.chainId,l])),u=[],h=new Set,Q=d.get(4326);Q&&(u.push(Q),h.add(4326));for(let l of W){if(u.length>=5)break;if(h.has(l))continue;let U=d.get(l);U&&(u.push(U),h.add(l))}for(let l of s){if(u.length>=5)break;h.has(l.chainId)||u.push(l)}return u},[b,W,w]),{enrichedTokens:M,isLoading:ve}=_chunk6CVCMRALcjs.E.call(void 0, c==="all"?"all":c),{tokenRegistry:j,getToken:D}=_chunk6CVCMRALcjs.D.call(void 0, ),xe=_react.useMemo.call(void 0, ()=>{let e=new Set;for(let t of j)e.add(`${t.chainId}-${t.address.toLowerCase()}`);return e},[j]),E=_react.useMemo.call(void 0, ()=>v?M.filter(e=>v.has(`${e.chainId}-${e.address.toLowerCase()}`)):M,[M,v]),R=_react2.default.useMemo(()=>{if(!L)return E;let e=L.toLowerCase();return E.filter(t=>(t.symbol||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||t.address.toLowerCase().includes(e))},[E,L]),O=_react2.default.useMemo(()=>{let e=c==="all"?(R||[]).filter(s=>b.includes(s.chainId)):R||[],t=new Set;return[...e.filter(s=>{let d=`${s.chainId}-${s.address.toLowerCase()}`;return t.has(d)?!1:(t.add(d),!0)})].sort((s,d)=>{let u=_chunk6CVCMRALcjs.i.call(void 0, s),h=_chunk6CVCMRALcjs.i.call(void 0, d);return u&&!h?-1:!u&&h?1:s.marketCap&&!d.marketCap?-1:!s.marketCap&&d.marketCap?1:!s.marketCap&&!d.marketCap?0:d.marketCap-s.marketCap})},[R,c,b]),{balances:k,isLoading:Ie}=_chunk6CVCMRALcjs.J.call(void 0, _,b,void 0,y.length>0?y:void 0),P=_react2.default.useMemo(()=>{if(!k)return[];let e=c==="all"?k:k.filter(r=>r.chainId===c),t=new Set;return e.filter(r=>{let s=`${r.chainId}-${(r.address||"").toLowerCase()}`;return t.has(s)?!1:(t.add(s),!0)})},[k,c]),Se=_react.useCallback.call(void 0, e=>{let t=e.target.value.toLowerCase(),r=_chunk6CVCMRALcjs.v.call(void 0, t),s=_chunkX7THKL37cjs.c.getState();r?(s.setAssetSelectionSearch(r),s.setAssetSelectionAddressInput(r)):(s.setAssetSelectionAddressInput(""),s.setAssetSelectionSearch(t))},[]),F=_react.useCallback.call(void 0, async e=>{i==="base"?await q(e):i==="quote"&&await V(e),n()},[n,i,q,V]);return _jsxruntime.jsxs.call(void 0, "div",{className:"w-full h-full flex flex-col pt-2.5",children:[!B&&_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:c==="all"&&!a?"var(--widget-primary)":"var(--widget-secondary)",color:c==="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(),_chunkX7THKL37cjs.c.getState().setAssetSelectionChain("all")},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _8 => _8("All Chains")]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _9 => _9(null)]),children:"All"}),ye.map((e,t)=>_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"flex items-center justify-center px-2 w-full cursor-pointer",style:{backgroundColor:c===e.chainId?"var(--widget-primary)":"var(--widget-secondary)",color:c===e.chainId?"var(--widget-primary-foreground)":"var(--widget-secondary-foreground)",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)",borderLeft:t===0?"none":"1px solid var(--widget-border)",borderRight:"1px solid var(--widget-border)"},onClick:r=>{r.stopPropagation(),_chunkX7THKL37cjs.c.getState().setAssetSelectionChain(e.chainId)},onMouseEnter:()=>_optionalChain([g, 'optionalCall', _10 => _10(e.name)]),onMouseLeave:()=>_optionalChain([g, 'optionalCall', _11 => _11(null)]),children:_jsxruntime.jsx.call(void 0, "div",{className:"mb-px h-4 w-4",children:_jsxruntime.jsx.call(void 0, _chunk6CVCMRALcjs.M,{chain:e.chainId,size:"xs"})})},e.chainId)),C&&_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(),C()},children:"More"})]}),we&&_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:f,onChange:Se}),f&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkX7THKL37cjs.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:[be&&!Ie&&P.length>0&&!f&&le==="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"}),P.filter(e=>e.assetInfo?v?v.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):_chunk6CVCMRALcjs.i.call(void 0, e.assetInfo)||xe.has(`${e.assetInfo.chainId}-${e.assetInfo.address.toLowerCase()}`):!1).sort((e,t)=>{let r=D(e.chainId,e.address)||e.assetInfo,s=D(t.chainId,t.address)||t.assetInfo,d=r&&e.decimals!==void 0?_chunk6CVCMRALcjs.u.call(void 0, r,e.balance,e.decimals):0;return(s&&t.decimals!==void 0?_chunk6CVCMRALcjs.u.call(void 0, s,t.balance,t.decimals):0)-d}).map(e=>!e.assetInfo||!S?null:_jsxruntime.jsx.call(void 0, H,{asset:e,otherAsset:S,handleFormSelection:F,getToken:D},`${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:f?"Search Results":"Supported Tokens"}),ve?_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..."})}):O.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"}):O.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:()=>F(e),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),F(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, _chunk6CVCMRALcjs.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}`))]})]})},Ue= exports.a =Ne;exports.a = Ue;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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; } var _class;"use client";
|
|
2
|
-
var _chunkDUIRZSBVcjs = require('./chunk-DUIRZSBV.cjs');var _chunkMCT3UZTPcjs = require('./chunk-MCT3UZTP.cjs');require('./chunk-KH57FLST.cjs');var _chunkUZWGYG2Scjs = require('./chunk-UZWGYG2S.cjs');var _chunkLXEKOQAGcjs = require('./chunk-LXEKOQAG.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var qt=({onSwapComplete:e,onSwapInitiated:t})=>{let{web3ConnectionType:c,hasConnectHandler:a,lockBase:s,lockQuote:b,disableInverting:k,tokenDisplay:N,tokenBadgeOrientation:W,widgetType:w}=_chunkLXEKOQAGcjs.b.call(void 0, ),S=N==="pill"||N==="ghost",C=w==="compact",I=C?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",O=C?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:r,quoteToken:i,baseAmount:d,quoteAmount:T,isBaseGasToken:X,isQuoteGasToken:L,isWrappingPair:u,isUnwrappingPair:g,baseBalance:m,quoteBalance:Y,setBaseAmount:R,setQuoteAmount:h,swapTokens:U,clearForm:M}=_chunkUZWGYG2Scjs.f.call(void 0, ),{rfqQuote:j,status:G,handleInputChange:H,ensureForParams:B,stop:z,clear:q,refresh:v}=_chunkMCT3UZTPcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Z}=_chunkMCT3UZTPcjs.g.call(void 0, ),{isRecipientInputOpen:E,txStatus:$}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isRecipientInputOpen:o.isRecipientInputOpen,txStatus:o.txStatus}))),[D,ee]=_react.useState.call(void 0, null),[Q,te]=_react.useState.call(void 0, null),ie=_react.useRef.call(void 0, !1),y=!1,J=_react.useMemo.call(void 0, ()=>!r||!i||typeof d!="number"||!T||!x||parseFloat(m.formatted)<d?null:{base:r,quote:i,baseAmount:d,quoteAmount:T,userAddress:x},[r,i,d,T,x,m.formatted]),ve=_react.useCallback.call(void 0, o=>{te(o),_chunkUZWGYG2Scjs.c.getState().startTracking(o)},[]),be=_react.useCallback.call(void 0, ()=>{ie.current=!0,v()},[v]);_react.useEffect.call(void 0, ()=>{if(D===null&&!(!r||!i)){if(!d||d<=0){H({amount:null,inputToken:r,outputToken:i,setOutputAmount:h});return}if(u||g){h(d);return}H({amount:d,inputToken:r,outputToken:i,setOutputAmount:h})}},[D,d,r,i,u,g,H,h]);let le=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("baseSelection")},[]),ye=_react.useCallback.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().setView("quoteSelection")},[]),xe=_react.useCallback.call(void 0, ()=>{U(),h(null)},[U,h]),ce=_react.useCallback.call(void 0, ()=>{if(!m.formatted||!r||!i)return;let o=parseFloat(m.formatted);if(!o||o<=0)return;let V=o*.9999999999;u||g?(R(V),h(V),q()):(R(V),h(null),B({inputToken:r,outputToken:i,inputAmount:V.toString(),setOutputAmount:re=>h(re)}))},[m.formatted,r,i,u,g,R,h,q,B]),Ne=_react.useCallback.call(void 0, ()=>{q(),M()},[q,M]),we=m.formatted?parseFloat(m.formatted):null,ke=!!(d||T),Se=_optionalChain([r, 'optionalAccess', _2 => _2.price])&&d?`$${(r.price*d).toFixed(2)}`:"$0.00",Ae=_optionalChain([i, 'optionalAccess', _3 => _3.price])&&T?`$${(i.price*T).toFixed(2)}`:"$0.00",Ce=D==="trackingTx"&&!!Q&&!!r&&!!i&&!!d&&!!T;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[Ce&&Q&&r&&i&&d&&T?_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.w,{orderHash:Q,base:r,quote:i,baseAmount:d,quoteAmount:T,status:$})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${I}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 mb-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(i, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(i, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(i, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}),_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:Se}),x&&we!==null&&we>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ce,disabled:y,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&_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:xe,"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:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${O}`,children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(i, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(i, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.i,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.h,{side:"quote",asset:_nullishCoalesce(i, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}),_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:Ae}),ke&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ne,disabled:y,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:E?"1px solid var(--widget-border)":"none",maxHeight:E?"60px":"0px",opacity:E?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.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, _chunkDUIRZSBVcjs.a,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Ce?"px-0":"px-4"} ${C?"py-2":"py-4"}`,children:x&&r&&i&&d&&d>0?_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.v,{base:r,baseAmount:d,quote:i,quoteAmount:_nullishCoalesce(T, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:g,isBaseGasToken:X,isQuoteGasToken:L,reviewActionProps:J,reviewState:D,setReviewState:ee,trackedOrderHash:Q,setTrackedOrderHash:te,onSwapComplete:e,onSwapInitiated:t,onOrderSubmitted:ve,onStaleQuoteRestart:be,txStatus:$}):!x&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Z(),className:`w-full ${C?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${C?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:x?"Enter Amount":"Connect Wallet"})})]})},rt=qt;var at=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-6 pb-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"relative px-4 py-4",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});var Ht=({targetText:e,isError:t})=>{let{displayText:c,suffix:a,characterColors:s}=_chunkLXEKOQAGcjs.A.call(void 0, e,t);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[c.split("").map((b,k)=>_jsxruntime.jsx.call(void 0, "span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:b},k)),_jsxruntime.jsx.call(void 0, "span",{style:{color:t?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:t?.5:1},children:a})]})},Vt=({headerText:e,onBackClick:t,isSameChain:c,isWrappingPair:a,isUnwrappingPair:s,hasLowLiquidity:b,hasInsufficientLiquidity:k,hasRoutingError:N,hasSizeCapError:W})=>{let w=_chunkUZWGYG2Scjs.c.call(void 0, v=>v.view),{isRecipientInputOpen:S,hasAllowanceError:C,hoveredChainName:I,isTrackingTx:O,txStatus:r,walletTab:i}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, v=>({isRecipientInputOpen:v.isRecipientInputOpen,hasAllowanceError:v.hasAllowanceError,hoveredChainName:v.hoveredChainName,isTrackingTx:v.isTrackingTx,txStatus:v.txStatus,walletTab:v.walletTab}))),{web3ConnectionType:d,swapHeaderVariant:T,customWalletUI:X,walletButtonEnabled:L}=_chunkLXEKOQAGcjs.b.call(void 0, ),{isConnected:u}=_chunk34N36GUDcjs.a.call(void 0, ),{openAccountModal:g}=_chunkMCT3UZTPcjs.g.call(void 0, ),[m,Y]=_react.useState.call(void 0, !1);_react.useEffect.call(void 0, ()=>Y(!0),[]);let[R,h]=_react.useState.call(void 0, !1),U=`${w}-${R}-${S}-${I||"none"}`,j=(()=>{if(O&&r)switch(r){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(I&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"))return I;if(w==="swap"&&R)return S?"Remove Custom Recipient":"Add Custom Recipient";switch(w){case"wallet":return"Wallet";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(w==="swap"){if(C&&!a&&!s)return"Allowance check failed";if(W&&!a&&!s)return"Size limit exceeded";if(k&&!a&&!s)return"Insufficient Liquidity";if(N&&!a&&!s)return"Route Not Found";if(b&&!a&&!s)return"High Price Impact"}return c&&!a&&!s?"Swap":a?"Wrap":s?"Unwrap":e}})(),G=!O&&w==="swap"&&!R&&(C&&!a&&!s||W&&!a&&!s||k&&!a&&!s||N&&!a&&!s||b&&!a&&!s),H={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},B=()=>!O||!r?null:_nullishCoalesce(H[r], () => (null)),z=()=>O?null:w==="swap"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[L&&m&&d==="custom"&&u&&_jsxruntime.jsx.call(void 0, "button",{onClick:()=>{X==="provider"&&g?g():_chunkUZWGYG2Scjs.c.getState().setView("wallet")},"aria-label":"Open wallet",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),L&&m&&d==="standalone"&&u&&g&&_jsxruntime.jsx.call(void 0, "button",{onClick:()=>g(),"aria-label":"Open account",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkUZWGYG2Scjs.c.getState().toggleRecipientInput(),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),"aria-label":S?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${S?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),_jsxruntime.jsxs.call(void 0, "g",{style:{transform:`rotate(${S?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[_jsxruntime.jsx.call(void 0, "path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>t?t():_chunkUZWGYG2Scjs.c.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[_jsxruntime.jsx.call(void 0, "span",{className:"pr-1",children:"\u2190"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:"Back"})]}),q=B();return T==="none"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[w==="wallet"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>_chunkUZWGYG2Scjs.c.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:i==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{children:"Wallet"})]}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkUZWGYG2Scjs.c.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:i==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{className:"relative",style:{color:q||"var(--widget-foreground)"},children:_jsxruntime.jsx.call(void 0, Ht,{targetText:j,isError:_nullishCoalesce(G, () => (!1))})},U)]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center",children:z()})]})},Be=Vt;var st=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./AssetSelectionMenu-4E576X3D.cjs")))),dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./ChainSelectionMenu-VU3SIBVL.cjs")))),jt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormHorizontal-V557YBX2.cjs")))),$t=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormSplit-PQCS3BPT.cjs")))),Dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletPanel-YBMN5KZH.cjs"))).then(e=>({default:e.WidgetWalletPanel}))),Qt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WalletPlaceholderPanel-TTONBBI4.cjs"))).then(e=>({default:e.WalletPlaceholderPanel}))),_t=({onSwapComplete:e,cardStyles:t,cardWidth:c})=>{let{baseToken:a,quoteToken:s,baseAmount:b,quoteAmount:k,isWrappingPair:N,isUnwrappingPair:W,isRegistryLoading:w}=_chunkUZWGYG2Scjs.f.call(void 0, ),{liquidityError:S,routingError:C,sizeCapError:I,stop:O,clear:r}=_chunkMCT3UZTPcjs.e.call(void 0, ),i=_chunkUZWGYG2Scjs.c.call(void 0, o=>o.view),{isTransitioning:d,isRecipientInputOpen:T,recipient:X,selectedChainFilterChainId:L}=_chunkUZWGYG2Scjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isTransitioning:o.isTransitioning,isRecipientInputOpen:o.isRecipientInputOpen,recipient:o.recipient,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([o, 'access', _4 => _4.selectedChainFilter, 'optionalAccess', _5 => _5.chainId]), () => (null))}))),u=_react.useRef.call(void 0, null),g=_react.useRef.call(void 0, null),[m,Y]=_react.useState.call(void 0, null);_chunkMCT3UZTPcjs.c.call(void 0, ),_react.useEffect.call(void 0, ()=>()=>{u.current&&clearTimeout(u.current),g.current&&clearTimeout(g.current)},[]),_react.useEffect.call(void 0, ()=>{_chunkUZWGYG2Scjs.c.getState().resetUI()},[]),_react.useEffect.call(void 0, ()=>{if(d)return u.current=setTimeout(()=>{_chunkUZWGYG2Scjs.c.getState().setIsTransitioning(!1),u.current=null},20),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[d]);let R=_react.useCallback.call(void 0, (o,V="navigation")=>{g.current&&(clearTimeout(g.current),g.current=null,Y(null)),_chunkUZWGYG2Scjs.c.getState().view!=="swap"&&o!=="swap"?(_chunkUZWGYG2Scjs.c.getState().setView(o),_chunkUZWGYG2Scjs.c.getState().setIsTransitioning(!1)):_chunkUZWGYG2Scjs.c.getState().transitionToView(o,V)},[]),h=_react.useCallback.call(void 0, ()=>{u.current&&(clearTimeout(u.current),u.current=null),g.current&&(clearTimeout(g.current),g.current=null);let o=_chunkUZWGYG2Scjs.c.getState().view;Y(o),_chunkUZWGYG2Scjs.c.getState().setChainFilter(null),_chunkUZWGYG2Scjs.c.getState().setView("swap"),_chunkUZWGYG2Scjs.c.getState().setIsTransitioning(!1),_chunkUZWGYG2Scjs.c.getState().resetAssetSelection(),g.current=setTimeout(()=>{Y(null),g.current=null},200)},[]),U=_react.useCallback.call(void 0, o=>{let re=i==="baseChainSelection"?"base":"quote";_chunkUZWGYG2Scjs.c.getState().setChainFilter({chainId:o,side:re}),_chunkUZWGYG2Scjs.c.getState().pushRecentChain(o),R(re==="base"?"baseSelection":"quoteSelection","chainSelection")},[i,R]),M=_react.useCallback.call(void 0, ()=>{let o=_chunkUZWGYG2Scjs.c.getState().view;o==="baseSelection"?R("baseChainSelection","chainSelection"):o==="quoteSelection"&&R("quoteChainSelection","chainSelection")},[R]),j=_react.useCallback.call(void 0, ()=>{O(),r()},[O,r]),G=a&&s?a.chainId===s.chainId:!0,H=()=>{switch(i){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:B,widgetType:z,customWalletUI:q}=_chunkLXEKOQAGcjs.b.call(void 0, ),v=i==="baseSelection"||i==="quoteSelection",x=i==="baseChainSelection"||i==="quoteChainSelection",Z=B==="split"&&(z==="default"||z==="compact"),E=B==="split"&&(z==="horizontal"||z==="split"),$=B==="default",D=i==="swap"||v||x||i==="wallet",ee=m==="baseSelection"||m==="quoteSelection",Q=m==="baseChainSelection"||m==="quoteChainSelection",te=v||ee,ie=x||Q,y=v&&!d,J=x&&!d,ve=v?i:m,be=ve==="baseSelection"?"base":"quote",le=ve==="baseSelection"?s:a,xe=(x?i:m)==="baseChainSelection"?"base":"quote",ce=o=>({backgroundColor:"var(--widget-background)",opacity:o?1:0,transform:o?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),Ne=$&&(v||x||i==="wallet"||m!=null),we=w?_jsxruntime.jsx.call(void 0, at,{}):z==="horizontal"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, jt,{onSwapComplete:e,onSwapInitiated:j,onBackToSwap:E?h:void 0,onMoreChainsClick:E?M:void 0})}):z==="split"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, $t,{onSwapComplete:e,onSwapInitiated:j,onBackToSwap:E?h:void 0,onMoreChainsClick:E?M:void 0})}):_jsxruntime.jsx.call(void 0, rt,{onSwapComplete:e,onSwapInitiated:j}),ke=_nullishCoalesce(t, () => ({})),Se=_react.useRef.call(void 0, null),[Ae,Ce]=_react.useState.call(void 0, 420);return _react.useEffect.call(void 0, ()=>{if(!Z)return;let o=Se.current;if(!o)return;let V=new ResizeObserver(re=>{for(let ft of re)Ce(ft.contentRect.height)});return V.observe(o),()=>V.disconnect()},[Z]),Z?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:Se,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...ke},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:"Swap",onBackClick:h,isSameChain:G,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:I}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:we})]}),(te||ie)&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:c,height:`${Ae}px`,...ke,...ce((v||x)&&!d)},children:v||ee?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:h,side:be,otherAsset:le,onMoreChainsClick:M,selectedChainFilter:L})}):_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:h,side:xe,onChainSelect:U})})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:H(),onBackClick:h,isSameChain:G,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:I}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative overflow-hidden",children:[D&&_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",style:Ne?{pointerEvents:"none"}:void 0,children:we}),(i==="wallet"||m==="wallet")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ce(i==="wallet"&&!d),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:q==="none"?_jsxruntime.jsx.call(void 0, Qt,{}):_jsxruntime.jsx.call(void 0, Dt,{})})}),$&&te&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ce(y),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:h,side:be,otherAsset:le,onMoreChainsClick:M,selectedChainFilter:L})})}),$&&ie&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ce(J),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:h,side:xe,onChainSelect:U})})})]})]})},lt=({onSwapComplete:e,defaultBaseToken:t,defaultQuoteToken:c,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:b,cardWidth:k})=>{let{address:N}=_chunk34N36GUDcjs.a.call(void 0, ),W=_chunkUZWGYG2Scjs.c.call(void 0, w=>w.recipient);return _jsxruntime.jsx.call(void 0, _chunkUZWGYG2Scjs.e,{defaultBaseToken:t,defaultQuoteToken:c,onBaseTokenChange:a,onQuoteTokenChange:s,children:_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.d,{recipient:W,children:_jsxruntime.jsx.call(void 0, _t,{onSwapComplete:e,cardStyles:b,cardWidth:k})})})};var Ee={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},he= exports.defaultDarkTheme ={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Fe(e){let t={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return t["--widget-font-sans"]=e["font-sans"]||"inherit",t["--widget-font-mono"]=e["font-mono"]||"inherit",t["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",t["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",t["--widget-shadow-blur"]=e["shadow-blur"]||"3px",t["--widget-shadow-spread"]=e["shadow-spread"]||"0px",t["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",t["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",t["--widget-letter-spacing"]=e["letter-spacing"]||"normal",t["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",t["--widget-status-received"]=e["status-received"]||"#fbbf24",t["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",t["--widget-status-failed"]=e["status-failed"]||"#fb7185",t}var ct=_react.createContext.call(void 0, he);function He({theme:e,children:t}){return _jsxruntime.jsx.call(void 0, ct.Provider,{value:e,children:t})}function Zt(){return _react.useContext.call(void 0, ct)}var ei=[],ti=[],ii=[],pt=[],ri=`
|
|
2
|
+
var _chunkXLIAXB6Gcjs = require('./chunk-XLIAXB6G.cjs');var _chunk7MGPLHPIcjs = require('./chunk-7MGPLHPI.cjs');require('./chunk-KH57FLST.cjs');var _chunkX7THKL37cjs = require('./chunk-X7THKL37.cjs');var _chunk6KEQ2NDQcjs = require('./chunk-6KEQ2NDQ.cjs');var _chunk6CVCMRALcjs = require('./chunk-6CVCMRAL.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var qt=({onSwapComplete:e,onSwapInitiated:i})=>{let{web3ConnectionType:g,hasConnectHandler:a,lockBase:s,lockQuote:h,disableInverting:k,tokenDisplay:W,tokenBadgeOrientation:R,widgetType:w}=_chunk6KEQ2NDQcjs.b.call(void 0, ),S=W==="pill"||W==="ghost",C=w==="compact",O=C?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",z=C?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:r,quoteToken:t,baseAmount:d,quoteAmount:T,isBaseGasToken:ee,isQuoteGasToken:K,isWrappingPair:u,isUnwrappingPair:p,baseBalance:f,quoteBalance:Y,setBaseAmount:N,setQuoteAmount:v,swapTokens:V,clearForm:M}=_chunkX7THKL37cjs.f.call(void 0, ),{rfqQuote:L,status:G,handleInputChange:q,ensureForParams:y,stop:E,clear:U,refresh:A}=_chunk7MGPLHPIcjs.e.call(void 0, ),{address:x}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Z}=_chunk7MGPLHPIcjs.g.call(void 0, ),{isRecipientInputOpen:B,txStatus:$}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isRecipientInputOpen:o.isRecipientInputOpen,txStatus:o.txStatus}))),[j,te]=_react.useState.call(void 0, null),[D,ie]=_react.useState.call(void 0, null),re=_react.useRef.call(void 0, !1),b=!1,J=_react.useMemo.call(void 0, ()=>!r||!t||typeof d!="number"||!T||!x||parseFloat(f.formatted)<d?null:{base:r,quote:t,baseAmount:d,quoteAmount:T,userAddress:x},[r,t,d,T,x,f.formatted]),he=_react.useCallback.call(void 0, o=>{ie(o),_chunkX7THKL37cjs.c.getState().startTracking(o)},[]),be=_react.useCallback.call(void 0, ()=>{re.current=!0,A()},[A]);_react.useEffect.call(void 0, ()=>{if(j===null&&!(!r||!t)){if(!d||d<=0){q({amount:null,inputToken:r,outputToken:t,setOutputAmount:v});return}if(u||p){v(d);return}q({amount:d,inputToken:r,outputToken:t,setOutputAmount:v})}},[j,d,r,t,u,p,q,v]);let ce=_react.useCallback.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().setView("baseSelection")},[]),ye=_react.useCallback.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().setView("quoteSelection")},[]),xe=_react.useCallback.call(void 0, ()=>{V(),v(null)},[V,v]),ae=_react.useCallback.call(void 0, ()=>{if(!f.formatted||!r||!t)return;let o=parseFloat(f.formatted);if(!o||o<=0)return;let F=o*.9999999999;u||p?(N(F),v(F),U()):(N(F),v(null),y({inputToken:r,outputToken:t,inputAmount:F.toString(),setOutputAmount:oe=>v(oe)}))},[f.formatted,r,t,u,p,N,v,U,y]),Ne=_react.useCallback.call(void 0, ()=>{U(),M()},[U,M]),pe=f.formatted?parseFloat(f.formatted):null,ke=!!(d||T),Se=_optionalChain([r, 'optionalAccess', _2 => _2.price])&&d?`$${(r.price*d).toFixed(2)}`:"$0.00",Ae=_optionalChain([t, 'optionalAccess', _3 => _3.price])&&T?`$${(t.price*T).toFixed(2)}`:"$0.00",Ce=j==="trackingTx"&&!!D&&!!r&&!!t&&!!d&&!!T;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[Ce&&D&&r&&t&&d&&T?_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.w,{orderHash:D,base:r,quote:t,baseAmount:d,quoteAmount:T,status:$})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${O}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 mb-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"base",asset:_nullishCoalesce(r, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:b,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:Se}),x&&pe!==null&&pe>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:ae,disabled:b,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&_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:xe,"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:"\u2191"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u2193"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${z}`,children:[S?C?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.i,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.h,{side:"quote",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(r, () => (null)),isPlacingOrder:b,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:Ae}),ke&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ne,disabled:b,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.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, _chunkXLIAXB6Gcjs.a,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${Ce?"px-0":"px-4"} ${C?"py-2":"py-4"}`,children:x&&r&&t&&d&&d>0?_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.v,{base:r,baseAmount:d,quote:t,quoteAmount:_nullishCoalesce(T, () => (0)),userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:ee,isQuoteGasToken:K,reviewActionProps:J,reviewState:j,setReviewState:te,trackedOrderHash:D,setTrackedOrderHash:ie,onSwapComplete:e,onSwapInitiated:i,onOrderSubmitted:he,onStaleQuoteRestart:be,txStatus:$}):!x&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Z(),className:`w-full ${C?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${C?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:x?"Enter Amount":"Connect Wallet"})})]})},rt=qt;var at=()=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative px-4 pt-6 pb-2",children:[_jsxruntime.jsx.call(void 0, "div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"relative px-4 py-4",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});var Ht=({targetText:e,isError:i})=>{let{displayText:g,suffix:a,characterColors:s}=_chunk6CVCMRALcjs.y.call(void 0, e,i);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[g.split("").map((h,k)=>_jsxruntime.jsx.call(void 0, "span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:h},k)),_jsxruntime.jsx.call(void 0, "span",{style:{color:i?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:i?.5:1},children:a})]})},Vt=({headerText:e,onBackClick:i,isSameChain:g,isWrappingPair:a,isUnwrappingPair:s,hasLowLiquidity:h,hasInsufficientLiquidity:k,hasRoutingError:W,hasSizeCapError:R})=>{let w=_chunkX7THKL37cjs.c.call(void 0, y=>y.view),{isRecipientInputOpen:S,hasAllowanceError:C,hoveredChainName:O,isTrackingTx:z,txStatus:r,walletTab:t}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, y=>({isRecipientInputOpen:y.isRecipientInputOpen,hasAllowanceError:y.hasAllowanceError,hoveredChainName:y.hoveredChainName,isTrackingTx:y.isTrackingTx,txStatus:y.txStatus,walletTab:y.walletTab}))),{swapHeaderVariant:d,walletButtonEnabled:T}=_chunk6KEQ2NDQcjs.b.call(void 0, ),{isConnected:ee}=_chunk34N36GUDcjs.a.call(void 0, ),[K,u]=_react.useState.call(void 0, !1);_react.useEffect.call(void 0, ()=>u(!0),[]);let[p,f]=_react.useState.call(void 0, !1),Y=`${w}-${p}-${S}-${O||"none"}`,v=(()=>{if(z&&r)switch(r){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(O&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"))return O;if(w==="swap"&&p)return S?"Remove Custom Recipient":"Add Custom Recipient";switch(w){case"wallet":return"Wallet";case"activity":return"Activity";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(w==="swap"){if(C&&!a&&!s)return"Allowance check failed";if(R&&!a&&!s)return"Size limit exceeded";if(k&&!a&&!s)return"Insufficient Liquidity";if(W&&!a&&!s)return"Route Not Found";if(h&&!a&&!s)return"High Price Impact"}return g&&!a&&!s?"Swap":a?"Wrap":s?"Unwrap":e}})(),V=!z&&w==="swap"&&!p&&(C&&!a&&!s||R&&!a&&!s||k&&!a&&!s||W&&!a&&!s||h&&!a&&!s),M={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},L=()=>!z||!r?null:_nullishCoalesce(M[r], () => (null)),G=()=>z?null:w==="swap"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2",children:[T&&K&&ee&&_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkX7THKL37cjs.c.getState().setView("activity"),"aria-label":"Open activity",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),_jsxruntime.jsx.call(void 0, "button",{onClick:()=>_chunkX7THKL37cjs.c.getState().toggleRecipientInput(),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),"aria-label":S?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${S?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:_jsxruntime.jsxs.call(void 0, "svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),_jsxruntime.jsx.call(void 0, "path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),_jsxruntime.jsxs.call(void 0, "g",{style:{transform:`rotate(${S?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[_jsxruntime.jsx.call(void 0, "path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),_jsxruntime.jsx.call(void 0, "path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):_jsxruntime.jsxs.call(void 0, "button",{onClick:()=>i?i():_chunkX7THKL37cjs.c.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[_jsxruntime.jsx.call(void 0, "span",{className:"pr-1",children:"\u2190"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",children:"Back"})]}),q=L();return d==="none"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[w==="wallet"?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:()=>_chunkX7THKL37cjs.c.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:t==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{children:"Wallet"})]}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>_chunkX7THKL37cjs.c.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:t==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),_jsxruntime.jsx.call(void 0, "span",{className:"relative",style:{color:q||"var(--widget-foreground)"},children:_jsxruntime.jsx.call(void 0, Ht,{targetText:v,isError:_nullishCoalesce(V, () => (!1))})},Y)]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center",children:G()})]})},Be=Vt;var st=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./AssetSelectionMenu-QAYGXIZN.cjs")))),dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./ChainSelectionMenu-73IHIGGD.cjs")))),$t=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormHorizontal-PNSM7UFE.cjs")))),jt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./SwapFormSplit-MT5WGEMG.cjs")))),Dt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletPanel-5H3BVAXR.cjs"))).then(e=>({default:e.WidgetWalletPanel}))),Qt=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WalletPlaceholderPanel-TTONBBI4.cjs"))).then(e=>({default:e.WalletPlaceholderPanel}))),_t=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./WidgetWalletTradeHistory-CW34HAHS.cjs"))).then(e=>({default:e.WidgetWalletTradeHistory}))),Kt=({onSwapComplete:e,cardStyles:i,cardWidth:g})=>{let{baseToken:a,quoteToken:s,baseAmount:h,quoteAmount:k,isWrappingPair:W,isUnwrappingPair:R,isRegistryLoading:w}=_chunkX7THKL37cjs.f.call(void 0, ),{liquidityError:S,routingError:C,sizeCapError:O,stop:z,clear:r}=_chunk7MGPLHPIcjs.e.call(void 0, ),t=_chunkX7THKL37cjs.c.call(void 0, o=>o.view),{isTransitioning:d,isRecipientInputOpen:T,recipient:ee,selectedChainFilterChainId:K}=_chunkX7THKL37cjs.c.call(void 0, _shallow.useShallow.call(void 0, o=>({isTransitioning:o.isTransitioning,isRecipientInputOpen:o.isRecipientInputOpen,recipient:o.recipient,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([o, 'access', _4 => _4.selectedChainFilter, 'optionalAccess', _5 => _5.chainId]), () => (null))}))),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),[f,Y]=_react.useState.call(void 0, null);_chunk7MGPLHPIcjs.c.call(void 0, ),_react.useEffect.call(void 0, ()=>()=>{u.current&&clearTimeout(u.current),p.current&&clearTimeout(p.current)},[]),_react.useEffect.call(void 0, ()=>{_chunkX7THKL37cjs.c.getState().resetUI()},[]),_react.useEffect.call(void 0, ()=>{if(d)return u.current=setTimeout(()=>{_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1),u.current=null},20),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[d]);let N=_react.useCallback.call(void 0, (o,F="navigation")=>{p.current&&(clearTimeout(p.current),p.current=null,Y(null)),_chunkX7THKL37cjs.c.getState().view!=="swap"&&o!=="swap"?(_chunkX7THKL37cjs.c.getState().setView(o),_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1)):_chunkX7THKL37cjs.c.getState().transitionToView(o,F)},[]),v=_react.useCallback.call(void 0, ()=>{u.current&&(clearTimeout(u.current),u.current=null),p.current&&(clearTimeout(p.current),p.current=null);let o=_chunkX7THKL37cjs.c.getState().view;Y(o),_chunkX7THKL37cjs.c.getState().setChainFilter(null),_chunkX7THKL37cjs.c.getState().setView("swap"),_chunkX7THKL37cjs.c.getState().setIsTransitioning(!1),_chunkX7THKL37cjs.c.getState().resetAssetSelection(),p.current=setTimeout(()=>{Y(null),p.current=null},200)},[]),V=_react.useCallback.call(void 0, o=>{let oe=t==="baseChainSelection"?"base":"quote";_chunkX7THKL37cjs.c.getState().setChainFilter({chainId:o,side:oe}),_chunkX7THKL37cjs.c.getState().pushRecentChain(o),N(oe==="base"?"baseSelection":"quoteSelection","chainSelection")},[t,N]),M=_react.useCallback.call(void 0, ()=>{let o=_chunkX7THKL37cjs.c.getState().view;o==="baseSelection"?N("baseChainSelection","chainSelection"):o==="quoteSelection"&&N("quoteChainSelection","chainSelection")},[N]),L=_react.useCallback.call(void 0, ()=>{z(),r()},[z,r]),G=a&&s?a.chainId===s.chainId:!0,q=()=>{switch(t){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:y,widgetType:E,customWalletUI:U}=_chunk6KEQ2NDQcjs.b.call(void 0, ),A=t==="baseSelection"||t==="quoteSelection",x=t==="baseChainSelection"||t==="quoteChainSelection",Z=y==="split"&&(E==="default"||E==="compact"),B=y==="split"&&(E==="horizontal"||E==="split"),$=y==="default",j=t==="swap"||A||x||t==="wallet"||t==="activity",te=f==="baseSelection"||f==="quoteSelection",D=f==="baseChainSelection"||f==="quoteChainSelection",ie=A||te,re=x||D,b=A&&!d,J=x&&!d,he=A?t:f,be=he==="baseSelection"?"base":"quote",ce=he==="baseSelection"?s:a,xe=(x?t:f)==="baseChainSelection"?"base":"quote",ae=o=>({backgroundColor:"var(--widget-background)",opacity:o?1:0,transform:o?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),Ne=$&&(A||x||t==="wallet"||t==="activity"||f!=null),pe=w?_jsxruntime.jsx.call(void 0, at,{}):E==="horizontal"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, $t,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):E==="split"?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, jt,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):_jsxruntime.jsx.call(void 0, rt,{onSwapComplete:e,onSwapInitiated:L}),ke=_nullishCoalesce(i, () => ({})),Se=_react.useRef.call(void 0, null),[Ae,Ce]=_react.useState.call(void 0, 420);return _react.useEffect.call(void 0, ()=>{if(!Z)return;let o=Se.current;if(!o)return;let F=new ResizeObserver(oe=>{for(let ft of oe)Ce(ft.contentRect.height)});return F.observe(o),()=>F.disconnect()},[Z]),Z?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{ref:Se,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...ke},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:"Swap",onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",children:pe})]}),(ie||re)&&_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:g,height:`${Ae}px`,...ke,...ae((A||x)&&!d)},children:A||te?_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})}):_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:v,side:xe,onChainSelect:V})})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[_jsxruntime.jsx.call(void 0, Be,{headerText:q(),onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative overflow-hidden",children:[j&&_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden",style:Ne?{pointerEvents:"none"}:void 0,children:pe}),(t==="wallet"||f==="wallet")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(t==="wallet"&&!d),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:U==="none"?_jsxruntime.jsx.call(void 0, Qt,{}):_jsxruntime.jsx.call(void 0, Dt,{})})}),(t==="activity"||f==="activity")&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-y-auto",style:ae(t==="activity"&&!d),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, _t,{isActive:t==="activity"})})}),$&&ie&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(b),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})})}),$&&re&&_jsxruntime.jsx.call(void 0, "div",{className:"absolute inset-0 overflow-hidden",style:ae(J),children:_jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:null,children:_jsxruntime.jsx.call(void 0, dt,{toggle:v,side:xe,onChainSelect:V})})})]})]})},lt=({onSwapComplete:e,defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:h,cardWidth:k})=>{let{address:W}=_chunk34N36GUDcjs.a.call(void 0, ),R=_chunkX7THKL37cjs.c.call(void 0, w=>w.recipient);return _jsxruntime.jsx.call(void 0, _chunkX7THKL37cjs.e,{defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,children:_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.d,{recipient:R,children:_jsxruntime.jsx.call(void 0, Kt,{onSwapComplete:e,cardStyles:h,cardWidth:k})})})};var Ee={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},ve= exports.defaultDarkTheme ={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Fe(e){let i={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return i["--widget-font-sans"]=e["font-sans"]||"inherit",i["--widget-font-mono"]=e["font-mono"]||"inherit",i["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",i["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",i["--widget-shadow-blur"]=e["shadow-blur"]||"3px",i["--widget-shadow-spread"]=e["shadow-spread"]||"0px",i["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",i["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",i["--widget-letter-spacing"]=e["letter-spacing"]||"normal",i["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",i["--widget-status-received"]=e["status-received"]||"#fbbf24",i["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",i["--widget-status-failed"]=e["status-failed"]||"#fb7185",i}var ct=_react.createContext.call(void 0, ve);function He({theme:e,children:i}){return _jsxruntime.jsx.call(void 0, ct.Provider,{value:e,children:i})}function Jt(){return _react.useContext.call(void 0, ct)}var ti=[],ii=[],ri=[],pt=[],ai=`
|
|
3
3
|
.aori-widget .text-2xs { font-size: 0.75rem; }
|
|
4
4
|
.aori-widget .text-3xs { font-size: 0.68rem; }
|
|
5
5
|
.aori-widget ::-webkit-scrollbar { width: 0px; height: 0px; display: none; }
|
|
@@ -7,4 +7,4 @@ var _chunkDUIRZSBVcjs = require('./chunk-DUIRZSBV.cjs');var _chunkMCT3UZTPcjs =
|
|
|
7
7
|
.aori-widget input:focus, .aori-widget input:focus-visible,
|
|
8
8
|
.aori-widget button:focus, .aori-widget button:focus-visible,
|
|
9
9
|
.aori-widget select:focus, .aori-widget select:focus-visible { outline: none; }
|
|
10
|
-
`,Ve= (_class =class extends _react2.default.Component{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?_jsxruntime.jsxs.call(void 0, "div",{style:{padding:"1.5rem",textAlign:"center",color:"var(--widget-foreground, #888)",fontFamily:"system-ui, sans-serif"},children:[_jsxruntime.jsx.call(void 0, "p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem"},children:"Something went wrong."}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>this.setState({hasError:!1}),style:{padding:"0.375rem 1rem",fontSize:"0.8125rem",cursor:"pointer",border:"1px solid currentColor",borderRadius:"0.25rem",background:"transparent",color:"inherit"},children:"Retry"})]}):this.props.children}}, _class);function ai(e){let t=e.theme.mode==="light"?Ee:he,c=e.theme.mode==="light"?e.theme.light:e.theme.dark;return c?{...t,...c}:t}function oi({config:e,className:t,onSwapComplete:c,onBaseTokenChange:a,onQuoteTokenChange:s,onRequestConnect:b,onRequestAccount:k,customWalletUI:N="builtin"}){_chunkLXEKOQAGcjs.n.call(void 0, e.apiKey),_chunkLXEKOQAGcjs.p.call(void 0, e.rpcOverrides),_chunkLXEKOQAGcjs.l.call(void 0, e.vtApiBaseUrl);let W=ai(e),w=_nullishCoalesce(_optionalChain([e, 'access', _6 => _6.appearance, 'optionalAccess', _7 => _7.widgetType]), () => ("default")),S=_nullishCoalesce(_optionalChain([e, 'access', _8 => _8.appearance, 'optionalAccess', _9 => _9.tokenDisplay]), () => ("default")),C=_nullishCoalesce(_optionalChain([e, 'access', _10 => _10.appearance, 'optionalAccess', _11 => _11.tokenBadgeOrientation]), () => ("left")),I=_nullishCoalesce(_optionalChain([e, 'access', _12 => _12.appearance, 'optionalAccess', _13 => _13.assetMenuVariant]), () => ("default")),O=_nullishCoalesce(_optionalChain([e, 'access', _14 => _14.appearance, 'optionalAccess', _15 => _15.amountInputVariant]), () => ("default")),r=_nullishCoalesce(_optionalChain([e, 'access', _16 => _16.appearance, 'optionalAccess', _17 => _17.hideAmountInputSymbol]), () => (!1)),i=_nullishCoalesce(_optionalChain([e, 'access', _18 => _18.appearance, 'optionalAccess', _19 => _19.swapButtonVariant]), () => ("default")),d=_nullishCoalesce(_optionalChain([e, 'access', _20 => _20.appearance, 'optionalAccess', _21 => _21.swapHeaderVariant]), () => ("default")),T=_nullishCoalesce(_optionalChain([e, 'access', _22 => _22.appearance, 'optionalAccess', _23 => _23.quoteLoaderVariant]), () => ("default")),X=_nullishCoalesce(_optionalChain([e, 'access', _24 => _24.appearance, 'optionalAccess', _25 => _25.walletButtonEnabled]), () => (!0)),L=_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.appearance, 'optionalAccess', _27 => _27.fillContainer]), () => (!1)),u=_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.appearance, 'optionalAccess', _29 => _29.hideBorder]), () => (!1)),g=Fe(W),m=I==="split"&&(w==="default"||w==="compact"),Y=_chunkUZWGYG2Scjs.c.call(void 0, J=>J.view==="baseSelection"||J.view==="quoteSelection"||J.view==="baseChainSelection"||J.view==="quoteChainSelection"),R=w==="compact"?"22rem":"24rem",U=m?{maxWidth:Y?w==="compact"?"46rem":"49rem":R,transition:"max-width 0.3s ease",height:"auto",overflow:"visible",display:"flex",gap:"1rem",alignItems:"stretch",backgroundColor:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0}:{width:"100%",...L?{}:{maxWidth:w==="split"||w==="horizontal"?"48rem":w==="compact"?"22rem":"24rem"},height:"auto",overflow:"hidden"},M={boxSizing:"border-box",backgroundColor:"var(--widget-background)",color:"var(--widget-foreground)",borderRadius:"var(--widget-radius)",...u?{border:"none"}:{borderWidth:"1px",borderStyle:"var(--widget-border-style)",borderColor:"var(--widget-border)"},boxShadow:"var(--widget-shadow-offset-x) var(--widget-shadow-offset-y) var(--widget-shadow-blur) var(--widget-shadow-spread) color-mix(in srgb, var(--widget-shadow-color) calc(var(--widget-shadow-opacity) * 100%), transparent)",padding:"0.25rem 0.5rem",paddingTop:"0.25rem"},j=_nullishCoalesce(_optionalChain([e, 'access', _30 => _30.tokens, 'optionalAccess', _31 => _31.enabledChains]), () => (ei)),G=_nullishCoalesce(_optionalChain([e, 'access', _32 => _32.tokens, 'optionalAccess', _33 => _33.supportedInputTokens]), () => (ti)),H=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.tokens, 'optionalAccess', _35 => _35.supportedOutputTokens]), () => (ii)),B=_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.tokens, 'optionalAccess', _37 => _37.supportedInputChains]), () => (pt)),z=_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.tokens, 'optionalAccess', _39 => _39.supportedOutputChains]), () => (pt)),q=_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.tokens, 'optionalAccess', _41 => _41.inputSelectionSearch]), () => (!0)),v=_nullishCoalesce(_optionalChain([e, 'access', _42 => _42.tokens, 'optionalAccess', _43 => _43.outputSelectionSearch]), () => (!0)),x=_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.tokens, 'optionalAccess', _45 => _45.showInputSelectionTokenBalances]), () => (!0)),Z=_nullishCoalesce(_optionalChain([e, 'access', _46 => _46.tokens, 'optionalAccess', _47 => _47.showOutputSelectionTokenBalances]), () => (!0)),E=_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.tokens, 'optionalAccess', _49 => _49.lockBase]), () => (!1)),$=_nullishCoalesce(_optionalChain([e, 'access', _50 => _50.tokens, 'optionalAccess', _51 => _51.lockQuote]), () => (!1)),D=_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.tokens, 'optionalAccess', _53 => _53.disableInverting]), () => (!1)),ee=_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.settings, 'optionalAccess', _55 => _55.defaultSlippage]), () => (.01)),Q=!!b,te=_react.useMemo.call(void 0, ()=>({apiKey:e.apiKey,web3ConnectionType:"custom",enabledChains:j,supportedInputTokens:G,supportedOutputTokens:H,supportedInputChains:B,supportedOutputChains:z,inputSelectionSearch:q,outputSelectionSearch:v,showInputSelectionTokenBalances:x,showOutputSelectionTokenBalances:Z,lockBase:E,lockQuote:$,disableInverting:D,defaultSlippage:ee,widgetType:w,tokenDisplay:S,tokenBadgeOrientation:C,assetMenuVariant:I,amountInputVariant:O,hideAmountInputSymbol:r,swapButtonVariant:i,swapHeaderVariant:d,quoteLoaderVariant:T,walletButtonEnabled:X,hasConnectHandler:Q,customWalletUI:N}),[e.apiKey,j,G,H,B,z,q,v,x,Z,E,$,D,ee,w,S,C,I,O,r,i,d,T,X,Q,N]),ie=_react.useMemo.call(void 0, ()=>b?{openConnectModal:b,openAccountModal:k}:null,[b,k]),y=_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.N,{children:_jsxruntime.jsx.call(void 0, _chunkLXEKOQAGcjs.a.Provider,{value:te,children:_jsxruntime.jsx.call(void 0, He,{theme:W,children:_jsxruntime.jsxs.call(void 0, "div",{className:`aori-widget${t?` ${t}`:""}`,style:{...g,"--font-sans":"var(--widget-font-sans)","--font-mono":"var(--widget-font-mono)",fontFamily:"var(--widget-font-sans)",letterSpacing:"var(--widget-letter-spacing)",width:"100%",...U,position:"relative",...m?{}:M},children:[_jsxruntime.jsx.call(void 0, "style",{dangerouslySetInnerHTML:{__html:ri}}),_jsxruntime.jsx.call(void 0, Ve,{children:_jsxruntime.jsx.call(void 0, lt,{onSwapComplete:c,defaultBaseToken:_optionalChain([e, 'access', _56 => _56.tokens, 'optionalAccess', _57 => _57.defaultBase]),defaultQuoteToken:_optionalChain([e, 'access', _58 => _58.tokens, 'optionalAccess', _59 => _59.defaultQuote]),onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:m?M:void 0,cardWidth:m?R:void 0})})]})})})});return ie?_jsxruntime.jsx.call(void 0, _chunkMCT3UZTPcjs.f.Provider,{value:ie,children:y}):y}function ni(){let{openConnectModal:e}=_chunkMCT3UZTPcjs.g.call(void 0, ),{isConnected:t,address:c}=_chunk34N36GUDcjs.a.call(void 0, ),a=t&&c?`${c.slice(0,6)}...${c.slice(-4)}`:"Connect";return _jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>e(),className:"h-8 cursor-pointer px-3 text-xs font-bold uppercase tracking-wide transition-colors duration-150 border border-border rounded-sm bg-card text-foreground hover:bg-secondary hover:border-foreground/20",children:a})}var _wagmi = require('wagmi');function li(e){let t=Object.entries(_chunkLXEKOQAGcjs.d);return Object.fromEntries(t.map(([c,a])=>{let s=_optionalChain([e, 'optionalAccess', _60 => _60[Number(c)]]),b=s?Array.isArray(s)?s:[s]:[],k=b.length>0?[...b,...a.rpcUrls]:a.rpcUrls;return[c,k.length>1?_wagmi.fallback.call(void 0, k.map(N=>_wagmi.http.call(void 0, N,{batch:{batchSize:50,wait:50}}))):_wagmi.http.call(void 0, k[0],{batch:{batchSize:50,wait:50}})]}))}var ci=_chunkLXEKOQAGcjs.f.call(void 0, ).map(e=>e.wagmiChain);var gi=e=>{let{tokenRegistry:t,isLoadingRegistry:c,error:a}=_chunkLXEKOQAGcjs.F.call(void 0, );return{tokens:_react.useMemo.call(void 0, ()=>t.filter(b=>b.chainId===e),[t,e]),isLoading:c,error:a}},pi= exports.useIsTokenSupported =(e,t)=>{let{tokenRegistry:c}=_chunkLXEKOQAGcjs.F.call(void 0, );return _react.useMemo.call(void 0, ()=>!e||!c.length?!1:c.some(a=>a.address.toLowerCase()===e.toLowerCase()&&a.chainId===t),[c,e,t])},wi= exports.useTokenByAddress =(e,t)=>{let{getToken:c}=_chunkLXEKOQAGcjs.F.call(void 0, );return _react.useMemo.call(void 0, ()=>{if(!(!e||!t))return c(t,e)},[c,e,t])},Nr=_chunkLXEKOQAGcjs.i.call(void 0, );exports.ChainSwitch = _chunkMCT3UZTPcjs.n; exports.ConnectButton = ni; exports.RfqProvider = _chunkMCT3UZTPcjs.d; exports.SignSwap = _chunkMCT3UZTPcjs.o; exports.SwapFormProvider = _chunkUZWGYG2Scjs.e; exports.SwapWidget = oi; exports.WidgetThemeProvider = He; exports.buildTransports = li; exports.canSubmitOrder = _chunkMCT3UZTPcjs.q; exports.cleanupOldSubmissions = _chunkMCT3UZTPcjs.s; exports.defaultDarkTheme = he; exports.defaultLightTheme = Ee; exports.isQuoteFresh = _chunkMCT3UZTPcjs.p; exports.markOrderAsSubmitted = _chunkMCT3UZTPcjs.r; exports.pollOrderStatus = _chunkMCT3UZTPcjs.k; exports.themeToCSS = Fe; exports.useBalanceEventListener = _chunkMCT3UZTPcjs.a; exports.useBalanceEventSubscription = _chunkMCT3UZTPcjs.c; exports.useEmitBalanceEvent = _chunkMCT3UZTPcjs.b; exports.useIsTokenSupported = pi; exports.useOrderStatusPolling = _chunkMCT3UZTPcjs.l; exports.useRfq = _chunkMCT3UZTPcjs.e; exports.useSwapForm = _chunkUZWGYG2Scjs.d; exports.useSwapFormContext = _chunkUZWGYG2Scjs.f; exports.useTokenByAddress = wi; exports.useTokenSelection = _chunkUZWGYG2Scjs.b; exports.useTokenSelectionStore = _chunkUZWGYG2Scjs.a; exports.useTokensForChain = gi; exports.useTransactionRegistry = _chunkMCT3UZTPcjs.m; exports.useUnwrapToken = _chunkMCT3UZTPcjs.t; exports.useWalletModal = _chunkMCT3UZTPcjs.g; exports.useWalletState = _chunk34N36GUDcjs.a; exports.useWidgetSwapUIStore = _chunkUZWGYG2Scjs.c; exports.useWidgetTheme = Zt; exports.useWrapToken = _chunkMCT3UZTPcjs.u; exports.wagmiChains = ci;
|
|
10
|
+
`,Ve= (_class =class extends _react2.default.Component{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?_jsxruntime.jsxs.call(void 0, "div",{style:{padding:"1.5rem",textAlign:"center",color:"var(--widget-foreground, #888)",fontFamily:"system-ui, sans-serif"},children:[_jsxruntime.jsx.call(void 0, "p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem"},children:"Something went wrong."}),_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>this.setState({hasError:!1}),style:{padding:"0.375rem 1rem",fontSize:"0.8125rem",cursor:"pointer",border:"1px solid currentColor",borderRadius:"0.25rem",background:"transparent",color:"inherit"},children:"Retry"})]}):this.props.children}}, _class);function oi(e){let i=e.theme.mode==="light"?Ee:ve,g=e.theme.mode==="light"?e.theme.light:e.theme.dark;return g?{...i,...g}:i}function ni({config:e,className:i,onSwapComplete:g,onBaseTokenChange:a,onQuoteTokenChange:s,onRequestConnect:h,onRequestAccount:k,customWalletUI:W="builtin"}){_chunk6CVCMRALcjs.l.call(void 0, e.apiKey),_chunk6CVCMRALcjs.n.call(void 0, e.rpcOverrides),_chunk6CVCMRALcjs.j.call(void 0, e.vtApiBaseUrl);let R=oi(e),w=_nullishCoalesce(_optionalChain([e, 'access', _6 => _6.appearance, 'optionalAccess', _7 => _7.widgetType]), () => ("default")),S=_nullishCoalesce(_optionalChain([e, 'access', _8 => _8.appearance, 'optionalAccess', _9 => _9.tokenDisplay]), () => ("default")),C=_nullishCoalesce(_optionalChain([e, 'access', _10 => _10.appearance, 'optionalAccess', _11 => _11.tokenBadgeOrientation]), () => ("left")),O=_nullishCoalesce(_optionalChain([e, 'access', _12 => _12.appearance, 'optionalAccess', _13 => _13.assetMenuVariant]), () => ("default")),z=_nullishCoalesce(_optionalChain([e, 'access', _14 => _14.appearance, 'optionalAccess', _15 => _15.amountInputVariant]), () => ("default")),r=_nullishCoalesce(_optionalChain([e, 'access', _16 => _16.appearance, 'optionalAccess', _17 => _17.hideAmountInputSymbol]), () => (!1)),t=_nullishCoalesce(_optionalChain([e, 'access', _18 => _18.appearance, 'optionalAccess', _19 => _19.swapButtonVariant]), () => ("default")),d=_nullishCoalesce(_optionalChain([e, 'access', _20 => _20.appearance, 'optionalAccess', _21 => _21.swapHeaderVariant]), () => ("default")),T=_nullishCoalesce(_optionalChain([e, 'access', _22 => _22.appearance, 'optionalAccess', _23 => _23.quoteLoaderVariant]), () => ("default")),ee=_nullishCoalesce(_optionalChain([e, 'access', _24 => _24.appearance, 'optionalAccess', _25 => _25.walletButtonEnabled]), () => (!0)),K=_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.appearance, 'optionalAccess', _27 => _27.fillContainer]), () => (!1)),u=_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.appearance, 'optionalAccess', _29 => _29.hideBorder]), () => (!1)),p=Fe(R),f=O==="split"&&(w==="default"||w==="compact"),Y=_chunkX7THKL37cjs.c.call(void 0, J=>J.view==="baseSelection"||J.view==="quoteSelection"||J.view==="baseChainSelection"||J.view==="quoteChainSelection"),N=w==="compact"?"22rem":"24rem",V=f?{maxWidth:Y?w==="compact"?"46rem":"49rem":N,transition:"max-width 0.3s ease",height:"auto",overflow:"visible",display:"flex",gap:"1rem",alignItems:"stretch",backgroundColor:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0}:{width:"100%",...K?{}:{maxWidth:w==="split"||w==="horizontal"?"48rem":w==="compact"?"22rem":"24rem"},height:"auto",overflow:"hidden"},M={boxSizing:"border-box",backgroundColor:"var(--widget-background)",color:"var(--widget-foreground)",borderRadius:"var(--widget-radius)",...u?{border:"none"}:{borderWidth:"1px",borderStyle:"var(--widget-border-style)",borderColor:"var(--widget-border)"},boxShadow:"var(--widget-shadow-offset-x) var(--widget-shadow-offset-y) var(--widget-shadow-blur) var(--widget-shadow-spread) color-mix(in srgb, var(--widget-shadow-color) calc(var(--widget-shadow-opacity) * 100%), transparent)",padding:"0.25rem 0.5rem",paddingTop:"0.25rem"},L=_nullishCoalesce(_optionalChain([e, 'access', _30 => _30.tokens, 'optionalAccess', _31 => _31.enabledChains]), () => (ti)),G=_nullishCoalesce(_optionalChain([e, 'access', _32 => _32.tokens, 'optionalAccess', _33 => _33.supportedInputTokens]), () => (ii)),q=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.tokens, 'optionalAccess', _35 => _35.supportedOutputTokens]), () => (ri)),y=_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.tokens, 'optionalAccess', _37 => _37.supportedInputChains]), () => (pt)),E=_nullishCoalesce(_optionalChain([e, 'access', _38 => _38.tokens, 'optionalAccess', _39 => _39.supportedOutputChains]), () => (pt)),U=_nullishCoalesce(_optionalChain([e, 'access', _40 => _40.tokens, 'optionalAccess', _41 => _41.inputSelectionSearch]), () => (!0)),A=_nullishCoalesce(_optionalChain([e, 'access', _42 => _42.tokens, 'optionalAccess', _43 => _43.outputSelectionSearch]), () => (!0)),x=_nullishCoalesce(_optionalChain([e, 'access', _44 => _44.tokens, 'optionalAccess', _45 => _45.showInputSelectionTokenBalances]), () => (!0)),Z=_nullishCoalesce(_optionalChain([e, 'access', _46 => _46.tokens, 'optionalAccess', _47 => _47.showOutputSelectionTokenBalances]), () => (!0)),B=_nullishCoalesce(_optionalChain([e, 'access', _48 => _48.tokens, 'optionalAccess', _49 => _49.lockBase]), () => (!1)),$=_nullishCoalesce(_optionalChain([e, 'access', _50 => _50.tokens, 'optionalAccess', _51 => _51.lockQuote]), () => (!1)),j=_nullishCoalesce(_optionalChain([e, 'access', _52 => _52.tokens, 'optionalAccess', _53 => _53.disableInverting]), () => (!1)),te=_nullishCoalesce(_optionalChain([e, 'access', _54 => _54.settings, 'optionalAccess', _55 => _55.defaultSlippage]), () => (.01)),D=!!h,ie=_react.useMemo.call(void 0, ()=>({apiKey:e.apiKey,web3ConnectionType:"custom",enabledChains:L,supportedInputTokens:G,supportedOutputTokens:q,supportedInputChains:y,supportedOutputChains:E,inputSelectionSearch:U,outputSelectionSearch:A,showInputSelectionTokenBalances:x,showOutputSelectionTokenBalances:Z,lockBase:B,lockQuote:$,disableInverting:j,defaultSlippage:te,widgetType:w,tokenDisplay:S,tokenBadgeOrientation:C,assetMenuVariant:O,amountInputVariant:z,hideAmountInputSymbol:r,swapButtonVariant:t,swapHeaderVariant:d,quoteLoaderVariant:T,walletButtonEnabled:ee,hasConnectHandler:D,customWalletUI:W}),[e.apiKey,L,G,q,y,E,U,A,x,Z,B,$,j,te,w,S,C,O,z,r,t,d,T,ee,D,W]),re=_react.useMemo.call(void 0, ()=>h?{openConnectModal:h,openAccountModal:k}:null,[h,k]),b=_jsxruntime.jsx.call(void 0, _chunk6CVCMRALcjs.L,{children:_jsxruntime.jsx.call(void 0, _chunk6KEQ2NDQcjs.a.Provider,{value:ie,children:_jsxruntime.jsx.call(void 0, He,{theme:R,children:_jsxruntime.jsxs.call(void 0, "div",{className:`aori-widget${i?` ${i}`:""}`,style:{...p,"--font-sans":"var(--widget-font-sans)","--font-mono":"var(--widget-font-mono)",fontFamily:"var(--widget-font-sans)",letterSpacing:"var(--widget-letter-spacing)",width:"100%",...V,position:"relative",...f?{}:M},children:[_jsxruntime.jsx.call(void 0, "style",{dangerouslySetInnerHTML:{__html:ai}}),_jsxruntime.jsx.call(void 0, Ve,{children:_jsxruntime.jsx.call(void 0, lt,{onSwapComplete:g,defaultBaseToken:_optionalChain([e, 'access', _56 => _56.tokens, 'optionalAccess', _57 => _57.defaultBase]),defaultQuoteToken:_optionalChain([e, 'access', _58 => _58.tokens, 'optionalAccess', _59 => _59.defaultQuote]),onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:f?M:void 0,cardWidth:f?N:void 0})})]})})})});return re?_jsxruntime.jsx.call(void 0, _chunk7MGPLHPIcjs.f.Provider,{value:re,children:b}):b}function si(){let{openConnectModal:e}=_chunk7MGPLHPIcjs.g.call(void 0, ),{isConnected:i,address:g}=_chunk34N36GUDcjs.a.call(void 0, ),a=i&&g?`${g.slice(0,6)}...${g.slice(-4)}`:"Connect";return _jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>e(),className:"h-8 cursor-pointer px-3 text-xs font-bold uppercase tracking-wide transition-colors duration-150 border border-border rounded-sm bg-card text-foreground hover:bg-secondary hover:border-foreground/20",children:a})}var _wagmi = require('wagmi');function ci(e){let i=Object.entries(_chunk6CVCMRALcjs.b);return Object.fromEntries(i.map(([g,a])=>{let s=_optionalChain([e, 'optionalAccess', _60 => _60[Number(g)]]),h=s?Array.isArray(s)?s:[s]:[],k=h.length>0?[...h,...a.rpcUrls]:a.rpcUrls;return[g,k.length>1?_wagmi.fallback.call(void 0, k.map(W=>_wagmi.http.call(void 0, W,{batch:{batchSize:50,wait:50}}))):_wagmi.http.call(void 0, k[0],{batch:{batchSize:50,wait:50}})]}))}var gi=_chunk6CVCMRALcjs.d.call(void 0, ).map(e=>e.wagmiChain);var pi=e=>{let{tokenRegistry:i,isLoadingRegistry:g,error:a}=_chunk6CVCMRALcjs.D.call(void 0, );return{tokens:_react.useMemo.call(void 0, ()=>i.filter(h=>h.chainId===e),[i,e]),isLoading:g,error:a}},wi= exports.useIsTokenSupported =(e,i)=>{let{tokenRegistry:g}=_chunk6CVCMRALcjs.D.call(void 0, );return _react.useMemo.call(void 0, ()=>!e||!g.length?!1:g.some(a=>a.address.toLowerCase()===e.toLowerCase()&&a.chainId===i),[g,e,i])},ui= exports.useTokenByAddress =(e,i)=>{let{getToken:g}=_chunk6CVCMRALcjs.D.call(void 0, );return _react.useMemo.call(void 0, ()=>{if(!(!e||!i))return g(i,e)},[g,e,i])},Nr=_chunk6CVCMRALcjs.g.call(void 0, );exports.ChainSwitch = _chunk7MGPLHPIcjs.n; exports.ConnectButton = si; exports.RfqProvider = _chunk7MGPLHPIcjs.d; exports.SignSwap = _chunk7MGPLHPIcjs.o; exports.SwapFormProvider = _chunkX7THKL37cjs.e; exports.SwapWidget = ni; exports.WidgetThemeProvider = He; exports.buildTransports = ci; exports.canSubmitOrder = _chunk7MGPLHPIcjs.q; exports.cleanupOldSubmissions = _chunk7MGPLHPIcjs.s; exports.defaultDarkTheme = ve; exports.defaultLightTheme = Ee; exports.isQuoteFresh = _chunk7MGPLHPIcjs.p; exports.markOrderAsSubmitted = _chunk7MGPLHPIcjs.r; exports.pollOrderStatus = _chunk7MGPLHPIcjs.k; exports.themeToCSS = Fe; exports.useBalanceEventListener = _chunk7MGPLHPIcjs.a; exports.useBalanceEventSubscription = _chunk7MGPLHPIcjs.c; exports.useEmitBalanceEvent = _chunk7MGPLHPIcjs.b; exports.useIsTokenSupported = wi; exports.useOrderStatusPolling = _chunk7MGPLHPIcjs.l; exports.useRfq = _chunk7MGPLHPIcjs.e; exports.useSwapForm = _chunkX7THKL37cjs.d; exports.useSwapFormContext = _chunkX7THKL37cjs.f; exports.useTokenByAddress = ui; exports.useTokenSelection = _chunkX7THKL37cjs.b; exports.useTokenSelectionStore = _chunkX7THKL37cjs.a; exports.useTokensForChain = pi; exports.useTransactionRegistry = _chunk7MGPLHPIcjs.m; exports.useUnwrapToken = _chunk7MGPLHPIcjs.t; exports.useWalletModal = _chunk7MGPLHPIcjs.g; exports.useWalletState = _chunk34N36GUDcjs.a; exports.useWidgetSwapUIStore = _chunkX7THKL37cjs.c; exports.useWidgetTheme = Jt; exports.useWrapToken = _chunk7MGPLHPIcjs.u; exports.wagmiChains = gi;
|
package/dist/index.d.cts
CHANGED
|
@@ -353,7 +353,7 @@ declare const useSwapFormContext: () => {
|
|
|
353
353
|
};
|
|
354
354
|
|
|
355
355
|
type ToastStatus = 'pending' | 'received' | 'completed' | 'failed' | 'cancelled';
|
|
356
|
-
type WidgetView = 'swap' | 'wallet' | 'baseSelection' | 'quoteSelection' | 'baseChainSelection' | 'quoteChainSelection';
|
|
356
|
+
type WidgetView = 'swap' | 'wallet' | 'activity' | 'baseSelection' | 'quoteSelection' | 'baseChainSelection' | 'quoteChainSelection';
|
|
357
357
|
type TransitionType = 'navigation' | 'tokenSelection' | 'chainSelection';
|
|
358
358
|
interface WidgetSwapUIState {
|
|
359
359
|
view: WidgetView;
|
package/dist/index.d.ts
CHANGED
|
@@ -353,7 +353,7 @@ declare const useSwapFormContext: () => {
|
|
|
353
353
|
};
|
|
354
354
|
|
|
355
355
|
type ToastStatus = 'pending' | 'received' | 'completed' | 'failed' | 'cancelled';
|
|
356
|
-
type WidgetView = 'swap' | 'wallet' | 'baseSelection' | 'quoteSelection' | 'baseChainSelection' | 'quoteChainSelection';
|
|
356
|
+
type WidgetView = 'swap' | 'wallet' | 'activity' | 'baseSelection' | 'quoteSelection' | 'baseChainSelection' | 'quoteChainSelection';
|
|
357
357
|
type TransitionType = 'navigation' | 'tokenSelection' | 'chainSelection';
|
|
358
358
|
interface WidgetSwapUIState {
|
|
359
359
|
view: WidgetView;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as Je}from"./chunk-4BQRVCQR.js";import{a as mt,b as ht,c as Pe,d as Ie,e as ue,f as Ze,g as ae,h as oe,i as ne,j as Xe,k as xt,l as kt,m as St,n as Ct,o as Tt,p as Rt,q as Wt,r as Nt,s as At,t as Pt,u as It,v as et,w as tt}from"./chunk-XYF2YBR3.js";import"./chunk-OPN7WCJR.js";import{a as vt,b as bt,c as n,d as yt,e as Oe,f as fe}from"./chunk-726CI6GC.js";import{A as Ye,F as Te,N as Ge,a as Ue,b as ge,d as je,f as $e,i as De,l as Qe,n as _e,p as Ke}from"./chunk-EW2OR6CJ.js";import{a as _}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import Xt,{useMemo as gt}from"react";import{Suspense as de,lazy as pe,useCallback as me,useEffect as Re,useRef as qe,useState as nt}from"react";import{useShallow as Ut}from"zustand/react/shallow";import{useCallback as se,useEffect as Ot,useMemo as zt,useRef as Mt,useState as it}from"react";import{useShallow as Bt}from"zustand/react/shallow";import{Fragment as ze,jsx as l,jsxs as A}from"react/jsx-runtime";var qt=({onSwapComplete:e,onSwapInitiated:t})=>{let{web3ConnectionType:c,hasConnectHandler:a,lockBase:s,lockQuote:b,disableInverting:k,tokenDisplay:N,tokenBadgeOrientation:W,widgetType:w}=ge(),S=N==="pill"||N==="ghost",C=w==="compact",I=C?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",O=C?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:r,quoteToken:i,baseAmount:d,quoteAmount:T,isBaseGasToken:X,isQuoteGasToken:L,isWrappingPair:u,isUnwrappingPair:g,baseBalance:m,quoteBalance:Y,setBaseAmount:R,setQuoteAmount:h,swapTokens:U,clearForm:M}=fe(),{rfqQuote:j,status:G,handleInputChange:H,ensureForParams:B,stop:z,clear:q,refresh:v}=ue(),{address:x}=_(),{openConnectModal:Z}=ae(),{isRecipientInputOpen:E,txStatus:$}=n(Bt(o=>({isRecipientInputOpen:o.isRecipientInputOpen,txStatus:o.txStatus}))),[D,ee]=it(null),[Q,te]=it(null),ie=Mt(!1),y=!1,J=zt(()=>!r||!i||typeof d!="number"||!T||!x||parseFloat(m.formatted)<d?null:{base:r,quote:i,baseAmount:d,quoteAmount:T,userAddress:x},[r,i,d,T,x,m.formatted]),ve=se(o=>{te(o),n.getState().startTracking(o)},[]),be=se(()=>{ie.current=!0,v()},[v]);Ot(()=>{if(D===null&&!(!r||!i)){if(!d||d<=0){H({amount:null,inputToken:r,outputToken:i,setOutputAmount:h});return}if(u||g){h(d);return}H({amount:d,inputToken:r,outputToken:i,setOutputAmount:h})}},[D,d,r,i,u,g,H,h]);let le=se(()=>{n.getState().setView("baseSelection")},[]),ye=se(()=>{n.getState().setView("quoteSelection")},[]),xe=se(()=>{U(),h(null)},[U,h]),ce=se(()=>{if(!m.formatted||!r||!i)return;let o=parseFloat(m.formatted);if(!o||o<=0)return;let V=o*.9999999999;u||g?(R(V),h(V),q()):(R(V),h(null),B({inputToken:r,outputToken:i,inputAmount:V.toString(),setOutputAmount:re=>h(re)}))},[m.formatted,r,i,u,g,R,h,q,B]),Ne=se(()=>{q(),M()},[q,M]),we=m.formatted?parseFloat(m.formatted):null,ke=!!(d||T),Se=r?.price&&d?`$${(r.price*d).toFixed(2)}`:"$0.00",Ae=i?.price&&T?`$${(i.price*T).toFixed(2)}`:"$0.00",Ce=D==="trackingTx"&&!!Q&&!!r&&!!i&&!!d&&!!T;return A("div",{className:"flex flex-col w-full",children:[Ce&&Q&&r&&i&&d&&T?l("div",{className:"overflow-hidden",children:l(tt,{orderHash:Q,base:r,quote:i,baseAmount:d,quoteAmount:T,status:$})}):A(ze,{children:[A("div",{className:`relative ${I}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[S?C?A("div",{className:`flex items-center gap-2 mb-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[l(ne,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),l("div",{className:"flex-1 min-w-0",children:l(oe,{side:"base",asset:r??null,otherAsset:i??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})})]}):A("div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[l(ne,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),l(oe,{side:"base",asset:r??null,otherAsset:i??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}):A(ze,{children:[l(ne,{toggle:le,side:"base",asset:r,isPlacingOrder:y||s}),l(oe,{side:"base",asset:r??null,otherAsset:i??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}),A("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[l("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Se}),x&&we!==null&&we>0&&l("button",{type:"button",onClick:ce,disabled:y,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&l("div",{className:"flex justify-center -my-4 relative z-10",children:A("button",{type:"button",onClick:xe,"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:[l("span",{className:"text-2xs",children:"\u2191"}),l("span",{className:"text-2xs",children:"\u2193"})]})}),A("div",{className:`relative ${O}`,children:[S?C?A("div",{className:`flex items-center gap-2 ${W==="right"?"flex-row-reverse":"flex-row"}`,children:[l(ne,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),l("div",{className:"flex-1 min-w-0",children:l(oe,{side:"quote",asset:i??null,otherAsset:r??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})})]}):A("div",{className:`flex flex-col ${W==="right"?"items-end":"items-start"}`,children:[l(ne,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),l(oe,{side:"quote",asset:i??null,otherAsset:r??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}):A(ze,{children:[l(ne,{toggle:ye,side:"quote",asset:i,isPlacingOrder:y||b}),l(oe,{side:"quote",asset:i??null,otherAsset:r??null,isPlacingOrder:y,isWrappingPair:u,isUnwrappingPair:g})]}),A("div",{className:"flex w-full flex-row items-center justify-between",children:[l("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ae}),ke&&l("button",{type:"button",onClick:Ne,disabled:y,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),l("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:E?"1px solid var(--widget-border)":"none",maxHeight:E?"60px":"0px",opacity:E?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:l(Xe,{})}),l("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:l(Je,{})})]}),l("div",{className:`relative ${Ce?"px-0":"px-4"} ${C?"py-2":"py-4"}`,children:x&&r&&i&&d&&d>0?l(et,{base:r,baseAmount:d,quote:i,quoteAmount:T??0,userAddress:x,isWrappingPair:u,isUnwrappingPair:g,isBaseGasToken:X,isQuoteGasToken:L,reviewActionProps:J,reviewState:D,setReviewState:ee,trackedOrderHash:Q,setTrackedOrderHash:te,onSwapComplete:e,onSwapInitiated:t,onOrderSubmitted:ve,onStaleQuoteRestart:be,txStatus:$}):!x&&a?l("button",{onClick:()=>Z(),className:`w-full ${C?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):l("button",{disabled:!0,className:`w-full ${C?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:x?"Enter Amount":"Connect Wallet"})})]})},rt=qt;import{jsx as P,jsxs as Me}from"react/jsx-runtime";var at=()=>Me("div",{className:"flex flex-col w-full",children:[Me("div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[P("div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),P("div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),P("div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:P("div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),P("div",{className:"flex justify-center -my-4 relative z-10",children:P("div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),Me("div",{className:"relative px-4 pt-6 pb-2",children:[P("div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),P("div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),P("div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:P("div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),P("div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),P("div",{className:"relative px-4 py-4",children:P("div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});import{useEffect as Et,useState as ot}from"react";import{useShallow as Ft}from"zustand/react/shallow";import{Fragment as Lt,jsx as f,jsxs as F}from"react/jsx-runtime";var Ht=({targetText:e,isError:t})=>{let{displayText:c,suffix:a,characterColors:s}=Ye(e,t);return F(Lt,{children:[c.split("").map((b,k)=>f("span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:b},k)),f("span",{style:{color:t?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:t?.5:1},children:a})]})},Vt=({headerText:e,onBackClick:t,isSameChain:c,isWrappingPair:a,isUnwrappingPair:s,hasLowLiquidity:b,hasInsufficientLiquidity:k,hasRoutingError:N,hasSizeCapError:W})=>{let w=n(v=>v.view),{isRecipientInputOpen:S,hasAllowanceError:C,hoveredChainName:I,isTrackingTx:O,txStatus:r,walletTab:i}=n(Ft(v=>({isRecipientInputOpen:v.isRecipientInputOpen,hasAllowanceError:v.hasAllowanceError,hoveredChainName:v.hoveredChainName,isTrackingTx:v.isTrackingTx,txStatus:v.txStatus,walletTab:v.walletTab}))),{web3ConnectionType:d,swapHeaderVariant:T,customWalletUI:X,walletButtonEnabled:L}=ge(),{isConnected:u}=_(),{openAccountModal:g}=ae(),[m,Y]=ot(!1);Et(()=>Y(!0),[]);let[R,h]=ot(!1),U=`${w}-${R}-${S}-${I||"none"}`,j=(()=>{if(O&&r)switch(r){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(I&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"))return I;if(w==="swap"&&R)return S?"Remove Custom Recipient":"Add Custom Recipient";switch(w){case"wallet":return"Wallet";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(w==="swap"){if(C&&!a&&!s)return"Allowance check failed";if(W&&!a&&!s)return"Size limit exceeded";if(k&&!a&&!s)return"Insufficient Liquidity";if(N&&!a&&!s)return"Route Not Found";if(b&&!a&&!s)return"High Price Impact"}return c&&!a&&!s?"Swap":a?"Wrap":s?"Unwrap":e}})(),G=!O&&w==="swap"&&!R&&(C&&!a&&!s||W&&!a&&!s||k&&!a&&!s||N&&!a&&!s||b&&!a&&!s),H={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},B=()=>!O||!r?null:H[r]??null,z=()=>O?null:w==="swap"?F("div",{className:"flex items-center gap-2",children:[L&&m&&d==="custom"&&u&&f("button",{onClick:()=>{X==="provider"&&g?g():n.getState().setView("wallet")},"aria-label":"Open wallet",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:F("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f("rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),f("path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),f("path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),L&&m&&d==="standalone"&&u&&g&&f("button",{onClick:()=>g(),"aria-label":"Open account",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:F("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f("rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),f("path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),f("path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),f("button",{onClick:()=>n.getState().toggleRecipientInput(),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),"aria-label":S?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${S?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:F("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f("path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),f("path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),f("path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),f("path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),F("g",{style:{transform:`rotate(${S?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[f("path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),f("path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):F("button",{onClick:()=>t?t():n.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[f("span",{className:"pr-1",children:"\u2190"}),f("span",{className:"text-sm",children:"Back"})]}),q=B();return T==="none"?null:F("div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[w==="wallet"?F("div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[F("button",{type:"button",onClick:()=>n.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:i==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[f("span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),f("span",{children:"Wallet"})]}),f("span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),f("button",{type:"button",onClick:()=>n.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:i==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):F("div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[f("span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),f("span",{className:"relative",style:{color:q||"var(--widget-foreground)"},children:f(Ht,{targetText:j,isError:G??!1})},U)]}),f("div",{className:"flex flex-row items-center",children:z()})]})},Be=Vt;import{Fragment as Kt,jsx as p,jsxs as We}from"react/jsx-runtime";var st=pe(()=>import("./AssetSelectionMenu-ZFY7XFRX.js")),dt=pe(()=>import("./ChainSelectionMenu-SKXLHK3S.js")),jt=pe(()=>import("./SwapFormHorizontal-GI4X7ISS.js")),$t=pe(()=>import("./SwapFormSplit-52RBMJIO.js")),Dt=pe(()=>import("./WidgetWalletPanel-XYV3YL4I.js").then(e=>({default:e.WidgetWalletPanel}))),Qt=pe(()=>import("./WalletPlaceholderPanel-Z4JCFCNV.js").then(e=>({default:e.WalletPlaceholderPanel}))),_t=({onSwapComplete:e,cardStyles:t,cardWidth:c})=>{let{baseToken:a,quoteToken:s,baseAmount:b,quoteAmount:k,isWrappingPair:N,isUnwrappingPair:W,isRegistryLoading:w}=fe(),{liquidityError:S,routingError:C,sizeCapError:I,stop:O,clear:r}=ue(),i=n(o=>o.view),{isTransitioning:d,isRecipientInputOpen:T,recipient:X,selectedChainFilterChainId:L}=n(Ut(o=>({isTransitioning:o.isTransitioning,isRecipientInputOpen:o.isRecipientInputOpen,recipient:o.recipient,selectedChainFilterChainId:o.selectedChainFilter?.chainId??null}))),u=qe(null),g=qe(null),[m,Y]=nt(null);Pe(),Re(()=>()=>{u.current&&clearTimeout(u.current),g.current&&clearTimeout(g.current)},[]),Re(()=>{n.getState().resetUI()},[]),Re(()=>{if(d)return u.current=setTimeout(()=>{n.getState().setIsTransitioning(!1),u.current=null},20),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[d]);let R=me((o,V="navigation")=>{g.current&&(clearTimeout(g.current),g.current=null,Y(null)),n.getState().view!=="swap"&&o!=="swap"?(n.getState().setView(o),n.getState().setIsTransitioning(!1)):n.getState().transitionToView(o,V)},[]),h=me(()=>{u.current&&(clearTimeout(u.current),u.current=null),g.current&&(clearTimeout(g.current),g.current=null);let o=n.getState().view;Y(o),n.getState().setChainFilter(null),n.getState().setView("swap"),n.getState().setIsTransitioning(!1),n.getState().resetAssetSelection(),g.current=setTimeout(()=>{Y(null),g.current=null},200)},[]),U=me(o=>{let re=i==="baseChainSelection"?"base":"quote";n.getState().setChainFilter({chainId:o,side:re}),n.getState().pushRecentChain(o),R(re==="base"?"baseSelection":"quoteSelection","chainSelection")},[i,R]),M=me(()=>{let o=n.getState().view;o==="baseSelection"?R("baseChainSelection","chainSelection"):o==="quoteSelection"&&R("quoteChainSelection","chainSelection")},[R]),j=me(()=>{O(),r()},[O,r]),G=a&&s?a.chainId===s.chainId:!0,H=()=>{switch(i){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:B,widgetType:z,customWalletUI:q}=ge(),v=i==="baseSelection"||i==="quoteSelection",x=i==="baseChainSelection"||i==="quoteChainSelection",Z=B==="split"&&(z==="default"||z==="compact"),E=B==="split"&&(z==="horizontal"||z==="split"),$=B==="default",D=i==="swap"||v||x||i==="wallet",ee=m==="baseSelection"||m==="quoteSelection",Q=m==="baseChainSelection"||m==="quoteChainSelection",te=v||ee,ie=x||Q,y=v&&!d,J=x&&!d,ve=v?i:m,be=ve==="baseSelection"?"base":"quote",le=ve==="baseSelection"?s:a,xe=(x?i:m)==="baseChainSelection"?"base":"quote",ce=o=>({backgroundColor:"var(--widget-background)",opacity:o?1:0,transform:o?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),Ne=$&&(v||x||i==="wallet"||m!=null),we=w?p(at,{}):z==="horizontal"?p(de,{fallback:null,children:p(jt,{onSwapComplete:e,onSwapInitiated:j,onBackToSwap:E?h:void 0,onMoreChainsClick:E?M:void 0})}):z==="split"?p(de,{fallback:null,children:p($t,{onSwapComplete:e,onSwapInitiated:j,onBackToSwap:E?h:void 0,onMoreChainsClick:E?M:void 0})}):p(rt,{onSwapComplete:e,onSwapInitiated:j}),ke=t??{},Se=qe(null),[Ae,Ce]=nt(420);return Re(()=>{if(!Z)return;let o=Se.current;if(!o)return;let V=new ResizeObserver(re=>{for(let ft of re)Ce(ft.contentRect.height)});return V.observe(o),()=>V.disconnect()},[Z]),Z?We(Kt,{children:[We("div",{ref:Se,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...ke},children:[p(Be,{headerText:"Swap",onBackClick:h,isSameChain:G,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:I}),p("div",{className:"overflow-hidden",children:we})]}),(te||ie)&&p("div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:c,height:`${Ae}px`,...ke,...ce((v||x)&&!d)},children:v||ee?p(de,{fallback:null,children:p(st,{toggle:h,side:be,otherAsset:le,onMoreChainsClick:M,selectedChainFilter:L})}):p(de,{fallback:null,children:p(dt,{toggle:h,side:xe,onChainSelect:U})})})]}):We("div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[p(Be,{headerText:H(),onBackClick:h,isSameChain:G,isWrappingPair:N,isUnwrappingPair:W,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:I}),We("div",{className:"relative overflow-hidden",children:[D&&p("div",{className:"overflow-hidden",style:Ne?{pointerEvents:"none"}:void 0,children:we}),(i==="wallet"||m==="wallet")&&p("div",{className:"absolute inset-0 overflow-hidden",style:ce(i==="wallet"&&!d),children:p(de,{fallback:null,children:q==="none"?p(Qt,{}):p(Dt,{})})}),$&&te&&p("div",{className:"absolute inset-0 overflow-hidden",style:ce(y),children:p(de,{fallback:null,children:p(st,{toggle:h,side:be,otherAsset:le,onMoreChainsClick:M,selectedChainFilter:L})})}),$&&ie&&p("div",{className:"absolute inset-0 overflow-hidden",style:ce(J),children:p(de,{fallback:null,children:p(dt,{toggle:h,side:xe,onChainSelect:U})})})]})]})},lt=({onSwapComplete:e,defaultBaseToken:t,defaultQuoteToken:c,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:b,cardWidth:k})=>{let{address:N}=_(),W=n(w=>w.recipient);return p(Oe,{defaultBaseToken:t,defaultQuoteToken:c,onBaseTokenChange:a,onQuoteTokenChange:s,children:p(Ie,{recipient:W,children:p(_t,{onSwapComplete:e,cardStyles:b,cardWidth:k})})})};import{createContext as Yt,useContext as Gt}from"react";var Ee={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},he={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Fe(e){let t={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return t["--widget-font-sans"]=e["font-sans"]||"inherit",t["--widget-font-mono"]=e["font-mono"]||"inherit",t["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",t["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",t["--widget-shadow-blur"]=e["shadow-blur"]||"3px",t["--widget-shadow-spread"]=e["shadow-spread"]||"0px",t["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",t["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",t["--widget-letter-spacing"]=e["letter-spacing"]||"normal",t["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",t["--widget-status-received"]=e["status-received"]||"#fbbf24",t["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",t["--widget-status-failed"]=e["status-failed"]||"#fb7185",t}import{jsx as Jt}from"react/jsx-runtime";var ct=Yt(he);function He({theme:e,children:t}){return Jt(ct.Provider,{value:e,children:t})}function Zt(){return Gt(ct)}import{jsx as K,jsxs as wt}from"react/jsx-runtime";var ei=[],ti=[],ii=[],pt=[],ri=`
|
|
2
|
+
import{a as Je}from"./chunk-IRK2XRZH.js";import{a as mt,b as vt,c as Pe,d as Ie,e as we,f as Ze,g as fe,h as ne,i as se,j as Xe,k as xt,l as kt,m as St,n as Ct,o as Tt,p as Rt,q as Wt,r as Nt,s as At,t as Pt,u as It,v as et,w as tt}from"./chunk-S2KAWPNR.js";import"./chunk-OPN7WCJR.js";import{a as ht,b as bt,c as n,d as yt,e as Oe,f as ue}from"./chunk-2QYGEJLV.js";import{a as Ue,b as ge}from"./chunk-OIE7DWV7.js";import{D as Te,L as Ge,b as $e,d as je,g as De,j as Qe,l as _e,n as Ke,y as Ye}from"./chunk-35CBCDGI.js";import{a as Q}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import ei,{useMemo as gt}from"react";import{Suspense as X,lazy as le,useCallback as me,useEffect as Re,useRef as qe,useState as nt}from"react";import{useShallow as Ut}from"zustand/react/shallow";import{useCallback as de,useEffect as Ot,useMemo as zt,useRef as Mt,useState as it}from"react";import{useShallow as Bt}from"zustand/react/shallow";import{Fragment as ze,jsx as l,jsxs as P}from"react/jsx-runtime";var qt=({onSwapComplete:e,onSwapInitiated:i})=>{let{web3ConnectionType:g,hasConnectHandler:a,lockBase:s,lockQuote:h,disableInverting:k,tokenDisplay:W,tokenBadgeOrientation:R,widgetType:w}=ge(),S=W==="pill"||W==="ghost",C=w==="compact",O=C?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2",z=C?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2",{baseToken:r,quoteToken:t,baseAmount:d,quoteAmount:T,isBaseGasToken:ee,isQuoteGasToken:K,isWrappingPair:u,isUnwrappingPair:p,baseBalance:f,quoteBalance:Y,setBaseAmount:N,setQuoteAmount:v,swapTokens:V,clearForm:M}=ue(),{rfqQuote:L,status:G,handleInputChange:q,ensureForParams:y,stop:E,clear:U,refresh:A}=we(),{address:x}=Q(),{openConnectModal:Z}=fe(),{isRecipientInputOpen:B,txStatus:$}=n(Bt(o=>({isRecipientInputOpen:o.isRecipientInputOpen,txStatus:o.txStatus}))),[j,te]=it(null),[D,ie]=it(null),re=Mt(!1),b=!1,J=zt(()=>!r||!t||typeof d!="number"||!T||!x||parseFloat(f.formatted)<d?null:{base:r,quote:t,baseAmount:d,quoteAmount:T,userAddress:x},[r,t,d,T,x,f.formatted]),he=de(o=>{ie(o),n.getState().startTracking(o)},[]),be=de(()=>{re.current=!0,A()},[A]);Ot(()=>{if(j===null&&!(!r||!t)){if(!d||d<=0){q({amount:null,inputToken:r,outputToken:t,setOutputAmount:v});return}if(u||p){v(d);return}q({amount:d,inputToken:r,outputToken:t,setOutputAmount:v})}},[j,d,r,t,u,p,q,v]);let ce=de(()=>{n.getState().setView("baseSelection")},[]),ye=de(()=>{n.getState().setView("quoteSelection")},[]),xe=de(()=>{V(),v(null)},[V,v]),ae=de(()=>{if(!f.formatted||!r||!t)return;let o=parseFloat(f.formatted);if(!o||o<=0)return;let F=o*.9999999999;u||p?(N(F),v(F),U()):(N(F),v(null),y({inputToken:r,outputToken:t,inputAmount:F.toString(),setOutputAmount:oe=>v(oe)}))},[f.formatted,r,t,u,p,N,v,U,y]),Ne=de(()=>{U(),M()},[U,M]),pe=f.formatted?parseFloat(f.formatted):null,ke=!!(d||T),Se=r?.price&&d?`$${(r.price*d).toFixed(2)}`:"$0.00",Ae=t?.price&&T?`$${(t.price*T).toFixed(2)}`:"$0.00",Ce=j==="trackingTx"&&!!D&&!!r&&!!t&&!!d&&!!T;return P("div",{className:"flex flex-col w-full",children:[Ce&&D&&r&&t&&d&&T?l("div",{className:"overflow-hidden",children:l(tt,{orderHash:D,base:r,quote:t,baseAmount:d,quoteAmount:T,status:$})}):P(ze,{children:[P("div",{className:`relative ${O}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[S?C?P("div",{className:`flex items-center gap-2 mb-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[l(se,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),l("div",{className:"flex-1 min-w-0",children:l(ne,{side:"base",asset:r??null,otherAsset:t??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):P("div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[l(se,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),l(ne,{side:"base",asset:r??null,otherAsset:t??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):P(ze,{children:[l(se,{toggle:ce,side:"base",asset:r,isPlacingOrder:b||s}),l(ne,{side:"base",asset:r??null,otherAsset:t??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}),P("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[l("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Se}),x&&pe!==null&&pe>0&&l("button",{type:"button",onClick:ae,disabled:b,className:"absolute bottom-3 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",style:{borderRadius:"var(--widget-radius)"},children:"Max"})]})]}),!k&&l("div",{className:"flex justify-center -my-4 relative z-10",children:P("button",{type:"button",onClick:xe,"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:[l("span",{className:"text-2xs",children:"\u2191"}),l("span",{className:"text-2xs",children:"\u2193"})]})}),P("div",{className:`relative ${z}`,children:[S?C?P("div",{className:`flex items-center gap-2 ${R==="right"?"flex-row-reverse":"flex-row"}`,children:[l(se,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),l("div",{className:"flex-1 min-w-0",children:l(ne,{side:"quote",asset:t??null,otherAsset:r??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})})]}):P("div",{className:`flex flex-col ${R==="right"?"items-end":"items-start"}`,children:[l(se,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),l(ne,{side:"quote",asset:t??null,otherAsset:r??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}):P(ze,{children:[l(se,{toggle:ye,side:"quote",asset:t,isPlacingOrder:b||h}),l(ne,{side:"quote",asset:t??null,otherAsset:r??null,isPlacingOrder:b,isWrappingPair:u,isUnwrappingPair:p})]}),P("div",{className:"flex w-full flex-row items-center justify-between",children:[l("p",{className:"mono text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ae}),ke&&l("button",{type:"button",onClick:Ne,disabled:b,className:"absolute bottom-2 right-4 flex items-center px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",style:{borderRadius:"var(--widget-radius)"},children:"Clear"})]})]}),l("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:B?"1px solid var(--widget-border)":"none",maxHeight:B?"60px":"0px",opacity:B?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:l(Xe,{})}),l("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:l(Je,{})})]}),l("div",{className:`relative ${Ce?"px-0":"px-4"} ${C?"py-2":"py-4"}`,children:x&&r&&t&&d&&d>0?l(et,{base:r,baseAmount:d,quote:t,quoteAmount:T??0,userAddress:x,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:ee,isQuoteGasToken:K,reviewActionProps:J,reviewState:j,setReviewState:te,trackedOrderHash:D,setTrackedOrderHash:ie,onSwapComplete:e,onSwapInitiated:i,onOrderSubmitted:he,onStaleQuoteRestart:be,txStatus:$}):!x&&a?l("button",{onClick:()=>Z(),className:`w-full ${C?"py-2":"py-3"} text-sm font-medium cursor-pointer transition-opacity hover:opacity-80`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:"Connect Wallet"}):l("button",{disabled:!0,className:`w-full ${C?"py-2":"py-3"} text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed`,style:{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"},children:x?"Enter Amount":"Connect Wallet"})})]})},rt=qt;import{jsx as I,jsxs as Me}from"react/jsx-runtime";var at=()=>Me("div",{className:"flex flex-col w-full",children:[Me("div",{className:"relative px-4 pt-4 pb-2",style:{borderBottom:"1px solid var(--widget-border)"},children:[I("div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),I("div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),I("div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:I("div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),I("div",{className:"flex justify-center -my-4 relative z-10",children:I("div",{className:"h-8 w-8",style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)",borderRadius:"9999px"}})}),Me("div",{className:"relative px-4 pt-6 pb-2",children:[I("div",{className:"h-12 w-full animate-pulse",style:{backgroundColor:"var(--widget-secondary)",borderRadius:"0.25rem"}}),I("div",{className:"mt-2 h-20 w-2/3 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.5,borderRadius:"0.25rem"}}),I("div",{className:"mt-1 mb-1 flex w-full items-center justify-between",children:I("div",{className:"h-4 w-12 animate-pulse",style:{backgroundColor:"var(--widget-secondary)",opacity:.4,borderRadius:"0.25rem"}})})]}),I("div",{className:"px-4",style:{height:"28px",borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"}}),I("div",{className:"relative px-4 py-4",children:I("div",{className:"w-full animate-pulse",style:{height:"44px",backgroundColor:"var(--widget-secondary)",borderRadius:"var(--widget-radius)",opacity:.6}})})]});import{useEffect as Et,useState as ot}from"react";import{useShallow as Ft}from"zustand/react/shallow";import{Fragment as Lt,jsx as m,jsxs as H}from"react/jsx-runtime";var Ht=({targetText:e,isError:i})=>{let{displayText:g,suffix:a,characterColors:s}=Ye(e,i);return H(Lt,{children:[g.split("").map((h,k)=>m("span",{style:s[k]?{color:"var(--widget-destructive)"}:void 0,children:h},k)),m("span",{style:{color:i?"var(--widget-destructive)":"var(--widget-muted-foreground)",opacity:i?.5:1},children:a})]})},Vt=({headerText:e,onBackClick:i,isSameChain:g,isWrappingPair:a,isUnwrappingPair:s,hasLowLiquidity:h,hasInsufficientLiquidity:k,hasRoutingError:W,hasSizeCapError:R})=>{let w=n(y=>y.view),{isRecipientInputOpen:S,hasAllowanceError:C,hoveredChainName:O,isTrackingTx:z,txStatus:r,walletTab:t}=n(Ft(y=>({isRecipientInputOpen:y.isRecipientInputOpen,hasAllowanceError:y.hasAllowanceError,hoveredChainName:y.hoveredChainName,isTrackingTx:y.isTrackingTx,txStatus:y.txStatus,walletTab:y.walletTab}))),{swapHeaderVariant:d,walletButtonEnabled:T}=ge(),{isConnected:ee}=Q(),[K,u]=ot(!1);Et(()=>u(!0),[]);let[p,f]=ot(!1),Y=`${w}-${p}-${S}-${O||"none"}`,v=(()=>{if(z&&r)switch(r){case"pending":return"Trade Pending";case"received":return"Trade Received";case"completed":return"Trade Filled";case"failed":return"Trade Failed";case"cancelled":return"Trade Cancelled";default:return"Processing Trade"}if(O&&(w==="baseSelection"||w==="quoteSelection"||w==="baseChainSelection"||w==="quoteChainSelection"))return O;if(w==="swap"&&p)return S?"Remove Custom Recipient":"Add Custom Recipient";switch(w){case"wallet":return"Wallet";case"activity":return"Activity";case"baseSelection":return"Select Source Token";case"quoteSelection":return"Select Destination Token";case"baseChainSelection":return"Select Source Chain";case"quoteChainSelection":return"Select Destination Chain";default:if(w==="swap"){if(C&&!a&&!s)return"Allowance check failed";if(R&&!a&&!s)return"Size limit exceeded";if(k&&!a&&!s)return"Insufficient Liquidity";if(W&&!a&&!s)return"Route Not Found";if(h&&!a&&!s)return"High Price Impact"}return g&&!a&&!s?"Swap":a?"Wrap":s?"Unwrap":e}})(),V=!z&&w==="swap"&&!p&&(C&&!a&&!s||R&&!a&&!s||k&&!a&&!s||W&&!a&&!s||h&&!a&&!s),M={pending:"var(--widget-status-pending)",received:"var(--widget-status-received)",completed:"var(--widget-status-completed)",failed:"var(--widget-status-failed)",cancelled:"var(--widget-status-failed)"},L=()=>!z||!r?null:M[r]??null,G=()=>z?null:w==="swap"?H("div",{className:"flex items-center gap-2",children:[T&&K&&ee&&m("button",{onClick:()=>n.getState().setView("activity"),"aria-label":"Open activity",className:"size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors text-(--widget-muted-foreground) opacity-60 hover:text-(--widget-foreground) hover:opacity-100",children:H("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m("rect",{x:"2",y:"5",width:"20",height:"15",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),m("path",{d:"M16 12C16 11.4477 16.4477 11 17 11H21V13H17C16.4477 13 16 12.5523 16 12Z",fill:"currentColor"}),m("path",{d:"M2 9H22",stroke:"currentColor",strokeWidth:"1.5"})]})}),m("button",{onClick:()=>n.getState().toggleRecipientInput(),onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),"aria-label":S?"Remove custom recipient":"Add custom recipient",className:`size-4 -translate-y-0.5 flex cursor-pointer items-center justify-center rounded-full transition-colors hover:text-(--widget-foreground) hover:opacity-100 ${S?"text-(--widget-destructive) opacity-80":"text-(--widget-muted-foreground) opacity-60"}`,children:H("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m("path",{d:"M2 7.75C1.58579 7.75 1.25 8.08579 1.25 8.5C1.25 8.91421 1.58579 9.25 2 9.25V7.75ZM2 8.5V9.25H13.5V8.5V7.75H2V8.5Z",fill:"currentColor"}),m("path",{d:"M6 16.5H8",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),m("path",{d:"M10.5 16.5H14.5",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"butt",strokeLinejoin:"miter"}),m("path",{d:"M22 12.03V16.11C22 20.5 22 20.5 17.56 20.5H6.44C2 20.5 2 20.5 2 16.11V7.89C2 3.5 2 3.5 6.44 3.5H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"miter"}),H("g",{style:{transform:`rotate(${S?"45deg":"0deg"})`,transformOrigin:"18.75px 6.75px",transition:"transform 150ms ease-out"},children:[m("path",{d:"M15 6.75H22.5",stroke:"currentColor",strokeWidth:"1.5"}),m("path",{d:"M18.75 10.5V3",stroke:"currentColor",strokeWidth:"1.5"})]})]})})]}):H("button",{onClick:()=>i?i():n.getState().setView("swap"),className:"flex cursor-pointer items-center justify-center whitespace-nowrap h-6 transition-colors text-(--widget-muted-foreground) opacity-70 hover:text-(--widget-foreground) hover:opacity-100",children:[m("span",{className:"pr-1",children:"\u2190"}),m("span",{className:"text-sm",children:"Back"})]}),q=L();return d==="none"?null:H("div",{className:"w-full pt-3 px-2 mono text-base flex flex-row justify-between h-6 shrink-0",children:[w==="wallet"?H("div",{className:"flex items-center gap-1 mono uppercase -translate-y-0.5 text-xs",children:[H("button",{type:"button",onClick:()=>n.getState().setWalletTab("wallet"),className:"cursor-pointer transition-colors",style:{color:t==="wallet"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:[m("span",{style:{color:"var(--widget-muted-foreground)"},children:">> "}),m("span",{children:"Wallet"})]}),m("span",{style:{color:"var(--widget-foreground)",opacity:.4},children:">>"}),m("button",{type:"button",onClick:()=>n.getState().setWalletTab("activity"),className:"cursor-pointer transition-colors",style:{color:t==="activity"?"var(--widget-foreground)":"var(--widget-muted-foreground)"},children:"Activity"})]}):H("div",{className:"mono uppercase -translate-y-0.5 text-xs flex items-center",children:[m("span",{className:"mr-1.5",style:{color:"var(--widget-muted-foreground)",opacity:.4},children:">> "}),m("span",{className:"relative",style:{color:q||"var(--widget-foreground)"},children:m(Ht,{targetText:v,isError:V??!1})},Y)]}),m("div",{className:"flex flex-row items-center",children:G()})]})},Be=Vt;import{Fragment as Yt,jsx as c,jsxs as We}from"react/jsx-runtime";var st=le(()=>import("./AssetSelectionMenu-XUE3KY7F.js")),dt=le(()=>import("./ChainSelectionMenu-IFRFS3IB.js")),$t=le(()=>import("./SwapFormHorizontal-MGK4QJBZ.js")),jt=le(()=>import("./SwapFormSplit-GLQEEJSQ.js")),Dt=le(()=>import("./WidgetWalletPanel-43R52FTI.js").then(e=>({default:e.WidgetWalletPanel}))),Qt=le(()=>import("./WalletPlaceholderPanel-Z4JCFCNV.js").then(e=>({default:e.WalletPlaceholderPanel}))),_t=le(()=>import("./WidgetWalletTradeHistory-QXIWCKMB.js").then(e=>({default:e.WidgetWalletTradeHistory}))),Kt=({onSwapComplete:e,cardStyles:i,cardWidth:g})=>{let{baseToken:a,quoteToken:s,baseAmount:h,quoteAmount:k,isWrappingPair:W,isUnwrappingPair:R,isRegistryLoading:w}=ue(),{liquidityError:S,routingError:C,sizeCapError:O,stop:z,clear:r}=we(),t=n(o=>o.view),{isTransitioning:d,isRecipientInputOpen:T,recipient:ee,selectedChainFilterChainId:K}=n(Ut(o=>({isTransitioning:o.isTransitioning,isRecipientInputOpen:o.isRecipientInputOpen,recipient:o.recipient,selectedChainFilterChainId:o.selectedChainFilter?.chainId??null}))),u=qe(null),p=qe(null),[f,Y]=nt(null);Pe(),Re(()=>()=>{u.current&&clearTimeout(u.current),p.current&&clearTimeout(p.current)},[]),Re(()=>{n.getState().resetUI()},[]),Re(()=>{if(d)return u.current=setTimeout(()=>{n.getState().setIsTransitioning(!1),u.current=null},20),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[d]);let N=me((o,F="navigation")=>{p.current&&(clearTimeout(p.current),p.current=null,Y(null)),n.getState().view!=="swap"&&o!=="swap"?(n.getState().setView(o),n.getState().setIsTransitioning(!1)):n.getState().transitionToView(o,F)},[]),v=me(()=>{u.current&&(clearTimeout(u.current),u.current=null),p.current&&(clearTimeout(p.current),p.current=null);let o=n.getState().view;Y(o),n.getState().setChainFilter(null),n.getState().setView("swap"),n.getState().setIsTransitioning(!1),n.getState().resetAssetSelection(),p.current=setTimeout(()=>{Y(null),p.current=null},200)},[]),V=me(o=>{let oe=t==="baseChainSelection"?"base":"quote";n.getState().setChainFilter({chainId:o,side:oe}),n.getState().pushRecentChain(o),N(oe==="base"?"baseSelection":"quoteSelection","chainSelection")},[t,N]),M=me(()=>{let o=n.getState().view;o==="baseSelection"?N("baseChainSelection","chainSelection"):o==="quoteSelection"&&N("quoteChainSelection","chainSelection")},[N]),L=me(()=>{z(),r()},[z,r]),G=a&&s?a.chainId===s.chainId:!0,q=()=>{switch(t){case"wallet":return"Wallet";case"baseSelection":return"Select Input Token";case"quoteSelection":return"Select Output Token";case"baseChainSelection":case"quoteChainSelection":return"Select Chain";default:return"Swap"}},{assetMenuVariant:y,widgetType:E,customWalletUI:U}=ge(),A=t==="baseSelection"||t==="quoteSelection",x=t==="baseChainSelection"||t==="quoteChainSelection",Z=y==="split"&&(E==="default"||E==="compact"),B=y==="split"&&(E==="horizontal"||E==="split"),$=y==="default",j=t==="swap"||A||x||t==="wallet"||t==="activity",te=f==="baseSelection"||f==="quoteSelection",D=f==="baseChainSelection"||f==="quoteChainSelection",ie=A||te,re=x||D,b=A&&!d,J=x&&!d,he=A?t:f,be=he==="baseSelection"?"base":"quote",ce=he==="baseSelection"?s:a,xe=(x?t:f)==="baseChainSelection"?"base":"quote",ae=o=>({backgroundColor:"var(--widget-background)",opacity:o?1:0,transform:o?"translateY(0)":"translateY(6px)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),Ne=$&&(A||x||t==="wallet"||t==="activity"||f!=null),pe=w?c(at,{}):E==="horizontal"?c(X,{fallback:null,children:c($t,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):E==="split"?c(X,{fallback:null,children:c(jt,{onSwapComplete:e,onSwapInitiated:L,onBackToSwap:B?v:void 0,onMoreChainsClick:B?M:void 0})}):c(rt,{onSwapComplete:e,onSwapInitiated:L}),ke=i??{},Se=qe(null),[Ae,Ce]=nt(420);return Re(()=>{if(!Z)return;let o=Se.current;if(!o)return;let F=new ResizeObserver(oe=>{for(let ft of oe)Ce(ft.contentRect.height)});return F.observe(o),()=>F.disconnect()},[Z]),Z?We(Yt,{children:[We("div",{ref:Se,className:"flex flex-col w-full overflow-hidden transition-colors duration-300",style:{flex:"1 1 0",minWidth:0,...ke},children:[c(Be,{headerText:"Swap",onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),c("div",{className:"overflow-hidden",children:pe})]}),(ie||re)&&c("div",{className:"flex flex-col overflow-hidden shrink-0",style:{width:g,height:`${Ae}px`,...ke,...ae((A||x)&&!d)},children:A||te?c(X,{fallback:null,children:c(st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})}):c(X,{fallback:null,children:c(dt,{toggle:v,side:xe,onChainSelect:V})})})]}):We("div",{className:"flex flex-col w-full",style:{overflow:"hidden",position:"relative"},children:[c(Be,{headerText:q(),onBackClick:v,isSameChain:G,isWrappingPair:W,isUnwrappingPair:R,hasLowLiquidity:S,hasInsufficientLiquidity:S,hasRoutingError:C,hasSizeCapError:O}),We("div",{className:"relative overflow-hidden",children:[j&&c("div",{className:"overflow-hidden",style:Ne?{pointerEvents:"none"}:void 0,children:pe}),(t==="wallet"||f==="wallet")&&c("div",{className:"absolute inset-0 overflow-hidden",style:ae(t==="wallet"&&!d),children:c(X,{fallback:null,children:U==="none"?c(Qt,{}):c(Dt,{})})}),(t==="activity"||f==="activity")&&c("div",{className:"absolute inset-0 overflow-y-auto",style:ae(t==="activity"&&!d),children:c(X,{fallback:null,children:c(_t,{isActive:t==="activity"})})}),$&&ie&&c("div",{className:"absolute inset-0 overflow-hidden",style:ae(b),children:c(X,{fallback:null,children:c(st,{toggle:v,side:be,otherAsset:ce,onMoreChainsClick:M,selectedChainFilter:K})})}),$&&re&&c("div",{className:"absolute inset-0 overflow-hidden",style:ae(J),children:c(X,{fallback:null,children:c(dt,{toggle:v,side:xe,onChainSelect:V})})})]})]})},lt=({onSwapComplete:e,defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:h,cardWidth:k})=>{let{address:W}=Q(),R=n(w=>w.recipient);return c(Oe,{defaultBaseToken:i,defaultQuoteToken:g,onBaseTokenChange:a,onQuoteTokenChange:s,children:c(Ie,{recipient:R,children:c(Kt,{onSwapComplete:e,cardStyles:h,cardWidth:k})})})};import{createContext as Gt,useContext as Zt}from"react";var Ee={background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff","card-foreground":"#0a0a0a",popover:"#ffffff","popover-foreground":"#0a0a0a",primary:"#171717","primary-foreground":"#fafafa",secondary:"#f5f5f5","secondary-foreground":"#171717",muted:"#f5f5f5","muted-foreground":"#737373",accent:"#f5f5f5","accent-foreground":"#171717",destructive:"#e7000b","destructive-foreground":"#ffffff",border:"#e5e5e5",input:"#e5e5e5",ring:"#a1a1a1",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#f59e0b","status-completed":"#10b981","status-failed":"#ef4444"},ve={background:"#0a0a0a",foreground:"#fafafa",card:"#171717","card-foreground":"#fafafa",popover:"#262626","popover-foreground":"#fafafa",primary:"#e5e5e5","primary-foreground":"#171717",secondary:"#262626","secondary-foreground":"#fafafa",muted:"#262626","muted-foreground":"#a1a1a1",accent:"#404040","accent-foreground":"#fafafa",destructive:"#ff6467","destructive-foreground":"#fafafa",border:"#282828",input:"#343434",ring:"#737373",radius:"0.625rem","border-style":"dotted","status-pending":"#a1a1aa","status-received":"#fbbf24","status-completed":"#2dd4bf","status-failed":"#fb7185"};function Fe(e){let i={"--widget-background":e.background,"--widget-foreground":e.foreground,"--widget-card":e.card,"--widget-card-foreground":e["card-foreground"],"--widget-popover":e.popover,"--widget-popover-foreground":e["popover-foreground"],"--widget-primary":e.primary,"--widget-primary-foreground":e["primary-foreground"],"--widget-secondary":e.secondary,"--widget-secondary-foreground":e["secondary-foreground"],"--widget-muted":e.muted,"--widget-muted-foreground":e["muted-foreground"],"--widget-accent":e.accent,"--widget-accent-foreground":e["accent-foreground"],"--widget-destructive":e.destructive,"--widget-destructive-foreground":e["destructive-foreground"],"--widget-border":e.border,"--widget-input":e.input,"--widget-ring":e.ring,"--widget-radius":e.radius,"--widget-border-style":e["border-style"]||"dotted"};return i["--widget-font-sans"]=e["font-sans"]||"inherit",i["--widget-font-mono"]=e["font-mono"]||"inherit",i["--widget-shadow-color"]=e["shadow-color"]||"oklch(0 0 0)",i["--widget-shadow-opacity"]=e["shadow-opacity"]||"0.1",i["--widget-shadow-blur"]=e["shadow-blur"]||"3px",i["--widget-shadow-spread"]=e["shadow-spread"]||"0px",i["--widget-shadow-offset-x"]=e["shadow-offset-x"]||"0",i["--widget-shadow-offset-y"]=e["shadow-offset-y"]||"1px",i["--widget-letter-spacing"]=e["letter-spacing"]||"normal",i["--widget-status-pending"]=e["status-pending"]||"#a1a1aa",i["--widget-status-received"]=e["status-received"]||"#fbbf24",i["--widget-status-completed"]=e["status-completed"]||"#2dd4bf",i["--widget-status-failed"]=e["status-failed"]||"#fb7185",i}import{jsx as Xt}from"react/jsx-runtime";var ct=Gt(ve);function He({theme:e,children:i}){return Xt(ct.Provider,{value:e,children:i})}function Jt(){return Zt(ct)}import{jsx as _,jsxs as wt}from"react/jsx-runtime";var ti=[],ii=[],ri=[],pt=[],ai=`
|
|
3
3
|
.aori-widget .text-2xs { font-size: 0.75rem; }
|
|
4
4
|
.aori-widget .text-3xs { font-size: 0.68rem; }
|
|
5
5
|
.aori-widget ::-webkit-scrollbar { width: 0px; height: 0px; display: none; }
|
|
@@ -7,4 +7,4 @@ import{a as Je}from"./chunk-4BQRVCQR.js";import{a as mt,b as ht,c as Pe,d as Ie,
|
|
|
7
7
|
.aori-widget input:focus, .aori-widget input:focus-visible,
|
|
8
8
|
.aori-widget button:focus, .aori-widget button:focus-visible,
|
|
9
9
|
.aori-widget select:focus, .aori-widget select:focus-visible { outline: none; }
|
|
10
|
-
`,Ve=class extends
|
|
10
|
+
`,Ve=class extends ei.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?wt("div",{style:{padding:"1.5rem",textAlign:"center",color:"var(--widget-foreground, #888)",fontFamily:"system-ui, sans-serif"},children:[_("p",{style:{margin:"0 0 0.75rem",fontSize:"0.875rem"},children:"Something went wrong."}),_("button",{type:"button",onClick:()=>this.setState({hasError:!1}),style:{padding:"0.375rem 1rem",fontSize:"0.8125rem",cursor:"pointer",border:"1px solid currentColor",borderRadius:"0.25rem",background:"transparent",color:"inherit"},children:"Retry"})]}):this.props.children}};function oi(e){let i=e.theme.mode==="light"?Ee:ve,g=e.theme.mode==="light"?e.theme.light:e.theme.dark;return g?{...i,...g}:i}function ni({config:e,className:i,onSwapComplete:g,onBaseTokenChange:a,onQuoteTokenChange:s,onRequestConnect:h,onRequestAccount:k,customWalletUI:W="builtin"}){_e(e.apiKey),Ke(e.rpcOverrides),Qe(e.vtApiBaseUrl);let R=oi(e),w=e.appearance?.widgetType??"default",S=e.appearance?.tokenDisplay??"default",C=e.appearance?.tokenBadgeOrientation??"left",O=e.appearance?.assetMenuVariant??"default",z=e.appearance?.amountInputVariant??"default",r=e.appearance?.hideAmountInputSymbol??!1,t=e.appearance?.swapButtonVariant??"default",d=e.appearance?.swapHeaderVariant??"default",T=e.appearance?.quoteLoaderVariant??"default",ee=e.appearance?.walletButtonEnabled??!0,K=e.appearance?.fillContainer??!1,u=e.appearance?.hideBorder??!1,p=Fe(R),f=O==="split"&&(w==="default"||w==="compact"),Y=n(J=>J.view==="baseSelection"||J.view==="quoteSelection"||J.view==="baseChainSelection"||J.view==="quoteChainSelection"),N=w==="compact"?"22rem":"24rem",V=f?{maxWidth:Y?w==="compact"?"46rem":"49rem":N,transition:"max-width 0.3s ease",height:"auto",overflow:"visible",display:"flex",gap:"1rem",alignItems:"stretch",backgroundColor:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0}:{width:"100%",...K?{}:{maxWidth:w==="split"||w==="horizontal"?"48rem":w==="compact"?"22rem":"24rem"},height:"auto",overflow:"hidden"},M={boxSizing:"border-box",backgroundColor:"var(--widget-background)",color:"var(--widget-foreground)",borderRadius:"var(--widget-radius)",...u?{border:"none"}:{borderWidth:"1px",borderStyle:"var(--widget-border-style)",borderColor:"var(--widget-border)"},boxShadow:"var(--widget-shadow-offset-x) var(--widget-shadow-offset-y) var(--widget-shadow-blur) var(--widget-shadow-spread) color-mix(in srgb, var(--widget-shadow-color) calc(var(--widget-shadow-opacity) * 100%), transparent)",padding:"0.25rem 0.5rem",paddingTop:"0.25rem"},L=e.tokens?.enabledChains??ti,G=e.tokens?.supportedInputTokens??ii,q=e.tokens?.supportedOutputTokens??ri,y=e.tokens?.supportedInputChains??pt,E=e.tokens?.supportedOutputChains??pt,U=e.tokens?.inputSelectionSearch??!0,A=e.tokens?.outputSelectionSearch??!0,x=e.tokens?.showInputSelectionTokenBalances??!0,Z=e.tokens?.showOutputSelectionTokenBalances??!0,B=e.tokens?.lockBase??!1,$=e.tokens?.lockQuote??!1,j=e.tokens?.disableInverting??!1,te=e.settings?.defaultSlippage??.01,D=!!h,ie=gt(()=>({apiKey:e.apiKey,web3ConnectionType:"custom",enabledChains:L,supportedInputTokens:G,supportedOutputTokens:q,supportedInputChains:y,supportedOutputChains:E,inputSelectionSearch:U,outputSelectionSearch:A,showInputSelectionTokenBalances:x,showOutputSelectionTokenBalances:Z,lockBase:B,lockQuote:$,disableInverting:j,defaultSlippage:te,widgetType:w,tokenDisplay:S,tokenBadgeOrientation:C,assetMenuVariant:O,amountInputVariant:z,hideAmountInputSymbol:r,swapButtonVariant:t,swapHeaderVariant:d,quoteLoaderVariant:T,walletButtonEnabled:ee,hasConnectHandler:D,customWalletUI:W}),[e.apiKey,L,G,q,y,E,U,A,x,Z,B,$,j,te,w,S,C,O,z,r,t,d,T,ee,D,W]),re=gt(()=>h?{openConnectModal:h,openAccountModal:k}:null,[h,k]),b=_(Ge,{children:_(Ue.Provider,{value:ie,children:_(He,{theme:R,children:wt("div",{className:`aori-widget${i?` ${i}`:""}`,style:{...p,"--font-sans":"var(--widget-font-sans)","--font-mono":"var(--widget-font-mono)",fontFamily:"var(--widget-font-sans)",letterSpacing:"var(--widget-letter-spacing)",width:"100%",...V,position:"relative",...f?{}:M},children:[_("style",{dangerouslySetInnerHTML:{__html:ai}}),_(Ve,{children:_(lt,{onSwapComplete:g,defaultBaseToken:e.tokens?.defaultBase,defaultQuoteToken:e.tokens?.defaultQuote,onBaseTokenChange:a,onQuoteTokenChange:s,cardStyles:f?M:void 0,cardWidth:f?N:void 0})})]})})})});return re?_(Ze.Provider,{value:re,children:b}):b}import{jsx as di}from"react/jsx-runtime";function si(){let{openConnectModal:e}=fe(),{isConnected:i,address:g}=Q(),a=i&&g?`${g.slice(0,6)}...${g.slice(-4)}`:"Connect";return di("button",{type:"button",onClick:()=>e(),className:"h-8 cursor-pointer px-3 text-xs font-bold uppercase tracking-wide transition-colors duration-150 border border-border rounded-sm bg-card text-foreground hover:bg-secondary hover:border-foreground/20",children:a})}import{http as ut,fallback as li}from"wagmi";function ci(e){let i=Object.entries($e);return Object.fromEntries(i.map(([g,a])=>{let s=e?.[Number(g)],h=s?Array.isArray(s)?s:[s]:[],k=h.length>0?[...h,...a.rpcUrls]:a.rpcUrls;return[g,k.length>1?li(k.map(W=>ut(W,{batch:{batchSize:50,wait:50}}))):ut(k[0],{batch:{batchSize:50,wait:50}})]}))}var gi=je().map(e=>e.wagmiChain);import{useMemo as Le}from"react";var pi=e=>{let{tokenRegistry:i,isLoadingRegistry:g,error:a}=Te();return{tokens:Le(()=>i.filter(h=>h.chainId===e),[i,e]),isLoading:g,error:a}},wi=(e,i)=>{let{tokenRegistry:g}=Te();return Le(()=>!e||!g.length?!1:g.some(a=>a.address.toLowerCase()===e.toLowerCase()&&a.chainId===i),[g,e,i])},ui=(e,i)=>{let{getToken:g}=Te();return Le(()=>{if(!(!e||!i))return g(i,e)},[g,e,i])},Nr=De();export{Ct as ChainSwitch,si as ConnectButton,Ie as RfqProvider,Tt as SignSwap,Oe as SwapFormProvider,ni as SwapWidget,He as WidgetThemeProvider,ci as buildTransports,Wt as canSubmitOrder,At as cleanupOldSubmissions,ve as defaultDarkTheme,Ee as defaultLightTheme,Rt as isQuoteFresh,Nt as markOrderAsSubmitted,xt as pollOrderStatus,Fe as themeToCSS,mt as useBalanceEventListener,Pe as useBalanceEventSubscription,vt as useEmitBalanceEvent,wi as useIsTokenSupported,kt as useOrderStatusPolling,we as useRfq,yt as useSwapForm,ue as useSwapFormContext,ui as useTokenByAddress,bt as useTokenSelection,ht as useTokenSelectionStore,pi as useTokensForChain,St as useTransactionRegistry,Pt as useUnwrapToken,fe as useWalletModal,Q as useWalletState,n as useWidgetSwapUIStore,Jt as useWidgetTheme,It as useWrapToken,gi as wagmiChains};
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
"use client";var _chunkHTWUZKYOcjs = require('./chunk-HTWUZKYO.cjs');require('./chunk-UZWGYG2S.cjs');require('./chunk-LXEKOQAG.cjs');require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');exports.default = _chunkHTWUZKYOcjs.a;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";import{a as ne}from"./chunk-4BQRVCQR.js";import{e as oe,g as se,h as f,i as w,j as re,v as ae,w as le}from"./chunk-XYF2YBR3.js";import{a as $}from"./chunk-4LJJMEOG.js";import{a as B}from"./chunk-FDQKBTWP.js";import"./chunk-OPN7WCJR.js";import{c as d,f as ie}from"./chunk-726CI6GC.js";import{b as ee}from"./chunk-EW2OR6CJ.js";import{a as te}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as p,useEffect as Fe,useMemo as Me,useRef as Ie,useState as de}from"react";import{useShallow as We}from"zustand/react/shallow";import{Fragment as k,jsx as e,jsxs as r}from"react/jsx-runtime";var P=()=>{},$e=({onSwapComplete:ue,onSwapInitiated:ce,onBackToSwap:h,onMoreChainsClick:Be})=>{let{web3ConnectionType:He,hasConnectHandler:pe,lockBase:O,lockQuote:N,disableInverting:me,swapButtonVariant:q,tokenDisplay:H,tokenBadgeOrientation:x,widgetType:ge,assetMenuVariant:fe}=ee(),Q=H==="pill"||H==="ghost",T=ge==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:we,isQuoteGasToken:ve,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:Qe,setBaseAmount:R,setQuoteAmount:c,swapTokens:U,clearForm:V}=ie(),{rfqQuote:Ue,status:Ve,handleInputChange:F,ensureForParams:j,stop:je,clear:S,refresh:G}=oe(),{address:m}=te(),{openConnectModal:be}=se(),{isRecipientInputOpen:M,txStatus:z,view:v,selectedChainFilterChainId:D}=d(We(n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:n.selectedChainFilter?.chainId??null}))),[C,he]=de(null),[y,E]=de(null),xe=Ie(!1),s=!1,Se=Me(()=>!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]),Ce=p(n=>{E(n),d.getState().startTracking(n)},[]),ye=p(()=>{xe.current=!0,G()},[G]);Fe(()=>{if(C===null&&!(!t||!o)){if(!i||i<=0){F({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}F({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[C,i,t,o,a,l,F,c]);let I=p(()=>{d.getState().setView("baseSelection")},[]),W=p(()=>{d.getState().setView("quoteSelection")},[]),Ae=p(()=>{U(),c(null)},[U,c]),Pe=p(()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let b=n*.9999999999;a||l?(R(b),c(b),S()):(R(b),c(null),j({inputToken:t,outputToken:o,inputAmount:b.toString(),setOutputAmount:A=>c(A)}))},[g.formatted,t,o,a,l,R,c,S,j]),ke=p(()=>{S(),V()},[S,V]),_=g.formatted?parseFloat(g.formatted):null,Oe=!!(i||u),L=fe==="split",J=L&&(v==="baseSelection"||v==="baseChainSelection"),K=L&&(v==="quoteSelection"||v==="quoteChainSelection"),X=p(n=>{let A=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:n,side:A}),d.getState().pushRecentChain(n),d.getState().transitionToView(A==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Ne=p(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),qe=p(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),Te=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Re=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",Y=C==="trackingTx"&&!!y&&!!t&&!!o&&!!i&&!!u,Z={backgroundColor:q==="default"?"var(--widget-primary)":"transparent",color:q==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:q!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[Y&&y&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(le,{orderHash:y,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${T?"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 ${J?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:J?v==="baseChainSelection"?e(B,{toggle:h??P,side:"base",onChainSelect:X}):e($,{toggle:h??P,side:"base",otherAsset:o,onMoreChainsClick:Ne,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),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 ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:I,side:"base",asset:t,isPlacingOrder:s||O}),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:Te}),m&&_!==null&&_>0&&e("button",{type:"button",onClick:Pe,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:me?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:Ae,"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 ${K?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:K?v==="quoteChainSelection"?e(B,{toggle:h??P,side:"quote",onChainSelect:X}):e($,{toggle:h??P,side:"quote",otherAsset:t,onMoreChainsClick:qe,selectedChainFilter:D}):r(k,{children:[Q?T?r("div",{className:`flex items-center gap-2 ${x==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),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 ${x==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(k,{children:[e(w,{toggle:W,side:"quote",asset:o,isPlacingOrder:s||N}),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:Re}),Oe&&e("button",{type:"button",onClick:ke,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:M?"1px solid var(--widget-border)":"none",maxHeight:M?"60px":"0px",opacity:M?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(re,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(ne,{})}),e("div",{className:`relative ${Y?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?e(ae,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:we,isQuoteGasToken:ve,reviewActionProps:Se,reviewState:C,setReviewState:he,trackedOrderHash:y,setTrackedOrderHash:E,onSwapComplete:ue,onSwapInitiated:ce,onOrderSubmitted:Ce,onStaleQuoteRestart:ye,txStatus:z}):!m&&pe?e("button",{onClick:()=>be(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:Z,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:Z,children:m?"Enter Amount":"Connect Wallet"})})]})},rt=$e;export{rt as default};
|