@tokenflight/swap 0.3.0-rc.2 → 0.3.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{C as e,S as t,a as n,b as r,c as i,h as a,l as o,m as s,o as c,p as l,s as u,u as d,v as f,x as p}from"./solid-iWr5Czxc.js";import{i as m,n as h,s as ee,t as g}from"./errors-DXq77OyE.js";import{c as _,d as te,g as ne,h as v,l as y,m as re,n as ie,o as b,s as x,t as S}from"./shared.module-2EeBIMep.js";import{A as C,C as ae,D as w,E as oe,O as T,S as E,T as se,_ as D,b as ce,g as le,h as ue,i as de,j as O,k,l as fe,p as A,s as pe,t as me,w as he}from"./rank-offers-CiA9Nw2C.js";import{$ as j,A as ge,B as _e,C as ve,D as ye,E as be,F as xe,G as Se,H as Ce,I as we,K as Te,L as Ee,M as De,N as Oe,O as ke,P as Ae,Q as je,R as Me,S as M,T as Ne,U as Pe,W as Fe,X as Ie,Y as Le,a as Re,b as ze,c as Be,d as Ve,et as He,f as N,ft as Ue,g as We,gt as Ge,h as Ke,ht as qe,i as Je,it as Ye,j as Xe,l as Ze,lt as Qe,m as $e,n as et,nt as tt,o as nt,pt as rt,q as it,r as P,rt as at,s as ot,t as st,tt as ct,u as lt,v as ut,w as dt,x as ft,z as pt}from"./usePageRouter-BUKTv1jC.js";var mt=1.05;function ht(e,t){let n=e.chainId===t.chainId,r=w(e.symbol,t.symbol),i=C(e.symbol,t.symbol),a=O(e.symbol),o=O(t.symbol),s=T(e.symbol);return n&&r?1:r?2:i||a&&o?n?3:4:a&&!o?5:s?6:n?7:8}function gt(e){return+!!se.has(e)}function _t(e){let t=new Map;for(let n of e){if(!k(n.address))continue;let e=n.extensions?.balance??`0`;if(e===`0`)continue;let r=Number(D(e,n.decimals)),i=Number(n.extensions?.price?.usd??`0`);if(i<=0)continue;let a=r*i,o=t.get(n.chainId)??0;t.set(n.chainId,o+a)}return t}function vt(e,t,n){return k(e)?!0:(n.get(t)??0)>=oe}function yt(e,t,n,r,i){if(e.length===0)return[];let a=_t(e),o={address:r,chainId:n},s=[];for(let r of e){if(E(r,o))continue;let e=r.extensions?.balance;if(!e||e===`0`)continue;let c=Number(r.extensions?.price?.usd??`0`);if(c<=0)continue;let l=Number(D(e,r.decimals))*c;if(l<1||i!==void 0&&l<i*mt||!vt(r.address,r.chainId,a))continue;let u=ht({symbol:r.symbol,chainId:r.chainId},{symbol:t,chainId:n});s.push({token:r,tier:u,gasCostScore:gt(r.chainId)})}return s.sort((e,t)=>e.tier===t.tier?e.gasCostScore-t.gasCostScore:e.tier-t.tier),s.map(e=>e.token)}function bt(e){let t=P();return{trackingOrderId:t.trackingOrderId,trackingProviderName:t.trackingProviderName,trackingProviderIcon:t.trackingProviderIcon,trackingInputAmount:t.trackingInputAmount,executionError:t.executionError,failedExecPhase:t.failedExecPhase,handleConfirm:async()=>{let n=e.selectedPayToken(),r=n?e.payTokenQuotes().find(e=>E(e.token,n)):null,i=e.walletAddress();if(!r||!e.client()||!e.walletAdapter()||!i)return;if(e.needRecipient()&&!e.recipient()){e.setError(`Recipient address is required for cross-chain swaps`),e.setErrorCode(g.INVALID_CONFIG);return}let a=r.route.quote.validBefore;if(a&&Date.now()/1e3>a){e.setLoadingQuotes(!0);try{let t=e.targetToken();if(!t||typeof t.decimals!=`number`)return;let n=le(e.configAmount(),t.decimals),a=await e.fetchSingleQuote(e.client(),r.token,n,i,t,e.recipient());if(a){let t=[...e.payTokenQuotes()],n=t.findIndex(e=>E(e.token,r.token));n>=0?t[n]=a:t.push(a),e.setPayTokenQuotes(t)}else{e.setError(`Quote expired and could not be refreshed`),e.setErrorCode(g.QUOTE_EXPIRED);return}}catch{e.setError(`Quote expired and could not be refreshed`),e.setErrorCode(g.QUOTE_EXPIRED);return}finally{e.setLoadingQuotes(!1)}}let o=e.selectedPayToken(),s=o?e.payTokenQuotes().find(e=>E(e.token,o)):null;if(!s)return;e.setFromToken({chainId:s.token.chainId,address:s.token.address,symbol:s.token.symbol,name:s.token.name,decimals:s.token.decimals,logoURI:s.token.logoURI}),t.setTrackingProviderName(s.route.routeId??null);let c=e.apiEndpoint()??`https://api.hyperstream.dev`;t.setTrackingProviderIcon(s.route.icon?`${c}${s.route.icon}`:null),t.setTrackingInputAmount(D(s.route.quote.amountIn,s.token.decimals)),t.setExecutionError(null),t.setFailedExecPhase(null),e.setExecPhase(`building`);try{let n=await e.client().buildDeposit({from:i,quoteId:s.quoteId,routeId:s.route.routeId});e.setExecPhase(`awaiting-wallet`);let r=await Je(e.walletAdapter(),n,s.token.chainId);e.setExecPhase(`submitting`);let a=await ot(e.client(),s.quoteId,s.route.routeId,r);e.setExecPhase(`tracking`),t.setTrackingOrderId(a.orderId)}catch(n){let r=Re(n,e.callbacks(),`deposit`);t.setExecutionError(r),t.setFailedExecPhase(e.execPhase())}},handleRetry:()=>{o(()=>{e.setExecPhase(null),e.storeClearError(),e.setPayTokenQuotes([])}),e.onRetry?.()},handleNewSwap:()=>{o(()=>{e.storeReset(),e.setPayTokenQuotes([])}),nt(t,e.client().baseUrl),e.onReset?.()}}}var F={header:`tf-9b71d6`,section:`tf-4c9136`,sectionLabel:`tf-febe61`,backArrowEnter:`tf-0d09cf`,backArrowPush:`tf-398c5c`,backTextEnter:`tf-2368bf`,backTextPush:`tf-86d030`,backArrowExit:`tf-b31fd2`,backTextExit:`tf-f55867`,methodHeaderOverlay:`tf-74b90d`,methodHeaderLabel:`tf-f366fb`,methodHeaderBackButton:`tf-9ab299`,methodPaneSpacer:`tf-e1e5bc`,methodPaneSpacerCrypto:`tf-fbab4f`,target:`tf-a27aab`,targetContent:`tf-d62361`,targetIcon:`tf-f0b3f5`,targetChainDot:`tf-7a6fbc`,amount:`tf-e9e9a1`,symbol:`tf-f3baad`,fiat:`tf-0131e4`,amountInput:`tf-e8980b`,amountInputShell:`tf-3d3253`,paySelected:`tf-81181d`,paySelectedLeft:`tf-a274dd`,payIconWrap:`tf-0039f9`,payChainDot:`tf-2ee752`,paySelectedInfo:`tf-96714d`,paySelectedTopRow:`tf-619747`,payTokenSymbol:`tf-cd221a`,payBestBadge:`tf-2c683f`,payTokenChain:`tf-c839a0`,paySelectedRight:`tf-0b0d52`,paySelectedAmount:`tf-19df0d`,paySelectedAmountUsd:`tf-c7d33a`,paySelectedCaret:`tf-e51789`,payAmountSkeleton:`tf-8a3107`,paySelectedSkeleton:`tf-e255df`,paySkeletonIcon:`tf-fb2771`,paySkeletonInfo:`tf-1b1e61`,paySkeletonLine:`tf-18dcca`,paySkeletonSymbol:`tf-a5c85b`,paySkeletonChain:`tf-12a725`,paySkeletonRight:`tf-df9ebb`,paySkeletonAmount:`tf-3547fa`,paySkeletonUsd:`tf-a46696`,payEmpty:`tf-1d40de`,payEmptyText:`tf-5d25d7`},xt=v(`<div data-height-transition-ignore=true>`),St=v(`<div part=container><div part=accent-line data-testid=accent-line>`),Ct=v(`<img height=22>`),wt=v(`<button part=wallet-info><div data-testid=wallet-dot></div><span data-testid=wallet-address>`),Tt=v(`<div part=header><div><div data-testid=header-brand data-header-brand-state=idle><span data-testid=header-title>`),Et=v(`<button part=recipient-badge data-testid=recipient-badge><span>`),Dt=v(`<div>`),Ot=v(`<div style=display:flex;align-items:center;gap:10px><div data-testid=receive-target-icon></div><div style=display:flex;align-items:center;gap:4px><div style=display:flex;flex-direction:column><span data-testid=receive-symbol></span><span style=font-size:var(--tf-font-sm);color:var(--tf-text-tertiary);line-height:16px>`),kt=v(`<div data-testid=receive-amount-shell><input type=number inputmode=decimal placeholder=0 data-testid=receive-amount-input style=text-align:right>`),At=v(`<div><div part=target-token><div data-testid=receive-section-label style=display:flex;justify-content:space-between;align-items:center><span></span></div><div style=justify-content:space-between><div style=display:flex;flex-direction:column;align-items:flex-end><span style=margin-left:0>`),jt=v(`<button data-testid=receive-method-back-button type=button><span></span><span>`),Mt=v(`<div style=flex:1;display:flex;flex-direction:column><div data-testid=receive-method-header>`),Nt=v(`<span>Flight`),Pt=v(`<button type=button style=display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;color:var(--tf-primary);font-size:var(--tf-font-lg);font-weight:600;font-family:var(--tf-font-family);padding:0>`),Ft=v(`<span data-testid=receive-amount>`),It=v(`<span data-testid=receive-method-label>`),Lt=v(`<div data-testid=receive-method-pane-spacer>`),Rt=v(`<div part=payment-list style="padding:0 20px">`),zt=v(`<div part=pay-token-error style="padding:8px 20px 0;color:var(--tf-error);font-size:var(--tf-font-xs)">`),Bt=v(`<div part=price-preview data-testid=quote>`),Vt=v(`<div style=min-height:186px;display:flex;flex-direction:column>`),Ht=v(`<button part=button-primary type=button>`),Ut=v(`<button disabled type=button><span><span>`),Wt=v(`<button disabled type=button style=opacity:0.6>`),Gt=v(`<div part=cta-wrapper style=margin-top:auto>`),Kt=v(`<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:186px;flex:1;gap:10px;margin:0 20px"><div><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><circle cx=8 cy=8 r=6></circle><path d="M18.09 10.37A6 6 0 1 1 10.34 18"></path><path d="M7 6h1v4"></path><path d="m16.71 13.88.7.71-2.82 2.82"></path></svg></div><span></span><span>`),qt=v(`<div style="padding:0 20px"><div><div><div></div><div><div></div><div></div></div></div><div><div></div><div>`),Jt=v(`<div><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=10></circle><path d="M12 6v6l4 2">`),Yt=v(`<span data-testid=pay-empty-text>`),Xt=v(`<div data-testid=pay-empty>`),Zt=v(`<div><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><rect x=1 y=5 width=22 height=16 rx=2></rect><path d="M16 14h.01"></path><path d="M1 10h22">`),Qt=v(`<span data-testid=recommended-badge>`),$t=v(`<button data-testid=pay-selected><div><div data-testid=pay-token-icon-wrap><div data-testid=pay-token-chain-dot></div></div><div><div><span data-testid=pay-token-symbol></span></div><span data-testid=pay-token-chain-name></span></div></div><div></div><span data-testid=pay-selected-caret>`),en=v(`<div data-testid=pay-selected-amount>`),tn=v(`<div part=no-offer><div><svg width=28 height=28 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><circle cx=11 cy=11 r=8></circle><path d="m21 21-4.35-4.35"></path><path d="M8 11h6"></path></svg></div><span>`);function nn(e){return d(N,{get children(){return d(rn,e)}})}function rn(v){let{t:C}=Ge(),w=We(),oe=Ge();e(()=>{v.config.locale&&oe.setLocale(v.config.locale)});let T=s(()=>v.config.methods??[`crypto`]),se=s(()=>T().includes(`crypto`)),O=s(()=>T().includes(`card`)),{page:k,setPage:Re,backExiting:N,handleBack:Je,onBackAnimEnd:nt}=st({methods:T}),P=Fe(),ot=s(()=>T().length>1&&k()!==`entry`),mt,ht=()=>{mt&&(clearTimeout(mt),mt=void 0)},gt=()=>{ht(),nt()},_t=()=>{ht(),mt=setTimeout(gt,260)};t(ht);let vt=e=>{let t=k();if(t===e)return;let n=$.begin(),r=()=>P.runForwardImmediate(t,e,()=>Re(e));if(n){$.scheduleCommit(r);return}r()},nn=()=>{if(!N()){if(ot()){let e=k(),t=$.begin();Je(),_t();let n=()=>P.runBackImmediate(e,`entry`,()=>Re(`entry`));if(t){$.scheduleCommit(n);return}n();return}Je()}},rn=()=>{gt()},[an,on]=f(v.config.amount??``),sn=()=>!!v.config.amountEditable,I=()=>sn()?an():v.config.amount??``,L=dt(),R=dt(),[cn,ln]=f(null),[un,dn]=f(null),[z,B]=f([]),[fn,V]=f(!1),[pn,mn]=f(!1),[hn,gn]=f(!1),[H,U]=f(null),[_n,vn]=f(null),[yn,W]=f(null),[bn,xn]=f(null),[Sn,Cn]=f(!1),wn=(e,t)=>{t instanceof HTMLElement&&e(t)},Tn=e=>{window.setTimeout(()=>{e?.isConnected&&e.focus()},300)},En=e=>{wn(ln,e),L.show()},Dn=()=>{L.hide(),Tn(cn())},On=e=>{wn(dn,e),R.show()},kn=()=>{R.hide(),Tn(un())},{isConnected:G,walletAddress:K,handleConnect:An}=Ve({walletAdapter:()=>v.walletAdapter,callbacks:()=>v.callbacks,onAddressChange:e=>w.setWalletAddress(e),onDisconnect:()=>{B([]),U(null),Cn(!1),vn(null),W(null)},onConnectError:(e,t)=>{w.setError(e),w.setErrorCode(t)}}),q=s(()=>new m({baseUrl:v.config.apiEndpoint??`https://api.hyperstream.dev`})),jn=()=>q().baseUrl,Mn=s(()=>O()?new ee({baseUrl:v.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`}):null),[Nn,Pn]=f(v.config.fiatCurrency??`USD`),Fn=s(()=>!!v.config.fiatCurrency),In=s(()=>{let e=w.recipient();if(e)return e;let t=w.targetToken(),n=K();return G()&&n&&t&&fe(n,pe(t.chainId))?n:null}),Ln=s(()=>{if(k()!==`card`)return null;let e=w.targetToken(),t=I();return!e||typeof e.decimals!=`number`||!t?null:le(t,e.decimals)}),J=et({client:Mn,targetToken:w.targetToken,recipient:In,fiatCurrency:()=>Nn(),callbacks:()=>v.callbacks,flowKind:`deposit`,cryptoAmount:Ln}),Rn=lt({phase:J.phase,onExpired:()=>J.refetchQuote(),intervalSeconds:30}),zn=Xe(Mn,()=>O()&&!Fn()),Bn=[`USD`,`EUR`,`GBP`,`JPY`,`KRW`,`CNY`,`AUD`,`CAD`,`INR`,`SGD`,`HKD`,`TWD`,`BRL`,`MXN`,`CHF`],Vn=s(()=>{let e=zn.data;if(!e?.providers?.length)return Bn;let t=new Set;for(let n of e.providers){let e=n.supportedCurrencies;if(Array.isArray(e))for(let n of e)typeof n==`string`?t.add(n):n&&typeof n.code==`string`&&t.add(n.code)}return t.size>0?[...t].sort():Bn}),Hn=s(()=>{let e=J.quote(),t=parseFloat(J.fiatAmount());return!e||!t?!1:!!(e.minFiatAmount&&t<parseFloat(String(e.minFiatAmount))||e.maxFiatAmount&&t>parseFloat(String(e.maxFiatAmount)))}),Un=s(()=>{let e=J.phase();return e===`awaiting-payment`||e===`tracking`}),Wn=s(()=>{let e=J.phase();return e===`creating-order`||e===`quoting`}),Gn=s(()=>{let e=J.phase();return e===`error`?C({id:`1w68n16`,message:`Try Again`})??`Try Again`:e===`creating-order`||e===`quoting`?C({id:`344av8`,message:`Processing...`}):e===`quoted`&&J.quote()?C({id:`13l4n4r`,message:`Continue via {provider}`},{provider:J.quote().providerName??it(J.quote().provider)}):C({id:`119fv83`,message:`Enter amount`})}),Kn=s(()=>J.phase()===`quoted`&&!!In()&&!Hn()&&!J.isQuoteFetching()),qn=()=>{let e=J.phase();e===`error`?J.handleRetry():e===`quoted`&&Kn()&&J.createOrder()},Y=s(()=>ut(w.execPhase(),w.error(),fn(),z().length)),Jn=s(()=>{let e=Y();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),Yn=s(()=>k()===`card`?`form`:Y()===`success`&&w.order()?`success`:Jn()?`tracking`:`form`),X=dt(),Xn=s(()=>!!v.config.recipient&&v.config.recipientEditable!==!0),{needRecipient:Zn,recipientDisplay:Qn,handleRecipientChange:$n}=Ze({fromToken:H,toToken:w.targetToken,recipient:w.recipient,isConnected:G,walletAddress:K,walletAdapter:()=>v.walletAdapter,setRecipient:w.setRecipient}),er=s(()=>v.config.fromTokens?.length?$e(v.config.fromTokens):void 0),tr=Oe(q,K,()=>G()&&!!K(),()=>v.walletAdapter?.supportedChainIds);e(()=>{v.config.recipient&&w.setRecipient(v.config.recipient)});let nr=ge(q,()=>!0),rr=s(()=>{let e=nr.data;return e?Ae(e):new Map});e(async()=>{let e=q();if(v.config.amount){let e=Number(v.config.amount);if(!Number.isFinite(e)||e<=0){w.setError(`Invalid amount: must be greater than zero`),w.setErrorCode(g.INVALID_AMOUNT);return}}try{if(v.config.target){let t=Ke(v.config.target),n=await ce(t.chainId,t.address,v.config.apiEndpoint,e);if(typeof n.decimals!=`number`){w.setError(`Failed to resolve target token metadata`),w.setErrorCode(g.INVALID_CONFIG);return}w.setTargetToken(n),v.config.amount&&w.setTargetAmount(v.config.amount)}if(v.config.fromToken)try{let t=Ke(v.config.fromToken),n=await ce(t.chainId,t.address,v.config.apiEndpoint,e);typeof n.decimals==`number`&&xn({address:n.address,chainId:n.chainId,symbol:n.symbol??n.address.slice(0,6),name:n.name??n.symbol??n.address,decimals:n.decimals,logoURI:n.logoURI,...n.priceUsd===void 0?{}:{extensions:{price:{usd:String(n.priceUsd)}}}})}catch(e){v.callbacks?.onDepositError?.({code:g.INVALID_TOKEN_IDENTIFIER,message:`Failed to resolve fromToken: ${e instanceof Error?e.message:String(e)}`})}}catch(e){w.setError(e instanceof Error?e.message:`Failed to resolve target token`),w.setErrorCode(g.INVALID_CONFIG)}});let ir=s(()=>{let e=tr.data;if(!e||e.length===0)return[];let t=v.walletAdapter?.supportedChainIds,n=er();return e.filter(e=>!(t?.length&&!t.includes(e.chainId)||n&&!n.has(he({chainId:e.chainId,address:e.address}))))}),Z=s(()=>{let e=ir(),t=w.targetToken();if(!e||e.length===0||!t)return[];let n=t.priceUsd??1,r=Number(I()||`0`)*n;return yt(e,t.symbol??``,t.chainId,t.address,r>0?r:void 0)});l(p([bn,Z],([e,t])=>{let n=ae({defaultFromToken:e,balances:t,currentSelection:H(),userPicked:Sn()});if(!n)return;U(n);let r=Y();(r===`quoting`||r===`quoted`||r===`error`)&&Q(t)})),l(p(Z,e=>{let t=Y();e.length>0&&(t===`idle`||t===`error`)&&k()===`crypto`&&Q(e)})),l(p(()=>w.recipient(),()=>{let e=Z(),t=Y();e.length>0&&(t===`idle`||t===`quoted`||t===`error`)&&k()===`crypto`&&Q(e)},{defer:!0})),l(p(()=>k(),e=>{if(e===`crypto`){let e=Z();e.length>0&&(Y()===`idle`||Y()===`error`)&&Q(e)}},{defer:!0}));let ar=s(()=>{let e=H();if(!e)return null;let t=w.targetToken(),n=K(),r=w.recipient(),i=I();return!t||typeof t.decimals!=`number`||!n||!i||Zn()&&!r?null:{tradeType:`EXACT_OUTPUT`,fromChainId:e.chainId,fromToken:e.address,toChainId:t.chainId,toToken:t.address,amount:le(i,t.decimals),fromAddress:n,...r&&{recipient:r},...v.config.refundTo&&{refundTo:v.config.refundTo},...v.config.referrer&&{referrer:v.config.referrer},...v.config.referrerFeeBps!==void 0&&{referrerFeeBps:v.config.referrerFeeBps}}}),or=De(q,ar,s(()=>!!ar()&&Y()===`quoted`)),sr=s(()=>k()===`crypto`&&(fn()||pn()||Y()===`quoted`&&or.isFetching));l(p(()=>or.data,e=>{if(e&&v.callbacks?.onQuoteReceived?.(e),!e||Y()!==`quoted`)return;let t=H();if(t&&e.routes.length>0){let n=de(me(e.routes,`EXACT_OUTPUT`))[0],r=e.routes.find(e=>e.routeId===n)??e.routes[0],i=z(),a=i.findIndex(e=>e.token.address.toLowerCase()===t.address.toLowerCase()&&e.token.chainId===t.chainId);if(a>=0){let n=[...i];n[a]={token:t,route:r,quoteId:e.quoteId},B(n)}}}));let{countdownSeconds:cr}=lt({phase:Y,onExpired:()=>{or.refetch()}}),lr=async(e,t,n,r,i,a,o)=>{try{let s={tradeType:`EXACT_OUTPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:i.chainId,toToken:i.address,amount:n,fromAddress:r,...a&&{recipient:a},...v.config.refundTo&&{refundTo:v.config.refundTo},...v.config.referrer&&{referrer:v.config.referrer},...v.config.referrerFeeBps!==void 0&&{referrerFeeBps:v.config.referrerFeeBps}},c=await ie.fetchQuery({queryKey:[`quote`,e.baseUrl,s],queryFn:({signal:t})=>e.getQuotes(s,{signal:o??t}),staleTime:15e3});if(c.routes.length>0){let e=de(me(c.routes,`EXACT_OUTPUT`))[0];return{token:t,route:c.routes.find(t=>t.routeId===e)??c.routes[0],quoteId:c.quoteId}}}catch{}return null},ur=null,Q=async e=>{let t=q(),n=K(),r=w.targetToken();if(!t||!n||!r||typeof r.decimals!=`number`||e.length===0)return;o(()=>{z().length>0&&B([]),w.error()&&w.clearError(),yn()&&W(null),V(!0)}),ur?.abort();let i=new AbortController;ur=i;try{let a=I();if(!a){V(!1);return}let o=le(a,r.decimals),s=H(),c=s?e.find(e=>E(e,s)):void 0,l=c?[c,...e.filter(e=>!E(e,c))]:e;for(let e of l){if(i.signal.aborted)return;let a=await lr(t,e,o,n,r,w.recipient(),i.signal);if(i.signal.aborted)return;if(a){B([a]),U(e),vn(he(e)),W(null),V(!1);return}}i.signal.aborted||(B([]),vn(null))}catch{}finally{V(!1),gn(!0)}};t(()=>{ur?.abort()});let dr=s(()=>{let e=Z(),t=ir();if(e.length===0)return t;let n=[...e];for(let e of t)n.some(t=>E(t,e))||n.push(e);return n}),fr=s(()=>{let e=H(),t=dr();if(!e||t.length===0)return 0;let n=t.findIndex(t=>E(t,e));return n>=0?n:0}),pr=s(()=>{let e=dr(),t=z(),n=w.targetToken(),r=rr();if(e.length===0||!n)return[];let i=new Map;for(let e of t)i.set(he(e.token),e);let a=_n();return e.map(e=>{let t=he(e),n=i.get(t),o=r.get(e.chainId),s=e.decimals,c=Number(e.extensions?.price?.usd??`0`),l=e.extensions?.balance?D(e.extensions.balance,s):`0`,u=A(ue(l,2)),d=``;if(c>0&&e.extensions?.balance){let e=Number(l)*c;d=e<.01?`<$0.01`:`$${A(e.toFixed(2).replace(/\.?0+$/,``))}`}let f=``,p=``,m=!0;if(n){let t=D(n.route.quote.amountIn,s);if(f=A(ue(t,2)),c>0){let e=Number(t)*c;p=e<.01?`<$0.01`:`$${A(e.toFixed(2).replace(/\.?0+$/,``))}`}m=BigInt(e.extensions?.balance??`0`)>=BigInt(n.route.quote.amountIn||`0`)}return{symbol:e.symbol,chain:o?.name??`Chain ${e.chainId}`,color:`#888`,amount:f,amountUsd:p,balance:u,balanceUsd:d,recommended:a!==null&&t===a,disabled:!m,logoURI:e.logoURI,chainId:e.chainId,address:e.address}})}),mr=s(()=>{let e={};for(let t of pr())if(t.recommended&&t.chainId){let n=(t.address??`0x0000000000000000000000000000000000000000`).toLowerCase();e[`eip155:${t.chainId}:${n}`]=C({id:`xel5qk`,message:`Recommended`})}return e}),hr=s(()=>{let e=H();return e?z().find(t=>E(t.token,e))??null:null}),gr=s(()=>hr()?.route??null),_r=s(()=>{let e=hr();return e?{chainId:e.token.chainId,address:e.token.address,symbol:e.token.symbol,name:e.token.name,decimals:e.token.decimals,logoURI:e.token.logoURI}:null}),{trackingOrderId:vr,trackingProviderName:yr,trackingProviderIcon:br,trackingInputAmount:xr,executionError:Sr,failedExecPhase:Cr,handleConfirm:wr,handleRetry:Tr,handleNewSwap:Er}=bt({client:q,walletAdapter:()=>v.walletAdapter,callbacks:()=>v.callbacks,apiEndpoint:()=>v.config.apiEndpoint,recipient:w.recipient,needRecipient:Zn,walletAddress:K,targetToken:w.targetToken,selectedPayToken:H,payTokenQuotes:z,setPayTokenQuotes:B,setLoadingQuotes:V,fetchSingleQuote:lr,configAmount:I,execPhase:w.execPhase,setExecPhase:w.setExecPhase,setFromToken:w.setFromToken,setError:w.setError,setErrorCode:w.setErrorCode,storeReset:w.reset,storeClearError:w.clearError,onRetry:()=>{U(null),Cn(!1),vn(null),W(null);let e=Z();e.length>0&&Q(e)},onReset:()=>{U(null),Cn(!1),vn(null),W(null);let e=Z();e.length>0&&Q(e)}});Be({client:q,walletAddress:K,trackingOrderId:vr,phase:Y,execPhase:w.execPhase,setOrder:w.setOrder,setExecPhase:w.setExecPhase,onOrderFilled:e=>{let t=H();v.callbacks?.onDepositSuccess?.({orderId:e.id,fromToken:t?.symbol??``,toToken:w.targetToken()?.symbol??``,fromAmount:e.srcAmount,toAmount:e.destAmount,txHash:e.depositTxHash??``})},onOrderFailed:e=>{v.callbacks?.onDepositError?.({code:g.ORDER_FAILED,message:`Order `+e.status})}});let Dr=async e=>{mn(!0),W(null);try{let t=q(),n=K(),r=w.targetToken(),i=I();if(!t||!n||!r||typeof r.decimals!=`number`||!i)return!1;let a=await lr(t,e,le(i,r.decimals),n,r,w.recipient());if(!a)return W(C({id:`wuxjl9`,message:`Selected token is unavailable for this purchase`})),!1;let o=z(),s=[...o],c=o.findIndex(t=>E(t.token,e));return c>=0?s[c]=a:s.push(a),B(s),U(e),Cn(!0),!0}finally{mn(!1)}},Or=e=>{L.hide(),e.address&&Dr(dr().find(t=>E(t,{chainId:e.chainId,address:e.address}))||{chainId:e.chainId,address:e.address,symbol:e.symbol,name:e.name,decimals:e.decimals??18,logoURI:e.logoURI})},kr=async()=>{v.walletAdapter?.openAccountModal?await v.walletAdapter.openAccountModal():v.callbacks?.onAccountModal?.()},Ar=()=>w.targetToken()?.symbol??``,jr=()=>J.quote()?.token?.decimals??w.targetToken()?.decimals??18,Mr=e=>e?ue(D(e,jr()),6):`0`,Nr=()=>{if(k()===`card`&&J.quote()){let e=J.quote();if(e.swapStrategy===`jump`){let t=e.routes?.[0]?.estimatedOutputAmount??e.estimatedOutputAmount;if(t)return ue(D(t,w.targetToken()?.decimals??18),6)}if(e.cryptoAmount)return Mr(e.cryptoAmount)}return w.targetAmount()||I()},Pr=()=>{let e=Number(Nr()),t=w.targetToken()?.priceUsd??0;return!e||t<=0?``:C({id:`1ovj1tk`,message:"≈ ${addThousandsSeparator}"},{addThousandsSeparator:A((e*t).toFixed(2).replace(/\.?0+$/,``))})},Fr=()=>{let e=Nr(),t=Ar();return!e||!t?C({id:`119fv83`,message:`Enter amount`}):C({id:`1cei180`,message:`Buy {amt} {sym}`},{amt:e,sym:t})},Ir=()=>!!w.targetToken(),Lr=()=>!!v.config.target,Rr=s(()=>v.config.toTokens?.length?$e(v.config.toTokens):void 0),zr=e=>{if(o(()=>{on(e),w.setTargetAmount(e),k()===`crypto`&&Z().length>0&&e&&V(!0)}),k()===`crypto`){let t=Z();t.length>0&&e&&Q(t)}},Br=s(()=>{let e=v.config.titleText?.trim();return e&&e.length>0?e:`TokenFlight`}),Vr=s(()=>{let e=v.config.titleText?.trim();return!!e&&e.length>0}),Hr=s(()=>{let e=v.config.titleImageUrl?.trim();return e&&e.length>0?e:null}),Ur=s(()=>T().length>1&&se()&&O()),Wr,$=Ce({container:()=>Wr,observeKey:()=>[Yn(),k(),P.state(),P.transitionPages()?.incoming??``,P.transitionPages()?.outgoing??``,k()===`card`&&(Un()||J.phase()===`success`),k()===`card`&&(Un()||J.phase()===`success`)?J.phase():``,v.config.hidePoweredBy].join(`|`)});return(()=>{var e=St(),t=e.firstChild;return ne(e=>{Wr=e},e),_(e,d(c,{get when(){return y(()=>k()===`card`)()&&(Un()||J.phase()===`success`)},get children(){return d(c,{get when(){return y(()=>J.phase()===`success`)()&&J.orderStatus()},get fallback(){return d(_e,{get phase(){return J.phase()},get status(){return J.orderStatus()?.status??`pending_payment`},get strategy(){return J.strategy()??J.orderStatus()?.swapStrategy??`direct`},get fiatAmount(){return J.fiatAmount()},get fiatCurrency(){return Nn()},get cryptoAmount(){let e=J.orderStatus()?.quotedCryptoAmount??J.quote()?.cryptoAmount,t=w.targetToken()?.decimals;return!e||t==null?e:D(e,t)},get targetToken(){return w.targetToken()},get provider(){return J.orderStatus()?.provider??J.quote()?.provider??`transak`},get hideProvider(){return v.config.hideProvider},get transferTxHash(){return J.orderStatus()?.fillTxHash??J.orderStatus()?.transferTxHash},get failedReason(){return J.orderStatus()?.failedReason??J.orderStatus()?.errorReason},get apiBase(){return jn()},get chainMap(){return rr()},onNewPurchase:()=>J.handleNewPurchase(),onRetry:()=>J.handleRetry(),onBack:()=>J.handleNewPurchase()})},get children(){return d(pt,{get orderStatus(){return J.orderStatus()},get fiatAmount(){return J.fiatAmount()},get fiatCurrency(){return Nn()},get targetToken(){return w.targetToken()},get tokenDecimals(){return J.tokenDecimals()},get provider(){return J.orderStatus()?.provider??`transak`},get apiBase(){return jn()},get chainMap(){return rr()},onNewPurchase:()=>J.handleNewPurchase()})}})}}),null),_(e,d(c,{get when(){return!(k()===`card`&&(Un()||J.phase()===`success`))},get children(){return d(Se,{get current(){return Yn()},views:{form:()=>[(()=>{var e=Tt(),t=e.firstChild,n=t.firstChild,r=n.firstChild;return _(n,d(c,{get when(){return Hr()},get fallback(){return d(c,{get when(){return!v.config.hideTitle},get children(){return d(ct,{size:22})}})},get children(){var e=Ct();return a(t=>{var n=Hr(),r=Br(),i=`${M.headerLogoImage} ${v.config.hideTitle?M[`headerLogoImage--solo`]:``}`;return n!==t.e&&te(e,`src`,t.e=n),r!==t.t&&te(e,`alt`,t.t=r),i!==t.a&&x(e,t.a=i),t},{e:void 0,t:void 0,a:void 0}),e}}),r),_(r,d(c,{get when(){return Vr()},get fallback(){return[`Token`,(()=>{var e=Nt();return a(()=>x(e,M.headerTitleAccent)),e})()]},get children(){return Br()}})),_(e,d(c,{get when(){return y(()=>!!G())()&&K()},get children(){var e=wt(),t=e.firstChild,n=t.nextSibling;return b(e,`click`,kr),_(n,()=>Le(K())),a(r=>{var i=M.headerRight,a=C({id:`xphk5n`,message:`Wallet account`}),o=M.walletDot,s=M.walletAddress;return i!==r.e&&x(e,r.e=i),a!==r.t&&te(e,`aria-label`,r.t=a),o!==r.a&&x(t,r.a=o),s!==r.o&&x(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),null),a(i=>{var a=F.header,o=M.headerLeft,s=`${M.headerBrand} ${M[`headerBrand--idle`]}`,c=`${M.headerTitle} ${v.config.hideTitle?M[`headerTitle--hidden`]:``}`;return a!==i.e&&x(e,i.e=a),o!==i.t&&x(t,i.t=o),s!==i.a&&x(n,i.a=s),c!==i.o&&x(r,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),e})(),(()=>{var e=At(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=n.nextSibling,o=i.firstChild,s=o.firstChild;return _(r,()=>qe(`youReceive`,C({id:`va18uh`,message:`You receive`}))),_(n,d(c,{get when(){return Qn()||G()},get children(){var e=Et(),t=e.firstChild;return b(e,`click`,()=>!Jn()&&!Xn()&&X.show()),_(t,(()=>{var e=y(()=>!!Qn());return()=>e()?Le(Qn()):C({id:`fpand1`,message:`Enter destination address`})})()),_(e,d(c,{get when(){return!Xn()},get children(){return d(Qe,{size:10})}}),null),a(n=>{var r=`${S.recipientBadge} ${Qn()?``:S.recipientBadgeEmpty}${Xn()?` ${S.recipientBadgeLocked}`:``}`,i=Xn(),a=S.recipientBadgeText;return r!==n.e&&x(e,n.e=r),i!==n.t&&(e.disabled=n.t=i),a!==n.a&&x(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),e}}),null),_(i,d(c,{get when(){return Ir()},get fallback(){return(()=>{var e=Pt();return b(e,`click`,e=>On(e.currentTarget)),_(e,()=>C({id:`zz4mrw`,message:`Select token`}),null),_(e,d(rt,{size:14}),null),e})()},get children(){var e=Ot(),t=e.firstChild,n=t.nextSibling,r=n.firstChild.firstChild,i=r.nextSibling;return b(e,`click`,e=>{Lr()||On(e.currentTarget)}),_(t,d(Ye,{get symbol(){return Ar()},color:`#0052FF`,size:32,get logoURI(){return w.targetToken()?.logoURI}}),null),_(t,d(c,{get when(){return w.targetToken()?.chainId},get children(){var e=Dt();return _(e,d(tt,{size:12,get iconUrl(){return h(jn(),w.targetToken()?.chainId??0)}})),a(()=>x(e,F.targetChainDot)),e}}),null),_(r,Ar),_(i,()=>rr().get(w.targetToken()?.chainId??0)?.name??``),_(n,d(c,{get when(){return!Lr()},get children(){return d(rt,{size:14})}}),null),a(n=>{var i={...Lr()?{}:{cursor:`pointer`}},a=F.targetIcon,o=F.symbol;return n.e=re(e,i,n.e),a!==n.t&&x(t,n.t=a),o!==n.a&&x(r,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),o),_(o,d(c,{get when(){return sn()},get fallback(){return(()=>{var e=Ft();return _(e,()=>A(Nr())),a(()=>x(e,F.amount)),e})()},get children(){var e=kt(),t=e.firstChild;return b(t,`input`,e=>zr(e.target.value)),a(n=>{var r=F.amountInputShell,i=F.amountInput;return r!==n.e&&x(e,n.e=r),i!==n.t&&x(t,n.t=i),n},{e:void 0,t:void 0}),a(()=>t.value=an()),e}}),s),_(s,Pr),a(r=>{var a=F.section,o=F.target,c=F.sectionLabel,l=F.targetContent,u=F.fiat;return a!==r.e&&x(e,r.e=a),o!==r.t&&x(t,r.t=o),c!==r.a&&x(n,r.a=c),l!==r.o&&x(i,r.o=l),u!==r.i&&x(s,r.i=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=Mt(),t=e.firstChild;return _(t,d(c,{get when(){return ot()},get fallback(){return(()=>{var e=It();return _(e,()=>C({id:`cgzgvn`,message:`Pay with`})),a(()=>x(e,F.methodHeaderLabel)),e})()},get children(){var e=jt(),t=e.firstChild,n=t.nextSibling;return b(e,`click`,nn),b(t,`animationend`,N()?rn:void 0),_(t,d(Ue,{size:14})),_(n,()=>C({id:`cgzgvn`,message:`Pay with`})),a(r=>{var i=`${S.backButton} ${F.methodHeaderBackButton}${N()?` ${S.backButtonExiting}`:``}`,a=N()?F.backArrowExit:F.backArrowEnter,o=N()?F.backTextExit:F.backTextEnter;return i!==r.e&&x(e,r.e=i),a!==r.t&&x(t,r.t=a),o!==r.a&&x(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})),_(e,d(Pe,{get page(){return k()},get state(){return P.state()},get transitionPages(){return P.transitionPages()},renderPage:e=>[d(c,{when:e===`entry`,get children(){return[(()=>{var e=Lt();return a(()=>x(e,F.methodPaneSpacer)),e})(),d(He,{get hasCrypto(){return se()},get hasCard(){return O()},onSelectCrypto:()=>vt(`crypto`),onSelectCard:()=>vt(`card`)})]}}),d(c,{when:e===`crypto`,get children(){return[(()=>{var e=Lt();return _(e,d(c,{get when(){return Y()===`quoted`},get children(){return d(xe,{secondsRemaining:cr,totalSeconds:30,onRefresh:()=>{or.refetch()},isRefreshing:()=>or.isFetching})}})),a(()=>x(e,`${F.methodPaneSpacer} ${F.methodPaneSpacerCrypto}`)),e})(),(()=>{var e=Vt();return _(e,d(c,{get when(){return I()},get fallback(){return(()=>{var e=Kt(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling;return _(n,()=>C({id:`1olegnl`,message:`Enter amount to get started`})),_(r,()=>C({id:`13i9oqu`,message:`We'll find the best rate for you`})),a(i=>{var a=ve.quoteCardSlotCard,o=S.idleIcon,s=S.idleTitle,c=S.idleSub;return a!==i.e&&x(e,i.e=a),o!==i.t&&x(t,i.t=o),s!==i.a&&x(n,i.a=s),c!==i.o&&x(r,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),e})()},get children(){return[d(c,{get when(){return!fn()||z().length>0},get fallback(){return[(()=>{var e=qt(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=r.nextSibling,o=i.firstChild,s=o.nextSibling,c=n.nextSibling,l=c.firstChild,u=l.nextSibling;return a(e=>{var a=F.paySelectedSkeleton,d=F.paySelectedLeft,f=`${S.skeleton} ${F.paySkeletonIcon}`,p=F.paySkeletonInfo,m=`${S.skeleton} ${F.paySkeletonLine} ${F.paySkeletonSymbol}`,h=`${S.skeleton} ${F.paySkeletonLine} ${F.paySkeletonChain}`,ee=F.paySkeletonRight,g=`${S.skeleton} ${F.paySkeletonLine} ${F.paySkeletonAmount}`,_=`${S.skeleton} ${F.paySkeletonLine} ${F.paySkeletonUsd}`;return a!==e.e&&x(t,e.e=a),d!==e.t&&x(n,e.t=d),f!==e.a&&x(r,e.a=f),p!==e.o&&x(i,e.o=p),m!==e.i&&x(o,e.i=m),h!==e.n&&x(s,e.n=h),ee!==e.s&&x(c,e.s=ee),g!==e.h&&x(l,e.h=g),_!==e.r&&x(u,e.r=_),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),e})(),d(Ee,{})]},get children(){return[(()=>{var e=Rt();return _(e,d(c,{get when(){return pr().length>0},get fallback(){return(()=>{var e=Xt();return _(e,d(c,{get when(){return G()},get fallback(){return[(()=>{var e=Zt();return a(()=>x(e,S.idleIcon)),e})(),(()=>{var e=Yt();return _(e,()=>C({id:`18y1lrp`,message:`Connect your wallet to see payment options`})),a(()=>x(e,F.payEmptyText)),e})()]},get children(){return[(()=>{var e=Jt();return a(()=>x(e,S.idleIcon)),e})(),(()=>{var e=Yt();return _(e,()=>C({id:`g7pjpv`,message:`No tokens available`})),a(()=>x(e,F.payEmptyText)),e})()]}})),a(()=>x(e,F.payEmpty)),e})()},get children(){return(()=>{let e=()=>pr()[fr()]??pr()[0];return(()=>{var t=$t(),n=t.firstChild,r=n.firstChild,i=r.firstChild,o=r.nextSibling,s=o.firstChild,l=s.firstChild,u=s.nextSibling,f=n.nextSibling,p=f.nextSibling;return b(t,`click`,e=>En(e.currentTarget)),_(r,d(Ye,{get symbol(){return e().symbol},get color(){return e().color},size:32,get logoURI(){return e().logoURI}}),i),_(i,d(tt,{color:null,size:12,get iconUrl(){return y(()=>e().chainId!==void 0)()?h(jn(),e().chainId):void 0}})),_(l,()=>e().symbol),_(s,d(c,{get when(){return e().recommended},get children(){var e=Qt();return _(e,()=>C({id:`xel5qk`,message:`Recommended`})),a(()=>x(e,F.payBestBadge)),e}}),null),_(u,()=>e().chain),_(f,d(c,{get when(){return y(()=>!!fn())()&&!e().amount},get fallback(){return[(()=>{var t=en();return _(t,()=>e().amount),a(()=>x(t,F.paySelectedAmount)),t})(),d(c,{get when(){return e().amountUsd},get children(){var t=Dt();return _(t,()=>e().amountUsd),a(()=>x(t,F.paySelectedAmountUsd)),t}})]},get children(){var e=Dt();return a(()=>x(e,`${S.skeleton} ${F.payAmountSkeleton}`)),e}})),_(p,d(rt,{size:16})),a(e=>{var a=F.paySelected,c=C({id:`1t0r88u`,message:`Select payment token`}),d=F.paySelectedLeft,m=F.payIconWrap,h=F.payChainDot,ee=F.paySelectedInfo,g=F.paySelectedTopRow,_=F.payTokenSymbol,ne=F.payTokenChain,v=F.paySelectedRight,y=F.paySelectedCaret;return a!==e.e&&x(t,e.e=a),c!==e.t&&te(t,`aria-label`,e.t=c),d!==e.a&&x(n,e.a=d),m!==e.o&&x(r,e.o=m),h!==e.i&&x(i,e.i=h),ee!==e.n&&x(o,e.n=ee),g!==e.s&&x(s,e.s=g),_!==e.h&&x(l,e.h=_),ne!==e.r&&x(u,e.r=ne),v!==e.d&&x(f,e.d=v),y!==e.l&&x(p,e.l=y),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),t})()})()}})),e})(),d(c,{get when(){return yn()},get children(){var e=zt();return _(e,yn),e}})]}}),d(c,{get when(){return y(()=>!!(pr().some(e=>!e.disabled)&&gr()&&_r()))()&&w.targetToken()},get fallback(){return d(c,{get when(){return pn()},get fallback(){return d(c,{get when(){return y(()=>!!(hn()&&!fn()&&I()&&pr().some(e=>!e.disabled)))()&&!gr()},get children(){var e=tn(),t=e.firstChild,n=t.nextSibling;return _(n,()=>C({id:`1ne9nkz`,message:`No offer available`})),a(r=>{var i=S.noOffer,a=S.noOfferIcon,o=S.noOfferText;return i!==r.e&&x(e,r.e=i),a!==r.t&&x(t,r.t=a),o!==r.a&&x(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})},get children(){return d(Ee,{})}})},get children(){var e=Bt();return _(e,d(we,{get route(){return gr()},get fromToken(){return _r()},get toToken(){return w.targetToken()},inline:!0})),a(()=>x(e,Me.quote)),e}})]}})),e})()]}}),d(c,{when:e===`card`,get children(){return[(()=>{var e=Lt();return _(e,d(ze,{get currencies(){return Vn()},get selected(){return Nn()},onSelect:Pn,get locked(){return Fn()},get locale(){return v.config.locale}})),a(()=>x(e,F.methodPaneSpacer)),e})(),d(ft,r({fiatCheckout:J,fiatCountdown:Rn,get targetToken(){return w.targetToken()??null},get fiatCurrency(){return Nn()},get apiBase(){return jn()},showPayAmount:!0},()=>I()&&!In()?{idleTitle:C({id:`pom1h2`,message:`Enter recipient address`}),idleSub:C({id:`7m2ht3`,message:`Required to receive your tokens`})}:{}))]}}),d(c,{when:e!==`entry`,get children(){var t=Gt();return _(t,d(i,{get children(){return[d(n,{get when(){return!Ir()},get children(){var e=Ht();return b(e,`click`,e=>On(e.currentTarget)),_(e,()=>C({id:`zz4mrw`,message:`Select token`})),a(()=>x(e,j.btnRecipient)),e}}),d(n,{when:e===`crypto`,get children(){return d(je,{get phase(){return Y()},get isConnected(){return G()},get hasQuote(){return!!gr()},get confirmDisabled(){return sr()},onConnect:An,onConfirm:wr,onRetry:Tr,get needsRecipient(){return y(()=>!!Zn())()&&!w.recipient()},onEnterRecipient:()=>X.show(),get label(){return y(()=>!!Jn())()?void 0:Fr()}})}}),d(n,{when:e===`card`,get children(){return d(i,{get children(){return[d(n,{get when(){return J.phase()===`error`},get children(){var e=Ht();return b(e,`click`,qn),_(e,Gn),a(()=>x(e,j.btnPrimary)),e}}),d(n,{get when(){return Wn()},get children(){var e=Ut(),t=e.firstChild,n=t.firstChild;return _(t,Gn,null),a(r=>{var i=`${j.btnPrimary} ${j.executing}`,a=j.btnInner,o=j.spinner;return i!==r.e&&x(e,r.e=i),a!==r.t&&x(t,r.t=a),o!==r.a&&x(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),d(n,{get when(){return!I()},get children(){var e=Wt();return _(e,()=>C({id:`119fv83`,message:`Enter amount`})),a(()=>x(e,j.btnPrimary)),e}}),d(n,{get when(){return!In()},get children(){var e=Ht();return b(e,`click`,()=>X.show()),_(e,()=>C({id:`wx5bee`,message:`Enter Recipient Address`})),a(()=>x(e,j.btnRecipient)),e}}),d(n,{get when(){return Kn()},get children(){var e=Ht();return b(e,`click`,qn),_(e,Gn),a(()=>x(e,j.btnPrimary)),e}}),d(n,{when:!0,get children(){var e=Wt();return _(e,Gn),a(()=>x(e,j.btnPrimary)),e}})]}})}})]}})),a(()=>x(t,S.ctaWrapperReceive)),t}})]}),null),a(()=>x(t,F.methodHeaderOverlay)),e})(),(()=>{var e=Dt();return _(e,d(c,{get when(){return!v.config.hidePoweredBy},get children(){return d(at,{})}})),a(()=>x(e,S.footerSlot)),e})()],tracking:()=>d(Ie,{get order(){return w.order()},get fromToken(){return w.fromToken()},get toToken(){return w.targetToken()},get providerName(){return yr()},get providerIcon(){return br()},get hideProvider(){return v.config.hideProvider},get apiEndpoint(){return v.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return xr()??``},get outputAmount(){return w.targetAmount()},onNewSwap:Er,mode:`receive`,get executionError(){return Sr()},onRetry:Tr,get phase(){return Y()},get failedPhase(){return Cr()},get chainMap(){return rr()}}),success:()=>d(Te,{get order(){return w.order()},get fromToken(){return w.fromToken()},get toToken(){return w.targetToken()},onNewSwap:Er,get apiEndpoint(){return v.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return yr()},mode:`receive`,get chainMap(){return rr()}})}})}}),null),_(e,d(c,{get when(){return L.mounted()},get children(){return d(ke,{selectingFor:`from`,onClose:Dn,get noBorder(){return v.config.noBorder},get dismissing(){return L.dismissing()},get children(){return d(u,{get fallback(){return d(ye,{selectingFor:`from`,onClose:Dn})},get children(){return d(be,{get client(){return q()},get walletAddress(){return K()},selectingFor:`from`,get tokenTags(){return mr()},onSelect:Or,onClose:Dn,get supportedChainIds(){return v.walletAdapter?.supportedChainIds},get allowedTokens(){return er()},get noBorder(){return v.config.noBorder},get dismissing(){return L.dismissing()}})}})}})}}),null),_(e,d(c,{get when(){return R.mounted()},get children(){return d(ke,{selectingFor:`to`,onClose:kn,get noBorder(){return v.config.noBorder},get dismissing(){return R.dismissing()},get children(){return d(u,{get fallback(){return d(ye,{selectingFor:`to`,onClose:kn})},get children(){return d(be,{get client(){return q()},walletAddress:null,selectingFor:`to`,onSelect:e=>{e.address&&typeof e.decimals==`number`&&w.setTargetToken({chainId:e.chainId,address:e.address,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd}),R.hide()},onClose:kn,get allowedTokens(){return Rr()},get noBorder(){return v.config.noBorder},get dismissing(){return R.dismissing()}})}})}})}}),null),_(e,d(c,{get when(){return y(()=>!!X.mounted())()&&w.targetToken()},get children(){var e=xt();return _(e,d(Ne,{get initialValue(){return w.recipient()??``},get chainType(){return pe(w.targetToken().chainId)},onConfirm:e=>{$n(e),X.hide()},onClose:()=>X.hide(),get dismissing(){return X.dismissing()}})),a(()=>x(e,`${S.selectorOverlay}${X.dismissing()?` ${S.selectorOverlayDismissing}`:``}`)),e}}),null),a(n=>{var r=`${S.container}${Ur()?` ${S.receiveMethodStableContainer}`:``}${$.state()===`animating`?` ${M.swapContainerAnimating}`:``}${v.config.noBackground?` ${S.noBg}`:``}${v.config.noBorder?` ${S.noBorder}`:``}`,i=$.state(),a=S.accentLine;return r!==n.e&&x(e,n.e=r),i!==n.t&&te(e,`data-height-transition-state`,n.t=i),a!==n.a&&x(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),e})()}export{nn as ReceiveComponent};
@@ -0,0 +1 @@
1
+ import{S as e,a as t,c as n,h as r,l as i,m as a,o,p as s,r as c,s as l,u,v as d,x as f}from"./solid-iWr5Czxc.js";import{c as p,i as m,n as h,s as g,t as _}from"./errors-DXq77OyE.js";import{c as v,d as y,f as ee,g as b,h as x,l as S,m as te,o as C,s as w,t as T}from"./shared.module-2EeBIMep.js";import{_ as E,b as ne,c as re,g as ie,h as ae,l as oe,p as se,r as ce,s as le,x as ue}from"./rank-offers-CiA9Nw2C.js";import{$ as D,A as de,B as fe,C as O,D as pe,E as me,F as he,G as ge,H as _e,I as ve,J as ye,K as be,L as xe,M as Se,N as Ce,O as we,P as Te,Q as Ee,R as De,S as k,T as Oe,U as ke,V as Ae,W as je,X as Me,Z as Ne,_ as Pe,a as Fe,at as Ie,b as Le,c as Re,ct as ze,d as Be,dt as A,et as Ve,f as j,ft as He,gt as Ue,h as We,ht as Ge,i as M,it as Ke,j as qe,k as Je,l as Ye,lt as Xe,m as Ze,mt as Qe,n as $e,nt as et,o as tt,ot as nt,p as rt,pt as it,q as at,r as ot,rt as st,s as ct,st as lt,t as ut,tt as dt,u as ft,ut as pt,w as mt,x as ht,y as gt,z as _t}from"./usePageRouter-BUKTv1jC.js";var vt={shell:`tf-25b7d0`,amount:`tf-59b76a`,muted:`tf-a859d8`},N=x(`<div data-testid=amount-input-shell><input type=number inputmode=decimal part=input>`);function yt(e){let{t}=Ue(),[n,i]=d(e.value);s(f(()=>e.value,e=>{i(e)}));let a=t=>{let n=t.target.value;n=n.replace(/[^0-9.]/g,``);let r=n.indexOf(`.`);r!==-1&&(n=n.slice(0,r+1)+n.slice(r+1).replace(/\./g,``)),i(n),e.onChange(n)};return(()=>{var i=N(),o=i.firstChild;return C(o,`input`,a),r(n=>{var r=vt.shell,a=vt.amount,s=e.disabled,c=e.placeholder??t({id:`epw9f3`,message:`0`});return r!==n.e&&w(i,n.e=r),a!==n.t&&w(o,n.t=a),s!==n.a&&(o.disabled=n.a=s),c!==n.o&&y(o,`placeholder`,n.o=c),n},{e:void 0,t:void 0,a:void 0,o:void 0}),r(()=>o.value=n()),i})()}var P={selector:`tf-28b876`,header:`tf-2aa545`,titleRow:`tf-bcba74`,title:`tf-a974e8`,headerRight:`tf-14447c`,close:`tf-527e42`,divider:`tf-a5a3ce`,providerList:`tf-211bfe`,providerItem:`tf-fd33c1`,providerItemSelected:`tf-a0382b`,providerLeft:`tf-2aece4`,providerIcon:`tf-949870`,providerIconFallback:`tf-13e09e`,providerInfo:`tf-2387c4`,providerName:`tf-74069b`,bestBadge:`tf-113a28`,providerFee:`tf-69fe0b`,providerRight:`tf-cb2799`,cryptoAmount:`tf-d4ce76`,checkmark:`tf-b3b747`},F=x(`<div role=dialog part=provider-selector data-testid=provider-selector><div><div><span data-testid=provider-selector-title></span><div><button data-testid=provider-selector-close></button></div></div></div><div></div><div>`),bt=x(`<img>`),xt=x(`<span>`),St=x(`<button type=button data-testid=provider-list-item><div><div><span></span><span>: </span></div></div><div><span>≈ <!> `),Ct=x(`<div>`);function wt(e){if(e.swapStrategy===`jump`&&e.routes?.length){let t=e.routes[0]?.estimatedOutputAmount;if(t)return t}return e.cryptoAmount}function Tt(e){let{t}=Ue(),n=()=>Ae(e.fiatCurrency.toUpperCase()),i=t=>e.selectedProviderId?t===e.selectedProviderId:e.quotes.length>0&&e.quotes[0].provider===t,a=t=>{t.key===`Escape`&&e.onClose()};return(()=>{var s=F(),l=s.firstChild,f=l.firstChild,p=f.firstChild,m=p.nextSibling,h=m.firstChild,g=l.nextSibling,_=g.nextSibling;return C(s,`keydown`,a),v(p,()=>t({id:`118a77s`,message:`Select Fiat Provider`})),v(m,u(he,{get secondsRemaining(){return e.countdownSeconds},get totalSeconds(){return e.totalCountdownSeconds},get onRefresh(){return e.onRefresh},get isRefreshing(){return e.isRefreshing}}),h),C(h,`click`,()=>e.onClose()),v(h,u(pt,{size:18})),v(_,u(c,{get each(){return[...e.quotes]},children:(a,s)=>{let[c,l]=d(!1),f=()=>i(a.provider),p=()=>s()===0,m=()=>a.providerIcon?`${e.apiBase}${a.providerIcon}`:null;return(()=>{var i=St(),s=i.firstChild,d=s.firstChild,h=d.firstChild,g=h.nextSibling,_=g.firstChild,ee=s.nextSibling,b=ee.firstChild,x=b.firstChild.nextSibling;return x.nextSibling,C(i,`click`,()=>e.onSelect(a.provider)),v(s,u(o,{get when(){return S(()=>!!m())()&&!c()},get fallback(){return(()=>{var e=Ct();return v(e,()=>(a.providerName??a.provider).charAt(0).toUpperCase()),r(()=>w(e,P.providerIconFallback)),e})()},get children(){var e=bt();return C(e,`error`,()=>l(!0)),r(t=>{var n=P.providerIcon,r=m(),i=a.provider;return n!==t.e&&w(e,t.e=n),r!==t.t&&y(e,`src`,t.t=r),i!==t.a&&y(e,`alt`,t.a=i),t},{e:void 0,t:void 0,a:void 0}),e}}),d),v(h,()=>a.providerName??a.provider,null),v(h,u(o,{get when(){return p()},get children(){var e=xt();return v(e,()=>t({id:`r7v9s7`,message:`BEST RATE`})),r(()=>w(e,P.bestBadge)),e}}),null),v(g,()=>t({id:`1viukn9`,message:`Total fee`}),_),v(g,n,null),v(g,()=>parseFloat(String(a.totalFee)).toFixed(2),null),v(b,()=>ae(E(wt(a),e.tokenDecimals),4),x),v(b,()=>e.targetSymbol,null),v(ee,u(o,{get when(){return f()},get children(){var e=xt();return v(e,u(A,{size:16})),r(()=>w(e,P.checkmark)),e}}),null),r(e=>{var t=`${P.providerItem}${f()?` ${P.providerItemSelected}`:``}`,n=P.providerLeft,r=P.providerInfo,a=P.providerName,o=P.providerFee,c=P.providerRight,l=P.cryptoAmount;return t!==e.e&&w(i,e.e=t),n!==e.t&&w(s,e.t=n),r!==e.a&&w(d,e.a=r),a!==e.o&&w(h,e.o=a),o!==e.i&&w(g,e.i=o),c!==e.n&&w(ee,e.n=c),l!==e.s&&w(b,e.s=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),i})()}})),r(e=>{var n=P.selector,r=t({id:`118a77s`,message:`Select Fiat Provider`}),i=P.header,a=P.titleRow,o=P.title,c=P.headerRight,u=P.close,d=t({id:`1l0xxoj`,message:`Close`}),v=P.divider,ee=P.providerList;return n!==e.e&&w(s,e.e=n),r!==e.t&&y(s,`aria-label`,e.t=r),i!==e.a&&w(l,e.a=i),a!==e.o&&w(f,e.o=a),o!==e.i&&w(p,e.i=o),c!==e.n&&w(m,e.n=c),u!==e.s&&w(h,e.s=u),d!==e.h&&y(h,`aria-label`,e.h=d),v!==e.r&&w(g,e.r=v),ee!==e.d&&w(_,e.d=ee),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),s})()}function Et(e){let t=ot();return{trackingOrderId:t.trackingOrderId,trackingAddress:t.trackingAddress,trackingProviderName:t.trackingProviderName,trackingProviderIcon:t.trackingProviderIcon,executionError:t.executionError,failedExecPhase:t.failedExecPhase,handleConfirm:async()=>{t.setTrackingOrderId(null),t.setTrackingAddress(null),t.setExecutionError(null),t.setFailedExecPhase(null);let n=e.routes(),r=e.quoteId(),i=n.find(t=>t.routeId===e.selectedRouteId())??n[0];if(!i||!r||!e.client()||!e.walletAdapter())return;if(e.needRecipient()&&!e.recipient()){e.setError(`Recipient address is required for cross-chain swaps`),e.setErrorCode(_.INVALID_CONFIG);return}let a=le(e.fromToken().chainId),o=e.walletAddress();if(!o){e.setError(`Wallet not connected`),e.setErrorCode(_.WALLET_CONNECTION_FAILED);return}if(!oe(o,a)){e.setError(rt`Wallet doesn't match source chain`),e.setErrorCode(_.INVALID_CONFIG);return}t.setTrackingProviderName(i.routeId??null);let s=e.apiEndpoint()??`https://api.hyperstream.dev`;t.setTrackingProviderIcon(i.icon?`${s}${i.icon}`:null),t.setTrackingAddress(o),e.setExecPhase(`building`);try{let n=await e.client().buildDeposit({from:o,quoteId:r,routeId:i.routeId});e.setExecPhase(`awaiting-wallet`);let a=await M(e.walletAdapter(),n,e.fromToken().chainId);e.setExecPhase(`submitting`);let s=await ct(e.client(),r,i.routeId,a);e.setExecPhase(`tracking`),t.setTrackingOrderId(s.orderId)}catch(n){let r=Fe(n,e.callbacks(),`swap`);t.setExecutionError(r),t.setFailedExecPhase(e.execPhase())}},handleRetry:()=>{t.setTrackingOrderId(null),t.setTrackingAddress(null),e.setExecPhase(null)},handleNewSwap:()=>{e.storeReset(),tt(t,e.client().baseUrl),e.onReset?.()}}}var I=x(`<button type=button data-testid=quote-error-close>`),L=x(`<button type=button part=button-primary data-testid=quote-error-retry>`),Dt=x(`<section part=quote-error data-testid=quote-error-panel><div><span></span><div><button type=button data-testid=quote-error-copy></button></div></div><div data-testid=quote-error-message>`),Ot=x(`<div data-height-transition-ignore=true>`),kt=x(`<div><div><span></span><span>`),At=x(`<div data-height-transition-ignore=true><div role=dialog data-testid=quote-details-sheet part=quote-details-sheet><button type=button data-testid=quote-details-close></button><div>`),jt=x(`<div part=container><div part=accent-line>`),Mt=x(`<button type=button part=back-button><span>`),Nt=x(`<img height=22>`),Pt=x(`<button part=wallet-info><div></div><span>`),Ft=x(`<div part=header><div><div data-testid=header-brand><span>`),It=x(`<div data-testid=swap-method-frame><div data-testid=powered-footer-slot>`),Lt=x(`<span>Flight`),Rt=x(`<div><span>`),zt=x(`<div><span></span><button type=button>`),Bt=x(`<span>`),Vt=x(`<div><div><div></div></div><span>`),Ht=x(`<div>`),Ut=x(`<div><div data-testid=fiat-amount-shell><span></span><input type=number inputmode=decimal placeholder=0 part=fiat-amount-input data-testid=fiat-amount-input>`),Wt=x(`<button type=button part=swap-arrow>`),Gt=x(`<button part=recipient-badge><span>`),Kt=x(`<span part=amount-display style=cursor:default>`),qt=x(`<button type=button data-testid=quote-details-trigger>`),Jt=x(`<div style=position:relative><div><div part=panel-from><div><span></span></div></div><div></div><div part=panel-to><div><span></span></div><div></div><div><span></span><div>`),Yt=x(`<div part=price-preview>`),Xt=x(`<div part=no-offer><span>`),Zt=x(`<div><div style=width:32px;height:32px></div><span>`),Qt=x(`<div><div></div><span></span><span>`),$t=x(`<button part=button-primary type=button>`),en=x(`<button disabled type=button><span><span>`),tn=x(`<button disabled type=button style=opacity:0.6>`),nn=x(`<div part=cta-wrapper>`),rn=x(`<button><span>`),an=x(`<span> `),on=x(`<div style=width:120px;height:28px>`),sn=x(`<div><div><div style=margin-bottom:0>`);function cn(t){let{t:n}=Ue(),[i,a]=d(!1),s,c=()=>{t.onCopy(t.message),a(!0),s&&clearTimeout(s),s=setTimeout(()=>{a(!1),s=void 0},1200)};return e(()=>{s&&clearTimeout(s)}),(()=>{var e=Dt(),a=e.firstChild,s=a.firstChild,l=s.nextSibling,d=l.firstChild,f=a.nextSibling;return v(s,u(nt,{size:15}),null),v(s,()=>n({id:`jf8ts4`,message:`Quote Failed`}),null),C(d,`click`,c),v(d,u(o,{get when(){return i()},get fallback(){return u(Ie,{size:13})},get children(){return u(A,{size:13})}})),v(l,u(o,{get when(){return t.onClose},get children(){var e=I();return C(e,`click`,()=>t.onClose?.()),v(e,u(pt,{size:14})),r(t=>{var r=k.quoteErrorIconButton,i=n({id:`1l0xxoj`,message:`Close`});return r!==t.e&&w(e,t.e=r),i!==t.t&&y(e,`aria-label`,t.t=i),t},{e:void 0,t:void 0}),e}}),null),v(f,()=>t.message),v(e,u(o,{get when(){return t.onRetry},get children(){var e=L();return C(e,`click`,()=>{t.onRetry?.()}),v(e,()=>n({id:`1w68n16`,message:`Try Again`})),r(()=>w(e,`${D.btnError} ${k.quoteErrorCta}`)),e}}),null),r(r=>{var o=`${k.quoteErrorPanel} ${k[`quoteErrorPanel--${t.variant}`]}`,c=k.quoteErrorHeader,u=k.quoteErrorTitle,p=k.quoteErrorActions,m=`${k.quoteErrorIconButton}${i()?` ${k.quoteErrorIconButtonCopied}`:``}`,h=i()?n({id:`13bzcw5`,message:`Copied`}):n({id:`2mzna2`,message:`Copy error`}),g=i()?`true`:`false`,_=k.quoteErrorMessage;return o!==r.e&&w(e,r.e=o),c!==r.t&&w(a,r.t=c),u!==r.a&&w(s,r.a=u),p!==r.o&&w(l,r.o=p),m!==r.i&&w(d,r.i=m),h!==r.n&&y(d,`aria-label`,r.n=h),g!==r.s&&y(d,`data-copied`,r.s=g),_!==r.h&&w(f,r.h=_),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e})()}function R(e){return u(j,{get children(){return u(z,e)}})}function z(e){let{t:c}=Ue(),x=Ue(),oe=a(()=>e.config.methods??[`crypto`]),Fe=a(()=>oe().includes(`crypto`)),Ie=a(()=>oe().includes(`card`)),A=a(()=>!!e.config.lockFromToken||!!e.config.defaultPayMethod),j=a(()=>!!e.config.lockToToken),{page:M,setPage:tt,showBack:nt,backExiting:rt,handleBack:ot,onBackAnimEnd:ct}=ut({methods:oe,defaultPage:()=>e.config.defaultPayMethod,onBack:e.onBack}),[N,P]=d(`idle`),F=je(),bt=a(()=>!e.config.defaultPayMethod&&oe().length>1&&M()!==`entry`),xt=a(()=>N()===`enter`?`enter`:N()===`exit`?`exit`:nt()?`pushed`:`idle`),St=e=>{let t=M();if(t===e)return;let n=$.begin(),r=()=>F.runForwardImmediate(t,e,()=>{P(t===`entry`?`enter`:`idle`),tt(e)});if(n){$.scheduleCommit(r);return}r()},Ct=()=>{if(rt())return;let e=bt();if(e){let e=M(),t=$.begin();P(`exit`),ot();let n=()=>F.runBackImmediate(e,`entry`,()=>tt(`entry`));if(t){$.scheduleCommit(n);return}n();return}P(e?`exit`:`idle`),ot()},wt=()=>{if(N()===`enter`){P(`idle`);return}N()===`exit`&&(P(`idle`),ct())},I=Pe(),[L,Dt]=d(`from`),R=mt(),z=mt(),ln=mt(),B=mt(),[un,dn]=d(null),[fn,pn]=d(!1),[V,mn]=d(e.config.fiatCurrency??`USD`),[hn,gn]=d(null),[_n,vn]=d(null),yn=()=>{i(()=>{I.clearError(),gn(null)})},{isConnected:H,walletAddress:U,handleConnect:bn}=Be({walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,onAddressChange:e=>I.setWalletAddress(e),onConnectError:(e,t)=>{i(()=>{gn(`wallet-connect`),I.setError(e),I.setErrorCode(t)})}});s(f(H,e=>{e&&hn()===`wallet-connect`&&yn()}));let xn=e=>{e instanceof HTMLElement&&dn(e)},Sn=()=>{window.setTimeout(()=>{let e=un();e?.isConnected&&e.focus()},300)},Cn=()=>{R.hide(),Sn()},wn=(e,t)=>{if(e===`to`&&M()===`card`){xn(t),Dt(`to`),R.show();return}if(!H()){bn();return}xn(t),Dt(e),R.show()},W=a(()=>new m({baseUrl:e.config.apiEndpoint??`https://api.hyperstream.dev`})),Tn=a(()=>new g({baseUrl:e.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`})),G=()=>W().baseUrl,En=a(()=>e.config.fromTokens?.length?Ze(e.config.fromTokens):void 0),Dn=a(()=>e.config.toTokens?.length?Ze(e.config.toTokens):void 0),[On,kn]=d([]),An=de(W,()=>!0),jn=a(()=>{let e=An.data;return e?Te(e):new Map}),{needRecipient:Mn,effectiveRecipient:Nn,recipientDisplay:Pn,handleRecipientChange:Fn}=Ye({fromToken:I.fromToken,toToken:I.toToken,recipient:I.recipient,isConnected:H,walletAddress:U,walletAdapter:()=>e.walletAdapter,setRecipient:I.setRecipient}),In=Ce(W,U,()=>H()&&!!U(),()=>e.walletAdapter?.supportedChainIds),Ln=a(()=>{let e=I.fromToken(),t=In.data;return!e||!t?null:ue(t,e)}),Rn=a(()=>{let e=Ln();return e?.extensions?.balance?se(ae(E(e.extensions.balance,e.decimals),2)):e?`0`:null}),zn=a(()=>{let e=I.fromToken();return!e||typeof e.decimals!=`number`||!In.data?null:Ln()?.extensions?.balance??`0`}),Bn=a(()=>{let e=I.inputAmount(),t=I.fromToken(),n=zn();if(!t||typeof t.decimals!=`number`||!n||!e||e===`0`||e===``)return!1;try{return BigInt(ie(e,t.decimals))>BigInt(n)}catch{return!1}}),[Vn,Hn,Un]=Je(``,300),K=a(()=>e.config.tradeType===`EXACT_OUTPUT`),Wn=a(()=>e.config.quoteCard??(K()?`visible`:`hidden`)),q=a(()=>!K()&&Wn()===`hidden`),Gn=a(()=>e.lockRecipient===void 0?!!e.config.recipient&&e.config.recipientEditable!==!0:e.lockRecipient),Kn=a(()=>{if(M()!==`crypto`)return null;let t=I.fromToken(),n=I.toToken(),r=Nn();if(!t||typeof t.decimals!=`number`||!n||typeof n.decimals!=`number`||!W()||Mn())return null;if(K()){let i=e.config.amount;return!i||parseFloat(i)<=0?null:{tradeType:`EXACT_OUTPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:n.chainId,toToken:n.address,amount:ie(i,n.decimals),fromAddress:U()??re(t.chainId),...r&&{recipient:r},...e.config.refundTo&&{refundTo:e.config.refundTo},...e.config.referrer&&{referrer:e.config.referrer},...e.config.referrerFeeBps!==void 0&&{referrerFeeBps:e.config.referrerFeeBps}}}let i=Vn();return!i||parseFloat(i)<=0?null:{tradeType:`EXACT_INPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:n.chainId,toToken:n.address,amount:ie(i,t.decimals),fromAddress:U()??re(t.chainId),...r&&{recipient:r},...e.config.refundTo&&{refundTo:e.config.refundTo},...e.config.referrer&&{referrer:e.config.referrer},...e.config.referrerFeeBps!==void 0&&{referrerFeeBps:e.config.referrerFeeBps}}}),J=Se(W,Kn,a(()=>!!Kn()&&!I.execPhase()&&H()&&!!U())),Y=a(()=>{if(!I.fromToken()||!I.toToken())return[];if(!K()){let e=I.inputAmount();if(!e||parseFloat(e)<=0)return[]}return J.data?.routes??[]}),qn=a(()=>J.data?.quoteId??null),Jn=a(()=>Y().length>0?ce(Y()):null),Yn=a(()=>{let e=Y(),t=Jn();return e.find(e=>e.routeId===t)??e[0]??null}),Xn=a(()=>{let e=Yn(),t=I.toToken();return!e||!t||typeof t.decimals!=`number`?``:ae(E(e.quote.amountOut,t.decimals))}),Zn=a(()=>{if(!K())return null;let e=Yn(),t=I.fromToken();return!e||!t||typeof t.decimals!=`number`?null:ae(E(e.quote.amountIn,t.decimals))}),X=a(()=>gt(I.execPhase(),I.error(),J.isFetching,Y().length,!!Kn())),Qn=a(()=>I.execPhase()||!Kn()?!1:!J.isFetching&&J.isSuccess&&Y().length===0),$n=a(()=>{let e=X();return e===`quoted`||e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`||e===`success`}),er=a(()=>{let e=X();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),tr=a(()=>!I.fromToken()||!I.toToken()?!1:X()===`quoting`&&!!Kn()&&Y().length===0),nr=a(()=>{let e=I.fromToken();if(!e)return null;if(typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd))return e.priceUsd;let t=Number(Ln()?.extensions?.price?.usd??``);return Number.isFinite(t)?t:null}),rr=a(()=>{let e=I.toToken();return e&&typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd)?e.priceUsd:null}),ir=a(()=>{let e=K()?Zn()??`0`:I.inputAmount(),t=Number(e),n=nr();return!Number.isFinite(t)||t<=0||n===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:ye(t*n)})}),{trackingOrderId:ar,trackingAddress:or,trackingProviderName:sr,trackingProviderIcon:cr,executionError:lr,failedExecPhase:ur,handleConfirm:dr,handleRetry:fr,handleNewSwap:pr}=Et({client:W,walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,apiEndpoint:()=>e.config.apiEndpoint,fromToken:I.fromToken,recipient:Nn,needRecipient:Mn,walletAddress:U,routes:Y,quoteId:qn,selectedRouteId:Jn,execPhase:I.execPhase,setExecPhase:I.setExecPhase,setError:e=>{gn(`validation`),I.setError(e)},setErrorCode:e=>{gn(`validation`),I.setErrorCode(e)},storeReset:I.reset,onReset:()=>Un(``)});Re({client:W,walletAddress:U,trackingAddress:or,trackingOrderId:ar,phase:X,execPhase:I.execPhase,setOrder:I.setOrder,setExecPhase:I.setExecPhase,onOrderFilled:t=>e.callbacks?.onSwapSuccess?.({orderId:t.id,fromToken:I.fromToken().symbol??I.fromToken().address,toToken:I.toToken().symbol??I.toToken().address,fromAmount:t.srcAmount,toAmount:t.destAmount,txHash:t.depositTxHash??``}),onOrderFailed:t=>e.callbacks?.onSwapError?.({code:_.ORDER_FAILED,message:`Order `+t.status})});let{countdownSeconds:mr}=ft({phase:X,onExpired:()=>J.refetch()});s(f(()=>({isError:J.isError,error:J.error,data:J.data}),({isError:e,error:t,data:n})=>{I.execPhase()||M()!==`crypto`||(e&&!n?i(()=>{gn(`quote`),t instanceof p?(I.setError(t.message),I.setErrorCode(t.code)):(I.setError(String(t)),I.setErrorCode(null))}):hn()===`quote`&&I.error()&&!e&&yn())}));let hr=async()=>{let e=hn();if(yn(),e===`quote`){await J.refetch();return}if(e===`wallet-connect`){await bn();return}e!==`validation`&&fr()};s(f(()=>J.data,t=>{t&&e.callbacks?.onQuoteReceived?.(t)}));let gr=a(()=>Nn()),_r=a(()=>{if(!K()||!e.config.amount)return null;let t=I.toToken();return!t||typeof t.decimals!=`number`?null:ie(e.config.amount,t.decimals)}),Z=$e({client:Tn,targetToken:I.toToken,recipient:gr,fiatCurrency:()=>V(),callbacks:()=>e.callbacks,flowKind:`swap`,cryptoAmount:_r,requireRecipient:!0}),vr=ft({phase:Z.phase,onExpired:()=>Z.refetchQuote(),intervalSeconds:30}),yr=a(()=>M()===`card`&&!gr()&&!!I.toToken()&&(!!Z.fiatAmount()||K())),br=a(()=>Pn()??(H()?U():null)),xr=a(()=>!!e.config.fiatCurrency),Sr=qe(Tn,()=>!xr()),Cr=a(()=>{if(xr())return[];let e=Sr.data;if(!e?.providers?.length)return[];let t=new Set;for(let n of e.providers){let e=n.supportedCurrencies;if(Array.isArray(e))for(let n of e)typeof n==`string`?t.add(n):n&&typeof n.code==`string`&&t.add(n.code)}return[...t].sort()}),wr=[`USD`,`EUR`,`GBP`,`JPY`,`KRW`,`CNY`,`AUD`,`CAD`,`INR`,`SGD`,`HKD`,`TWD`,`BRL`,`MXN`,`CHF`],Tr=a(()=>{let e=Cr();return e.length>0?e:wr}),Er=a(()=>Ae(V())||V()),Dr=()=>Z.quote()?.token?.decimals??I.toToken()?.decimals??18,Or=e=>e?ae(E(e,Dr()),6):`0`,kr=a(()=>{let e=Z.quote(),t=parseFloat(Z.fiatAmount());return!e||!t?!1:!!(e.minFiatAmount&&t<parseFloat(String(e.minFiatAmount))||e.maxFiatAmount&&t>parseFloat(String(e.maxFiatAmount)))}),Ar=a(()=>{let e=Z.phase();return e===`awaiting-payment`||e===`tracking`}),jr=a(()=>{let e=Z.phase();return e===`creating-order`||e===`quoting`}),Mr=a(()=>{let e=Z.phase();return e===`error`?c({id:`1w68n16`,message:`Try Again`})??`Try Again`:e===`creating-order`||e===`quoting`?c({id:`344av8`,message:`Processing...`}):e===`quoted`&&Z.quote()?c({id:`13l4n4r`,message:`Continue via {provider}`},{provider:Z.quote().providerName??at(Z.quote().provider)}):c({id:`119fv83`,message:`Enter amount`})}),Nr=a(()=>Z.phase()===`quoted`&&!!gr()&&!kr()&&!Z.isQuoteFetching()),Pr=()=>{let e=Z.phase();e===`error`?Z.handleRetry():e===`quoted`&&Nr()&&Z.createOrder()},Fr=a(()=>{if(K()&&e.config.amount)return e.config.amount;if(M()===`crypto`)return Xn();let t=Z.quote();if(!t)return``;if(t.swapStrategy===`jump`){let e=t.routes?.[0]?.estimatedOutputAmount??t.estimatedOutputAmount;if(e)return ae(E(e,I.toToken()?.decimals??18),6)}return Or(t.cryptoAmount)}),Ir=a(()=>K()&&e.config.amount?!0:M()===`crypto`?$n()||X()===`quoting`:!!Z.quote()||Z.phase()===`quoting`),Lr=a(()=>{let e=Number(Fr()||`0`),t=rr();return!Ir()||!Number.isFinite(e)||e<=0||t===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:ye(e*t)})}),Rr=e=>{let t=jn().get(e.chainId);return{symbol:e.symbol??``,name:e.name??e.symbol??``,chain:t?.name??`Chain ${e.chainId}`,chainId:e.chainId,color:`#888`,balance:null,usd:``,address:e.address,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd}},zr=async t=>{try{let n=We(t),r=await ne(n.chainId,n.address,e.config.apiEndpoint,W());return typeof r.decimals==`number`?r:null}catch{return null}};s(f(()=>e.config.locale,e=>{e&&x.setLocale(e)})),s(f(()=>e.config.recipient,e=>{I.setRecipient(e??null)})),s(f(()=>e.config.fiatCurrency,e=>{e&&mn(e)})),s(f([()=>e.config.amount,K],([e,t])=>{let n=e??``;I.setInputAmount(n),Un(t?``:n)}));let Br=0;s(f([()=>e.config.fromToken,()=>e.config.apiEndpoint],async([e])=>{let t=++Br;if(!e){I.setFromToken(null);return}let n=await zr(e);t===Br&&I.setFromToken(n)}));let Vr=0;s(f([()=>e.config.toToken,()=>e.config.apiEndpoint],async([e])=>{let t=++Vr;if(!e){I.setToToken(null);return}let n=await zr(e);t===Vr&&I.setToToken(n)}));let Hr=0;s(f([()=>e.config.toTokens,()=>e.config.apiEndpoint,jn],async([e])=>{let t=++Hr;if(!e?.length){kn([]);return}let n=await Promise.all(e.map(zr));t===Hr&&kn(n.filter(e=>!!e).map(Rr))}));let Ur=t=>{I.setInputAmount(t),e.callbacks?.onAmountChanged?.({amount:t,direction:`from`}),I.error()&&yn(),Hn(t)},Wr=e=>{Fn(e),I.error()&&yn()},Gr=e=>{let t={chainId:e.chainId,address:e.address??``,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd};L()===`from`?I.setFromToken(t):I.setToToken(t),R.hide()},Kr=()=>{if(er()||!I.fromToken()||!I.toToken())return;let e=I.fromToken(),t=I.toToken();i(()=>{I.setFromToken(t),I.setToToken(e),I.execPhase()===`success`&&I.setExecPhase(null)})},qr=()=>{let e=I.fromToken(),t=zn();if(!e||typeof e.decimals!=`number`||!t||t===`0`)return;let n=E(t,e.decimals);n&&n!==`0`&&Ur(n)},Jr=e=>`${e.slice(0,6)}...${e.slice(-4)}`,Q=a(()=>{let e=Yn();return!e||!I.fromToken()||!I.toToken()?null:X()===`quoting`||$n()?e:null}),Yr=a(()=>hn()===`quote`?I.error():null),Xr=a(()=>Z.errorSource()===`quote`?Z.error():null),Zr=a(()=>Z.phase()===`error`&&Z.errorSource()!==`quote`?Z.error():null),Qr=e=>e===`crypto`?Yr():e===`card`?Xr():null,$r=e=>{let t=Qr(e);return t?`${e}:${t}`:null},ei=a(()=>$r(M())),ti=e=>{let t=$r(e);return!!t&&t===_n()},ni=e=>!q()&&!!Qr(e)&&!ti(e),ri=a(()=>!!Q()&&!!I.fromToken()&&!!I.toToken()),ii=a(()=>!!Z.quote()),ai=e=>q()&&(e===`crypto`&&ri()||e===`card`&&ii()||!!Qr(e)),oi=e=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(e).catch(()=>void 0)},si=()=>{let e=ei();e&&vn(e),B.hide()},ci=e=>{e.target===e.currentTarget&&si()},li=e=>{e.key===`Escape`&&si()};s(()=>{B.open()&&!ai(M())&&B.hide()}),s(()=>{let e=ei();if(!e){vn(null);return}!q()||_n()===e||B.open()||B.show()});let ui=a(()=>{let t=e.config.titleText?.trim();return t&&t.length>0?t:`TokenFlight`}),di=a(()=>{let t=e.config.titleText?.trim();return!!t&&t.length>0}),fi=a(()=>{let t=e.config.titleImageUrl?.trim();return t&&t.length>0?t:null}),pi=a(()=>M()===`card`&&(Ar()||Z.phase()===`success`)),mi=a(()=>X()===`success`&&I.order()?`success`:er()?`tracking`:`form`),hi,$=_e({container:()=>hi,observeKey:()=>[mi(),M(),F.state(),F.transitionPages()?.incoming??``,F.transitionPages()?.outgoing??``,pi(),pi()?Z.phase():``,q(),e.config.hidePoweredBy].join(`|`)});return(()=>{var i=jt(),a=i.firstChild;return b(e=>{hi=e},i),v(i,u(o,{get when(){return pi()},get children(){return u(o,{get when(){return S(()=>Z.phase()===`success`)()&&Z.orderStatus()},get fallback(){return u(fe,{get phase(){return Z.phase()},get status(){return Z.orderStatus()?.status??`pending_payment`},get strategy(){return Z.strategy()??Z.orderStatus()?.swapStrategy??`direct`},get fiatAmount(){return Z.fiatAmount()},get fiatCurrency(){return V()},get cryptoAmount(){return Or(Z.orderStatus()?.quotedCryptoAmount??Z.quote()?.cryptoAmount)},get targetToken(){return I.toToken()},get provider(){return Z.orderStatus()?.provider??Z.quote()?.provider??`transak`},get hideProvider(){return e.config.hideProvider},get transferTxHash(){return Z.orderStatus()?.fillTxHash??Z.orderStatus()?.transferTxHash},get failedReason(){return Z.orderStatus()?.failedReason??Z.orderStatus()?.errorReason},get apiBase(){return G()},get chainMap(){return jn()},onNewPurchase:()=>Z.handleNewPurchase(),onRetry:()=>Z.handleRetry()})},get children(){return u(_t,{get orderStatus(){return Z.orderStatus()},get fiatAmount(){return Z.fiatAmount()},get fiatCurrency(){return V()},get targetToken(){return I.toToken()},get tokenDecimals(){return Z.tokenDecimals()},get provider(){return Z.orderStatus()?.provider??`transak`},get apiBase(){return G()},get chainMap(){return jn()},onNewPurchase:()=>Z.handleNewPurchase()})}})}}),null),v(i,u(o,{get when(){return!pi()},get children(){return u(ge,{get current(){return mi()},views:{form:()=>[(()=>{var t=Ft(),n=t.firstChild,i=n.firstChild,a=i.firstChild;return v(n,u(o,{get when(){return nt()},get children(){var e=Mt(),t=e.firstChild;return C(e,`click`,Ct),C(t,`animationend`,N()===`idle`?void 0:wt),v(t,u(He,{size:16})),r(n=>{var r=`${T.backButton} ${k.headerBackButton}${rt()?` ${T.backButtonExiting}`:``}`,i=c({id:`1hzmxtu`,message:`Back`}),a=N()===`enter`?`${k.headerBackArrow} ${k[`headerBackArrow--enter`]}`:N()===`exit`?`${k.headerBackArrow} ${k[`headerBackArrow--exit`]}`:k.headerBackArrow,o=N()===`idle`?{display:`inline-flex`}:void 0,s=N();return r!==n.e&&w(e,n.e=r),i!==n.t&&y(e,`aria-label`,n.t=i),a!==n.a&&w(t,n.a=a),n.o=te(t,o,n.o),s!==n.i&&y(t,`data-nav-animation`,n.i=s),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),i),v(i,u(o,{get when(){return fi()},get fallback(){return u(o,{get when(){return!e.config.hideTitle},get children(){return u(dt,{size:22})}})},get children(){var t=Nt();return r(n=>{var r=fi(),i=ui(),a=`${k.headerLogoImage} ${e.config.hideTitle?k[`headerLogoImage--solo`]:``}`;return r!==n.e&&y(t,`src`,n.e=r),i!==n.t&&y(t,`alt`,n.t=i),a!==n.a&&w(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),a),v(a,u(o,{get when(){return di()},get fallback(){return[`Token`,(()=>{var e=Lt();return r(()=>w(e,k.headerTitleAccent)),e})()]},get children(){return ui()}})),v(t,u(o,{get when(){return S(()=>!!H())()&&U()},get children(){var t=Pt(),n=t.firstChild,i=n.nextSibling;return C(t,`click`,async()=>{e.walletAdapter?.openAccountModal?await e.walletAdapter.openAccountModal():e.callbacks?.onAccountModal?.()}),v(i,()=>Jr(U())),r(e=>{var r=k.headerRight,a=c({id:`xphk5n`,message:`Wallet account`}),o=k.walletDot,s=k.walletAddress;return r!==e.e&&w(t,e.e=r),a!==e.t&&y(t,`aria-label`,e.t=a),o!==e.a&&w(n,e.a=o),s!==e.o&&w(i,e.o=s),e},{e:void 0,t:void 0,a:void 0,o:void 0}),t}}),null),r(r=>{var o=k.header,s=k.headerLeft,c=`${k.headerBrand} ${k[`headerBrand--${xt()}`]}`,l=xt(),u=`${k.headerTitle} ${e.config.hideTitle?k[`headerTitle--hidden`]:``}`;return o!==r.e&&w(t,r.e=o),s!==r.t&&w(n,r.t=s),c!==r.a&&w(i,r.a=c),l!==r.o&&y(i,`data-header-brand-state`,r.o=l),u!==r.i&&w(a,r.i=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})(),(()=>{var i=It(),a=i.firstChild;return v(i,u(ke,{get page(){return M()},get state(){return F.state()},get transitionPages(){return F.transitionPages()},renderPage:i=>u(n,{get children(){return[u(t,{when:i===`entry`,get children(){return[(()=>{var e=Rt(),t=e.firstChild;return v(t,()=>c({id:`cgzgvn`,message:`Pay with`})),r(()=>w(e,k.payWithLabel)),e})(),u(Ve,{get hasCrypto(){return Fe()},get hasCard(){return Ie()},showExchange:!0,onSelectCrypto:()=>St(`crypto`),onSelectCard:()=>St(`card`)})]}}),u(t,{when:i!==`entry`,get children(){return[(()=>{var a=Jt(),s=a.firstChild,l=s.firstChild,d=l.firstChild,f=d.firstChild,p=l.nextSibling,m=p.nextSibling,g=m.firstChild,_=g.firstChild,b=g.nextSibling,x=b.nextSibling,te=x.firstChild,E=te.nextSibling;return v(f,()=>Ge(`youPay`,c({id:`17kq51m`,message:`You pay`}))),v(d,u(o,{get when(){return S(()=>!!(i===`crypto`&&H()))()&&Rn()},get children(){var e=zt(),t=e.firstChild,n=t.nextSibling;return v(t,()=>c({id:`y6jqu9`,message:`Balance: {fromBalance}`},{fromBalance:Rn()})),C(n,`click`,qr),v(n,()=>c({id:`7v6g6x`,message:`MAX`})),r(r=>{var i=k.panelHeaderRight,a=k.panelBalance,o=k.maxBtn;return i!==r.e&&w(e,r.e=i),a!==r.t&&w(t,r.t=a),o!==r.a&&w(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),null),v(l,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return[(()=>{var e=Ht();return v(e,u(yt,{get value(){return S(()=>!!K())()?Zn()??`0`:I.inputAmount()},onChange:Ur,get disabled(){return er()||K()}}),null),v(e,u(o,{get when(){return I.fromToken()},get fallback(){return(()=>{var e=rn(),t=e.firstChild;return C(e,`click`,e=>{A()||wn(`from`,e.currentTarget)}),v(t,()=>c({id:`zz4mrw`,message:`Select token`})),v(e,u(o,{get when(){return!A()},get children(){var e=Bt();return v(e,u(it,{size:14})),r(()=>w(e,k.caret)),e}}),null),r(n=>{var r=`${k.tokenBtn} ${k[`tokenBtn--select`]}`,i=k.tokenNameAccent;return r!==n.e&&w(e,n.e=r),i!==n.t&&w(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=Vt(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return C(e,`click`,e=>{A()||wn(`from`,e.currentTarget)}),v(t,u(Ke,{get symbol(){return I.fromToken().symbol??`?`},color:`#2775CA`,size:24,get logoURI(){return I.fromToken().logoURI}}),n),v(n,u(et,{size:10,get iconUrl(){return h(G(),I.fromToken().chainId)}})),v(i,()=>I.fromToken().symbol),v(e,u(o,{get when(){return!A()},get children(){var e=Bt();return v(e,u(it,{size:14})),r(()=>w(e,k.caret)),e}}),null),r(r=>{var a=`${k.tokenBtn}${A()?` ${k[`tokenBtn--locked`]}`:``}`,o=A()?void 0:`button`,s=k.tokenIconWrap,c=k.tokenChainDot,l=k.tokenName;return a!==r.e&&w(e,r.e=a),o!==r.t&&y(e,`role`,r.t=o),s!==r.a&&w(t,r.a=s),c!==r.o&&w(n,r.o=c),l!==r.i&&w(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),r(()=>w(e,k.panelRow)),e})(),(()=>{var e=Rt(),t=e.firstChild;return v(t,()=>ir()??` `),r(n=>{var r=k.panelFooter,i=`${k.fiat} ${ir()?``:k[`fiat--hidden`]}`;return r!==n.e&&w(e,n.e=r),i!==n.t&&w(t,n.t=i),n},{e:void 0,t:void 0}),e})()]}}),u(t,{when:i===`card`,get children(){return[(()=>{var t=Ut(),n=t.firstChild,i=n.firstChild,a=i.nextSibling;return v(i,Er),C(a,`input`,e=>!K()&&Z.setFiatAmount(e.target.value)),v(t,u(Le,{get currencies(){return Tr()},get selected(){return V()},onSelect:mn,get locked(){return xr()},get locale(){return e.config.locale}}),null),r(e=>{var r=k.panelRow,o=O.fiatAmountWrap,s=O.fiatCurrencyPrefix,c=O.fiatAmountInput,l=K();return r!==e.e&&w(t,e.e=r),o!==e.t&&w(n,e.t=o),s!==e.a&&w(i,e.a=s),c!==e.o&&w(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r(()=>a.value=K()?Z.quote()?.fiatAmount??`0`:Z.fiatAmount()),t})(),(()=>{var e=Ht();return v(e,u(o,{get when(){return Z.quote()},get fallback(){return(()=>{var e=an();return r(()=>w(e,`${k.fiat} ${k[`fiat--hidden`]}`)),e})()},children:e=>(()=>{var t=Bt();return v(t,u(o,{get when(){return e().minFiatAmount},get children(){return[S(()=>c({id:`cx9lh3`,message:`Min`})),`: `,S(()=>Er()),S(()=>e().minFiatAmount)]}}),null),v(t,u(o,{get when(){return S(()=>!!e().minFiatAmount)()&&e().maxFiatAmount},children:` · `}),null),v(t,u(o,{get when(){return e().maxFiatAmount},get children(){return[S(()=>c({id:`gtvgs9`,message:`Max`})),`: `,S(()=>Er()),S(()=>e().maxFiatAmount)]}}),null),r(()=>w(t,`${O.fiatLimitsText}${kr()?` ${O.fiatLimitsError}`:``}`)),t})()})),r(()=>w(e,k.panelFooter)),e})()]}})]}}),null),v(p,u(o,{get when(){return S(()=>!e.hideSwapArrow&&i===`crypto`)()&&!j()},get children(){var e=Wt();return C(e,`click`,Kr),v(e,u(Qe,{size:13})),r(t=>{var n=k.swapArrowCircle,r=c({id:`2eikro`,message:`Swap tokens`});return n!==t.e&&w(e,t.e=n),r!==t.t&&y(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}})),v(_,()=>Ge(`youReceive`,c({id:`va18uh`,message:`You receive`}))),v(g,u(o,{get when(){return i===`card`||I.toToken()&&H()},get children(){var e=Gt(),t=e.firstChild;return C(e,`click`,()=>!Gn()&&z.show()),v(t,(()=>{var e=S(()=>!!(i===`card`?br():Pn()));return()=>e()?Jr(i===`card`?br():Pn()):c({id:`fpand1`,message:`Enter destination address`})})()),v(e,u(o,{get when(){return!Gn()},get children(){return u(Xe,{size:10})}}),null),r(n=>{var r=`${T.recipientBadge} ${(i===`card`?br():Pn())?``:T.recipientBadgeEmpty}${Gn()?` ${T.recipientBadgeLocked}`:``}`,a=Gn(),o=T.recipientBadgeText;return r!==n.e&&w(e,n.e=r),a!==n.t&&(e.disabled=n.t=a),o!==n.a&&w(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),null),v(b,u(o,{get when(){return!(i===`crypto`?tr():Z.phase()===`quoting`)},get fallback(){return(()=>{var e=on();return r(()=>w(e,T.skeleton)),e})()},get children(){var e=Kt();return v(e,u(Ne,{get value(){return Fr()||`0`},digits:8})),r(()=>w(e,`${vt.amount} ${Ir()?``:vt.muted}`)),e}}),null),v(b,u(o,{get when(){return I.toToken()},get fallback(){return(()=>{var e=rn(),t=e.firstChild;return C(e,`click`,e=>{j()||wn(`to`,e.currentTarget)}),v(t,()=>c({id:`zz4mrw`,message:`Select token`})),v(e,u(o,{get when(){return!j()},get children(){var e=Bt();return v(e,u(it,{size:14})),r(()=>w(e,k.caret)),e}}),null),r(n=>{var r=`${k.tokenBtn} ${k[`tokenBtn--select`]}`,i=k.tokenNameAccent;return r!==n.e&&w(e,n.e=r),i!==n.t&&w(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=Vt(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return C(e,`click`,e=>{j()||wn(`to`,e.currentTarget)}),v(t,u(Ke,{get symbol(){return I.toToken().symbol??`?`},color:`#0052FF`,size:24,get logoURI(){return I.toToken().logoURI}}),n),v(n,u(et,{size:10,get iconUrl(){return h(G(),I.toToken().chainId)}})),v(i,()=>I.toToken().symbol),v(e,u(o,{get when(){return!j()},get children(){var e=Bt();return v(e,u(it,{size:14})),r(()=>w(e,k.caret)),e}}),null),r(r=>{var a=`${k.tokenBtn}${j()?` ${k[`tokenBtn--locked`]}`:``}`,o=j()?void 0:`button`,s=k.tokenIconWrap,c=k.tokenChainDot,l=k.tokenName;return a!==r.e&&w(e,r.e=a),o!==r.t&&y(e,`role`,r.t=o),s!==r.a&&w(t,r.a=s),c!==r.o&&w(n,r.o=c),l!==r.i&&w(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),v(te,()=>Lr()??` `),v(E,u(o,{get when(){return i===`crypto`&&X()===`quoted`},get children(){return u(he,{secondsRemaining:mr,totalSeconds:30,onRefresh:()=>J.refetch(),isRefreshing:()=>J.isFetching})}}),null),v(E,u(o,{get when(){return i===`card`&&Z.phase()===`quoted`},get children(){return u(he,{get secondsRemaining(){return vr.countdownSeconds},totalSeconds:30,onRefresh:()=>{Z.refetchQuote(),vr.resetCountdown()},get isRefreshing(){return Z.isQuoteFetching}})}}),null),v(E,u(o,{get when(){return ai(i)},get children(){var e=qt();return C(e,`click`,()=>B.show()),v(e,u(lt,{size:13})),r(t=>{var n=k.quoteDetailsTrigger,r=c({id:`tbygoy`,message:`View quote details`});return n!==t.e&&w(e,t.e=n),r!==t.t&&y(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}}),null),r(e=>{var t=k.panelWrapper,n=fn()?`5`:void 0,r=k.mergedPanel,i=k.mergedSection,o=k.panelHeader,c=k.panelLabel,u=k.panelDivider,h=k.mergedSection,v=k.panelHeader,y=k.panelLabel,S=k.panelRow,C=k.panelFiatRow,T=`${k.fiat} ${Lr()?``:k[`fiat--hidden`]}`,ne=k.quotePanelActions;return t!==e.e&&w(a,e.e=t),n!==e.t&&ee(a,`z-index`,e.t=n),r!==e.a&&w(s,e.a=r),i!==e.o&&w(l,e.o=i),o!==e.i&&w(d,e.i=o),c!==e.n&&w(f,e.n=c),u!==e.s&&w(p,e.s=u),h!==e.h&&w(m,e.h=h),v!==e.r&&w(g,e.r=v),y!==e.d&&w(_,e.d=y),S!==e.l&&w(b,e.l=S),C!==e.u&&w(x,e.u=C),T!==e.c&&w(te,e.c=T),ne!==e.w&&w(E,e.w=ne),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0}),a})(),u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return[u(o,{get when(){return S(()=>!!ni(i))()&&Yr()},children:e=>u(cn,{get message(){return e()},variant:`crypto`,onCopy:oi})}),u(o,{get when(){return S(()=>!q())()&&tr()},get children(){var e=Ht();return v(e,u(xe,{})),r(()=>w(e,T.fadeIn)),e}}),u(o,{get when(){return S(()=>!!(!q()&&Q()&&I.fromToken()))()&&I.toToken()},get children(){var e=Yt();return v(e,u(ve,{get route(){return Q()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},inline:!0})),r(()=>w(e,De.quote)),e}}),u(o,{get when(){return S(()=>!!Qn())()&&!tr()},get children(){var e=Xt(),t=e.firstChild;return v(t,()=>c({id:`ln9xiv`,message:`No routes available`})),r(n=>{var r=`${q()?k.compactQuoteStatus:k.noRoutesCard} ${T.fadeIn}`,i=T.noOfferText;return r!==n.e&&w(e,n.e=r),i!==n.t&&w(t,n.t=i),n},{e:void 0,t:void 0}),e}}),u(o,{get when(){return S(()=>!q()&&!Yr()&&!tr()&&!Q())()&&!Qn()},get children(){var e=Zt(),t=e.firstChild,n=t.nextSibling;return v(t,u(Qe,{size:16})),v(n,()=>c({id:`1olegnl`,message:`Enter amount to get started`})),r(r=>{var i=`${O.quoteCardSlotCard} ${k.idleCardInline} ${T.fadeIn}`,a=T.idleIcon,o=T.idleTitle;return i!==r.e&&w(e,r.e=i),a!==r.t&&w(t,r.t=a),o!==r.a&&w(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})]}}),u(t,{get when(){return S(()=>!!(yr()&&!Xr()))()&&!q()},get children(){var e=Qt(),t=e.firstChild,n=t.nextSibling,i=n.nextSibling;return v(t,u(ze,{size:20})),v(n,()=>c({id:`fpand1`,message:`Enter destination address`})),v(i,()=>c({id:`19ne1ha`,message:`Connect wallet or enter an address to get a quote`})),r(r=>{var a=`${O.quoteCardSlotCard} ${k.recipientGateCard} ${T.fadeIn}`,o=T.idleIcon,s=T.idleTitle,c=T.idleSub;return a!==r.e&&w(e,r.e=a),o!==r.t&&w(t,r.t=o),s!==r.a&&w(n,r.a=s),c!==r.o&&w(i,r.o=c),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),u(t,{get when(){return S(()=>!!(i===`card`&&ni(i)))()&&Xr()},children:e=>u(cn,{get message(){return e()},variant:`card`,onCopy:oi})}),u(t,{get when(){return S(()=>i===`card`&&Z.phase()!==`error`)()&&!q()},get children(){return u(ht,{fiatCheckout:Z,fiatCountdown:vr,get targetToken(){return I.toToken()??null},get fiatCurrency(){return V()},get apiBase(){return G()},get showPayAmount(){return K()},hideCountdown:!0,onCompareProviders:()=>ln.show()})}})]}}),u(o,{get when(){return i===`card`&&Zr()},children:e=>(()=>{var t=sn(),n=t.firstChild,i=n.firstChild;return v(i,e),r(e=>{var r=O.errorSlot,a=O.errorArea,o=O.errorText;return r!==e.e&&w(t,e.e=r),a!==e.t&&w(n,e.t=a),o!==e.a&&w(i,e.a=o),e},{e:void 0,t:void 0,a:void 0}),t})()}),(()=>{var e=nn();return v(e,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return u(Ee,{get phase(){return X()},get isConnected(){return H()},get hasQuote(){return $n()},onConnect:bn,onConfirm:dr,onRetry:hr,get errorLabel(){return S(()=>hn()===`quote`)()?c({id:`1w68n16`,message:`Try Again`}):I.error()??void 0},get needsRecipient(){return Mn()},onEnterRecipient:()=>z.show(),get insufficientBalance(){return Bn()}})}}),u(t,{when:i===`card`,get children(){return u(n,{get children(){return[u(t,{get when(){return Z.phase()===`error`},get children(){var e=$t();return C(e,`click`,Pr),v(e,Mr),r(()=>w(e,D.btnError)),e}}),u(t,{get when(){return jr()},get children(){var e=en(),t=e.firstChild,n=t.firstChild;return v(t,Mr,null),r(r=>{var i=`${D.btnPrimary} ${D.executing}`,a=D.btnInner,o=D.spinner;return i!==r.e&&w(e,r.e=i),a!==r.t&&w(t,r.t=a),o!==r.a&&w(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return S(()=>!I.toToken())()&&(!!Z.fiatAmount()||K())},get children(){var e=$t();return C(e,`click`,e=>{xn(e.currentTarget),Dt(`to`),R.show()}),v(e,()=>c({id:`zz4mrw`,message:`Select token`})),r(()=>w(e,D.btnRecipient)),e}}),u(t,{get when(){return yr()},get children(){var e=$t();return C(e,`click`,()=>z.show()),v(e,()=>c({id:`wx5bee`,message:`Enter Recipient Address`})),r(()=>w(e,D.btnRecipient)),e}}),u(t,{get when(){return Nr()},get children(){var e=$t();return C(e,`click`,Pr),v(e,Mr),r(()=>w(e,D.btnPrimary)),e}}),u(t,{when:!0,get children(){var e=tn();return v(e,Mr),r(()=>w(e,D.btnPrimary)),e}})]}})}})]}})),r(()=>w(e,T.ctaWrapper)),e})()]}})]}})}),a),v(a,u(o,{get when(){return!e.config.hidePoweredBy},get children(){return u(st,{})}})),r(t=>{var n=`${k.methodFrame}${q()?` ${k[`methodFrame--compact`]}`:``}${e.config.hidePoweredBy?` ${k[`methodFrame--footerHidden`]}`:``}`,r=q()?`hidden`:`visible`,o=e.config.hidePoweredBy?`hidden`:`visible`,s=`${T.footerSlot} ${k.methodFooterSlot}`,c=e.config.hidePoweredBy?`true`:`false`;return n!==t.e&&w(i,t.e=n),r!==t.t&&y(i,`data-quote-card-frame`,t.t=r),o!==t.a&&y(i,`data-powered-footer-frame`,t.a=o),s!==t.o&&w(a,t.o=s),c!==t.i&&y(a,`data-powered-footer-hidden`,t.i=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i})()],tracking:()=>u(Me,{get order(){return I.order()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},get providerName(){return sr()},get providerIcon(){return cr()},get hideProvider(){return e.config.hideProvider},get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return I.inputAmount()},get outputAmount(){return Xn()},onNewSwap:pr,onRetry:fr,get executionError(){return lr()},mode:`swap`,get phase(){return X()},get failedPhase(){return ur()},get chainMap(){return jn()}}),success:()=>u(be,{get order(){return I.order()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},onNewSwap:pr,get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return sr()},mode:`swap`,get chainMap(){return jn()}})}})}}),null),v(i,u(o,{get when(){return R.mounted()},get children(){return u(we,{get selectingFor(){return L()},onClose:Cn,get noBorder(){return e.config.noBorder},get dismissing(){return R.dismissing()},get children(){return u(l,{get fallback(){return u(pe,{get selectingFor(){return L()},onClose:Cn})},get children(){return u(me,{get client(){return W()},get walletAddress(){return U()},get selectingFor(){return L()},onSelect:Gr,onClose:Cn,get supportedChainIds(){return e.walletAdapter?.supportedChainIds},get allowedTokens(){return S(()=>L()===`from`)()?En():Dn()},get tokens(){return S(()=>!!(L()===`to`&&On().length))()?On():void 0},get noBorder(){return e.config.noBorder},get dismissing(){return R.dismissing()}})}})}})}}),null),v(i,u(o,{get when(){return S(()=>!!z.mounted())()&&I.toToken()},get children(){var e=Ot();return v(e,u(Oe,{get initialValue(){return I.recipient()??Nn()??``},get chainType(){return le(I.toToken().chainId)},onConfirm:e=>{Wr(e),z.hide()},onClose:()=>z.hide(),get dismissing(){return z.dismissing()}})),r(()=>w(e,`${T.selectorOverlay}${z.dismissing()?` ${T.selectorOverlayDismissing}`:``}`)),e}}),null),v(i,u(o,{get when(){return B.mounted()},get children(){var e=At(),i=e.firstChild,a=i.firstChild,o=a.nextSibling;return C(e,`keydown`,li),C(e,`click`,ci),C(a,`click`,si),v(a,u(pt,{size:17})),v(o,u(n,{get children(){return[u(t,{get when(){return Qr(M())},children:e=>u(cn,{get message(){return e()},variant:`sheet`,onCopy:oi,get onRetry(){return S(()=>M()===`card`)()?Z.handleRetry:hr}})}),u(t,{get when(){return S(()=>!!(M()===`crypto`&&Q()&&I.fromToken()))()&&I.toToken()},get children(){var e=kt(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return v(n,()=>c({id:`1nvxkfy`,message:`Route`})),v(i,()=>Q().routeId),v(e,u(ve,{get route(){return Q()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},inline:!0}),null),r(n=>{var r=k.quoteDetailsCard,a=k.quoteDetailsMetaRow,o=k.quoteDetailsMetaValue;return r!==n.e&&w(e,n.e=r),a!==n.t&&w(t,n.t=a),o!==n.a&&w(i,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return S(()=>M()===`card`)()&&Z.quote()},get children(){return u(ht,{fiatCheckout:Z,fiatCountdown:vr,get targetToken(){return I.toToken()??null},get fiatCurrency(){return V()},get apiBase(){return G()},get showPayAmount(){return K()},hideCountdown:!0,margin:`0`,height:`auto`,onCompareProviders:()=>ln.show()})}})]}})),r(t=>{var n=`${T.selectorOverlay}${B.dismissing()?` ${T.selectorOverlayDismissing}`:``}`,r=`${k.quoteDetailsSheet}${B.dismissing()?` ${k[`quoteDetailsSheet--dismissing`]}`:``}`,s=c({id:`1tn6f91`,message:`Quote details`}),l=k.quoteDetailsClose,u=c({id:`1l0xxoj`,message:`Close`}),d=k.quoteDetailsBody;return n!==t.e&&w(e,t.e=n),r!==t.t&&w(i,t.t=r),s!==t.a&&y(i,`aria-label`,t.a=s),l!==t.o&&w(a,t.o=l),u!==t.i&&y(a,`aria-label`,t.i=u),d!==t.n&&w(o,t.n=d),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e}}),null),v(i,u(o,{get when(){return ln.mounted()},get children(){var e=Ot();return v(e,u(Tt,{get quotes(){return Z.allQuotes()},get selectedProviderId(){return Z.selectedProviderId()},get fiatCurrency(){return V()},get apiBase(){return G()},get tokenDecimals(){return Dr()},get targetSymbol(){return I.toToken()?.symbol??``},get countdownSeconds(){return vr.countdownSeconds},totalCountdownSeconds:30,onRefresh:()=>{Z.refetchQuote(),vr.resetCountdown()},get isRefreshing(){return Z.isQuoteFetching},onSelect:e=>{Z.setSelectedProvider(e),ln.hide()},onClose:()=>ln.hide()})),r(()=>w(e,`${T.selectorOverlay}${ln.dismissing()?` ${T.selectorOverlayDismissing}`:``}`)),e}}),null),r(t=>{var n=`${T.container}${q()?` ${k.quoteCardHiddenContainer}`:``}${$.state()===`animating`?` ${k.swapContainerAnimating}`:``}${e.config.noBackground?` ${T.noBg}`:``}${e.config.noBorder?` ${T.noBorder}`:``}`,r=$.state(),o=$.state(),s=q()?`hidden`:`visible`,c=T.accentLine;return n!==t.e&&w(i,t.e=n),r!==t.t&&y(i,`data-swap-container-transition`,t.t=r),o!==t.a&&y(i,`data-height-transition-state`,t.a=o),s!==t.o&&y(i,`data-quote-card`,t.o=s),c!==t.i&&w(a,t.i=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i})()}export{R as SwapComponent};
@@ -1,3 +1,3 @@
1
- import{_ as e,b as t,v as n,x as r,y as i}from"./shared.module-C-kWMzqW.js";function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class extends Error{constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),c(this,`response`,void 0),c(this,`request`,void 0),c(this,`options`,void 0),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},u=class extends Error{constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),c(this,`name`,`NonError`),c(this,`value`,void 0),this.value=e}},d=class extends Error{constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new u(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),c(this,`name`,`ForceRetryError`),c(this,`customDelay`,void 0),c(this,`code`,void 0),c(this,`customRequest`,void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},f=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),p=typeof globalThis.AbortController==`function`,m=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,h=typeof globalThis.ReadableStream==`function`,g=typeof globalThis.FormData==`function`,_=[`get`,`post`,`put`,`patch`,`head`,`delete`],ee={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},v=2147483647,te=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,y=Symbol(`stop`),b=class{constructor(e){c(this,`options`,void 0),this.options=e}},ne=e=>new b(e),re={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},ie={next:!0},ae={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},oe=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=te,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},x=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},se=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(x(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},ce=(e,t,n)=>{if(!e.body)return e;let r=oe(n??e.body);return new Request(e,{duplex:`half`,body:x(e.body,r,t)})},S=e=>typeof e==`object`&&!!e,C=(...e)=>{for(let t of e)if((!S(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return D({},...e)},w=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function T(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:D(e[n]??[],t[n]??[])}var E=(e={},t={})=>({beforeRequest:T(e,t,`beforeRequest`),beforeRetry:T(e,t,`beforeRetry`),afterResponse:T(e,t,`afterResponse`),beforeError:T(e,t,`beforeError`)}),le=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(S(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},D=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(S(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!S(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:le(i,n);continue}S(n)&&e in t&&(n=D(t[e],n)),t={...t,[e]:n}}S(o.hooks)&&(r=E(r,o.hooks),t.hooks=r),S(o.headers)&&(n=w(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:m?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},ue=e=>_.includes(e)?e.toUpperCase():e,O={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},de=(e={})=>{if(typeof e==`number`)return{...O,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&(e.methods=e.methods.map(e=>e.toLowerCase())),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...O,...t}},k=class extends Error{constructor(e){super(`Request timed out: ${e.method} ${e.url}`),c(this,`request`,void 0),this.name=`TimeoutError`,this.request=e}};async function fe(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new k(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function pe(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}var me=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in ae)&&!(r in re)&&(!(r in e)||r in ie)&&(n[r]=t[r]);return n},he=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function ge(e){return e instanceof l||e?.name===l.name}function _e(e){return e instanceof k||e?.name===k.name}var A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakSet,R=class a{static create(e,t){let r=new a(e,t),o=i(L,r,U).call(r,async()=>{if(typeof n(N,r).timeout==`number`&&n(N,r).timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${v}`);await Promise.resolve();let e=await i(L,r,be).call(r);for(let t of n(N,r).hooks.afterResponse){let a=i(L,r,B).call(r,e.clone()),o;try{o=await t(r.request,i(L,r,W).call(r),a,{retryCount:n(j,r)})}catch(t){throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),t}if(o instanceof b)throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),new d(o.options);let s=o instanceof globalThis.Response?o:e;a!==s&&i(L,r,H).call(r,a),e!==s&&i(L,r,H).call(r,e),e=s}if(i(L,r,B).call(r,e),!e.ok&&(typeof n(N,r).throwHttpErrors==`function`?n(N,r).throwHttpErrors(e.status):n(N,r).throwHttpErrors)){let t=new l(e,r.request,i(L,r,W).call(r));for(let e of n(N,r).hooks.beforeError)t=await e(t,{retryCount:n(j,r)});throw t}if(n(N,r).onDownloadProgress){if(typeof n(N,r).onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!h)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return i(L,r,H).call(r,e),se(t,n(N,r).onDownloadProgress)}return e}).finally(()=>{let e=n(P,r);i(L,r,V).call(r,e?.body??void 0),i(L,r,V).call(r,r.request.body??void 0)});for(let[e,n]of Object.entries(ee))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(o[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||n);let i=await o;if(e===`json`){if(i.status===204)return``;let e=await i.text();return e===``?``:t.parseJson?t.parseJson(e):JSON.parse(e)}return i[e]()});return o}constructor(o,s={}){if(r(this,L),c(this,`request`,void 0),t(this,A,void 0),t(this,j,0),t(this,M,void 0),t(this,N,void 0),t(this,P,void 0),t(this,F,void 0),t(this,I,void 0),e(M,this,o),e(N,this,{...s,headers:w(n(M,this).headers,s.headers),hooks:E({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:ue(s.method??n(M,this).method??`GET`),prefixUrl:String(s.prefixUrl||``),retry:de(s.retry),throwHttpErrors:s.throwHttpErrors??!0,timeout:s.timeout??1e4,fetch:s.fetch??globalThis.fetch.bind(globalThis),context:s.context??{}}),typeof n(M,this)!=`string`&&!(n(M,this)instanceof URL||n(M,this)instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(n(N,this).prefixUrl&&typeof n(M,this)==`string`){if(n(M,this).startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");n(N,this).prefixUrl.endsWith(`/`)||(n(N,this).prefixUrl+=`/`),e(M,this,n(N,this).prefixUrl+n(M,this))}p&&m&&(e(F,this,n(N,this).signal??n(M,this).signal),e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal),f&&(n(N,this).duplex=`half`),n(N,this).json!==void 0&&(n(N,this).body=n(N,this).stringifyJson?.(n(N,this).json)??JSON.stringify(n(N,this).json),n(N,this).headers.set(`content-type`,n(N,this).headers.get(`content-type`)??`application/json`));let l=s.headers&&new globalThis.Headers(s.headers).has(`content-type`);if(n(M,this)instanceof globalThis.Request&&(g&&n(N,this).body instanceof globalThis.FormData||n(N,this).body instanceof URLSearchParams)&&!l&&n(N,this).headers.delete(`content-type`),this.request=new globalThis.Request(n(M,this),n(N,this)),he(n(N,this).searchParams)){let e=`?`+(typeof n(N,this).searchParams==`string`?n(N,this).searchParams.replace(/^\?/,``):new URLSearchParams(ve.call(a,n(N,this).searchParams)).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);this.request=new globalThis.Request(t,n(N,this))}if(n(N,this).onUploadProgress){if(typeof n(N,this).onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!f)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=i(L,this,K).call(this,this.request,n(N,this).body??void 0)}}};function ve(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}function z(){let e=n(N,this).retry.delay(n(j,this)),t=e;n(N,this).retry.jitter===!0?t=Math.random()*e:typeof n(N,this).retry.jitter==`function`&&(t=n(N,this).retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let r=n(N,this).retry.backoffLimit??1/0;return Math.min(r,t)}async function ye(t){var r;if(e(j,this,(r=n(j,this),r++,r)),n(j,this)>n(N,this).retry.limit)throw t;let a=t instanceof Error?t:new u(t);if(a instanceof d)return a.customDelay??i(L,this,z).call(this);if(!n(N,this).retry.methods.includes(this.request.method.toLowerCase()))throw t;if(n(N,this).retry.shouldRetry!==void 0){let e=await n(N,this).retry.shouldRetry({error:a,retryCount:n(j,this)});if(e===!1)throw t;if(e===!0)return i(L,this,z).call(this)}if(_e(t)&&!n(N,this).retry.retryOnTimeout)throw t;if(ge(t)){if(!n(N,this).retry.statusCodes.includes(t.response.status))throw t;let e=t.response.headers.get(`Retry-After`)??t.response.headers.get(`RateLimit-Reset`)??t.response.headers.get(`X-RateLimit-Retry-After`)??t.response.headers.get(`X-RateLimit-Reset`)??t.response.headers.get(`X-Rate-Limit-Reset`);if(e&&n(N,this).retry.afterStatusCodes.includes(t.response.status)){let t=Number(e)*1e3;Number.isNaN(t)?t=Date.parse(e)-Date.now():t>=Date.parse(`2024-01-01`)&&(t-=Date.now());let r=n(N,this).retry.maxRetryAfter??t;return t<r?t:r}if(t.response.status===413)throw t}return i(L,this,z).call(this)}function B(e){return n(N,this).parseJson&&(e.json=async()=>n(N,this).parseJson(await e.text())),e}function V(e){e&&e.cancel().catch(()=>void 0)}function H(e){i(L,this,V).call(this,e.body??void 0)}async function U(e){try{return await e()}catch(t){let r=Math.min(await i(L,this,ye).call(this,t),v);if(n(j,this)<1)throw t;if(await pe(r,n(F,this)?{signal:n(F,this)}:{}),t instanceof d&&t.customRequest){let e=n(N,this).signal?new globalThis.Request(t.customRequest,{signal:n(N,this).signal}):new globalThis.Request(t.customRequest);i(L,this,G).call(this,e)}for(let e of n(N,this).hooks.beforeRetry){let r=await e({request:this.request,options:i(L,this,W).call(this),error:t,retryCount:n(j,this)});if(r instanceof globalThis.Request){i(L,this,G).call(this,r);break}if(r instanceof globalThis.Response)return r;if(r===y)return}return i(L,this,U).call(this,e)}}async function be(){n(A,this)?.signal.aborted&&(e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal,this.request=new globalThis.Request(this.request,{signal:n(N,this).signal}));for(let e of n(N,this).hooks.beforeRequest){let t=await e(this.request,i(L,this,W).call(this),{retryCount:n(j,this)});if(t instanceof Response)return t;if(t instanceof globalThis.Request){i(L,this,G).call(this,t);break}}let t=me(this.request,n(N,this));return e(P,this,this.request),this.request=n(P,this).clone(),n(N,this).timeout===!1?n(N,this).fetch(n(P,this),t):fe(n(P,this),t,n(A,this),n(N,this))}function W(){if(!n(I,this)){let{hooks:t,...r}=n(N,this);e(I,this,Object.freeze(r))}return n(I,this)}function G(t){e(I,this,void 0),this.request=i(L,this,K).call(this,t)}function K(e,t){return!n(N,this).onUploadProgress||!e.body?e:ce(e,n(N,this).onUploadProgress,t??n(N,this).body??void 0)}var q=e=>{let t=(t,n)=>R.create(t,C(e,n));for(let n of _)t[n]=(t,r)=>R.create(t,C(e,r,{method:n}));return t.create=e=>q(C(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),q(C(e,t))),t.stop=y,t.retry=ne,t},xe=q(),J={API_REQUEST_FAILED:`TF3001`,API_TIMEOUT:`TF3002`,API_INVALID_RESPONSE:`TF3003`,QUOTE_FAILED:`TF3004`,QUOTE_EXPIRED:`TF3005`,DEPOSIT_BUILD_FAILED:`TF3006`,DEPOSIT_SUBMIT_FAILED:`TF3007`,ORDER_FAILED:`TF3008`,API_ABORTED:`TF3009`,FIAT_QUOTE_FAILED:`TF6001`,FIAT_ORDER_FAILED:`TF6002`,FIAT_STATUS_FAILED:`TF6003`,FIAT_PROVIDER_ERROR:`TF6004`,FIAT_AMOUNT_OUT_OF_RANGE:`TF6005`,FIAT_POPUP_BLOCKED:`TF6006`,FIAT_CHECKOUT_UNAVAILABLE:`TF6007`},Y={[J.API_REQUEST_FAILED]:`API request failed`,[J.API_TIMEOUT]:`API request timed out`,[J.API_INVALID_RESPONSE]:`Invalid API response`,[J.QUOTE_FAILED]:`Failed to get quote`,[J.QUOTE_EXPIRED]:`Quote has expired`,[J.DEPOSIT_BUILD_FAILED]:`Failed to build deposit transaction`,[J.DEPOSIT_SUBMIT_FAILED]:`Failed to submit deposit`,[J.ORDER_FAILED]:`Order processing failed`,[J.API_ABORTED]:`Request was aborted`,[J.FIAT_QUOTE_FAILED]:`Failed to get fiat quote`,[J.FIAT_ORDER_FAILED]:`Failed to create fiat order`,[J.FIAT_STATUS_FAILED]:`Failed to get fiat order status`,[J.FIAT_PROVIDER_ERROR]:`Fiat provider error`,[J.FIAT_AMOUNT_OUT_OF_RANGE]:`Fiat amount is out of range`,[J.FIAT_POPUP_BLOCKED]:`Payment popup was blocked by the browser`,[J.FIAT_CHECKOUT_UNAVAILABLE]:`Fiat checkout requires a browser window`},X=class extends Error{constructor(e,t,n){let r=typeof t==`string`?t:t instanceof Error||typeof t==`object`&&t&&`message`in t&&typeof t.message==`string`?t.message:Y[e]??`Unknown error`;super(r),this.name=`TokenFlightError`,this.code=e,this.details=n}},Se=class extends X{constructor(e,t){super(J.API_TIMEOUT,e,t),this.name=`ApiTimeoutError`}},Z=class extends X{constructor(e,t){super(J.API_ABORTED,e,t),this.name=`ApiAbortedError`}},Q=class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`ApiValidationError`}},Ce={ValidationException:Q,ZodValidationException:Q,BadRequestException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`BadRequestError`}},QuoteNotFoundException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`QuoteNotFoundError`}},QuoteExpiredException:class extends X{constructor(e,t){super(J.QUOTE_EXPIRED,e,t),this.name=`QuoteExpiredError`}},CannotFillException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`CannotFillError`}},NotSupportedTokenException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedTokenError`}},NotSupportedChainException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedChainError`}},NotSupportedDepositMethodException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`NotSupportedDepositMethodError`}},UnexpectedFromAddressException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`UnexpectedFromAddressError`}},IntentNotFoundException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`IntentNotFoundError`}},DuplicateRecordException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`DuplicateRecordError`}},BroadcastException:class extends X{constructor(e,t){super(J.DEPOSIT_SUBMIT_FAILED,e,t),this.name=`BroadcastError`}},InternalErrorException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`InternalServerError`}}};function we(e,t,n){if(typeof e==`object`&&e){let r=e,i=typeof r.name==`string`?r.name:null,a=typeof r.message==`string`?r.message:t;if(i&&Ce[i]){let t=Ce[i];return new t(a,n??e)}return new X(J.API_REQUEST_FAILED,a,n??e)}return new X(J.API_REQUEST_FAILED,t,n)}function Te(e){return xe.create({prefixUrl:e.baseUrl,timeout:e.timeout??15e3,retry:0,...e.fetch?{fetch:e.fetch}:{},headers:{"X-TF-SDK-Version":De(),...e.headers}})}function Ee(e){return e.replace(/\/$/,``)}function De(){return`0.3.0-rc.2`}async function Oe(e,t){try{return await e}catch(e){if(e instanceof X)throw e;if(e instanceof k)throw new Se(t.timeoutMessage,e);if(e instanceof DOMException&&e.name===`AbortError`)throw new Z(`Request was aborted`,e);if(e instanceof l){let n=``;try{n=await e.response.json()}catch{n=await e.response.text().catch(()=>``)}let r=`${t.failureMessage}: ${e.response.status} ${e.response.statusText}`;throw we(n,r,{status:e.response.status,body:n})}throw new X(J.API_REQUEST_FAILED,`${t.failureMessage}: ${String(e)}`,e)}}async function*ke(e){if(!e.ok){let t=``;try{t=await e.json()}catch{t=await e.text().catch(()=>``)}throw we(t,`API request failed: ${e.status} ${e.statusText}`,{status:e.status,body:t})}if(!e.body)throw new X(J.API_INVALID_RESPONSE,`Streaming response has no body`);let t=e.body.getReader(),n=new TextDecoder(`utf-8`),r=``;try{for(;;){let{value:e,done:i}=await t.read();e&&(r+=n.decode(e,{stream:!0}));let a=r.indexOf(`
1
+ import{_ as e,b as t,v as n,x as r,y as i}from"./shared.module-2EeBIMep.js";function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class extends Error{constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),c(this,`response`,void 0),c(this,`request`,void 0),c(this,`options`,void 0),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},u=class extends Error{constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),c(this,`name`,`NonError`),c(this,`value`,void 0),this.value=e}},d=class extends Error{constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new u(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),c(this,`name`,`ForceRetryError`),c(this,`customDelay`,void 0),c(this,`code`,void 0),c(this,`customRequest`,void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},f=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),p=typeof globalThis.AbortController==`function`,m=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,h=typeof globalThis.ReadableStream==`function`,g=typeof globalThis.FormData==`function`,_=[`get`,`post`,`put`,`patch`,`head`,`delete`],ee={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},v=2147483647,te=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,y=Symbol(`stop`),b=class{constructor(e){c(this,`options`,void 0),this.options=e}},ne=e=>new b(e),re={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},ie={next:!0},ae={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},oe=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=te,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},x=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},se=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(x(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},ce=(e,t,n)=>{if(!e.body)return e;let r=oe(n??e.body);return new Request(e,{duplex:`half`,body:x(e.body,r,t)})},S=e=>typeof e==`object`&&!!e,C=(...e)=>{for(let t of e)if((!S(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return D({},...e)},w=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function T(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:D(e[n]??[],t[n]??[])}var E=(e={},t={})=>({beforeRequest:T(e,t,`beforeRequest`),beforeRetry:T(e,t,`beforeRetry`),afterResponse:T(e,t,`afterResponse`),beforeError:T(e,t,`beforeError`)}),le=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(S(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},D=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(S(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!S(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:le(i,n);continue}S(n)&&e in t&&(n=D(t[e],n)),t={...t,[e]:n}}S(o.hooks)&&(r=E(r,o.hooks),t.hooks=r),S(o.headers)&&(n=w(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:m?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},ue=e=>_.includes(e)?e.toUpperCase():e,O={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},de=(e={})=>{if(typeof e==`number`)return{...O,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&(e.methods=e.methods.map(e=>e.toLowerCase())),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...O,...t}},k=class extends Error{constructor(e){super(`Request timed out: ${e.method} ${e.url}`),c(this,`request`,void 0),this.name=`TimeoutError`,this.request=e}};async function fe(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new k(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function pe(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}var me=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in ae)&&!(r in re)&&(!(r in e)||r in ie)&&(n[r]=t[r]);return n},he=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function ge(e){return e instanceof l||e?.name===l.name}function _e(e){return e instanceof k||e?.name===k.name}var A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakSet,R=class a{static create(e,t){let r=new a(e,t),o=i(L,r,U).call(r,async()=>{if(typeof n(N,r).timeout==`number`&&n(N,r).timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${v}`);await Promise.resolve();let e=await i(L,r,be).call(r);for(let t of n(N,r).hooks.afterResponse){let a=i(L,r,B).call(r,e.clone()),o;try{o=await t(r.request,i(L,r,W).call(r),a,{retryCount:n(j,r)})}catch(t){throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),t}if(o instanceof b)throw i(L,r,H).call(r,a),i(L,r,H).call(r,e),new d(o.options);let s=o instanceof globalThis.Response?o:e;a!==s&&i(L,r,H).call(r,a),e!==s&&i(L,r,H).call(r,e),e=s}if(i(L,r,B).call(r,e),!e.ok&&(typeof n(N,r).throwHttpErrors==`function`?n(N,r).throwHttpErrors(e.status):n(N,r).throwHttpErrors)){let t=new l(e,r.request,i(L,r,W).call(r));for(let e of n(N,r).hooks.beforeError)t=await e(t,{retryCount:n(j,r)});throw t}if(n(N,r).onDownloadProgress){if(typeof n(N,r).onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!h)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return i(L,r,H).call(r,e),se(t,n(N,r).onDownloadProgress)}return e}).finally(()=>{let e=n(P,r);i(L,r,V).call(r,e?.body??void 0),i(L,r,V).call(r,r.request.body??void 0)});for(let[e,n]of Object.entries(ee))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(o[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||n);let i=await o;if(e===`json`){if(i.status===204)return``;let e=await i.text();return e===``?``:t.parseJson?t.parseJson(e):JSON.parse(e)}return i[e]()});return o}constructor(o,s={}){if(r(this,L),c(this,`request`,void 0),t(this,A,void 0),t(this,j,0),t(this,M,void 0),t(this,N,void 0),t(this,P,void 0),t(this,F,void 0),t(this,I,void 0),e(M,this,o),e(N,this,{...s,headers:w(n(M,this).headers,s.headers),hooks:E({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:ue(s.method??n(M,this).method??`GET`),prefixUrl:String(s.prefixUrl||``),retry:de(s.retry),throwHttpErrors:s.throwHttpErrors??!0,timeout:s.timeout??1e4,fetch:s.fetch??globalThis.fetch.bind(globalThis),context:s.context??{}}),typeof n(M,this)!=`string`&&!(n(M,this)instanceof URL||n(M,this)instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(n(N,this).prefixUrl&&typeof n(M,this)==`string`){if(n(M,this).startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");n(N,this).prefixUrl.endsWith(`/`)||(n(N,this).prefixUrl+=`/`),e(M,this,n(N,this).prefixUrl+n(M,this))}p&&m&&(e(F,this,n(N,this).signal??n(M,this).signal),e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal),f&&(n(N,this).duplex=`half`),n(N,this).json!==void 0&&(n(N,this).body=n(N,this).stringifyJson?.(n(N,this).json)??JSON.stringify(n(N,this).json),n(N,this).headers.set(`content-type`,n(N,this).headers.get(`content-type`)??`application/json`));let l=s.headers&&new globalThis.Headers(s.headers).has(`content-type`);if(n(M,this)instanceof globalThis.Request&&(g&&n(N,this).body instanceof globalThis.FormData||n(N,this).body instanceof URLSearchParams)&&!l&&n(N,this).headers.delete(`content-type`),this.request=new globalThis.Request(n(M,this),n(N,this)),he(n(N,this).searchParams)){let e=`?`+(typeof n(N,this).searchParams==`string`?n(N,this).searchParams.replace(/^\?/,``):new URLSearchParams(ve.call(a,n(N,this).searchParams)).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);this.request=new globalThis.Request(t,n(N,this))}if(n(N,this).onUploadProgress){if(typeof n(N,this).onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!f)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=i(L,this,K).call(this,this.request,n(N,this).body??void 0)}}};function ve(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}function z(){let e=n(N,this).retry.delay(n(j,this)),t=e;n(N,this).retry.jitter===!0?t=Math.random()*e:typeof n(N,this).retry.jitter==`function`&&(t=n(N,this).retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let r=n(N,this).retry.backoffLimit??1/0;return Math.min(r,t)}async function ye(t){var r;if(e(j,this,(r=n(j,this),r++,r)),n(j,this)>n(N,this).retry.limit)throw t;let a=t instanceof Error?t:new u(t);if(a instanceof d)return a.customDelay??i(L,this,z).call(this);if(!n(N,this).retry.methods.includes(this.request.method.toLowerCase()))throw t;if(n(N,this).retry.shouldRetry!==void 0){let e=await n(N,this).retry.shouldRetry({error:a,retryCount:n(j,this)});if(e===!1)throw t;if(e===!0)return i(L,this,z).call(this)}if(_e(t)&&!n(N,this).retry.retryOnTimeout)throw t;if(ge(t)){if(!n(N,this).retry.statusCodes.includes(t.response.status))throw t;let e=t.response.headers.get(`Retry-After`)??t.response.headers.get(`RateLimit-Reset`)??t.response.headers.get(`X-RateLimit-Retry-After`)??t.response.headers.get(`X-RateLimit-Reset`)??t.response.headers.get(`X-Rate-Limit-Reset`);if(e&&n(N,this).retry.afterStatusCodes.includes(t.response.status)){let t=Number(e)*1e3;Number.isNaN(t)?t=Date.parse(e)-Date.now():t>=Date.parse(`2024-01-01`)&&(t-=Date.now());let r=n(N,this).retry.maxRetryAfter??t;return t<r?t:r}if(t.response.status===413)throw t}return i(L,this,z).call(this)}function B(e){return n(N,this).parseJson&&(e.json=async()=>n(N,this).parseJson(await e.text())),e}function V(e){e&&e.cancel().catch(()=>void 0)}function H(e){i(L,this,V).call(this,e.body??void 0)}async function U(e){try{return await e()}catch(t){let r=Math.min(await i(L,this,ye).call(this,t),v);if(n(j,this)<1)throw t;if(await pe(r,n(F,this)?{signal:n(F,this)}:{}),t instanceof d&&t.customRequest){let e=n(N,this).signal?new globalThis.Request(t.customRequest,{signal:n(N,this).signal}):new globalThis.Request(t.customRequest);i(L,this,G).call(this,e)}for(let e of n(N,this).hooks.beforeRetry){let r=await e({request:this.request,options:i(L,this,W).call(this),error:t,retryCount:n(j,this)});if(r instanceof globalThis.Request){i(L,this,G).call(this,r);break}if(r instanceof globalThis.Response)return r;if(r===y)return}return i(L,this,U).call(this,e)}}async function be(){n(A,this)?.signal.aborted&&(e(A,this,new globalThis.AbortController),n(N,this).signal=n(F,this)?AbortSignal.any([n(F,this),n(A,this).signal]):n(A,this).signal,this.request=new globalThis.Request(this.request,{signal:n(N,this).signal}));for(let e of n(N,this).hooks.beforeRequest){let t=await e(this.request,i(L,this,W).call(this),{retryCount:n(j,this)});if(t instanceof Response)return t;if(t instanceof globalThis.Request){i(L,this,G).call(this,t);break}}let t=me(this.request,n(N,this));return e(P,this,this.request),this.request=n(P,this).clone(),n(N,this).timeout===!1?n(N,this).fetch(n(P,this),t):fe(n(P,this),t,n(A,this),n(N,this))}function W(){if(!n(I,this)){let{hooks:t,...r}=n(N,this);e(I,this,Object.freeze(r))}return n(I,this)}function G(t){e(I,this,void 0),this.request=i(L,this,K).call(this,t)}function K(e,t){return!n(N,this).onUploadProgress||!e.body?e:ce(e,n(N,this).onUploadProgress,t??n(N,this).body??void 0)}var q=e=>{let t=(t,n)=>R.create(t,C(e,n));for(let n of _)t[n]=(t,r)=>R.create(t,C(e,r,{method:n}));return t.create=e=>q(C(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),q(C(e,t))),t.stop=y,t.retry=ne,t},xe=q(),J={API_REQUEST_FAILED:`TF3001`,API_TIMEOUT:`TF3002`,API_INVALID_RESPONSE:`TF3003`,QUOTE_FAILED:`TF3004`,QUOTE_EXPIRED:`TF3005`,DEPOSIT_BUILD_FAILED:`TF3006`,DEPOSIT_SUBMIT_FAILED:`TF3007`,ORDER_FAILED:`TF3008`,API_ABORTED:`TF3009`,FIAT_QUOTE_FAILED:`TF6001`,FIAT_ORDER_FAILED:`TF6002`,FIAT_STATUS_FAILED:`TF6003`,FIAT_PROVIDER_ERROR:`TF6004`,FIAT_AMOUNT_OUT_OF_RANGE:`TF6005`,FIAT_POPUP_BLOCKED:`TF6006`,FIAT_CHECKOUT_UNAVAILABLE:`TF6007`},Y={[J.API_REQUEST_FAILED]:`API request failed`,[J.API_TIMEOUT]:`API request timed out`,[J.API_INVALID_RESPONSE]:`Invalid API response`,[J.QUOTE_FAILED]:`Failed to get quote`,[J.QUOTE_EXPIRED]:`Quote has expired`,[J.DEPOSIT_BUILD_FAILED]:`Failed to build deposit transaction`,[J.DEPOSIT_SUBMIT_FAILED]:`Failed to submit deposit`,[J.ORDER_FAILED]:`Order processing failed`,[J.API_ABORTED]:`Request was aborted`,[J.FIAT_QUOTE_FAILED]:`Failed to get fiat quote`,[J.FIAT_ORDER_FAILED]:`Failed to create fiat order`,[J.FIAT_STATUS_FAILED]:`Failed to get fiat order status`,[J.FIAT_PROVIDER_ERROR]:`Fiat provider error`,[J.FIAT_AMOUNT_OUT_OF_RANGE]:`Fiat amount is out of range`,[J.FIAT_POPUP_BLOCKED]:`Payment popup was blocked by the browser`,[J.FIAT_CHECKOUT_UNAVAILABLE]:`Fiat checkout requires a browser window`},X=class extends Error{constructor(e,t,n){let r=typeof t==`string`?t:t instanceof Error||typeof t==`object`&&t&&`message`in t&&typeof t.message==`string`?t.message:Y[e]??`Unknown error`;super(r),this.name=`TokenFlightError`,this.code=e,this.details=n}},Se=class extends X{constructor(e,t){super(J.API_TIMEOUT,e,t),this.name=`ApiTimeoutError`}},Z=class extends X{constructor(e,t){super(J.API_ABORTED,e,t),this.name=`ApiAbortedError`}},Q=class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`ApiValidationError`}},Ce={ValidationException:Q,ZodValidationException:Q,BadRequestException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`BadRequestError`}},QuoteNotFoundException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`QuoteNotFoundError`}},QuoteExpiredException:class extends X{constructor(e,t){super(J.QUOTE_EXPIRED,e,t),this.name=`QuoteExpiredError`}},CannotFillException:class extends X{constructor(e,t){super(J.QUOTE_FAILED,e,t),this.name=`CannotFillError`}},NotSupportedTokenException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedTokenError`}},NotSupportedChainException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`NotSupportedChainError`}},NotSupportedDepositMethodException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`NotSupportedDepositMethodError`}},UnexpectedFromAddressException:class extends X{constructor(e,t){super(J.DEPOSIT_BUILD_FAILED,e,t),this.name=`UnexpectedFromAddressError`}},IntentNotFoundException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`IntentNotFoundError`}},DuplicateRecordException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`DuplicateRecordError`}},BroadcastException:class extends X{constructor(e,t){super(J.DEPOSIT_SUBMIT_FAILED,e,t),this.name=`BroadcastError`}},InternalErrorException:class extends X{constructor(e,t){super(J.API_REQUEST_FAILED,e,t),this.name=`InternalServerError`}}};function we(e,t,n){if(typeof e==`object`&&e){let r=e,i=typeof r.name==`string`?r.name:null,a=typeof r.message==`string`?r.message:t;if(i&&Ce[i]){let t=Ce[i];return new t(a,n??e)}return new X(J.API_REQUEST_FAILED,a,n??e)}return new X(J.API_REQUEST_FAILED,t,n)}function Te(e){return xe.create({prefixUrl:e.baseUrl,timeout:e.timeout??15e3,retry:0,...e.fetch?{fetch:e.fetch}:{},headers:{"X-TF-SDK-Version":De(),...e.headers}})}function Ee(e){return e.replace(/\/$/,``)}function De(){return`0.3.0-rc.3`}async function Oe(e,t){try{return await e}catch(e){if(e instanceof X)throw e;if(e instanceof k)throw new Se(t.timeoutMessage,e);if(e instanceof DOMException&&e.name===`AbortError`)throw new Z(`Request was aborted`,e);if(e instanceof l){let n=``;try{n=await e.response.json()}catch{n=await e.response.text().catch(()=>``)}let r=`${t.failureMessage}: ${e.response.status} ${e.response.statusText}`;throw we(n,r,{status:e.response.status,body:n})}throw new X(J.API_REQUEST_FAILED,`${t.failureMessage}: ${String(e)}`,e)}}async function*ke(e){if(!e.ok){let t=``;try{t=await e.json()}catch{t=await e.text().catch(()=>``)}throw we(t,`API request failed: ${e.status} ${e.statusText}`,{status:e.status,body:t})}if(!e.body)throw new X(J.API_INVALID_RESPONSE,`Streaming response has no body`);let t=e.body.getReader(),n=new TextDecoder(`utf-8`),r=``;try{for(;;){let{value:e,done:i}=await t.read();e&&(r+=n.decode(e,{stream:!0}));let a=r.indexOf(`
2
2
  `);for(;a!==-1;){let e=r.slice(0,a).trim();r=r.slice(a+1),e&&(yield Ae(e)),a=r.indexOf(`
3
3
  `)}if(i){let e=r.trim();e&&(yield Ae(e));return}}}finally{t.releaseLock()}}function Ae(e){try{return JSON.parse(e)}catch(t){throw new X(J.API_INVALID_RESPONSE,`Failed to parse NDJSON frame: ${String(t)}`,{line:e})}}var je=`https://api.hyperstream.dev`,Me=2e3,Ne=500,Pe=5e3,Fe=class{constructor(e){this.baseUrl=Ee(e.baseUrl),this.ky=Te({baseUrl:this.baseUrl,timeout:e.timeout,fetch:e.fetch,headers:e.headers}),this.fetchImpl=e.fetch??globalThis.fetch.bind(globalThis),this.extraHeaders=e.headers??{}}request(e){return Oe(e,{timeoutMessage:`API request timed out`,failureMessage:`API request failed`})}getQuotes(e,t){return this.request(this.ky.post(`v1/quotes`,{json:e,signal:t?.signal}).json())}async*streamQuotes(e,t){yield*ke(await this.fetchImpl(`${this.baseUrl}/v1/quotes?mode=stream`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-TF-SDK-Version":De(),...this.extraHeaders},body:JSON.stringify(e),signal:t?.signal}))}buildDeposit(e,t){return this.request(this.ky.post(`v1/deposit/build`,{json:e,signal:t?.signal}).json())}submitDeposit(e,t){return this.request(this.ky.put(`v1/deposit/submit`,{json:e,signal:t?.signal}).json())}getOrdersByAddress(e,t){let n={};return t?.orderIds?.length&&(n.orderIds=t.orderIds.join(`,`)),t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),this.request(this.ky.get(`v1/orders/${e}`,{searchParams:n,signal:t?.signal}).json())}async getOrderById(e,t,n){return(await this.getOrdersByAddress(e,{orderIds:[t],signal:n?.signal})).data[0]??null}getOrder(e,t){return this.request(this.ky.get(`v1/orders/by-id/${e}`,{signal:t?.signal}).json())}trackOrder(e,t={}){let n=Math.max(Ne,t.intervalMs??Me);return new Promise((r,i)=>{let a=!1,o=null,s=()=>{o&&(clearTimeout(o),o=null),t.signal&&t.signal.removeEventListener(`abort`,c)},c=()=>{a||(a=!0,s(),i(new Z(`Order tracking was aborted`)))};if(t.signal){if(t.signal.aborted){c();return}t.signal.addEventListener(`abort`,c)}let l=async()=>{if(!a)try{let i=await this.getOrder(e,{signal:t.signal});if(a)return;if(t.onStatus?.(i),Ie.includes(i.status)){a=!0,s(),r(i);return}o=setTimeout(l,n)}catch(e){if(a)return;if(e instanceof Z){a=!0,s(),i(e);return}o=setTimeout(l,Pe)}};l()})}getTokens(e){let t={};return e?.q&&(t.q=e.q),e?.chainIds?.length&&(t.chainIds=e.chainIds.join(`,`)),e?.limit&&(t.limit=e.limit.toString()),e?.cursor&&(t.cursor=e.cursor.toString()),this.request(this.ky.get(`v1/tokens`,{searchParams:t,signal:e?.signal}).json())}searchTokens(e,t){let n={q:e};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/search`,{searchParams:n,signal:t?.signal}).json())}getTopTokens(e){let t={};return e?.chainIds?.length&&(t.chainIds=e.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/top`,{searchParams:t,signal:e?.signal}).json())}getTokenBalances(e,t){let n={};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),this.request(this.ky.get(`v1/tokens/balances/${e}`,{searchParams:n,signal:t?.signal}).json())}getTokenAutocomplete(e,t){let n={};return t?.chainIds?.length&&(n.chainIds=t.chainIds.join(`,`)),t?.limit&&(n.limit=t.limit.toString()),this.request(this.ky.get(`v1/tokens/autocomplete/${encodeURIComponent(e)}`,{searchParams:n,signal:t?.signal}).json())}getTokenAutocompleteSuggestions(e){return this.request(this.ky.get(`v1/tokens/autocomplete/suggestions`,{signal:e?.signal}).json())}getChains(e){return this.request(this.ky.get(`v1/chains`,{signal:e?.signal}).json())}getArcadiaConfig(e){return this.request(this.ky.get(`v1/config/arcadia`,{signal:e?.signal}).json())}getVaults(e){return this.request(this.ky.get(`v1/vaults`,{signal:e?.signal}).json())}getMTokens(e){return this.request(this.ky.get(`v1/mtokens`,{signal:e?.signal}).json())}getIntent(e,t){return this.request(this.ky.get(`v1/intent/${e}`,{signal:t?.signal}).json())}getIntentByDeposit(e,t){return this.request(this.ky.get(`v1/intent/deposit`,{searchParams:{chainId:e.chainId.toString(),txHash:e.txHash},signal:t?.signal}).json())}getIntentsByAuthor(e,t){let n={};return t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),t?.fromChainId&&(n.fromChainId=t.fromChainId.toString()),t?.toChainId&&(n.toChainId=t.toChainId.toString()),this.request(this.ky.get(`v1/intents/${e}`,{searchParams:n,signal:t?.signal}).json())}},Ie=[`filled`,`refunded`,`failed`],Le=500,Re=700,ze=2e3,Be=500,Ve=5e3;function He(e,t){let n=typeof window.outerWidth==`number`?window.outerWidth:0,r=typeof window.outerHeight==`number`?window.outerHeight:0,i=typeof window.screenX==`number`?window.screenX:0,a=typeof window.screenY==`number`?window.screenY:0,o=n>0?n:screen.width,s=r>0?r:screen.height,c=n>0?i:0,l=r>0?a:0;return`width=${e},height=${t},left=${Math.max(0,Math.round(c+(o-e)/2))},top=${Math.max(0,Math.round(l+(s-t)/2))}`}function Ue(e){return e===`completed`?`completed`:e===`canceled`?`canceled`:`failed`}function We(e,t,n={}){if(typeof window>`u`)return Promise.reject(new X(J.FIAT_CHECKOUT_UNAVAILABLE,`Fiat checkout requires a browser window`));let r=n.popup?.width??Le,i=n.popup?.height??Re,a=n.minPollIntervalMs??ze,o=window.open(t.wrapperUrl,`tf-fiat-${t.orderId}`,He(r,i));if(!o||o.closed)return Promise.reject(new X(J.FIAT_POPUP_BLOCKED,`Payment popup was blocked by the browser`));let s;try{s=new URL(e.baseUrl).origin}catch{return o.close(),Promise.reject(new X(J.FIAT_CHECKOUT_UNAVAILABLE,`Fiat API base URL is malformed`))}return new Promise((r,i)=>{let c=!1,l=!1,u=null,d=null,f=()=>{window.removeEventListener(`message`,m),u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null),n.signal&&n.signal.removeEventListener(`abort`,h)},p=async n=>{if(!c){c=!0,f();try{let i=await e.getStatus(t.orderId);o.closed||o.close(),r({orderId:t.orderId,finalStatus:i,outcome:n})}catch(e){o.closed||o.close(),i(e)}}},m=e=>{if(e.origin!==s)return;let r=e.data;if(!(!r||typeof r!=`object`||r.type!==`FIAT_WIDGET_EVENT`)&&!(r.orderId&&r.orderId!==t.orderId))switch(n.onEvent?.(r),r.event){case`widget_ready`:l=!0;break;case`order_completed`:p(`completed`);break;case`order_failed`:l&&p(`failed`);break;case`widget_close`:break}},h=()=>{o.closed||o.close(),p(`canceled`)};if(window.addEventListener(`message`,m),n.signal){if(n.signal.aborted){h();return}n.signal.addEventListener(`abort`,h)}d=setInterval(()=>{o.closed&&!c&&p(`canceled`)},Be);let g=async()=>{if(!c)try{let r=await e.getStatus(t.orderId);if(c)return;if(n.onStatus?.(r),r.polling.isTerminal){p(Ue(r.status));return}let i=Math.max(a,r.polling.suggestedIntervalMs);u=setTimeout(g,i)}catch{c||(u=setTimeout(g,Ve))}};g()})}var Ge=`https://fiat.hyperstream.dev`,Ke=class{constructor(e){this.baseUrl=Ee(e.baseUrl),this.ky=Te({baseUrl:this.baseUrl,timeout:e.timeout,fetch:e.fetch,headers:e.headers})}request(e){return Oe(e,{timeoutMessage:`Fiat API request timed out`,failureMessage:`Fiat API request failed`})}getProviders(e){return this.request(this.ky.get(`v1/fiat/providers`,{signal:e?.signal}).json())}getQuote(e,t){return this.request(this.ky.post(`v1/fiat/quote`,{json:e,signal:t?.signal}).json())}createOrder(e,t){return this.request(this.ky.post(`v1/fiat/order`,{json:e,signal:t?.signal}).json())}getStatus(e,t){let n=t?.force?{force:`1`}:void 0;return this.request(this.ky.get(`v1/fiat/status/${e}`,{signal:t?.signal,searchParams:n}).json())}startCheckout(e,t){return We(this,e,t)}getOrdersByAddress(e,t){let n={};return t?.status&&(n.status=t.status),t?.limit&&(n.limit=t.limit.toString()),t?.cursor&&(n.cursor=t.cursor.toString()),this.request(this.ky.get(`v1/fiat/orders/${e}`,{searchParams:n,signal:t?.signal}).json())}};function qe(e,t){if(e)return`${e.replace(/\/$/,``)}/v1/chain/${t}/icon`}var Je=new Set([`completed`,`failed`,`canceled`]),$={...J,INVALID_CONFIG:`TF1001`,INVALID_TOKEN_IDENTIFIER:`TF1002`,INVALID_AMOUNT:`TF1003`,WALLET_CONNECTION_FAILED:`TF2002`,WALLET_ACTION_FAILED:`TF2003`,TRANSACTION_FAILED:`TF4001`,ELEMENT_NOT_FOUND:`TF5001`},Ye={[$.INVALID_CONFIG]:`Invalid configuration provided`,[$.INVALID_TOKEN_IDENTIFIER]:`Invalid token identifier format`,[$.INVALID_AMOUNT]:`Invalid amount value`,[$.WALLET_CONNECTION_FAILED]:`Failed to connect wallet`,[$.WALLET_ACTION_FAILED]:`Wallet action failed`,[$.TRANSACTION_FAILED]:`Transaction failed`,[$.ELEMENT_NOT_FOUND]:`Target DOM element not found`};({...Y,...Ye});export{Ie as a,X as c,Fe as i,je as l,qe as n,Ge as o,Je as r,Ke as s,$ as t,c as u};
@@ -1,4 +1,4 @@
1
- import{S as e,m as t,o as n,p as r,u as i,v as a}from"./solid-iWr5Czxc.js";import{h as o,l as s,n as c,r as l,u}from"./shared.module-C-kWMzqW.js";import{i as d,o as f,r as p,t as m}from"./theme-C9tsVWlo.js";import{n as h,t as g}from"./widget-DQLVNkNn.js";import{n as _,r as v,t as y}from"./iframe-receiver-PfhKUIZW.js";function b(e=document){return e.querySelector(`[data-widget-root="stable"]`)??e.querySelector(`[part="container"]`)}function x(e,t=document){let n=()=>{let n=b(t);return n?(e.observeResize(n),!0):!1};if(n())return;let r=new MutationObserver(()=>{n()&&r.disconnect()});r.observe(document.body,{childList:!0,subtree:!0})}var S=o(`<div style="position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:9999;padding:6px 12px;border-radius:999px;background:color-mix(in srgb, var(--tf-primary) 15%, transparent);color:var(--tf-primary);border:1px solid color-mix(in srgb, var(--tf-primary) 35%, transparent);font-family:'DM Sans', sans-serif;font-size:11px;font-weight:600;letter-spacing:0.03em;user-select:none;pointer-events:none">Standalone preview · embed via &lt;tokenflight-iframe-widget&gt;`),C=o(`<div style="color:#95a8c4;font-family:'DM Sans', sans-serif;font-size:13px;text-align:center;padding-top:60px">Waiting for host bridge…`);function w(e={}){if(typeof window>`u`)return()=>{};E(),D();let t=T(e.target);if(!t)return()=>{};let n=e.queryClient??c,r=u(()=>i(P,{queryClient:n}),t);return()=>r()}function T(e){return typeof e==`string`?document.querySelector(e):e||document.getElementById(`root`)}function E(){if(!g||document.querySelector(`style[data-tokenflight-widget]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-widget`,``),e.textContent=g,document.head.appendChild(e)}function D(){if(document.querySelector(`style[data-tokenflight-flat]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-flat`,``),e.textContent=`
1
+ import{S as e,m as t,o as n,p as r,u as i,v as a}from"./solid-iWr5Czxc.js";import{h as o,l as s,n as c,r as l,u}from"./shared.module-2EeBIMep.js";import{i as d,o as f,r as p,t as m}from"./theme-C9tsVWlo.js";import{n as h,t as g}from"./widget-eUE--Gt1.js";import{n as _,r as v,t as y}from"./iframe-receiver-PfhKUIZW.js";function b(e=document){return e.querySelector(`[data-widget-root="stable"]`)??e.querySelector(`[part="container"]`)}function x(e,t=document){let n=()=>{let n=b(t);return n?(e.observeResize(n),!0):!1};if(n())return;let r=new MutationObserver(()=>{n()&&r.disconnect()});r.observe(document.body,{childList:!0,subtree:!0})}var S=o(`<div style="position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:9999;padding:6px 12px;border-radius:999px;background:color-mix(in srgb, var(--tf-primary) 15%, transparent);color:var(--tf-primary);border:1px solid color-mix(in srgb, var(--tf-primary) 35%, transparent);font-family:'DM Sans', sans-serif;font-size:11px;font-weight:600;letter-spacing:0.03em;user-select:none;pointer-events:none">Standalone preview · embed via &lt;tokenflight-iframe-widget&gt;`),C=o(`<div style="color:#95a8c4;font-family:'DM Sans', sans-serif;font-size:13px;text-align:center;padding-top:60px">Waiting for host bridge…`);function w(e={}){if(typeof window>`u`)return()=>{};E(),D();let t=T(e.target);if(!t)return()=>{};let n=e.queryClient??c,r=u(()=>i(P,{queryClient:n}),t);return()=>r()}function T(e){return typeof e==`string`?document.querySelector(e):e||document.getElementById(`root`)}function E(){if(!g||document.querySelector(`style[data-tokenflight-widget]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-widget`,``),e.textContent=g,document.head.appendChild(e)}function D(){if(document.querySelector(`style[data-tokenflight-flat]`))return;let e=document.createElement(`style`);e.setAttribute(`data-tokenflight-flat`,``),e.textContent=`
2
2
  html, body {
3
3
  margin: 0;
4
4
  padding: 0;
@@ -1 +1 @@
1
- import{c as e,i as t,t as n}from"./errors-BZKSEUy5.js";import{n as r}from"./shared.module-C-kWMzqW.js";var i={ETH:[`ETH`,`WETH`],USDC:[`USDC`,`USDC.e`,`USDbC`],USDT:[`USDT`,`USDT.e`]},a={STABLES_MAJOR:[`USDT`,`USDC`,`USDE`,`DAI`,`USDS`,`USD1`,`BUIDL`,`USDF`,`USDTB`,`PYUSD`],STABLE_WRAPPED:[`USDE`,`SUSDE`,`USDS`,`SUSDS`,`DAI`,`SDAI`],BTC:[`BTC`,`WBTC`,`TBTC`,`CBBTC`,`BTC.B`,`CKBTC`],ETH_LST_LRT:[`ETH`,`WETH`,`STETH`,`WSTETH`,`RETH`,`CBETH`,`FRXETH`,`SFRXETH`,`OSETH`,`ETHX`,`METH`,`EETH`,`WEETH`,`EZETH`,`PUFETH`,`RSETH`,`WBETH`]},o=new Set([`BTC`,`ETH`,`WETH`,`WBTC`,`USDC`,`USDT`,`DAI`,`BNB`,`XRP`,`SOL`,`TRX`,`DOGE`,`ADA`,`BCH`,`HYPE`,`XMR`,`LEO`,`LINK`,`MATIC`,`AVAX`]),s=new Set([`USDC`,`USDT`,`DAI`,`USDE`,`USDS`,`USD1`,`USDF`,`USDG`,`RLUSD`,`USDD`,`BUSD`,`TUSD`,`USDP`,`FRAX`,`LUSD`,`GUSD`,`PYUSD`]),c=.1,l=new Set([1]),u=new Set([`0x0000000000000000000000000000000000000000`,`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,`11111111111111111111111111111111`]);function d(e){return e?u.has(e.toLowerCase()):!1}function f(e,t){let n=e.toUpperCase(),r=t.toUpperCase();if(n===r)return!0;for(let e of Object.values(i)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function p(e,t){let n=e.toUpperCase(),r=t.toUpperCase();for(let e of Object.values(a)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function m(e){return s.has(e.toUpperCase())}function h(e){return o.has(e.toUpperCase())}function g(e){return d(e)&&(e.startsWith(`0x`)||e.startsWith(`0X`))?`0x0000000000000000000000000000000000000000`:e.toLowerCase()}function _(e,t){return e.chainId===t.chainId&&g(e.address)===g(t.address)}function v(e){return`${e.chainId}:${g(e.address)}`}function y(e,t){return t?e.find(e=>_(e,t))??null:null}function b(e){let{defaultFromToken:t,balances:n,currentSelection:r,userPicked:i}=e;return!t||n.length===0||i||r&&_(r,t)?null:y(n,t)}var x=`tf:token:`,S=1440*60*1e3,C=200;function w(e,t,n){return[`tokenInfo`,n??`__default__`,e,t.toLowerCase()]}function T(e,t){return`${x}${e}:${t.toLowerCase()}`}function E(e,t,n){return r.getQueryData(w(e,t,n))??null}function D(e,t){r.setQueryData(w(e.chainId,e.address,t),e)}function O(e,t){try{let n=T(e,t),r=localStorage.getItem(n);if(!r)return null;let i=JSON.parse(r);return Date.now()-i.timestamp>S?(localStorage.removeItem(n),null):i.token}catch{return null}}function k(e){try{let t=T(e.chainId,e.address),n={token:e,timestamp:Date.now()};localStorage.setItem(t,JSON.stringify(n)),A()}catch{}}function A(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(x))try{let t=localStorage.getItem(n);if(t){let r=JSON.parse(t);e.push({key:n,timestamp:r.timestamp})}}catch{n&&localStorage.removeItem(n)}}if(e.length<=C)return;e.sort((e,t)=>e.timestamp-t.timestamp);let t=e.length-C;for(let n=0;n<t;n++)localStorage.removeItem(e[n].key)}function j(e,t){k(e),D(e,t)}function M(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(x)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}async function N(r,i,a,o){let s=(o?.baseUrl??a)?.replace(/\/$/,``),c=E(r,i,s);if(c)return c;let l=O(r,i);if(l)return D(l,s),l;let u=e=>({chainId:e.chainId??r,address:e.address??i,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,...Number.isFinite(Number(e.extensions?.price?.usd??``))?{priceUsd:Number(e.extensions?.price?.usd??``)}:{}}),d=e=>{let t=g(i);return e.find(e=>Number(e.chainId)===r&&g(e.address)===t)};if(o||a)try{let c=d((await(o??new t({baseUrl:a})).searchTokens(i,{chainIds:[r]})).data??[]);if(c){let e=u(c);return j(e,s),e}throw new e(n.INVALID_TOKEN_IDENTIFIER,`Token not found for chain ${r}: ${i}`)}catch(t){if(t instanceof e)throw t}return{chainId:r,address:i,decimals:void 0}}function P(e,t){if(!e||t<0)return`0`;let n;try{n=(e.startsWith(`0x`),BigInt(e).toString())}catch{return`0`}let r=n.startsWith(`-`),i=r?n.slice(1):n;if(t===0)return r?`-${i}`:i;let a=i.padStart(t+1,`0`),o=a.slice(0,a.length-t),s=a.slice(a.length-t).replace(/0+$/,``),c=s?`${o}.${s}`:o;return r?`-${c}`:c}function F(e,t){if(!e||!/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(e))return`0`;let n=e.startsWith(`-`),r=(n?e.slice(1):e).split(`.`),i=((r[0]??`0`)+(r[1]??``).slice(0,t).padEnd(t,`0`)).replace(/^0+/,``)||`0`;return n?`-${i}`:i}function I(e,t,n,r){if(!e||!n||e===`0`||t<0||r<0)return`0`;let i,a;try{i=BigInt(e),a=BigInt(n)}catch{return`0`}if(i===0n)return`0`;let o=10n**BigInt(8),s=(a*10n**BigInt(t)*o/(i*10n**BigInt(r))).toString().padStart(9,`0`),c=s.slice(0,s.length-8),l=s.slice(s.length-8).replace(/0+$/,``);return l?`${c}.${l}`:c}function L(e){let t=e.split(`.`),n=t[0]??`0`,r=n.startsWith(`-`),i=(r?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,`,`),a=r?`-${i}`:i;return t[1]===void 0?a:`${a}.${t[1]}`}function R(e,t=6){if(!e||e===`0`)return`0`;let n=e.split(`.`),r=n[0]??`0`;if(!n[1])return e;let i=n[1];if(r!==`0`&&r!==`-0`){let e=i.slice(0,t).replace(/0+$/,``);return e?`${r}.${e}`:r}let a=i.search(/[1-9]/);if(a===-1)return`0`;let o=a+t,s=i.slice(0,o).replace(/0+$/,``);return s?`${r}.${s}`:`0`}var z=20011e6;function B(e){return e===z}function V(e){return e!==z}function H(e){return B(e)?`solana`:`evm`}function U(e,t){return H(e)!==H(t)}function W(e){return B(e)?`11111111111111111111111111111111`:`0x0000000000000000000000000000000000000000`}function G(e,t){return t?.get(e)?.name??`Chain ${e}`}function K(e,t){return t===`evm`?/^0x[0-9a-fA-F]{40}$/.test(e):/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function q(e){return e?.includes(`1-click`)??!1}function J(e){try{return e.startsWith(`0x`),BigInt(e)}catch{return null}}function Y(e){let t=[];for(let n of e){let e=J(n.quote.amountOut);e!==null&&t.push({routeId:n.routeId,amountOut:e,etaSeconds:Number.isFinite(n.quote.expectedDurationSeconds)?n.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:!1,isOneClick:q(n.tags)})}return t}function X(e,t){let n=[];for(let r of e){let e=J(r.quote.amountIn);if(e===null)continue;let i=t===`EXACT_OUTPUT`&&r.exactOutMethod===`native`;n.push({routeId:r.routeId,amountIn:e,etaSeconds:Number.isFinite(r.quote.expectedDurationSeconds)?r.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:i,isOneClick:q(r.tags)})}return n}function Z(e){if(e.length===0)return[];let t=e[0].amountOut;for(let n of e)n.amountOut>t&&(t=n.amountOut);let n=t*999n/1000n,r=[...e.filter(e=>e.amountOut>=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function Q(e){if(e.length===0)return[];let t=e[0].amountIn;for(let n of e)n.amountIn<t&&(t=n.amountIn);let n=t*1001n/1000n,r=[...e.filter(e=>e.amountIn<=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function $(e){return Z(Y(e))[0]??null}function ee(e,t){return Q(X(e,t))[0]??null}export{p as A,b as C,f as D,c as E,h as O,_ as S,l as T,P as _,z as a,N as b,W as c,V as d,B as f,F as g,R as h,Q as i,m as j,d as k,K as l,I as m,ee as n,G as o,L as p,$ as r,H as s,X as t,U as u,M as v,v as w,y as x,j as y};
1
+ import{c as e,i as t,t as n}from"./errors-DXq77OyE.js";import{n as r}from"./shared.module-2EeBIMep.js";var i={ETH:[`ETH`,`WETH`],USDC:[`USDC`,`USDC.e`,`USDbC`],USDT:[`USDT`,`USDT.e`]},a={STABLES_MAJOR:[`USDT`,`USDC`,`USDE`,`DAI`,`USDS`,`USD1`,`BUIDL`,`USDF`,`USDTB`,`PYUSD`],STABLE_WRAPPED:[`USDE`,`SUSDE`,`USDS`,`SUSDS`,`DAI`,`SDAI`],BTC:[`BTC`,`WBTC`,`TBTC`,`CBBTC`,`BTC.B`,`CKBTC`],ETH_LST_LRT:[`ETH`,`WETH`,`STETH`,`WSTETH`,`RETH`,`CBETH`,`FRXETH`,`SFRXETH`,`OSETH`,`ETHX`,`METH`,`EETH`,`WEETH`,`EZETH`,`PUFETH`,`RSETH`,`WBETH`]},o=new Set([`BTC`,`ETH`,`WETH`,`WBTC`,`USDC`,`USDT`,`DAI`,`BNB`,`XRP`,`SOL`,`TRX`,`DOGE`,`ADA`,`BCH`,`HYPE`,`XMR`,`LEO`,`LINK`,`MATIC`,`AVAX`]),s=new Set([`USDC`,`USDT`,`DAI`,`USDE`,`USDS`,`USD1`,`USDF`,`USDG`,`RLUSD`,`USDD`,`BUSD`,`TUSD`,`USDP`,`FRAX`,`LUSD`,`GUSD`,`PYUSD`]),c=.1,l=new Set([1]),u=new Set([`0x0000000000000000000000000000000000000000`,`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,`11111111111111111111111111111111`]);function d(e){return e?u.has(e.toLowerCase()):!1}function f(e,t){let n=e.toUpperCase(),r=t.toUpperCase();if(n===r)return!0;for(let e of Object.values(i)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function p(e,t){let n=e.toUpperCase(),r=t.toUpperCase();for(let e of Object.values(a)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function m(e){return s.has(e.toUpperCase())}function h(e){return o.has(e.toUpperCase())}function g(e){return d(e)&&(e.startsWith(`0x`)||e.startsWith(`0X`))?`0x0000000000000000000000000000000000000000`:e.toLowerCase()}function _(e,t){return e.chainId===t.chainId&&g(e.address)===g(t.address)}function v(e){return`${e.chainId}:${g(e.address)}`}function y(e,t){return t?e.find(e=>_(e,t))??null:null}function b(e){let{defaultFromToken:t,balances:n,currentSelection:r,userPicked:i}=e;return!t||n.length===0||i||r&&_(r,t)?null:y(n,t)}var x=`tf:token:`,S=1440*60*1e3,C=200;function w(e,t,n){return[`tokenInfo`,n??`__default__`,e,t.toLowerCase()]}function T(e,t){return`${x}${e}:${t.toLowerCase()}`}function E(e,t,n){return r.getQueryData(w(e,t,n))??null}function D(e,t){r.setQueryData(w(e.chainId,e.address,t),e)}function O(e,t){try{let n=T(e,t),r=localStorage.getItem(n);if(!r)return null;let i=JSON.parse(r);return Date.now()-i.timestamp>S?(localStorage.removeItem(n),null):i.token}catch{return null}}function k(e){try{let t=T(e.chainId,e.address),n={token:e,timestamp:Date.now()};localStorage.setItem(t,JSON.stringify(n)),A()}catch{}}function A(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(x))try{let t=localStorage.getItem(n);if(t){let r=JSON.parse(t);e.push({key:n,timestamp:r.timestamp})}}catch{n&&localStorage.removeItem(n)}}if(e.length<=C)return;e.sort((e,t)=>e.timestamp-t.timestamp);let t=e.length-C;for(let n=0;n<t;n++)localStorage.removeItem(e[n].key)}function j(e,t){k(e),D(e,t)}function M(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(x)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}async function N(r,i,a,o){let s=(o?.baseUrl??a)?.replace(/\/$/,``),c=E(r,i,s);if(c)return c;let l=O(r,i);if(l)return D(l,s),l;let u=e=>({chainId:e.chainId??r,address:e.address??i,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,...Number.isFinite(Number(e.extensions?.price?.usd??``))?{priceUsd:Number(e.extensions?.price?.usd??``)}:{}}),d=e=>{let t=g(i);return e.find(e=>Number(e.chainId)===r&&g(e.address)===t)};if(o||a)try{let c=d((await(o??new t({baseUrl:a})).searchTokens(i,{chainIds:[r]})).data??[]);if(c){let e=u(c);return j(e,s),e}throw new e(n.INVALID_TOKEN_IDENTIFIER,`Token not found for chain ${r}: ${i}`)}catch(t){if(t instanceof e)throw t}return{chainId:r,address:i,decimals:void 0}}function P(e,t){if(!e||t<0)return`0`;let n;try{n=(e.startsWith(`0x`),BigInt(e).toString())}catch{return`0`}let r=n.startsWith(`-`),i=r?n.slice(1):n;if(t===0)return r?`-${i}`:i;let a=i.padStart(t+1,`0`),o=a.slice(0,a.length-t),s=a.slice(a.length-t).replace(/0+$/,``),c=s?`${o}.${s}`:o;return r?`-${c}`:c}function F(e,t){if(!e||!/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(e))return`0`;let n=e.startsWith(`-`),r=(n?e.slice(1):e).split(`.`),i=((r[0]??`0`)+(r[1]??``).slice(0,t).padEnd(t,`0`)).replace(/^0+/,``)||`0`;return n?`-${i}`:i}function I(e,t,n,r){if(!e||!n||e===`0`||t<0||r<0)return`0`;let i,a;try{i=BigInt(e),a=BigInt(n)}catch{return`0`}if(i===0n)return`0`;let o=10n**BigInt(8),s=(a*10n**BigInt(t)*o/(i*10n**BigInt(r))).toString().padStart(9,`0`),c=s.slice(0,s.length-8),l=s.slice(s.length-8).replace(/0+$/,``);return l?`${c}.${l}`:c}function L(e){let t=e.split(`.`),n=t[0]??`0`,r=n.startsWith(`-`),i=(r?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,`,`),a=r?`-${i}`:i;return t[1]===void 0?a:`${a}.${t[1]}`}function R(e,t=6){if(!e||e===`0`)return`0`;let n=e.split(`.`),r=n[0]??`0`;if(!n[1])return e;let i=n[1];if(r!==`0`&&r!==`-0`){let e=i.slice(0,t).replace(/0+$/,``);return e?`${r}.${e}`:r}let a=i.search(/[1-9]/);if(a===-1)return`0`;let o=a+t,s=i.slice(0,o).replace(/0+$/,``);return s?`${r}.${s}`:`0`}var z=20011e6;function B(e){return e===z}function V(e){return e!==z}function H(e){return B(e)?`solana`:`evm`}function U(e,t){return H(e)!==H(t)}function W(e){return B(e)?`11111111111111111111111111111111`:`0x0000000000000000000000000000000000000000`}function G(e,t){return t?.get(e)?.name??`Chain ${e}`}function K(e,t){return t===`evm`?/^0x[0-9a-fA-F]{40}$/.test(e):/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function q(e){return e?.includes(`1-click`)??!1}function J(e){try{return e.startsWith(`0x`),BigInt(e)}catch{return null}}function Y(e){let t=[];for(let n of e){let e=J(n.quote.amountOut);e!==null&&t.push({routeId:n.routeId,amountOut:e,etaSeconds:Number.isFinite(n.quote.expectedDurationSeconds)?n.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:!1,isOneClick:q(n.tags)})}return t}function X(e,t){let n=[];for(let r of e){let e=J(r.quote.amountIn);if(e===null)continue;let i=t===`EXACT_OUTPUT`&&r.exactOutMethod===`native`;n.push({routeId:r.routeId,amountIn:e,etaSeconds:Number.isFinite(r.quote.expectedDurationSeconds)?r.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:i,isOneClick:q(r.tags)})}return n}function Z(e){if(e.length===0)return[];let t=e[0].amountOut;for(let n of e)n.amountOut>t&&(t=n.amountOut);let n=t*999n/1000n,r=[...e.filter(e=>e.amountOut>=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function Q(e){if(e.length===0)return[];let t=e[0].amountIn;for(let n of e)n.amountIn<t&&(t=n.amountIn);let n=t*1001n/1000n,r=[...e.filter(e=>e.amountIn<=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function $(e){return Z(Y(e))[0]??null}function ee(e,t){return Q(X(e,t))[0]??null}export{p as A,b as C,f as D,c as E,h as O,_ as S,l as T,P as _,z as a,N as b,W as c,V as d,B as f,F as g,R as h,Q as i,m as j,d as k,K as l,I as m,ee as n,G as o,L as p,$ as r,H as s,X as t,U as u,M as v,v as w,y as x,j as y};
@@ -1 +1 @@
1
- import{S as e,_ as t,m as n,u as r,v as i}from"./solid-iWr5Czxc.js";import{S as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as ee,t as b,u as x,v as S,y as te}from"./register-defaults-C_q7CG7x.js";import{c as C,t as w}from"./errors-BZKSEUy5.js";import{_ as T,b as E,c as D,d as O,h as k,n as A,r as j,u as M,v as N,x as P,y as F}from"./shared.module-C-kWMzqW.js";import{a as I,n as L,o as R,r as z,t as B}from"./theme-C9tsVWlo.js";import{n as V,t as H}from"./widget-DQLVNkNn.js";function ne(e){if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw new C(w.ELEMENT_NOT_FOUND,`Element not found: ${e}`);return t}return e}function re(e,t){var n,i,a,o,s,c,l,u;return n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakSet,class{constructor(e){P(this,u),E(this,n,null),E(this,i,null),E(this,a,void 0),E(this,o,null),E(this,s,void 0),E(this,c,void 0),E(this,l,void 0),T(a,this,ne(e.container)),T(s,this,e.config),T(c,this,e.walletAdapter),T(l,this,e.callbacks)}initialize(){N(n,this)&&this.destroy();let t=document.createElement(`div`);N(a,this).appendChild(t);let i=t.attachShadow({mode:`open`});T(o,this,i);let p=document.createElement(`style`),m=N(s,this).theme??`light`;F(u,this,d).call(this,p,m),i.appendChild(p),F(u,this,f).call(this,p);let h=document.createElement(`div`);i.appendChild(h),N(s,this).customColors&&B(t,N(s,this).customColors);let g=N(s,this),_=N(c,this),v=N(l,this);T(n,this,M(()=>r(j,{client:A,get children(){return e(g,_,v)}}),h))}destroy(){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(n,this)&&(N(n,this).call(this),T(n,this,null)),T(o,this,null),N(a,this).innerHTML=``}setTheme(e){T(s,this,{...N(s,this),theme:e});let t=N(o,this);if(t){let n=t.querySelector(`style`);n&&(F(u,this,d).call(this,n,e),F(u,this,f).call(this,n))}}setCustomColors(e){let t=N(o,this)?.host;t&&B(t,e)}};function d(e,n){let r=(n===`auto`?typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0:n===`dark`)?z:I;e.textContent=`${t()}\n:host { ${L(r)} }`}function f(e){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(s,this).theme===`auto`&&T(i,this,R(n=>{e.textContent=`${t()}\n:host { ${L(n)} }`}))}}var U=re((e,t,n)=>r(V,{config:e,walletAdapter:t,callbacks:n}),()=>H);function W(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=Object.assign({},r),X(r.value)&&!ae(r.value)&&!Array.isArray(r.value)&&(t[n].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[n].value=r.value.slice(0)),t},{})}function G(e){return e?Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=X(r)&&`value`in r?r:{value:r},t[n].attribute||(t[n].attribute=ie(n)),t[n].parse=`parse`in t[n]?t[n].parse:typeof t[n].value!=`string`,t},{}):{}}function K(e){return Object.keys(e).reduce((t,n)=>(t[n]=e[n].value,t),{})}function q(e,t){let n=W(t);return Object.keys(t).forEach(t=>{let r=n[t],i=e.getAttribute(r.attribute),a=e[t];i!=null&&(r.value=r.parse?J(i):i),a!=null&&(r.value=Array.isArray(a)?a.slice(0):a),r.reflect&&Y(e,r.attribute,r.value,!!r.parse),Object.defineProperty(e,t,{get(){return r.value},set(e){let n=r.value;r.value=e,r.reflect&&Y(this,r.attribute,r.value,!!r.parse);for(let r=0,i=this.__propertyChangedCallbacks.length;r<i;r++)this.__propertyChangedCallbacks[r](t,e,n)},enumerable:!0,configurable:!0})}),n}function J(e){if(e)try{return JSON.parse(e)}catch{return e}}function Y(e,t,n,r){if(n==null||n===!1)return e.removeAttribute(t);let i=r?JSON.stringify(n):n;e.__updating[t]=!0,i===`true`&&(i=``),e.setAttribute(t,i),Promise.resolve().then(()=>delete e.__updating[t])}function ie(e){return e.replace(/\.?([A-Z]+)/g,(e,t)=>`-`+t.toLowerCase()).replace(`_`,`-`).replace(/^-/,``)}function X(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}function ae(e){return Object.prototype.toString.call(e)===`[object Function]`}function oe(e){return typeof e==`function`&&e.toString().indexOf(`class`)===0}var Z;function se(e,t){let n=Object.keys(t);return class extends e{static get observedAttributes(){return n.map(e=>t[e].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={};for(let e of n)this[e]=void 0}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=q(this,t);let e=K(this.props),n=this.Component,r=Z;try{Z=this,this.__initialized=!0,oe(n)?new n(e,{element:this}):n(e,{element:this})}finally{Z=r}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let e=null;for(;e=this.__releaseCallbacks.pop();)e(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(e,n,r){if(this.__initialized&&!this.__updating[e]&&(e=this.lookupProp(e),e in t)){if(r==null&&!this[e])return;this[e]=t[e].parse?J(r):r}}lookupProp(e){if(t)return n.find(n=>e===n||e===t[n].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:`open`})}addReleaseCallback(e){this.__releaseCallbacks.push(e)}addPropertyChangedCallback(e){this.__propertyChangedCallbacks.push(e)}}}function ce(e,t={},n={}){let{BaseElement:r=HTMLElement,extension:i,customElements:a=window.customElements}=n;return n=>{if(!e)throw Error(`tag is required to register a Component`);let o=a.get(e);return o?(o.prototype.Component=n,o):(o=se(r,G(t)),o.prototype.Component=n,o.prototype.registeredTag=e,a.define(e,o,i),o)}}function le(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let[a,o]=i(e[t[r]]);Object.defineProperty(n,t[r],{get:a,set(e){o(()=>e)}})}return n}function Q(e){if(e.assignedSlot&&e.assignedSlot._$owner)return e.assignedSlot._$owner;let t=e.parentNode;for(;t&&!t._$owner&&!(t.assignedSlot&&t.assignedSlot._$owner);)t=t.parentNode;return t&&t.assignedSlot?t.assignedSlot._$owner:e._$owner}function ue(e){return(n,r)=>{let{element:i}=r;return t(t=>{let a=le(n);i.addPropertyChangedCallback((e,t)=>a[e]=t),i.addReleaseCallback(()=>{i.renderRoot.textContent=``,t()});let o=e(a,r);return D(i.renderRoot,o)},Q(i))}}function de(e,t,n){return arguments.length===2&&(n=t,t={}),ce(e,t)(ue(n))}var fe=k(`<style>`);function pe(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function $(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function me(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function he(e){if(e)try{let t=JSON.parse(e.trim());if(typeof t==`object`&&t&&!Array.isArray(t)&&Object.values(t).every(e=>typeof e==`string`))return t}catch{}}function ge(e){return e===`hidden`||e===`visible`?e:void 0}function _e(t){t&&b(t),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-widget`)||de(`tokenflight-widget`,{"api-endpoint":``,"fiat-api-endpoint":``,"to-token":``,"from-token":``,"trade-type":``,amount:``,recipient:``,icon:``,"lock-from-token":!1,"lock-to-token":!1,"fiat-currency":``,methods:``,"default-pay-method":``,"from-tokens":``,"to-tokens":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"quote-card":``,"no-background":!1,"no-border":!1,"recipient-editable":!1,"refund-to":``,"rpc-overrides":``,referrer:``,"referrer-fee-bps":``},(t,{element:b})=>{let C={get apiEndpoint(){return t[`api-endpoint`]||y()||void 0},get fiatApiEndpoint(){return t[`fiat-api-endpoint`]||_()||void 0},get toToken(){return pe(t[`to-token`])},get fromToken(){return t[`from-token`]||void 0},get tradeType(){return t[`trade-type`]||void 0},get amount(){return t.amount||void 0},get recipient(){return t.recipient||void 0},get recipientEditable(){return s(t[`recipient-editable`])},get refundTo(){return t[`refund-to`]||void 0},get icon(){return t.icon||void 0},get lockFromToken(){return s(t[`lock-from-token`])},get lockToToken(){return s(t[`lock-to-token`])},get fiatCurrency(){return t[`fiat-currency`]||void 0},get methods(){return me(t.methods)??l()},get defaultPayMethod(){return t[`default-pay-method`]||void 0},get fromTokens(){return $(t[`from-tokens`])},get toTokens(){return $(t[`to-tokens`])},get titleText(){return t[`title-text`]||void 0},get titleImageUrl(){return t[`title-image`]||void 0},get theme(){return t.theme||S()||`light`},get locale(){return t.locale||x()||`en-US`},get hideTitle(){return g(b,t[`hide-title`],`hide-title`)?s(t[`hide-title`])??!1:m()},get hidePoweredBy(){return g(b,t[`hide-powered-by`],`hide-powered-by`)?s(t[`hide-powered-by`])??!1:ee()},get hideProvider(){return g(b,t[`hide-provider`],`hide-provider`)?s(t[`hide-provider`])??!1:c()},get quoteCard(){return ge(t[`quote-card`])},get noBackground(){return g(b,t[`no-background`],`no-background`)?s(t[`no-background`])??!1:u()},get noBorder(){return g(b,t[`no-border`],`no-border`)?s(t[`no-border`])??!1:v()},get rpcOverrides(){return he(t[`rpc-overrides`])??d()},get referrer(){return w().referrer},get referrerFeeBps(){return w().referrerFeeBps}},w=()=>a(t.referrer||h(),t[`referrer-fee-bps`]===``?f():Number(t[`referrer-fee-bps`]),b),T=t[`csp-nonce`]||void 0,[E,k]=i(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);e(R(e=>{k(e===z)}));let M=b.__customColors,N=n(()=>{let e=t.theme||S()||`light`,n=(e===`auto`?E():e===`dark`)?z:I,r=o();return`${H}\n:host { ${L(r||M?{...n,...r,...M}:n)} }`}),P=b.__walletAdapter,F=b.__callbacks;return[(()=>{var e=fe();return O(e,`nonce`,T),D(e,N),e})(),r(j,{client:A,get children(){return r(V,{config:C,get walletAdapter(){return P??te()},get callbacks(){return F?{...p(),...F}:p()}})}})]}))}export{U as n,_e as t};
1
+ import{S as e,_ as t,m as n,u as r,v as i}from"./solid-iWr5Czxc.js";import{S as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as ee,t as b,u as x,v as S,y as te}from"./register-defaults-C_q7CG7x.js";import{c as C,t as w}from"./errors-DXq77OyE.js";import{_ as T,b as E,c as D,d as O,h as k,n as A,r as j,u as M,v as N,x as P,y as F}from"./shared.module-2EeBIMep.js";import{a as I,n as L,o as R,r as z,t as B}from"./theme-C9tsVWlo.js";import{n as V,t as H}from"./widget-eUE--Gt1.js";function ne(e){if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw new C(w.ELEMENT_NOT_FOUND,`Element not found: ${e}`);return t}return e}function re(e,t){var n,i,a,o,s,c,l,u;return n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakSet,class{constructor(e){P(this,u),E(this,n,null),E(this,i,null),E(this,a,void 0),E(this,o,null),E(this,s,void 0),E(this,c,void 0),E(this,l,void 0),T(a,this,ne(e.container)),T(s,this,e.config),T(c,this,e.walletAdapter),T(l,this,e.callbacks)}initialize(){N(n,this)&&this.destroy();let t=document.createElement(`div`);N(a,this).appendChild(t);let i=t.attachShadow({mode:`open`});T(o,this,i);let p=document.createElement(`style`),m=N(s,this).theme??`light`;F(u,this,d).call(this,p,m),i.appendChild(p),F(u,this,f).call(this,p);let h=document.createElement(`div`);i.appendChild(h),N(s,this).customColors&&B(t,N(s,this).customColors);let g=N(s,this),_=N(c,this),v=N(l,this);T(n,this,M(()=>r(j,{client:A,get children(){return e(g,_,v)}}),h))}destroy(){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(n,this)&&(N(n,this).call(this),T(n,this,null)),T(o,this,null),N(a,this).innerHTML=``}setTheme(e){T(s,this,{...N(s,this),theme:e});let t=N(o,this);if(t){let n=t.querySelector(`style`);n&&(F(u,this,d).call(this,n,e),F(u,this,f).call(this,n))}}setCustomColors(e){let t=N(o,this)?.host;t&&B(t,e)}};function d(e,n){let r=(n===`auto`?typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0:n===`dark`)?z:I;e.textContent=`${t()}\n:host { ${L(r)} }`}function f(e){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(s,this).theme===`auto`&&T(i,this,R(n=>{e.textContent=`${t()}\n:host { ${L(n)} }`}))}}var U=re((e,t,n)=>r(V,{config:e,walletAdapter:t,callbacks:n}),()=>H);function W(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=Object.assign({},r),X(r.value)&&!ae(r.value)&&!Array.isArray(r.value)&&(t[n].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[n].value=r.value.slice(0)),t},{})}function G(e){return e?Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=X(r)&&`value`in r?r:{value:r},t[n].attribute||(t[n].attribute=ie(n)),t[n].parse=`parse`in t[n]?t[n].parse:typeof t[n].value!=`string`,t},{}):{}}function K(e){return Object.keys(e).reduce((t,n)=>(t[n]=e[n].value,t),{})}function q(e,t){let n=W(t);return Object.keys(t).forEach(t=>{let r=n[t],i=e.getAttribute(r.attribute),a=e[t];i!=null&&(r.value=r.parse?J(i):i),a!=null&&(r.value=Array.isArray(a)?a.slice(0):a),r.reflect&&Y(e,r.attribute,r.value,!!r.parse),Object.defineProperty(e,t,{get(){return r.value},set(e){let n=r.value;r.value=e,r.reflect&&Y(this,r.attribute,r.value,!!r.parse);for(let r=0,i=this.__propertyChangedCallbacks.length;r<i;r++)this.__propertyChangedCallbacks[r](t,e,n)},enumerable:!0,configurable:!0})}),n}function J(e){if(e)try{return JSON.parse(e)}catch{return e}}function Y(e,t,n,r){if(n==null||n===!1)return e.removeAttribute(t);let i=r?JSON.stringify(n):n;e.__updating[t]=!0,i===`true`&&(i=``),e.setAttribute(t,i),Promise.resolve().then(()=>delete e.__updating[t])}function ie(e){return e.replace(/\.?([A-Z]+)/g,(e,t)=>`-`+t.toLowerCase()).replace(`_`,`-`).replace(/^-/,``)}function X(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}function ae(e){return Object.prototype.toString.call(e)===`[object Function]`}function oe(e){return typeof e==`function`&&e.toString().indexOf(`class`)===0}var Z;function se(e,t){let n=Object.keys(t);return class extends e{static get observedAttributes(){return n.map(e=>t[e].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={};for(let e of n)this[e]=void 0}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=q(this,t);let e=K(this.props),n=this.Component,r=Z;try{Z=this,this.__initialized=!0,oe(n)?new n(e,{element:this}):n(e,{element:this})}finally{Z=r}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let e=null;for(;e=this.__releaseCallbacks.pop();)e(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(e,n,r){if(this.__initialized&&!this.__updating[e]&&(e=this.lookupProp(e),e in t)){if(r==null&&!this[e])return;this[e]=t[e].parse?J(r):r}}lookupProp(e){if(t)return n.find(n=>e===n||e===t[n].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:`open`})}addReleaseCallback(e){this.__releaseCallbacks.push(e)}addPropertyChangedCallback(e){this.__propertyChangedCallbacks.push(e)}}}function ce(e,t={},n={}){let{BaseElement:r=HTMLElement,extension:i,customElements:a=window.customElements}=n;return n=>{if(!e)throw Error(`tag is required to register a Component`);let o=a.get(e);return o?(o.prototype.Component=n,o):(o=se(r,G(t)),o.prototype.Component=n,o.prototype.registeredTag=e,a.define(e,o,i),o)}}function le(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let[a,o]=i(e[t[r]]);Object.defineProperty(n,t[r],{get:a,set(e){o(()=>e)}})}return n}function Q(e){if(e.assignedSlot&&e.assignedSlot._$owner)return e.assignedSlot._$owner;let t=e.parentNode;for(;t&&!t._$owner&&!(t.assignedSlot&&t.assignedSlot._$owner);)t=t.parentNode;return t&&t.assignedSlot?t.assignedSlot._$owner:e._$owner}function ue(e){return(n,r)=>{let{element:i}=r;return t(t=>{let a=le(n);i.addPropertyChangedCallback((e,t)=>a[e]=t),i.addReleaseCallback(()=>{i.renderRoot.textContent=``,t()});let o=e(a,r);return D(i.renderRoot,o)},Q(i))}}function de(e,t,n){return arguments.length===2&&(n=t,t={}),ce(e,t)(ue(n))}var fe=k(`<style>`);function pe(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function $(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function me(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function he(e){if(e)try{let t=JSON.parse(e.trim());if(typeof t==`object`&&t&&!Array.isArray(t)&&Object.values(t).every(e=>typeof e==`string`))return t}catch{}}function ge(e){return e===`hidden`||e===`visible`?e:void 0}function _e(t){t&&b(t),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-widget`)||de(`tokenflight-widget`,{"api-endpoint":``,"fiat-api-endpoint":``,"to-token":``,"from-token":``,"trade-type":``,amount:``,recipient:``,icon:``,"lock-from-token":!1,"lock-to-token":!1,"fiat-currency":``,methods:``,"default-pay-method":``,"from-tokens":``,"to-tokens":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"quote-card":``,"no-background":!1,"no-border":!1,"recipient-editable":!1,"refund-to":``,"rpc-overrides":``,referrer:``,"referrer-fee-bps":``},(t,{element:b})=>{let C={get apiEndpoint(){return t[`api-endpoint`]||y()||void 0},get fiatApiEndpoint(){return t[`fiat-api-endpoint`]||_()||void 0},get toToken(){return pe(t[`to-token`])},get fromToken(){return t[`from-token`]||void 0},get tradeType(){return t[`trade-type`]||void 0},get amount(){return t.amount||void 0},get recipient(){return t.recipient||void 0},get recipientEditable(){return s(t[`recipient-editable`])},get refundTo(){return t[`refund-to`]||void 0},get icon(){return t.icon||void 0},get lockFromToken(){return s(t[`lock-from-token`])},get lockToToken(){return s(t[`lock-to-token`])},get fiatCurrency(){return t[`fiat-currency`]||void 0},get methods(){return me(t.methods)??l()},get defaultPayMethod(){return t[`default-pay-method`]||void 0},get fromTokens(){return $(t[`from-tokens`])},get toTokens(){return $(t[`to-tokens`])},get titleText(){return t[`title-text`]||void 0},get titleImageUrl(){return t[`title-image`]||void 0},get theme(){return t.theme||S()||`light`},get locale(){return t.locale||x()||`en-US`},get hideTitle(){return g(b,t[`hide-title`],`hide-title`)?s(t[`hide-title`])??!1:m()},get hidePoweredBy(){return g(b,t[`hide-powered-by`],`hide-powered-by`)?s(t[`hide-powered-by`])??!1:ee()},get hideProvider(){return g(b,t[`hide-provider`],`hide-provider`)?s(t[`hide-provider`])??!1:c()},get quoteCard(){return ge(t[`quote-card`])},get noBackground(){return g(b,t[`no-background`],`no-background`)?s(t[`no-background`])??!1:u()},get noBorder(){return g(b,t[`no-border`],`no-border`)?s(t[`no-border`])??!1:v()},get rpcOverrides(){return he(t[`rpc-overrides`])??d()},get referrer(){return w().referrer},get referrerFeeBps(){return w().referrerFeeBps}},w=()=>a(t.referrer||h(),t[`referrer-fee-bps`]===``?f():Number(t[`referrer-fee-bps`]),b),T=t[`csp-nonce`]||void 0,[E,k]=i(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);e(R(e=>{k(e===z)}));let M=b.__customColors,N=n(()=>{let e=t.theme||S()||`light`,n=(e===`auto`?E():e===`dark`)?z:I,r=o();return`${H}\n:host { ${L(r||M?{...n,...r,...M}:n)} }`}),P=b.__walletAdapter,F=b.__callbacks;return[(()=>{var e=fe();return O(e,`nonce`,T),D(e,N),e})(),r(j,{client:A,get children(){return r(V,{config:C,get walletAdapter(){return P??te()},get callbacks(){return F?{...p(),...F}:p()}})}})]}))}export{U as n,_e as t};
@@ -0,0 +1 @@
1
+ import{D as e,E as t,S as n,T as r,_ as i,d as a,f as o,g as s,h as c,l,m as u,n as d,t as f,u as p,v as m,w as h,x as ee,y as g}from"./solid-iWr5Czxc.js";function _(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function v(e,t){_(e,t),t.add(e)}function y(e,t,n){_(e,t),t.set(e,n)}function b(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function x(e,t){return e.get(b(e,t))}function S(e,t,n){return e.set(b(e,t),n),n}var te=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),ne=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),re=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),ie=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function ae(e,t){let n=ie[e];return typeof n==`object`?n[t]?n.$:void 0:n}var oe=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),se=new Set(`altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-src.font-face-uri.foreignObject.g.glyph.glyphRef.hkern.image.line.linearGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.set.stop.svg.switch.symbol.text.textPath.tref.tspan.use.view.vkern`.split(`.`)),ce={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},le=e=>u(()=>e());function ue(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var de=`_$DX_DELEGATE`;function fe(e,t,n,r={}){let a;return i(r=>{a=r,t===document?e():Te(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{a(),t.textContent=``}}function pe(e,n,r,i){let a,o=()=>{let t=i?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,r?t.content.firstChild.firstChild:i?t.firstChild:t.content.firstChild},s=n?()=>t(()=>document.importNode(a||(a=o()),!0)):()=>(a||(a=o())).cloneNode(!0);return s.cloneNode=s,s}function me(e,t=window.document){let n=t[de]||(t[de]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,je))}}function he(e,t,n){C(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ge(e,t,n,r){C(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function _e(e,t,n){C(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function ve(e,t){C(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function ye(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function be(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(ke(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(ke(e,i,!0),n[i]=o)}return n}function xe(e,t,n){if(!t)return n?he(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||(n={}),t||(t={});let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function Se(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function Ce(e,t={},n,r){let i={};return r||c(()=>i.children=Me(e,t.children,i.children)),c(()=>typeof t.ref==`function`&&we(t.ref,e)),c(()=>Ee(e,t,n,!0,i,!0)),i}function we(e,n,r){return t(()=>e(n,r))}function Te(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Me(e,t,r,n);c(r=>Me(e,t(),r,n),r)}function Ee(e,t,n,r,i={},a=!1){t||(t={});for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=Ae(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||Me(e,t.children);continue}let s=t[o];i[o]=Ae(e,o,s,i[o],n,a,t)}}function De(e){let t,n;return!C()||!(t=h.registry.get(n=Ie()))?e():(h.completed&&h.completed.add(t),h.registry.delete(n),t)}function C(e){return!!h.context&&!h.done&&(!e||e.isConnected)}function Oe(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function ke(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function Ae(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return xe(e,n,r);if(t===`classList`)return be(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=oe.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(ye(e,i,n,a),a&&me([i]))}else if(t.slice(0,5)===`attr:`)he(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)_e(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=ne.has(t))||!i&&((u=ae(t,e.tagName))||(c=te.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(C(e))return n;t===`class`||t===`className`?ve(e,n):s&&!c&&!l?e[Oe(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&ce[t.split(`:`)[0]];r?ge(e,r,t,n):he(e,re[t]||t,n)}return n}function je(e){if(h.registry&&h.events&&h.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,`target`,{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t||document}}),h.registry&&!h.done&&(h.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function Me(e,t,n,r,i){let a=C(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Fe(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Fe(e,n,r)}else if(o===`function`)return c(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Me(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],l=n&&Array.isArray(n);if(Ne(o,t,n,i))return c(()=>n=Me(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Fe(e,n,r),s)return n}else l?n.length===0?Pe(e,o,r):ue(e,n,o):(n&&Fe(e),Pe(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Fe(e,n,r,t);Fe(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function Ne(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=Ne(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=Ne(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function Pe(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Fe(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function Ie(){return h.getNextContextId()}var Le=`http://www.w3.org/2000/svg`;function Re(e,t=!1,n=void 0){return t?document.createElementNS(Le,e):document.createElement(e,{is:n})}function ze(e,n){let r=u(e);return u(()=>{let e=r();switch(typeof e){case`function`:return t(()=>e(n));case`string`:let r=se.has(e),i=h.context?De():Re(e,r,t(()=>n.is));return Ce(i,n,r),i}})}function Be(e){let[,t]=r(e,[`component`]);return ze(()=>e.component,t)}var Ve=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},w,He,Ue={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},T=new(w=new WeakMap,He=new WeakMap,class{constructor(){y(this,w,Ue),y(this,He,!1)}setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&x(He,this)&&x(w,this),S(w,this,e),process.env.NODE_ENV!==`production`&&S(He,this,!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&S(He,this,!0),x(w,this).setTimeout(e,t)}clearTimeout(e){x(w,this).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&S(He,this,!0),x(w,this).setInterval(e,t)}clearInterval(e){x(w,this).clearInterval(e)}});function We(e){setTimeout(e,0)}var Ge=typeof window>`u`||`Deno`in globalThis;function E(){}function Ke(e,t){return typeof e==`function`?e(t):e}function qe(e){return typeof e==`number`&&e>=0&&e!==1/0}function Je(e,t){return Math.max(e+(t||0)-Date.now(),0)}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){return typeof e==`function`?e(t):e}function Ye(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Ze(o,t.options))return!1}else if(!$e(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Xe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Qe(t.options.mutationKey)!==Qe(a))return!1}else if(!$e(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ze(e,t){return(t?.queryKeyHashFn||Qe)(e)}function Qe(e){return JSON.stringify(e,(e,t)=>it(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $e(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>$e(e[n],t[n])):!1}var et=Object.prototype.hasOwnProperty;function tt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=rt(e)&&rt(t);if(!r&&!(it(e)&&it(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:et.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=tt(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function nt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function rt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function it(e){if(!at(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!at(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function at(e){return Object.prototype.toString.call(e)===`[object Object]`}function ot(e){return new Promise(t=>{T.setTimeout(t,e)})}function st(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return tt(e,t)}catch(e){throw e}return tt(e,t)}return t}function ct(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function lt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ut=Symbol();function dt(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn,!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ut?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ft(e,t){return typeof e==`function`?e(...t):!!e}function pt(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var mt,k,ht,gt=new(mt=new WeakMap,k=new WeakMap,ht=new WeakMap,class extends Ve{constructor(){super(),y(this,mt,void 0),y(this,k,void 0),y(this,ht,void 0),S(ht,this,e=>{if(!Ge&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){x(k,this)||this.setEventListener(x(ht,this))}onUnsubscribe(){this.hasListeners()||(x(k,this)?.call(this),S(k,this,void 0))}setEventListener(e){S(ht,this,e),x(k,this)?.call(this),S(k,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){x(mt,this)!==e&&(S(mt,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof x(mt,this)==`boolean`?x(mt,this):globalThis.document?.visibilityState!==`hidden`}});function _t(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function vt(e){let t;if(e.then(e=>(t=e,e),E)?.catch(E),t!==void 0)return{data:t}}function yt(e){return e}function bt(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??yt,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l})=>{let u=c?vt(c):void 0,d=r.data===void 0?u?.data:r.data,f=d===void 0?d:a(d),p=i.get(o),m=p?.state.status===`pending`,h=p?.state.fetchStatus===`fetching`;if(p){let e=u&&l!==void 0&&l>p.state.dataUpdatedAt;if(r.dataUpdatedAt>p.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;p.setState({...t,data:f})}}else p=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s},{...r,data:f,fetchStatus:`idle`,status:f===void 0?r.status:`success`});c&&!m&&!h&&(l===void 0||l>p.state.dataUpdatedAt)&&p.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(E)})}var xt=We;function St(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=xt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=St(),Ct,wt,Tt,Et=new(Ct=new WeakMap,wt=new WeakMap,Tt=new WeakMap,class extends Ve{constructor(){super(),y(this,Ct,!0),y(this,wt,void 0),y(this,Tt,void 0),S(Tt,this,e=>{if(!Ge&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){x(wt,this)||this.setEventListener(x(Tt,this))}onUnsubscribe(){this.hasListeners()||(x(wt,this)?.call(this),S(wt,this,void 0))}setEventListener(e){S(Tt,this,e),x(wt,this)?.call(this),S(wt,this,e(this.setOnline.bind(this)))}setOnline(e){x(Ct,this)!==e&&(S(Ct,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return x(Ct,this)}});function Dt(e){return Math.min(1e3*2**e,3e4)}function Ot(e){return(e??`online`)===`online`?Et.isOnline():!0}var kt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function At(e){let t=!1,n=0,r,i=_t(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new kt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>gt.isFocused()&&(e.networkMode===`always`||Et.isOnline())&&e.canRun(),u=()=>Ot(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ge?0:3),o=e.retryDelay??Dt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ot(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var jt,Mt=(jt=new WeakMap,class{constructor(){y(this,jt,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qe(this.gcTime)&&S(jt,this,T.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ge?1/0:300*1e3))}clearGcTimeout(){x(jt,this)&&(T.clearTimeout(x(jt,this)),S(jt,this,void 0))}}),Nt,Pt,j,Ft,M,It,Lt,N,Rt=(Nt=new WeakMap,Pt=new WeakMap,j=new WeakMap,Ft=new WeakMap,M=new WeakMap,It=new WeakMap,Lt=new WeakMap,N=new WeakSet,class extends Mt{constructor(e){super(),v(this,N),y(this,Nt,void 0),y(this,Pt,void 0),y(this,j,void 0),y(this,Ft,void 0),y(this,M,void 0),y(this,It,void 0),y(this,Lt,void 0),S(Lt,this,!1),S(It,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],S(Ft,this,e.client),S(j,this,x(Ft,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,S(Nt,this,Vt(this.options)),this.state=e.state??x(Nt,this),this.scheduleGc()}get meta(){return this.options.meta}get promise(){return x(M,this)?.promise}setOptions(e){if(this.options={...x(It,this),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Vt(this.options);e.data!==void 0&&(this.setState(Bt(e.data,e.dataUpdatedAt)),S(Nt,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&x(j,this).remove(this)}setData(e,t){let n=st(this.state.data,e,this.options);return b(N,this,P).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){b(N,this,P).call(this,{type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=x(M,this)?.promise;return x(M,this)?.cancel(e),t?t.then(E).catch(E):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(x(Nt,this))}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ut||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>D(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Je(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),x(M,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),x(M,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),x(j,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(x(M,this)&&(x(Lt,this)?x(M,this).cancel({revert:!0}):x(M,this).cancelRetry()),this.scheduleGc()),x(j,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||b(N,this,P).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&x(M,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(x(M,this))return x(M,this).continueRetry(),x(M,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&Array.isArray(this.options.queryKey);let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(S(Lt,this,!0),n.signal)})},i=()=>{let e=dt(this.options,t),n=(()=>{let e={client:x(Ft,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return S(Lt,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:x(Ft,this),state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),S(Pt,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&b(N,this,P).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),S(M,this,At({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof kt&&e.revert&&this.setState({...x(Pt,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{b(N,this,P).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{b(N,this,P).call(this,{type:`pause`})},onContinue:()=>{b(N,this,P).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await x(M,this).start();if(e===void 0)throw process.env.NODE_ENV,Error(`${this.queryHash} data is undefined`);return this.setData(e),x(j,this).config.onSuccess?.(e,this),x(j,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof kt){if(e.silent)return x(M,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw b(N,this,P).call(this,{type:`error`,error:e}),x(j,this).config.onError?.(e,this),x(j,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function P(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...zt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Bt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return S(Pt,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),x(j,this).notify({query:this,type:`updated`,action:e})})}function zt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ot(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Bt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Vt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var F,I,Ht,L,Ut,Wt,R,z,Gt,Kt,qt,Jt,Yt,B,Xt,V,Zt=(F=new WeakMap,I=new WeakMap,Ht=new WeakMap,L=new WeakMap,Ut=new WeakMap,Wt=new WeakMap,R=new WeakMap,z=new WeakMap,Gt=new WeakMap,Kt=new WeakMap,qt=new WeakMap,Jt=new WeakMap,Yt=new WeakMap,B=new WeakMap,Xt=new WeakMap,V=new WeakSet,class extends Ve{constructor(e,t){super(),v(this,V),y(this,F,void 0),y(this,I,void 0),y(this,Ht,void 0),y(this,L,void 0),y(this,Ut,void 0),y(this,Wt,void 0),y(this,R,void 0),y(this,z,void 0),y(this,Gt,void 0),y(this,Kt,void 0),y(this,qt,void 0),y(this,Jt,void 0),y(this,Yt,void 0),y(this,B,void 0),y(this,Xt,new Set),this.options=t,S(F,this,e),S(z,this,null),S(R,this,_t()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(x(I,this).addObserver(this),ln(x(I,this),this.options)?b(V,this,Qt).call(this):this.updateResult(),b(V,this,nn).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return un(x(I,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return un(x(I,this),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,b(V,this,rn).call(this),b(V,this,an).call(this),x(I,this).removeObserver(this)}setOptions(e){let t=this.options,n=x(I,this);if(this.options=x(F,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,x(I,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);b(V,this,on).call(this),x(I,this).setOptions(this.options),t._defaulted&&!nt(this.options,t)&&x(F,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:x(I,this),observer:this});let r=this.hasListeners();r&&dn(x(I,this),n,this.options,t)&&b(V,this,Qt).call(this),this.updateResult(),r&&(x(I,this)!==n||O(this.options.enabled,x(I,this))!==O(t.enabled,x(I,this))||D(this.options.staleTime,x(I,this))!==D(t.staleTime,x(I,this)))&&b(V,this,$t).call(this);let i=b(V,this,en).call(this);r&&(x(I,this)!==n||O(this.options.enabled,x(I,this))!==O(t.enabled,x(I,this))||i!==x(B,this))&&b(V,this,tn).call(this,i)}getOptimisticResult(e){let t=x(F,this).getQueryCache().build(x(F,this),e),n=this.createResult(t,e);return pn(this,n)&&(S(L,this,n),S(Wt,this,this.options),S(Ut,this,x(I,this).state)),n}getCurrentResult(){return x(L,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&x(R,this).status===`pending`&&x(R,this).reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){x(Xt,this).add(e)}getCurrentQuery(){return x(I,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=x(F,this).defaultQueryOptions(e),n=x(F,this).getQueryCache().build(x(F,this),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return b(V,this,Qt).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),x(L,this)))}createResult(e,t){let n=x(I,this),r=this.options,i=x(L,this),a=x(Ut,this),o=x(Wt,this),s=e===n?x(Ht,this):e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ln(e,t),o=i&&dn(e,n,t,r);(a||o)&&(l={...l,...zt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(x(qt,this)?.state.data,x(qt,this)):t.placeholderData,e!==void 0&&(m=`success`,d=st(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===x(Gt,this))d=x(Kt,this);else try{S(Gt,this,t.select),d=t.select(d),d=st(i?.data,d,t),S(Kt,this,d),S(z,this,null)}catch(e){S(z,this,e)}x(z,this)&&(f=x(z,this),d=x(Kt,this),p=Date.now(),m=`error`);let ee=l.fetchStatus===`fetching`,g=m===`pending`,_=m===`error`,v=g&&ee,y=d!==void 0,b={status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:_,isInitialLoading:v,isLoading:v,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:ee,isRefetching:ee&&!g,isLoadingError:_&&!y,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&y,isStale:fn(e,t),refetch:this.refetch,promise:x(R,this),isEnabled:O(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=b.data!==void 0,r=b.status===`error`&&!t,i=e=>{r?e.reject(b.error):t&&e.resolve(b.data)},a=()=>{i(S(R,this,b.promise=_t()))},o=x(R,this);switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||b.data!==o.value)&&a();break;case`rejected`:(!r||b.error!==o.reason)&&a();break}}return b}updateResult(){let e=x(L,this),t=this.createResult(x(I,this),this.options);S(Ut,this,x(I,this).state),S(Wt,this,this.options),x(Ut,this).data!==void 0&&S(qt,this,x(I,this)),!nt(t,e)&&(S(L,this,t),b(V,this,sn).call(this,{listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!x(Xt,this).size)return!0;let r=new Set(n??x(Xt,this));return this.options.throwOnError&&r.add(`error`),Object.keys(x(L,this)).some(t=>{let n=t;return x(L,this)[n]!==e[n]&&r.has(n)})})()}))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&b(V,this,nn).call(this)}});function Qt(e){b(V,this,on).call(this);let t=x(I,this).fetch(this.options,e);return e?.throwOnError||(t=t.catch(E)),t}function $t(){b(V,this,rn).call(this);let e=D(this.options.staleTime,x(I,this));if(Ge||x(L,this).isStale||!qe(e))return;let t=Je(x(L,this).dataUpdatedAt,e)+1;S(Jt,this,T.setTimeout(()=>{x(L,this).isStale||this.updateResult()},t))}function en(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(x(I,this)):this.options.refetchInterval)??!1}function tn(e){b(V,this,an).call(this),S(B,this,e),!(Ge||O(this.options.enabled,x(I,this))===!1||!qe(x(B,this))||x(B,this)===0)&&S(Yt,this,T.setInterval(()=>{(this.options.refetchIntervalInBackground||gt.isFocused())&&b(V,this,Qt).call(this)},x(B,this)))}function nn(){b(V,this,$t).call(this),b(V,this,tn).call(this,b(V,this,en).call(this))}function rn(){x(Jt,this)&&(T.clearTimeout(x(Jt,this)),S(Jt,this,void 0))}function an(){x(Yt,this)&&(T.clearInterval(x(Yt,this)),S(Yt,this,void 0))}function on(){let e=x(F,this).getQueryCache().build(x(F,this),this.options);if(e===x(I,this))return;let t=x(I,this);S(I,this,e),S(Ht,this,e.state),this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}function sn(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(x(L,this))}),x(F,this).getQueryCache().notify({query:x(I,this),type:`observerResultsUpdated`})})}function cn(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ln(e,t){return cn(e,t)||e.state.data!==void 0&&un(e,t,t.refetchOnMount)}function un(e,t,n){if(O(t.enabled,e)!==!1&&D(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&fn(e,t)}return!1}function dn(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&fn(e,n)}function fn(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(D(t.staleTime,e))}function pn(e,t){return!nt(e.getCurrentResult(),t)}function mn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{pt(e,()=>t.signal,()=>n=!0)},u=dt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?lt:ct;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?gn:hn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:hn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function hn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var _n,H,U,vn,W,yn=(_n=new WeakMap,H=new WeakMap,U=new WeakMap,vn=new WeakMap,W=new WeakSet,class extends Mt{constructor(e){super(),v(this,W),y(this,_n,void 0),y(this,H,void 0),y(this,U,void 0),y(this,vn,void 0),S(_n,this,e.client),this.mutationId=e.mutationId,S(U,this,e.mutationCache),S(H,this,[]),this.state=e.state||bn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){x(H,this).includes(e)||(x(H,this).push(e),this.clearGcTimeout(),x(U,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){S(H,this,x(H,this).filter(t=>t!==e)),this.scheduleGc(),x(U,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){x(H,this).length||(this.state.status===`pending`?this.scheduleGc():x(U,this).remove(this))}continue(){return x(vn,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{b(W,this,G).call(this,{type:`continue`})},n={client:x(_n,this),meta:this.options.meta,mutationKey:this.options.mutationKey};S(vn,this,At({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{b(W,this,G).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{b(W,this,G).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>x(U,this).canRun(this)}));let r=this.state.status===`pending`,i=!x(vn,this).canStart();try{if(r)t();else{b(W,this,G).call(this,{type:`pending`,variables:e,isPaused:i}),x(U,this).config.onMutate&&await x(U,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&b(W,this,G).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await x(vn,this).start();return await x(U,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await x(U,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),b(W,this,G).call(this,{type:`success`,data:a}),a}catch(t){try{await x(U,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await x(U,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw b(W,this,G).call(this,{type:`error`,error:t}),t}finally{x(U,this).runNext(this)}}});function G(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),A.batch(()=>{x(H,this).forEach(t=>{t.onMutationUpdate(e)}),x(U,this).notify({mutation:this,type:`updated`,action:e})})}function bn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var K,q,xn,Sn=(K=new WeakMap,q=new WeakMap,xn=new WeakMap,class extends Ve{constructor(e={}){super(),y(this,K,void 0),y(this,q,void 0),y(this,xn,void 0),this.config=e,S(K,this,new Set),S(q,this,new Map),S(xn,this,0)}build(e,t,n){var r;let i=new yn({client:e,mutationCache:this,mutationId:S(xn,this,(r=x(xn,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){x(K,this).add(e);let t=Cn(e);if(typeof t==`string`){let n=x(q,this).get(t);n?n.push(e):x(q,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(x(K,this).delete(e)){let t=Cn(e);if(typeof t==`string`){let n=x(q,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&x(q,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Cn(e);if(typeof t==`string`){let n=x(q,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Cn(e);return typeof t==`string`?(x(q,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{x(K,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),x(K,this).clear(),x(q,this).clear()})}getAll(){return Array.from(x(K,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Xe(t,e))}findAll(e={}){return this.getAll().filter(t=>Xe(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(E))))}});function Cn(e){return e.options.scope?.id}var J,wn=(J=new WeakMap,class extends Ve{constructor(e={}){super(),y(this,J,void 0),this.config=e,S(J,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ze(r,t),a=this.get(i);return a||(a=new Rt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){x(J,this).has(e.queryHash)||(x(J,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=x(J,this).get(e.queryHash);t&&(e.destroy(),t===e&&x(J,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return x(J,this).get(e)}getAll(){return[...x(J,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ye(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ye(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),Y,Tn,En,Dn,On,X,kn,An,jn=(Y=new WeakMap,Tn=new WeakMap,En=new WeakMap,Dn=new WeakMap,On=new WeakMap,X=new WeakMap,kn=new WeakMap,An=new WeakMap,class{constructor(e={}){y(this,Y,void 0),y(this,Tn,void 0),y(this,En,void 0),y(this,Dn,void 0),y(this,On,void 0),y(this,X,void 0),y(this,kn,void 0),y(this,An,void 0),S(Y,this,e.queryCache||new wn),S(Tn,this,e.mutationCache||new Sn),S(En,this,e.defaultOptions||{}),S(Dn,this,new Map),S(On,this,new Map),S(X,this,0)}mount(){var e;S(X,this,(e=x(X,this),e++,e)),x(X,this)===1&&(S(kn,this,gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),x(Y,this).onFocus())})),S(An,this,Et.subscribe(async e=>{e&&(await this.resumePausedMutations(),x(Y,this).onOnline())})))}unmount(){var e;S(X,this,(e=x(X,this),e--,e)),x(X,this)===0&&(x(kn,this)?.call(this),S(kn,this,void 0),x(An,this)?.call(this),S(An,this,void 0))}isFetching(e){return x(Y,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return x(Tn,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return x(Y,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=x(Y,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(D(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return x(Y,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=x(Y,this).get(r.queryHash)?.state.data,a=Ke(t,i);if(a!==void 0)return x(Y,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>x(Y,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return x(Y,this).get(t.queryHash)?.state}removeQueries(e){let t=x(Y,this);A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=x(Y,this);return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=A.batch(()=>x(Y,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(E).catch(E)}invalidateQueries(e,t={}){return A.batch(()=>(x(Y,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=A.batch(()=>x(Y,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(E)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(E)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=x(Y,this).build(this,t);return n.isStaleByTime(D(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(E).catch(E)}fetchInfiniteQuery(e){return e.behavior=mn(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(E).catch(E)}ensureInfiniteQueryData(e){return e.behavior=mn(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Et.isOnline()?x(Tn,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return x(Y,this)}getMutationCache(){return x(Tn,this)}getDefaultOptions(){return x(En,this)}setDefaultOptions(e){S(En,this,e)}setQueryDefaults(e,t){x(Dn,this).set(Qe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...x(Dn,this).values()],n={};return t.forEach(t=>{$e(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){x(On,this).set(Qe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...x(On,this).values()],n={};return t.forEach(t=>{$e(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...x(En,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ze(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ut&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...x(En,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){x(Y,this).clear(),x(Tn,this).clear()}}),Mn=Symbol(`store-raw`),Nn=Symbol(`store-node`),Z=Symbol(`store-has`),Pn=Symbol(`store-self`);function Fn(e){let t=e[f];if(!t&&(Object.defineProperty(e,f,{value:t=new Proxy(e,Hn)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;i<a;i++){let a=n[i];r[a].get&&Object.defineProperty(e,a,{enumerable:r[a].enumerable,get:r[a].get.bind(t)})}}return t}function Q(e){let t;return typeof e==`object`&&!!e&&(e[f]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function In(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Mn])return n;if(!Q(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=In(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=In(i,t))!==i&&(e[a]=r))}return e}function Ln(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Rn(e,t,n){if(e[t])return e[t];let[r,i]=m(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function zn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===f||t===Nn?n:(delete n.value,delete n.writable,n.get=()=>e[f][t],n)}function Bn(e){g()&&Rn(Ln(e,Nn),Pn)()}function Vn(e){return Bn(e),Reflect.ownKeys(e)}var Hn={get(e,t,n){if(t===Mn)return e;if(t===f)return n;if(t===d)return Bn(e),n;let r=Ln(e,Nn),i=r[t],a=i?i():e[t];if(t===Nn||t===Z||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);g()&&(typeof a!=`function`||e.hasOwnProperty(t))&&!(n&&n.get)&&(a=Rn(r,t,a)())}return Q(a)?Fn(a):a},has(e,t){return t===Mn||t===f||t===d||t===Nn||t===Z||t===`__proto__`?!0:(g()&&Rn(Ln(e,Z),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Vn,getOwnPropertyDescriptor:zn};function $(e,t,n,r=!1){if(!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[Z]&&e[Z][t]&&i!==void 0&&e[Z][t].$()):(e[t]=n,e[Z]&&e[Z][t]&&i===void 0&&e[Z][t].$());let o=Ln(e,Nn),s;if((s=Rn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Rn(o,`length`,a))&&s.$(e.length)}(s=o[Pn])&&s.$()}function Un(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];$(e,i,t[i])}}function Wn(e,t){if(typeof t==`function`&&(t=t(e)),t=In(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&$(e,n,r)}$(e,`length`,r)}else Un(e,t)}function Gn(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)Gn(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&Gn(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)Gn(e,[r].concat(t),n);return}else if(t.length>1){Gn(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=In(a),r===void 0||Q(i)&&Q(a)&&!Array.isArray(a)?Un(i,a):$(e,r,a))}function Kn(...[e,t]){let n=In(e||{}),r=Array.isArray(n),i=Fn(n);function a(...e){l(()=>{r&&e.length===1?Wn(n,e[0]):Gn(n,e)})}return[i,a]}var qn=Symbol(`store-root`);function Jn(e,t,n,r,i){let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==qn&&(!Q(e)||!Q(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){$(t,n,e);return}if(o){if(e.length&&a.length&&(!r||i&&e[0]&&e[0][i]!=null)){let t,n,o,s,c,l,u,d;for(o=0,s=Math.min(a.length,e.length);o<s&&(a[o]===e[o]||i&&a[o]&&e[o]&&a[o][i]&&a[o][i]===e[o][i]);o++)Jn(e[o],a,o,r,i);let f=Array(e.length),p=new Map;for(s=a.length-1,c=e.length-1;s>=o&&c>=o&&(a[s]===e[c]||i&&a[s]&&e[c]&&a[s][i]&&a[s][i]===e[c][i]);s--,c--)f[c]=a[s];if(o>c||o>s){for(n=o;n<=c;n++)$(a,n,e[n]);for(;n<e.length;n++)$(a,n,f[n]),Jn(e[n],a,n,r,i);a.length>e.length&&$(a,`length`,e.length);return}for(u=Array(c+1),n=c;n>=o;n--)l=e[n],d=i&&l?l[i]:l,t=p.get(d),u[n]=t===void 0?-1:t,p.set(d,n);for(t=o;t<=s;t++)l=a[t],d=i&&l?l[i]:l,n=p.get(d),n!==void 0&&n!==-1&&(f[n]=a[t],n=u[n],p.set(d,n));for(n=o;n<e.length;n++)n in f?($(a,n,f[n]),Jn(e[n],a,n,r,i)):$(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)Jn(e[t],a,t,r,i);a.length>e.length&&$(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)Jn(e[s[t]],a,s[t],r,i);let c=Object.keys(a);for(let t=0,n=c.length;t<n;t++)e[c[t]]===void 0&&$(a,c[t],void 0)}function Yn(e,t={}){let{merge:n,key:r=`id`}=t,i=In(e);return e=>{if(!Q(e)||!Q(i))return i;let t=Jn(i,{[qn]:e},qn,n,r);return t===void 0?e:t}}var Xn=o(void 0),Zn=t=>{if(t)return t;let n=e(Xn);if(!n)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return n()},Qn=e=>(c(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),n(()=>e.client.unmount()),p(Xn.Provider,{value:()=>e.client,get children(){return e.children}})),$n=o(()=>!1),er=()=>e($n);$n.Provider;function tr(e,t,n,r){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let i=t.data;if(e.data===void 0)try{i=structuredClone(i)}catch{}let a=Yn(i,{key:n})(e.data);return{...t,data:a}}var nr=(e,t)=>t;function rr(e,t,r){let i=u(()=>Zn(r?.())),o=er(),c=u(()=>{let t=i().defaultQueryOptions(e());return t._optimisticResults=o()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),l=c(),[d,f]=m(new t(i(),c())),p=d().getOptimisticResult(c()),[h,g]=Kn(p),_=()=>d().subscribe(e=>{p=e,queueMicrotask(()=>{b&&te()})});function v(e){let t=d().options,n=t.reconcile;g(r=>tr(r,e,n===void 0?!1:n,t.queryHash))}function y(){return[()=>h,e=>{let t=In(h);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}v(e)}]}let b=null,x=null,[S,{refetch:te}]=s(()=>{let e=d();return new Promise((t,n)=>{if(x=t,!b&&!o()&&(b=_()),e.updateResult(),p.isError&&!p.isFetching&&!o()&&ft(e.options.throwOnError,[p.error,e.getCurrentQuery()]))return v(p),n(p.error);if(!p.isLoading)return x=null,t(nr(e.getCurrentQuery(),p));v(p)})},{storage:y,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&bt(i(),{queries:[{...t.value.hydrationData}]}),b)return;let n={...l};(l.staleTime||!l.initialData)&&t.value&&(n.refetchOnMount=!1),d().setOptions(n),v(d().getOptimisticResult(n)),b=_()}});return a(ee(i,e=>{b&&b();let n=new t(e,c());b=_(),f(n)},{defer:!0})),a(ee(o,e=>{e||te()},{defer:!0})),n(()=>{b&&(b(),b=null),x&&(x(p),x=null)}),a(ee([d,c],([e,t])=>{e.setOptions(t),v(e.getOptimisticResult(t)),te()},{defer:!0})),new Proxy(h,{get(e,t){return t===`data`?h.data===void 0?S()?.data:S.latest?.data:Reflect.get(e,t)}})}function ir(e,t){return rr(u(()=>e()),Zt,t)}var ar=new class extends jn{constructor(e={}){super(e)}}({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),or={skeleton:`tf-1ac2ef`,pulse:`tf-90e981`,selectorOverlay:`tf-68a980`,"tf-fade-in":`tf-ed0355`,selectorOverlayDismissing:`tf-0c7f16`,"tf-overlay-fade-out":`tf-9cad3e`,container:`tf-e7b9c7`,backButton:`tf-affc9b`,backButtonExiting:`tf-013ec9`,receiveMethodStableContainer:`tf-dc1cc1`,noBg:`tf-b4f391`,noBorder:`tf-118b57`,accentLine:`tf-07225e`,ctaWrapper:`tf-d01dff`,ctaWrapperReceive:`tf-5bb68c`,footerSlot:`tf-37ddcc`,footerSpacer:`tf-d256dd`,noOffer:`tf-04e1e2`,"tf-slide-up":`tf-b61e63`,noOfferIcon:`tf-d01908`,noOfferText:`tf-1cc72b`,explorerLink:`tf-480f1a`,explorerLinkReceive:`tf-bc7950`,recipientBadge:`tf-d9b7b4`,recipientBadgeEmpty:`tf-9398ea`,recipientBadgeText:`tf-2d9323`,recipientBadgeLocked:`tf-4567e1`,recipientPlaceholder:`tf-58881e`,flexCenter:`tf-c7b4d2`,flexCol:`tf-771a48`,flexRow:`tf-e2b7ba`,flexBetween:`tf-6f7fab`,fadeIn:`tf-b15cde`,idleCard:`tf-52678c`,idleIcon:`tf-25f74d`,idleTitle:`tf-b385cd`,idleSub:`tf-dc46f6`,disabledOpacity:`tf-55c652`,monoAmount:`tf-2ad189`,dividerLine:`tf-192a37`,providerIconInline:`tf-44389f`,payMethodTabs:`tf-58158c`,payMethodTab:`tf-6f8fbb`,payMethodTabActive:`tf-2a2ad5`};export{S as _,Be as a,y as b,Te as c,he as d,Se as f,we as g,pe as h,ir as i,le as l,xe as m,ar as n,ye as o,Ce as p,Qn as r,ve as s,or as t,fe as u,x as v,v as x,b as y};