@aori/mega-swap-widget 0.1.9 → 0.1.11

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/README.md CHANGED
@@ -322,11 +322,179 @@ MEGAETH_RPC_URL=https://your-megaeth-rpc.example.com
322
322
  | `customWalletUI` | `'none' \| 'provider'` | `'provider'` | `'provider'` wires into your wallet modals via callbacks; `'none'` hides all wallet UI |
323
323
  | `onRequestConnect` | `() => void` | — | Open the host app's connect modal |
324
324
  | `onRequestAccount` | `() => void` | — | Open the host app's account modal |
325
- | `onSwapComplete` | `(orderHash: string) => void` | — | Callback after a successful swap |
325
+ | `onSwapSubmitted` | `(quoteId: string) => void` | — | Fires immediately after the user's signing/transaction steps complete and the order is submitted to the Aori backend. `quoteId` is the VT quote ID for tracking. |
326
+ | `onSwapComplete` | `(data: SwapCompleteData) => void` | — | Fires when polling confirms the swap is settled on-chain. Returns `{ quoteId, aoriOrderHash, explorerUrl, details }` where `details` is the full Aori `/data/details` response. |
326
327
  | `onBaseTokenChange` | `(token: Asset) => void` | — | Callback when the base token changes |
327
328
  | `onQuoteTokenChange` | `(token: Asset) => void` | — | Callback when the quote token changes |
328
329
  | `className` | `string` | — | Additional CSS class on the root element |
329
330
 
331
+ ### Swap Lifecycle Hooks Example
332
+
333
+ Use `onSwapSubmitted` to know when the order hits the Aori backend, and `onSwapComplete` to get the full details once it settles on-chain:
334
+
335
+ ```tsx
336
+ <SwapWidget
337
+ config={aoriConfig}
338
+ onSwapSubmitted={(quoteId) => {
339
+ // Fires immediately after the user signs and the order is submitted.
340
+ // quoteId is the VT quote ID — use it to track the order or just wait for onSwapComplete.
341
+ }}
342
+ onSwapComplete={({ aoriOrderHash, explorerUrl, details }) => {
343
+ // Fires when polling confirms the swap is settled on-chain.
344
+ // details is the full response from https://api.aori.io/data/details/${aoriOrderHash}
345
+
346
+ // Redirect to a confirmation page
347
+ router.push(`/confirmation?order=${aoriOrderHash}`);
348
+
349
+ // Or persist to your own tx history
350
+ const getEventTime = (type: string) =>
351
+ details.events.find(e => e.event === type)?.timestamp ?? null;
352
+
353
+ addToHistory({
354
+ orderHash: aoriOrderHash,
355
+ explorerUrl,
356
+ inputAmount: details.inputAmount,
357
+ inputChain: details.inputChain,
358
+ outputAmount: details.outputAmount,
359
+ outputChain: details.outputChain,
360
+ srcTx: details.srcTx,
361
+ dstTx: details.dstTx,
362
+ // individual event timestamps — use these to show status progression in your UI
363
+ createdAt: getEventTime('created'),
364
+ receivedAt: getEventTime('received'),
365
+ completedAt: getEventTime('completed'),
366
+ failedAt: getEventTime('failed'),
367
+ canceledAt: getEventTime('cancelled'),
368
+ });
369
+ }}
370
+ />
371
+ ```
372
+
373
+ The `SwapCompleteData` type:
374
+
375
+ ```ts
376
+ interface SwapCompleteData {
377
+ quoteId: string; // VT quote ID (same value as onSwapSubmitted)
378
+ aoriOrderHash: string; // Aori order hash, parsed from explorerUrl
379
+ explorerUrl: string; // https://aoriscan.io/order/0x...
380
+ details: AoriOrderDetails;
381
+ }
382
+
383
+ interface AoriOrderDetails {
384
+ orderHash: string;
385
+ offerer: string;
386
+ recipient: string;
387
+ inputToken: string;
388
+ inputAmount: string;
389
+ inputChain: string;
390
+ inputTokenValueUsd: string;
391
+ outputToken: string;
392
+ outputAmount: string;
393
+ outputChain: string;
394
+ outputTokenValueUsd: string;
395
+ startTime: number;
396
+ endTime: number;
397
+ timestamp: number;
398
+ srcTx: string | null;
399
+ dstTx: string | null;
400
+ events: Array<{
401
+ event: string; // 'created' | 'received' | 'completed' | 'failed' | 'cancelled'
402
+ timestamp: number;
403
+ }>;
404
+ }
405
+ ```
406
+
407
+ ### What You Can Build With These Hooks
408
+
409
+ The data from `onSwapComplete` is generic — you decide what to do with it. Some examples:
410
+
411
+ - **Tx history component** — render a live list of swaps with status, amounts, and links
412
+ - **Confirmation page** — redirect to a dedicated page after settlement with order details
413
+ - **Custom notification** — show a toast, modal, or banner with the swap result
414
+ - **Analytics** — send swap events to your own backend or analytics pipeline
415
+ - **Order detail page** — use `aoriOrderHash` to link to or render a full order breakdown
416
+ - **Just the data** — store it in state, context, or your DB and use it however your app needs
417
+
418
+ The hooks don't dictate any UI. They hand you the data at the right moment — you wire it into whatever component or flow makes sense for your app.
419
+
420
+ ### Building a Live Tx History
421
+
422
+ One common pattern — use both hooks together to maintain a live list. `onSwapSubmitted` adds a pending entry immediately, `onSwapComplete` updates it in-place once settled:
423
+
424
+ ```tsx
425
+ const [history, setHistory] = useState([]);
426
+
427
+ const addOrUpdate = (quoteId, patch) =>
428
+ setHistory(prev => {
429
+ const exists = prev.find(e => e.quoteId === quoteId);
430
+ if (exists) return prev.map(e => e.quoteId === quoteId ? { ...e, ...patch } : e);
431
+ return [...prev, { quoteId, status: 'pending', orderHash: null, ...patch }];
432
+ });
433
+
434
+ <SwapWidget
435
+ config={aoriConfig}
436
+ onSwapSubmitted={(quoteId) => {
437
+ addOrUpdate(quoteId, { status: 'pending' });
438
+ }}
439
+ onSwapComplete={({ quoteId, aoriOrderHash, explorerUrl, details }) => {
440
+ const getEventTime = (type) =>
441
+ details.events.find(e => e.event === type)?.timestamp ?? null;
442
+
443
+ addOrUpdate(quoteId, {
444
+ status: getEventTime('failed') ? 'failed' : 'completed',
445
+ orderHash: aoriOrderHash,
446
+ explorerUrl,
447
+ inputAmount: details.inputAmount,
448
+ inputChain: details.inputChain,
449
+ outputAmount: details.outputAmount,
450
+ outputChain: details.outputChain,
451
+ srcTx: details.srcTx,
452
+ dstTx: details.dstTx,
453
+ createdAt: getEventTime('created'),
454
+ receivedAt: getEventTime('received'),
455
+ completedAt: getEventTime('completed'),
456
+ failedAt: getEventTime('failed'),
457
+ });
458
+ }}
459
+ />
460
+
461
+ // Render history however you like
462
+ {history.map(tx => <TxRow key={tx.quoteId} tx={tx} />)}
463
+ ```
464
+
465
+ This gives you a real-time list that:
466
+ - Shows "pending" the instant the user submits
467
+ - Updates to "completed" or "failed" once on-chain settlement confirms
468
+ - Has all the data needed to render amounts, chains, tx links, and a status timeline
469
+
470
+ ### Fetching Order History Outside the Hook
471
+
472
+ The `onSwapComplete` hook only captures swaps from the current session. To load a wallet's full order history — on mount, for a tx history page, etc. — use the Aori API directly with the connected wallet address.
473
+
474
+ **Query all orders for a wallet** ([`/data/query`](https://docs.aori.io/reference/query)):
475
+
476
+ ```ts
477
+ const res = await fetch(
478
+ `https://api.aori.io/data/query?offerer=[connected_wallet_address]&page=0&limit=100&sortBy=createdAt_desc`
479
+ );
480
+ const { orders, pagination } = await res.json();
481
+ // orders is an array of summarised order objects with srcTx, dstTx, amounts, chains, status
482
+ ```
483
+
484
+ **Get full details for a specific order** ([`/data/details`](https://docs.aori.io/reference/details)):
485
+
486
+ ```ts
487
+ const res = await fetch(`https://api.aori.io/data/details/${orderHash}`);
488
+ const details = await res.json();
489
+ // Full event history, tx hashes, block numbers, timestamps
490
+ ```
491
+
492
+ The recommended pattern for a tx history feature:
493
+
494
+ - **On swap completion** — write to your own state/DB via `onSwapComplete`
495
+ - **On page load** — fetch historical orders from `/data/query?offerer=${address}` to backfill swaps from past sessions
496
+ - **On detail view** — fetch `/data/details/${orderHash}` for the full event timeline of a specific order
497
+
330
498
  ## Configuration
331
499
 
332
500
  See [`AoriSwapWidgetConfig`](./src/config/types.ts) for the full type. Only non-default values need to be specified.
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{a as le}from"./chunk-2VOK7L7P.js";import{e as se,g as re,h as f,i as w,j as de,k as ue,x as ce,y as pe}from"./chunk-YIRIKYAW.js";import{a as Q}from"./chunk-UR3Q7FG5.js";import{a as H}from"./chunk-IKTTT66M.js";import{a as ae}from"./chunk-UHG7ZIWD.js";import"./chunk-OPN7WCJR.js";import{e as ne}from"./chunk-YO5D6L5W.js";import{b as oe,d}from"./chunk-GPT4NHM5.js";import"./chunk-QAOZRRSH.js";import{a as ie}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as p,useEffect as He,useMemo as Ue,useRef as De,useState as me}from"react";import{useShallow as Ve}from"zustand/react/shallow";import{Fragment as q,jsx as e,jsxs as r}from"react/jsx-runtime";var O=()=>{},je=({onSwapSubmitted:ge,onSwapComplete:fe,onSwapInitiated:we,onBackToSwap:x,onMoreChainsClick:Ee})=>{let{web3ConnectionType:Ge,hasConnectHandler:he,lockBase:N,lockQuote:T,disableInverting:ve,swapButtonVariant:I,tokenDisplay:U,tokenBadgeOrientation:C,widgetType:be,assetMenuVariant:Se}=oe(),{effectiveInputTokens:xe,effectiveOutputTokens:Ce}=ae(),h=xe.length===1,v=Ce.length===1,D=U==="pill"||U==="ghost",R=be==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:ye,isQuoteGasToken:ke,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:ze,setBaseAmount:F,setQuoteAmount:c,swapTokens:V,clearForm:j}=ne(),{rfqQuote:Le,status:_e,handleInputChange:M,ensureForParams:E,stop:Je,clear:y,refresh:G}=se(),{address:m}=ie(),{openConnectModal:Ae}=re(),{isRecipientInputOpen:W,txStatus:z,view:b,selectedChainFilterChainId:L}=d(Ve(n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:n.selectedChainFilter?.chainId??null}))),[k,Pe]=me(null),[A,_]=me(null),Oe=De(!1),s=!1,qe=Ue(()=>!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]),Ne=p(n=>{_(n),d.getState().startTracking(n)},[]),Te=p(()=>{Oe.current=!0,G()},[G]);He(()=>{if(k===null&&!(!t||!o)){if(!i||i<=0){M({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}M({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[k,i,t,o,a,l,M,c]);let B=p(()=>{d.getState().setView("baseSelection")},[]),$=p(()=>{d.getState().setView("quoteSelection")},[]),Ie=p(()=>{V(),c(null)},[V,c]),Re=p(()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let S=n*.9999999999;a||l?(F(S),c(S),y()):(F(S),c(null),E({inputToken:t,outputToken:o,inputAmount:S.toString(),setOutputAmount:P=>c(P)}))},[g.formatted,t,o,a,l,F,c,y,E]),Fe=p(()=>{y(),j()},[y,j]),J=g.formatted?parseFloat(g.formatted):null,Me=!!(i||u),K=Se==="split",X=K&&(b==="baseSelection"||b==="baseChainSelection"),Y=K&&(b==="quoteSelection"||b==="quoteChainSelection"),Z=p(n=>{let P=d.getState().view==="baseChainSelection"?"base":"quote";d.getState().setChainFilter({chainId:n,side:P}),d.getState().pushRecentChain(n),d.getState().transitionToView(P==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),We=p(()=>{d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Be=p(()=>{d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),$e=t?.price&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Qe=o?.price&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",ee=k==="trackingTx"&&!!A&&!!t&&!!o&&!!i&&!!u,te={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return r("div",{className:"flex flex-col w-full",children:[ee&&A&&t&&o&&i&&u?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(pe,{orderHash:A,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):r("div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${R?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${X?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:X?b==="baseChainSelection"?e(H,{toggle:x??O,side:"base",onChainSelect:Z}):e(Q,{toggle:x??O,side:"base",otherAsset:o,onMoreChainsClick:We,selectedChainFilter:L}):r(q,{children:[D?R?r("div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(q,{children:[e(w,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),e(f,{side:"base",asset:t??null,otherAsset:o??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:$e}),m&&J!==null&&J>0&&e("button",{type:"button",onClick:Re,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors 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:ve?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:Ie,"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(ue,{className:"w-3.5 h-3.5"})})}),e("div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?b==="quoteChainSelection"?e(H,{toggle:x??O,side:"quote",onChainSelect:Z}):e(Q,{toggle:x??O,side:"quote",otherAsset:t,onMoreChainsClick:Be,selectedChainFilter:L}):r(q,{children:[D?R?r("div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),e("div",{className:"flex-1 min-w-0",children:e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):r("div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):r(q,{children:[e(w,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),e(f,{side:"quote",asset:o??null,otherAsset:t??null,isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),r("div",{className:"flex items-center justify-between",children:[e("span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Qe}),Me&&e("button",{type:"button",onClick:Fe,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(de,{})}),e("div",{className:"px-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:e(le,{})}),e("div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?e(ce,{base:t,baseAmount:i,quote:o,quoteAmount:u??0,userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:ye,isQuoteGasToken:ke,reviewActionProps:qe,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:_,onSwapSubmitted:ge,onSwapComplete:fe,onSwapInitiated:we,onOrderSubmitted:Ne,onStaleQuoteRestart:Te,txStatus:z}):!m&&he?e("button",{onClick:()=>Ae(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:te,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:te,children:m?"Enter Amount":"Connect Wallet"})})]})},ft=je;export{ft as default};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
+ "use client";var _chunkXTJC3IX6cjs = require('./chunk-XTJC3IX6.cjs');var _chunk46JMXEHJcjs = require('./chunk-46JMXEHJ.cjs');var _chunkEKSQTNKScjs = require('./chunk-EKSQTNKS.cjs');var _chunkWZCWYOCNcjs = require('./chunk-WZCWYOCN.cjs');var _chunkTWVI6PZScjs = require('./chunk-TWVI6PZS.cjs');require('./chunk-KH57FLST.cjs');var _chunkPSCWQFVYcjs = require('./chunk-PSCWQFVY.cjs');var _chunkD7GULMHEcjs = require('./chunk-D7GULMHE.cjs');require('./chunk-K3RTTHBS.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var O=()=>{},je=({onSwapSubmitted:ge,onSwapComplete:fe,onSwapInitiated:we,onBackToSwap:x,onMoreChainsClick:Ee})=>{let{web3ConnectionType:Ge,hasConnectHandler:he,lockBase:N,lockQuote:T,disableInverting:ve,swapButtonVariant:I,tokenDisplay:U,tokenBadgeOrientation:C,widgetType:be,assetMenuVariant:Se}=_chunkD7GULMHEcjs.b.call(void 0, ),{effectiveInputTokens:xe,effectiveOutputTokens:Ce}=_chunkTWVI6PZScjs.a.call(void 0, ),h=xe.length===1,v=Ce.length===1,D=U==="pill"||U==="ghost",R=be==="compact",{baseToken:t,quoteToken:o,baseAmount:i,quoteAmount:u,isBaseGasToken:ye,isQuoteGasToken:ke,isWrappingPair:a,isUnwrappingPair:l,baseBalance:g,quoteBalance:ze,setBaseAmount:F,setQuoteAmount:c,swapTokens:V,clearForm:j}=_chunkPSCWQFVYcjs.e.call(void 0, ),{rfqQuote:Le,status:_e,handleInputChange:M,ensureForParams:E,stop:Je,clear:y,refresh:G}=_chunk46JMXEHJcjs.e.call(void 0, ),{address:m}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Ae}=_chunk46JMXEHJcjs.g.call(void 0, ),{isRecipientInputOpen:W,txStatus:z,view:b,selectedChainFilterChainId:L}=_chunkD7GULMHEcjs.d.call(void 0, _shallow.useShallow.call(void 0, n=>({isRecipientInputOpen:n.isRecipientInputOpen,txStatus:n.txStatus,view:n.view,selectedChainFilterChainId:_nullishCoalesce(_optionalChain([n, 'access', _2 => _2.selectedChainFilter, 'optionalAccess', _3 => _3.chainId]), () => (null))}))),[k,Pe]=_react.useState.call(void 0, null),[A,_]=_react.useState.call(void 0, null),Oe=_react.useRef.call(void 0, !1),s=!1,qe=_react.useMemo.call(void 0, ()=>!t||!o||typeof i!="number"||!u||!m||parseFloat(g.formatted)<i?null:{base:t,quote:o,baseAmount:i,quoteAmount:u,userAddress:m},[t,o,i,u,m,g.formatted]),Ne=_react.useCallback.call(void 0, n=>{_(n),_chunkD7GULMHEcjs.d.getState().startTracking(n)},[]),Te=_react.useCallback.call(void 0, ()=>{Oe.current=!0,G()},[G]);_react.useEffect.call(void 0, ()=>{if(k===null&&!(!t||!o)){if(!i||i<=0){M({amount:null,inputToken:t,outputToken:o,setOutputAmount:c});return}if(a||l){c(i);return}M({amount:i,inputToken:t,outputToken:o,setOutputAmount:c})}},[k,i,t,o,a,l,M,c]);let B=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().setView("baseSelection")},[]),$=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().setView("quoteSelection")},[]),Ie=_react.useCallback.call(void 0, ()=>{V(),c(null)},[V,c]),Re=_react.useCallback.call(void 0, ()=>{if(!g.formatted||!t||!o)return;let n=parseFloat(g.formatted);if(!n||n<=0)return;let S=n*.9999999999;a||l?(F(S),c(S),y()):(F(S),c(null),E({inputToken:t,outputToken:o,inputAmount:S.toString(),setOutputAmount:P=>c(P)}))},[g.formatted,t,o,a,l,F,c,y,E]),Fe=_react.useCallback.call(void 0, ()=>{y(),j()},[y,j]),J=g.formatted?parseFloat(g.formatted):null,Me=!!(i||u),K=Se==="split",X=K&&(b==="baseSelection"||b==="baseChainSelection"),Y=K&&(b==="quoteSelection"||b==="quoteChainSelection"),Z=_react.useCallback.call(void 0, n=>{let P=_chunkD7GULMHEcjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkD7GULMHEcjs.d.getState().setChainFilter({chainId:n,side:P}),_chunkD7GULMHEcjs.d.getState().pushRecentChain(n),_chunkD7GULMHEcjs.d.getState().transitionToView(P==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),We=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().transitionToView("baseChainSelection","chainSelection")},[]),Be=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),$e=_optionalChain([t, 'optionalAccess', _4 => _4.price])&&i?`$${(t.price*i).toFixed(2)}`:"$0.00",Qe=_optionalChain([o, 'optionalAccess', _5 => _5.price])&&u?`$${(o.price*u).toFixed(2)}`:"$0.00",ee=k==="trackingTx"&&!!A&&!!t&&!!o&&!!i&&!!u,te={backgroundColor:I==="default"?"var(--widget-primary)":"transparent",color:I==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:I!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col w-full",children:[ee&&A&&t&&o&&i&&u?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.y,{orderHash:A,base:t,quote:o,baseAmount:i,quoteAmount:u,status:z})}):_jsxruntime.jsxs.call(void 0, "div",{className:`grid grid-cols-[1fr_auto_1fr] items-stretch px-4 ${R?"pt-3 pb-1":"pt-4 pb-2"} gap-2`,children:[_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${X?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:X?b==="baseChainSelection"?_jsxruntime.jsx.call(void 0, _chunkWZCWYOCNcjs.a,{toggle:_nullishCoalesce(x, () => (O)),side:"base",onChainSelect:Z}):_jsxruntime.jsx.call(void 0, _chunkEKSQTNKScjs.a,{toggle:_nullishCoalesce(x, () => (O)),side:"base",otherAsset:o,onMoreChainsClick:We,selectedChainFilter:L}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?R?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"base",asset:t,isPlacingOrder:s||N||h,hideDropdown:h}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(t, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:$e}),m&&J!==null&&J>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Re,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card)",children:"Max"})]})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center px-1",children:ve?_jsxruntime.jsx.call(void 0, "div",{className:"flex h-8 w-8 items-center justify-center opacity-20",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"\u2192"})}):_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ie,"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, _chunk46JMXEHJcjs.k,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative flex flex-col gap-1 p-3 rounded-lg overflow-hidden ${Y?"h-[380px]":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-card)"},children:Y?b==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkWZCWYOCNcjs.a,{toggle:_nullishCoalesce(x, () => (O)),side:"quote",onChainSelect:Z}):_jsxruntime.jsx.call(void 0, _chunkEKSQTNKScjs.a,{toggle:_nullishCoalesce(x, () => (O)),side:"quote",otherAsset:t,onMoreChainsClick:Be,selectedChainFilter:L}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[D?R?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${C==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${C==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:$,side:"quote",asset:o,isPlacingOrder:s||T||v,hideDropdown:v}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(t, () => (null)),isPlacingOrder:s,isWrappingPair:a,isUnwrappingPair:l})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs",style:{color:"var(--widget-muted-foreground)"},children:Qe}),Me&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Fe,disabled:s,className:"flex items-center rounded-full px-2 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 transition-colors text-(--widget-muted-foreground) hover:bg-(--widget-secondary)",children:"Clear"})]})]})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden px-4",style:{borderTop:W?"1px solid var(--widget-border)":"none",maxHeight:W?"60px":"0px",opacity:W?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.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, _chunkXTJC3IX6cjs.a,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:m&&t&&o&&i&&i>0?_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.x,{base:t,baseAmount:i,quote:o,quoteAmount:_nullishCoalesce(u, () => (0)),userAddress:m,isWrappingPair:a,isUnwrappingPair:l,isBaseGasToken:ye,isQuoteGasToken:ke,reviewActionProps:qe,reviewState:k,setReviewState:Pe,trackedOrderHash:A,setTrackedOrderHash:_,onSwapSubmitted:ge,onSwapComplete:fe,onSwapInitiated:we,onOrderSubmitted:Ne,onStaleQuoteRestart:Te,txStatus:z}):!m&&he?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Ae(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:te,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:te,children:m?"Enter Amount":"Connect Wallet"})})]})},ft= exports.default =je;exports.default = ft;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
+ "use client";var _chunk46JMXEHJcjs = require('./chunk-46JMXEHJ.cjs');var _chunkEKSQTNKScjs = require('./chunk-EKSQTNKS.cjs');var _chunkWZCWYOCNcjs = require('./chunk-WZCWYOCN.cjs');var _chunkTWVI6PZScjs = require('./chunk-TWVI6PZS.cjs');require('./chunk-KH57FLST.cjs');var _chunkPSCWQFVYcjs = require('./chunk-PSCWQFVY.cjs');var _chunkD7GULMHEcjs = require('./chunk-D7GULMHE.cjs');var _chunkK3RTTHBScjs = require('./chunk-K3RTTHBS.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');require('./chunk-T3I3AJXV.cjs');var _react = require('react');var _shallow = require('zustand/react/shallow');var _jsxruntime = require('react/jsx-runtime');var we=()=>{},tt=({onSwapSubmitted:he,onSwapComplete:be,onSwapInitiated:Se,onBackToSwap:E,onMoreChainsClick:st})=>{let{web3ConnectionType:ot,hasConnectHandler:ye,lockBase:q,lockQuote:R,disableInverting:Ce,swapButtonVariant:F,tokenDisplay:j,tokenBadgeOrientation:N,widgetType:Ne,assetMenuVariant:ke}=_chunkD7GULMHEcjs.b.call(void 0, ),{effectiveInputTokens:Ae,effectiveOutputTokens:Pe}=_chunkTWVI6PZScjs.a.call(void 0, ),S=Ae.length===1,y=Pe.length===1,z=j==="pill"||j==="ghost",k=Ne==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Te,isQuoteGasToken:Oe,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:I,setQuoteAmount:g,swapTokens:G,clearForm:L}=_chunkPSCWQFVYcjs.e.call(void 0, ),{handleInputChange:M,ensureForParams:_,clear:A,refresh:J,liquidityError:qe,routingError:Re}=_chunk46JMXEHJcjs.e.call(void 0, ),{address:v}=_chunk34N36GUDcjs.a.call(void 0, ),{openConnectModal:Fe}=_chunk46JMXEHJcjs.g.call(void 0, ),{isRecipientInputOpen:$,txStatus:K,view:x,selectedChainFilterChainId:Ie}=_chunkD7GULMHEcjs.d.call(void 0, _shallow.useShallow.call(void 0, i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:_nullishCoalesce(i.selectedChainFilterChainId, () => (null))}))),[P,Me]=_react.useState.call(void 0, null),[T,X]=_react.useState.call(void 0, null),$e=_react.useRef.call(void 0, !1),r=!1,We=_react.useMemo.call(void 0, ()=>!d||!c||typeof a!="number"||!n||!v||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:v},[d,c,a,n,v,w.formatted]),Be=_react.useCallback.call(void 0, i=>{X(i),_chunkD7GULMHEcjs.d.getState().startTracking(i)},[]),De=_react.useCallback.call(void 0, ()=>{$e.current=!0,J()},[J]);_react.useEffect.call(void 0, ()=>{if(P===null&&!(!d||!c)){if(!a||a<=0){M({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}M({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[P,a,d,c,u,p,M,g]);let Y=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,W=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().setView("baseSelection")},[]),B=_react.useCallback.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().setView("quoteSelection")},[]),Qe=_react.useCallback.call(void 0, ()=>{G(),g(null)},[G,g]),Ue=_react.useCallback.call(void 0, ()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(I(m),g(m),A()):(I(m),g(null),_({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:C=>g(C)}))},[w.formatted,d,c,u,p,I,g,A,_]),Ve=_react.useCallback.call(void 0, ()=>{A(),L()},[A,L]),Z=w.formatted?parseFloat(w.formatted):null,He=!!(a||n),s=d,o=c,Ee=_optionalChain([s, 'optionalAccess', _2 => _2.price])&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",je=_optionalChain([o, 'optionalAccess', _3 => _3.price])&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",ze=!!(s&&o&&a&&n),Ge=qe||Re,ee=P==="trackingTx"&&!!T&&!!s&&!!o&&!!a&&!!n,D=ke==="split",Q=D&&(x==="baseSelection"||x==="quoteSelection"||x==="baseChainSelection"||x==="quoteChainSelection"),U=x==="baseSelection"||x==="baseChainSelection"?"base":"quote",Le=U==="base"?o:s,te=_react.useRef.call(void 0, null),[_e,Je]=_react.useState.call(void 0, 380);_react.useEffect.call(void 0, ()=>{if(!D)return;let i=te.current;if(!i)return;let m=new ResizeObserver(C=>{for(let Ye of C)Je(Ye.contentRect.height)});return m.observe(i),()=>m.disconnect()},[D]);let Ke=_react.useCallback.call(void 0, i=>{let C=_chunkD7GULMHEcjs.d.getState().view==="baseChainSelection"?"base":"quote";_chunkD7GULMHEcjs.d.getState().setChainFilter({chainId:i,side:C}),_chunkD7GULMHEcjs.d.getState().pushRecentChain(i),_chunkD7GULMHEcjs.d.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Xe=_react.useCallback.call(void 0, ()=>{let i=_chunkD7GULMHEcjs.d.getState().view;i==="baseSelection"?_chunkD7GULMHEcjs.d.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&_chunkD7GULMHEcjs.d.getState().transitionToView("quoteChainSelection","chainSelection")},[]),se={backgroundColor:F==="default"?"var(--widget-primary)":"transparent",color:F==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:F!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:te,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[ee&&T&&s&&o&&a&&n?_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-h-0 overflow-hidden",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.y,{orderHash:T,base:s,quote:o,baseAmount:a,quoteAmount:n,status:K})}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${k?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?k?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"base",asset:_nullishCoalesce(s, () => (null)),otherAsset:_nullishCoalesce(o, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ee}),v&&Z!==null&&Z>0&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ue,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ce&&_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center -my-4 relative z-10",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Qe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.k,{className:"w-3.5 h-3.5"})})}),_jsxruntime.jsxs.call(void 0, "div",{className:`relative ${k?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?k?_jsxruntime.jsxs.call(void 0, "div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, "div",{className:"flex-1 min-w-0",children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):_jsxruntime.jsxs.call(void 0, "div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.i,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.h,{side:"quote",asset:_nullishCoalesce(o, () => (null)),otherAsset:_nullishCoalesce(s, () => (null)),isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:je}),He&&_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:Ve,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:$?"1px solid var(--widget-border)":"none",maxHeight:$?"60px":"0px",opacity:$?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.j,{})}),_jsxruntime.jsx.call(void 0, "div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:v&&s&&o&&a&&a>0?_jsxruntime.jsx.call(void 0, _chunk46JMXEHJcjs.x,{base:s,baseAmount:a,quote:o,quoteAmount:_nullishCoalesce(n, () => (0)),userAddress:v,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Te,isQuoteGasToken:Oe,reviewActionProps:We,reviewState:P,setReviewState:Me,trackedOrderHash:T,setTrackedOrderHash:X,onSwapSubmitted:he,onSwapComplete:be,onSwapInitiated:Se,onOrderSubmitted:Be,onStaleQuoteRestart:De,txStatus:K}):!v&&ye?_jsxruntime.jsx.call(void 0, "button",{onClick:()=>Fe(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:se,children:"Connect Wallet"}):_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:se,children:v?"Enter Amount":"Connect Wallet"})})]}),_jsxruntime.jsx.call(void 0, "div",{className:`flex flex-col transition-all duration-300 ${Q?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...Q?{height:`${_e}px`}:{}},children:Q?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:x==="baseChainSelection"||x==="quoteChainSelection"?_jsxruntime.jsx.call(void 0, _chunkWZCWYOCNcjs.a,{toggle:_nullishCoalesce(E, () => (we)),side:U,onChainSelect:Ke}):_jsxruntime.jsx.call(void 0, _chunkEKSQTNKScjs.a,{toggle:_nullishCoalesce(E, () => (we)),side:U,otherAsset:Le,onMoreChainsClick:Xe,selectedChainFilter:Ie})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-3 px-4 py-4",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),ze&&s&&o?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-0.5",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:o,size:"3xs",noChain:!0}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:_jsxruntime.jsxs.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Y.toFixed(6)]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-1 pl-4",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:s,size:"3xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Y*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center",children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):Ge?_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.W,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((i,m)=>_jsxruntime.jsx.call(void 0, "div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},Ct= exports.default =tt;exports.default = Ct;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use client";import{e as ne,g as le,h,i as b,j as ce,k as ue,x as pe,y as me}from"./chunk-YIRIKYAW.js";import{a as ge}from"./chunk-UR3Q7FG5.js";import{a as fe}from"./chunk-IKTTT66M.js";import{a as de}from"./chunk-UHG7ZIWD.js";import"./chunk-OPN7WCJR.js";import{e as re}from"./chunk-YO5D6L5W.js";import{b as oe,d as l}from"./chunk-GPT4NHM5.js";import{O as V,W as ae}from"./chunk-QAOZRRSH.js";import{a as ie}from"./chunk-46H44R7V.js";import"./chunk-73CB2I7U.js";import{useCallback as f,useEffect as ve,useMemo as Ze,useRef as xe,useState as H}from"react";import{useShallow as et}from"zustand/react/shallow";import{Fragment as O,jsx as e,jsxs as t}from"react/jsx-runtime";var we=()=>{},tt=({onSwapSubmitted:he,onSwapComplete:be,onSwapInitiated:Se,onBackToSwap:E,onMoreChainsClick:st})=>{let{web3ConnectionType:ot,hasConnectHandler:ye,lockBase:q,lockQuote:R,disableInverting:Ce,swapButtonVariant:F,tokenDisplay:j,tokenBadgeOrientation:N,widgetType:Ne,assetMenuVariant:ke}=oe(),{effectiveInputTokens:Ae,effectiveOutputTokens:Pe}=de(),S=Ae.length===1,y=Pe.length===1,z=j==="pill"||j==="ghost",k=Ne==="compact",{baseToken:d,quoteToken:c,baseAmount:a,quoteAmount:n,isBaseGasToken:Te,isQuoteGasToken:Oe,isWrappingPair:u,isUnwrappingPair:p,baseBalance:w,setBaseAmount:I,setQuoteAmount:g,swapTokens:G,clearForm:L}=re(),{handleInputChange:M,ensureForParams:_,clear:A,refresh:J,liquidityError:qe,routingError:Re}=ne(),{address:v}=ie(),{openConnectModal:Fe}=le(),{isRecipientInputOpen:$,txStatus:K,view:x,selectedChainFilterChainId:Ie}=l(et(i=>({isRecipientInputOpen:i.isRecipientInputOpen,txStatus:i.txStatus,view:i.view,selectedChainFilterChainId:i.selectedChainFilterChainId??null}))),[P,Me]=H(null),[T,X]=H(null),$e=xe(!1),r=!1,We=Ze(()=>!d||!c||typeof a!="number"||!n||!v||parseFloat(w.formatted)<a?null:{base:d,quote:c,baseAmount:a,quoteAmount:n,userAddress:v},[d,c,a,n,v,w.formatted]),Be=f(i=>{X(i),l.getState().startTracking(i)},[]),De=f(()=>{$e.current=!0,J()},[J]);ve(()=>{if(P===null&&!(!d||!c)){if(!a||a<=0){M({amount:null,inputToken:d,outputToken:c,setOutputAmount:g});return}if(u||p){g(a);return}M({amount:a,inputToken:d,outputToken:c,setOutputAmount:g})}},[P,a,d,c,u,p,M,g]);let Y=a&&n&&parseFloat(n.toString())?parseFloat(a.toString())/parseFloat(n.toString()):0,W=f(()=>{l.getState().setView("baseSelection")},[]),B=f(()=>{l.getState().setView("quoteSelection")},[]),Qe=f(()=>{G(),g(null)},[G,g]),Ue=f(()=>{if(!w.formatted||!d||!c)return;let i=parseFloat(w.formatted);if(!i||i<=0)return;let m=i*.9999999999;u||p?(I(m),g(m),A()):(I(m),g(null),_({inputToken:d,outputToken:c,inputAmount:m.toString(),setOutputAmount:C=>g(C)}))},[w.formatted,d,c,u,p,I,g,A,_]),Ve=f(()=>{A(),L()},[A,L]),Z=w.formatted?parseFloat(w.formatted):null,He=!!(a||n),s=d,o=c,Ee=s?.price&&a?`$${(s.price*a).toFixed(2)}`:"$0.00",je=o?.price&&n?`$${(o.price*n).toFixed(2)}`:"$0.00",ze=!!(s&&o&&a&&n),Ge=qe||Re,ee=P==="trackingTx"&&!!T&&!!s&&!!o&&!!a&&!!n,D=ke==="split",Q=D&&(x==="baseSelection"||x==="quoteSelection"||x==="baseChainSelection"||x==="quoteChainSelection"),U=x==="baseSelection"||x==="baseChainSelection"?"base":"quote",Le=U==="base"?o:s,te=xe(null),[_e,Je]=H(380);ve(()=>{if(!D)return;let i=te.current;if(!i)return;let m=new ResizeObserver(C=>{for(let Ye of C)Je(Ye.contentRect.height)});return m.observe(i),()=>m.disconnect()},[D]);let Ke=f(i=>{let C=l.getState().view==="baseChainSelection"?"base":"quote";l.getState().setChainFilter({chainId:i,side:C}),l.getState().pushRecentChain(i),l.getState().transitionToView(C==="base"?"baseSelection":"quoteSelection","chainSelection")},[]),Xe=f(()=>{let i=l.getState().view;i==="baseSelection"?l.getState().transitionToView("baseChainSelection","chainSelection"):i==="quoteSelection"&&l.getState().transitionToView("quoteChainSelection","chainSelection")},[]),se={backgroundColor:F==="default"?"var(--widget-primary)":"transparent",color:F==="default"?"var(--widget-primary-foreground)":"var(--widget-primary)",border:F!=="default"?"1px solid var(--widget-primary)":"none",borderRadius:"var(--widget-radius)"};return t("div",{className:"flex flex-row w-full",children:[t("div",{ref:te,className:"flex flex-col flex-1 min-w-0",style:{borderRight:"1px solid var(--widget-border)"},children:[ee&&T&&s&&o&&a&&n?e("div",{className:"flex-1 min-h-0 overflow-hidden",children:e(me,{orderHash:T,base:s,quote:o,baseAmount:a,quoteAmount:n,status:K})}):t(O,{children:[t("div",{className:`relative ${k?"px-4 pt-3 pb-1":"px-4 pt-4 pb-2"}`,style:{borderBottom:"1px solid var(--widget-border)"},children:[z?k?t("div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e("div",{className:"flex-1 min-w-0",children:e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(O,{children:[e(b,{toggle:W,side:"base",asset:s,isPlacingOrder:r||q||S,hideDropdown:S}),e(h,{side:"base",asset:s??null,otherAsset:o??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"mb-1 flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:Ee}),v&&Z!==null&&Z>0&&e("button",{type:"button",onClick:Ue,disabled:r,className:"absolute bottom-3 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 bg-(--widget-primary) text-(--widget-primary-foreground) hover:bg-(--widget-foreground) hover:text-(--widget-card) transition-colors",children:"Max"})]})]}),!Ce&&e("div",{className:"flex justify-center -my-4 relative z-10",children:e("button",{type:"button",onClick:Qe,"aria-label":"Swap input and output tokens",className:"flex h-8 w-8 items-center justify-center rounded-full cursor-pointer bg-(--widget-card) text-(--widget-muted-foreground) hover:bg-(--widget-secondary) hover:text-(--widget-foreground) transition-colors",style:{border:"1px solid var(--widget-border)"},children:e(ue,{className:"w-3.5 h-3.5"})})}),t("div",{className:`relative ${k?"px-4 pt-4 pb-1":"px-4 pt-6 pb-2"}`,children:[z?k?t("div",{className:`flex items-center gap-2 ${N==="right"?"flex-row-reverse":"flex-row"}`,children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e("div",{className:"flex-1 min-w-0",children:e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})})]}):t("div",{className:`flex flex-col ${N==="right"?"items-end":"items-start"}`,children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}):t(O,{children:[e(b,{toggle:B,side:"quote",asset:o,isPlacingOrder:r||R||y,hideDropdown:y}),e(h,{side:"quote",asset:o??null,otherAsset:s??null,isPlacingOrder:r,isWrappingPair:u,isUnwrappingPair:p})]}),t("div",{className:"flex w-full flex-row items-center justify-between",children:[e("p",{className:"font-sans text-sm",style:{color:"var(--widget-muted-foreground)"},children:je}),He&&e("button",{type:"button",onClick:Ve,disabled:r,className:"absolute bottom-2 right-4 flex items-center rounded-full px-3 py-0.5 text-xs font-medium uppercase cursor-pointer disabled:opacity-40 text-(--widget-muted-foreground) hover:bg-(--widget-secondary) transition-colors",children:"Clear"})]})]})]}),e("div",{className:"flex flex-row items-center w-full overflow-hidden",style:{borderTop:$?"1px solid var(--widget-border)":"none",maxHeight:$?"60px":"0px",opacity:$?1:0,transition:"max-height 0.3s ease, opacity 0.3s ease"},children:e(ce,{})}),e("div",{className:`relative ${ee?"px-0":"px-4"} py-4`,children:v&&s&&o&&a&&a>0?e(pe,{base:s,baseAmount:a,quote:o,quoteAmount:n??0,userAddress:v,isWrappingPair:u,isUnwrappingPair:p,isBaseGasToken:Te,isQuoteGasToken:Oe,reviewActionProps:We,reviewState:P,setReviewState:Me,trackedOrderHash:T,setTrackedOrderHash:X,onSwapSubmitted:he,onSwapComplete:be,onSwapInitiated:Se,onOrderSubmitted:Be,onStaleQuoteRestart:De,txStatus:K}):!v&&ye?e("button",{onClick:()=>Fe(),className:"w-full py-3 text-sm font-medium cursor-pointer transition-opacity hover:opacity-80",style:se,children:"Connect Wallet"}):e("button",{disabled:!0,className:"w-full py-3 text-sm font-medium transition-colors disabled:opacity-40 cursor-not-allowed",style:se,children:v?"Enter Amount":"Connect Wallet"})})]}),e("div",{className:`flex flex-col transition-all duration-300 ${Q?"flex-1 min-w-0":"w-48 shrink-0"}`,style:{backgroundColor:"var(--widget-background)",...Q?{height:`${_e}px`}:{}},children:Q?e("div",{className:"flex flex-col overflow-hidden p-2",style:{height:"100%"},children:x==="baseChainSelection"||x==="quoteChainSelection"?e(fe,{toggle:E??we,side:U,onChainSelect:Ke}):e(ge,{toggle:E??we,side:U,otherAsset:Le,onMoreChainsClick:Xe,selectedChainFilter:Ie})}):t("div",{className:"flex flex-col gap-3 px-4 py-4",children:[e("span",{className:"text-2xs uppercase tracking-wider font-medium",style:{color:"var(--widget-muted-foreground)"},children:"Quote Details"}),ze&&s&&o?t(O,{children:[t("div",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Rate"}),t("div",{className:"flex items-center gap-1",children:[e(V,{asset:o,size:"3xs",noChain:!0}),t("span",{className:"font-sans text-xs uppercase",children:["1 ",o.symbol]})]}),e("div",{className:"flex items-center gap-1 pl-4",children:t("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:["= ",Y.toFixed(6)]})}),t("div",{className:"flex items-center gap-1 pl-4",children:[e(V,{asset:s,size:"3xs",noChain:!0}),e("span",{className:"font-sans text-xs uppercase",children:s.symbol})]})]}),t("div",{className:"flex flex-col gap-2",style:{borderTop:"1px solid var(--widget-border)",paddingTop:"0.5rem"},children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"USD Value"}),t("span",{className:"font-sans text-xs",children:["$",s.price?(s.price*Y*parseFloat(n.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),e("span",{className:"text-2xs font-sans",style:{color:"var(--widget-foreground)"},children:"RFQ"})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Fill"}),e("span",{className:"text-2xs",style:{color:"var(--widget-primary)"},children:"Exact"})]}),s.chainId!==o.chainId&&t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Route"}),e("span",{className:"text-2xs font-sans",children:"Cross-chain"})]})]})]}):Ge?t("div",{className:"flex flex-col gap-1",children:[e(ae,{className:"h-6 w-6",style:{color:"var(--widget-destructive)"}}),e("span",{className:"text-2xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"})]}):t("div",{className:"flex flex-col gap-2 mt-2",children:[[...Array(4)].map((i,m)=>e("div",{className:"h-3 rounded animate-pulse",style:{backgroundColor:"var(--widget-muted)",width:m%2===0?"80%":"60%",opacity:.5}},m)),e("span",{className:"text-2xs mt-1",style:{color:"var(--widget-muted-foreground)",opacity:.5},children:"Enter an amount"})]})]})})]})},Ct=tt;export{Ct as default};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{e as y}from"./chunk-PU5KXI4P.js";import{e as h}from"./chunk-YO5D6L5W.js";import{b as C}from"./chunk-GPT4NHM5.js";import{O as u,W as m,c as x}from"./chunk-QAOZRRSH.js";import M,{useEffect as T,useState as $}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var I=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Q=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function N(o){if(o===0)return"0";let a=Math.abs(o);return a>=1e4?o.toFixed(0):a>=1e3?o.toFixed(1):a>=100?o.toFixed(2):a>=1?o.toFixed(4):a>=.01?o.toFixed(6):o.toExponential(3)}var b=M.memo(()=>{let[o,a]=$(!1),{liquidityError:k,routingError:F}=y(),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:r}=h(),{quoteLoaderVariant:f,widgetType:E}=C(),p=E==="compact",d=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,j=s&&r&&s.chainId!==r.chainId,v=s?x(s.chainId)?.estimatedTimeMs??0:0,S=r?x(r.chainId)?.estimatedTimeMs??0:0,w=(j?v+S:v)/1e3,g=k||F,l=s&&r&&n&&parseFloat(n.toString())&&i;return T(()=>{f==="expanded"&&l&&a(!0)},[f,l]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&r?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:r,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",r?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[N(d)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}):g?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>l&&a(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l&&a(L=>!L))},children:e("div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&r?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:r,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",r?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[N(d)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):g?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&l?"120px":"0px",opacity:o&&l?1:0},children:t("div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",s?.price&&i?(s.price*d*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Estimated Time"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:w>0?`${w.toFixed(2)}s`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[e(Q,{}),"Aori",e(I,{})]})]})]})})]})});b.displayName="QuoteLoader";var D=b;export{D as a};
2
+ import{e as y}from"./chunk-YIRIKYAW.js";import{e as h}from"./chunk-YO5D6L5W.js";import{b as C}from"./chunk-GPT4NHM5.js";import{O as u,W as m,c as x}from"./chunk-QAOZRRSH.js";import M,{useEffect as T,useState as $}from"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var I=()=>t("svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Q=()=>t("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),e("path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]});function N(o){if(o===0)return"0";let a=Math.abs(o);return a>=1e4?o.toFixed(0):a>=1e3?o.toFixed(1):a>=100?o.toFixed(2):a>=1?o.toFixed(4):a>=.01?o.toFixed(6):o.toExponential(3)}var b=M.memo(()=>{let[o,a]=$(!1),{liquidityError:k,routingError:F}=y(),{baseAmount:n,baseToken:s,quoteAmount:i,quoteToken:r}=h(),{quoteLoaderVariant:f,widgetType:E}=C(),p=E==="compact",d=n&&i&&parseFloat(i.toString())?parseFloat(n.toString())/parseFloat(i.toString()):0,j=s&&r&&s.chainId!==r.chainId,v=s?x(s.chainId)?.estimatedTimeMs??0:0,S=r?x(r.chainId)?.estimatedTimeMs??0:0,w=(j?v+S:v)/1e3,g=k||F,l=s&&r&&n&&parseFloat(n.toString())&&i;return T(()=>{f==="expanded"&&l&&a(!0)},[f,l]),f==="none"?null:f==="default"?e("div",{className:`relative box-border flex flex-row h-8 w-full items-center${p?" justify-start overflow-x-auto":" justify-center"}`,children:e("div",{className:`flex h-full items-center${p?" min-w-max":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&r?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:r,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",r?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[N(d)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}):g?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}):t("div",{className:"flex flex-col w-full",children:[e("div",{className:`relative box-border flex flex-row pt-1 h-8 w-full items-center cursor-pointer${p?" overflow-x-auto":""}`,role:"button",tabIndex:0,onClick:()=>l&&a(c=>!c),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l&&a(L=>!L))},children:e("div",{className:`flex h-full items-center${p?" min-w-max overflow-x-auto":" w-full overflow-hidden"}`,style:{color:"var(--widget-foreground)"},children:s&&r?n&&parseFloat(n.toString())?i?t("div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[t("div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:r,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",r?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),t("div",{className:"flex flex-row items-center gap-1",children:[e(u,{asset:s,size:"3xs",noChain:!0,className:"mb-0.5"}),t("span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[N(d)," ",s?.symbol]})]}),e("span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:s?.price?`\u2248 $${(s.price*d).toFixed(2)}`:""})]}),e("span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:o?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]}):g?t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-destructive)"},children:"Quote not found"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-destructive)"}})]}):t("div",{className:"flex h-full w-full flex-row pb-1 items-center justify-between",children:[e("p",{className:"text-xs",style:{color:"var(--widget-accent)"},children:"Searching For Quote"}),e(m,{className:"h-8 w-8",style:{color:"var(--widget-accent)"}})]}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"}):e("div",{className:"text-xs pb-1",style:{color:"var(--widget-muted-foreground)"},children:"Enter Amount"})})}),e("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&l?"120px":"0px",opacity:o&&l?1:0},children:t("div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"USD Value"}),t("span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",s?.price&&i?(s.price*d*parseFloat(i.toString())).toFixed(2):"\u2014"]})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Estimated Time"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:w>0?`${w.toFixed(2)}s`:"\u2014"})]}),t("div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Order Type"}),e("span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),t("div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[e("span",{children:"Route"}),t("a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[e(Q,{}),"Aori",e(I,{})]})]})]})})]})});b.displayName="QuoteLoader";var D=b;export{D as a};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
+ var _chunkKH57FLSTcjs = require('./chunk-KH57FLST.cjs');var _chunkPSCWQFVYcjs = require('./chunk-PSCWQFVY.cjs');var _chunkD7GULMHEcjs = require('./chunk-D7GULMHE.cjs');var _chunkK3RTTHBScjs = require('./chunk-K3RTTHBS.cjs');var _chunk34N36GUDcjs = require('./chunk-34N36GUD.cjs');var _chunkT3I3AJXVcjs = require('./chunk-T3I3AJXV.cjs');var _reactquery = require('@tanstack/react-query');var _react = require('react');function $r(e){if(e.length===0)return 5e3;let l=Math.max(...e.map(s=>_nullishCoalesce(_optionalChain([_chunkK3RTTHBScjs.c.call(void 0, s), 'optionalAccess', _2 => _2.blockTimeMs]), () => (2e3))));return Math.min(5e3,Math.max(1e3,l*2+1e3))}var Ur=()=>{let{address:e}=_chunk34N36GUDcjs.a.call(void 0, ),t=_chunkD7GULMHEcjs.c.call(void 0, ),n=_reactquery.useQueryClient.call(void 0, ),c=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, !0),s=_react.useCallback.call(void 0, a=>{if(!e)return;let v=[...new Set(a.tokens.map(d=>d.asset.chainId))],p=$r(v);c.current&&(clearTimeout(c.current),c.current=null),c.current=setTimeout(async()=>{if(c.current=null,!!l.current)try{let d=a.tokens.map(w=>({chainId:w.asset.chainId,tokenAddress:w.asset.address})),o=await _chunkK3RTTHBScjs.I.call(void 0, e,d);if(o.balances.length===0)return;if(a.tokens.length>=2){let w=a.tokens[0].asset,u=a.tokens[1].asset,h=_chunkK3RTTHBScjs.J.swap(e,w.chainId,w.address,u.chainId,u.address);n.setQueryData(h,o)}let r=_chunkK3RTTHBScjs.J.bulk(e,t),y=n.getQueryData(r);if(y){let w=y.balances.map(u=>_nullishCoalesce(o.balances.find(m=>m.chainId===u.chainId&&m.token.toLowerCase()===u.token.toLowerCase()), () => (u)));for(let u of o.balances)w.some(h=>h.chainId===u.chainId&&h.token.toLowerCase()===u.token.toLowerCase())||w.push(u);for(let u of a.tokens)if(!o.balances.some(m=>m.chainId===u.asset.chainId&&m.token.toLowerCase()===u.asset.address.toLowerCase())){let m=w.findIndex(i=>i.chainId===u.asset.chainId&&i.token.toLowerCase()===u.asset.address.toLowerCase());m!==-1&&(w[m]={...w[m],balance:"0",shiftedBalance:"0"})}n.setQueryData(r,{balances:w})}}catch (e2){}},p)},[e,t,n]);return _react.useEffect.call(void 0, ()=>(l.current=!0,()=>{l.current=!1,c.current&&(clearTimeout(c.current),c.current=null)}),[]),{triggerBalanceUpdate:s}},lt=class extends EventTarget{emit(t){this.dispatchEvent(new CustomEvent("balance-update",{detail:t}))}},ut=new lt,Me= exports.b =()=>e=>ut.emit(e),gs= exports.c =()=>{let{triggerBalanceUpdate:e}=Ur();_react.useEffect.call(void 0, ()=>{let t=n=>{e(n.detail)};return ut.addEventListener("balance-update",t),()=>ut.removeEventListener("balance-update",t)},[e])};var _viem = require('viem');var _jsxruntime = require('react/jsx-runtime');var _t=_react.createContext.call(void 0, void 0),Ft=1e4,Fr=3e4,_r=1e3,Br=2;function qr(e){return _nullishCoalesce(e.find(n=>_optionalChain([n, 'access', _3 => _3.routeSteps, 'optionalAccess', _4 => _4[0], 'optionalAccess', _5 => _5.type])==="AORI_V1"), () => (e[0]))}var Ss=({children:e,recipient:t})=>{let{address:n}=_chunk34N36GUDcjs.a.call(void 0, ),c=t||n,[l,s]=_react.useState.call(void 0, "idle"),[a,v]=_react.useState.call(void 0, "idle"),[p,d]=_react.useState.call(void 0, null),[o,r]=_react.useState.call(void 0, null),[y,w]=_react.useState.call(void 0, !1),[u,h]=_react.useState.call(void 0, !1),[m,i]=_react.useState.call(void 0, !1),g=_react.useRef.call(void 0, null),x=_react.useRef.call(void 0, null),f=_react.useRef.call(void 0, null),k=_react.useRef.call(void 0, null),O=_react.useRef.call(void 0, null),C=_react.useRef.call(void 0, 0),M=_react.useRef.call(void 0, 0),D=_react.useRef.call(void 0, 0),E=_react.useRef.call(void 0, !1),I=_react.useRef.call(void 0, new Map),P=_react.useCallback.call(void 0, ()=>{f.current&&clearTimeout(f.current),k.current&&clearTimeout(k.current),O.current&&clearTimeout(O.current),f.current=null,k.current=null,O.current=null},[]),$=_react.useCallback.call(void 0, ()=>{P(),g.current=null,C.current=0,s(()=>E.current?"fresh":"idle")},[P]),W=_react.useCallback.call(void 0, ()=>{$(),x.current=null,d(null),r(null),w(!1),h(!1),i(!1),I.current.clear(),s("idle"),v("idle")},[$]),H=_react.useCallback.call(void 0, S=>{if(!S)return;k.current&&clearTimeout(k.current);let R=Math.max(0,S+Fr-Date.now());k.current=setTimeout(()=>{s(L=>L==="idle"?"idle":"stale")},R)},[]),te=_react.useCallback.call(void 0, async(S,R)=>{let{inputToken:L,outputToken:N,inputAmount:B,setOutputAmount:J}=S;if(!L||!N||!B||parseFloat(B)<=0||Date.now()-(M.current||0)<Ft-10)return;let Se=++C.current;try{if(!_optionalChain([L, 'optionalAccess', _6 => _6.decimals])||!_optionalChain([N, 'optionalAccess', _7 => _7.decimals]))return;let K=_chunkK3RTTHBScjs.F.call(void 0, L.chainId)||_optionalChain([_chunkK3RTTHBScjs.c.call(void 0, L.chainId), 'optionalAccess', _8 => _8.key])||"",ie=_chunkK3RTTHBScjs.F.call(void 0, N.chainId)||_optionalChain([_chunkK3RTTHBScjs.c.call(void 0, N.chainId), 'optionalAccess', _9 => _9.key])||"";if(!K||!ie)throw new Error("Unknown chain");let ne=_viem.parseUnits.call(void 0, B.toString(),L.decimals).toString(),ce={srcChainKey:K,dstChainKey:ie,srcTokenAddress:_chunkK3RTTHBScjs.v.call(void 0, L.address),dstTokenAddress:_chunkK3RTTHBScjs.v.call(void 0, N.address),amount:ne,srcWalletAddress:n||"0x0000000000000000000000000000000000000000",dstWalletAddress:c||n||"0x0000000000000000000000000000000000000000",options:{amountType:"EXACT_SRC_AMOUNT",feeTolerance:{type:"PERCENT",amount:2}}};M.current=Date.now();let le=await fetch(`${_chunkK3RTTHBScjs.k.call(void 0, )}/quotes`,{method:"POST",headers:_chunkK3RTTHBScjs.m.call(void 0, ),body:JSON.stringify(ce),signal:AbortSignal.timeout(15e3)});if(!le.ok){let Ee=await _asyncOptionalChain([(await le.json().catch(()=>({}))), 'optionalAccess', async _10 => _10.message])||le.statusText;throw Object.assign(new Error(Ee),{status:le.status})}let ue=await le.json();if(Se!==C.current||g.current!==R)return;let Te=_nullishCoalesce(ue.quotes, () => ([])),de=qr(Te);if(!de)throw Object.assign(new Error("No quotes returned"),{emptyQuotes:!0});let Ve=Number(_viem.formatUnits.call(void 0, _chunkK3RTTHBScjs.q.call(void 0, de.dstAmount),N.decimals));typeof J=="function"&&J(Ve),de._receivedAt=Date.now(),d(de),r(null),w(!1),s("fresh"),H(de._receivedAt),R&&I.current.delete(R)}catch(K){if(Se!==C.current||g.current!==R)return;let ie=_optionalChain([K, 'optionalAccess', _11 => _11.status]),ne=K instanceof Error?K.message:"",ce=!!_optionalChain([K, 'optionalAccess', _12 => _12.emptyQuotes]);if((ie===400||ce||ne.includes("Quote request failed"))&&R){let ue=(I.current.get(R)||0)+1;if(I.current.set(R,ue),ue>=Br){h(!0),P(),g.current=null;return}}if(ne.toLowerCase().includes("order cap exceeded")){i(!0),P(),g.current=null;return}if(ne.toLowerCase().includes("insufficient executor balance")){w(!0),P(),g.current=null;return}r(K instanceof Error?K.message:"Unknown error")}},[n,c,H,P]),U=_react.useCallback.call(void 0, (S,R)=>{P(),x.current=S,M.current=0,I.current.delete(R),w(!1),h(!1),i(!1),r(null),s("polling");let L=async()=>{g.current===R&&(await te(S,R),g.current===R&&(f.current=setTimeout(L,Ft)))};L()},[P,te]),T=_react.useCallback.call(void 0, S=>{if(!_optionalChain([S, 'optionalAccess', _13 => _13.inputToken])||!_optionalChain([S, 'optionalAccess', _14 => _14.outputToken])||!_optionalChain([S, 'optionalAccess', _15 => _15.inputAmount])||parseFloat(S.inputAmount)<=0){$();return}let R=x.current;if(R&&_optionalChain([R, 'access', _16 => _16.inputToken, 'optionalAccess', _17 => _17.address])===_optionalChain([S, 'access', _18 => _18.inputToken, 'optionalAccess', _19 => _19.address])&&_optionalChain([R, 'access', _20 => _20.inputToken, 'optionalAccess', _21 => _21.chainId])===_optionalChain([S, 'access', _22 => _22.inputToken, 'optionalAccess', _23 => _23.chainId])&&_optionalChain([R, 'access', _24 => _24.outputToken, 'optionalAccess', _25 => _25.address])===_optionalChain([S, 'access', _26 => _26.outputToken, 'optionalAccess', _27 => _27.address])&&_optionalChain([R, 'access', _28 => _28.outputToken, 'optionalAccess', _29 => _29.chainId])===_optionalChain([S, 'access', _30 => _30.outputToken, 'optionalAccess', _31 => _31.chainId])&&R.inputAmount===S.inputAmount&&g.current)return;let N=Date.now();if(N-D.current<100)return;D.current=N;let B=`${Date.now()}-${Math.random().toString(36).slice(2)}`;g.current=B,U(S,B)},[U,$]),_=_react.useCallback.call(void 0, ({amount:S,inputToken:R,outputToken:L,setOutputAmount:N})=>{N(null),O.current&&clearTimeout(O.current),!S||S===0?(v("idle"),$(),d(null),r(null),w(!1),h(!1),i(!1)):(v("typing"),$(),d(null),w(!1),h(!1),i(!1),r(null),O.current=setTimeout(()=>{v("settled"),R&&L&&S>0&&T({inputToken:R,outputToken:L,inputAmount:S.toString(),setOutputAmount:N})},_r))},[$,T]),Q=_react.useCallback.call(void 0, ()=>{let S=x.current;if(!S)return;d(null);let R=`${Date.now()}-${Math.random().toString(36).slice(2)}`;g.current=R,s("refreshing"),typeof S.setOutputAmount=="function"&&S.setOutputAmount(null),U(S,R)},[U]);_react.useEffect.call(void 0, ()=>{E.current=!!p},[p]),_react.useEffect.call(void 0, ()=>()=>P(),[P]);let G=_react.useMemo.call(void 0, ()=>({status:l,inputState:a,rfqQuote:p,error:o,liquidityError:y,routingError:u,sizeCapError:m,ensureForParams:T,stop:$,refresh:Q,clear:W,handleInputChange:_}),[l,a,p,o,y,u,m,T,$,Q,W,_]);return _jsxruntime.jsx.call(void 0, _t.Provider,{value:G,children:e})},ze= exports.e =()=>{let e=_react.useContext.call(void 0, _t);if(e===void 0)throw new Error("useRfq must be used within an RfqProvider");return e};var Hr=_react.createContext.call(void 0, {openConnectModal:()=>{}}),ks= exports.g =()=>_react.useContext.call(void 0, Hr);var Gr=20,Kr=({side:e,asset:t,otherAsset:n,isPlacingOrder:c,isWrappingPair:l,isUnwrappingPair:s})=>{let{baseAmount:a,quoteAmount:v,setBaseAmount:p,setQuoteAmount:d}=_chunkPSCWQFVYcjs.e.call(void 0, ),{amountInputVariant:o,hideAmountInputSymbol:r,widgetType:y}=_chunkD7GULMHEcjs.b.call(void 0, ),w=y==="compact",[u,h]=e==="base"?[p,d]:[d,p],m=!t||e==="quote"||c,i=w?32:o==="default"?64:32,[g,x]=_react.useState.call(void 0, i),[f,k]=_react.useState.call(void 0, ""),O=_react.useRef.call(void 0, null),C=_react.useRef.call(void 0, null),M=_react.useRef.call(void 0, null),D=_react.useRef.call(void 0, null),E="USD",I=e==="base"?a:v,[P,$]=_react.useState.call(void 0, !1),W=_react.useCallback.call(void 0, ()=>{if(o!=="default"){x(i);return}if(!O.current||!C.current||!M.current)return;let U=O.current.offsetWidth,T=20,_=i;for(;_>20&&(C.current.style.fontSize=`${_}px`,M.current.style.fontSize=`${_}px`,!(C.current.offsetWidth+M.current.offsetWidth+T<=U));)_-=1;x(_)},[o,i]),H=_react.useCallback.call(void 0, U=>{U.key==="."&&f.includes(".")&&U.preventDefault()},[f]),te=_react.useCallback.call(void 0, U=>{let T=U.target.value;if(T==="."&&(T="0."),!/^\d*\.?\d*$/.test(T)||(T.match(/\./g)||[]).length>1)return;if(T.length>1&&T[0]==="0"&&T[1]!=="."&&(T=T.replace(/^0+/,"")||"0"),_optionalChain([t, 'optionalAccess', _32 => _32.decimals])!==void 0&&T.includes(".")){let[,Q]=T.split(".");if(Q&&Q.length>t.decimals)return}if(T.length>Gr)return;k(T);let _=parseFloat(T);T!==f&&(T===""||T==="0."||T.endsWith(".")?(u(null),e==="base"&&h(null)):!Number.isNaN(_)&&_>=0&&u(_),e==="base"&&d(null),(s||l)&&d(_||0))},[f,u,e,d,_optionalChain([t, 'optionalAccess', _33 => _33.decimals]),h,s,l]);return _react.useEffect.call(void 0, ()=>{let U=Q=>{if(Q===null)return"";let G=_optionalChain([t, 'optionalAccess', _34 => _34.decimals]);if(G===void 0)return"";let S=Q.toString();if(/e/i.test(S)&&(S=Number(Q).toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:G})),S.includes(".")){let[R,L]=S.split("."),N=L.slice(0,G);return N?`${R}.${N}`:R}return S};if(I===null){f==="0."||f!==""&&f.endsWith(".")||k("");return}if(!m&&(f.endsWith(".")||f.match(/\.\d*0$/)||f==="0"||f==="0.")&&f!=="")return;let _=parseFloat(f)||0;(f===""||Math.abs(_-I)>1e-10)&&k(U(I))},[I,_optionalChain([t, 'optionalAccess', _35 => _35.decimals]),f,m]),_react.useEffect.call(void 0, ()=>{W()},[f,W]),_react.useEffect.call(void 0, ()=>{$(!0)},[]),_react.useEffect.call(void 0, ()=>{P&&W()},[P,W]),_react.useEffect.call(void 0, ()=>{C.current&&D.current&&(D.current.style.width=`${C.current.offsetWidth}px`)},[f]),_react.useEffect.call(void 0, ()=>{if(!P)return;let U=new ResizeObserver(()=>{P&&W()});return O.current&&U.observe(O.current),()=>U.disconnect()},[P,W]),_jsxruntime.jsx.call(void 0, "div",{ref:O,style:{fontSize:`${g}px`,transition:"font-size 0.05s ease-in-out"},className:`mt-2 box-border font-sans flex ${w?o==="normal"?"h-12 my-1":"h-10 my-0.5":o==="normal"?"h-12 my-1":"h-20 my-1"} w-full flex-row items-center ${m?"cursor-default":"cursor-text"}`,onClick:()=>_optionalChain([D, 'access', _36 => _36.current, 'optionalAccess', _37 => _37.focus, 'call', _38 => _38()]),children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex w-full items-center",children:[_jsxruntime.jsx.call(void 0, "label",{htmlFor:`${e}Amount`,className:"sr-only",children:e==="base"?"Input token amount":"Output token amount"}),_jsxruntime.jsx.call(void 0, "input",{ref:D,type:"text",inputMode:"decimal",placeholder:"0",autoComplete:"off",id:`${e}Amount`,value:f,onWheel:U=>U.target.blur(),onKeyDown:H,onChange:te,style:{transition:"width 0.15s ease-in-out",color:"var(--widget-foreground)",WebkitTextFillColor:"var(--widget-foreground)",opacity:1},className:"flex min-w-[45px] whitespace-nowrap bg-transparent placeholder:opacity-50 font-sans font-thin",disabled:m}),_jsxruntime.jsx.call(void 0, "span",{style:{transition:"width 0.15s ease-in-out"},ref:C,className:"pointer-events-none absolute flex whitespace-nowrap invisible",children:f||0}),!r&&o!=="normal"&&_jsxruntime.jsx.call(void 0, "span",{ref:M,className:"ml-2 font-thin uppercase",style:{color:"var(--widget-foreground)",opacity:.5,fontSize:`${g}px`},children:_optionalChain([t, 'optionalAccess', _39 => _39.symbol])?t.symbol.length>6?`${t.symbol.slice(0,6)}...`:t.symbol:E}),(r||o==="normal")&&_jsxruntime.jsx.call(void 0, "span",{ref:M,className:"hidden"})]})})},$s= exports.h =Kr;var Yr=({toggle:e,side:t,asset:n,isPlacingOrder:c,hideDropdown:l})=>{let{baseBalance:s,quoteBalance:a}=_chunkPSCWQFVYcjs.e.call(void 0, ),{tokenDisplay:v,tokenBadgeOrientation:p,widgetType:d}=_chunkD7GULMHEcjs.b.call(void 0, ),o=d==="compact",r=o?"h-10":"h-13",y=o?"h-10 w-10":"h-13 w-13",w=t==="base"?s.formatted?(()=>{let h=parseFloat(s.formatted);return h>=1e4?_chunkK3RTTHBScjs.o.call(void 0, h):h.toFixed(4)})():void 0:a.formatted?(()=>{let h=parseFloat(a.formatted);return h>=1e4?_chunkK3RTTHBScjs.o.call(void 0, h):h.toFixed(4)})():void 0,u={role:"button",tabIndex:c?-1:0,"aria-disabled":c,"aria-label":`Select ${t==="base"?"input":"output"} token${n?`: ${n.symbol}`:""}`,onClick:c?void 0:e,onKeyDown:c?void 0:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),e())}};return v==="pill"?_jsxruntime.jsx.call(void 0, "div",{...u,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-full cursor-pointer transition-colors ${p==="right"?"ml-auto":""}`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-secondary)",color:"var(--widget-secondary-foreground)"},children:n?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{className:"rounded-full",asset:n,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-thin uppercase",children:n.symbol}),!l&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.U,{className:"w-1.5 opacity-60",style:{color:"var(--widget-secondary-foreground)"}})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{className:"text-xs opacity-70",children:"Select"}),!l&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.U,{className:"w-1.5 opacity-60",style:{color:"var(--widget-secondary-foreground)"}})]})}):v==="ghost"?_jsxruntime.jsxs.call(void 0, "div",{...u,className:"inline-flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-70 py-1",style:{color:"var(--widget-foreground)"},children:[n?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{className:"rounded-full",asset:n,size:"xxs",noChain:!0}),_jsxruntime.jsx.call(void 0, "span",{className:"text-sm font-thin uppercase",children:n.symbol})]}):_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-muted-foreground)"},children:"Select token"}),!l&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.U,{className:"w-1.5 opacity-50"})]}):_jsxruntime.jsx.call(void 0, "div",{...u,className:`relative ${r} w-full cursor-pointer text-xl duration-100 ease-linear`,style:{border:"1px solid var(--widget-border)",backgroundColor:"var(--widget-secondary)",borderTopLeftRadius:"9999px",borderBottomLeftRadius:"9999px",borderTopRightRadius:"var(--widget-radius)",borderBottomRightRadius:"var(--widget-radius)"},children:_jsxruntime.jsx.call(void 0, "div",{className:"relative flex h-full w-full flex-row items-center",children:n?_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex h-full w-full flex-row items-center",children:[_jsxruntime.jsx.call(void 0, "div",{className:`${y} pl-px flex items-center justify-center`,children:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{className:"rounded-full",asset:n,size:"lg"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full w-full flex-row items-center justify-between pl-2.5 pr-7",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-full flex-col justify-center gap-0.5",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-thin uppercase",style:{color:"var(--widget-secondary-foreground)"},children:n.symbol}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-muted-foreground)"},children:[_optionalChain([n, 'access', _40 => _40.address, 'optionalAccess', _41 => _41.slice, 'call', _42 => _42(0,6)]),"...",_optionalChain([n, 'access', _43 => _43.address, 'optionalAccess', _44 => _44.slice, 'call', _45 => _45(-4)])]})]}),w!==void 0&&_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-2xs",style:{color:"var(--widget-muted-foreground)"},children:"Balance"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-sans text-xs tabular-nums",style:{color:"var(--widget-foreground)",opacity:.5},children:w})]})]}),!l&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.U,{className:"absolute right-3 top-1/2 w-1.5 translate-y-[-50%]",style:{color:"var(--widget-secondary-foreground)",opacity:.6}})]}):_jsxruntime.jsx.call(void 0, "div",{className:"flex h-full w-full items-center justify-center",children:_jsxruntime.jsx.call(void 0, "span",{className:"text-sm",style:{color:"var(--widget-secondary-foreground)",opacity:.7},children:"Select token"})})})})},Ws= exports.i =Yr;var qt=_chunkT3I3AJXVcjs.b.call(void 0, _chunkKH57FLSTcjs.a.call(void 0, ),1);var Jr=()=>{let[e,t]=_react.useState.call(void 0, null),[n,c]=_react.useState.call(void 0, ""),l=_chunkK3RTTHBScjs.x.call(void 0, n,1e3),[s,a]=_react.useState.call(void 0, !1),[v,p]=_react.useState.call(void 0, "");_react.useEffect.call(void 0, ()=>{_chunkD7GULMHEcjs.d.getState().setRecipient(e)},[e]),_react.useEffect.call(void 0, ()=>{c(e||"")},[e]);let d=r=>{let y=r.target.value;s&&(a(!1),p(""),t(null)),c(y),y===""&&t(null)};_react.useEffect.call(void 0, ()=>{l===""||!l?(a(!1),p(""),t(null)):_chunkK3RTTHBScjs.w.call(void 0, l)?(a(!1),p(""),t(l)):(a(!0),p("Invalid wallet address..."),t(null),c(""))},[l]),_react.useEffect.call(void 0, ()=>{if(s){let r=setTimeout(()=>{t(null),c(""),a(!1),p("")},2e3);return()=>clearTimeout(r)}},[s]);let o=()=>{t(null),c(""),a(!1),p("")};return _jsxruntime.jsx.call(void 0, "div",{className:"w-full",children:_jsxruntime.jsxs.call(void 0, "div",{className:"relative flex flex-row items-center",children:[_jsxruntime.jsx.call(void 0, "input",{type:"password",style:{display:"none"},"aria-hidden":"true",tabIndex:-1}),_jsxruntime.jsx.call(void 0, "label",{htmlFor:"recipient-address",className:"sr-only",children:"Recipient wallet address"}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-3 flex h-6 w-6 items-end justify-center overflow-hidden rounded-full",style:{backgroundColor:"var(--widget-secondary)"},children:e&&!s?_jsxruntime.jsx.call(void 0, "img",{className:"h-full w-full rounded-full object-cover",src:(0,qt.makeGradient)(e),alt:"Recipient avatar"}):_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.T,{className:"h-5 w-5",style:{color:s?"var(--widget-destructive)":"var(--widget-muted-foreground)"}})}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-12 top-1.5 -translate-y-1 text-xs font-medium opacity-60",style:{color:s?"var(--widget-destructive)":"var(--widget-muted-foreground)"},"aria-hidden":"true",children:"To:"}),_jsxruntime.jsx.call(void 0, "input",{id:"recipient-address",className:"font-sans block h-10 w-full items-center pl-12 pt-4 pr-8 text-xs",style:{backgroundColor:s?"color-mix(in srgb, var(--widget-destructive) 10%, transparent)":"transparent",color:s?"var(--widget-destructive)":"var(--widget-foreground)",outline:"none",opacity:s?.9:1},placeholder:s?v:"Enter recipient address...",value:n,onChange:d,spellCheck:!1,"aria-invalid":s,"aria-describedby":s?"recipient-error":void 0}),s&&_jsxruntime.jsx.call(void 0, "span",{id:"recipient-error",className:"sr-only",children:v}),e&&!s&&_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer flex items-center justify-center h-4 w-4 rounded-full transition-colors hover:[color:var(--widget-destructive)]",style:{color:"var(--widget-muted-foreground)"},onClick:o,"aria-label":"Clear recipient",children:[_jsxruntime.jsx.call(void 0, "svg",{className:"h-2.5 w-2.5",viewBox:"0 -0.5 21 21",fill:"none",children:_jsxruntime.jsx.call(void 0, "g",{fill:"currentColor",fillRule:"evenodd",children:_jsxruntime.jsx.call(void 0, "polygon",{points:"375.0183 90 384 98.554 382.48065 100 373.5 91.446 364.5183 100 363 98.554 371.98065 90 363 81.446 364.5183 80 373.5 88.554 382.48065 80 384 81.446",transform:"translate(-363 -80)"})})}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Clear recipient"})]})]})})},js= exports.j =Jr;function Ks(e){return _jsxruntime.jsxs.call(void 0, "svg",{width:"485",height:"484",viewBox:"0 0 485 484",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[_jsxruntime.jsx.call(void 0, "path",{d:"M265.974 52.8127C270.567 50.9299 273.227 53.6338 275.917 56.1595C301.879 80.5364 327.828 104.927 353.786 129.308C380.101 154.024 406.44 178.715 432.721 203.467C436.002 206.557 440.744 209.272 438.226 215.021C435.865 220.415 430.758 219.123 426.424 219.124C305.965 219.169 185.506 219.163 65.0464 219.166C53.0995 219.166 49.0676 215.225 49.0125 203.316C48.9563 191.154 48.9813 178.991 48.9973 166.829C49.0119 155.717 53.3581 151.358 64.4131 151.358C127.892 151.357 191.37 151.364 254.849 151.368C262.591 151.368 262.645 151.344 262.588 143.559C262.388 116.237 262.191 88.914 261.918 61.5922C261.883 58.0834 262.161 54.9042 265.974 52.8127Z",fill:"currentColor"}),_jsxruntime.jsx.call(void 0, "path",{d:"M80.5649 300.432C71.3447 291.747 62.4175 283.264 53.4064 274.87C50.4552 272.122 47.8959 269.327 49.7894 264.946C51.6154 260.72 55.4624 260.923 59.1682 260.923C164.476 260.927 269.785 260.932 375.093 260.935C391.422 260.935 407.752 260.9 424.081 260.933C434.679 260.955 438.994 265.286 439.015 275.854C439.04 288.517 439.048 301.181 439.013 313.845C438.985 324.225 434.466 328.73 424.01 328.732C360.359 328.741 296.707 328.729 233.056 328.714C225.392 328.713 225.368 328.686 225.426 336.583C225.628 363.741 225.815 390.9 226.101 418.057C226.142 421.935 225.905 425.512 221.852 427.329C217.686 429.197 214.934 426.578 212.212 424.02C172.068 386.302 131.922 348.587 91.7738 310.874C88.1374 307.459 84.4753 304.07 80.5649 300.432Z",fill:"currentColor"})]})}var en=["SUCCEEDED","FAILED","COMPLETED","CANCELLED"];async function zt(e,t,n={}){let{onStatusChange:c,onComplete:l,onError:s,interval:a=4e3,timeout:v=3e5,txHash:p,signal:d}=n,o=null,r=Date.now(),y=0,w=8,u=null,h=p?`?txHash=${p}`:"";return new Promise((m,i)=>{let g=async()=>{try{if(_optionalChain([d, 'optionalAccess', _46 => _46.aborted])){u&&clearTimeout(u),i(new DOMException("Polling aborted","AbortError"));return}if(Date.now()-r>v){u&&clearTimeout(u);let O=new Error("Order status polling timed out");_optionalChain([s, 'optionalCall', _47 => _47(O)]),i(O);return}let x=await fetch(`${t}/status/${e}${h}`,{headers:_chunkK3RTTHBScjs.m.call(void 0, ),signal:d});if(x.status===404){u=setTimeout(g,a);return}if(!x.ok)throw new Error(`Failed to fetch order status: ${await x.text()}`);let f=await x.json();if(!f||typeof f!="object"||!f.status)throw new Error(`Invalid status response format: ${JSON.stringify(f)}`);y=0;let k=f.status.toUpperCase();if(k!==o&&(o=k,_optionalChain([c, 'optionalCall', _48 => _48(f)])),en.includes(k)){u&&clearTimeout(u),_optionalChain([l, 'optionalCall', _49 => _49(f)]),m(f);return}u=setTimeout(g,a)}catch(x){if(x instanceof Error&&x.name==="AbortError"){u&&clearTimeout(u),i(x);return}if(++y>=w){u&&clearTimeout(u);let f=x instanceof Error?x:new Error(String(x));_optionalChain([s, 'optionalCall', _50 => _50(f)]),i(f);return}u=setTimeout(g,a)}};g()})}function jt(e){let t=e.toUpperCase();return t==="SUCCEEDED"||t==="COMPLETED"?"completed":t==="FAILED"?"failed":t==="CANCELLED"?"cancelled":t==="PROCESSING"?"received":"pending"}var Ht=e=>{let t=_react.useRef.call(void 0, new Map),n=_react.useRef.call(void 0, new Map),c=_react.useRef.call(void 0, new Map),l=_react.useRef.call(void 0, 0),s=_react.useCallback.call(void 0, ()=>++l.current,[]),{address:a}=_chunk34N36GUDcjs.a.call(void 0, ),v=Me(),p=_react.useCallback.call(void 0, (r,y)=>{if(t.current.get(r))return;y&&n.current.set(r,y),t.current.set(r,!0);let w=l.current,u=new AbortController;c.current.set(r,u);let h=_optionalChain([y, 'optionalAccess', _51 => _51.baseToken, 'optionalAccess', _52 => _52.chainId])===1;zt(r,_chunkK3RTTHBScjs.k.call(void 0, ),{interval:h?1e3:500,timeout:3e5,signal:u.signal,onStatusChange:m=>{if(!_optionalChain([m, 'optionalAccess', _53 => _53.status]))return;let i=jt(m.status);if(_optionalChain([e, 'optionalCall', _54 => _54(r,i,m.explorerUrl)]),i==="completed"&&a){let g=n.current.get(r);if(g&&(g.baseToken||g.quoteToken)){let x=[];g.baseToken&&x.push({asset:g.baseToken,userAddress:a}),g.quoteToken&&x.push({asset:g.quoteToken,userAddress:a}),v({type:"swap",tokens:x})}}["completed","failed","cancelled"].includes(i)&&(t.current.delete(r),n.current.delete(r)),w!==l.current&&(t.current.delete(r),n.current.delete(r))},onComplete:m=>{_optionalChain([m, 'optionalAccess', _55 => _55.status])&&_optionalChain([e, 'optionalCall', _56 => _56(r,jt(m.status),m.explorerUrl)]),t.current.delete(r),n.current.delete(r)},onError:()=>{t.current.delete(r),n.current.delete(r)}}).catch(m=>{m instanceof Error&&m.name==="AbortError"||(t.current.delete(r),n.current.delete(r),c.current.delete(r))})},[a,v,e]),d=_react.useCallback.call(void 0, r=>{let y=c.current.get(r);y&&(y.abort(),c.current.delete(r)),s(),t.current.delete(r),n.current.delete(r)},[s]),o=_react.useCallback.call(void 0, ()=>{for(let r of c.current.values())r.abort();c.current.clear(),s(),t.current.clear(),n.current.clear()},[s]);return _react.useEffect.call(void 0, ()=>()=>o(),[o]),{startPolling:p,stopPolling:d,stopAllPolling:o,isPolling:r=>t.current.has(r)}};function _e(e){try{let t=new URL(e).pathname.split("/"),n=t[t.length-1];return n&&n.startsWith("0x")?n:null}catch (e3){return null}}var sn=_react.createContext.call(void 0, {registerTransaction:()=>{},enabled:!1}),Gt= exports.o =()=>_react.useContext.call(void 0, sn);var _actions = require('viem/actions');function Xt(e){return e instanceof Error?e.name==="UserRejectedRequestError"||e.message.includes("User rejected")||e.message.includes("rejected")||e.message.includes("denied")||e.message.includes("cancelled")||e.message.includes("canceled"):!1}async function Kt(e){if(_optionalChain([e, 'access', _57 => _57.chain, 'optionalAccess', _58 => _58.id]))return e.chain.id;let t=_optionalChain([e, 'access', _59 => _59.getChainId, 'optionalCall', _60 => _60()]);return t!=null?await t:null}var an=async(e,t)=>{try{if(await Kt(e)===t)return!0;if(e.request)await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${t.toString(16)}`}]});else if(e.switchChain)await e.switchChain({id:t});else if(e.send)await e.send("wallet_switchEthereumChain",[{chainId:`0x${t.toString(16)}`}]);else throw new Error("Wallet doesn't support chain switching");return await Kt(e)===t}catch(n){throw Xt(n)?new Error("User rejected the chain switch request"):new Error(`Please switch your wallet to the required network (Chain ID: ${t})`)}},Yt= exports.q =async e=>{let{quote:t,signatureStep:n,userAddress:c,walletClient:l}=e;if(!l)throw new Error("Wallet client not available");if(n.type!=="SIGNATURE"||!_optionalChain([n, 'access', _61 => _61.signature, 'optionalAccess', _62 => _62.typedData]))throw new Error("Invalid signature step");try{let s=n.signature.typedData,a={...s.message};for(let o of["inputAmount","outputAmount","startTime","endTime"])a[o]!=null&&(a[o]=BigInt(a[o]));let v=s.domain;if(v.chainId!=null){let o=Number(v.chainId);await an(l,o)}let p=await _actions.signTypedData.call(void 0, l,{account:c,domain:v,types:s.types,primaryType:s.primaryType,message:a}),d=await fetch(`${_chunkK3RTTHBScjs.k.call(void 0, )}/submit-signature`,{method:"POST",headers:_chunkK3RTTHBScjs.m.call(void 0, ),body:JSON.stringify({quoteId:t.id,signatures:[p]})});if(!d.ok){let o=await d.json().catch(()=>({}));throw new Error(_optionalChain([o, 'optionalAccess', _63 => _63.message])||`Submit failed: ${d.status}`)}return{quoteId:t.id,signature:p}}catch(s){throw Xt(s)?new Error("User rejected the signing request"):s instanceof Error&&s.message.includes("chain")?new Error("Chain switching failed. Please manually switch to the correct network."):s}};var Jt="vt_submitted_quotes";var mt=()=>{try{let e=localStorage.getItem(Jt);return e?JSON.parse(e):[]}catch (e4){return[]}},Zt=e=>{try{localStorage.setItem(Jt,JSON.stringify(e))}catch (e5){}},cn= exports.r =e=>{let t=Date.now(),n=typeof e=="string"?new Date(e).getTime():e>9999999999?e:e*1e3;return t<n+3e4},ln=e=>mt().some(t=>t.quoteId===e),er= exports.s =(e,t)=>ln(e)?{canSubmit:!1,reason:"Order already submitted"}:cn(t)?{canSubmit:!0}:{canSubmit:!1,reason:"Quote has expired"},tr= exports.t =(e,t)=>{let n=typeof t=="string"?new Date(t).getTime():t,c=mt();c.push({quoteId:e,submittedAt:Date.now(),createdAt:n}),Zt(c)},rr= exports.u =()=>{let e=mt(),t=Date.now(),n=300*1e3,c=e.filter(l=>t-l.submittedAt<n);c.length!==e.length&&Zt(c)};var _core = require('@wagmi/core');var _abis = require('abitype/abis');var _wagmi = require('wagmi');function nr(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:n,amountRaw:c,writeContractAsync:l})=>{let s=_chunkK3RTTHBScjs.c.call(void 0, t);if(!s)throw new Error(`No wrapping contract for chain ${t}`);let a=s.wrappedAsset.address,v=await l({abi:_abis.wethAbi,functionName:"withdraw",address:a,account:n,args:[c],chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:v,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Unwrap transaction did not get successful receipt");return{success:!0,hash:v}}})}function sr(){let e=_wagmi.useConfig.call(void 0, );return _reactquery.useMutation.call(void 0, {mutationFn:async({chainId:t,accountAddress:n,amountRaw:c,writeContractAsync:l})=>{let s=_chunkK3RTTHBScjs.c.call(void 0, t);if(!s)throw new Error(`No wrapping contract for chain ${t}`);let a=s.wrappedAsset.address,v=await l({abi:_abis.wethAbi,functionName:"deposit",address:a,account:n,value:c,chainId:t});if((await _core.waitForTransactionReceipt.call(void 0, e,{hash:v,chainId:t,confirmations:1,pollingInterval:4e3})).status!=="success")throw new Error("Wrap transaction did not get successful receipt");return{success:!0,hash:v}}})}function ar(){let{registerTransaction:e,enabled:t}=Gt(),n=_react.useRef.call(void 0, new Set),c=_react.useCallback.call(void 0, (s,a)=>{!t||n.current.has(s)||(n.current.add(s),e(s,a))},[t,e]),l=_react.useCallback.call(void 0, (s,a)=>{!t||n.current.has(s)||(n.current.add(s),e(s,a))},[t,e]);return{trackOrderTransaction:c,trackNativeTransaction:l,txTrackingEnabled:t}}var Sn=15e3,Ye="chain",Tn=({needsChainSwitch:e,requiredChain:t,reviewState:n,goToNextStep:c,cancel:l})=>{let s=_chunkK3RTTHBScjs.r.call(void 0, Ye,n),[a,v]=_react.useState.call(void 0, "pending"),p=_react.useRef.call(void 0, !1),d=_react.useRef.call(void 0, !1),o=_react.useRef.call(void 0, null),r=_wagmi.useChainId.call(void 0, ),{switchChainAsync:y}=_wagmi.useSwitchChain.call(void 0, ),{status:w,isReconnecting:u}=_wagmi.useAccount.call(void 0, ),h=_react.useCallback.call(void 0, ()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),m=_react.useCallback.call(void 0, async()=>{if(!(p.current||d.current||w!=="connected"||u)){p.current=!0,d.current=!0,v("pending"),o.current=setTimeout(()=>{p.current&&(v("error"),p.current=!1)},Sn);try{await y({chainId:t.chainId}),h(),v("success"),c(Ye,n)}catch (e6){h(),v("error")}finally{p.current=!1}}},[y,w,u,t.chainId,c,n,h]);_react.useEffect.call(void 0, ()=>{p.current||d.current||n===Ye&&a==="pending"&&w==="connected"&&!u&&(e&&r!==t.chainId?m():(v("success"),c(Ye,n)))},[n,a,e,r,t.chainId,w,u,m,c]),_react.useEffect.call(void 0, ()=>()=>h(),[h]);let i=()=>{a==="error"&&(d.current=!1,v("pending"))},g=!s&&a==="error",x=!s&&(a==="pending"||a==="error"),f=g?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-sans font-medium transition duration-150 ${g?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${f} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${f} 20%, transparent)`,color:f,borderRadius:"var(--widget-radius)"},onClick:g?i:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.N,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:g?"Retry Switch":`Switch to ${t.name}`}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!s&&a==="pending"&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),(s||a==="success")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-8 w-8"}),g&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.S,{className:"h-[12px] w-[12px]"})]})]})}),x&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:l,children:"Cancel"})]})},lr=Tn;var Rn=({startTime:e,onExpired:t})=>{let[n,c]=_react.useState.call(void 0, 30),[l,s]=_react.useState.call(void 0, !1),a=_react.useRef.call(void 0, !1),v=_react.useRef.call(void 0, t);v.current=t,_react.useEffect.call(void 0, ()=>{a.current=!1},[e]),_react.useEffect.call(void 0, ()=>{let d=()=>{let r=Date.now(),w=(e>9999999999?e:e*1e3)+30*1e3,u=Math.max(0,w-r),h=Math.floor(u/1e3);if(h<=0){c(0),a.current||(a.current=!0,s(!0),v.current());return}c(h),s(!1)};if(l)return;d();let o=setInterval(d,1e3);return()=>clearInterval(o)},[e,l]);let p=d=>{let o=Math.floor(d/60),r=d%60;return`${o.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`};return l?null:_jsxruntime.jsx.call(void 0, "span",{className:"text-xs font-sans",children:p(n)})},fr=Rn;function Mn(e){return e.name==="UserRejectedRequestError"||e.message.includes("User rejected")||e.message.includes("rejected")||e.message.includes("denied")||e.message.includes("cancelled")||e.message.includes("canceled")}var Ce="signingOrder";async function Ln(e,t,n,c,l){let s=_optionalChain([e, 'access', _64 => _64.transaction, 'optionalAccess', _65 => _65.encoded]),a=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _66 => _66.to]), () => (e.to)),v=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _67 => _67.data]), () => (e.data)),p=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _68 => _68.value]), () => (e.value));if(!a)throw new Error('Transaction step missing "to" address');let d=_optionalChain([s, 'optionalAccess', _69 => _69.chainId]),o=e.chainKey||l,r=d||(o?_chunkK3RTTHBScjs.E.call(void 0, o):void 0);if(!r)throw new Error(`Unknown chain: ${o}`);let y=_chunkK3RTTHBScjs.h.call(void 0, )[r],w=await n({account:t,chain:y,to:a,data:v||"0x",value:BigInt(p||"0")});return await _core.waitForTransactionReceipt.call(void 0, c,{hash:w,chainId:r}),w}async function Dn(e,t,n,c,l){let s=_optionalChain([e, 'access', _70 => _70.transaction, 'optionalAccess', _71 => _71.encoded]),a=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _72 => _72.to]), () => (e.to)),v=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _73 => _73.data]), () => (e.data));if(!(!a||!v))try{let{args:p}=_viem.decodeFunctionData.call(void 0, {abi:_viem.erc20Abi,data:v});if(!p||p.length<2)return;let d=p[0],o=e.chainKey||l.srcChainKey,r=_optionalChain([s, 'optionalAccess', _74 => _74.chainId])||(o?_chunkK3RTTHBScjs.E.call(void 0, o):void 0);if(!r)return;if(await _chunkK3RTTHBScjs.H.call(void 0, r).readContract({address:a,abi:_viem.erc20Abi,functionName:"allowance",args:[t,d]})>0n){let u=_viem.encodeFunctionData.call(void 0, {abi:_viem.erc20Abi,functionName:"approve",args:[d,0n]}),h=_chunkK3RTTHBScjs.h.call(void 0, )[r],m=await n({account:t,chain:h,to:a,data:u,value:0n});await _core.waitForTransactionReceipt.call(void 0, c,{hash:m,chainId:r})}}catch (e7){}}var Vn=({base:e,baseAmount:t,quote:n,quoteAmount:c,userAddress:l,reviewState:s,goToNextStep:a,cancel:v,isWrappingPair:p,isUnwrappingPair:d,restartSigningFlow:o,onSwapInitiated:r,onOrderSubmitted:y,onSwapSubmitted:w,startPolling:u,trackNativeTransaction:h})=>{let m=_chunkK3RTTHBScjs.r.call(void 0, Ce,s),[i,g]=_react.useState.call(void 0, "idle"),x=_react.useRef.call(void 0, !1),f=_react.useRef.call(void 0, null),k=_wagmi.useConfig.call(void 0, ),{isReconnecting:O}=_wagmi.useAccount.call(void 0, ),{rfqQuote:C,stop:M,refresh:D}=ze(),{data:E}=_wagmi.useWalletClient.call(void 0, {chainId:e.chainId}),{switchChain:I}=_wagmi.useSwitchChain.call(void 0, ),{sendTransactionAsync:P}=_wagmi.useSendTransaction.call(void 0, ),$=_nullishCoalesce(_optionalChain([C, 'optionalAccess', _75 => _75._receivedAt]), () => (0)),W=_react.useCallback.call(void 0, ()=>$?Date.now()>=$+30*1e3:!1,[$]),H=_react.useCallback.call(void 0, async()=>{if(x.current||i!=="idle")return;if(!_optionalChain([C, 'optionalAccess', _76 => _76.id])||!_optionalChain([C, 'optionalAccess', _77 => _77._receivedAt])){g("error");return}if(!er(C.id,C._receivedAt).canSubmit){g("stale");return}x.current=!0;try{if(!E)throw new Error("Wallet client not available");rr();let R=_nullishCoalesce(C.userSteps, () => ([])),L;for(let N of R)if(N.type==="TRANSACTION"){g("submitting");let B=N.chainKey||C.srcChainKey,J=B?_chunkK3RTTHBScjs.E.call(void 0, B):void 0;J&&_optionalChain([E, 'access', _78 => _78.chain, 'optionalAccess', _79 => _79.id])!==J&&(await I({chainId:J}),await new Promise(K=>setTimeout(K,800)));let we=_optionalChain([(_nullishCoalesce(_optionalChain([N, 'access', _80 => _80.transaction, 'optionalAccess', _81 => _81.encoded, 'optionalAccess', _82 => _82.to]), () => (N.to))), 'optionalAccess', _83 => _83.toLowerCase, 'call', _84 => _84()]),Se=_optionalChain([C, 'access', _85 => _85.srcToken, 'optionalAccess', _86 => _86.address, 'optionalAccess', _87 => _87.toLowerCase, 'call', _88 => _88()]);we&&Se&&we===Se&&await Dn(N,l,P,k,C),L=await Ln(N,l,P,k,C.srcChainKey),h(L,N.description||`Tx on ${B}`)}else N.type==="SIGNATURE"&&(g("signing"),await Yt({quote:C,signatureStep:N,userAddress:l,walletClient:E}));tr(C.id,C._receivedAt),_optionalChain([y, 'optionalCall', _89 => _89(C.id)]),u(C.id,{baseToken:e,quoteToken:n}),_optionalChain([r, 'optionalCall', _90 => _90()]),M(),g("success"),a(Ce,s),_optionalChain([w, 'optionalCall', _91 => _91(C.id)])}catch(R){R instanceof Error&&Mn(R),g("error")}finally{x.current=!1}},[i,C,E,e,n,l,M,u,a,s,w,I,P,r,y,h,k]);_react.useEffect.call(void 0, ()=>{if(s===Ce&&M(),m&&i!=="success"){g("success"),a(Ce,s);return}if(i==="success"){a(Ce,s);return}if(s===Ce&&i==="idle"&&!_optionalChain([C, 'optionalAccess', _92 => _92.id])){g("refreshingQuote"),D();return}if(s===Ce&&i==="idle"&&E&&!x.current&&!O){let S=_optionalChain([C, 'optionalAccess', _93 => _93.id])||null;S&&f.current!==S&&(f.current=S,H())}},[m,s,i,E,O,H,a,_optionalChain([C, 'optionalAccess', _94 => _94.id]),D,M]),_react.useEffect.call(void 0, ()=>{i==="refreshingQuote"&&_optionalChain([C, 'optionalAccess', _95 => _95.id])&&g("idle")},[i,_optionalChain([C, 'optionalAccess', _96 => _96.id])]),_react.useEffect.call(void 0, ()=>{s!==Ce&&(f.current=null)},[s]),_react.useEffect.call(void 0, ()=>{let S=setInterval(()=>{W()&&!x.current&&i!=="submitting"&&i!=="success"&&g("stale")},1e3);return()=>clearInterval(S)},[W,i]);let te=()=>{i==="error"&&!x.current&&(f.current=null,g("idle"))},U=_react.useCallback.call(void 0, ()=>{f.current=null,g("refreshingQuote"),D()},[D]),T=_react.useCallback.call(void 0, ()=>{o?o(!0):v()},[o,v]),_=()=>i==="error"?"Retry swap":i==="signing"?"Sign Swap Order":i==="submitting"?"Submitting...":i==="refreshingQuote"?"Refreshing Quote...":i==="stale"?"Quote Stale":"Sign & Submit",Q=!m&&(i==="error"||i==="stale"),G=Q?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-sans font-medium transition duration-150 ${Q?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${G} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${G} 20%, transparent)`,color:G,borderRadius:"var(--widget-radius)"},onClick:!m&&i==="error"?te:i==="stale"?T:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:e,size:"xs",noChain:!0}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:_()}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),$>0&&i!=="success"&&i!=="error"&&i!=="stale"&&_jsxruntime.jsx.call(void 0, fr,{startTime:$,onExpired:()=>g("stale")}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!m&&(i==="idle"||i==="signing"||i==="submitting"||i==="refreshingQuote")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),(m||i==="success")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-8 w-8"}),!m&&(i==="error"||i==="stale")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.S,{className:"h-[12px] w-[12px]"})]})]})}),!m&&(i==="error"||i==="stale")&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:v,children:"Cancel"})]})},wr=Vn;var Fn=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),_n="trackingTx",hr={pending:{icon:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),buttonText:"Trade Pending",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},received:{icon:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),buttonText:"Trade Received",showNewSwap:!1,statusVar:"var(--widget-primary)",clickable:!1},completed:{icon:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-5 w-5"}),buttonText:"View Transaction",showNewSwap:!1,statusVar:"var(--widget-status-completed)",clickable:!0},failed:{icon:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.Y,{}),buttonText:"Retry Swap",showNewSwap:!0,statusVar:"var(--widget-status-failed)",clickable:!0},cancelled:{icon:_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.Y,{}),buttonText:"View Transaction",showNewSwap:!1,statusVar:"var(--widget-status-failed)",clickable:!0}},Bn=({orderHash:e,base:t,quote:n,baseAmount:c,quoteAmount:l,reviewState:s,onNewSwap:a,onRetry:v,status:p})=>{let d=_chunkK3RTTHBScjs.r.call(void 0, _n,s),o=hr[p]||hr.pending,r=_chunkD7GULMHEcjs.d.call(void 0, u=>u.explorerUrl);_react.useEffect.call(void 0, ()=>{if(p==="completed"){let u=setTimeout(a,15e3);return()=>clearTimeout(u)}},[p,a]);let y=()=>{p==="failed"?v():(p==="completed"||p==="cancelled")&&r&&window.open(r,"_blank","noopener,noreferrer")},w=o.statusVar;return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-row justify-between space-x-3 w-full px-4",children:_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-sans font-medium transition duration-150 ${o.clickable?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${w} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${w} 20%, transparent)`,color:w,borderRadius:"var(--widget-radius)"},onClick:o.clickable?y:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex h-6 w-6 items-center justify-center rounded-full overflow-hidden shrink-0",children:o.icon}),_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:o.buttonText}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),o.clickable&&_jsxruntime.jsx.call(void 0, "div",{className:"flex h-6 w-6 items-center justify-center",children:p==="failed"?_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.X,{}):_jsxruntime.jsx.call(void 0, Fn,{})})]})})})},vr=Bn;var Hn=15e3,et="unwrapping",Gn=({needsToUnwrap:e,amount:t,chainId:n,token:c,reviewState:l,setReviewState:s,goToNextStep:a,cancel:v,delayedClose:p})=>{let d=_chunkK3RTTHBScjs.r.call(void 0, et,l),[o,r]=_react.useState.call(void 0, "idle"),y=nr(),{writeContractAsync:w}=_wagmi.useWriteContract.call(void 0, ),{address:u}=_chunk34N36GUDcjs.a.call(void 0, ),h=Me(),m=_react.useRef.call(void 0, !1),i=_react.useRef.call(void 0, !1),g=_react.useRef.call(void 0, null),{status:x}=_wagmi.useAccount.call(void 0, ),f=_react.useCallback.call(void 0, ()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),k=_react.useCallback.call(void 0, async()=>{if(!(m.current||i.current||!u||x!=="connected")){m.current=!0,i.current=!0,r("pending"),g.current=setTimeout(()=>{m.current&&(r("error"),m.current=!1)},Hn);try{let E=_chunkK3RTTHBScjs.c.call(void 0, n);if(!E)throw new Error(`No config for chain ${n}`);let I=_nullishCoalesce(E.wrappedAsset.decimals, () => (E.nativeAsset.decimals)),P=_viem.parseUnits.call(void 0, t.toString(),I);await y.mutateAsync({chainId:n,accountAddress:u,amountRaw:P,writeContractAsync:w});let $={symbol:E.nativeAsset.symbol,name:E.nativeAsset.name,address:_chunkK3RTTHBScjs.a,decimals:E.nativeAsset.decimals,chainId:n},W={symbol:E.wrappedAsset.symbol,name:E.wrappedAsset.name,address:E.wrappedAsset.address,decimals:E.wrappedAsset.decimals,chainId:n};h({type:"unwrap",tokens:[{asset:$,userAddress:u},{asset:W,userAddress:u}]}),f(),r("success"),a(et,l),await p()}catch (e8){f(),r("error")}finally{m.current=!1}}},[u,x,n,t,y,w,h,a,l,p,f]);_react.useEffect.call(void 0, ()=>{m.current||i.current||l===et&&o==="idle"&&x==="connected"&&(e?k():(r("success"),a(et,l)))},[l,o,e,x,k,a]),_react.useEffect.call(void 0, ()=>()=>f(),[f]);let O=()=>{o==="error"&&(i.current=!1,r("idle"))},C=!d&&o==="error",M=!d&&(o==="pending"||o==="idle"||o==="error"),D=C?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-sans font-medium transition duration-150 ${C?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${D} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${D} 20%, transparent)`,color:D,borderRadius:"var(--widget-radius)"},onClick:C?O:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:C?"Retry Unwrap":c?`Unwrap ${c.symbol}`:"Unwrap Native Token"}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!d&&(o==="pending"||o==="idle")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),(d||o==="success")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-8 w-8"}),C&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.S,{className:"h-[12px] w-[12px]"})]})]})}),M&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:v,children:"Cancel"})]})},Cr=Gn;var Zn=15e3,tt="wrapping",es=({needsToWrap:e,amount:t,chainId:n,token:c,reviewState:l,setReviewState:s,goToNextStep:a,cancel:v,delayedClose:p,isWrappingPair:d})=>{let o=_chunkK3RTTHBScjs.r.call(void 0, tt,l),[r,y]=_react.useState.call(void 0, "idle"),w=sr(),{writeContractAsync:u}=_wagmi.useWriteContract.call(void 0, ),{address:h}=_chunk34N36GUDcjs.a.call(void 0, ),m=Me(),i=_react.useRef.call(void 0, !1),g=_react.useRef.call(void 0, !1),x=_react.useRef.call(void 0, null),{status:f}=_wagmi.useAccount.call(void 0, ),k=_react.useCallback.call(void 0, ()=>{x.current&&(clearTimeout(x.current),x.current=null)},[]),O=_react.useCallback.call(void 0, async()=>{if(!(i.current||g.current||!h||f!=="connected")){i.current=!0,g.current=!0,y("pending"),x.current=setTimeout(()=>{i.current&&(y("error"),i.current=!1)},Zn);try{let I=_chunkK3RTTHBScjs.c.call(void 0, n);if(!I)throw new Error(`No config for chain ${n}`);let P=_viem.parseUnits.call(void 0, t.toString(),I.nativeAsset.decimals);await w.mutateAsync({chainId:n,accountAddress:h,amountRaw:P,writeContractAsync:u});let $={symbol:I.nativeAsset.symbol,name:I.nativeAsset.name,address:_chunkK3RTTHBScjs.a,decimals:I.nativeAsset.decimals,chainId:n},W={symbol:I.wrappedAsset.symbol,name:I.wrappedAsset.name,address:I.wrappedAsset.address,decimals:I.wrappedAsset.decimals,chainId:n};m({type:"wrap",tokens:[{asset:$,userAddress:h},{asset:W,userAddress:h}]}),k(),y("success"),a(tt,l),d&&await p()}catch (e9){k(),y("error")}finally{i.current=!1}}},[h,f,n,t,w,u,m,a,l,p,d,k]);_react.useEffect.call(void 0, ()=>{i.current||g.current||l===tt&&r==="idle"&&f==="connected"&&(e?O():(y("success"),a(tt,l)))},[l,r,e,f,O,a]),_react.useEffect.call(void 0, ()=>()=>k(),[k]);let C=()=>{r==="error"&&(g.current=!1,y("idle"))},M=!o&&r==="error",D=!o&&(r==="pending"||r==="idle"||r==="error"),E=M?"var(--widget-status-failed)":"var(--widget-primary)";return _jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full flex-row justify-between space-x-3",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:`inline-flex h-12 w-full items-center justify-center text-sm font-sans font-medium transition duration-150 ${M?"cursor-pointer":"cursor-not-allowed"}`,style:{backgroundColor:`color-mix(in srgb, ${E} 12%, transparent)`,border:`1px solid color-mix(in srgb, ${E} 20%, transparent)`,color:E,borderRadius:"var(--widget-radius)"},onClick:M?C:void 0,children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-10 w-full flex-row items-center space-x-3 px-4",children:[_jsxruntime.jsx.call(void 0, "p",{className:"whitespace-nowrap",children:M?"Retry Wrap":c?`Wrap ${c.symbol}`:"Wrap Native Token"}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-1 border-t",style:{borderColor:"var(--widget-border)"}}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex h-6 w-3 items-center justify-center rounded-full",children:[!o&&(r==="pending"||r==="idle")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5"}),(o||r==="success")&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-8 w-8"}),M&&_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.S,{className:"h-[12px] w-[12px]"})]})]})}),D&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"inline-flex h-12 items-center justify-center px-8 text-sm font-sans font-medium transition duration-150 cursor-pointer",style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 12%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",color:"var(--widget-status-failed)",borderRadius:"var(--widget-radius)"},onClick:v,children:"Cancel"})]})},Rr=es;var Ha=({base:e,baseAmount:t,quote:n,quoteAmount:c,userAddress:l,isWrappingPair:s,isUnwrappingPair:a,isBaseGasToken:v,isQuoteGasToken:p,reviewActionProps:d,reviewState:o,setReviewState:r,trackedOrderHash:y,setTrackedOrderHash:w,txStatus:u,onSwapSubmitted:h,onSwapComplete:m,onSwapInitiated:i,onOrderSubmitted:g,onStaleQuoteRestart:x,setExitHandler:f,setRetryHandler:k})=>{let{rfqQuote:O,status:C,liquidityError:M,routingError:D,sizeCapError:E,stop:I,clear:P}=ze(),{clearForm:$}=_chunkPSCWQFVYcjs.e.call(void 0, ),W=_wagmi.useChainId.call(void 0, ),{swapButtonVariant:H,widgetType:te}=_chunkD7GULMHEcjs.b.call(void 0, ),U=te==="compact",{trackOrderTransaction:T,trackNativeTransaction:_}=ar(),{startPolling:Q}=Ht((F,he,ve)=>{if(_chunkD7GULMHEcjs.d.getState().setTxStatus(he),ve&&_chunkD7GULMHEcjs.d.getState().setExplorerUrl(ve),he==="completed"&&(T(F,`Swap ${e.symbol} \u2192 ${n.symbol}`),ve)){let rt=_e(ve);rt&&fetch(`https://api.aori.io/data/details/${rt}`).then(nt=>nt.json()).then(nt=>_optionalChain([m, 'optionalCall', _97 => _97({quoteId:F,aoriOrderHash:rt,explorerUrl:ve,details:nt})])).catch(()=>{})}}),[G,S]=_react.useState.call(void 0, !1),R=_react.useRef.call(void 0, !1),L=_react.useRef.call(void 0, null),N=s,B=a,J=!s&&!a,we=W!==_optionalChain([e, 'optionalAccess', _98 => _98.chainId])&&(N||B||J),Se=_chunkK3RTTHBScjs.c.call(void 0, e.chainId),K={chainId:e.chainId,name:_nullishCoalesce(_optionalChain([Se, 'optionalAccess', _99 => _99.displayName]), () => (`Chain ${e.chainId}`))},ie=_react.useCallback.call(void 0, (F,he)=>{if(he!==F)return;if(F==="chain"){if(N){r("wrapping");return}if(B){r("unwrapping");return}r("signingOrder");return}if(F==="signingOrder"){r("trackingTx");return}if(F==="wrapping"){if(!s){r("signingOrder");return}r("wrapSuccess");return}if(F==="unwrapping"){r("wrapSuccess");return}let ve=_chunkK3RTTHBScjs.s.call(void 0, F);ve&&r(ve)},[r,s,N,B,J]),ne=_react.useCallback.call(void 0, ()=>we?"chain":N?"wrapping":B?"unwrapping":J?"signingOrder":null,[we,N,B,J]),ce=_react.useCallback.call(void 0, ()=>{r(null),$()},[$,r]),le=_react.useCallback.call(void 0, async()=>{r("wrapSuccess");for(let F=0;F<3;F++)await _chunkK3RTTHBScjs.t.call(void 0, 700);ce()},[ce,r]),ue=_react.useCallback.call(void 0, async()=>{P(),r("cancelled");for(let F=0;F<3;F++)await _chunkK3RTTHBScjs.t.call(void 0, 500);ce()},[P,ce,r]),Te=_react.useCallback.call(void 0, ()=>{y&&(_chunkD7GULMHEcjs.d.getState().stopTracking(),r(null),w(null),$())},[y,r,w,$]),de=_react.useCallback.call(void 0, ()=>{r(null),w(null),R.current=!0,_optionalChain([x, 'optionalCall', _100 => _100()])},[r,w,x]),Ve=_react.useCallback.call(void 0, ()=>{d&&r(ne())},[ne,d,r]),kt=_react.useCallback.call(void 0, (F=!1)=>{F?(R.current=!0,r(null),_optionalChain([x, 'optionalCall', _101 => _101()])):(r(null),L.current=setTimeout(()=>{d&&(r(ne()),S(!1))},100))},[r,d,ne,x]);_react.useEffect.call(void 0, ()=>{o!==null&&I()},[o,I]),_react.useEffect.call(void 0, ()=>{o!==null&&G&&S(!1)},[o,G]),_react.useEffect.call(void 0, ()=>{_optionalChain([f, 'optionalCall', _102 => _102(Te)])},[f,Te]),_react.useEffect.call(void 0, ()=>(_chunkD7GULMHEcjs.d.getState().setExitHandler(Te),()=>_chunkD7GULMHEcjs.d.getState().setExitHandler(null)),[Te]),_react.useEffect.call(void 0, ()=>{_optionalChain([k, 'optionalCall', _103 => _103(de)])},[k,de]),_react.useEffect.call(void 0, ()=>()=>{L.current&&clearTimeout(L.current)},[]),_react.useEffect.call(void 0, ()=>{R.current&&C==="fresh"&&_optionalChain([O, 'optionalAccess', _104 => _104.id])&&(R.current=!1,r("signingOrder"))},[C,_optionalChain([O, 'optionalAccess', _105 => _105.id]),r]);let Ee=F=>{if(!F)return{backgroundColor:H==="default"?"var(--widget-muted)":"transparent",color:"var(--widget-muted-foreground)",border:H!=="default"?"1px solid var(--widget-border)":"none",borderRadius:"var(--widget-radius)"};switch(H){case"outline":return{backgroundColor:"transparent",color:"var(--widget-primary)",border:"1px solid var(--widget-primary)",borderRadius:"var(--widget-radius)"};case"ghost":return{backgroundColor:"transparent",color:"var(--widget-primary)",border:"none",borderRadius:"var(--widget-radius)"};default:return{backgroundColor:"var(--widget-primary)",color:"var(--widget-primary-foreground)",borderRadius:"var(--widget-radius)"}}},Be=`w-full ${U?"py-2":"py-3"} text-sm font-sans font-medium transition-colors cursor-pointer mt-1`;if(o===null&&!s&&!a){if(G)return _jsxruntime.jsx.call(void 0, "button",{className:Be,disabled:!0,style:{...Ee(!1),opacity:.6,cursor:"not-allowed"},children:"Getting fresh quote..."});let F=()=>M?"Insufficient Liquidity":D?"Route Not Available":E?"Size Cap Exceeded":!O&&C==="polling"?"Getting Quote...":O?"Swap":"Enter Amount",he=!!d;return _jsxruntime.jsx.call(void 0, "button",{onClick:he?Ve:void 0,disabled:!he,className:`${Be} disabled:opacity-40 disabled:cursor-not-allowed`,style:Ee(he),children:F()})}return o===null&&a?_jsxruntime.jsx.call(void 0, "button",{onClick:d?Ve:void 0,disabled:!d,className:`${Be} disabled:opacity-40 disabled:cursor-not-allowed`,style:Ee(!!d),children:"Unwrap"}):o===null&&s?_jsxruntime.jsx.call(void 0, "button",{onClick:d?Ve:void 0,disabled:!d,className:`${Be} disabled:opacity-40 disabled:cursor-not-allowed`,style:Ee(!!d),children:"Wrap"}):o==="success"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{className:`w-full ${U?"py-2":"py-3"} text-sm font-sans font-medium cursor-default`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-completed) 15%, transparent)",color:"var(--widget-status-completed)",border:"1px solid color-mix(in srgb, var(--widget-status-completed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:"Order Placed"})}):o==="wrapSuccess"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{className:`w-full ${U?"py-2":"py-3"} text-sm font-sans font-medium cursor-default`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-completed) 15%, transparent)",color:"var(--widget-status-completed)",border:"1px solid color-mix(in srgb, var(--widget-status-completed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:s?"Wrapped Successfully":"Unwrapped Successfully"})}):o==="cancelled"?_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2 w-full",children:_jsxruntime.jsx.call(void 0, "button",{onClick:ce,className:`w-full ${U?"py-2":"py-3"} text-sm font-sans font-medium cursor-pointer`,style:{backgroundColor:"color-mix(in srgb, var(--widget-status-failed) 15%, transparent)",color:"var(--widget-status-failed)",border:"1px solid color-mix(in srgb, var(--widget-status-failed) 20%, transparent)",borderRadius:"var(--widget-radius)"},children:"Order Cancelled"})}):_jsxruntime.jsxs.call(void 0, "div",{className:"flex w-full",children:[o==="chain"&&we&&_jsxruntime.jsx.call(void 0, lr,{requiredChain:K,needsChainSwitch:we&&W!==e.chainId,reviewState:o,goToNextStep:ie,cancel:ue}),o==="wrapping"&&N&&_jsxruntime.jsx.call(void 0, Rr,{needsToWrap:N,amount:t,chainId:e.chainId,token:e,reviewState:o,setReviewState:r,goToNextStep:ie,cancel:ue,delayedClose:le,isWrappingPair:s}),o==="unwrapping"&&B&&_jsxruntime.jsx.call(void 0, Cr,{needsToUnwrap:B,amount:t,chainId:e.chainId,token:e,reviewState:o,setReviewState:r,goToNextStep:ie,cancel:ue,delayedClose:le}),o==="signingOrder"&&J&&_jsxruntime.jsx.call(void 0, wr,{base:e,baseAmount:t,quote:n,quoteAmount:c,userAddress:l,reviewState:o,goToNextStep:ie,cancel:ue,restartSigningFlow:kt,onSwapInitiated:i,onOrderSubmitted:g,isWrappingPair:s,isUnwrappingPair:a,onSwapSubmitted:h,startPolling:Q,trackNativeTransaction:_}),o==="trackingTx"&&y&&_jsxruntime.jsx.call(void 0, vr,{orderHash:y,base:e,quote:n,baseAmount:t,quoteAmount:c,reviewState:o,status:u,onNewSwap:Te,onRetry:de}),o&&!["chain","wrapping","unwrapping","approval","signingOrder","trackingTx","success","wrapSuccess","cancelled"].includes(o)&&_jsxruntime.jsx.call(void 0, "button",{disabled:!0,className:`w-full ${U?"py-2":"py-3"} text-sm font-sans font-medium`,style:{backgroundColor:"var(--widget-muted)",color:"var(--widget-muted-foreground)",borderRadius:"var(--widget-radius)"},children:"Processing..."})]})};var _shallow = require('zustand/react/shallow');var kr={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)"},as=({status:e})=>{let t=_nullishCoalesce(kr[e], () => (kr.pending));switch(e){case"completed":return _jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.P,{className:"h-6 w-6"});case"failed":case"cancelled":return _jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.Y,{className:"h-6 w-6"});default:return _jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.V,{size:"5",color:t})}};function is(e){if(e===0)return"0";let t=Math.abs(e);return t>=1e4?e.toFixed(0):t>=1e3?e.toFixed(1):t>=100?e.toFixed(2):t>=1?e.toFixed(4):t>=.01?e.toFixed(6):e.toExponential(3)}function Nr(e){let t=e.length;return t<=4?48:t<=6?40:t<=8?34:28}var At=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",style:{color:"var(--widget-secondary-foreground)"},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 13V19C18 20.1046 17.1046 21 16 21H5C3.89543 21 3 20.1046 3 19V8C3 6.89543 3.89543 6 5 6H11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M10 14L21 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),cs=()=>_jsxruntime.jsxs.call(void 0, "svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 195 321",fill:"var(--widget-secondary-foreground)",xmlns:"http://www.w3.org/2000/svg",children:[_jsxruntime.jsx.call(void 0, "path",{fillRule:"evenodd",d:"M195,189C195,207.02,195,225.04,194.7,243.21C193.68,244.78,192.9,246.17,192.25,247.63C189.71,253.38,187.74,259.46,184.6,264.86C169.44,290.97,147.86,309.46,118.54,318.86C116.44,319.55,114.72,320.27,113,321C97.65,321,82.29,321,66.36,320.66C64.21,319.86,62.64,319.4,60.77,318.73C34.51,310.12,15.56,293.82,4.22,268.85C3.68,267.66,2.1,266.94,1,266C1,242.31,1,218.62,1.29,194.79C2.84,192.16,4.11,189.7,5.34,187.22C18.42,160.94,39.89,144.07,66.64,133.63C76.92,129.62,87.87,127.33,98.67,124.2C97.79,123.24,96.8,121.93,95.59,120.86C85.84,112.3,75.95,103.89,66.3,95.21C55.93,85.86,45.02,76.96,35.71,66.63C21.14,50.5,20.04,23.08,45.41,9.57C50.08,7.08,55.12,5.26,59.93,3.03C60.76,2.64,61.32,1.69,62,1C86.69,1,111.38,1,136.23,1.32C138.04,2.32,139.67,3.01,141.32,3.67C147.64,6.19,154.12,8.39,160.26,11.32C166.83,14.45,172.19,19.18,175.44,25.95C179.39,34.19,178.09,43.36,172.05,49.56C165.75,56.03,157.21,57.8,148.78,52.89C142.4,49.17,136.86,43.96,131.1,39.23C122.63,32.28,115.05,23.88,105.74,18.38C87.78,7.76,68.84,9.07,51.16,19.53C38.68,26.91,36.37,41.4,45.53,52.71C50.38,58.69,56.45,64,62.83,68.36C87.15,84.99,111.86,101.05,136.34,117.44C162.56,135,183.88,156.57,193.26,187.79C193.42,188.32,194.4,188.6,195,189ZM77.06,146.49C61.39,155.71,51.27,169.26,45.93,186.5C39.48,207.32,39.44,228.5,42.93,249.76C45.84,267.48,53.16,282.95,66.59,295.39C83.82,311.34,108.85,312.86,127.37,298.41C138.98,289.35,146.05,277.03,149.48,263.04C161.53,213.92,148.4,171.97,112.16,137.05C111.13,136.06,108.71,135.6,107.31,136.05C97.38,139.22,87.54,142.7,77.06,146.49Z"}),_jsxruntime.jsx.call(void 0, "path",{d:"M118.83,199C121.61,197.69,122.77,198.41,122.77,201.27C122.71,217.43,122.78,233.58,122.65,249.73C122.65,250.83,121.43,251.92,120.77,253.01C119.97,252.05,118.63,251.17,118.45,250.1C116.32,237.7,113.36,235.12,100.61,235.02C98.12,235,95.62,234.98,93.12,235.01C81.26,235.16,77.72,238.3,75.94,249.84C75.74,251.15,74.39,252.28,73.57,253.49C73.11,253.23,72.64,252.98,72.17,252.73C72.17,234.81,72.17,216.88,72.17,198.96C72.49,198.62,72.81,198.28,73.13,197.93C74.09,198.95,75.72,199.85,75.92,201C78.13,213.8,80.95,216.26,94.05,216.3C97.38,216.31,100.72,216.44,104.04,216.27C113.28,215.79,117.15,212.05,118.22,202.81C118.35,201.65,118.47,200.49,118.83,199Z"})]}),ls=({orderHash:e,base:t,quote:n,baseAmount:c,quoteAmount:l,status:s})=>{let[a,v]=_react.useState.call(void 0, !1),[p,d]=_react.useState.call(void 0, !0),o=_react.useRef.call(void 0, null),r=_react.useRef.call(void 0, Date.now()),[y,w]=_react.useState.call(void 0, null),u=_react.useRef.call(void 0, null),{isRecipientInputOpen:h,recipient:m,explorerUrl:i}=_chunkD7GULMHEcjs.d.call(void 0, _shallow.useShallow.call(void 0, T=>({isRecipientInputOpen:T.isRecipientInputOpen,recipient:T.recipient,explorerUrl:T.explorerUrl})));_react.useEffect.call(void 0, ()=>{s==="received"&&(o.current=Date.now())},[s]),_react.useEffect.call(void 0, ()=>{if(s==="completed"&&!y){let T=o.current||r.current;w((Date.now()-T)/1e3)}},[s,y]),_react.useEffect.call(void 0, ()=>()=>{u.current&&clearTimeout(u.current)},[]);let g=_react.useCallback.call(void 0, ()=>{if(!_optionalChain([navigator, 'access', _106 => _106.clipboard, 'optionalAccess', _107 => _107.writeText]))return;let T=i?_nullishCoalesce(_e(i), () => (e)):e;navigator.clipboard.writeText(T).then(()=>{v(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>v(!1),2e3)}).catch(()=>{})},[e,i]),x=_chunkK3RTTHBScjs.o.call(void 0, c),f=_chunkK3RTTHBScjs.o.call(void 0, l),k=s==="completed"||s==="failed"||s==="cancelled",O=!k,C=c&&l?c/l:0,M=_chunkK3RTTHBScjs.c.call(void 0, t.chainId),D=_chunkK3RTTHBScjs.c.call(void 0, n.chainId),E=_nullishCoalesce(_optionalChain([M, 'optionalAccess', _108 => _108.displayName]), () => (`Chain ${t.chainId}`)),I=_nullishCoalesce(_optionalChain([D, 'optionalAccess', _109 => _109.displayName]), () => (`Chain ${n.chainId}`)),P=t.chainId!==n.chainId,$=_nullishCoalesce(_optionalChain([M, 'optionalAccess', _110 => _110.estimatedTimeMs]), () => (0)),W=_nullishCoalesce(_optionalChain([D, 'optionalAccess', _111 => _111.estimatedTimeMs]), () => (0)),H=(P?$+W:$)/1e3,te=i?_nullishCoalesce(_e(i), () => (e)):e,U=`${te.slice(0,6)} \u2026 ${te.slice(-4)}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"relative w-full flex flex-col",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"mx-4 mt-2",style:{backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"p-5",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 mb-3",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:t,size:"md",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-thin uppercase",style:{color:"var(--widget-foreground)"},children:t.symbol}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:t.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1",style:{backgroundColor:"color-mix(in srgb, var(--widget-muted-foreground) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-muted-foreground) 30%, transparent)"},children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.N,{chain:t.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-muted-foreground)"},children:E})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-thin tracking-tight font-sans",style:{color:"var(--widget-foreground)",fontSize:`${Nr(x)}px`,transition:"font-size 0.1s ease-out"},children:x}),t.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 font-sans",style:{color:"var(--widget-muted-foreground)"},children:["$",(t.price*c).toFixed(2)]})]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative",children:[_jsxruntime.jsx.call(void 0, "div",{style:{borderTop:"1px solid var(--widget-border)"}}),_jsxruntime.jsx.call(void 0, "div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:_jsxruntime.jsx.call(void 0, "div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--widget-secondary)",border:"1px solid var(--widget-border)"},children:_jsxruntime.jsx.call(void 0, as,{status:s})})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"p-5",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-3 mb-3",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:n,size:"md",noChain:!0}),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-xl font-thin uppercase",style:{color:"var(--widget-foreground)"},children:n.symbol}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:n.name})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1",style:{backgroundColor:"color-mix(in srgb, var(--widget-muted-foreground) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--widget-muted-foreground) 30%, transparent)"},children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.N,{chain:n.chainId,size:"xs"}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs pt-0.5",style:{color:"var(--widget-muted-foreground)"},children:I})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"text-right",children:[_jsxruntime.jsx.call(void 0, "p",{className:"font-thin tracking-tight font-sans",style:{color:"var(--widget-foreground)",fontSize:`${Nr(f)}px`,transition:"font-size 0.1s ease-out"},children:f}),n.price&&_jsxruntime.jsxs.call(void 0, "p",{className:"text-xs mt-1 font-sans",style:{color:"var(--widget-muted-foreground)"},children:["$",(n.price*l).toFixed(2)]})]})]})})]}),h&&m&&_jsxruntime.jsx.call(void 0, "div",{className:"mx-4 mt-2 px-5 pb-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center gap-2 p-2 rounded-full",style:{backgroundColor:"var(--widget-secondary)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex h-5 w-5 items-center justify-center overflow-hidden rounded-full",style:{backgroundColor:"var(--widget-muted)"},children:_jsxruntime.jsx.call(void 0, "span",{className:"text-2xs",children:"\u{1F464}"})}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"To:"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs font-sans",style:{color:"var(--widget-foreground)"},children:[m.slice(0,6),"...",m.slice(-4)]})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"px-4 mt-4",style:{borderTop:"1px solid var(--widget-border)",borderBottom:"1px solid var(--widget-border)"},children:[_jsxruntime.jsx.call(void 0, "div",{className:"relative box-border flex flex-row h-8 w-full items-center cursor-pointer",role:"button",tabIndex:0,onClick:()=>d(!p),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(!p))},children:_jsxruntime.jsx.call(void 0, "div",{className:"flex h-full items-center w-full overflow-hidden",style:{color:"var(--widget-muted-foreground)"},children:_jsxruntime.jsxs.call(void 0, "div",{className:"translate-y-px font-sans flex w-full flex-row items-center justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-2 whitespace-nowrap",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:n,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:["1 ",n.symbol]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:"="}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-row items-center gap-1",children:[_jsxruntime.jsx.call(void 0, _chunkK3RTTHBScjs.O,{asset:t,size:"3xs",noChain:!0,className:"mb-0.5"}),_jsxruntime.jsxs.call(void 0, "span",{className:"text-xs uppercase",style:{color:"var(--widget-muted-foreground)"},children:[is(C)," ",t.symbol]})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs",style:{color:"var(--widget-muted-foreground)"},children:t.price?`\u2248 $${(t.price*C).toFixed(2)}`:""})]}),_jsxruntime.jsx.call(void 0, "span",{className:"text-xs ml-2 transition-transform duration-200 shrink-0",style:{color:"var(--widget-muted-foreground)",transform:p?"rotate(180deg)":"rotate(0deg)",display:"inline-block"},children:"\u25BE"})]})})}),_jsxruntime.jsx.call(void 0, "div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:p?"200px":"0px",opacity:p?1:0},children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-1 pb-1.5 font-sans",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"USD Value"}),_jsxruntime.jsxs.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:["$",t.price?(t.price*c).toFixed(2):"\u2014"]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-muted-foreground)"},children:"Order Type"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:"RFQ (Limit)"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Transaction"}),i?_jsxruntime.jsxs.call(void 0, "a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:a?"Copied!":U}),_jsxruntime.jsx.call(void 0, At,{})]}):_jsxruntime.jsxs.call(void 0, "button",{type:"button",onClick:g,className:"flex items-center gap-1 cursor-pointer transition-colors",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:a?"Copied!":U}),_jsxruntime.jsx.call(void 0, At,{})]})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:k?"Speed":"Est. Time"}),_jsxruntime.jsx.call(void 0, "span",{style:{color:"var(--widget-secondary-foreground)"},children:y?`${y.toFixed(2)}s`:H>0?`~${H}s`:"\u2014"})]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between items-center text-2xs",style:{color:"var(--widget-muted-foreground)"},children:[_jsxruntime.jsx.call(void 0, "span",{children:"Route"}),_jsxruntime.jsxs.call(void 0, "a",{href:"https://www.aori.io",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:opacity-80",style:{color:"var(--widget-secondary-foreground)"},children:[_jsxruntime.jsx.call(void 0, cs,{}),"Aori",_jsxruntime.jsx.call(void 0, At,{})]})]})]})})]})]})},ri= exports.y =ls;exports.a = Ur; exports.b = Me; exports.c = gs; exports.d = Ss; exports.e = ze; exports.f = Hr; exports.g = ks; exports.h = $s; exports.i = Ws; exports.j = js; exports.k = Ks; exports.l = zt; exports.m = Ht; exports.n = _e; exports.o = Gt; exports.p = an; exports.q = Yt; exports.r = cn; exports.s = er; exports.t = tr; exports.u = rr; exports.v = nr; exports.w = sr; exports.x = Ha; exports.y = ri;