@tokenflight/swap 0.3.0 → 0.3.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReceiveComponent-DrVCp370.js +1 -0
- package/dist/SwapComponent-DMJ9Vnuc.js +1 -0
- package/dist/{bridge-BufC2_tK.js → bridge-B12bx0Ea.js} +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{dist-CsBuWseE.js → dist-CpC2fQqU.js} +1 -1
- package/dist/en-US-BMJO2sGe.js +1 -0
- package/dist/{errors-DeB4WVzG.js → errors-BMU5s_Au.js} +1 -1
- package/dist/iframe-entry.js +2 -2
- package/dist/iframe.d.ts +1 -1
- package/dist/iframe.js +2 -1
- package/dist/ja-JP-BCMq7oj9.js +1 -0
- package/dist/ko-KR-CNy9wYQD.js +1 -0
- package/dist/rank-offers-94_Vuact.js +1 -0
- package/dist/{register-widget-D6m_f_gp.js → register-widget-DGeLOf67.js} +1 -1
- package/dist/{shared.module-Bs-BN_nM.js → shared.module-Bk8Fpur5.js} +1 -1
- package/dist/swap.css +1 -1
- package/dist/tokenflight-swap.d.ts +7 -1
- package/dist/tokenflight-swap.js +1 -1
- package/dist/tokenflight-swap.umd.cjs +10 -10
- package/dist/usePageRouter-BV0kz9ap.js +1 -0
- package/dist/widget-zSdkT7wD.js +2 -0
- package/dist/widget.d.ts +7 -1
- package/dist/widget.js +1 -1
- package/dist/zh-CN-CtFy8Sce.js +1 -0
- package/dist/zh-TW-DeiLbWLm.js +1 -0
- package/package.json +2 -2
- package/dist/ReceiveComponent-YtkLLaLd.js +0 -1
- package/dist/SwapComponent-CBJpgat4.js +0 -1
- package/dist/en-US-BsEBXsff.js +0 -1
- package/dist/ja-JP-DckpHLDh.js +0 -1
- package/dist/ko-KR-jzHfArkK.js +0 -1
- package/dist/rank-offers-4N4cmoQy.js +0 -1
- package/dist/usePageRouter-BI7v3BwA.js +0 -1
- package/dist/widget-B0OLriHf.js +0 -2
- package/dist/zh-CN-Cm_ni5eM.js +0 -1
- package/dist/zh-TW-BnoGGI9_.js +0 -1
|
@@ -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-DqvEpdeb.js";import{o as m,r as ee,t as te}from"./dist-CpC2fQqU.js";import{t as h}from"./errors-BMU5s_Au.js";import{c as g,f as _,g as v,h as ne,l as y,n as b,r as re,s as x,t as S,u as C}from"./shared.module-Bk8Fpur5.js";import{A as w,C as T,D as E,E as ie,M as D,O as ae,T as oe,_ as se,g as ce,h as le,i as ue,j as de,k as O,l as fe,p as pe,s as me,t as he,v as ge,w as _e,x as ve}from"./rank-offers-94_Vuact.js";import{A as ye,At as be,B as xe,C as k,D as Se,Et as Ce,F as we,G as Te,H as Ee,J as De,L as Oe,M as ke,Mt as Ae,N as je,Nt as Me,O as Ne,P as Pe,R as Fe,S as Ie,T as Le,U as Re,V as ze,W as Be,X as Ve,Y as He,Z as Ue,_ as We,_t as Ge,a as Ke,at as qe,bt as Je,c as Ye,ct as Xe,d as Ze,et as Qe,f as A,ft as $e,g as et,gt as j,h as tt,ht as nt,i as rt,j as it,k as at,kt as ot,l as st,lt as ct,m as lt,n as ut,nt as dt,o as ft,pt,r as mt,rt as ht,s as gt,st as _t,t as vt,u as yt,ut as bt,vt as xt,x as St,xt as Ct,y as wt,yt as Tt,z as Et}from"./usePageRouter-BV0kz9ap.js";var M=1.05;function Dt(e,t){let n=e.chainId===t.chainId,r=ae(e.symbol,t.symbol),i=de(e.symbol,t.symbol),a=D(e.symbol),o=D(t.symbol),s=O(e.symbol);return n&&r?1:r?2:i||a&&o?n?3:4:a&&!o?5:s?6:n?7:8}function Ot(e){return+!!ie.has(e)}function kt(e){let t=new Map;for(let n of e){if(!w(n.address))continue;let e=n.extensions?.balance??`0`;if(e===`0`)continue;let r=Number(ge(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 At(e,t,n){return w(e)?!0:(n.get(t)??0)>=E}function jt(e,t,n,r,i){if(e.length===0)return[];let a=kt(e),o={address:r,chainId:n},s=[];for(let r of e){if(T(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(ge(e,r.decimals))*c;if(l<1||i!==void 0&&l<i*M||!At(r.address,r.chainId,a))continue;let u=Dt({symbol:r.symbol,chainId:r.chainId},{symbol:t,chainId:n});s.push({token:r,tier:u,gasCostScore:Ot(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 Mt(e){let t=mt();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=>T(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(h.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=se(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=>T(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(h.QUOTE_EXPIRED);return}}catch{e.setError(`Quote expired and could not be refreshed`),e.setErrorCode(h.QUOTE_EXPIRED);return}finally{e.setLoadingQuotes(!1)}}let o=e.selectedPayToken(),s=o?e.payTokenQuotes().find(e=>T(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(ge(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 rt(e.walletAdapter(),n,s.token.chainId);e.setExecPhase(`submitting`);let a=await gt(e.client(),s.quoteId,s.route.routeId,r);e.setExecPhase(`tracking`),t.setTrackingOrderId(a.orderId)}catch(n){let r=Ke(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([])}),ft(t,e.client().baseUrl),e.onReset?.()}}}var N={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`},Nt=v(`<img height=22>`),Pt=v(`<button part=wallet-info><div data-testid=wallet-dot></div><span data-testid=wallet-address>`),Ft=v(`<div part=header><div><div data-testid=header-brand data-header-brand-state=idle><span data-testid=header-title>`),It=v(`<button part=recipient-badge data-testid=recipient-badge><span>`),Lt=v(`<div>`),Rt=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>`),zt=v(`<div data-testid=receive-amount-shell>`),Bt=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>`),Vt=v(`<button data-testid=receive-method-back-button type=button><span></span><span>`),Ht=v(`<div style=flex:1;display:flex;flex-direction:column><div data-testid=receive-method-header>`),Ut=v(`<span>Flight`),Wt=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>`),Gt=v(`<span data-testid=receive-amount>`),Kt=v(`<span data-testid=receive-method-label>`),qt=v(`<div data-testid=receive-method-pane-spacer>`),Jt=v(`<div part=payment-list style="padding:0 20px">`),Yt=v(`<div part=pay-token-error style="padding:8px 20px 0;color:var(--tf-error);font-size:var(--tf-font-xs)">`),Xt=v(`<div part=price-preview data-testid=quote>`),Zt=v(`<div style=min-height:186px;display:flex;flex-direction:column>`),Qt=v(`<button part=button-primary type=button>`),$t=v(`<button disabled type=button><span><span>`),en=v(`<button disabled type=button style=opacity:0.6>`),tn=v(`<div part=cta-wrapper style=margin-top:auto>`),nn=v(`<div style=display:contents>`),rn=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>`),an=v(`<div style="padding:0 20px"><div><div><div></div><div><div></div><div></div></div></div><div><div></div><div>`),on=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">`),sn=v(`<span data-testid=pay-empty-text>`),cn=v(`<div data-testid=pay-empty>`),ln=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">`),un=v(`<span data-testid=recommended-badge>`),dn=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>`),fn=v(`<div data-testid=pay-selected-amount>`),pn=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 mn(e,n){let[r,i]=f(!1);return l(p(e,e=>{if(!e)return;i(!1);let n=window.requestAnimationFrame(()=>i(!0));t(()=>window.cancelAnimationFrame(n))})),l(p(n,e=>{e||i(!1)})),r}function hn(e){return d(A,{get children(){return d(gn,e)}})}function gn(v){let{t:w}=Me(),E=We(),ie=Me();e(()=>{v.config.locale&&ie.setLocale(v.config.locale)});let D=s(()=>v.config.methods??[`crypto`]),ae=s(()=>D().includes(`crypto`)),de=s(()=>D().includes(`card`)),{page:O,setPage:Ke,backExiting:A,handleBack:rt,onBackAnimEnd:ft}=vt({methods:D}),[mt,gt]=f(`idle`),M=s(()=>!!v.config.noBackground&&!!v.config.noBorder),Dt=s(()=>D().length>1&&O()!==`entry`),Ot,kt=()=>{Ot&&(clearTimeout(Ot),Ot=void 0)},At=()=>{kt(),ft()},hn=()=>{kt(),Ot=setTimeout(At,260)};t(kt);let gn=e=>{O()!==e&&(gt(`forward`),Ke(e))},_n=()=>{if(!A()){if(Dt()){rt(),hn(),gt(`back`),Ke(`entry`);return}rt()}},vn=()=>{At()},[yn,bn]=f(v.config.amount??``),xn=()=>!!v.config.amountEditable,P=()=>xn()?yn():v.config.amount??``,{payTokenSelector:F,targetSelector:I,fiatPaymentHandoff:L,recipient:R}=dt([`payTokenSelector`,`targetSelector`,`fiatPaymentHandoff`,`recipient`]),Sn=mn(F.open,F.mounted),Cn=mn(I.open,I.mounted),[wn,Tn]=f(null),[En,Dn]=f(null),[On,kn]=f(null),[z,B]=f([]),[An,V]=f(!1),[jn,Mn]=f(!1),[Nn,Pn]=f(!1),[H,U]=f(null),[Fn,In]=f(null),[Ln,W]=f(null),[Rn,zn]=f(null),[Bn,Vn]=f(!1),Hn=(e,t)=>{t instanceof HTMLElement&&e(t)},Un=e=>{window.setTimeout(()=>{e?.isConnected&&e.focus()},300)},Wn=e=>{Hn(Tn,e),F.show()},Gn=()=>{F.hide(),Un(wn())},Kn=e=>{Hn(Dn,e),I.show()},qn=()=>{I.hide(),Un(En())},Jn=e=>{if(e instanceof HTMLElement){e.blur();return}if(typeof document>`u`)return;let t=document.activeElement;if(!(t instanceof HTMLElement))return;let n=t.shadowRoot?.activeElement;if(n instanceof HTMLElement){n.blur();return}t.blur()},Yn=e=>{Jn(e),R.show()},{isConnected:G,walletAddress:K,handleConnect:Xn}=Ze({walletAdapter:()=>v.walletAdapter,callbacks:()=>v.callbacks,onAddressChange:e=>E.setWalletAddress(e),onDisconnect:()=>{B([]),U(null),Vn(!1),In(null),W(null)},onConnectError:(e,t)=>{E.setError(e),E.setErrorCode(t)}}),q=s(()=>new ee({baseUrl:v.config.apiEndpoint??`https://api.hyperstream.dev`})),Zn=()=>q().baseUrl,Qn=s(()=>de()?new m({baseUrl:v.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`}):null),[$n,er]=f(v.config.fiatCurrency??`USD`),tr=s(()=>!!v.config.fiatCurrency),nr=s(()=>{let e=E.recipient();if(e)return e;let t=E.targetToken(),n=K();return G()&&n&&t&&fe(n,me(t.chainId))?n:null}),rr=s(()=>{if(O()!==`card`)return null;let e=E.targetToken(),t=P();return!e||typeof e.decimals!=`number`||!t?null:se(t,e.decimals)}),J=ut({client:Qn,targetToken:E.targetToken,recipient:nr,refundTo:()=>v.config.refundTo,fiatCurrency:()=>$n(),callbacks:()=>v.callbacks,flowKind:`deposit`,cryptoAmount:rr}),[ir,ar]=f(null),or=e=>({orderStatus:e,fiatAmount:J.fiatAmount()||e.fiatAmount||``,fiatCurrency:$n(),targetToken:E.targetToken(),tokenDecimals:J.tokenDecimals(),provider:e.provider??`transak`,quote:J.quote()}),Y=s(()=>{let e=J.orderStatus();return e?or(e):ir()});l(()=>{let e=J.orderStatus();J.phase()!==`success`||!e||ar(or(e))});let sr=yt({phase:J.phase,onExpired:()=>J.refetchQuote(),intervalSeconds:30}),cr=Fe(Qn,()=>de()&&!tr()),lr=[`USD`,`EUR`,`GBP`,`JPY`,`KRW`,`CNY`,`AUD`,`CAD`,`INR`,`SGD`,`HKD`,`TWD`,`BRL`,`MXN`,`CHF`],ur=s(()=>{let e=cr.data;if(!e?.providers?.length)return lr;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():lr}),dr=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)))}),fr=s(()=>{let e=J.phase();return e===`awaiting-payment`||e===`payment-handoff`||e===`tracking`}),pr=s(()=>O()===`card`&&(J.phase()===`awaiting-payment`||J.phase()===`payment-handoff`)&&!!J.directWidgetUrl()),mr=s(()=>O()===`card`&&(J.phase()===`awaiting-payment`||J.phase()===`payment-handoff`)),hr=s(()=>{if(O()!==`card`||J.phase()!==`payment-handoff`)return null;let e=J.orderId(),t=J.directWidgetUrl();return e&&t?`${e}:${t}`:null}),gr=s(()=>{let e=J.quote();return e?.providerName??bt(J.orderStatus()?.provider??e?.provider??`Transak`)}),_r=s(()=>J.fiatAmount()||J.orderStatus()?.fiatAmount||J.quote()?.fiatAmount||``),vr=()=>{pr()&&(L.open()?L.hide():L.show())};l(()=>{if(!pr()){J.orderId()||kn(null),L.hide();return}let e=hr();e&&On()!==e&&(kn(e),L.show())});let yr=s(()=>{let e=J.phase();return e===`creating-order`||e===`quoting`}),br=s(()=>{let e=J.phase();return e===`error`?w({id:`1w68n16`,message:`Try Again`})??`Try Again`:e===`creating-order`||e===`quoting`?w({id:`344av8`,message:`Processing...`}):e===`quoted`&&J.quote()?w({id:`13l4n4r`,message:`Continue via {provider}`},{provider:J.quote().providerName??bt(J.quote().provider)}):w({id:`119fv83`,message:`Enter amount`})}),xr=s(()=>J.phase()===`quoted`&&!!nr()&&!dr()&&!J.isQuoteFetching()),Sr=()=>{let e=J.phase();e===`error`?J.handleRetry():e===`quoted`&&xr()&&J.createOrder()},X=s(()=>wt(E.execPhase(),E.error(),An(),z().length)),Cr=s(()=>{let e=X();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),wr=s(()=>O()===`card`&&(fr()||J.phase()===`success`)),Tr=s(()=>O()===`card`?J.phase()===`success`&&J.orderStatus()?`success`:wr()?`tracking`:`form`:X()===`success`&&E.order()?`success`:Cr()?`tracking`:`form`),Er=s(()=>!!v.config.recipient&&v.config.recipientEditable!==!0),{needRecipient:Dr,recipientDisplay:Or,handleRecipientChange:kr}=st({fromToken:H,toToken:E.targetToken,recipient:E.recipient,isConnected:G,walletAddress:K,walletAdapter:()=>v.walletAdapter,setRecipient:E.setRecipient}),Ar=s(()=>v.config.fromTokens?.length?tt(v.config.fromTokens):void 0),jr=xe(q,K,()=>G()&&!!K(),()=>v.walletAdapter?.supportedChainIds);e(()=>{v.config.recipient&&E.setRecipient(v.config.recipient)});let Mr=Oe(q,()=>!0),Nr=s(()=>{let e=Mr.data;return e?ze(e):new Map});e(async()=>{let e=q();if(v.config.amount){let e=Number(v.config.amount);if(!Number.isFinite(e)||e<=0){E.setError(`Invalid amount: must be greater than zero`),E.setErrorCode(h.INVALID_AMOUNT);return}}try{if(v.config.target){let t=et(v.config.target),n=await ve(t.chainId,t.address,v.config.apiEndpoint,e);if(typeof n.decimals!=`number`){E.setError(`Failed to resolve target token metadata`),E.setErrorCode(h.INVALID_CONFIG);return}E.setTargetToken(n),v.config.amount&&E.setTargetAmount(v.config.amount)}if(v.config.fromToken)try{let t=et(v.config.fromToken),n=await ve(t.chainId,t.address,v.config.apiEndpoint,e);typeof n.decimals==`number`&&zn({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:h.INVALID_TOKEN_IDENTIFIER,message:`Failed to resolve fromToken: ${e instanceof Error?e.message:String(e)}`})}}catch(e){E.setError(e instanceof Error?e.message:`Failed to resolve target token`),E.setErrorCode(h.INVALID_CONFIG)}});let Pr=s(()=>{let e=jr.data;if(!e||e.length===0)return[];let t=v.walletAdapter?.supportedChainIds,n=Ar();return e.filter(e=>!(t?.length&&!t.includes(e.chainId)||n&&!n.has(oe({chainId:e.chainId,address:e.address}))))}),Z=s(()=>{let e=Pr(),t=E.targetToken();if(!e||e.length===0||!t)return[];let n=t.priceUsd??1,r=Number(P()||`0`)*n;return jt(e,t.symbol??``,t.chainId,t.address,r>0?r:void 0)});l(p([Rn,Z],([e,t])=>{let n=_e({defaultFromToken:e,balances:t,currentSelection:H(),userPicked:Bn()});if(!n)return;U(n);let r=X();(r===`quoting`||r===`quoted`||r===`error`)&&Q(t)})),l(p(Z,e=>{let t=X();e.length>0&&(t===`idle`||t===`error`)&&O()===`crypto`&&Q(e)})),l(p(()=>E.recipient(),()=>{let e=Z(),t=X();e.length>0&&(t===`idle`||t===`quoted`||t===`error`)&&O()===`crypto`&&Q(e)},{defer:!0})),l(p(()=>O(),e=>{if(e===`crypto`){let e=Z();e.length>0&&(X()===`idle`||X()===`error`)&&Q(e)}},{defer:!0}));let Fr=s(()=>{let e=H();if(!e)return null;let t=E.targetToken(),n=K(),r=E.recipient(),i=P();return!t||typeof t.decimals!=`number`||!n||!i||Dr()&&!r?null:{tradeType:`EXACT_OUTPUT`,fromChainId:e.chainId,fromToken:e.address,toChainId:t.chainId,toToken:t.address,amount:se(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}}}),Ir=Et(q,Fr,s(()=>!!Fr()&&X()===`quoted`)),Lr=s(()=>O()===`crypto`&&(An()||jn()||X()===`quoted`&&Ir.isFetching));l(p(()=>Ir.data,e=>{if(e&&v.callbacks?.onQuoteReceived?.(e),!e||X()!==`quoted`)return;let t=H();if(t&&e.routes.length>0){let n=ue(he(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:Rr}=yt({phase:X,onExpired:()=>{Ir.refetch()}}),zr=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 re.fetchQuery({queryKey:[`quote`,e.baseUrl,s],queryFn:({signal:t})=>e.getQuotes(s,{signal:o??t}),staleTime:15e3});if(c.routes.length>0){let e=ue(he(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},Br=null,Q=async e=>{let t=q(),n=K(),r=E.targetToken();if(!t||!n||!r||typeof r.decimals!=`number`||e.length===0)return;o(()=>{z().length>0&&B([]),E.error()&&E.clearError(),Ln()&&W(null),V(!0)}),Br?.abort();let i=new AbortController;Br=i;try{let a=P();if(!a){V(!1);return}let o=se(a,r.decimals),s=H(),c=s?e.find(e=>T(e,s)):void 0,l=c?[c,...e.filter(e=>!T(e,c))]:e;for(let e of l){if(i.signal.aborted)return;let a=await zr(t,e,o,n,r,E.recipient(),i.signal);if(i.signal.aborted)return;if(a){B([a]),U(e),In(oe(e)),W(null),V(!1);return}}i.signal.aborted||(B([]),In(null))}catch{}finally{V(!1),Pn(!0)}};t(()=>{Br?.abort()});let Vr=s(()=>{let e=Z(),t=Pr();if(e.length===0)return t;let n=[...e];for(let e of t)n.some(t=>T(t,e))||n.push(e);return n}),Hr=s(()=>{let e=H(),t=Vr();if(!e||t.length===0)return 0;let n=t.findIndex(t=>T(t,e));return n>=0?n:0}),$=s(()=>{let e=Vr(),t=z(),n=E.targetToken(),r=Nr();if(e.length===0||!n)return[];let i=new Map;for(let e of t)i.set(oe(e.token),e);let a=Fn();return e.map(e=>{let t=oe(e),n=i.get(t),o=r.get(e.chainId),s=e.decimals,c=Number(e.extensions?.price?.usd??`0`),l=e.extensions?.balance?ge(e.extensions.balance,s):`0`,u=pe(le(l,2)),d=``;if(c>0&&e.extensions?.balance){let e=Number(l)*c;d=e<.01?`<$0.01`:`$${pe(e.toFixed(2).replace(/\.?0+$/,``))}`}let f=``,p=``,m=!0;if(n){let t=ge(n.route.quote.amountIn,s);if(f=pe(le(t,2)),c>0){let e=Number(t)*c;p=e<.01?`<$0.01`:`$${pe(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}})}),Ur=s(()=>{let e={};for(let t of $())if(t.recommended&&t.chainId){let n=(t.address??`0x0000000000000000000000000000000000000000`).toLowerCase();e[`eip155:${t.chainId}:${n}`]=w({id:`xel5qk`,message:`Recommended`})}return e}),Wr=s(()=>{let e=H();return e?z().find(t=>T(t.token,e))??null:null}),Gr=s(()=>Wr()?.route??null),Kr=s(()=>{let e=Wr();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:qr,trackingProviderName:Jr,trackingProviderIcon:Yr,trackingInputAmount:Xr,executionError:Zr,failedExecPhase:Qr,handleConfirm:$r,handleRetry:ei,handleNewSwap:ti}=Mt({client:q,walletAdapter:()=>v.walletAdapter,callbacks:()=>v.callbacks,apiEndpoint:()=>v.config.apiEndpoint,recipient:E.recipient,needRecipient:Dr,walletAddress:K,targetToken:E.targetToken,selectedPayToken:H,payTokenQuotes:z,setPayTokenQuotes:B,setLoadingQuotes:V,fetchSingleQuote:zr,configAmount:P,execPhase:E.execPhase,setExecPhase:E.setExecPhase,setFromToken:E.setFromToken,setError:E.setError,setErrorCode:E.setErrorCode,storeReset:E.reset,storeClearError:E.clearError,onRetry:()=>{U(null),Vn(!1),In(null),W(null);let e=Z();e.length>0&&Q(e)},onReset:()=>{U(null),Vn(!1),In(null),W(null);let e=Z();e.length>0&&Q(e)}});Ye({client:q,walletAddress:K,trackingOrderId:qr,phase:X,execPhase:E.execPhase,setOrder:E.setOrder,setExecPhase:E.setExecPhase,onOrderFilled:e=>{let t=H();v.callbacks?.onDepositSuccess?.({orderId:e.id,fromToken:t?.symbol??``,toToken:E.targetToken()?.symbol??``,fromAmount:e.srcAmount,toAmount:e.destAmount,txHash:e.depositTxHash??``})},onOrderFailed:e=>{v.callbacks?.onDepositError?.({code:h.ORDER_FAILED,message:`Order `+e.status})}});let ni=async e=>{Mn(!0),W(null);try{let t=q(),n=K(),r=E.targetToken(),i=P();if(!t||!n||!r||typeof r.decimals!=`number`||!i)return!1;let a=await zr(t,e,se(i,r.decimals),n,r,E.recipient());if(!a)return W(w({id:`wuxjl9`,message:`Selected token is unavailable for this purchase`})),!1;let o=z(),s=[...o],c=o.findIndex(t=>T(t.token,e));return c>=0?s[c]=a:s.push(a),B(s),U(e),Vn(!0),!0}finally{Mn(!1)}},ri=e=>{F.hide(),e.address&&ni(Vr().find(t=>T(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})},ii=async()=>{v.walletAdapter?.openAccountModal?await v.walletAdapter.openAccountModal():v.callbacks?.onAccountModal?.()},ai=()=>E.targetToken()?.symbol??``,oi=()=>E.targetToken()?.decimals??J.quote()?.token?.decimals??18,si=e=>e?le(ge(e,oi()),6):`0`,ci=()=>{if(O()===`card`&&J.quote()){let e=Ve(J.quote());if(e)return si(e)}return E.targetAmount()||P()},li=()=>{let e=Number(ci()),t=E.targetToken()?.priceUsd??0;return!e||t<=0?``:w({id:`1ovj1tk`,message:"≈ ${addThousandsSeparator}"},{addThousandsSeparator:pe((e*t).toFixed(2).replace(/\.?0+$/,``))})},ui=()=>{let e=ci(),t=ai();return!e||!t?w({id:`119fv83`,message:`Enter amount`}):w({id:`1cei180`,message:`Buy {amt} {sym}`},{amt:e,sym:t})},di=()=>!!E.targetToken(),fi=()=>!!v.config.target,pi=s(()=>v.config.toTokens?.length?tt(v.config.toTokens):void 0),mi=e=>{if(o(()=>{bn(e),E.setTargetAmount(e),O()===`crypto`&&Z().length>0&&e&&V(!0)}),O()===`crypto`){let t=Z();t.length>0&&e&&Q(t)}},hi=Ne({fields:{targetAmount:at({value:yn,setValue:e=>{xn()&&mi(e)},parse:ce,validate:e=>{if(!xn()||O()===`entry`)return null;let t=Number(e);return Number.isFinite(t)&&t>0?null:`Enter amount`}}),fiatAmount:at({value:J.fiatAmount,setValue:J.setFiatAmount,parse:ce,validate:()=>null}),recipient:at({value:()=>E.recipient()??``,setValue:kr,parse:e=>e.trim(),validate:()=>O()===`crypto`&&Dr()&&!E.recipient()||O()===`card`&&P()&&!nr()?`Enter Recipient Address`:null})}}),gi=hi.field(`targetAmount`),_i=hi.field(`recipient`),vi=()=>hi.validateFields([`targetAmount`,`recipient`]),yi=()=>hi.validateFields([`targetAmount`,`fiatAmount`,`recipient`]),bi=()=>{vi()&&$r()},xi=()=>{J.phase()===`quoted`&&!yi()||Sr()},Si=s(()=>{let e=v.config.titleText?.trim();return e&&e.length>0?e:`TokenFlight`}),Ci=s(()=>{let e=v.config.titleText?.trim();return!!e&&e.length>0}),wi=s(()=>{let e=v.config.titleImageUrl?.trim();return e&&e.length>0?e:null}),Ti=s(()=>D().length>1&&ae()&&de());return d(ye,{get class(){return C(()=>!!Ti())()?S.receiveMethodStableContainer:void 0},observeKey:()=>[Tr(),wr(),wr()?J.phase():``,pr()?`fiat-payment-link`:``,v.config.hidePoweredBy].join(`|`),get noBackground(){return v.config.noBackground},get noBorder(){return v.config.noBorder},get children(){return d(Se,{form:hi,get children(){return[d(Xe,{get current(){return Tr()},get opaque(){return!v.config.noBackground},"data-testid":`receive-lifecycle-presence`,children:e=>d(i,{get children(){return[d(n,{when:e===`form`,get children(){return[(()=>{var e=Ft(),t=e.firstChild,n=t.firstChild,r=n.firstChild;return y(n,d(c,{get when(){return wi()},get fallback(){return d(c,{get when(){return!v.config.hideTitle},get children(){return d(xt,{size:22})}})},get children(){var e=Nt();return a(t=>{var n=wi(),r=Si(),i=b(k.headerLogoImage,v.config.hideTitle&&k[`headerLogoImage--solo`]);return n!==t.e&&_(e,`src`,t.e=n),r!==t.t&&_(e,`alt`,t.t=r),i!==t.a&&g(e,t.a=i),t},{e:void 0,t:void 0,a:void 0}),e}}),r),y(r,d(c,{get when(){return Ci()},get fallback(){return[`Token`,(()=>{var e=Ut();return a(()=>g(e,k.headerTitleAccent)),e})()]},get children(){return Si()}})),y(e,d(c,{get when(){return C(()=>!!G())()&&K()},get children(){var e=Pt(),t=e.firstChild,n=t.nextSibling;return x(e,`click`,ii),y(n,()=>$e(K())),a(r=>{var i=k.headerRight,a=w({id:`xphk5n`,message:`Wallet account`}),o=k.walletDot,s=k.walletAddress;return i!==r.e&&g(e,r.e=i),a!==r.t&&_(e,`aria-label`,r.t=a),o!==r.a&&g(t,r.a=o),s!==r.o&&g(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),null),a(i=>{var a=N.header,o=k.headerLeft,s=b(k.headerBrand,k[`headerBrand--idle`]),c=b(k.headerTitle,v.config.hideTitle&&k[`headerTitle--hidden`]);return a!==i.e&&g(e,i.e=a),o!==i.t&&g(t,i.t=o),s!==i.a&&g(n,i.a=s),c!==i.o&&g(r,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),e})(),(()=>{var e=Bt(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=n.nextSibling,o=i.firstChild,s=o.firstChild;return y(r,()=>Ae(`youReceive`,w({id:`va18uh`,message:`You receive`}))),y(n,d(c,{get when(){return Or()||G()&&di()&&!!P()},get children(){var e=It(),t=e.firstChild;return x(e,`click`,e=>!Cr()&&!Er()&&Yn(e.currentTarget)),y(t,(()=>{var e=C(()=>!!Or());return()=>e()?$e(Or()):w({id:`fpand1`,message:`Enter destination address`})})()),y(e,d(c,{get when(){return!Er()},get children(){return d(Ce,{size:10})}}),null),a(n=>{var r=b(S.recipientBadge,!Or()&&S.recipientBadgeEmpty,Er()&&S.recipientBadgeLocked),i=Er(),a=S.recipientBadgeText;return r!==n.e&&g(e,n.e=r),i!==n.t&&(e.disabled=n.t=i),a!==n.a&&g(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),e}}),null),y(i,d(c,{get when(){return di()},get fallback(){return(()=>{var e=Wt();return x(e,`click`,e=>Kn(e.currentTarget)),y(e,()=>w({id:`zz4mrw`,message:`Select token`}),null),y(e,d(be,{size:14}),null),e})()},get children(){var e=Rt(),t=e.firstChild,n=t.nextSibling,r=n.firstChild.firstChild,i=r.nextSibling;return x(e,`click`,e=>{fi()||Kn(e.currentTarget)}),y(t,d(Ct,{get symbol(){return ai()},color:`#0052FF`,size:32,get logoURI(){return E.targetToken()?.logoURI}}),null),y(t,d(c,{get when(){return E.targetToken()?.chainId},get children(){var e=Lt();return y(e,d(Tt,{size:12,get iconUrl(){return te(Zn(),E.targetToken()?.chainId??0)}})),a(()=>g(e,N.targetChainDot)),e}}),null),y(r,ai),y(i,()=>Nr().get(E.targetToken()?.chainId??0)?.name??``),y(n,d(c,{get when(){return!fi()},get children(){return d(be,{size:14})}}),null),a(n=>{var i={...fi()?{}:{cursor:`pointer`}},a=N.targetIcon,o=N.symbol;return n.e=ne(e,i,n.e),a!==n.t&&g(t,n.t=a),o!==n.a&&g(r,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),o),y(o,d(c,{get when(){return xn()},get fallback(){return(()=>{var e=Gt();return y(e,()=>pe(ci())),a(()=>g(e,N.amount)),e})()},get children(){var e=zt();return y(e,d(Le,{field:gi,get class(){return N.amountInput},type:`text`,inputMode:`decimal`,placeholder:`0`,style:{"text-align":`right`},"data-testid":`receive-amount-input`})),a(()=>g(e,N.amountInputShell)),e}}),s),y(s,li),a(r=>{var a=N.section,o=N.target,c=N.sectionLabel,l=N.targetContent,u=N.fiat;return a!==r.e&&g(e,r.e=a),o!==r.t&&g(t,r.t=o),c!==r.a&&g(n,r.a=c),l!==r.o&&g(i,r.o=l),u!==r.i&&g(s,r.i=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=Ht(),t=e.firstChild;return y(t,d(c,{get when(){return Dt()},get fallback(){return(()=>{var e=Kt();return y(e,()=>w({id:`cgzgvn`,message:`Pay with`})),a(()=>g(e,N.methodHeaderLabel)),e})()},get children(){var e=Vt(),t=e.firstChild,n=t.nextSibling;return x(e,`click`,_n),x(t,`animationend`,A()?vn:void 0),y(t,d(ot,{size:14})),y(n,()=>w({id:`cgzgvn`,message:`Pay with`})),a(r=>{var i=b(S.backButton,N.methodHeaderBackButton,A()&&S.backButtonExiting),a=A()?N.backArrowExit:N.backArrowEnter,o=A()?N.backTextExit:N.backTextEnter;return i!==r.e&&g(e,r.e=i),a!==r.t&&g(t,r.t=a),o!==r.a&&g(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})),y(e,d(_t,{get current(){return O()},get direction(){return mt()},height:!0,"data-testid":`method-presence`,children:e=>(()=>{var t=nn();return _(t,`data-method-page`,e),y(t,d(c,{when:e===`entry`,get children(){return[(()=>{var e=qt();return a(()=>g(e,N.methodPaneSpacer)),e})(),d(Ge,{get hasCrypto(){return ae()},get hasCard(){return de()},onSelectCrypto:()=>gn(`crypto`),onSelectCard:()=>gn(`card`)})]}}),null),y(t,d(c,{when:e===`crypto`,get children(){return[(()=>{var e=qt();return y(e,d(c,{get when(){return X()===`quoted`},get children(){return d(Ee,{secondsRemaining:Rr,totalSeconds:30,onRefresh:()=>{Ir.refetch()},isRefreshing:()=>Ir.isFetching})}})),a(()=>g(e,b(N.methodPaneSpacer,N.methodPaneSpacerCrypto))),e})(),(()=>{var e=Zt();return y(e,d(c,{get when(){return P()},get fallback(){return(()=>{var e=rn(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling;return y(n,()=>w({id:`1olegnl`,message:`Enter amount to get started`})),y(r,()=>w({id:`13i9oqu`,message:`We'll find the best rate for you`})),a(i=>{var a=ht.quoteCardSlotCard,o=S.idleIcon,s=S.idleTitle,c=S.idleSub;return a!==i.e&&g(e,i.e=a),o!==i.t&&g(t,i.t=o),s!==i.a&&g(n,i.a=s),c!==i.o&&g(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!An()||z().length>0},get fallback(){return[(()=>{var e=an(),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=N.paySelectedSkeleton,d=N.paySelectedLeft,f=b(S.skeleton,N.paySkeletonIcon),p=N.paySkeletonInfo,m=b(S.skeleton,N.paySkeletonLine,N.paySkeletonSymbol),ee=b(S.skeleton,N.paySkeletonLine,N.paySkeletonChain),te=N.paySkeletonRight,h=b(S.skeleton,N.paySkeletonLine,N.paySkeletonAmount),_=b(S.skeleton,N.paySkeletonLine,N.paySkeletonUsd);return a!==e.e&&g(t,e.e=a),d!==e.t&&g(n,e.t=d),f!==e.a&&g(r,e.a=f),p!==e.o&&g(i,e.o=p),m!==e.i&&g(o,e.i=m),ee!==e.n&&g(s,e.n=ee),te!==e.s&&g(c,e.s=te),h!==e.h&&g(l,e.h=h),_!==e.r&&g(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(Be,{})]},get children(){return[(()=>{var e=Jt();return y(e,d(c,{get when(){return $().length>0},get fallback(){return(()=>{var e=cn();return y(e,d(c,{get when(){return G()},get fallback(){return[(()=>{var e=ln();return a(()=>g(e,S.idleIcon)),e})(),(()=>{var e=sn();return y(e,()=>w({id:`18y1lrp`,message:`Connect your wallet to see payment options`})),a(()=>g(e,N.payEmptyText)),e})()]},get children(){return[(()=>{var e=on();return a(()=>g(e,S.idleIcon)),e})(),(()=>{var e=sn();return y(e,()=>w({id:`g7pjpv`,message:`No tokens available`})),a(()=>g(e,N.payEmptyText)),e})()]}})),a(()=>g(e,N.payEmpty)),e})()},get children(){return(()=>{let e=()=>$()[Hr()]??$()[0];return(()=>{var t=dn(),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 x(t,`click`,e=>Wn(e.currentTarget)),y(r,d(Ct,{get symbol(){return e().symbol},get color(){return e().color},size:32,get logoURI(){return e().logoURI}}),i),y(i,d(Tt,{color:null,size:12,get iconUrl(){return C(()=>e().chainId!==void 0)()?te(Zn(),e().chainId):void 0}})),y(l,()=>e().symbol),y(s,d(c,{get when(){return e().recommended},get children(){var e=un();return y(e,()=>w({id:`xel5qk`,message:`Recommended`})),a(()=>g(e,N.payBestBadge)),e}}),null),y(u,()=>e().chain),y(f,d(c,{get when(){return C(()=>!!An())()&&!e().amount},get fallback(){return[(()=>{var t=fn();return y(t,()=>e().amount),a(()=>g(t,N.paySelectedAmount)),t})(),d(c,{get when(){return e().amountUsd},get children(){var t=Lt();return y(t,()=>e().amountUsd),a(()=>g(t,N.paySelectedAmountUsd)),t}})]},get children(){var e=Lt();return a(()=>g(e,b(S.skeleton,N.payAmountSkeleton))),e}})),y(p,d(be,{size:16})),a(e=>{var a=N.paySelected,c=w({id:`1t0r88u`,message:`Select payment token`}),d=N.paySelectedLeft,m=N.payIconWrap,ee=N.payChainDot,te=N.paySelectedInfo,h=N.paySelectedTopRow,v=N.payTokenSymbol,ne=N.payTokenChain,y=N.paySelectedRight,b=N.paySelectedCaret;return a!==e.e&&g(t,e.e=a),c!==e.t&&_(t,`aria-label`,e.t=c),d!==e.a&&g(n,e.a=d),m!==e.o&&g(r,e.o=m),ee!==e.i&&g(i,e.i=ee),te!==e.n&&g(o,e.n=te),h!==e.s&&g(s,e.s=h),v!==e.h&&g(l,e.h=v),ne!==e.r&&g(u,e.r=ne),y!==e.d&&g(f,e.d=y),b!==e.l&&g(p,e.l=b),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 Ln()},get children(){var e=Yt();return y(e,Ln),e}})]}}),d(c,{get when(){return C(()=>!!($().some(e=>!e.disabled)&&Gr()&&Kr()))()&&E.targetToken()},get fallback(){return d(c,{get when(){return jn()},get fallback(){return d(c,{get when(){return C(()=>!!(Nn()&&!An()&&P()&&$().some(e=>!e.disabled)))()&&!Gr()},get children(){var e=pn(),t=e.firstChild,n=t.nextSibling;return y(n,()=>w({id:`1ne9nkz`,message:`No offer available`})),a(r=>{var i=S.noOffer,a=S.noOfferIcon,o=S.noOfferText;return i!==r.e&&g(e,r.e=i),a!==r.t&&g(t,r.t=a),o!==r.a&&g(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})},get children(){return d(Be,{})}})},get children(){var e=Xt();return y(e,d(Re,{get route(){return Gr()},get fromToken(){return Kr()},get toToken(){return E.targetToken()},inline:!0})),a(()=>g(e,Te.quote)),e}})]}})),e})()]}}),null),y(t,d(c,{when:e===`card`,get children(){return[(()=>{var e=qt();return y(e,d(St,{get currencies(){return ur()},get selected(){return $n()},onSelect:er,get locked(){return tr()},get locale(){return v.config.locale}})),a(()=>g(e,N.methodPaneSpacer)),e})(),d(Ie,r({fiatCheckout:J,fiatCountdown:sr,get targetToken(){return E.targetToken()??null},get fiatCurrency(){return $n()},get apiBase(){return Zn()},showPayAmount:!0},()=>P()&&!nr()?{idleTitle:w({id:`pom1h2`,message:`Enter recipient address`}),idleSub:w({id:`7m2ht3`,message:`Required to receive your tokens`})}:{}))]}}),null),y(t,d(c,{when:e!==`entry`,get children(){var t=tn();return y(t,d(i,{get children(){return[d(n,{get when(){return!di()},get children(){var e=Qt();return x(e,`click`,e=>Kn(e.currentTarget)),y(e,()=>w({id:`zz4mrw`,message:`Select token`})),a(()=>g(e,j.btnRecipient)),e}}),d(n,{when:e===`crypto`,get children(){return d(nt,{get phase(){return X()},get isConnected(){return G()},get hasQuote(){return!!Gr()},get confirmDisabled(){return Lr()},onConnect:Xn,onConfirm:bi,onRetry:ei,get needsRecipient(){return C(()=>!!Dr())()&&!E.recipient()},onEnterRecipient:()=>Yn(),get label(){return C(()=>!!Cr())()?void 0:ui()}})}}),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=Qt();return x(e,`click`,xi),y(e,br),a(()=>g(e,j.btnPrimary)),e}}),d(n,{get when(){return yr()},get children(){var e=$t(),t=e.firstChild,n=t.firstChild;return y(t,br,null),a(r=>{var i=b(j.btnPrimary,j.executing),a=j.btnInner,o=j.spinner;return i!==r.e&&g(e,r.e=i),a!==r.t&&g(t,r.t=a),o!==r.a&&g(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),d(n,{get when(){return!P()},get children(){var e=en();return y(e,()=>w({id:`119fv83`,message:`Enter amount`})),a(()=>g(e,j.btnPrimary)),e}}),d(n,{get when(){return!nr()},get children(){var e=Qt();return x(e,`click`,e=>Yn(e.currentTarget)),y(e,()=>w({id:`wx5bee`,message:`Enter Recipient Address`})),a(()=>g(e,j.btnRecipient)),e}}),d(n,{get when(){return xr()},get children(){var e=Qt();return x(e,`click`,xi),y(e,br),a(()=>g(e,j.btnPrimary)),e}}),d(n,{when:!0,get children(){var e=en();return y(e,br),a(()=>g(e,j.btnPrimary)),e}})]}})}})]}})),a(()=>g(t,S.ctaWrapperReceive)),t}}),null),t})()}),null),a(()=>g(t,N.methodHeaderOverlay)),e})(),(()=>{var e=Lt();return y(e,d(c,{get when(){return!v.config.hidePoweredBy},get children(){return d(Je,{})}})),a(()=>g(e,S.footerSlot)),e})()]}}),d(n,{when:e===`tracking`,get children(){return d(i,{get children(){return[d(n,{get when(){return O()===`card`},get children(){return d(qe,{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 _r()},get fiatCurrency(){return $n()},get cryptoAmount(){return si(He({status:J.orderStatus(),quote:J.quote()}))},get targetToken(){return E.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 lt(J.orderStatus())},get apiBase(){return Zn()},get chainMap(){return Nr()},get paymentLinkAvailable(){return pr()},get paymentLinkOpen(){return L.open()},onPaymentLinkToggle:vr,get cancelAvailable(){return mr()},onCancelPayment:()=>J.cancelPayment(),onNewPurchase:()=>J.handleNewPurchase(),onRetry:()=>J.handleRetry(),onBack:()=>J.handleNewPurchase()})}}),d(n,{when:!0,get children(){return d(pt,{get order(){return E.order()},get fromToken(){return E.fromToken()},get toToken(){return E.targetToken()},get providerName(){return Jr()},get providerIcon(){return Yr()},get hideProvider(){return v.config.hideProvider},get apiEndpoint(){return v.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return Xr()??``},get outputAmount(){return E.targetAmount()},onNewSwap:ti,mode:`receive`,get executionError(){return Zr()},onRetry:ei,get phase(){return X()},get failedPhase(){return Qr()},get chainMap(){return Nr()}})}})]}})}}),d(n,{when:e===`success`,get children(){return d(i,{get children(){return[d(n,{get when(){return C(()=>O()===`card`)()&&Y()},get children(){return d(De,{get orderStatus(){return Y().orderStatus},get fiatAmount(){return Y().fiatAmount},get fiatCurrency(){return Y().fiatCurrency},get targetToken(){return Y().targetToken},get tokenDecimals(){return Y().tokenDecimals},get quote(){return Y().quote},get provider(){return Y().provider},get apiBase(){return Zn()},get chainMap(){return Nr()},onNewPurchase:()=>J.handleNewPurchase()})}}),d(n,{when:!0,get children(){return d(ct,{get order(){return E.order()},get fromToken(){return E.fromToken()},get toToken(){return E.targetToken()},onNewSwap:ti,get apiEndpoint(){return v.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return Jr()},mode:`receive`,get chainMap(){return Nr()}})}})]}})}})]}})}),d(Qe,{drawer:L,when:()=>!!J.directWidgetUrl(),get children(){return d(Ue,{drawer:L,get url(){return J.directWidgetUrl()},get provider(){return gr()},onClose:()=>L.hide(),get noChrome(){return M()}})}}),d(Qe,{drawer:F,get children(){return d(we,{drawer:F,selectingFor:`from`,get noBorder(){return v.config.noBorder},get noChrome(){return M()},get children(){return d(c,{get when(){return Sn()},get fallback(){return d(Pe,{selectingFor:`from`,onClose:Gn})},get children(){return d(u,{get fallback(){return d(Pe,{selectingFor:`from`,onClose:Gn})},get children(){return d(je,{get client(){return q()},get walletAddress(){return K()},selectingFor:`from`,get tokenTags(){return Ur()},onSelect:ri,onClose:Gn,get supportedChainIds(){return v.walletAdapter?.supportedChainIds},get allowedTokens(){return Ar()},get noBorder(){return v.config.noBorder},get dismissing(){return F.dismissing()}})}})}})}})}}),d(Qe,{drawer:I,get children(){return d(we,{drawer:I,selectingFor:`to`,get noBorder(){return v.config.noBorder},get noChrome(){return M()},get children(){return d(c,{get when(){return Cn()},get fallback(){return d(Pe,{selectingFor:`to`,onClose:qn})},get children(){return d(u,{get fallback(){return d(Pe,{selectingFor:`to`,onClose:qn})},get children(){return d(je,{get client(){return q()},walletAddress:null,selectingFor:`to`,onSelect:e=>{e.address&&typeof e.decimals==`number`&&E.setTargetToken({chainId:e.chainId,address:e.address,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd}),I.hide()},onClose:qn,get allowedTokens(){return pi()},get noBorder(){return v.config.noBorder},get dismissing(){return I.dismissing()}})}})}})}})}}),d(Qe,{drawer:R,when:()=>!!E.targetToken(),get children(){return d(ke,{drawer:R,get noChrome(){return M()},get children(){return d(it,{get initialValue(){return _i.value()},get chainType(){return me(E.targetToken().chainId)},onConfirm:e=>{_i.setValue(e),_i.markTouched(),R.hide()},onClose:()=>R.hide(),get noChrome(){return M()},get dismissing(){return R.dismissing()}})}})}})]}})}})}export{hn 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-DqvEpdeb.js";import{o as p,r as m,s as h,t as g}from"./dist-CpC2fQqU.js";import{t as _}from"./errors-BMU5s_Au.js";import{_ as v,c as y,f as b,g as x,h as S,l as C,n as w,p as ee,s as T,t as E,u as D}from"./shared.module-Bk8Fpur5.js";import{A as te,S as ne,_ as re,c as ie,g as ae,h as oe,l as se,p as ce,r as le,s as ue,v as de,x as fe}from"./rank-offers-94_Vuact.js";import{$ as pe,A as me,At as he,B as ge,C as O,Ct as _e,D as ve,Dt as ye,E as be,Et as xe,F as Se,G as Ce,H as we,I as Te,J as Ee,K as De,L as Oe,M as ke,Mt as Ae,N as je,Nt as Me,O as Ne,Ot as k,P as Pe,Q as Fe,R as Ie,S as Le,St as A,T as Re,Tt as ze,U as Be,V as Ve,W as He,X as Ue,Y as We,Z as Ge,_t as Ke,a as j,at as qe,b as Je,bt as Ye,c as Xe,ct as Ze,d as Qe,dt as $e,et,f as tt,g as nt,gt as M,h as rt,ht as it,i as at,it as ot,j as st,jt as ct,k as lt,kt as ut,l as dt,lt as ft,m as pt,mt,n as ht,nt as gt,o as _t,ot as vt,p as yt,pt as bt,q as xt,r as St,rt as N,s as P,st as Ct,t as wt,tt as Tt,u as Et,ut as Dt,v as Ot,vt as kt,w as At,wt as jt,x as Mt,xt as Nt,yt as Pt,z as Ft}from"./usePageRouter-BV0kz9ap.js";var F={selector:`tf-28b876`,selectorNoChrome:`tf-5570b6`,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`},It=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>`),Lt=x(`<img>`),Rt=x(`<span>`),zt=x(`<button type=button data-testid=provider-list-item><div><div><span></span><span>: </span></div></div><div><span>≈ <!> `),Bt=x(`<div>`);function Vt(e){return Ue(e)??`0`}function Ht(e){let{t}=Me(),n=()=>vt(e.fiatCurrency.toUpperCase()),i=ot({axis:`y`}),a=t=>e.selectedProviderId?t===e.selectedProviderId:e.quotes.length>0&&e.quotes[0].provider===t,s=t=>{t.key===`Escape`&&e.onClose()};return(()=>{var l=It(),f=l.firstChild,p=f.firstChild,m=p.firstChild,h=m.nextSibling,g=h.firstChild,_=f.nextSibling,x=_.nextSibling;return T(l,`keydown`,s),C(m,()=>t({id:`118a77s`,message:`Select Fiat Provider`})),C(h,u(we,{get secondsRemaining(){return e.countdownSeconds},get totalSeconds(){return e.totalCountdownSeconds},get onRefresh(){return e.onRefresh},get isRefreshing(){return e.isRefreshing}}),g),T(g,`click`,()=>e.onClose()),C(g,u(ye,{size:18})),v(i,x),C(x,u(c,{get each(){return[...e.quotes]},children:(i,s)=>{let[c,l]=d(!1),f=()=>a(i.provider),p=()=>s()===0,m=()=>i.providerIcon?`${e.apiBase}${i.providerIcon}`:null;return(()=>{var a=zt(),s=a.firstChild,d=s.firstChild,h=d.firstChild,g=h.nextSibling,_=g.firstChild,v=s.nextSibling,x=v.firstChild,S=x.firstChild.nextSibling;return S.nextSibling,T(a,`click`,()=>e.onSelect(i.provider)),C(s,u(o,{get when(){return D(()=>!!m())()&&!c()},get fallback(){return(()=>{var e=Bt();return C(e,()=>(i.providerName??i.provider).charAt(0).toUpperCase()),r(()=>y(e,F.providerIconFallback)),e})()},get children(){var e=Lt();return T(e,`error`,()=>l(!0)),r(t=>{var n=F.providerIcon,r=m(),a=i.provider;return n!==t.e&&y(e,t.e=n),r!==t.t&&b(e,`src`,t.t=r),a!==t.a&&b(e,`alt`,t.a=a),t},{e:void 0,t:void 0,a:void 0}),e}}),d),C(h,()=>i.providerName??i.provider,null),C(h,u(o,{get when(){return p()},get children(){var e=Rt();return C(e,()=>t({id:`r7v9s7`,message:`BEST RATE`})),r(()=>y(e,F.bestBadge)),e}}),null),C(g,()=>t({id:`1viukn9`,message:`Total fee`}),_),C(g,n,null),C(g,()=>parseFloat(String(i.totalFee)).toFixed(2),null),C(x,()=>oe(de(Vt(i),e.tokenDecimals),4),S),C(x,()=>e.targetSymbol,null),C(v,u(o,{get when(){return f()},get children(){var e=Rt();return C(e,u(k,{size:16})),r(()=>y(e,F.checkmark)),e}}),null),r(e=>{var t=w(F.providerItem,f()&&F.providerItemSelected),n=F.providerLeft,r=F.providerInfo,i=F.providerName,o=F.providerFee,c=F.providerRight,l=F.cryptoAmount;return t!==e.e&&y(a,e.e=t),n!==e.t&&y(s,e.t=n),r!==e.a&&y(d,e.a=r),i!==e.o&&y(h,e.o=i),o!==e.i&&y(g,e.i=o),c!==e.n&&y(v,e.n=c),l!==e.s&&y(x,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}),a})()}})),r(n=>{var r=w(F.selector,e.noChrome&&F.selectorNoChrome),i=t({id:`118a77s`,message:`Select Fiat Provider`}),a=F.header,o=F.titleRow,s=F.title,c=F.headerRight,u=F.close,d=t({id:`1l0xxoj`,message:`Close`}),v=F.divider,S=w(F.providerList,E.autoHideScrollbar);return r!==n.e&&y(l,n.e=r),i!==n.t&&b(l,`aria-label`,n.t=i),a!==n.a&&y(f,n.a=a),o!==n.o&&y(p,n.o=o),s!==n.i&&y(m,n.i=s),c!==n.n&&y(h,n.n=c),u!==n.s&&y(g,n.s=u),d!==n.h&&b(g,`aria-label`,n.h=d),v!==n.r&&y(_,n.r=v),S!==n.d&&y(x,n.d=S),n},{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})()}function Ut(e){let t=St();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=ue(e.fromToken().chainId),o=e.walletAddress();if(!o){e.setError(`Wallet not connected`),e.setErrorCode(_.WALLET_CONNECTION_FAILED);return}if(!se(o,a)){e.setError(yt`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 at(e.walletAdapter(),n,e.fromToken().chainId);e.setExecPhase(`submitting`);let s=await P(e.client(),r,i.routeId,a);e.setExecPhase(`tracking`),t.setTrackingOrderId(s.orderId)}catch(n){let r=j(n,e.callbacks(),`swap`);t.setExecutionError(r),t.setFailedExecPhase(e.execPhase())}},handleRetry:()=>{t.setTrackingOrderId(null),t.setTrackingAddress(null),e.setExecPhase(null)},handleNewSwap:()=>{e.storeReset(),_t(t,e.client().baseUrl),e.onReset?.()}}}var Wt=x(`<button type=button data-testid=quote-error-close>`),I=x(`<button type=button part=button-primary data-testid=quote-error-retry>`),L=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>`),Gt=x(`<div><div><span></span><span>`),Kt=x(`<button type=button part=back-button><span>`),qt=x(`<img height=22>`),Jt=x(`<button part=wallet-info><div></div><span>`),Yt=x(`<div part=header><div><div data-testid=header-brand><span>`),Xt=x(`<div data-testid=swap-method-frame><div data-testid=powered-footer-slot>`),Zt=x(`<span>Flight`),Qt=x(`<div data-testid=swap-entry-method-pane><div><span>`),$t=x(`<span id=tf-max-tooltip role=tooltip>`),en=x(`<div><span></span><span><button type=button data-testid=btn-max>`),tn=x(`<span>`),nn=x(`<div><div><div></div></div><span>`),rn=x(`<div>`),an=x(`<div><span>`),on=x(`<div><div data-testid=fiat-amount-shell><span>`),sn=x(`<button type=button part=swap-arrow>`),cn=x(`<button part=recipient-badge><span>`),ln=x(`<span part=amount-display style=cursor:default>`),un=x(`<button type=button data-testid=quote-details-trigger>`),dn=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>`),fn=x(`<div part=price-preview>`),pn=x(`<div part=no-offer><span>`),mn=x(`<div><div style=width:32px;height:32px></div><span>`),hn=x(`<div data-testid=card-recipient-gate-card><div></div><span></span><span>`),gn=x(`<button part=button-primary type=button>`),_n=x(`<button disabled type=button><span><span>`),vn=x(`<button disabled type=button style=opacity:0.6>`),yn=x(`<div part=cta-wrapper>`),bn=x(`<div style=display:contents>`),xn=x(`<button><span>`),Sn=x(`<span> `),Cn=x(`<div style=width:120px;height:28px>`),wn=x(`<div aria-hidden=true part=button-primary style=visibility:hidden;pointer-events:none>`);function Tn(t,n){let[r,i]=d(!1);return s(f(t,t=>{if(!t)return;i(!1);let n=window.requestAnimationFrame(()=>i(!0));e(()=>window.cancelAnimationFrame(n))})),s(f(n,e=>{e||i(!1)})),r}function En(t){let{t:n}=Me(),[i,a]=d(!1),s=ot({axis:`y`}),c,l=()=>{t.onCopy(t.message),a(!0),c&&clearTimeout(c),c=setTimeout(()=>{a(!1),c=void 0},1200)};return e(()=>{c&&clearTimeout(c)}),(()=>{var e=L(),a=e.firstChild,c=a.firstChild,d=c.nextSibling,f=d.firstChild,p=a.nextSibling;return C(c,u(_e,{size:15}),null),C(c,()=>t.title??n({id:`jf8ts4`,message:`Quote Failed`}),null),T(f,`click`,l),C(f,u(o,{get when(){return i()},get fallback(){return u(A,{size:13})},get children(){return u(k,{size:13})}})),C(d,u(o,{get when(){return t.onClose},get children(){var e=Wt();return T(e,`click`,()=>t.onClose?.()),C(e,u(ye,{size:14})),r(t=>{var r=O.quoteErrorIconButton,i=n({id:`1l0xxoj`,message:`Close`});return r!==t.e&&y(e,t.e=r),i!==t.t&&b(e,`aria-label`,t.t=i),t},{e:void 0,t:void 0}),e}}),null),v(s,p),C(p,()=>t.message),C(e,u(o,{get when(){return t.onRetry},get children(){var e=I();return T(e,`click`,()=>{t.onRetry?.()}),C(e,()=>n({id:`1w68n16`,message:`Try Again`})),r(()=>y(e,w(M.btnError,O.quoteErrorCta))),e}}),null),r(r=>{var o=w(O.quoteErrorPanel,O[`quoteErrorPanel--${t.variant}`]),s=O.quoteErrorHeader,l=O.quoteErrorTitle,u=O.quoteErrorActions,m=w(O.quoteErrorIconButton,i()&&O.quoteErrorIconButtonCopied),h=i()?n({id:`13bzcw5`,message:`Copied`}):n({id:`2mzna2`,message:`Copy error`}),g=i()?`true`:`false`,_=w(O.quoteErrorMessage,E.autoHideScrollbar);return o!==r.e&&y(e,r.e=o),s!==r.t&&y(a,r.t=s),l!==r.a&&y(c,r.a=l),u!==r.o&&y(d,r.o=u),m!==r.i&&y(f,r.i=m),h!==r.n&&b(f,`aria-label`,r.n=h),g!==r.s&&b(f,`data-copied`,r.s=g),_!==r.h&&y(p,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 Dn(e){return u(tt,{get children(){return u(R,e)}})}function R(e){let{t:c}=Me(),v=Me(),x=a(()=>e.config.methods??[`crypto`]),se=a(()=>x().includes(`crypto`)),_e=a(()=>x().includes(`card`)),k=a(()=>!!e.config.lockFromToken||!!e.config.defaultPayMethod),A=a(()=>!!e.config.lockToToken),{page:j,setPage:tt,showBack:at,backExiting:_t,handleBack:yt,onBackAnimEnd:St}=wt({methods:x,defaultPage:()=>e.config.defaultPayMethod,onBack:e.onBack}),[P,F]=d(`idle`),[It,Lt]=d(`idle`),Rt=a(()=>!e.config.defaultPayMethod&&x().length>1&&j()!==`entry`),zt=a(()=>P()===`enter`?`enter`:P()===`exit`?`exit`:at()?`pushed`:`idle`),Bt=e=>{let t=j();t!==e&&(Lt(`forward`),F(t===`entry`?`enter`:`idle`),tt(e))},Vt=()=>{if(_t())return;let e=Rt();if(e){F(`exit`),yt(),Lt(`back`),tt(`entry`);return}F(e?`exit`:`idle`),yt()},Wt=()=>{if(P()===`enter`){F(`idle`);return}P()===`exit`&&(F(`idle`),St())},I=Ot(),[L,Dn]=d(`from`),{tokenSelector:R,recipient:On,provider:kn,quoteDetails:z,paymentError:B,fiatPaymentHandoff:V}=gt([`tokenSelector`,`recipient`,`provider`,`quoteDetails`,`paymentError`,`fiatPaymentHandoff`]),An=Tn(R.open,R.mounted),jn=ot({axis:`y`}),Mn=ot({axis:`y`}),[Nn,Pn]=d(null),[Fn,In]=d(!1),[H,Ln]=d(e.config.fiatCurrency??`USD`),[Rn,zn]=d(null),[Bn,Vn]=d(null),[Hn,Un]=d(null),[Wn,Gn]=d(null),Kn=()=>{i(()=>{I.clearError(),zn(null)})},{isConnected:U,walletAddress:W,handleConnect:qn}=Qe({walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,onAddressChange:e=>I.setWalletAddress(e),onConnectError:(e,t)=>{i(()=>{zn(`wallet-connect`),I.setError(e),I.setErrorCode(t)})}});s(f(U,e=>{e&&Rn()===`wallet-connect`&&Kn()}));let Jn=e=>{e instanceof HTMLElement&&Pn(e)},Yn=()=>{window.setTimeout(()=>{let e=Nn();e?.isConnected&&e.focus()},300)},Xn=()=>{R.hide(),Yn()},Zn=(e,t)=>{if(e===`to`&&j()===`card`){Jn(t),Dn(`to`),R.show();return}if(!U()){qn();return}Jn(t),Dn(e),R.show()},Qn=e=>{if(e instanceof HTMLElement){e.blur();return}if(typeof document>`u`)return;let t=document.activeElement;if(!(t instanceof HTMLElement))return;let n=t.shadowRoot?.activeElement;if(n instanceof HTMLElement){n.blur();return}t.blur()},$n=e=>{Qn(e),On.show()},G=a(()=>new m({baseUrl:e.config.apiEndpoint??`https://api.hyperstream.dev`})),er=a(()=>new p({baseUrl:e.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`})),K=()=>G().baseUrl,tr=a(()=>e.config.fromTokens?.length?rt(e.config.fromTokens):void 0),nr=a(()=>e.config.toTokens?.length?rt(e.config.toTokens):void 0),[rr,ir]=d([]),ar=Oe(G,()=>!0),or=a(()=>{let e=ar.data;return e?Ve(e):new Map}),{needRecipient:sr,effectiveRecipient:cr,recipientDisplay:lr,handleRecipientChange:ur}=dt({fromToken:I.fromToken,toToken:I.toToken,recipient:I.recipient,isConnected:U,walletAddress:W,walletAdapter:()=>e.walletAdapter,setRecipient:I.setRecipient}),dr=ge(G,W,()=>U()&&!!W(),()=>e.walletAdapter?.supportedChainIds),fr=a(()=>{let e=I.fromToken(),t=dr.data;return!e||!t?null:ne(t,e)}),pr=a(()=>{let e=fr();return e?.extensions?.balance?ce(oe(de(e.extensions.balance,e.decimals),2)):e?`0`:null}),mr=a(()=>{let e=I.fromToken();return!e||typeof e.decimals!=`number`||!dr.data?null:fr()?.extensions?.balance??`0`}),hr=a(()=>{let e=I.inputAmount(),t=I.fromToken(),n=mr();if(!t||typeof t.decimals!=`number`||!n||!e||e===`0`||e===``)return!1;try{return BigInt(re(e,t.decimals))>BigInt(n)}catch{return!1}}),[gr,_r,vr]=Te(``,300),q=a(()=>e.config.tradeType===`EXACT_OUTPUT`),yr=a(()=>e.config.quoteCard??(q()?`visible`:`hidden`)),J=a(()=>!q()&&yr()===`hidden`),Y=a(()=>!!e.config.noBackground&&!!e.config.noBorder),br=a(()=>e.lockRecipient===void 0?!!e.config.recipient&&e.config.recipientEditable!==!0:e.lockRecipient),xr=a(()=>{if(j()!==`crypto`)return null;let t=I.fromToken(),n=I.toToken(),r=cr();if(!t||typeof t.decimals!=`number`||!n||typeof n.decimals!=`number`||!G()||sr())return null;if(q()){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:re(i,n.decimals),fromAddress:W()??ie(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=gr();return!i||parseFloat(i)<=0?null:{tradeType:`EXACT_INPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:n.chainId,toToken:n.address,amount:re(i,t.decimals),fromAddress:W()??ie(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}}}),X=Ft(G,xr,a(()=>!!xr()&&!I.execPhase()&&U()&&!!W())),Sr=a(()=>{if(!I.fromToken()||!I.toToken())return[];if(!q()){let e=I.inputAmount();if(!e||parseFloat(e)<=0)return[]}return X.data?.routes??[]}),Cr=a(()=>X.data?.quoteId??null),wr=a(()=>Sr().length>0?le(Sr()):null),Tr=a(()=>{let e=Sr(),t=wr();return e.find(e=>e.routeId===t)??e[0]??null}),Er=a(()=>{let e=Tr(),t=I.toToken();return!e||!t||typeof t.decimals!=`number`?``:oe(de(e.quote.amountOut,t.decimals))}),Dr=a(()=>{if(!q())return null;let e=Tr(),t=I.fromToken();return!e||!t||typeof t.decimals!=`number`?null:oe(de(e.quote.amountIn,t.decimals))}),Z=a(()=>Je(I.execPhase(),I.error(),X.isFetching,Sr().length,!!xr())),Or=a(()=>I.execPhase()||!xr()?!1:!X.isFetching&&X.isSuccess&&Sr().length===0),kr=a(()=>{let e=Z();return e===`quoted`||e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`||e===`success`}),Ar=a(()=>{let e=Z();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),jr=a(()=>!I.fromToken()||!I.toToken()?!1:Z()===`quoting`&&!!xr()&&Sr().length===0),Mr=a(()=>{let e=I.fromToken();if(!e)return null;if(typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd))return e.priceUsd;let t=Number(fr()?.extensions?.price?.usd??``);return Number.isFinite(t)?t:null}),Nr=a(()=>{let e=I.toToken();return e&&typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd)?e.priceUsd:null}),Pr=a(()=>{let e=q()?Dr()??`0`:I.inputAmount(),t=Number(e),n=Mr();return!Number.isFinite(t)||t<=0||n===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:$e(t*n)})}),{trackingOrderId:Fr,trackingAddress:Ir,trackingProviderName:Lr,trackingProviderIcon:Rr,executionError:zr,failedExecPhase:Br,handleConfirm:Vr,handleRetry:Hr,handleNewSwap:Ur}=Ut({client:G,walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,apiEndpoint:()=>e.config.apiEndpoint,fromToken:I.fromToken,recipient:cr,needRecipient:sr,walletAddress:W,routes:Sr,quoteId:Cr,selectedRouteId:wr,execPhase:I.execPhase,setExecPhase:I.setExecPhase,setError:e=>{zn(`validation`),I.setError(e)},setErrorCode:e=>{zn(`validation`),I.setErrorCode(e)},storeReset:I.reset,onReset:()=>vr(``)});Xe({client:G,walletAddress:W,trackingAddress:Ir,trackingOrderId:Fr,phase:Z,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:Wr}=Et({phase:Z,onExpired:()=>X.refetch()});s(f(()=>({isError:X.isError,error:X.error,data:X.data}),({isError:e,error:t,data:n})=>{I.execPhase()||j()!==`crypto`||(e&&!n?i(()=>{zn(`quote`),t instanceof h?(I.setError(t.message),I.setErrorCode(t.code)):(I.setError(String(t)),I.setErrorCode(null))}):Rn()===`quote`&&I.error()&&!e&&Kn())}));let Gr=async()=>{let e=Rn();if(Kn(),e===`quote`){await X.refetch();return}if(e===`wallet-connect`){await qn();return}e!==`validation`&&Hr()};s(f(()=>X.data,t=>{t&&e.callbacks?.onQuoteReceived?.(t)}));let Kr=a(()=>cr()),qr=a(()=>{if(!q()||!e.config.amount)return null;let t=I.toToken();return!t||typeof t.decimals!=`number`?null:re(e.config.amount,t.decimals)}),Q=ht({client:er,targetToken:I.toToken,recipient:Kr,refundTo:()=>e.config.refundTo,fiatCurrency:()=>H(),callbacks:()=>e.callbacks,flowKind:`swap`,cryptoAmount:qr,requireRecipient:!0}),Jr=Et({phase:Q.phase,onExpired:()=>Q.refetchQuote(),intervalSeconds:30}),Yr=a(()=>!!I.toToken()&&(q()?!!e.config.amount:!!Q.fiatAmount())),Xr=a(()=>j()===`card`&&!Kr()&&Yr()),Zr=a(()=>lr()??(U()?W():null)),Qr=a(()=>!!Zr()||Yr()),$r=a(()=>!!e.config.fiatCurrency),ei=Ie(er,()=>!$r()),ti=a(()=>{if($r())return[];let e=ei.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()}),ni=[`USD`,`EUR`,`GBP`,`JPY`,`KRW`,`CNY`,`AUD`,`CAD`,`INR`,`SGD`,`HKD`,`TWD`,`BRL`,`MXN`,`CHF`],ri=a(()=>{let e=ti();return e.length>0?e:ni}),ii=a(()=>vt(H())||H()),ai=()=>I.toToken()?.decimals??Q.quote()?.token?.decimals??18,oi=e=>e?oe(de(e,ai()),6):`0`,si=a(()=>{let e=Q.quote(),t=parseFloat(Q.fiatAmount());return!e||!t?!1:!!(e.minFiatAmount&&t<parseFloat(String(e.minFiatAmount))||e.maxFiatAmount&&t>parseFloat(String(e.maxFiatAmount)))}),ci=a(()=>{let e=Q.phase();return e===`awaiting-payment`||e===`payment-handoff`||e===`tracking`}),li=a(()=>j()===`card`&&(Q.phase()===`awaiting-payment`||Q.phase()===`payment-handoff`)&&!!Q.directWidgetUrl()),ui=a(()=>j()===`card`&&(Q.phase()===`awaiting-payment`||Q.phase()===`payment-handoff`)),di=a(()=>{if(j()!==`card`||Q.phase()!==`payment-handoff`)return null;let e=Q.orderId(),t=Q.directWidgetUrl();return e&&t?`${e}:${t}`:null}),fi=a(()=>{let e=Q.quote();return e?.providerName??Dt(Q.orderStatus()?.provider??e?.provider??`Transak`)}),pi=a(()=>Q.fiatAmount()||Q.orderStatus()?.fiatAmount||Q.quote()?.fiatAmount||``),[mi,hi]=d(null),gi=e=>({orderStatus:e,fiatAmount:pi()||e.fiatAmount||``,fiatCurrency:H(),targetToken:I.toToken(),tokenDecimals:Q.tokenDecimals(),provider:e.provider??`transak`,quote:Q.quote()}),$=a(()=>{let e=Q.orderStatus();return e?gi(e):mi()});s(()=>{let e=Q.orderStatus();Q.phase()!==`success`||!e||hi(gi(e))});let _i=()=>{li()&&(V.open()?V.hide():V.show())};s(()=>{if(!li()){Q.orderId()||Gn(null),V.hide();return}let e=di();e&&Wn()!==e&&(Gn(e),V.show())});let vi=a(()=>{let e=Q.phase();return e===`creating-order`||e===`quoting`}),yi=a(()=>{let e=Q.phase();return e===`error`?c({id:`1w68n16`,message:`Try Again`})??`Try Again`:e===`creating-order`||e===`quoting`?c({id:`344av8`,message:`Processing...`}):e===`quoted`&&Q.quote()?c({id:`13l4n4r`,message:`Continue via {provider}`},{provider:Q.quote().providerName??Dt(Q.quote().provider)}):c({id:`119fv83`,message:`Enter amount`})}),bi=a(()=>Q.phase()===`quoted`&&!!Kr()&&!si()&&!Q.isQuoteFetching()),xi=()=>{let e=Q.phase();e===`error`?Q.handleRetry():e===`quoted`&&bi()&&Q.createOrder()},Si=a(()=>{if(q()&&e.config.amount)return e.config.amount;if(j()===`crypto`)return Er();let t=Ue(Q.quote());return t?oi(t):``}),Ci=a(()=>q()&&e.config.amount?!0:j()===`crypto`?kr()||Z()===`quoting`:!!Q.quote()||Q.phase()===`quoting`),wi=a(()=>{let e=Number(Si()||`0`),t=Nr();return!Ci()||!Number.isFinite(e)||e<=0||t===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:$e(e*t)})}),Ti=e=>{let t=or().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}},Ei=async t=>{try{let n=nt(t),r=await fe(n.chainId,n.address,e.config.apiEndpoint,G());return typeof r.decimals==`number`?r:null}catch{return null}};s(f(()=>e.config.locale,e=>{e&&v.setLocale(e)})),s(f(()=>e.config.recipient,e=>{I.setRecipient(e??null)})),s(f(()=>e.config.fiatCurrency,e=>{e&&Ln(e)})),s(f([()=>e.config.amount,q],([e,t])=>{let n=e??``;I.setInputAmount(n),vr(t?``:n)}));let Di=0;s(f([()=>e.config.fromToken,()=>e.config.apiEndpoint],async([e])=>{let t=++Di;if(!e){I.setFromToken(null);return}let n=await Ei(e);t===Di&&I.setFromToken(n)}));let Oi=0;s(f([()=>e.config.toToken,()=>e.config.apiEndpoint],async([e])=>{let t=++Oi;if(!e){I.setToToken(null);return}let n=await Ei(e);t===Oi&&I.setToToken(n)}));let ki=0;s(f([()=>e.config.toTokens,()=>e.config.apiEndpoint,or],async([e])=>{let t=++ki;if(!e?.length){ir([]);return}let n=await Promise.all(e.map(Ei));t===ki&&ir(n.filter(e=>!!e).map(Ti))}));let Ai=t=>{I.setInputAmount(t),e.callbacks?.onAmountChanged?.({amount:t,direction:`from`}),I.error()&&Kn(),_r(t)},ji=e=>{ur(e),I.error()&&Kn()},Mi=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()},Ni=()=>{if(Ar()||!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)})},Pi=a(()=>{let e=I.fromToken(),t=mr();if(!e||typeof e.decimals!=`number`||!t)return null;let n=te(e.address),r=n?Tr()?.quote.estimatedGas:void 0;return De({balanceRaw:t,decimals:e.decimals,chainId:e.chainId,isNative:n,estimatedGasRaw:r})}),Fi=a(()=>{let e=Pi(),t=I.fromToken();if(!e||!t||e.reserveSource===`none`||e.reserveSource===`fallback`)return;let n=xt(t.chainId).symbol,r=e.reserveAmount;return e.reserveSource===`live`?c({id:`1fz9lzi`,message:`{reserve} {symbol} reserved for network fees (live estimate)`},{reserve:r,symbol:n}):c({id:`156lkep`,message:`{reserve} {symbol} reserved for network fees`},{reserve:r,symbol:n})}),Ii=a(()=>{let e=Pi(),t=I.inputAmount(),n=I.fromToken();if(!e||!n||typeof n.decimals!=`number`||!t||t===`0`||t===``||!te(n.address)||e.reserveSource===`none`)return!1;try{let r=BigInt(re(t,n.decimals)),i=BigInt(re(e.amount,n.decimals)),a=BigInt(mr()??`0`);return r>i&&r<=a}catch{return!1}}),Li=()=>{if(q())return;let e=Pi();!e||e.amount===`0`||Ai(e.amount)},Ri=Ne({fields:{cryptoAmount:lt({value:()=>q()?Dr()??`0`:I.inputAmount(),setValue:e=>{q()||Ai(e)},parse:ae,validate:e=>{if(j()!==`crypto`||q())return null;let t=Number(e);return Number.isFinite(t)&&t>0?null:`Enter amount`}}),fiatAmount:lt({value:()=>q()?Q.quote()?.fiatAmount??`0`:Q.fiatAmount(),setValue:e=>{q()||Q.setFiatAmount(e)},parse:ae,validate:e=>{if(j()!==`card`||q())return null;let t=Number(e);return Number.isFinite(t)&&t>0?null:`Enter amount`}}),recipient:lt({value:()=>I.recipient()??``,setValue:ji,parse:e=>e.trim(),validate:()=>j()===`crypto`&&sr()||Xr()?`Enter Recipient Address`:null})}}),zi=Ri.field(`cryptoAmount`),Bi=Ri.field(`fiatAmount`),Vi=Ri.field(`recipient`),Hi=()=>Ri.validateFields([`cryptoAmount`,`recipient`]),Ui=()=>Ri.validateFields([`fiatAmount`,`recipient`]),Wi=()=>{Hi()&&Vr()},Gi=()=>{Q.phase()===`quoted`&&!Ui()||xi()},Ki=e=>`${e.slice(0,6)}...${e.slice(-4)}`,qi=a(()=>{let e=Tr();return!e||!I.fromToken()||!I.toToken()?null:Z()===`quoting`||kr()?e:null}),Ji=a(()=>Rn()===`quote`?I.error():null),Yi=a(()=>Q.errorSource()===`quote`?Q.error():null),Xi=a(()=>Q.phase()===`error`&&Q.errorSource()!==`quote`?Q.error():null),Zi=a(()=>{let e=Xi();return e?`card:${e}`:null}),Qi=e=>e===`crypto`?Ji():e===`card`?Yi():null,$i=e=>{let t=Qi(e);return t?`${e}:${t}`:null},ea=a(()=>$i(j())),ta=e=>{let t=$i(e);return!!t&&t===Bn()},na=e=>!J()&&!!Qi(e)&&!ta(e),ra=a(()=>!!qi()&&!!I.fromToken()&&!!I.toToken()),ia=a(()=>!!Q.quote()),aa=e=>J()&&(e===`crypto`&&ra()||e===`card`&&ia()||!!Qi(e)),oa=e=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(e).catch(()=>void 0)},sa=()=>{let e=ea();e&&Vn(e),z.hide()};s(()=>{z.open()&&!aa(j())&&z.hide()}),s(()=>{let e=ea();if(!e){Vn(null);return}!J()||Bn()===e||z.open()||z.show()});let ca=()=>{let e=Zi();e&&Un(e),B.hide()},la=()=>{Un(null),B.hide(),Q.handleRetry()};s(()=>{let e=Zi();if(!e){Un(null),B.open()&&B.hide();return}if(j()!==`card`){B.open()&&B.hide();return}if(!J()){B.open()&&B.hide();return}Hn()===e||B.open()||B.show()});let ua=a(()=>J()&&!!Xi()&&B.mounted()),da=a(()=>{let t=e.config.titleText?.trim();return t&&t.length>0?t:`TokenFlight`}),fa=a(()=>{let t=e.config.titleText?.trim();return!!t&&t.length>0}),pa=a(()=>{let t=e.config.titleImageUrl?.trim();return t&&t.length>0?t:null}),ma=a(()=>j()===`card`&&(ci()||Q.phase()===`success`)),ha=a(()=>j()===`card`?Q.phase()===`success`&&Q.orderStatus()?`success`:ma()?`tracking`:`form`:Z()===`success`&&I.order()?`success`:Ar()?`tracking`:`form`);return u(me,{get class(){return D(()=>!!J())()?O.quoteCardHiddenContainer:void 0},observeKey:()=>[ha(),ma()?Q.phase():``,li()?`fiat-payment-link`:``,J(),e.config.hidePoweredBy].join(`|`),get noBackground(){return e.config.noBackground},get noBorder(){return e.config.noBorder},get"data-quote-card"(){return J()?`hidden`:`visible`},get children(){return u(ve,{form:Ri,get children(){return[u(Ze,{get current(){return ha()},get opaque(){return!e.config.noBackground},"data-testid":`swap-lifecycle-presence`,children:i=>u(n,{get children(){return[u(t,{when:i===`form`,get children(){return[(()=>{var t=Yt(),n=t.firstChild,i=n.firstChild,a=i.firstChild;return C(n,u(o,{get when(){return at()},get children(){var e=Kt(),t=e.firstChild;return T(e,`click`,Vt),T(t,`animationend`,P()===`idle`?void 0:Wt),C(t,u(ut,{size:16})),r(n=>{var r=w(E.backButton,O.headerBackButton,_t()&&E.backButtonExiting),i=c({id:`1hzmxtu`,message:`Back`}),a=P()===`enter`?`${O.headerBackArrow} ${O[`headerBackArrow--enter`]}`:P()===`exit`?`${O.headerBackArrow} ${O[`headerBackArrow--exit`]}`:O.headerBackArrow,o=P()===`idle`?{display:`inline-flex`}:void 0,s=P();return r!==n.e&&y(e,n.e=r),i!==n.t&&b(e,`aria-label`,n.t=i),a!==n.a&&y(t,n.a=a),n.o=S(t,o,n.o),s!==n.i&&b(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),C(i,u(o,{get when(){return pa()},get fallback(){return u(o,{get when(){return!e.config.hideTitle},get children(){return u(kt,{size:22})}})},get children(){var t=qt();return r(n=>{var r=pa(),i=da(),a=w(O.headerLogoImage,e.config.hideTitle&&O[`headerLogoImage--solo`]);return r!==n.e&&b(t,`src`,n.e=r),i!==n.t&&b(t,`alt`,n.t=i),a!==n.a&&y(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),a),C(a,u(o,{get when(){return fa()},get fallback(){return[`Token`,(()=>{var e=Zt();return r(()=>y(e,O.headerTitleAccent)),e})()]},get children(){return da()}})),C(t,u(o,{get when(){return D(()=>!!U())()&&W()},get children(){var t=Jt(),n=t.firstChild,i=n.nextSibling;return T(t,`click`,async()=>{e.walletAdapter?.openAccountModal?await e.walletAdapter.openAccountModal():e.callbacks?.onAccountModal?.()}),C(i,()=>Ki(W())),r(e=>{var r=O.headerRight,a=c({id:`xphk5n`,message:`Wallet account`}),o=O.walletDot,s=O.walletAddress;return r!==e.e&&y(t,e.e=r),a!==e.t&&b(t,`aria-label`,e.t=a),o!==e.a&&y(n,e.a=o),s!==e.o&&y(i,e.o=s),e},{e:void 0,t:void 0,a:void 0,o:void 0}),t}}),null),r(r=>{var o=O.header,s=O.headerLeft,c=w(O.headerBrand,O[`headerBrand--${zt()}`]),l=zt(),u=w(O.headerTitle,e.config.hideTitle&&O[`headerTitle--hidden`]);return o!==r.e&&y(t,r.e=o),s!==r.t&&y(n,r.t=s),c!==r.a&&y(i,r.a=c),l!==r.o&&b(i,`data-header-brand-state`,r.o=l),u!==r.i&&y(a,r.i=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})(),(()=>{var i=Xt(),a=i.firstChild;return C(i,u(Ct,{get current(){return j()},get direction(){return It()},height:!0,"data-testid":`method-presence`,children:i=>(()=>{var a=bn();return b(a,`data-method-page`,i),C(a,u(n,{get children(){return[u(t,{when:i===`entry`,get children(){var e=Qt(),t=e.firstChild,n=t.firstChild;return C(n,()=>c({id:`cgzgvn`,message:`Pay with`})),C(e,u(Ke,{get hasCrypto(){return se()},get hasCard(){return _e()},showExchange:!0,onSelectCrypto:()=>Bt(`crypto`),onSelectCard:()=>Bt(`card`)}),null),r(n=>{var r=O.entryMethodPane,i=O.payWithLabel;return r!==n.e&&y(e,n.e=r),i!==n.t&&y(t,n.t=i),n},{e:void 0,t:void 0}),e}}),u(t,{when:i!==`entry`,get children(){return[(()=>{var a=dn(),s=a.firstChild,l=s.firstChild,d=l.firstChild,f=d.firstChild,p=l.nextSibling,m=p.nextSibling,h=m.firstChild,_=h.firstChild,v=h.nextSibling,x=v.nextSibling,S=x.firstChild,te=S.nextSibling;return C(f,()=>Ae(`youPay`,c({id:`17kq51m`,message:`You pay`}))),C(d,u(o,{get when(){return D(()=>!!(i===`crypto`&&U()&&pr()))()&&!q()},get children(){var e=en(),t=e.firstChild,n=t.nextSibling,i=n.firstChild;return C(t,()=>c({id:`y6jqu9`,message:`Balance: {fromBalance}`},{fromBalance:pr()})),T(i,`click`,Li),C(i,()=>c({id:`7v6g6x`,message:`MAX`})),C(n,u(o,{get when(){return Fi()},get children(){var e=$t();return C(e,Fi),r(()=>y(e,O.maxTooltip)),e}}),null),r(r=>{var a=O.panelHeaderRight,o=O.panelBalance,s=O.maxBtnWrapper,c=O.maxBtn,l=Fi()?`tf-max-tooltip`:void 0;return a!==r.e&&y(e,r.e=a),o!==r.t&&y(t,r.t=o),s!==r.a&&y(n,r.a=s),c!==r.o&&y(i,r.o=c),l!==r.i&&b(i,`aria-describedby`,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),C(l,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return[(()=>{var e=rn();return C(e,u(At,{field:zi,get disabled(){return Ar()||q()}}),null),C(e,u(o,{get when(){return I.fromToken()},get fallback(){return(()=>{var e=xn(),t=e.firstChild;return T(e,`click`,e=>{k()||Zn(`from`,e.currentTarget)}),C(t,()=>c({id:`zz4mrw`,message:`Select token`})),C(e,u(o,{get when(){return!k()},get children(){var e=tn();return C(e,u(he,{size:14})),r(()=>y(e,O.caret)),e}}),null),r(n=>{var r=w(O.tokenBtn,O[`tokenBtn--select`]),i=O.tokenNameAccent;return r!==n.e&&y(e,n.e=r),i!==n.t&&y(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=nn(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return T(e,`click`,e=>{k()||Zn(`from`,e.currentTarget)}),C(t,u(Nt,{get symbol(){return I.fromToken().symbol??`?`},color:`#2775CA`,size:24,get logoURI(){return I.fromToken().logoURI}}),n),C(n,u(Pt,{size:10,get iconUrl(){return g(K(),I.fromToken().chainId)}})),C(i,()=>I.fromToken().symbol),C(e,u(o,{get when(){return!k()},get children(){var e=tn();return C(e,u(he,{size:14})),r(()=>y(e,O.caret)),e}}),null),r(r=>{var a=w(O.tokenBtn,k()&&O[`tokenBtn--locked`]),o=k()?void 0:`button`,s=O.tokenIconWrap,c=O.tokenChainDot,l=O.tokenName;return a!==r.e&&y(e,r.e=a),o!==r.t&&b(e,`role`,r.t=o),s!==r.a&&y(t,r.a=s),c!==r.o&&y(n,r.o=c),l!==r.i&&y(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),r(()=>y(e,O.panelRow)),e})(),(()=>{var e=an(),t=e.firstChild;return C(t,()=>Pr()??` `),r(n=>{var r=O.panelFooter,i=w(O.fiat,!Pr()&&O[`fiat--hidden`]);return r!==n.e&&y(e,n.e=r),i!==n.t&&y(t,n.t=i),n},{e:void 0,t:void 0}),e})()]}}),u(t,{when:i===`card`,get children(){return[(()=>{var t=on(),n=t.firstChild,a=n.firstChild;return C(a,ii),C(n,u(Re,{field:Bi,get class(){return N.fiatAmountInput},type:`text`,inputMode:`decimal`,placeholder:`0`,get disabled(){return q()},part:`fiat-amount-input`,"data-testid":`fiat-amount-input`}),null),C(t,u(Mt,{get currencies(){return ri()},get selected(){return H()},onSelect:Ln,get locked(){return $r()},get locale(){return e.config.locale},get compactSafe(){return i===`card`&&J()},onOpenChange:e=>In(e&&i===`card`&&J())}),null),r(e=>{var r=O.panelRow,i=N.fiatAmountWrap,o=N.fiatCurrencyPrefix;return r!==e.e&&y(t,e.e=r),i!==e.t&&y(n,e.t=i),o!==e.a&&y(a,e.a=o),e},{e:void 0,t:void 0,a:void 0}),t})(),(()=>{var e=rn();return C(e,u(o,{get when(){return Q.quote()},get fallback(){return(()=>{var e=Sn();return r(()=>y(e,w(O.fiat,O[`fiat--hidden`]))),e})()},children:e=>(()=>{var t=tn();return C(t,u(o,{get when(){return e().minFiatAmount},get children(){return[D(()=>c({id:`cx9lh3`,message:`Min`})),`: `,D(()=>ii()),D(()=>e().minFiatAmount)]}}),null),C(t,u(o,{get when(){return D(()=>!!e().minFiatAmount)()&&e().maxFiatAmount},children:` · `}),null),C(t,u(o,{get when(){return e().maxFiatAmount},get children(){return[D(()=>c({id:`gtvgs9`,message:`Max`})),`: `,D(()=>ii()),D(()=>e().maxFiatAmount)]}}),null),r(()=>y(t,w(N.fiatLimitsText,si()&&N.fiatLimitsError))),t})()})),r(()=>y(e,O.panelFooter)),e})()]}})]}}),null),C(p,u(o,{get when(){return D(()=>!e.hideSwapArrow&&i===`crypto`)()&&!A()},get children(){var e=sn();return T(e,`click`,Ni),C(e,u(ct,{size:13})),r(t=>{var n=O.swapArrowCircle,r=c({id:`2eikro`,message:`Swap tokens`});return n!==t.e&&y(e,t.e=n),r!==t.t&&b(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}})),C(_,()=>Ae(`youReceive`,c({id:`va18uh`,message:`You receive`}))),C(h,u(o,{get when(){return i===`card`?Qr():I.toToken()&&U()},get children(){var e=cn(),t=e.firstChild;return T(e,`click`,e=>!br()&&$n(e.currentTarget)),C(t,(()=>{var e=D(()=>!!(i===`card`?Zr():lr()));return()=>e()?Ki(i===`card`?Zr():lr()):c({id:`fpand1`,message:`Enter destination address`})})()),C(e,u(o,{get when(){return!br()},get children(){return u(xe,{size:10})}}),null),r(n=>{var r=w(E.recipientBadge,!(i===`card`?Zr():lr())&&E.recipientBadgeEmpty,br()&&E.recipientBadgeLocked),a=br(),o=E.recipientBadgeText;return r!==n.e&&y(e,n.e=r),a!==n.t&&(e.disabled=n.t=a),o!==n.a&&y(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),null),C(v,u(o,{get when(){return!(i===`crypto`?jr():Q.phase()===`quoting`)},get fallback(){return(()=>{var e=Cn();return r(()=>y(e,E.skeleton)),e})()},get children(){var e=ln();return C(e,u(mt,{get value(){return Si()||`0`},digits:8})),r(()=>y(e,w(be.amount,!Ci()&&be.muted))),e}}),null),C(v,u(o,{get when(){return I.toToken()},get fallback(){return(()=>{var e=xn(),t=e.firstChild;return T(e,`click`,e=>{A()||Zn(`to`,e.currentTarget)}),C(t,()=>c({id:`zz4mrw`,message:`Select token`})),C(e,u(o,{get when(){return!A()},get children(){var e=tn();return C(e,u(he,{size:14})),r(()=>y(e,O.caret)),e}}),null),r(n=>{var r=w(O.tokenBtn,O[`tokenBtn--select`]),i=O.tokenNameAccent;return r!==n.e&&y(e,n.e=r),i!==n.t&&y(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=nn(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return T(e,`click`,e=>{A()||Zn(`to`,e.currentTarget)}),C(t,u(Nt,{get symbol(){return I.toToken().symbol??`?`},color:`#0052FF`,size:24,get logoURI(){return I.toToken().logoURI}}),n),C(n,u(Pt,{size:10,get iconUrl(){return g(K(),I.toToken().chainId)}})),C(i,()=>I.toToken().symbol),C(e,u(o,{get when(){return!A()},get children(){var e=tn();return C(e,u(he,{size:14})),r(()=>y(e,O.caret)),e}}),null),r(r=>{var a=w(O.tokenBtn,A()&&O[`tokenBtn--locked`]),o=A()?void 0:`button`,s=O.tokenIconWrap,c=O.tokenChainDot,l=O.tokenName;return a!==r.e&&y(e,r.e=a),o!==r.t&&b(e,`role`,r.t=o),s!==r.a&&y(t,r.a=s),c!==r.o&&y(n,r.o=c),l!==r.i&&y(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),C(S,()=>wi()??` `),C(te,u(o,{get when(){return i===`crypto`&&Z()===`quoted`},get children(){return u(we,{secondsRemaining:Wr,totalSeconds:30,onRefresh:()=>X.refetch(),isRefreshing:()=>X.isFetching})}}),null),C(te,u(o,{get when(){return i===`card`&&Q.phase()===`quoted`},get children(){return u(we,{get secondsRemaining(){return Jr.countdownSeconds},totalSeconds:30,onRefresh:()=>{Q.refetchQuote(),Jr.resetCountdown()},get isRefreshing(){return Q.isQuoteFetching}})}}),null),C(te,u(o,{get when(){return aa(i)},get children(){var e=un();return T(e,`click`,()=>z.show()),C(e,u(jt,{size:13})),r(t=>{var n=O.quoteDetailsTrigger,r=c({id:`tbygoy`,message:`View quote details`});return n!==t.e&&y(e,t.e=n),r!==t.t&&b(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}}),null),r(e=>{var t=O.panelWrapper,n=Fn()?`40`:void 0,r=O.mergedPanel,i=O.mergedSection,o=O.panelHeader,c=O.panelLabel,u=O.panelDivider,g=O.mergedSection,b=O.panelHeader,C=O.panelLabel,T=O.panelRow,E=O.panelFiatRow,D=w(O.fiat,!wi()&&O[`fiat--hidden`]),ne=O.quotePanelActions;return t!==e.e&&y(a,e.e=t),n!==e.t&&ee(a,`z-index`,e.t=n),r!==e.a&&y(s,e.a=r),i!==e.o&&y(l,e.o=i),o!==e.i&&y(d,e.i=o),c!==e.n&&y(f,e.n=c),u!==e.s&&y(p,e.s=u),g!==e.h&&y(m,e.h=g),b!==e.r&&y(h,e.r=b),C!==e.d&&y(_,e.d=C),T!==e.l&&y(v,e.l=T),E!==e.u&&y(x,e.u=E),D!==e.c&&y(S,e.c=D),ne!==e.w&&y(te,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 D(()=>!!na(i))()&&Ji()},children:e=>u(En,{get message(){return e()},variant:`crypto`,onCopy:oa})}),u(o,{get when(){return D(()=>!J())()&&jr()},get children(){var e=rn();return C(e,u(He,{})),r(()=>y(e,E.fadeIn)),e}}),u(o,{get when(){return D(()=>!!(!J()&&qi()&&I.fromToken()))()&&I.toToken()},get children(){var e=fn();return C(e,u(Be,{get route(){return qi()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},inline:!0})),r(()=>y(e,Ce.quote)),e}}),u(o,{get when(){return D(()=>!!Or())()&&!jr()},get children(){var e=pn(),t=e.firstChild;return C(t,()=>c({id:`ln9xiv`,message:`No routes available`})),r(n=>{var r=w(J()?O.compactQuoteStatus:O.noRoutesCard,E.fadeIn),i=E.noOfferText;return r!==n.e&&y(e,n.e=r),i!==n.t&&y(t,n.t=i),n},{e:void 0,t:void 0}),e}}),u(o,{get when(){return D(()=>!J()&&!Ji()&&!jr()&&!qi())()&&!Or()},get children(){var e=mn(),t=e.firstChild,n=t.nextSibling;return C(t,u(ct,{size:16})),C(n,()=>c({id:`1olegnl`,message:`Enter amount to get started`})),r(r=>{var i=w(N.quoteCardSlotCard,O.idleCardInline,E.fadeIn),a=E.idleIcon,o=E.idleTitle;return i!==r.e&&y(e,r.e=i),a!==r.t&&y(t,r.t=a),o!==r.a&&y(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})]}}),u(t,{get when(){return D(()=>!!(Xr()&&!Yi()))()&&!J()},get children(){var e=hn(),t=e.firstChild,n=t.nextSibling,i=n.nextSibling;return C(t,u(ze,{size:20})),C(n,()=>c({id:`fpand1`,message:`Enter destination address`})),C(i,()=>c({id:`19ne1ha`,message:`Connect wallet or enter an address to get a quote`})),r(r=>{var a=w(N.quoteCardSlotCard,O.recipientGateCard,E.fadeIn),o=E.idleIcon,s=E.idleTitle,c=E.idleSub;return a!==r.e&&y(e,r.e=a),o!==r.t&&y(t,r.t=o),s!==r.a&&y(n,r.a=s),c!==r.o&&y(i,r.o=c),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),u(t,{get when(){return D(()=>i===`card`&&!J())()&&Xi()},children:e=>u(En,{get message(){return e()},get title(){return c({id:`jssk7y`,message:`Payment Failed`})},variant:`card`,onCopy:oa})}),u(t,{get when(){return D(()=>!!(i===`card`&&na(i)))()&&Yi()},children:e=>u(En,{get message(){return e()},variant:`card`,onCopy:oa})}),u(t,{get when(){return D(()=>i===`card`&&Q.phase()!==`error`)()&&!J()},get children(){return u(Le,{fiatCheckout:Q,fiatCountdown:Jr,get targetToken(){return I.toToken()??null},get fiatCurrency(){return H()},get apiBase(){return K()},get showPayAmount(){return q()},hideCountdown:!0,onCompareProviders:()=>kn.show()})}})]}}),(()=>{var e=yn();return C(e,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return u(it,{get phase(){return Z()},get isConnected(){return U()},get hasQuote(){return kr()},onConnect:qn,onConfirm:Wi,onRetry:Gr,get errorLabel(){return D(()=>Rn()===`quote`)()?c({id:`1w68n16`,message:`Try Again`}):I.error()??void 0},get needsRecipient(){return sr()},onEnterRecipient:()=>$n(),get insufficientBalance(){return hr()},get insufficientForGas(){return Ii()}})}}),u(t,{when:i===`card`,get children(){return u(n,{get children(){return[u(t,{get when(){return Q.phase()===`error`},get children(){return u(o,{get when(){return!ua()},get fallback(){return(()=>{var e=wn();return C(e,yi),r(()=>y(e,M.btnPrimary)),e})()},get children(){var e=gn();return T(e,`click`,Gi),C(e,yi),r(()=>y(e,M.btnPrimary)),e}})}}),u(t,{get when(){return vi()},get children(){var e=_n(),t=e.firstChild,n=t.firstChild;return C(t,yi,null),r(r=>{var i=w(M.btnPrimary,M.executing),a=M.btnInner,o=M.spinner;return i!==r.e&&y(e,r.e=i),a!==r.t&&y(t,r.t=a),o!==r.a&&y(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return D(()=>!I.toToken())()&&(!!Q.fiatAmount()||q())},get children(){var e=gn();return T(e,`click`,e=>{Jn(e.currentTarget),Dn(`to`),R.show()}),C(e,()=>c({id:`zz4mrw`,message:`Select token`})),r(()=>y(e,M.btnRecipient)),e}}),u(t,{get when(){return Xr()},get children(){var e=gn();return T(e,`click`,e=>$n(e.currentTarget)),C(e,()=>c({id:`wx5bee`,message:`Enter Recipient Address`})),r(()=>y(e,M.btnRecipient)),e}}),u(t,{get when(){return bi()},get children(){var e=gn();return T(e,`click`,Gi),C(e,yi),r(()=>y(e,M.btnPrimary)),e}}),u(t,{when:!0,get children(){var e=vn();return C(e,yi),r(()=>y(e,M.btnPrimary)),e}})]}})}})]}})),r(()=>y(e,w(E.ctaWrapper,J()&&O.compactCtaWrapper))),e})()]}})]}})),a})()}),a),C(a,u(o,{get when(){return!e.config.hidePoweredBy},get children(){return u(Ye,{})}})),r(t=>{var n=w(O.methodFrame,J()&&O[`methodFrame--compact`],e.config.hidePoweredBy&&O[`methodFrame--footerHidden`]),r=J()?`hidden`:`visible`,o=e.config.hidePoweredBy?`hidden`:`visible`,s=w(E.footerSlot,O.methodFooterSlot),c=e.config.hidePoweredBy?`true`:`false`;return n!==t.e&&y(i,t.e=n),r!==t.t&&b(i,`data-quote-card-frame`,t.t=r),o!==t.a&&b(i,`data-powered-footer-frame`,t.a=o),s!==t.o&&y(a,t.o=s),c!==t.i&&b(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})()]}}),u(t,{when:i===`tracking`,get children(){return u(n,{get children(){return[u(t,{get when(){return j()===`card`},get children(){return u(qe,{get phase(){return Q.phase()},get status(){return Q.orderStatus()?.status??`pending_payment`},get strategy(){return Q.strategy()??Q.orderStatus()?.swapStrategy??`direct`},get fiatAmount(){return pi()},get fiatCurrency(){return H()},get cryptoAmount(){return oi(We({status:Q.orderStatus(),quote:Q.quote()}))},get targetToken(){return I.toToken()},get provider(){return Q.orderStatus()?.provider??Q.quote()?.provider??`transak`},get hideProvider(){return e.config.hideProvider},get transferTxHash(){return Q.orderStatus()?.fillTxHash??Q.orderStatus()?.transferTxHash},get failedReason(){return pt(Q.orderStatus())},get apiBase(){return K()},get chainMap(){return or()},get paymentLinkAvailable(){return li()},get paymentLinkOpen(){return V.open()},onPaymentLinkToggle:_i,get cancelAvailable(){return ui()},onCancelPayment:()=>Q.cancelPayment(),onNewPurchase:()=>Q.handleNewPurchase(),onRetry:()=>Q.handleRetry()})}}),u(t,{when:!0,get children(){return u(bt,{get order(){return I.order()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},get providerName(){return Lr()},get providerIcon(){return Rr()},get hideProvider(){return e.config.hideProvider},get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return I.inputAmount()},get outputAmount(){return Er()},onNewSwap:Ur,onRetry:Hr,get executionError(){return zr()},mode:`swap`,get phase(){return Z()},get failedPhase(){return Br()},get chainMap(){return or()}})}})]}})}}),u(t,{when:i===`success`,get children(){return u(n,{get children(){return[u(t,{get when(){return D(()=>j()===`card`)()&&$()},get children(){return u(Ee,{get orderStatus(){return $().orderStatus},get fiatAmount(){return $().fiatAmount},get fiatCurrency(){return $().fiatCurrency},get targetToken(){return $().targetToken},get tokenDecimals(){return $().tokenDecimals},get quote(){return $().quote},get provider(){return $().provider},get apiBase(){return K()},get chainMap(){return or()},onNewPurchase:()=>Q.handleNewPurchase()})}}),u(t,{when:!0,get children(){return u(ft,{get order(){return I.order()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},onNewSwap:Ur,get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return Lr()},mode:`swap`,get chainMap(){return or()}})}})]}})}})]}})}),u(et,{drawer:V,when:()=>!!Q.directWidgetUrl(),get children(){return u(Ge,{drawer:V,get url(){return Q.directWidgetUrl()},get provider(){return fi()},onClose:()=>V.hide(),get noChrome(){return Y()}})}}),u(et,{drawer:R,get children(){return u(Se,{drawer:R,get selectingFor(){return L()},get noBorder(){return e.config.noBorder},get noChrome(){return Y()},get children(){return u(o,{get when(){return An()},get fallback(){return u(Pe,{get selectingFor(){return L()},onClose:Xn})},get children(){return u(l,{get fallback(){return u(Pe,{get selectingFor(){return L()},onClose:Xn})},get children(){return u(je,{get client(){return G()},get walletAddress(){return W()},get selectingFor(){return L()},onSelect:Mi,onClose:Xn,get supportedChainIds(){return e.walletAdapter?.supportedChainIds},get allowedTokens(){return D(()=>L()===`from`)()?tr():nr()},get tokens(){return D(()=>!!(L()===`to`&&rr().length))()?rr():void 0},get noBorder(){return e.config.noBorder},get dismissing(){return R.dismissing()}})}})}})}})}}),u(et,{drawer:On,when:()=>!!I.toToken(),get children(){return u(ke,{drawer:On,get noChrome(){return Y()},get children(){return u(st,{get initialValue(){return Vi.value()||cr()||``},get chainType(){return ue(I.toToken().chainId)},onConfirm:e=>{Vi.setValue(e),Vi.markTouched(),On.hide()},onClose:()=>On.hide(),get noChrome(){return Y()},get dismissing(){return On.dismissing()}})}})}}),u(et,{drawer:z,get children(){return u(Tt,{drawer:z,get label(){return c({id:`1tn6f91`,message:`Quote details`})},backdrop:`strong`,get noChrome(){return Y()},get class(){return w(O.quoteDetailsSheet,Y()&&O.drawerSheetNoChrome)},testId:`quote-details-sheet`,part:`quote-details-sheet`,get children(){return[u(pe,{get class(){return O.quoteDetailsClose},onClose:sa,get ariaLabel(){return c({id:`1l0xxoj`,message:`Close`})},testId:`quote-details-close`,get children(){return u(ye,{size:17})}}),u(Fe,{ref:jn,get class(){return w(O.quoteDetailsBody,E.autoHideScrollbar)},get children(){return u(n,{get children(){return[u(t,{get when(){return Qi(j())},children:e=>u(En,{get message(){return e()},variant:`sheet`,onCopy:oa,get onRetry(){return D(()=>j()===`card`)()?Q.handleRetry:Gr}})}),u(t,{get when(){return D(()=>!!(j()===`crypto`&&qi()&&I.fromToken()))()&&I.toToken()},get children(){var e=Gt(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return C(n,()=>c({id:`1nvxkfy`,message:`Route`})),C(i,()=>qi().routeId),C(e,u(Be,{get route(){return qi()},get fromToken(){return I.fromToken()},get toToken(){return I.toToken()},inline:!0}),null),r(n=>{var r=O.quoteDetailsCard,a=O.quoteDetailsMetaRow,o=O.quoteDetailsMetaValue;return r!==n.e&&y(e,n.e=r),a!==n.t&&y(t,n.t=a),o!==n.a&&y(i,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return D(()=>j()===`card`)()&&Q.quote()},get children(){return u(Le,{fiatCheckout:Q,fiatCountdown:Jr,get targetToken(){return I.toToken()??null},get fiatCurrency(){return H()},get apiBase(){return K()},get showPayAmount(){return q()},hideCountdown:!0,margin:`0`,height:`auto`,onCompareProviders:()=>kn.show()})}})]}})}})]}})}}),u(et,{drawer:B,when:()=>J()&&!!Xi(),get children(){return u(Tt,{drawer:B,get label(){return c({id:`jssk7y`,message:`Payment Failed`})},backdrop:`strong`,get noChrome(){return Y()},get class(){return w(O.quoteDetailsSheet,Y()&&O.drawerSheetNoChrome)},testId:`payment-error-sheet`,part:`payment-error-sheet`,get children(){return[u(pe,{get class(){return O.quoteDetailsClose},onClose:ca,get ariaLabel(){return c({id:`1l0xxoj`,message:`Close`})},testId:`payment-error-close`,get children(){return u(ye,{size:17})}}),u(Fe,{ref:Mn,get class(){return w(O.quoteDetailsBody,E.autoHideScrollbar)},get children(){return u(En,{get message(){return Xi()},get title(){return c({id:`jssk7y`,message:`Payment Failed`})},variant:`sheet`,onCopy:oa,onRetry:la})}})]}})}}),u(et,{drawer:kn,get children(){return u(Tt,{drawer:kn,get label(){return c({id:`118a77s`,message:`Select Fiat Provider`})},backdrop:`strong`,get noChrome(){return Y()},get children(){return u(Ht,{get quotes(){return Q.allQuotes()},get selectedProviderId(){return Q.selectedProviderId()},get fiatCurrency(){return H()},get apiBase(){return K()},get tokenDecimals(){return ai()},get targetSymbol(){return I.toToken()?.symbol??``},get countdownSeconds(){return Jr.countdownSeconds},totalCountdownSeconds:30,onRefresh:()=>{Q.refetchQuote(),Jr.resetCountdown()},get isRefreshing(){return Q.isQuoteFetching},onSelect:e=>{Q.setSelectedProvider(e),kn.hide()},onClose:()=>kn.hide(),get noChrome(){return Y()}})}})}})]}})}})}export{Dn as SwapComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./dist-
|
|
1
|
+
import"./dist-CpC2fQqU.js";import{a as e,n as t,o as n,s as r}from"./protocol-B7S8LSlJ.js";var i,a=`https://embed.tokenflight.ai/widget`,o=15e3,s=500;function c(e){return{...e,noBackground:!0,noBorder:!0}}var l=class i{constructor(t){if(this.listeners=new Map,this.ready=!1,this.destroyed=!1,this.readyTimer=null,this.popup=null,this.popupPollTimer=null,this.popupOrderId=null,this.popupMessageHandler=null,this.handleMessage=t=>{if(this.destroyed||t.origin!==this.widgetOrigin||t.source!==this.iframe.contentWindow)return;let r=n(t.data);r&&(e(r,`tf:ready`)?this.handleReady(r.payload.version,r.payload.protocolVersion):e(r,`tf:signRequest`)?this.handleSignRequest(r.payload.requestId,r.payload.action,r.payload.timeoutMs):e(r,`tf:connectWallet`)?this.handleConnectWallet(r.payload.chainType):e(r,`tf:disconnectWallet`)?this.handleDisconnectWallet():e(r,`tf:event`)?this.handleWidgetEvent(r.payload.name,r.payload.data):e(r,`tf:resize`)?this.handleResize(r.payload.height):e(r,`tf:preOpenPopup`)?this.handlePreOpenPopup():e(r,`tf:navigatePopup`)?this.navigatePopup(r.payload.url,r.payload.orderId):e(r,`tf:closeFiatPopup`)&&this.handleCloseFiatPopup(r.payload.orderId))},this.options=t,this.wallet=t.wallet,typeof t.container==`string`){let e=document.querySelector(t.container);if(!e&&!t.iframe)throw Error(`TokenFlightBridge: container "${t.container}" not found`);this.container=e??document.body}else this.container=t.container;let r=t.iframeSrc??a,i=typeof window<`u`?window.location.href:void 0;this.widgetOrigin=new URL(r,i).origin,t.iframe?(this.iframe=t.iframe,this.ownsIframe=!1,this.iframe.getAttribute(`src`)!==r&&(this.iframe.src=r)):(this.iframe=document.createElement(`iframe`),this.ownsIframe=!0,this.iframe.src=r,this.iframe.style.display=`block`,this.iframe.style.width=`100%`,this.iframe.style.height=`660px`,this.iframe.style.minWidth=`375px`,this.iframe.style.colorScheme=`normal`,this.iframe.style.border=`0`,this.iframe.style.background=`transparent`,this.iframe.setAttribute(`allow`,`camera;microphone;payment;clipboard-write`),this.iframe.setAttribute(`title`,`TokenFlight Widget`),this.container.appendChild(this.iframe)),window.addEventListener(`message`,this.handleMessage),this.walletHandler=e=>{this.sendWalletState(e.type)},this.subscribeWalletEvents();let s=t.readyTimeout??o;this.readyTimer=setTimeout(()=>{!this.ready&&!this.destroyed&&t.onLoadError?.(Error(`TokenFlightBridge: widget did not send tf:ready within timeout`))},s)}setConfig(e){this.postToIframe(t(`setConfig`,c(e)))}setStyle(e){this.postToIframe(t(`setStyle`,e))}setWallet(e){this.unsubscribeWalletEvents(),this.wallet=e,this.subscribeWalletEvents(),this.sendWalletState()}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){this.listeners.get(e)?.delete(t)}destroy(){this.destroyed||(this.destroyed=!0,this.readyTimer&&(clearTimeout(this.readyTimer),this.readyTimer=null),window.removeEventListener(`message`,this.handleMessage),this.unsubscribeWalletEvents(),this.closePopup(),this.ownsIframe&&this.iframe.remove(),this.listeners.clear())}async handleReady(e,n){if(n!==1){this.options.onLoadError?.(Error(`TokenFlightBridge: protocol version mismatch (bridge=1, widget=${n})`));return}this.ready=!0,this.readyTimer&&(clearTimeout(this.readyTimer),this.readyTimer=null);let r=this.wallet?.isConnected()??!1,i=null;if(r&&this.wallet)try{i=await this.wallet.getAddress()}catch{}this.postToIframe(t(`init`,{config:c(this.options.config),style:this.options.style,walletAddress:i,connected:r})),this.options.onReady?.(e),this.emit(`ready`,{version:e})}async handleSignRequest(e,n,i){if(!this.wallet){this.postToIframe(t(`signResult`,{requestId:e,error:{code:`ADAPTER_ERROR`,message:`No wallet adapter configured`}}));return}try{let r=await this.wallet.executeWalletAction(n);this.postToIframe(t(`signResult`,{requestId:e,result:r}))}catch(n){this.postToIframe(t(`signResult`,{requestId:e,error:r(n)}))}}async handleConnectWallet(e){if(this.wallet)try{await this.wallet.connect(e)}catch{}}async handleDisconnectWallet(){if(this.wallet)try{await this.wallet.disconnect()}catch{}}handleWidgetEvent(e,t){let n=u[e];n&&this.emit(n,t)}handleResize(e){this.iframe.style.height=`${e}px`,this.emit(`resize`,{height:e})}handlePreOpenPopup(){this.closePopup(),this.popup=window.open(`about:blank`,`tf-payment`,`width=500,height=700`)}navigatePopup(e,n){if(!this.popup||this.popup.closed){this.postToIframe(t(`fiatPopupBlocked`,{orderId:n}));return}try{let r=new URL(e);if(r.protocol!==`https:`&&r.protocol!==`http:`){this.postToIframe(t(`fiatPopupBlocked`,{orderId:n}));return}}catch{this.postToIframe(t(`fiatPopupBlocked`,{orderId:n}));return}this.popup.location.href=e,this.popupOrderId=n,this.installPopupMessageHandler(),this.popupPollTimer=setInterval(()=>{this.popup?.closed&&(this.closePopup(),this.postToIframe(t(`fiatPopupClosed`,{orderId:this.popupOrderId??n})),this.popupOrderId=null)},s)}installPopupMessageHandler(){if(this.popupMessageHandler)return;let e,n=this.options.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`;try{e=new URL(n).origin}catch{return}let r=new Set([`widget_ready`,`order_completed`,`order_failed`,`widget_close`]);this.popupMessageHandler=n=>{if(this.destroyed||n.origin!==e)return;let i=n.data;if(!i||i.type!==`FIAT_WIDGET_EVENT`||typeof i.event!=`string`||!r.has(i.event))return;let a=this.popupOrderId;a&&(typeof i.orderId==`string`&&i.orderId!==a||this.postToIframe(t(`fiatProviderEvent`,{orderId:a,event:i.event,provider:typeof i.provider==`string`?i.provider:void 0,data:i.data??void 0})))},window.addEventListener(`message`,this.popupMessageHandler)}closePopup(){this.popupPollTimer&&(clearInterval(this.popupPollTimer),this.popupPollTimer=null),this.popupMessageHandler&&(window.removeEventListener(`message`,this.popupMessageHandler),this.popupMessageHandler=null),this.popup&&!this.popup.closed&&this.popup.close(),this.popup=null}handleCloseFiatPopup(e){if(e===null){if(this.popupOrderId)return;this.closePopup();return}this.popupOrderId&&this.popupOrderId!==e||(this.closePopup(),this.popupOrderId=null)}subscribeWalletEvents(){if(this.wallet)for(let e of i.WALLET_EVENTS)this.wallet.on(e,this.walletHandler)}unsubscribeWalletEvents(){if(this.wallet)for(let e of i.WALLET_EVENTS)this.wallet.off(e,this.walletHandler)}async sendWalletState(e){if(!this.wallet)return;let n=this.wallet.isConnected(),r=null;if(n)try{r=await this.wallet.getAddress()}catch{}this.postToIframe(t(`walletState`,{connected:n,address:r,event:e}))}postToIframe(e){this.destroyed||this.iframe.contentWindow?.postMessage(e,this.widgetOrigin)}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of n)try{e(t)}catch{}}};i=l,i.WALLET_EVENTS=[`connect`,`disconnect`,`chainChanged`,`accountsChanged`];var u={swapComplete:`swapComplete`,error:`error`,fiatOrderCreated:`fiatOrderCreated`,fiatOrderCompleted:`fiatOrderCompleted`};function d(e){return new l(e)}export{d as n,l as t};
|
package/dist/bridge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./protocol-B7S8LSlJ.js";import{n as c,t as l}from"./bridge-
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./protocol-B7S8LSlJ.js";import{n as c,t as l}from"./bridge-B12bx0Ea.js";import{i as u,n as d,r as f,t as p}from"./iframe-receiver-i4RfQGg2.js";export{u as IframeBridgeWalletAdapter,p as IframeReceiver,t as TF_PROTOCOL_VERSION,l as TokenFlightBridge,s as consumeRequestId,r as createMessage,a as createRequestId,c as createTokenFlightBridge,n as deserializeError,d as getHostOrigin,f as isIframeMode,e as isMessageType,i as parseMessage,o as serializeError};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"./classPrivateFieldSet2-DmR3eaHe.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 i=new a(e,t),o=r(L,i,U).call(i,async()=>{if(typeof n(N,i).timeout==`number`&&n(N,i).timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${v}`);await Promise.resolve();let e=await r(L,i,be).call(i);for(let t of n(N,i).hooks.afterResponse){let a=r(L,i,B).call(i,e.clone()),o;try{o=await t(i.request,r(L,i,W).call(i),a,{retryCount:n(j,i)})}catch(t){throw r(L,i,H).call(i,a),r(L,i,H).call(i,e),t}if(o instanceof b)throw r(L,i,H).call(i,a),r(L,i,H).call(i,e),new d(o.options);let s=o instanceof globalThis.Response?o:e;a!==s&&r(L,i,H).call(i,a),e!==s&&r(L,i,H).call(i,e),e=s}if(r(L,i,B).call(i,e),!e.ok&&(typeof n(N,i).throwHttpErrors==`function`?n(N,i).throwHttpErrors(e.status):n(N,i).throwHttpErrors)){let t=new l(e,i.request,r(L,i,W).call(i));for(let e of n(N,i).hooks.beforeError)t=await e(t,{retryCount:n(j,i)});throw t}if(n(N,i).onDownloadProgress){if(typeof n(N,i).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 r(L,i,H).call(i,e),se(t,n(N,i).onDownloadProgress)}return e}).finally(()=>{let e=n(P,i);r(L,i,V).call(i,e?.body??void 0),r(L,i,V).call(i,i.request.body??void 0)});for(let[e,n]of Object.entries(ee))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(o[e]=async()=>{i.request.headers.set(`accept`,i.request.headers.get(`accept`)||n);let r=await o;if(e===`json`){if(r.status===204)return``;let e=await r.text();return e===``?``:t.parseJson?t.parseJson(e):JSON.parse(e)}return r[e]()});return o}constructor(o,s={}){if(e(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),i(M,this,o),i(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+=`/`),i(M,this,n(N,this).prefixUrl+n(M,this))}p&&m&&(i(F,this,n(N,this).signal??n(M,this).signal),i(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=r(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(e){var t;if(i(j,this,(t=n(j,this),t++,t)),n(j,this)>n(N,this).retry.limit)throw e;let a=e instanceof Error?e:new u(e);if(a instanceof d)return a.customDelay??r(L,this,z).call(this);if(!n(N,this).retry.methods.includes(this.request.method.toLowerCase()))throw e;if(n(N,this).retry.shouldRetry!==void 0){let t=await n(N,this).retry.shouldRetry({error:a,retryCount:n(j,this)});if(t===!1)throw e;if(t===!0)return r(L,this,z).call(this)}if(_e(e)&&!n(N,this).retry.retryOnTimeout)throw e;if(ge(e)){if(!n(N,this).retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&n(N,this).retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let r=n(N,this).retry.maxRetryAfter??e;return e<r?e:r}if(e.response.status===413)throw e}return r(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){r(L,this,V).call(this,e.body??void 0)}async function U(e){try{return await e()}catch(t){let i=Math.min(await r(L,this,ye).call(this,t),v);if(n(j,this)<1)throw t;if(await pe(i,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);r(L,this,G).call(this,e)}for(let e of n(N,this).hooks.beforeRetry){let i=await e({request:this.request,options:r(L,this,W).call(this),error:t,retryCount:n(j,this)});if(i instanceof globalThis.Request){r(L,this,G).call(this,i);break}if(i instanceof globalThis.Response)return i;if(i===y)return}return r(L,this,U).call(this,e)}}async function be(){n(A,this)?.signal.aborted&&(i(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,r(L,this,W).call(this),{retryCount:n(j,this)});if(t instanceof Response)return t;if(t instanceof globalThis.Request){r(L,this,G).call(this,t);break}}let e=me(this.request,n(N,this));return i(P,this,this.request),this.request=n(P,this).clone(),n(N,this).timeout===!1?n(N,this).fetch(n(P,this),e):fe(n(P,this),e,n(A,this),n(N,this))}function W(){if(!n(I,this)){let{hooks:e,...t}=n(N,this);i(I,this,Object.freeze(t))}return n(I,this)}function G(e){i(I,this,void 0),this.request=r(L,this,K).call(this,e)}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`}},$={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 Ce(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&&$[i]){let t=$[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 we(e){return xe.create({prefixUrl:e.baseUrl,timeout:e.timeout??15e3,retry:0,...e.fetch?{fetch:e.fetch}:{},headers:{"X-TF-SDK-Version":Ee(),...e.headers}})}function Te(e){return e.replace(/\/$/,``)}function Ee(){return`0.3.0`}async function De(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 Ce(n,r,{status:e.response.status,body:n})}throw new X(J.API_REQUEST_FAILED,`${t.failureMessage}: ${String(e)}`,e)}}async function*Oe(e){if(!e.ok){let t=``;try{t=await e.json()}catch{t=await e.text().catch(()=>``)}throw Ce(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{a as e,i as t,n,r,t as i}from"./classPrivateFieldSet2-DmR3eaHe.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 i=new a(e,t),o=r(L,i,U).call(i,async()=>{if(typeof n(N,i).timeout==`number`&&n(N,i).timeout>2147483647)throw RangeError(`The \`timeout\` option cannot be greater than ${v}`);await Promise.resolve();let e=await r(L,i,be).call(i);for(let t of n(N,i).hooks.afterResponse){let a=r(L,i,B).call(i,e.clone()),o;try{o=await t(i.request,r(L,i,W).call(i),a,{retryCount:n(j,i)})}catch(t){throw r(L,i,H).call(i,a),r(L,i,H).call(i,e),t}if(o instanceof b)throw r(L,i,H).call(i,a),r(L,i,H).call(i,e),new d(o.options);let s=o instanceof globalThis.Response?o:e;a!==s&&r(L,i,H).call(i,a),e!==s&&r(L,i,H).call(i,e),e=s}if(r(L,i,B).call(i,e),!e.ok&&(typeof n(N,i).throwHttpErrors==`function`?n(N,i).throwHttpErrors(e.status):n(N,i).throwHttpErrors)){let t=new l(e,i.request,r(L,i,W).call(i));for(let e of n(N,i).hooks.beforeError)t=await e(t,{retryCount:n(j,i)});throw t}if(n(N,i).onDownloadProgress){if(typeof n(N,i).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 r(L,i,H).call(i,e),se(t,n(N,i).onDownloadProgress)}return e}).finally(()=>{let e=n(P,i);r(L,i,V).call(i,e?.body??void 0),r(L,i,V).call(i,i.request.body??void 0)});for(let[e,n]of Object.entries(ee))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(o[e]=async()=>{i.request.headers.set(`accept`,i.request.headers.get(`accept`)||n);let r=await o;if(e===`json`){if(r.status===204)return``;let e=await r.text();return e===``?``:t.parseJson?t.parseJson(e):JSON.parse(e)}return r[e]()});return o}constructor(o,s={}){if(e(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),i(M,this,o),i(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+=`/`),i(M,this,n(N,this).prefixUrl+n(M,this))}p&&m&&(i(F,this,n(N,this).signal??n(M,this).signal),i(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=r(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(e){var t;if(i(j,this,(t=n(j,this),t++,t)),n(j,this)>n(N,this).retry.limit)throw e;let a=e instanceof Error?e:new u(e);if(a instanceof d)return a.customDelay??r(L,this,z).call(this);if(!n(N,this).retry.methods.includes(this.request.method.toLowerCase()))throw e;if(n(N,this).retry.shouldRetry!==void 0){let t=await n(N,this).retry.shouldRetry({error:a,retryCount:n(j,this)});if(t===!1)throw e;if(t===!0)return r(L,this,z).call(this)}if(_e(e)&&!n(N,this).retry.retryOnTimeout)throw e;if(ge(e)){if(!n(N,this).retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&n(N,this).retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let r=n(N,this).retry.maxRetryAfter??e;return e<r?e:r}if(e.response.status===413)throw e}return r(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){r(L,this,V).call(this,e.body??void 0)}async function U(e){try{return await e()}catch(t){let i=Math.min(await r(L,this,ye).call(this,t),v);if(n(j,this)<1)throw t;if(await pe(i,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);r(L,this,G).call(this,e)}for(let e of n(N,this).hooks.beforeRetry){let i=await e({request:this.request,options:r(L,this,W).call(this),error:t,retryCount:n(j,this)});if(i instanceof globalThis.Request){r(L,this,G).call(this,i);break}if(i instanceof globalThis.Response)return i;if(i===y)return}return r(L,this,U).call(this,e)}}async function be(){n(A,this)?.signal.aborted&&(i(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,r(L,this,W).call(this),{retryCount:n(j,this)});if(t instanceof Response)return t;if(t instanceof globalThis.Request){r(L,this,G).call(this,t);break}}let e=me(this.request,n(N,this));return i(P,this,this.request),this.request=n(P,this).clone(),n(N,this).timeout===!1?n(N,this).fetch(n(P,this),e):fe(n(P,this),e,n(A,this),n(N,this))}function W(){if(!n(I,this)){let{hooks:e,...t}=n(N,this);i(I,this,Object.freeze(t))}return n(I,this)}function G(e){i(I,this,void 0),this.request=r(L,this,K).call(this,e)}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`}},$={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 Ce(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&&$[i]){let t=$[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 we(e){return xe.create({prefixUrl:e.baseUrl,timeout:e.timeout??15e3,retry:0,...e.fetch?{fetch:e.fetch}:{},headers:{"X-TF-SDK-Version":Ee(),...e.headers}})}function Te(e){return e.replace(/\/$/,``)}function Ee(){return`0.3.1-rc.0`}async function De(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 Ce(n,r,{status:e.response.status,body:n})}throw new X(J.API_REQUEST_FAILED,`${t.failureMessage}: ${String(e)}`,e)}}async function*Oe(e){if(!e.ok){let t=``;try{t=await e.json()}catch{t=await e.text().catch(()=>``)}throw Ce(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 ke(e)),a=r.indexOf(`
|
|
3
3
|
`)}if(i){let e=r.trim();e&&(yield ke(e));return}}}finally{t.releaseLock()}}function ke(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 Ae=`https://api.hyperstream.dev`,je=2e3,Me=500,Ne=5e3,Pe=class{constructor(e){this.baseUrl=Te(e.baseUrl),this.ky=we({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 De(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*Oe(await this.fetchImpl(`${this.baseUrl}/v1/quotes?mode=stream`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-TF-SDK-Version":Ee(),...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(Me,t.intervalMs??je);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),Fe.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,Ne)}};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())}},Fe=[`filled`,`refunded`,`failed`],Ie=500,Le=700,Re=2e3,ze=500,Be=5e3;function Ve(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 He(e){return e===`completed`?`completed`:e===`canceled`?`canceled`:`failed`}function Ue(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??Ie,i=n.popup?.height??Le,a=n.minPollIntervalMs??Re,o=window.open(t.wrapperUrl,`tf-fiat-${t.orderId}`,Ve(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`)},ze);let g=async()=>{if(!c)try{let r=await e.getStatus(t.orderId);if(c)return;if(n.onStatus?.(r),r.polling.isTerminal){p(He(r.status));return}let i=Math.max(a,r.polling.suggestedIntervalMs);u=setTimeout(g,i)}catch{c||(u=setTimeout(g,Be))}};g()})}var We=`https://fiat.hyperstream.dev`,Ge=class{constructor(e){this.baseUrl=Te(e.baseUrl),this.ky=we({baseUrl:this.baseUrl,timeout:e.timeout,fetch:e.fetch,headers:e.headers})}request(e){return De(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 Ue(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 Ke(e,t){if(e)return`${e.replace(/\/$/,``)}/v1/chain/${t}/icon`}var qe=new Set([`completed`,`failed`,`canceled`]);export{We as a,Y as c,c as d,Fe as i,Ae as l,qe as n,Ge as o,Pe as r,X as s,Ke as t,J as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>`Pay ${e.amount}`,ee=`Waiting for confirmation...`,te=`View on Explorer`,t=`Delivery unsuccessful`,n=`Select Fiat Provider`,r=`Enter amount`,i=e=>`${e.count} more`,a=`Order expired`,o=e=>`Pay ${e.amount} via ${e.provider}`,s=`Copied`,c=`We'll find the best rate for you`,l=e=>`Continue via ${e.provider}`,u=`Try selecting a different chain or search for a specific token`,d=`Coming soon`,f=e=>`via ${e.provider}`,p=e=>`${e.reserve} ${e.symbol} reserved for network fees`,m=`Search results`,h=`Tokens delivered to your wallet`,g=`You pay`,_=`Your tokens have been delivered`,v=e=>`≈ $${e.formatUsd}`,y=`Recipient Address`,b=`Confirm`,x=`Connect your wallet to see payment options`,S=`No tokens found`,C=`Connect wallet or enter an address to get a quote`,w=`Confirm in your wallet...`,T=`Refund tx`,E=e=>`Buy ${e.amt} ${e.sym}`,D=`Exchange`,O=e=>`${e.reserve} ${e.symbol} reserved for network fees (live estimate)`,k=`Swapping via DEX...`,A=`Transaction failed — Retry`,j=`No filler accepted the order`,M=`Back`,ne=`Pay`,N=`Executing...`,P=`Select destination token`,F=e=>`Filled on ${e.chain}`,I=`Payment confirmed`,re=`Buy`,L=`Close`,R=`Payment QR code`,z=`No offer available`,B=`Refund in progress`,V=e=>`Deposit on ${e.chain}`,H=`Route`,U=`Crypto`,W=`Signed in wallet`,G=`Order failed`,K=`Enter amount to get started`,q=`Recipient`,J=e=>`≈ $${e.addThousandsSeparator}`,Y=`Buy with credit or debit card`,X=`View All Chains`,Z=`Swap`,Q=`Sender`,ie=`Processing your order...`,ae=`Select payment token`,oe=e=>`Via ${e.provider}`,se=`Quote details`,ce=`Total fee`,le=`Paid`,ue=`Try Again`,de=`Review Swap`,fe=`Provider filling your order`,pe=`Swapping tokens`,me=`Your tokens`,he=e=>`Returning tokens on ${e.chain}`,ge=`Card`,_e=`Swap tokens`,ve=`Copy error`,ye=`Fiat payment`,be=`Processing...`,xe=`Purchase failed`,Se=`New Purchase`,Ce=`Not enough native left for gas — try MAX`,we=`This browser cannot open the payment window. Scan the QR code or copy the link to continue.`,Te=`Pay with credit or debit card`,Ee=`Confirmed on-chain`,$=`Sign in wallet`,De=`From`,Oe=`Required to receive your tokens`,ke=`MAX`,Ae=`Fee`,je=`Could not be completed`,Me=`Copy link`,Ne=`Top tokens`,Pe=`Fill tx`,Fe=e=>`Delivered in ${e.seconds}s`,Ie=`Pay with`,Le=`Swap Successful`,Re=`Tokens delivered`,ze=`Receive`,Be=`Min`,Ve=`Search by name or address`,He=e=>`~${e.value}s`,Ue=`0`,We=`Provider`,Ge=`Est. time`,Ke=`Insufficient balance`,qe=`Invalid address for this chain`,Je=`Enter destination address`,Ye=`No tokens available`,Xe=`Open payment link`,Ze=`Max`,Qe=`Transfer tx`,$e=`Confirm Swap`,et=`This token is not directly available for card purchase. We buy USDC first, then swap it to your desired token automatically.`,tt=`Quote Failed`,nt=e=>`Compare ${e.count} more providers`,rt=e=>`Buy ${e.arg0} directly`,it=`Payment Failed`,at=e=>`on ${e.chain}`,ot=e=>`~${e.value}m`,st=`No routes available`,ct=`Tokens Landed!`,lt=`Awaiting payment`,ut=e=>`Routed through ${e.token} for the best rate`,dt=`New Swap`,ft=`Enter recipient address`,pt=`Wallet doesn't match source chain`,mt=`View`,ht=`BEST RATE`,gt=`Your order could not be completed.`,_t=e=>`Delivering ${e.symbol} to your wallet...`,vt=`Your funds have been returned to your wallet.`,yt=`View quote details`,bt=`Signature submitted`,xt=`Deposit tx`,St=`Connect Wallet`,Ct=`Pay with tokens from your wallet`,wt=`Cancel order`,Tt=`You receive`,Et=`Purchase Complete`,Dt=`Selected token is unavailable for this purchase`,Ot=`Enter Recipient Address`,kt=`Recommended`,At=`Wallet account`,jt=e=>`Balance: ${e.fromBalance}`,Mt=`Purchase complete`,Nt=`Retry`,Pt=`Select token`,Ft={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"156lkep":p,"15bw477":m,"1685rko":h,"17kq51m":g,"17wtaao":_,"188897k":v,"18cmny0":y,"18tbqwf":b,"18y1lrp":x,"19is1h8":S,"19ne1ha":C,"1bze7sg":w,"1c5n7ll":T,"1cei180":E,"1dyojgg":D,"1fz9lzi":O,"1g8tdk7":k,"1hb73om":A,"1hdpo6q":j,"1hzmxtu":M,"1i7coq1":`Pay`,"1ih47b3":N,"1ix1b7w":P,"1ixbbo7":F,"1jhuo24":I,"1ka8utn":`Buy`,"1l0xxoj":L,"1ndiott":R,"1ne9nkz":z,"1nhkl7x":B,"1nn0owb":V,"1nvxkfy":H,"1o1b4a8":U,"1o4ofyx":W,"1ok4m5g":G,"1olegnl":K,"1oncz6g":q,"1ovj1tk":J,"1q45kup":Y,"1qbiehv":X,"1rkfalq":Z,"1rnxx1g":Q,"1spu5st":ie,"1t0r88u":ae,"1t86tnu":oe,"1tn6f91":se,"1viukn9":ce,"1w0n607":le,"1w68n16":ue,"1x5xdes":de,"1y28pgi":fe,"1y6hn5o":pe,"1yijk6g":me,"27fhcv":he,"2b8ghr":ge,"2eikro":_e,"2mzna2":ve,"2zh3gr":ye,"344av8":be,"3pklqf":xe,"3u5vqs":Se,"43sibf":Ce,"53b4uu":we,"6c0jc7":Te,"6c5l2f":Ee,"6gkge0":$,"6s9hn9":De,"7m2ht3":Oe,"7v6g6x":`MAX`,"9l4mg3":`Fee`,"9p7amh":je,"9zccf0":Me,bdctly:Ne,bdo3n8:Pe,biwlqk:Fe,cgzgvn:Ie,cjn1xs:Le,cnwfg3:Re,cwk7r6:ze,cx9lh3:`Min`,dizog6:Ve,ek03j3:He,epw9f3:`0`,evz7q4:We,f45rwo:Ge,fcy4ey:Ke,fo0vw0:qe,fpand1:Je,g7pjpv:Ye,gnnylt:Xe,gtvgs9:`Max`,hzq69q:Qe,ibrnk6:$e,ifug2i:et,jf8ts4:tt,jmpbi6:nt,jnzipx:rt,jssk7y:it,k47stp:at,knrcsh:ot,ln9xiv:st,mnlddk:ct,n9zkql:lt,ofi1rq:ut,pmqvh0:dt,pom1h2:ft,q4mqcd:pt,q5w460:mt,r7v9s7:ht,rvctng:gt,sykid7:_t,t1rvqg:vt,tbygoy:yt,tgp8yw:bt,tjg3i3:xt,u61kge:St,udneg1:Ct,uu5nf7:wt,va18uh:Tt,vum0cd:Et,wuxjl9:Dt,wx5bee:Ot,xel5qk:kt,xphk5n:At,y6jqu9:jt,yhtv6l:Mt,zkouah:Nt,zz4mrw:Pt};export{$e as _100907z,Tt as _108j3sk,le as _10lgc56,Q as _10n9ta8,g as _113vzpe,ft as _11ncipg,U as _11p3b1r,st as _12qyh2x,p as _132e19v,B as _13ym6k2,ge as _14oyo32,Ne as _15iyda3,C as _15vbpgm,we as _15xhlup,s as _16j2pbi,et as _16ln1wz,Le as _16pzx0g,je as _16rump9,P as _17g2rjk,v as _18346vt,re as _1982g2x,At as _1biskvr,k as _1bjtgx1,Re as _1cmz8k7,Ct as _1cpadi9,J as _1d7sodl,pt as _1e023il,u as _1e5aqjt,V as _1ea99j0,te as _1f4czmp,Ee as _1f8nqa3,de as _1f8umlr,q as _1fe46d3,Oe as _1fikhaa,dt as _1fu9qvd,D as _1g7ofg0,Ie as _1gfjrn0,Fe as _1gma9hv,O as _1h09em8,he as _1hs819x,bt as _1ht75o0,t as _1i8i0au,nt as _1i9sfkh,L as _1ib6ekl,Y as _1ievltk,ht as _1in1gel,K as _1in9ocp,Je as _1ju6xlj,E as _1jvje3y,Ae as _1kd3yrp,M as _1kez60s,pe as _1krtsvx,ut as _1kvlpuf,Te as _1l1rqi2,Z as _1l2nmmx,ne as _1lra4kg,yt as _1mmcyfz,Dt as _1n1igys,A as _1na1vy4,ve as _1nd7gbf,o as _1nwhws6,He as _1o0vi1j,Qe as _1o2h7a2,l as _1o8feo7,Ye as _1om32zr,T as _1oqs23j,Me as _1ovibcu,Nt as _1popw3r,ee as _1qamgmj,H as _1rggu8s,ot as _1s54fdc,c as _1s9ryeq,$ as _1t3gki9,i as _1ulsa90,h as _1urf8wf,n as _1w2bswr,F as _1wwy4yj,e as _1wx2fw2,it as _1x1qus,_t as _1y7hba4,S as _1yv1ajq,Ce as _2fxyxc,Ot as _3mtvnb,We as _3w8t28,ae as _41y3qp,X as _454sub,mt as _49235i,G as _4itr6p,W as _4opuqb,ye as _5af8qp,b as _5r87wo,x as _78b61s,De as _8edkty,Pe as _a5vz6z,Ve as _al7a0k,ke as _bii6w9,Ue as _cnghfj,N as _czpegb,xt as _d7bf51,tt as _doc1yy,wt as _ftpidr,z as _g3pfjv,lt as _gkmqsa,f as _hyiyqa,d as _i9ury1,y as _ide9vv,St as _ig1w2,jt as _jpt8np,ce as _kmeu9o,fe as _kqdlbv,kt as _l5s0fl,rt as _l78r94,me as _l800fy,_ as _ly147p,ze as _mdvri5,Xe as _nb1pp5,ie as _np8jou,R as _nq4mpy,a as _nrzzox,at as _o3um2w,I as _oj2fr8,Et as _p5ybee,j as _pqml54,xe as _pr6lte,be as _q0rsrj,vt as _qm85b2,m as _r3yix2,w as _sf0mgy,Pt as _si8n6l,Ze as _swoaip,Mt as _t0vnn4,oe as _t91lwj,qe as _ty2nen,gt as _u7tj7p,Ge as _uc0jju,r as _uu4paz,ct as _vogk37,se as _wa8i8c,ue as _xavgbs,_e as _xkdtbf,Se as _ystooe,Be as _z6jr7i,Ke as _zzusn5,Ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,u as t}from"./dist-
|
|
1
|
+
import{c as e,u as t}from"./dist-CpC2fQqU.js";var n={...t,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`},r={[n.INVALID_CONFIG]:`Invalid configuration provided`,[n.INVALID_TOKEN_IDENTIFIER]:`Invalid token identifier format`,[n.INVALID_AMOUNT]:`Invalid amount value`,[n.WALLET_CONNECTION_FAILED]:`Failed to connect wallet`,[n.WALLET_ACTION_FAILED]:`Wallet action failed`,[n.TRANSACTION_FAILED]:`Transaction failed`,[n.ELEMENT_NOT_FOUND]:`Target DOM element not found`};({...e,...r});export{n as t};
|
package/dist/iframe-entry.js
CHANGED
|
@@ -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-DqvEpdeb.js";import{
|
|
1
|
+
import{S as e,m as t,o as n,p as r,u as i,v as a}from"./solid-DqvEpdeb.js";import{d as o,g as s,i as c,r as l,u}from"./shared.module-Bk8Fpur5.js";import{i as d,o as f,r as p,t as m}from"./theme-B6YtpkRW.js";import{n as h,t as g}from"./widget-zSdkT7wD.js";import{n as _,r as v,t as y}from"./iframe-receiver-i4RfQGg2.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=s(`<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 <tokenflight-iframe-widget>`),C=s(`<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??l,r=o(()=>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;
|
|
@@ -26,4 +26,4 @@ import{S as e,m as t,o as n,p as r,u as i,v as a}from"./solid-DqvEpdeb.js";impor
|
|
|
26
26
|
[part="container"] {
|
|
27
27
|
height: 100dvh !important;
|
|
28
28
|
}
|
|
29
|
-
`,document.head.appendChild(e)}function k(e){x(e)}function A(){let e={};if(typeof location>`u`)return e;let t=new URLSearchParams(location.search),n=e=>t.get(e)??void 0;n(`api-endpoint`)&&(e.apiEndpoint=n(`api-endpoint`)),n(`fiat-api-endpoint`)&&(e.fiatApiEndpoint=n(`fiat-api-endpoint`));let r=n(`theme`);(r===`dark`||r===`light`||r===`auto`)&&(e.theme=r),n(`locale`)&&(e.locale=n(`locale`)),n(`from-token`)&&(e.fromToken=n(`from-token`)),n(`to-token`)&&(e.toToken=n(`to-token`));let i=n(`trade-type`);(i===`EXACT_INPUT`||i===`EXACT_OUTPUT`)&&(e.tradeType=i);let a=n(`quote-card`);(a===`hidden`||a===`visible`)&&(e.quoteCard=a),n(`amount`)&&(e.amount=n(`amount`)),n(`recipient`)&&(e.recipient=n(`recipient`));let o=n(`methods`);return o&&(e.methods=o.split(`,`).map(e=>e.trim())),n(`title-text`)&&(e.titleText=n(`title-text`)),t.has(`hide-title`)&&(e.hideTitle=!0),t.has(`hide-powered-by`)&&(e.hidePoweredBy=!0),e}function j(){return S()}function M(e){if(!e)return;let t=document.documentElement;for(let[n,r]of Object.entries(e))n.startsWith(`--`)&&t.style.setProperty(n,r)}function N(e){let t=document.documentElement;for(let[n,r]of Object.entries(e))t.style.setProperty(n,r)}function P(o){let[
|
|
29
|
+
`,document.head.appendChild(e)}function k(e){x(e)}function A(){let e={};if(typeof location>`u`)return e;let t=new URLSearchParams(location.search),n=e=>t.get(e)??void 0;n(`api-endpoint`)&&(e.apiEndpoint=n(`api-endpoint`)),n(`fiat-api-endpoint`)&&(e.fiatApiEndpoint=n(`fiat-api-endpoint`));let r=n(`theme`);(r===`dark`||r===`light`||r===`auto`)&&(e.theme=r),n(`locale`)&&(e.locale=n(`locale`)),n(`from-token`)&&(e.fromToken=n(`from-token`)),n(`to-token`)&&(e.toToken=n(`to-token`));let i=n(`trade-type`);(i===`EXACT_INPUT`||i===`EXACT_OUTPUT`)&&(e.tradeType=i);let a=n(`quote-card`);(a===`hidden`||a===`visible`)&&(e.quoteCard=a),n(`amount`)&&(e.amount=n(`amount`)),n(`recipient`)&&(e.recipient=n(`recipient`));let o=n(`methods`);return o&&(e.methods=o.split(`,`).map(e=>e.trim())),n(`title-text`)&&(e.titleText=n(`title-text`)),t.has(`hide-title`)&&(e.hideTitle=!0),t.has(`hide-powered-by`)&&(e.hidePoweredBy=!0),e}function j(){return S()}function M(e){if(!e)return;let t=document.documentElement;for(let[n,r]of Object.entries(e))n.startsWith(`--`)&&t.style.setProperty(n,r)}function N(e){let t=document.documentElement;for(let[n,r]of Object.entries(e))t.style.setProperty(n,r)}function P(o){let[s,l]=a(null),[g,b]=a(null),[x,S]=a(!1),w=t(()=>{let e=g();if(e)return{onSwapSuccess:t=>e.emitEvent(`swapComplete`,t),onDepositSuccess:t=>e.emitEvent(`swapComplete`,t),onSwapError:t=>e.emitEvent(`error`,t),onDepositError:t=>e.emitEvent(`error`,t),onFiatOrderCreated:t=>e.emitEvent(`fiatOrderCreated`,t),onFiatOrderCompleted:t=>e.emitEvent(`fiatOrderCompleted`,t)}});queueMicrotask(()=>{if(!v()){O(),S(!0),l(A());return}let e=_();if(!e)return;let t=new y(e,{onInit:(e,t)=>{l(e),M(t?.vars)},onConfigUpdate:e=>{l({...s()??{},...e})},onStyleUpdate:e=>{M(e.vars)}});b(t),k(t)}),e(()=>g()?.destroy());let T=null;r(()=>{let e=s();if(!e)return;let t=e.theme??`light`;N(d(t)),e.customColors&&m(document.documentElement,e.customColors),document.body.className=t===`dark`?`dark`:`light`,T?.(),T=null,t===`auto`&&(T=f(t=>{N(t),e.customColors&&m(document.documentElement,e.customColors),document.body.className=t===p?`dark`:`light`}))}),e(()=>T?.());let E=t(()=>s()||null);return i(c,{get client(){return o.queryClient},get children(){return[u(()=>u(()=>!!x())()?i(j,{}):null),i(n,{get when(){return E()},get fallback(){return C()},children:e=>i(h,{get config(){return e()},get walletAdapter(){return g()?.walletAdapter},get callbacks(){return w()}})})]}})}export{w as mountIframeReceiver};
|
package/dist/iframe.d.ts
CHANGED
|
@@ -384,7 +384,7 @@ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
|
|
|
384
384
|
* Default: false — presetting `recipient` locks the badge.
|
|
385
385
|
*/
|
|
386
386
|
recipientEditable?: boolean;
|
|
387
|
-
/** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
|
|
387
|
+
/** Address the filler or card settlement should refund to if the fill fails (sent as `refundTo` on quote/order requests). */
|
|
388
388
|
refundTo?: string;
|
|
389
389
|
/** Payment methods to offer (default: ["crypto"]) */
|
|
390
390
|
methods?: SwapPayMethod[];
|
package/dist/iframe.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,b as t}from"./register-defaults-BOb3wgfD.js";import{a as n,n as r,o as i,r as a}from"./theme-B6YtpkRW.js";import{t as o}from"./bridge-
|
|
1
|
+
import{S as e,b as t}from"./register-defaults-BOb3wgfD.js";import{a as n,n as r,o as i,r as a}from"./theme-B6YtpkRW.js";import{t as o}from"./bridge-B12bx0Ea.js";function s(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 c(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function l(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function u(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{}}var d=`tokenflight-iframe-widget`,f=`api-endpoint.fiat-api-endpoint.to-token.from-token.trade-type.amount.recipient.icon.lock-from-token.lock-to-token.fiat-currency.methods.default-pay-method.from-tokens.to-tokens.title-text.title-image.theme.locale.hide-title.hide-powered-by.hide-provider.quote-card.no-background.no-border.recipient-editable.refund-to.rpc-overrides.referrer.referrer-fee-bps`.split(`.`),p={"api-endpoint":`apiEndpoint`,"fiat-api-endpoint":`fiatApiEndpoint`,"to-token":`toToken`,"from-token":`fromToken`,"trade-type":`tradeType`,"lock-from-token":`lockFromToken`,"lock-to-token":`lockToToken`,"fiat-currency":`fiatCurrency`,"default-pay-method":`defaultPayMethod`,"from-tokens":`fromTokens`,"to-tokens":`toTokens`,"title-text":`titleText`,"title-image":`titleImageUrl`,"hide-title":`hideTitle`,"hide-powered-by":`hidePoweredBy`,"hide-provider":`hideProvider`,"quote-card":`quoteCard`,"no-background":`noBackground`,"no-border":`noBorder`,"recipient-editable":`recipientEditable`,"refund-to":`refundTo`,"rpc-overrides":`rpcOverrides`,"referrer-fee-bps":`referrerFeeBps`};function m(e,n){if(n!==null)switch(e){case`to-token`:return s(n);case`from-tokens`:case`to-tokens`:return c(n);case`methods`:return l(n);case`quote-card`:return n===`hidden`||n===`visible`?n:void 0;case`rpc-overrides`:return u(n);case`referrer-fee-bps`:{let e=Number(n);return Number.isNaN(e)?void 0:e}case`lock-from-token`:case`lock-to-token`:case`hide-title`:case`hide-powered-by`:case`hide-provider`:case`no-background`:case`no-border`:case`recipient-editable`:return t(n)??(n===``?!0:void 0);default:return n||void 0}}function h(t,n){let r=t.getAttribute(`referrer`)||n.referrer,i=t.getAttribute(`referrer-fee-bps`);return e(r,i!==null&&i!==``?Number(i):n.referrerFeeBps,t)}function g(e,n){let r=t=>e.getAttribute(t),i=h(e,n);return{apiEndpoint:r(`api-endpoint`)||n.apiEndpoint||void 0,fiatApiEndpoint:r(`fiat-api-endpoint`)||n.fiatApiEndpoint||void 0,toToken:s(r(`to-token`)??``)||void 0,fromToken:r(`from-token`)||void 0,tradeType:r(`trade-type`)||void 0,amount:r(`amount`)||void 0,recipient:r(`recipient`)||void 0,icon:r(`icon`)||void 0,recipientEditable:e.hasAttribute(`recipient-editable`)?t(r(`recipient-editable`))??!0:void 0,refundTo:r(`refund-to`)||void 0,lockFromToken:e.hasAttribute(`lock-from-token`)?t(r(`lock-from-token`))??!0:void 0,lockToToken:e.hasAttribute(`lock-to-token`)?t(r(`lock-to-token`))??!0:void 0,fiatCurrency:r(`fiat-currency`)||void 0,methods:l(r(`methods`)??``)??n.methods,defaultPayMethod:r(`default-pay-method`)||void 0,quoteCard:r(`quote-card`)===`hidden`||r(`quote-card`)===`visible`?r(`quote-card`):void 0,fromTokens:c(r(`from-tokens`)??``),toTokens:c(r(`to-tokens`)??``),titleText:r(`title-text`)||void 0,titleImageUrl:r(`title-image`)||void 0,theme:r(`theme`)||n.theme||`light`,locale:r(`locale`)||n.locale||`en-US`,hideTitle:e.hasAttribute(`hide-title`)?t(r(`hide-title`))??!0:n.hideTitle,hidePoweredBy:e.hasAttribute(`hide-powered-by`)?t(r(`hide-powered-by`))??!0:n.hidePoweredBy,hideProvider:e.hasAttribute(`hide-provider`)?t(r(`hide-provider`))??!0:n.hideProvider,noBackground:e.hasAttribute(`no-background`)?t(r(`no-background`))??!0:n.noBackground,noBorder:e.hasAttribute(`no-border`)?t(r(`no-border`))??!0:n.noBorder,rpcOverrides:u(r(`rpc-overrides`)??``)??n.rpcOverrides,referrer:i.referrer,referrerFeeBps:i.referrerFeeBps}}var _=`
|
|
2
2
|
:host { display: block; }
|
|
3
3
|
.container {
|
|
4
4
|
position: relative;
|
|
@@ -15,6 +15,7 @@ import{S as e,b as t}from"./register-defaults-BOb3wgfD.js";import{a as n,n as r,
|
|
|
15
15
|
}
|
|
16
16
|
:host([no-background]) .container { background: transparent; }
|
|
17
17
|
:host([no-border]) .container { border: none; box-shadow: none; }
|
|
18
|
+
:host([no-background][no-border]) .container { border-radius: 0; }
|
|
18
19
|
.accent-line {
|
|
19
20
|
position: absolute;
|
|
20
21
|
inset-inline: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>`${e.amount} を支払う`,ee=`確認待ち...`,te=`エクスプローラーで表示`,t=`送達に失敗しました`,n=`法定通貨プロバイダーを選択`,r=`金額を入力`,i=e=>`他${e.count}件`,a=`注文が期限切れ`,o=e=>`${e.provider} で ${e.amount} を支払う`,s=`コピーしました`,c=`最適なレートをお探しします`,l=e=>`${e.provider}で続行`,u=`別のチェーンを選択するか、特定のトークンを検索してください`,d=`近日公開`,f=e=>`${e.provider}経由`,p=e=>`ネットワーク手数料用に ${e.reserve} ${e.symbol} を確保`,m=`検索結果`,h=`トークンがウォレットに送達されました`,g=`支払い`,_=`トークンが送達されました`,v=e=>`≈ $${e.formatUsd}`,y=`受取アドレス`,b=`確認`,x=`ウォレットを接続して支払いオプションを表示`,S=`トークンが見つかりません`,C=`ウォレットを接続するかアドレスを入力して見積もりを取得`,w=`ウォレットで確認してください...`,T=`返金トランザクション`,E=e=>`${e.amt} ${e.sym} を購入`,D=`交換`,O=e=>`ネットワーク手数料用に ${e.reserve} ${e.symbol} を確保 (リアルタイム見積もり)`,k=`DEXでスワップ中...`,A=`取引失敗 — 再試行`,j=`フィラーが注文を受け付けませんでした`,M=`戻る`,N=`支払い`,P=`実行中...`,F=`受取りトークンを選択`,I=e=>`${e.chain}で完了`,L=`支払い確認済み`,R=`購入`,z=`閉じる`,B=`支払い用QRコード`,V=`利用可能なオファーがありません`,H=`返金処理中`,U=e=>`${e.chain}への入金`,W=`ルート`,G=`暗号通貨`,K=`署名完了`,q=`注文が失敗`,J=`金額を入力して開始`,Y=`受取アドレス`,X=e=>`≈ $${e.addThousandsSeparator}`,Z=`クレジットカードまたはデビットカードで購入`,Q=`すべてのチェーンを表示`,ne=`スワップ`,re=`送信者`,ie=`注文を処理中...`,ae=`支払いトークンを選択`,oe=e=>`${e.provider}経由`,se=`見積もり詳細`,ce=`合計手数料`,le=`支払い済み`,ue=`再試行`,de=`スワップを確認`,fe=`プロバイダーが注文を処理中`,pe=`トークンをスワップ中`,me=`あなたのトークン`,he=e=>`${e.chain}でトークンを返還中`,ge=`カード`,_e=`トークンを交換`,ve=`エラーをコピー`,ye=`法定通貨支払い`,be=`処理中...`,xe=`購入失敗`,Se=`新しい購入`,Ce=`ガス代用のネイティブ通貨が不足しています — MAXをお試しください`,we=`このブラウザでは支払いウィンドウを開けません。QRコードをスキャンするか、リンクをコピーして続行してください。`,Te=`クレジットカードまたはデビットカードで支払う`,Ee=`オンチェーンで確認済み`,$=`ウォレットで署名`,De=`送金元`,Oe=`トークン受け取りに必要`,ke=`最大`,Ae=`手数料`,je=`完了できませんでした`,Me=`リンクをコピー`,Ne=`人気トークン`,Pe=`完了取引`,Fe=e=>`${e.seconds}秒で送達`,Ie=`支払い方法`,Le=`スワップ成功`,Re=`トークンが送達されました`,ze=`受取`,Be=`最低`,Ve=`名前またはアドレスで検索`,He=e=>`~${e.value}秒`,Ue=`0`,We=`プロバイダー`,Ge=`推定時間`,Ke=`残高不足`,qe=`このチェーンのアドレス形式が無効です`,Je=`宛先アドレスを入力`,Ye=`利用可能なトークンがありません`,Xe=`支払いリンクを開く`,Ze=`最高`,Qe=`送金トランザクション`,$e=`スワップを実行`,et=`このトークンはカードで直接購入できません。まず USDC を購入し、自動的にご希望のトークンに交換します。`,tt=`見積もり失敗`,nt=e=>`他${e.count}件のプロバイダーと比較`,rt=e=>`${e.arg0} を直接購入`,it=`支払い失敗`,at=e=>`${e.chain}上`,ot=e=>`~${e.value}分`,st=`利用可能なルートがありません`,ct=`トークンが到着しました!`,lt=`支払い待ち`,ut=e=>`最良レートのため${e.token}経由でルーティング`,dt=`新しいスワップ`,ft=`受取アドレスを入力`,pt=`ウォレットがソースチェーンと一致しません`,mt=`表示`,ht=`最良レート`,gt=`注文を完了できませんでした。`,_t=e=>`${e.symbol}をウォレットに送信中...`,vt=`資金がウォレットに返金されました。`,yt=`見積もり詳細を表示`,bt=`署名を提出しました`,xt=`入金取引`,St=`ウォレットを接続`,Ct=`ウォレットのトークンで支払う`,wt=`注文をキャンセル`,Tt=`受取り`,Et=`購入完了`,Dt=`選択したトークンは現在この購入には利用できません`,Ot=`受取アドレスを入力`,kt=`おすすめ`,At=`ウォレットアカウント`,jt=e=>`残高: ${e.fromBalance}`,Mt=`購入完了`,Nt=`リトライ`,Pt=`トークンを選択`,Ft={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"156lkep":p,"15bw477":m,"1685rko":h,"17kq51m":g,"17wtaao":_,"188897k":v,"18cmny0":y,"18tbqwf":b,"18y1lrp":x,"19is1h8":S,"19ne1ha":C,"1bze7sg":w,"1c5n7ll":T,"1cei180":E,"1dyojgg":D,"1fz9lzi":O,"1g8tdk7":k,"1hb73om":A,"1hdpo6q":j,"1hzmxtu":M,"1i7coq1":N,"1ih47b3":P,"1ix1b7w":F,"1ixbbo7":I,"1jhuo24":L,"1ka8utn":R,"1l0xxoj":z,"1ndiott":B,"1ne9nkz":V,"1nhkl7x":H,"1nn0owb":U,"1nvxkfy":W,"1o1b4a8":G,"1o4ofyx":K,"1ok4m5g":q,"1olegnl":J,"1oncz6g":Y,"1ovj1tk":X,"1q45kup":Z,"1qbiehv":Q,"1rkfalq":ne,"1rnxx1g":re,"1spu5st":ie,"1t0r88u":ae,"1t86tnu":oe,"1tn6f91":se,"1viukn9":ce,"1w0n607":le,"1w68n16":ue,"1x5xdes":de,"1y28pgi":fe,"1y6hn5o":pe,"1yijk6g":me,"27fhcv":he,"2b8ghr":ge,"2eikro":_e,"2mzna2":ve,"2zh3gr":ye,"344av8":be,"3pklqf":xe,"3u5vqs":Se,"43sibf":Ce,"53b4uu":we,"6c0jc7":Te,"6c5l2f":Ee,"6gkge0":$,"6s9hn9":De,"7m2ht3":Oe,"7v6g6x":ke,"9l4mg3":Ae,"9p7amh":je,"9zccf0":Me,bdctly:Ne,bdo3n8:Pe,biwlqk:Fe,cgzgvn:Ie,cjn1xs:Le,cnwfg3:Re,cwk7r6:ze,cx9lh3:Be,dizog6:Ve,ek03j3:He,epw9f3:`0`,evz7q4:We,f45rwo:Ge,fcy4ey:Ke,fo0vw0:qe,fpand1:Je,g7pjpv:Ye,gnnylt:Xe,gtvgs9:Ze,hzq69q:Qe,ibrnk6:$e,ifug2i:et,jf8ts4:tt,jmpbi6:nt,jnzipx:rt,jssk7y:it,k47stp:at,knrcsh:ot,ln9xiv:st,mnlddk:ct,n9zkql:lt,ofi1rq:ut,pmqvh0:dt,pom1h2:ft,q4mqcd:pt,q5w460:mt,r7v9s7:ht,rvctng:gt,sykid7:_t,t1rvqg:vt,tbygoy:yt,tgp8yw:bt,tjg3i3:xt,u61kge:St,udneg1:Ct,uu5nf7:wt,va18uh:Tt,vum0cd:Et,wuxjl9:Dt,wx5bee:Ot,xel5qk:kt,xphk5n:At,y6jqu9:jt,yhtv6l:Mt,zkouah:Nt,zz4mrw:Pt};export{$e as _100907z,Tt as _108j3sk,le as _10lgc56,re as _10n9ta8,g as _113vzpe,ft as _11ncipg,G as _11p3b1r,st as _12qyh2x,p as _132e19v,H as _13ym6k2,ge as _14oyo32,Ne as _15iyda3,C as _15vbpgm,we as _15xhlup,s as _16j2pbi,et as _16ln1wz,Le as _16pzx0g,je as _16rump9,F as _17g2rjk,v as _18346vt,R as _1982g2x,At as _1biskvr,k as _1bjtgx1,Re as _1cmz8k7,Ct as _1cpadi9,X as _1d7sodl,pt as _1e023il,u as _1e5aqjt,U as _1ea99j0,te as _1f4czmp,Ee as _1f8nqa3,de as _1f8umlr,Y as _1fe46d3,Oe as _1fikhaa,dt as _1fu9qvd,D as _1g7ofg0,Ie as _1gfjrn0,Fe as _1gma9hv,O as _1h09em8,he as _1hs819x,bt as _1ht75o0,t as _1i8i0au,nt as _1i9sfkh,z as _1ib6ekl,Z as _1ievltk,ht as _1in1gel,J as _1in9ocp,Je as _1ju6xlj,E as _1jvje3y,Ae as _1kd3yrp,M as _1kez60s,pe as _1krtsvx,ut as _1kvlpuf,Te as _1l1rqi2,ne as _1l2nmmx,N as _1lra4kg,yt as _1mmcyfz,Dt as _1n1igys,A as _1na1vy4,ve as _1nd7gbf,o as _1nwhws6,He as _1o0vi1j,Qe as _1o2h7a2,l as _1o8feo7,Ye as _1om32zr,T as _1oqs23j,Me as _1ovibcu,Nt as _1popw3r,ee as _1qamgmj,W as _1rggu8s,ot as _1s54fdc,c as _1s9ryeq,$ as _1t3gki9,i as _1ulsa90,h as _1urf8wf,n as _1w2bswr,I as _1wwy4yj,e as _1wx2fw2,it as _1x1qus,_t as _1y7hba4,S as _1yv1ajq,Ce as _2fxyxc,Ot as _3mtvnb,We as _3w8t28,ae as _41y3qp,Q as _454sub,mt as _49235i,q as _4itr6p,K as _4opuqb,ye as _5af8qp,b as _5r87wo,x as _78b61s,De as _8edkty,Pe as _a5vz6z,Ve as _al7a0k,ke as _bii6w9,Ue as _cnghfj,P as _czpegb,xt as _d7bf51,tt as _doc1yy,wt as _ftpidr,V as _g3pfjv,lt as _gkmqsa,f as _hyiyqa,d as _i9ury1,y as _ide9vv,St as _ig1w2,jt as _jpt8np,ce as _kmeu9o,fe as _kqdlbv,kt as _l5s0fl,rt as _l78r94,me as _l800fy,_ as _ly147p,ze as _mdvri5,Xe as _nb1pp5,ie as _np8jou,B as _nq4mpy,a as _nrzzox,at as _o3um2w,L as _oj2fr8,Et as _p5ybee,j as _pqml54,xe as _pr6lte,be as _q0rsrj,vt as _qm85b2,m as _r3yix2,w as _sf0mgy,Pt as _si8n6l,Ze as _swoaip,Mt as _t0vnn4,oe as _t91lwj,qe as _ty2nen,gt as _u7tj7p,Ge as _uc0jju,r as _uu4paz,ct as _vogk37,se as _wa8i8c,ue as _xavgbs,_e as _xkdtbf,Se as _ystooe,Be as _z6jr7i,Ke as _zzusn5,Ft as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>`${e.amount} 결제`,ee=`확인 대기 중...`,te=`익스플로러에서 보기`,t=`전달 실패`,n=`법정화폐 제공업체 선택`,r=`금액 입력`,i=e=>`${e.count}곳 더`,a=`주문 만료`,o=e=>`${e.provider}에서 ${e.amount} 결제`,s=`복사됨`,c=`최적의 환율을 찾아드립니다`,l=e=>`${e.provider}를 통해 계속`,u=`다른 체인을 선택하거나 특정 토큰을 검색해 보세요`,d=`곧 출시`,f=e=>`${e.provider} 경유`,p=e=>`네트워크 수수료용으로 ${e.reserve} ${e.symbol} 예약됨`,m=`검색 결과`,h=`토큰이 지갑에 전달되었습니다`,g=`지불`,_=`토큰이 전달되었습니다`,v=e=>`≈ $${e.formatUsd}`,y=`수신 주소`,b=`확인`,x=`지갑을 연결하여 결제 옵션을 확인하세요`,S=`토큰을 찾을 수 없습니다`,C=`지갑을 연결하거나 주소를 입력하여 견적 받기`,w=`지갑에서 확인해 주세요...`,T=`환불 트랜잭션`,E=e=>`${e.amt} ${e.sym} 구매`,D=`교환`,O=e=>`네트워크 수수료용으로 ${e.reserve} ${e.symbol} 예약됨 (실시간 추정)`,k=`DEX를 통해 스왑 중...`,A=`거래 실패 — 재시도`,j=`필러가 주문을 수락하지 않았습니다`,M=`뒤로`,N=`결제`,P=`실행 중...`,F=`수령 토큰 선택`,I=e=>`${e.chain}에서 완료`,L=`결제 확인됨`,R=`구매`,z=`닫기`,B=`결제 QR 코드`,V=`이용 가능한 오퍼가 없습니다`,H=`환불 진행 중`,U=e=>`${e.chain}에 입금`,W=`경로`,G=`암호화폐`,K=`서명 완료`,q=`주문 실패`,J=`금액을 입력하여 시작`,Y=`수신 주소`,X=e=>`≈ $${e.addThousandsSeparator}`,Z=`신용카드 또는 체크카드로 구매`,Q=`모든 체인 보기`,ne=`스왑`,re=`보낸 사람`,ie=`주문 처리 중...`,ae=`결제 토큰 선택`,oe=e=>`${e.provider} 경유`,se=`견적 상세`,ce=`총 수수료`,le=`결제 완료`,ue=`재시도`,de=`스왑 확인`,fe=`제공자가 주문 처리 중`,pe=`토큰 스왑 중`,me=`내 토큰`,he=e=>`${e.chain}에서 토큰 반환 중`,ge=`카드`,_e=`토큰 교환`,ve=`오류 복사`,ye=`법정화폐 결제`,be=`처리 중...`,xe=`구매 실패`,Se=`새 구매`,Ce=`가스에 사용할 네이티브 잔액이 부족합니다 — MAX를 사용해 보세요`,we=`이 브라우저에서는 결제 창을 열 수 없습니다. QR 코드를 스캔하거나 링크를 복사해 계속하세요.`,Te=`신용카드 또는 체크카드로 결제`,Ee=`온체인에서 확인됨`,$=`지갑에서 서명`,De=`보낸 곳`,Oe=`토큰 수령에 필요`,ke=`최대`,Ae=`수수료`,je=`완료할 수 없습니다`,Me=`링크 복사`,Ne=`인기 토큰`,Pe=`완료 트랜잭션`,Fe=e=>`${e.seconds}초 만에 전달`,Ie=`결제 수단`,Le=`스왑 성공`,Re=`토큰이 전달되었습니다`,ze=`수령`,Be=`최소`,Ve=`이름 또는 주소로 검색`,He=e=>`~${e.value}초`,Ue=`0`,We=`제공자`,Ge=`예상 시간`,Ke=`잔액 부족`,qe=`이 체인의 주소 형식이 올바르지 않습니다`,Je=`대상 주소 입력`,Ye=`사용 가능한 토큰이 없습니다`,Xe=`결제 링크 열기`,Ze=`최대`,Qe=`전송 트랜잭션`,$e=`스왑 실행`,et=`이 토큰은 카드로 직접 구매할 수 없습니다. 먼저 USDC를 구매한 후 원하는 토큰으로 자동 교환합니다.`,tt=`견적 실패`,nt=e=>`${e.count}곳의 제공업체 더 비교`,rt=e=>`${e.arg0} 직접 구매`,it=`결제 실패`,at=e=>`${e.chain}에서`,ot=e=>`~${e.value}분`,st=`사용 가능한 경로 없음`,ct=`토큰이 도착했습니다!`,lt=`결제 대기`,ut=e=>`최적 가격을 위해 ${e.token}을 통해 라우팅`,dt=`새 스왑`,ft=`수신 주소 입력`,pt=`지갑이 소스 체인과 일치하지 않습니다`,mt=`보기`,ht=`최적 가격`,gt=`주문을 완료할 수 없습니다.`,_t=e=>`${e.symbol}을 지갑으로 전송 중...`,vt=`자금이 지갑으로 반환되었습니다.`,yt=`견적 상세 보기`,bt=`서명이 제출되었습니다`,xt=`입금 트랜잭션`,St=`지갑 연결`,Ct=`지갑의 토큰으로 결제`,wt=`주문 취소`,Tt=`수령`,Et=`구매 완료`,Dt=`선택한 토큰은 현재 이 구매에 사용할 수 없습니다`,Ot=`수신 주소 입력`,kt=`추천`,At=`지갑 계정`,jt=e=>`잔액: ${e.fromBalance}`,Mt=`구매 완료`,Nt=`재시도`,Pt=`토큰 선택`,Ft={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"156lkep":p,"15bw477":m,"1685rko":h,"17kq51m":g,"17wtaao":_,"188897k":v,"18cmny0":y,"18tbqwf":b,"18y1lrp":x,"19is1h8":S,"19ne1ha":C,"1bze7sg":w,"1c5n7ll":T,"1cei180":E,"1dyojgg":D,"1fz9lzi":O,"1g8tdk7":k,"1hb73om":A,"1hdpo6q":j,"1hzmxtu":M,"1i7coq1":N,"1ih47b3":P,"1ix1b7w":F,"1ixbbo7":I,"1jhuo24":L,"1ka8utn":R,"1l0xxoj":z,"1ndiott":B,"1ne9nkz":V,"1nhkl7x":H,"1nn0owb":U,"1nvxkfy":W,"1o1b4a8":G,"1o4ofyx":K,"1ok4m5g":q,"1olegnl":J,"1oncz6g":Y,"1ovj1tk":X,"1q45kup":Z,"1qbiehv":Q,"1rkfalq":ne,"1rnxx1g":re,"1spu5st":ie,"1t0r88u":ae,"1t86tnu":oe,"1tn6f91":se,"1viukn9":ce,"1w0n607":le,"1w68n16":ue,"1x5xdes":de,"1y28pgi":fe,"1y6hn5o":pe,"1yijk6g":me,"27fhcv":he,"2b8ghr":ge,"2eikro":_e,"2mzna2":ve,"2zh3gr":ye,"344av8":be,"3pklqf":xe,"3u5vqs":Se,"43sibf":Ce,"53b4uu":we,"6c0jc7":Te,"6c5l2f":Ee,"6gkge0":$,"6s9hn9":De,"7m2ht3":Oe,"7v6g6x":ke,"9l4mg3":Ae,"9p7amh":je,"9zccf0":Me,bdctly:Ne,bdo3n8:Pe,biwlqk:Fe,cgzgvn:Ie,cjn1xs:Le,cnwfg3:Re,cwk7r6:ze,cx9lh3:Be,dizog6:Ve,ek03j3:He,epw9f3:`0`,evz7q4:We,f45rwo:Ge,fcy4ey:Ke,fo0vw0:qe,fpand1:Je,g7pjpv:Ye,gnnylt:Xe,gtvgs9:Ze,hzq69q:Qe,ibrnk6:$e,ifug2i:et,jf8ts4:tt,jmpbi6:nt,jnzipx:rt,jssk7y:it,k47stp:at,knrcsh:ot,ln9xiv:st,mnlddk:ct,n9zkql:lt,ofi1rq:ut,pmqvh0:dt,pom1h2:ft,q4mqcd:pt,q5w460:mt,r7v9s7:ht,rvctng:gt,sykid7:_t,t1rvqg:vt,tbygoy:yt,tgp8yw:bt,tjg3i3:xt,u61kge:St,udneg1:Ct,uu5nf7:wt,va18uh:Tt,vum0cd:Et,wuxjl9:Dt,wx5bee:Ot,xel5qk:kt,xphk5n:At,y6jqu9:jt,yhtv6l:Mt,zkouah:Nt,zz4mrw:Pt};export{$e as _100907z,Tt as _108j3sk,le as _10lgc56,re as _10n9ta8,g as _113vzpe,ft as _11ncipg,G as _11p3b1r,st as _12qyh2x,p as _132e19v,H as _13ym6k2,ge as _14oyo32,Ne as _15iyda3,C as _15vbpgm,we as _15xhlup,s as _16j2pbi,et as _16ln1wz,Le as _16pzx0g,je as _16rump9,F as _17g2rjk,v as _18346vt,R as _1982g2x,At as _1biskvr,k as _1bjtgx1,Re as _1cmz8k7,Ct as _1cpadi9,X as _1d7sodl,pt as _1e023il,u as _1e5aqjt,U as _1ea99j0,te as _1f4czmp,Ee as _1f8nqa3,de as _1f8umlr,Y as _1fe46d3,Oe as _1fikhaa,dt as _1fu9qvd,D as _1g7ofg0,Ie as _1gfjrn0,Fe as _1gma9hv,O as _1h09em8,he as _1hs819x,bt as _1ht75o0,t as _1i8i0au,nt as _1i9sfkh,z as _1ib6ekl,Z as _1ievltk,ht as _1in1gel,J as _1in9ocp,Je as _1ju6xlj,E as _1jvje3y,Ae as _1kd3yrp,M as _1kez60s,pe as _1krtsvx,ut as _1kvlpuf,Te as _1l1rqi2,ne as _1l2nmmx,N as _1lra4kg,yt as _1mmcyfz,Dt as _1n1igys,A as _1na1vy4,ve as _1nd7gbf,o as _1nwhws6,He as _1o0vi1j,Qe as _1o2h7a2,l as _1o8feo7,Ye as _1om32zr,T as _1oqs23j,Me as _1ovibcu,Nt as _1popw3r,ee as _1qamgmj,W as _1rggu8s,ot as _1s54fdc,c as _1s9ryeq,$ as _1t3gki9,i as _1ulsa90,h as _1urf8wf,n as _1w2bswr,I as _1wwy4yj,e as _1wx2fw2,it as _1x1qus,_t as _1y7hba4,S as _1yv1ajq,Ce as _2fxyxc,Ot as _3mtvnb,We as _3w8t28,ae as _41y3qp,Q as _454sub,mt as _49235i,q as _4itr6p,K as _4opuqb,ye as _5af8qp,b as _5r87wo,x as _78b61s,De as _8edkty,Pe as _a5vz6z,Ve as _al7a0k,ke as _bii6w9,Ue as _cnghfj,P as _czpegb,xt as _d7bf51,tt as _doc1yy,wt as _ftpidr,V as _g3pfjv,lt as _gkmqsa,f as _hyiyqa,d as _i9ury1,y as _ide9vv,St as _ig1w2,jt as _jpt8np,ce as _kmeu9o,fe as _kqdlbv,kt as _l5s0fl,rt as _l78r94,me as _l800fy,_ as _ly147p,ze as _mdvri5,Xe as _nb1pp5,ie as _np8jou,B as _nq4mpy,a as _nrzzox,at as _o3um2w,L as _oj2fr8,Et as _p5ybee,j as _pqml54,xe as _pr6lte,be as _q0rsrj,vt as _qm85b2,m as _r3yix2,w as _sf0mgy,Pt as _si8n6l,Ze as _swoaip,Mt as _t0vnn4,oe as _t91lwj,qe as _ty2nen,gt as _u7tj7p,Ge as _uc0jju,r as _uu4paz,ct as _vogk37,se as _wa8i8c,ue as _xavgbs,_e as _xkdtbf,Se as _ystooe,Be as _z6jr7i,Ke as _zzusn5,Ft as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,s as t}from"./dist-CpC2fQqU.js";import{t as n}from"./errors-BMU5s_Au.js";import{r}from"./shared.module-Bk8Fpur5.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`,`so11111111111111111111111111111111111111112`]);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 e({baseUrl:a})).searchTokens(i,{chainIds:[r]})).data??[]);if(c){let e=u(c);return j(e,s),e}throw new t(n.INVALID_TOKEN_IDENTIFIER,`Token not found for chain ${r}: ${i}`)}catch(e){if(e instanceof t)throw e}return{chainId:r,address:i,decimals:void 0}}function P(e){let t=e.replace(/[^0-9.]/g,``),n=t.indexOf(`.`);return n===-1?t:t.slice(0,n+1)+t.slice(n+1).replace(/\./g,``)}function F(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 I(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 L(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 R(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 z(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 B=20011e6;function V(e){return e===B}function H(e){return e!==B}function U(e){return V(e)?`solana`:`evm`}function W(e,t){return U(e)!==U(t)}function G(e){return V(e)?`11111111111111111111111111111111`:`0x0000000000000000000000000000000000000000`}function K(e,t){return t?.get(e)?.name??`Chain ${e}`}function q(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 J(e){return e?.includes(`1-click`)??!1}function Y(e){try{return e.startsWith(`0x`),BigInt(e)}catch{return null}}function X(e){let t=[];for(let n of e){let e=Y(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:J(n.tags)})}return t}function Z(e,t){let n=[];for(let r of e){let e=Y(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:J(r.tags)})}return n}function Q(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 $(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 ee(e){return Q(X(e))[0]??null}function te(e,t){return $(Z(e,t))[0]??null}export{d as A,_ as C,c as D,l as E,m as M,f as O,y as S,v as T,I as _,B as a,j as b,G as c,H as d,V as f,P as g,z as h,$ as i,p as j,h as k,q as l,L as m,te as n,K as o,R as p,ee as r,U as s,Z as t,W as u,F as v,b as w,N as x,M as y};
|