@tokenflight/swap 0.3.0-rc.3 → 0.3.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReceiveComponent-GQRMS7Qu.js +1 -0
- package/dist/SwapComponent-B_mG9K4P.js +1 -0
- package/dist/bridge-YKE1uT8W.js +1 -0
- package/dist/bridge.d.ts +30 -5
- package/dist/bridge.js +1 -1
- package/dist/browser-BONUFvML.js +8 -0
- package/dist/chunk-Dj_sP-dV.js +1 -0
- package/dist/classPrivateFieldSet2-DmR3eaHe.js +1 -0
- package/dist/dist-D3Q09jyE.js +3 -0
- package/dist/en-US-CA6Sa-oZ.js +1 -0
- package/dist/errors-wDO33e38.js +1 -0
- package/dist/iframe-entry.js +2 -2
- package/dist/{iframe-receiver-PfhKUIZW.js → iframe-receiver-i4RfQGg2.js} +1 -1
- package/dist/iframe.d.ts +1 -1
- package/dist/iframe.js +2 -1
- package/dist/ja-JP-dq1hxi1o.js +1 -0
- package/dist/ko-KR-ixklPQrK.js +1 -0
- package/dist/rank-offers-TMz0oVic.js +1 -0
- package/dist/{register-defaults-C_q7CG7x.js → register-defaults-BOb3wgfD.js} +1 -1
- package/dist/register-widget-CzQlUUbW.js +1 -0
- package/dist/shared.module-BORGC5lt.js +1 -0
- package/dist/swap.css +1 -1
- package/dist/tokenflight-swap.d.ts +9 -3
- package/dist/tokenflight-swap.js +1 -1
- package/dist/tokenflight-swap.umd.cjs +12 -5
- package/dist/usePageRouter-mTjOlNav.js +1 -0
- package/dist/widget-M3Wfb9U3.js +2 -0
- package/dist/widget.d.ts +9 -3
- package/dist/widget.js +1 -1
- package/dist/zh-CN-Qnc6ozkb.js +1 -0
- package/dist/zh-TW-CG-ua9cn.js +1 -0
- package/package.json +4 -2
- package/dist/ReceiveComponent-4xwyN66k.js +0 -1
- package/dist/SwapComponent-CF2-MzB_.js +0 -1
- package/dist/bridge-Bq0QUltI.js +0 -1
- package/dist/en-US-CU2aSy93.js +0 -1
- package/dist/errors-DXq77OyE.js +0 -3
- package/dist/ja-JP-BoipV6-j.js +0 -1
- package/dist/ko-KR-DyFXZJsF.js +0 -1
- package/dist/rank-offers-CiA9Nw2C.js +0 -1
- package/dist/register-widget-DHNRTdAz.js +0 -1
- package/dist/shared.module-2EeBIMep.js +0 -1
- package/dist/usePageRouter-BUKTv1jC.js +0 -1
- package/dist/widget-eUE--Gt1.js +0 -2
- package/dist/zh-CN-epCUm9Io.js +0 -1
- package/dist/zh-TW-DSEboEJV.js +0 -1
- /package/dist/{active-bridge-V8lTJ2Js.js → active-bridge-hZx8_r6Y.js} +0 -0
- /package/dist/{defaults-loader-DfcaO9j5.js → defaults-loader-CUYh_qLj.js} +0 -0
- /package/dist/{protocol-CDxgudrl.js → protocol-B7S8LSlJ.js} +0 -0
- /package/dist/{solid-iWr5Czxc.js → solid-DqvEpdeb.js} +0 -0
- /package/dist/{theme-C9tsVWlo.js → theme-B6YtpkRW.js} +0 -0
|
@@ -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-D3Q09jyE.js";import{t as h}from"./errors-wDO33e38.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-BORGC5lt.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-TMz0oVic.js";import{A as ye,At as be,B as xe,C as k,Ct as Se,D as Ce,Dt as we,Et as Te,F as Ee,G as De,H as Oe,J as ke,K as Ae,L as je,M as Me,N as Ne,O as Pe,P as Fe,Q as Ie,R as Le,S as Re,T as ze,U as Be,V as Ve,W as He,Y as Ue,_ as We,_t as Ge,a as Ke,at as qe,c as Je,d as Ye,et as Xe,f as A,ft as Ze,g as Qe,gt as $e,h as et,ht as tt,i as nt,it as rt,j as it,k as at,kt as ot,l as st,lt as ct,m as lt,mt as ut,n as dt,nt as ft,o as pt,ot as mt,pt as j,q as ht,r as gt,s as _t,st as vt,t as yt,tt as bt,u as xt,ut as St,vt as Ct,x as wt,y as Tt,z as Et}from"./usePageRouter-mTjOlNav.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=gt();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 nt(e.walletAdapter(),n,s.token.chainId);e.setExecPhase(`submitting`);let a=await _t(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([])}),pt(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}=be(),E=We(),ie=be();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:nt,onBackAnimEnd:pt}=yt({methods:D}),[gt,_t]=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(),pt()},hn=()=>{kt(),Ot=setTimeout(At,260)};t(kt);let gn=e=>{O()!==e&&(_t(`forward`),Ke(e))},_n=()=>{if(!A()){if(Dt()){nt(),hn(),_t(`back`),Ke(`entry`);return}nt()}},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}=Xe([`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}=Ye({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=dt({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=xt({phase:J.phase,onExpired:()=>J.refetchQuote(),intervalSeconds:30}),cr=Le(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??vt(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??vt(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(()=>Tt(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?et(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=je(q,()=>!0),Nr=s(()=>{let e=Mr.data;return e?Ve(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=Qe(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=Qe(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}=xt({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)}});Je({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=ke(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?et(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=Pe({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(Ce,{form:hi,get children(){return[d(qe,{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(tt,{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,()=>ct(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,()=>ot(`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()?ct(Or()):w({id:`fpand1`,message:`Enter destination address`})})()),y(e,d(c,{get when(){return!Er()},get children(){return d(Se,{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(we,{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($e,{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(we,{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(ze,{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(Te,{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(rt,{get current(){return O()},get direction(){return gt()},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(ut,{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(Oe,{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=bt.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(He,{})]},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($e,{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(we,{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(He,{})}})},get children(){var e=Xt();return y(e,d(Be,{get route(){return Gr()},get fromToken(){return Kr()},get toToken(){return E.targetToken()},inline:!0})),a(()=>g(e,De.quote)),e}})]}})),e})()]}}),null),y(t,d(c,{when:e===`card`,get children(){return[(()=>{var e=qt();return y(e,d(wt,{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(Re,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(Ze,{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(Ge,{})}})),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(ft,{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(ht({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(St,{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(Ae,{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(mt,{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(Ie,{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(Ie,{drawer:F,get children(){return d(Ee,{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(Fe,{selectingFor:`from`,onClose:Gn})},get children(){return d(u,{get fallback(){return d(Fe,{selectingFor:`from`,onClose:Gn})},get children(){return d(Ne,{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(Ie,{drawer:I,get children(){return d(Ee,{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(Fe,{selectingFor:`to`,onClose:qn})},get children(){return d(u,{get fallback(){return d(Fe,{selectingFor:`to`,onClose:qn})},get children(){return d(Ne,{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(Ie,{drawer:R,when:()=>!!E.targetToken(),get children(){return d(Me,{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-D3Q09jyE.js";import{t as _}from"./errors-wDO33e38.js";import{c as v,f as y,g as b,h as x,l as S,n as C,p as ee,s as w,t as T,u as E}from"./shared.module-BORGC5lt.js";import{S as te,_ as D,c as ne,g as re,h as ie,l as ae,p as oe,r as se,s as ce,v as le,x as ue}from"./rank-offers-TMz0oVic.js";import{$ as de,A as fe,At as pe,B as me,C as O,Ct as he,D as ge,Dt as _e,E as ve,Et as ye,F as be,G as xe,H as Se,I as Ce,J as we,K as Te,L as Ee,M as De,N as Oe,O as ke,Ot as Ae,P as je,Q as Me,R as Ne,S as Pe,St as Fe,T as Ie,Tt as Le,U as Re,V as ze,W as Be,X as Ve,Y as He,Z as Ue,_t as We,a as Ge,at as Ke,b as qe,bt as k,c as Je,ct as Ye,d as Xe,dt as Ze,et as Qe,f as A,ft as $e,g as et,gt as tt,h as nt,ht as rt,i as j,it,j as at,k as ot,kt as st,l as ct,m as lt,mt as ut,n as dt,nt as ft,o as pt,ot as mt,p as ht,pt as M,q as gt,r as _t,rt as vt,s as yt,st as bt,t as xt,tt as St,u as Ct,ut as wt,v as Tt,vt as Et,w as Dt,wt as Ot,x as kt,xt as At,yt as jt,z as Mt}from"./usePageRouter-mTjOlNav.js";var N={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`},Nt=b(`<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>`),Pt=b(`<img>`),Ft=b(`<span>`),It=b(`<button type=button data-testid=provider-list-item><div><div><span></span><span>: </span></div></div><div><span>≈ <!> `),Lt=b(`<div>`);function Rt(e){return we(e)??`0`}function zt(e){let{t}=pe(),n=()=>vt(e.fiatCurrency.toUpperCase()),i=t=>e.selectedProviderId?t===e.selectedProviderId:e.quotes.length>0&&e.quotes[0].provider===t,a=t=>{t.key===`Escape`&&e.onClose()};return(()=>{var s=Nt(),l=s.firstChild,f=l.firstChild,p=f.firstChild,m=p.nextSibling,h=m.firstChild,g=l.nextSibling,_=g.nextSibling;return w(s,`keydown`,a),S(p,()=>t({id:`118a77s`,message:`Select Fiat Provider`})),S(m,u(Se,{get secondsRemaining(){return e.countdownSeconds},get totalSeconds(){return e.totalCountdownSeconds},get onRefresh(){return e.onRefresh},get isRefreshing(){return e.isRefreshing}}),h),w(h,`click`,()=>e.onClose()),S(h,u(Ot,{size:18})),S(_,u(c,{get each(){return[...e.quotes]},children:(a,s)=>{let[c,l]=d(!1),f=()=>i(a.provider),p=()=>s()===0,m=()=>a.providerIcon?`${e.apiBase}${a.providerIcon}`:null;return(()=>{var i=It(),s=i.firstChild,d=s.firstChild,h=d.firstChild,g=h.nextSibling,_=g.firstChild,b=s.nextSibling,x=b.firstChild,ee=x.firstChild.nextSibling;return ee.nextSibling,w(i,`click`,()=>e.onSelect(a.provider)),S(s,u(o,{get when(){return E(()=>!!m())()&&!c()},get fallback(){return(()=>{var e=Lt();return S(e,()=>(a.providerName??a.provider).charAt(0).toUpperCase()),r(()=>v(e,N.providerIconFallback)),e})()},get children(){var e=Pt();return w(e,`error`,()=>l(!0)),r(t=>{var n=N.providerIcon,r=m(),i=a.provider;return n!==t.e&&v(e,t.e=n),r!==t.t&&y(e,`src`,t.t=r),i!==t.a&&y(e,`alt`,t.a=i),t},{e:void 0,t:void 0,a:void 0}),e}}),d),S(h,()=>a.providerName??a.provider,null),S(h,u(o,{get when(){return p()},get children(){var e=Ft();return S(e,()=>t({id:`r7v9s7`,message:`BEST RATE`})),r(()=>v(e,N.bestBadge)),e}}),null),S(g,()=>t({id:`1viukn9`,message:`Total fee`}),_),S(g,n,null),S(g,()=>parseFloat(String(a.totalFee)).toFixed(2),null),S(x,()=>ie(le(Rt(a),e.tokenDecimals),4),ee),S(x,()=>e.targetSymbol,null),S(b,u(o,{get when(){return f()},get children(){var e=Ft();return S(e,u(Le,{size:16})),r(()=>v(e,N.checkmark)),e}}),null),r(e=>{var t=C(N.providerItem,f()&&N.providerItemSelected),n=N.providerLeft,r=N.providerInfo,a=N.providerName,o=N.providerFee,c=N.providerRight,l=N.cryptoAmount;return t!==e.e&&v(i,e.e=t),n!==e.t&&v(s,e.t=n),r!==e.a&&v(d,e.a=r),a!==e.o&&v(h,e.o=a),o!==e.i&&v(g,e.i=o),c!==e.n&&v(b,e.n=c),l!==e.s&&v(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}),i})()}})),r(n=>{var r=C(N.selector,e.noChrome&&N.selectorNoChrome),i=t({id:`118a77s`,message:`Select Fiat Provider`}),a=N.header,o=N.titleRow,c=N.title,u=N.headerRight,d=N.close,b=t({id:`1l0xxoj`,message:`Close`}),x=N.divider,S=N.providerList;return r!==n.e&&v(s,n.e=r),i!==n.t&&y(s,`aria-label`,n.t=i),a!==n.a&&v(l,n.a=a),o!==n.o&&v(f,n.o=o),c!==n.i&&v(p,n.i=c),u!==n.n&&v(m,n.n=u),d!==n.s&&v(h,n.s=d),b!==n.h&&y(h,`aria-label`,n.h=b),x!==n.r&&v(g,n.r=x),S!==n.d&&v(_,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}),s})()}function Bt(e){let t=_t();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=ce(e.fromToken().chainId),o=e.walletAddress();if(!o){e.setError(`Wallet not connected`),e.setErrorCode(_.WALLET_CONNECTION_FAILED);return}if(!ae(o,a)){e.setError(ht`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 j(e.walletAdapter(),n,e.fromToken().chainId);e.setExecPhase(`submitting`);let s=await yt(e.client(),r,i.routeId,a);e.setExecPhase(`tracking`),t.setTrackingOrderId(s.orderId)}catch(n){let r=Ge(n,e.callbacks(),`swap`);t.setExecutionError(r),t.setFailedExecPhase(e.execPhase())}},handleRetry:()=>{t.setTrackingOrderId(null),t.setTrackingAddress(null),e.setExecPhase(null)},handleNewSwap:()=>{e.storeReset(),pt(t,e.client().baseUrl),e.onReset?.()}}}var Vt=b(`<button type=button data-testid=quote-error-close>`),Ht=b(`<button type=button part=button-primary data-testid=quote-error-retry>`),P=b(`<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>`),Ut=b(`<div><div><span></span><span>`),Wt=b(`<button type=button part=back-button><span>`),Gt=b(`<img height=22>`),Kt=b(`<button part=wallet-info><div></div><span>`),qt=b(`<div part=header><div><div data-testid=header-brand><span>`),Jt=b(`<div data-testid=swap-method-frame><div data-testid=powered-footer-slot>`),Yt=b(`<span>Flight`),Xt=b(`<div data-testid=swap-entry-method-pane><div><span>`),Zt=b(`<div><span></span><button type=button>`),Qt=b(`<span>`),$t=b(`<div><div><div></div></div><span>`),en=b(`<div>`),tn=b(`<div><span>`),nn=b(`<div><div data-testid=fiat-amount-shell><span>`),rn=b(`<button type=button part=swap-arrow>`),an=b(`<button part=recipient-badge><span>`),on=b(`<span part=amount-display style=cursor:default>`),sn=b(`<button type=button data-testid=quote-details-trigger>`),cn=b(`<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>`),ln=b(`<div part=price-preview>`),un=b(`<div part=no-offer><span>`),dn=b(`<div><div style=width:32px;height:32px></div><span>`),fn=b(`<div data-testid=card-recipient-gate-card><div></div><span></span><span>`),pn=b(`<button part=button-primary type=button>`),mn=b(`<button disabled type=button><span><span>`),hn=b(`<button disabled type=button style=opacity:0.6>`),gn=b(`<div part=cta-wrapper>`),_n=b(`<div style=display:contents>`),vn=b(`<button><span>`),yn=b(`<span> `),bn=b(`<div style=width:120px;height:28px>`);function xn(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 Sn(t){let{t:n}=pe(),[i,a]=d(!1),s,c=()=>{t.onCopy(t.message),a(!0),s&&clearTimeout(s),s=setTimeout(()=>{a(!1),s=void 0},1200)};return e(()=>{s&&clearTimeout(s)}),(()=>{var e=P(),a=e.firstChild,s=a.firstChild,l=s.nextSibling,d=l.firstChild,f=a.nextSibling;return S(s,u(k,{size:15}),null),S(s,()=>t.title??n({id:`jf8ts4`,message:`Quote Failed`}),null),w(d,`click`,c),S(d,u(o,{get when(){return i()},get fallback(){return u(jt,{size:13})},get children(){return u(Le,{size:13})}})),S(l,u(o,{get when(){return t.onClose},get children(){var e=Vt();return w(e,`click`,()=>t.onClose?.()),S(e,u(Ot,{size:14})),r(t=>{var r=O.quoteErrorIconButton,i=n({id:`1l0xxoj`,message:`Close`});return r!==t.e&&v(e,t.e=r),i!==t.t&&y(e,`aria-label`,t.t=i),t},{e:void 0,t:void 0}),e}}),null),S(f,()=>t.message),S(e,u(o,{get when(){return t.onRetry},get children(){var e=Ht();return w(e,`click`,()=>{t.onRetry?.()}),S(e,()=>n({id:`1w68n16`,message:`Try Again`})),r(()=>v(e,C(M.btnError,O.quoteErrorCta))),e}}),null),r(r=>{var o=C(O.quoteErrorPanel,O[`quoteErrorPanel--${t.variant}`]),c=O.quoteErrorHeader,u=O.quoteErrorTitle,p=O.quoteErrorActions,m=C(O.quoteErrorIconButton,i()&&O.quoteErrorIconButtonCopied),h=i()?n({id:`13bzcw5`,message:`Copied`}):n({id:`2mzna2`,message:`Copy error`}),g=i()?`true`:`false`,_=O.quoteErrorMessage;return o!==r.e&&v(e,r.e=o),c!==r.t&&v(a,r.t=c),u!==r.a&&v(s,r.a=u),p!==r.o&&v(l,r.o=p),m!==r.i&&v(d,r.i=m),h!==r.n&&y(d,`aria-label`,r.n=h),g!==r.s&&y(d,`data-copied`,r.s=g),_!==r.h&&v(f,r.h=_),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e})()}function F(e){return u(A,{get children(){return u(Cn,e)}})}function Cn(e){let{t:c}=pe(),b=pe(),ae=a(()=>e.config.methods??[`crypto`]),Le=a(()=>ae().includes(`crypto`)),Ge=a(()=>ae().includes(`card`)),k=a(()=>!!e.config.lockFromToken||!!e.config.defaultPayMethod),A=a(()=>!!e.config.lockToToken),{page:j,setPage:pt,showBack:ht,backExiting:_t,handleBack:yt,onBackAnimEnd:jt}=xt({methods:ae,defaultPage:()=>e.config.defaultPayMethod,onBack:e.onBack}),[N,Nt]=d(`idle`),[Pt,Ft]=d(`idle`),It=a(()=>!e.config.defaultPayMethod&&ae().length>1&&j()!==`entry`),Lt=a(()=>N()===`enter`?`enter`:N()===`exit`?`exit`:ht()?`pushed`:`idle`),Rt=e=>{let t=j();t!==e&&(Ft(`forward`),Nt(t===`entry`?`enter`:`idle`),pt(e))},Vt=()=>{if(_t())return;let e=It();if(e){Nt(`exit`),yt(),Ft(`back`),pt(`entry`);return}Nt(e?`exit`:`idle`),yt()},Ht=()=>{if(N()===`enter`){Nt(`idle`);return}N()===`exit`&&(Nt(`idle`),jt())},P=Tt(),[F,Cn]=d(`from`),{tokenSelector:I,recipient:wn,provider:Tn,quoteDetails:L,paymentError:R,fiatPaymentHandoff:z}=Qe([`tokenSelector`,`recipient`,`provider`,`quoteDetails`,`paymentError`,`fiatPaymentHandoff`]),En=xn(I.open,I.mounted),[Dn,On]=d(null),[kn,An]=d(!1),[B,jn]=d(e.config.fiatCurrency??`USD`),[Mn,Nn]=d(null),[Pn,Fn]=d(null),[In,Ln]=d(null),[Rn,zn]=d(null),Bn=()=>{i(()=>{P.clearError(),Nn(null)})},{isConnected:V,walletAddress:H,handleConnect:Vn}=Xe({walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,onAddressChange:e=>P.setWalletAddress(e),onConnectError:(e,t)=>{i(()=>{Nn(`wallet-connect`),P.setError(e),P.setErrorCode(t)})}});s(f(V,e=>{e&&Mn()===`wallet-connect`&&Bn()}));let Hn=e=>{e instanceof HTMLElement&&On(e)},Un=()=>{window.setTimeout(()=>{let e=Dn();e?.isConnected&&e.focus()},300)},Wn=()=>{I.hide(),Un()},Gn=(e,t)=>{if(e===`to`&&j()===`card`){Hn(t),Cn(`to`),I.show();return}if(!V()){Vn();return}Hn(t),Cn(e),I.show()},Kn=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()},qn=e=>{Kn(e),wn.show()},U=a(()=>new m({baseUrl:e.config.apiEndpoint??`https://api.hyperstream.dev`})),Jn=a(()=>new p({baseUrl:e.config.fiatApiEndpoint??`https://fiat.hyperstream.dev`})),W=()=>U().baseUrl,Yn=a(()=>e.config.fromTokens?.length?nt(e.config.fromTokens):void 0),Xn=a(()=>e.config.toTokens?.length?nt(e.config.toTokens):void 0),[Zn,Qn]=d([]),$n=Ee(U,()=>!0),er=a(()=>{let e=$n.data;return e?ze(e):new Map}),{needRecipient:tr,effectiveRecipient:nr,recipientDisplay:rr,handleRecipientChange:ir}=ct({fromToken:P.fromToken,toToken:P.toToken,recipient:P.recipient,isConnected:V,walletAddress:H,walletAdapter:()=>e.walletAdapter,setRecipient:P.setRecipient}),ar=me(U,H,()=>V()&&!!H(),()=>e.walletAdapter?.supportedChainIds),or=a(()=>{let e=P.fromToken(),t=ar.data;return!e||!t?null:te(t,e)}),sr=a(()=>{let e=or();return e?.extensions?.balance?oe(ie(le(e.extensions.balance,e.decimals),2)):e?`0`:null}),cr=a(()=>{let e=P.fromToken();return!e||typeof e.decimals!=`number`||!ar.data?null:or()?.extensions?.balance??`0`}),lr=a(()=>{let e=P.inputAmount(),t=P.fromToken(),n=cr();if(!t||typeof t.decimals!=`number`||!n||!e||e===`0`||e===``)return!1;try{return BigInt(D(e,t.decimals))>BigInt(n)}catch{return!1}}),[ur,dr,fr]=Ce(``,300),G=a(()=>e.config.tradeType===`EXACT_OUTPUT`),pr=a(()=>e.config.quoteCard??(G()?`visible`:`hidden`)),K=a(()=>!G()&&pr()===`hidden`),q=a(()=>!!e.config.noBackground&&!!e.config.noBorder),mr=a(()=>e.lockRecipient===void 0?!!e.config.recipient&&e.config.recipientEditable!==!0:e.lockRecipient),hr=a(()=>{if(j()!==`crypto`)return null;let t=P.fromToken(),n=P.toToken(),r=nr();if(!t||typeof t.decimals!=`number`||!n||typeof n.decimals!=`number`||!U()||tr())return null;if(G()){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:D(i,n.decimals),fromAddress:H()??ne(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=ur();return!i||parseFloat(i)<=0?null:{tradeType:`EXACT_INPUT`,fromChainId:t.chainId,fromToken:t.address,toChainId:n.chainId,toToken:n.address,amount:D(i,t.decimals),fromAddress:H()??ne(t.chainId),...r&&{recipient:r},...e.config.refundTo&&{refundTo:e.config.refundTo},...e.config.referrer&&{referrer:e.config.referrer},...e.config.referrerFeeBps!==void 0&&{referrerFeeBps:e.config.referrerFeeBps}}}),J=Mt(U,hr,a(()=>!!hr()&&!P.execPhase()&&V()&&!!H())),Y=a(()=>{if(!P.fromToken()||!P.toToken())return[];if(!G()){let e=P.inputAmount();if(!e||parseFloat(e)<=0)return[]}return J.data?.routes??[]}),gr=a(()=>J.data?.quoteId??null),_r=a(()=>Y().length>0?se(Y()):null),vr=a(()=>{let e=Y(),t=_r();return e.find(e=>e.routeId===t)??e[0]??null}),yr=a(()=>{let e=vr(),t=P.toToken();return!e||!t||typeof t.decimals!=`number`?``:ie(le(e.quote.amountOut,t.decimals))}),br=a(()=>{if(!G())return null;let e=vr(),t=P.fromToken();return!e||!t||typeof t.decimals!=`number`?null:ie(le(e.quote.amountIn,t.decimals))}),X=a(()=>qe(P.execPhase(),P.error(),J.isFetching,Y().length,!!hr())),xr=a(()=>P.execPhase()||!hr()?!1:!J.isFetching&&J.isSuccess&&Y().length===0),Sr=a(()=>{let e=X();return e===`quoted`||e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`||e===`success`}),Cr=a(()=>{let e=X();return e===`building`||e===`awaiting-wallet`||e===`submitting`||e===`tracking`}),wr=a(()=>!P.fromToken()||!P.toToken()?!1:X()===`quoting`&&!!hr()&&Y().length===0),Tr=a(()=>{let e=P.fromToken();if(!e)return null;if(typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd))return e.priceUsd;let t=Number(or()?.extensions?.price?.usd??``);return Number.isFinite(t)?t:null}),Er=a(()=>{let e=P.toToken();return e&&typeof e.priceUsd==`number`&&Number.isFinite(e.priceUsd)?e.priceUsd:null}),Dr=a(()=>{let e=G()?br()??`0`:P.inputAmount(),t=Number(e),n=Tr();return!Number.isFinite(t)||t<=0||n===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:Ye(t*n)})}),{trackingOrderId:Or,trackingAddress:kr,trackingProviderName:Ar,trackingProviderIcon:jr,executionError:Mr,failedExecPhase:Nr,handleConfirm:Pr,handleRetry:Fr,handleNewSwap:Ir}=Bt({client:U,walletAdapter:()=>e.walletAdapter,callbacks:()=>e.callbacks,apiEndpoint:()=>e.config.apiEndpoint,fromToken:P.fromToken,recipient:nr,needRecipient:tr,walletAddress:H,routes:Y,quoteId:gr,selectedRouteId:_r,execPhase:P.execPhase,setExecPhase:P.setExecPhase,setError:e=>{Nn(`validation`),P.setError(e)},setErrorCode:e=>{Nn(`validation`),P.setErrorCode(e)},storeReset:P.reset,onReset:()=>fr(``)});Je({client:U,walletAddress:H,trackingAddress:kr,trackingOrderId:Or,phase:X,execPhase:P.execPhase,setOrder:P.setOrder,setExecPhase:P.setExecPhase,onOrderFilled:t=>e.callbacks?.onSwapSuccess?.({orderId:t.id,fromToken:P.fromToken().symbol??P.fromToken().address,toToken:P.toToken().symbol??P.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:Lr}=Ct({phase:X,onExpired:()=>J.refetch()});s(f(()=>({isError:J.isError,error:J.error,data:J.data}),({isError:e,error:t,data:n})=>{P.execPhase()||j()!==`crypto`||(e&&!n?i(()=>{Nn(`quote`),t instanceof h?(P.setError(t.message),P.setErrorCode(t.code)):(P.setError(String(t)),P.setErrorCode(null))}):Mn()===`quote`&&P.error()&&!e&&Bn())}));let Rr=async()=>{let e=Mn();if(Bn(),e===`quote`){await J.refetch();return}if(e===`wallet-connect`){await Vn();return}e!==`validation`&&Fr()};s(f(()=>J.data,t=>{t&&e.callbacks?.onQuoteReceived?.(t)}));let zr=a(()=>nr()),Br=a(()=>{if(!G()||!e.config.amount)return null;let t=P.toToken();return!t||typeof t.decimals!=`number`?null:D(e.config.amount,t.decimals)}),Z=dt({client:Jn,targetToken:P.toToken,recipient:zr,refundTo:()=>e.config.refundTo,fiatCurrency:()=>B(),callbacks:()=>e.callbacks,flowKind:`swap`,cryptoAmount:Br,requireRecipient:!0}),Vr=Ct({phase:Z.phase,onExpired:()=>Z.refetchQuote(),intervalSeconds:30}),Hr=a(()=>!!P.toToken()&&(G()?!!e.config.amount:!!Z.fiatAmount())),Ur=a(()=>j()===`card`&&!zr()&&Hr()),Wr=a(()=>rr()??(V()?H():null)),Gr=a(()=>!!Wr()||Hr()),Kr=a(()=>!!e.config.fiatCurrency),qr=Ne(Jn,()=>!Kr()),Jr=a(()=>{if(Kr())return[];let e=qr.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()}),Yr=[`USD`,`EUR`,`GBP`,`JPY`,`KRW`,`CNY`,`AUD`,`CAD`,`INR`,`SGD`,`HKD`,`TWD`,`BRL`,`MXN`,`CHF`],Xr=a(()=>{let e=Jr();return e.length>0?e:Yr}),Zr=a(()=>vt(B())||B()),Qr=()=>P.toToken()?.decimals??Z.quote()?.token?.decimals??18,$r=e=>e?ie(le(e,Qr()),6):`0`,ei=a(()=>{let e=Z.quote(),t=parseFloat(Z.fiatAmount());return!e||!t?!1:!!(e.minFiatAmount&&t<parseFloat(String(e.minFiatAmount))||e.maxFiatAmount&&t>parseFloat(String(e.maxFiatAmount)))}),ti=a(()=>{let e=Z.phase();return e===`awaiting-payment`||e===`payment-handoff`||e===`tracking`}),ni=a(()=>j()===`card`&&(Z.phase()===`awaiting-payment`||Z.phase()===`payment-handoff`)&&!!Z.directWidgetUrl()),ri=a(()=>j()===`card`&&(Z.phase()===`awaiting-payment`||Z.phase()===`payment-handoff`)),ii=a(()=>{if(j()!==`card`||Z.phase()!==`payment-handoff`)return null;let e=Z.orderId(),t=Z.directWidgetUrl();return e&&t?`${e}:${t}`:null}),ai=a(()=>{let e=Z.quote();return e?.providerName??bt(Z.orderStatus()?.provider??e?.provider??`Transak`)}),oi=a(()=>Z.fiatAmount()||Z.orderStatus()?.fiatAmount||Z.quote()?.fiatAmount||``),[si,ci]=d(null),li=e=>({orderStatus:e,fiatAmount:oi()||e.fiatAmount||``,fiatCurrency:B(),targetToken:P.toToken(),tokenDecimals:Z.tokenDecimals(),provider:e.provider??`transak`,quote:Z.quote()}),Q=a(()=>{let e=Z.orderStatus();return e?li(e):si()});s(()=>{let e=Z.orderStatus();Z.phase()!==`success`||!e||ci(li(e))});let ui=()=>{ni()&&(z.open()?z.hide():z.show())};s(()=>{if(!ni()){Z.orderId()||zn(null),z.hide();return}let e=ii();e&&Rn()!==e&&(zn(e),z.show())});let di=a(()=>{let e=Z.phase();return e===`creating-order`||e===`quoting`}),fi=a(()=>{let e=Z.phase();return e===`error`?c({id:`1w68n16`,message:`Try Again`})??`Try Again`:e===`creating-order`||e===`quoting`?c({id:`344av8`,message:`Processing...`}):e===`quoted`&&Z.quote()?c({id:`13l4n4r`,message:`Continue via {provider}`},{provider:Z.quote().providerName??bt(Z.quote().provider)}):c({id:`119fv83`,message:`Enter amount`})}),pi=a(()=>Z.phase()===`quoted`&&!!zr()&&!ei()&&!Z.isQuoteFetching()),mi=()=>{let e=Z.phase();e===`error`?Z.handleRetry():e===`quoted`&&pi()&&Z.createOrder()},hi=a(()=>{if(G()&&e.config.amount)return e.config.amount;if(j()===`crypto`)return yr();let t=we(Z.quote());return t?$r(t):``}),gi=a(()=>G()&&e.config.amount?!0:j()===`crypto`?Sr()||X()===`quoting`:!!Z.quote()||Z.phase()===`quoting`),_i=a(()=>{let e=Number(hi()||`0`),t=Er();return!gi()||!Number.isFinite(e)||e<=0||t===null?null:c({id:`188897k`,message:"≈ ${formatUsd}"},{formatUsd:Ye(e*t)})}),vi=e=>{let t=er().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}},yi=async t=>{try{let n=et(t),r=await ue(n.chainId,n.address,e.config.apiEndpoint,U());return typeof r.decimals==`number`?r:null}catch{return null}};s(f(()=>e.config.locale,e=>{e&&b.setLocale(e)})),s(f(()=>e.config.recipient,e=>{P.setRecipient(e??null)})),s(f(()=>e.config.fiatCurrency,e=>{e&&jn(e)})),s(f([()=>e.config.amount,G],([e,t])=>{let n=e??``;P.setInputAmount(n),fr(t?``:n)}));let bi=0;s(f([()=>e.config.fromToken,()=>e.config.apiEndpoint],async([e])=>{let t=++bi;if(!e){P.setFromToken(null);return}let n=await yi(e);t===bi&&P.setFromToken(n)}));let xi=0;s(f([()=>e.config.toToken,()=>e.config.apiEndpoint],async([e])=>{let t=++xi;if(!e){P.setToToken(null);return}let n=await yi(e);t===xi&&P.setToToken(n)}));let Si=0;s(f([()=>e.config.toTokens,()=>e.config.apiEndpoint,er],async([e])=>{let t=++Si;if(!e?.length){Qn([]);return}let n=await Promise.all(e.map(yi));t===Si&&Qn(n.filter(e=>!!e).map(vi))}));let Ci=t=>{P.setInputAmount(t),e.callbacks?.onAmountChanged?.({amount:t,direction:`from`}),P.error()&&Bn(),dr(t)},wi=e=>{ir(e),P.error()&&Bn()},Ti=e=>{let t={chainId:e.chainId,address:e.address??``,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,priceUsd:e.priceUsd};F()===`from`?P.setFromToken(t):P.setToToken(t),I.hide()},Ei=()=>{if(Cr()||!P.fromToken()||!P.toToken())return;let e=P.fromToken(),t=P.toToken();i(()=>{P.setFromToken(t),P.setToToken(e),P.execPhase()===`success`&&P.setExecPhase(null)})},Di=()=>{let e=P.fromToken(),t=cr();if(!e||typeof e.decimals!=`number`||!t||t===`0`)return;let n=le(t,e.decimals);n&&n!==`0`&&Ci(n)},Oi=ke({fields:{cryptoAmount:ot({value:()=>G()?br()??`0`:P.inputAmount(),setValue:e=>{G()||Ci(e)},parse:re,validate:e=>{if(j()!==`crypto`||G())return null;let t=Number(e);return Number.isFinite(t)&&t>0?null:`Enter amount`}}),fiatAmount:ot({value:()=>G()?Z.quote()?.fiatAmount??`0`:Z.fiatAmount(),setValue:e=>{G()||Z.setFiatAmount(e)},parse:re,validate:e=>{if(j()!==`card`||G())return null;let t=Number(e);return Number.isFinite(t)&&t>0?null:`Enter amount`}}),recipient:ot({value:()=>P.recipient()??``,setValue:wi,parse:e=>e.trim(),validate:()=>j()===`crypto`&&tr()||Ur()?`Enter Recipient Address`:null})}}),ki=Oi.field(`cryptoAmount`),Ai=Oi.field(`fiatAmount`),ji=Oi.field(`recipient`),Mi=()=>Oi.validateFields([`cryptoAmount`,`recipient`]),Ni=()=>Oi.validateFields([`fiatAmount`,`recipient`]),Pi=()=>{Mi()&&Pr()},Fi=()=>{Z.phase()===`quoted`&&!Ni()||mi()},Ii=e=>`${e.slice(0,6)}...${e.slice(-4)}`,$=a(()=>{let e=vr();return!e||!P.fromToken()||!P.toToken()?null:X()===`quoting`||Sr()?e:null}),Li=a(()=>Mn()===`quote`?P.error():null),Ri=a(()=>Z.errorSource()===`quote`?Z.error():null),zi=a(()=>Z.phase()===`error`&&Z.errorSource()!==`quote`?Z.error():null),Bi=a(()=>{let e=zi();return e?`card:${e}`:null}),Vi=e=>e===`crypto`?Li():e===`card`?Ri():null,Hi=e=>{let t=Vi(e);return t?`${e}:${t}`:null},Ui=a(()=>Hi(j())),Wi=e=>{let t=Hi(e);return!!t&&t===Pn()},Gi=e=>!K()&&!!Vi(e)&&!Wi(e),Ki=a(()=>!!$()&&!!P.fromToken()&&!!P.toToken()),qi=a(()=>!!Z.quote()),Ji=e=>K()&&(e===`crypto`&&Ki()||e===`card`&&qi()||!!Vi(e)),Yi=e=>{typeof navigator>`u`||!navigator.clipboard||navigator.clipboard.writeText(e).catch(()=>void 0)},Xi=()=>{let e=Ui();e&&Fn(e),L.hide()};s(()=>{L.open()&&!Ji(j())&&L.hide()}),s(()=>{let e=Ui();if(!e){Fn(null);return}!K()||Pn()===e||L.open()||L.show()});let Zi=()=>{let e=Bi();e&&Ln(e),R.hide()},Qi=()=>{Ln(null),R.hide(),Z.handleRetry()};s(()=>{let e=Bi();if(!e){Ln(null),R.open()&&R.hide();return}if(j()!==`card`){R.open()&&R.hide();return}if(!K()){R.open()&&R.hide();return}In()===e||R.open()||R.show()});let $i=a(()=>{let t=e.config.titleText?.trim();return t&&t.length>0?t:`TokenFlight`}),ea=a(()=>{let t=e.config.titleText?.trim();return!!t&&t.length>0}),ta=a(()=>{let t=e.config.titleImageUrl?.trim();return t&&t.length>0?t:null}),na=a(()=>j()===`card`&&(ti()||Z.phase()===`success`)),ra=a(()=>j()===`card`?Z.phase()===`success`&&Z.orderStatus()?`success`:na()?`tracking`:`form`:X()===`success`&&P.order()?`success`:Cr()?`tracking`:`form`);return u(fe,{get class(){return E(()=>!!K())()?O.quoteCardHiddenContainer:void 0},observeKey:()=>[ra(),na()?Z.phase():``,ni()?`fiat-payment-link`:``,K(),e.config.hidePoweredBy].join(`|`),get noBackground(){return e.config.noBackground},get noBorder(){return e.config.noBorder},get"data-quote-card"(){return K()?`hidden`:`visible`},get children(){return u(ge,{form:Oi,get children(){return[u(Ke,{get current(){return ra()},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=qt(),n=t.firstChild,i=n.firstChild,a=i.firstChild;return S(n,u(o,{get when(){return ht()},get children(){var e=Wt(),t=e.firstChild;return w(e,`click`,Vt),w(t,`animationend`,N()===`idle`?void 0:Ht),S(t,u(ye,{size:16})),r(n=>{var r=C(T.backButton,O.headerBackButton,_t()&&T.backButtonExiting),i=c({id:`1hzmxtu`,message:`Back`}),a=N()===`enter`?`${O.headerBackArrow} ${O[`headerBackArrow--enter`]}`:N()===`exit`?`${O.headerBackArrow} ${O[`headerBackArrow--exit`]}`:O.headerBackArrow,o=N()===`idle`?{display:`inline-flex`}:void 0,s=N();return r!==n.e&&v(e,n.e=r),i!==n.t&&y(e,`aria-label`,n.t=i),a!==n.a&&v(t,n.a=a),n.o=x(t,o,n.o),s!==n.i&&y(t,`data-nav-animation`,n.i=s),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),i),S(i,u(o,{get when(){return ta()},get fallback(){return u(o,{get when(){return!e.config.hideTitle},get children(){return u(rt,{size:22})}})},get children(){var t=Gt();return r(n=>{var r=ta(),i=$i(),a=C(O.headerLogoImage,e.config.hideTitle&&O[`headerLogoImage--solo`]);return r!==n.e&&y(t,`src`,n.e=r),i!==n.t&&y(t,`alt`,n.t=i),a!==n.a&&v(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),a),S(a,u(o,{get when(){return ea()},get fallback(){return[`Token`,(()=>{var e=Yt();return r(()=>v(e,O.headerTitleAccent)),e})()]},get children(){return $i()}})),S(t,u(o,{get when(){return E(()=>!!V())()&&H()},get children(){var t=Kt(),n=t.firstChild,i=n.nextSibling;return w(t,`click`,async()=>{e.walletAdapter?.openAccountModal?await e.walletAdapter.openAccountModal():e.callbacks?.onAccountModal?.()}),S(i,()=>Ii(H())),r(e=>{var r=O.headerRight,a=c({id:`xphk5n`,message:`Wallet account`}),o=O.walletDot,s=O.walletAddress;return r!==e.e&&v(t,e.e=r),a!==e.t&&y(t,`aria-label`,e.t=a),o!==e.a&&v(n,e.a=o),s!==e.o&&v(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=C(O.headerBrand,O[`headerBrand--${Lt()}`]),l=Lt(),u=C(O.headerTitle,e.config.hideTitle&&O[`headerTitle--hidden`]);return o!==r.e&&v(t,r.e=o),s!==r.t&&v(n,r.t=s),c!==r.a&&v(i,r.a=c),l!==r.o&&y(i,`data-header-brand-state`,r.o=l),u!==r.i&&v(a,r.i=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})(),(()=>{var i=Jt(),a=i.firstChild;return S(i,u(it,{get current(){return j()},get direction(){return Pt()},height:!0,"data-testid":`method-presence`,children:i=>(()=>{var a=_n();return y(a,`data-method-page`,i),S(a,u(n,{get children(){return[u(t,{when:i===`entry`,get children(){var e=Xt(),t=e.firstChild,n=t.firstChild;return S(n,()=>c({id:`cgzgvn`,message:`Pay with`})),S(e,u(ut,{get hasCrypto(){return Le()},get hasCard(){return Ge()},showExchange:!0,onSelectCrypto:()=>Rt(`crypto`),onSelectCard:()=>Rt(`card`)}),null),r(n=>{var r=O.entryMethodPane,i=O.payWithLabel;return r!==n.e&&v(e,n.e=r),i!==n.t&&v(t,n.t=i),n},{e:void 0,t:void 0}),e}}),u(t,{when:i!==`entry`,get children(){return[(()=>{var a=cn(),s=a.firstChild,l=s.firstChild,d=l.firstChild,f=d.firstChild,p=l.nextSibling,m=p.nextSibling,h=m.firstChild,_=h.firstChild,b=h.nextSibling,x=b.nextSibling,te=x.firstChild,D=te.nextSibling;return S(f,()=>st(`youPay`,c({id:`17kq51m`,message:`You pay`}))),S(d,u(o,{get when(){return E(()=>!!(i===`crypto`&&V()))()&&sr()},get children(){var e=Zt(),t=e.firstChild,n=t.nextSibling;return S(t,()=>c({id:`y6jqu9`,message:`Balance: {fromBalance}`},{fromBalance:sr()})),w(n,`click`,Di),S(n,()=>c({id:`7v6g6x`,message:`MAX`})),r(r=>{var i=O.panelHeaderRight,a=O.panelBalance,o=O.maxBtn;return i!==r.e&&v(e,r.e=i),a!==r.t&&v(t,r.t=a),o!==r.a&&v(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),null),S(l,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return[(()=>{var e=en();return S(e,u(Dt,{field:ki,get disabled(){return Cr()||G()}}),null),S(e,u(o,{get when(){return P.fromToken()},get fallback(){return(()=>{var e=vn(),t=e.firstChild;return w(e,`click`,e=>{k()||Gn(`from`,e.currentTarget)}),S(t,()=>c({id:`zz4mrw`,message:`Select token`})),S(e,u(o,{get when(){return!k()},get children(){var e=Qt();return S(e,u(_e,{size:14})),r(()=>v(e,O.caret)),e}}),null),r(n=>{var r=C(O.tokenBtn,O[`tokenBtn--select`]),i=O.tokenNameAccent;return r!==n.e&&v(e,n.e=r),i!==n.t&&v(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=$t(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return w(e,`click`,e=>{k()||Gn(`from`,e.currentTarget)}),S(t,u(Et,{get symbol(){return P.fromToken().symbol??`?`},color:`#2775CA`,size:24,get logoURI(){return P.fromToken().logoURI}}),n),S(n,u(tt,{size:10,get iconUrl(){return g(W(),P.fromToken().chainId)}})),S(i,()=>P.fromToken().symbol),S(e,u(o,{get when(){return!k()},get children(){var e=Qt();return S(e,u(_e,{size:14})),r(()=>v(e,O.caret)),e}}),null),r(r=>{var a=C(O.tokenBtn,k()&&O[`tokenBtn--locked`]),o=k()?void 0:`button`,s=O.tokenIconWrap,c=O.tokenChainDot,l=O.tokenName;return a!==r.e&&v(e,r.e=a),o!==r.t&&y(e,`role`,r.t=o),s!==r.a&&v(t,r.a=s),c!==r.o&&v(n,r.o=c),l!==r.i&&v(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),r(()=>v(e,O.panelRow)),e})(),(()=>{var e=tn(),t=e.firstChild;return S(t,()=>Dr()??` `),r(n=>{var r=O.panelFooter,i=C(O.fiat,!Dr()&&O[`fiat--hidden`]);return r!==n.e&&v(e,n.e=r),i!==n.t&&v(t,n.t=i),n},{e:void 0,t:void 0}),e})()]}}),u(t,{when:i===`card`,get children(){return[(()=>{var t=nn(),n=t.firstChild,a=n.firstChild;return S(a,Zr),S(n,u(Ie,{field:Ai,get class(){return St.fiatAmountInput},type:`text`,inputMode:`decimal`,placeholder:`0`,get disabled(){return G()},part:`fiat-amount-input`,"data-testid":`fiat-amount-input`}),null),S(t,u(kt,{get currencies(){return Xr()},get selected(){return B()},onSelect:jn,get locked(){return Kr()},get locale(){return e.config.locale},get compactSafe(){return i===`card`&&K()},onOpenChange:e=>An(e&&i===`card`&&K())}),null),r(e=>{var r=O.panelRow,i=St.fiatAmountWrap,o=St.fiatCurrencyPrefix;return r!==e.e&&v(t,e.e=r),i!==e.t&&v(n,e.t=i),o!==e.a&&v(a,e.a=o),e},{e:void 0,t:void 0,a:void 0}),t})(),(()=>{var e=en();return S(e,u(o,{get when(){return Z.quote()},get fallback(){return(()=>{var e=yn();return r(()=>v(e,C(O.fiat,O[`fiat--hidden`]))),e})()},children:e=>(()=>{var t=Qt();return S(t,u(o,{get when(){return e().minFiatAmount},get children(){return[E(()=>c({id:`cx9lh3`,message:`Min`})),`: `,E(()=>Zr()),E(()=>e().minFiatAmount)]}}),null),S(t,u(o,{get when(){return E(()=>!!e().minFiatAmount)()&&e().maxFiatAmount},children:` · `}),null),S(t,u(o,{get when(){return e().maxFiatAmount},get children(){return[E(()=>c({id:`gtvgs9`,message:`Max`})),`: `,E(()=>Zr()),E(()=>e().maxFiatAmount)]}}),null),r(()=>v(t,C(St.fiatLimitsText,ei()&&St.fiatLimitsError))),t})()})),r(()=>v(e,O.panelFooter)),e})()]}})]}}),null),S(p,u(o,{get when(){return E(()=>!e.hideSwapArrow&&i===`crypto`)()&&!A()},get children(){var e=rn();return w(e,`click`,Ei),S(e,u(Ae,{size:13})),r(t=>{var n=O.swapArrowCircle,r=c({id:`2eikro`,message:`Swap tokens`});return n!==t.e&&v(e,t.e=n),r!==t.t&&y(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}})),S(_,()=>st(`youReceive`,c({id:`va18uh`,message:`You receive`}))),S(h,u(o,{get when(){return i===`card`?Gr():P.toToken()&&V()},get children(){var e=an(),t=e.firstChild;return w(e,`click`,e=>!mr()&&qn(e.currentTarget)),S(t,(()=>{var e=E(()=>!!(i===`card`?Wr():rr()));return()=>e()?Ii(i===`card`?Wr():rr()):c({id:`fpand1`,message:`Enter destination address`})})()),S(e,u(o,{get when(){return!mr()},get children(){return u(he,{size:10})}}),null),r(n=>{var r=C(T.recipientBadge,!(i===`card`?Wr():rr())&&T.recipientBadgeEmpty,mr()&&T.recipientBadgeLocked),a=mr(),o=T.recipientBadgeText;return r!==n.e&&v(e,n.e=r),a!==n.t&&(e.disabled=n.t=a),o!==n.a&&v(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),null),S(b,u(o,{get when(){return!(i===`crypto`?wr():Z.phase()===`quoting`)},get fallback(){return(()=>{var e=bn();return r(()=>v(e,T.skeleton)),e})()},get children(){var e=on();return S(e,u(Ze,{get value(){return hi()||`0`},digits:8})),r(()=>v(e,C(ve.amount,!gi()&&ve.muted))),e}}),null),S(b,u(o,{get when(){return P.toToken()},get fallback(){return(()=>{var e=vn(),t=e.firstChild;return w(e,`click`,e=>{A()||Gn(`to`,e.currentTarget)}),S(t,()=>c({id:`zz4mrw`,message:`Select token`})),S(e,u(o,{get when(){return!A()},get children(){var e=Qt();return S(e,u(_e,{size:14})),r(()=>v(e,O.caret)),e}}),null),r(n=>{var r=C(O.tokenBtn,O[`tokenBtn--select`]),i=O.tokenNameAccent;return r!==n.e&&v(e,n.e=r),i!==n.t&&v(t,n.t=i),n},{e:void 0,t:void 0}),e})()},get children(){var e=$t(),t=e.firstChild,n=t.firstChild,i=t.nextSibling;return w(e,`click`,e=>{A()||Gn(`to`,e.currentTarget)}),S(t,u(Et,{get symbol(){return P.toToken().symbol??`?`},color:`#0052FF`,size:24,get logoURI(){return P.toToken().logoURI}}),n),S(n,u(tt,{size:10,get iconUrl(){return g(W(),P.toToken().chainId)}})),S(i,()=>P.toToken().symbol),S(e,u(o,{get when(){return!A()},get children(){var e=Qt();return S(e,u(_e,{size:14})),r(()=>v(e,O.caret)),e}}),null),r(r=>{var a=C(O.tokenBtn,A()&&O[`tokenBtn--locked`]),o=A()?void 0:`button`,s=O.tokenIconWrap,c=O.tokenChainDot,l=O.tokenName;return a!==r.e&&v(e,r.e=a),o!==r.t&&y(e,`role`,r.t=o),s!==r.a&&v(t,r.a=s),c!==r.o&&v(n,r.o=c),l!==r.i&&v(i,r.i=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}}),null),S(te,()=>_i()??` `),S(D,u(o,{get when(){return i===`crypto`&&X()===`quoted`},get children(){return u(Se,{secondsRemaining:Lr,totalSeconds:30,onRefresh:()=>J.refetch(),isRefreshing:()=>J.isFetching})}}),null),S(D,u(o,{get when(){return i===`card`&&Z.phase()===`quoted`},get children(){return u(Se,{get secondsRemaining(){return Vr.countdownSeconds},totalSeconds:30,onRefresh:()=>{Z.refetchQuote(),Vr.resetCountdown()},get isRefreshing(){return Z.isQuoteFetching}})}}),null),S(D,u(o,{get when(){return Ji(i)},get children(){var e=sn();return w(e,`click`,()=>L.show()),S(e,u(At,{size:13})),r(t=>{var n=O.quoteDetailsTrigger,r=c({id:`tbygoy`,message:`View quote details`});return n!==t.e&&v(e,t.e=n),r!==t.t&&y(e,`aria-label`,t.t=r),t},{e:void 0,t:void 0}),e}}),null),r(e=>{var t=O.panelWrapper,n=kn()?`40`:void 0,r=O.mergedPanel,i=O.mergedSection,o=O.panelHeader,c=O.panelLabel,u=O.panelDivider,g=O.mergedSection,y=O.panelHeader,S=O.panelLabel,w=O.panelRow,T=O.panelFiatRow,E=C(O.fiat,!_i()&&O[`fiat--hidden`]),ne=O.quotePanelActions;return t!==e.e&&v(a,e.e=t),n!==e.t&&ee(a,`z-index`,e.t=n),r!==e.a&&v(s,e.a=r),i!==e.o&&v(l,e.o=i),o!==e.i&&v(d,e.i=o),c!==e.n&&v(f,e.n=c),u!==e.s&&v(p,e.s=u),g!==e.h&&v(m,e.h=g),y!==e.r&&v(h,e.r=y),S!==e.d&&v(_,e.d=S),w!==e.l&&v(b,e.l=w),T!==e.u&&v(x,e.u=T),E!==e.c&&v(te,e.c=E),ne!==e.w&&v(D,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 E(()=>!!Gi(i))()&&Li()},children:e=>u(Sn,{get message(){return e()},variant:`crypto`,onCopy:Yi})}),u(o,{get when(){return E(()=>!K())()&&wr()},get children(){var e=en();return S(e,u(Be,{})),r(()=>v(e,T.fadeIn)),e}}),u(o,{get when(){return E(()=>!!(!K()&&$()&&P.fromToken()))()&&P.toToken()},get children(){var e=ln();return S(e,u(Re,{get route(){return $()},get fromToken(){return P.fromToken()},get toToken(){return P.toToken()},inline:!0})),r(()=>v(e,xe.quote)),e}}),u(o,{get when(){return E(()=>!!xr())()&&!wr()},get children(){var e=un(),t=e.firstChild;return S(t,()=>c({id:`ln9xiv`,message:`No routes available`})),r(n=>{var r=C(K()?O.compactQuoteStatus:O.noRoutesCard,T.fadeIn),i=T.noOfferText;return r!==n.e&&v(e,n.e=r),i!==n.t&&v(t,n.t=i),n},{e:void 0,t:void 0}),e}}),u(o,{get when(){return E(()=>!K()&&!Li()&&!wr()&&!$())()&&!xr()},get children(){var e=dn(),t=e.firstChild,n=t.nextSibling;return S(t,u(Ae,{size:16})),S(n,()=>c({id:`1olegnl`,message:`Enter amount to get started`})),r(r=>{var i=C(St.quoteCardSlotCard,O.idleCardInline,T.fadeIn),a=T.idleIcon,o=T.idleTitle;return i!==r.e&&v(e,r.e=i),a!==r.t&&v(t,r.t=a),o!==r.a&&v(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}})]}}),u(t,{get when(){return E(()=>!!(Ur()&&!Ri()))()&&!K()},get children(){var e=fn(),t=e.firstChild,n=t.nextSibling,i=n.nextSibling;return S(t,u(Fe,{size:20})),S(n,()=>c({id:`fpand1`,message:`Enter destination address`})),S(i,()=>c({id:`19ne1ha`,message:`Connect wallet or enter an address to get a quote`})),r(r=>{var a=C(St.quoteCardSlotCard,O.recipientGateCard,T.fadeIn),o=T.idleIcon,s=T.idleTitle,c=T.idleSub;return a!==r.e&&v(e,r.e=a),o!==r.t&&v(t,r.t=o),s!==r.a&&v(n,r.a=s),c!==r.o&&v(i,r.o=c),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),u(t,{get when(){return E(()=>i===`card`&&!K())()&&zi()},children:e=>u(Sn,{get message(){return e()},get title(){return c({id:`jssk7y`,message:`Payment Failed`})},variant:`card`,onCopy:Yi})}),u(t,{get when(){return E(()=>!!(i===`card`&&Gi(i)))()&&Ri()},children:e=>u(Sn,{get message(){return e()},variant:`card`,onCopy:Yi})}),u(t,{get when(){return E(()=>i===`card`&&Z.phase()!==`error`)()&&!K()},get children(){return u(Pe,{fiatCheckout:Z,fiatCountdown:Vr,get targetToken(){return P.toToken()??null},get fiatCurrency(){return B()},get apiBase(){return W()},get showPayAmount(){return G()},hideCountdown:!0,onCompareProviders:()=>Tn.show()})}})]}}),(()=>{var e=gn();return S(e,u(n,{get children(){return[u(t,{when:i===`crypto`,get children(){return u($e,{get phase(){return X()},get isConnected(){return V()},get hasQuote(){return Sr()},onConnect:Vn,onConfirm:Pi,onRetry:Rr,get errorLabel(){return E(()=>Mn()===`quote`)()?c({id:`1w68n16`,message:`Try Again`}):P.error()??void 0},get needsRecipient(){return tr()},onEnterRecipient:()=>qn(),get insufficientBalance(){return lr()}})}}),u(t,{when:i===`card`,get children(){return u(n,{get children(){return[u(t,{get when(){return Z.phase()===`error`},get children(){var e=pn();return w(e,`click`,Fi),S(e,fi),r(()=>v(e,M.btnPrimary)),e}}),u(t,{get when(){return di()},get children(){var e=mn(),t=e.firstChild,n=t.firstChild;return S(t,fi,null),r(r=>{var i=C(M.btnPrimary,M.executing),a=M.btnInner,o=M.spinner;return i!==r.e&&v(e,r.e=i),a!==r.t&&v(t,r.t=a),o!==r.a&&v(n,r.a=o),r},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return E(()=>!P.toToken())()&&(!!Z.fiatAmount()||G())},get children(){var e=pn();return w(e,`click`,e=>{Hn(e.currentTarget),Cn(`to`),I.show()}),S(e,()=>c({id:`zz4mrw`,message:`Select token`})),r(()=>v(e,M.btnRecipient)),e}}),u(t,{get when(){return Ur()},get children(){var e=pn();return w(e,`click`,e=>qn(e.currentTarget)),S(e,()=>c({id:`wx5bee`,message:`Enter Recipient Address`})),r(()=>v(e,M.btnRecipient)),e}}),u(t,{get when(){return pi()},get children(){var e=pn();return w(e,`click`,Fi),S(e,fi),r(()=>v(e,M.btnPrimary)),e}}),u(t,{when:!0,get children(){var e=hn();return S(e,fi),r(()=>v(e,M.btnPrimary)),e}})]}})}})]}})),r(()=>v(e,C(T.ctaWrapper,K()&&O.compactCtaWrapper))),e})()]}})]}})),a})()}),a),S(a,u(o,{get when(){return!e.config.hidePoweredBy},get children(){return u(We,{})}})),r(t=>{var n=C(O.methodFrame,K()&&O[`methodFrame--compact`],e.config.hidePoweredBy&&O[`methodFrame--footerHidden`]),r=K()?`hidden`:`visible`,o=e.config.hidePoweredBy?`hidden`:`visible`,s=C(T.footerSlot,O.methodFooterSlot),c=e.config.hidePoweredBy?`true`:`false`;return n!==t.e&&v(i,t.e=n),r!==t.t&&y(i,`data-quote-card-frame`,t.t=r),o!==t.a&&y(i,`data-powered-footer-frame`,t.a=o),s!==t.o&&v(a,t.o=s),c!==t.i&&y(a,`data-powered-footer-hidden`,t.i=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i})()]}}),u(t,{when:i===`tracking`,get children(){return u(n,{get children(){return[u(t,{get when(){return j()===`card`},get children(){return u(ft,{get phase(){return Z.phase()},get status(){return Z.orderStatus()?.status??`pending_payment`},get strategy(){return Z.strategy()??Z.orderStatus()?.swapStrategy??`direct`},get fiatAmount(){return oi()},get fiatCurrency(){return B()},get cryptoAmount(){return $r(gt({status:Z.orderStatus(),quote:Z.quote()}))},get targetToken(){return P.toToken()},get provider(){return Z.orderStatus()?.provider??Z.quote()?.provider??`transak`},get hideProvider(){return e.config.hideProvider},get transferTxHash(){return Z.orderStatus()?.fillTxHash??Z.orderStatus()?.transferTxHash},get failedReason(){return lt(Z.orderStatus())},get apiBase(){return W()},get chainMap(){return er()},get paymentLinkAvailable(){return ni()},get paymentLinkOpen(){return z.open()},onPaymentLinkToggle:ui,get cancelAvailable(){return ri()},onCancelPayment:()=>Z.cancelPayment(),onNewPurchase:()=>Z.handleNewPurchase(),onRetry:()=>Z.handleRetry()})}}),u(t,{when:!0,get children(){return u(wt,{get order(){return P.order()},get fromToken(){return P.fromToken()},get toToken(){return P.toToken()},get providerName(){return Ar()},get providerIcon(){return jr()},get hideProvider(){return e.config.hideProvider},get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get inputAmount(){return P.inputAmount()},get outputAmount(){return yr()},onNewSwap:Ir,onRetry:Fr,get executionError(){return Mr()},mode:`swap`,get phase(){return X()},get failedPhase(){return Nr()},get chainMap(){return er()}})}})]}})}}),u(t,{when:i===`success`,get children(){return u(n,{get children(){return[u(t,{get when(){return E(()=>j()===`card`)()&&Q()},get children(){return u(Te,{get orderStatus(){return Q().orderStatus},get fiatAmount(){return Q().fiatAmount},get fiatCurrency(){return Q().fiatCurrency},get targetToken(){return Q().targetToken},get tokenDecimals(){return Q().tokenDecimals},get quote(){return Q().quote},get provider(){return Q().provider},get apiBase(){return W()},get chainMap(){return er()},onNewPurchase:()=>Z.handleNewPurchase()})}}),u(t,{when:!0,get children(){return u(mt,{get order(){return P.order()},get fromToken(){return P.fromToken()},get toToken(){return P.toToken()},onNewSwap:Ir,get apiEndpoint(){return e.config.apiEndpoint??`https://api.hyperstream.dev`},get providerName(){return Ar()},mode:`swap`,get chainMap(){return er()}})}})]}})}})]}})}),u(Me,{drawer:z,when:()=>!!Z.directWidgetUrl(),get children(){return u(He,{drawer:z,get url(){return Z.directWidgetUrl()},get provider(){return ai()},onClose:()=>z.hide(),get noChrome(){return q()}})}}),u(Me,{drawer:I,get children(){return u(be,{drawer:I,get selectingFor(){return F()},get noBorder(){return e.config.noBorder},get noChrome(){return q()},get children(){return u(o,{get when(){return En()},get fallback(){return u(je,{get selectingFor(){return F()},onClose:Wn})},get children(){return u(l,{get fallback(){return u(je,{get selectingFor(){return F()},onClose:Wn})},get children(){return u(Oe,{get client(){return U()},get walletAddress(){return H()},get selectingFor(){return F()},onSelect:Ti,onClose:Wn,get supportedChainIds(){return e.walletAdapter?.supportedChainIds},get allowedTokens(){return E(()=>F()===`from`)()?Yn():Xn()},get tokens(){return E(()=>!!(F()===`to`&&Zn().length))()?Zn():void 0},get noBorder(){return e.config.noBorder},get dismissing(){return I.dismissing()}})}})}})}})}}),u(Me,{drawer:wn,when:()=>!!P.toToken(),get children(){return u(De,{drawer:wn,get noChrome(){return q()},get children(){return u(at,{get initialValue(){return ji.value()||nr()||``},get chainType(){return ce(P.toToken().chainId)},onConfirm:e=>{ji.setValue(e),ji.markTouched(),wn.hide()},onClose:()=>wn.hide(),get noChrome(){return q()},get dismissing(){return wn.dismissing()}})}})}}),u(Me,{drawer:L,get children(){return u(de,{drawer:L,get label(){return c({id:`1tn6f91`,message:`Quote details`})},backdrop:`strong`,get noChrome(){return q()},get class(){return C(O.quoteDetailsSheet,q()&&O.drawerSheetNoChrome)},testId:`quote-details-sheet`,part:`quote-details-sheet`,get children(){return[u(Ue,{get class(){return O.quoteDetailsClose},onClose:Xi,get ariaLabel(){return c({id:`1l0xxoj`,message:`Close`})},testId:`quote-details-close`,get children(){return u(Ot,{size:17})}}),u(Ve,{get class(){return O.quoteDetailsBody},get children(){return u(n,{get children(){return[u(t,{get when(){return Vi(j())},children:e=>u(Sn,{get message(){return e()},variant:`sheet`,onCopy:Yi,get onRetry(){return E(()=>j()===`card`)()?Z.handleRetry:Rr}})}),u(t,{get when(){return E(()=>!!(j()===`crypto`&&$()&&P.fromToken()))()&&P.toToken()},get children(){var e=Ut(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return S(n,()=>c({id:`1nvxkfy`,message:`Route`})),S(i,()=>$().routeId),S(e,u(Re,{get route(){return $()},get fromToken(){return P.fromToken()},get toToken(){return P.toToken()},inline:!0}),null),r(n=>{var r=O.quoteDetailsCard,a=O.quoteDetailsMetaRow,o=O.quoteDetailsMetaValue;return r!==n.e&&v(e,n.e=r),a!==n.t&&v(t,n.t=a),o!==n.a&&v(i,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}}),u(t,{get when(){return E(()=>j()===`card`)()&&Z.quote()},get children(){return u(Pe,{fiatCheckout:Z,fiatCountdown:Vr,get targetToken(){return P.toToken()??null},get fiatCurrency(){return B()},get apiBase(){return W()},get showPayAmount(){return G()},hideCountdown:!0,margin:`0`,height:`auto`,onCompareProviders:()=>Tn.show()})}})]}})}})]}})}}),u(Me,{drawer:R,when:()=>K()&&!!zi(),get children(){return u(de,{drawer:R,get label(){return c({id:`jssk7y`,message:`Payment Failed`})},backdrop:`strong`,get noChrome(){return q()},get class(){return C(O.quoteDetailsSheet,q()&&O.drawerSheetNoChrome)},testId:`payment-error-sheet`,part:`payment-error-sheet`,get children(){return[u(Ue,{get class(){return O.quoteDetailsClose},onClose:Zi,get ariaLabel(){return c({id:`1l0xxoj`,message:`Close`})},testId:`payment-error-close`,get children(){return u(Ot,{size:17})}}),u(Ve,{get class(){return O.quoteDetailsBody},get children(){return u(Sn,{get message(){return zi()},get title(){return c({id:`jssk7y`,message:`Payment Failed`})},variant:`sheet`,onCopy:Yi,onRetry:Qi})}})]}})}}),u(Me,{drawer:Tn,get children(){return u(de,{drawer:Tn,get label(){return c({id:`118a77s`,message:`Select Fiat Provider`})},backdrop:`strong`,get noChrome(){return q()},get children(){return u(zt,{get quotes(){return Z.allQuotes()},get selectedProviderId(){return Z.selectedProviderId()},get fiatCurrency(){return B()},get apiBase(){return W()},get tokenDecimals(){return Qr()},get targetSymbol(){return P.toToken()?.symbol??``},get countdownSeconds(){return Vr.countdownSeconds},totalCountdownSeconds:30,onRefresh:()=>{Z.refetchQuote(),Vr.resetCountdown()},get isRefreshing(){return Z.isQuoteFetching},onSelect:e=>{Z.setSelectedProvider(e),Tn.hide()},onClose:()=>Tn.hide(),get noChrome(){return q()}})}})}})]}})}})}export{F as SwapComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./dist-D3Q09jyE.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.d.ts
CHANGED
|
@@ -145,6 +145,8 @@ declare interface FiatIframeBridge {
|
|
|
145
145
|
requestPreOpenPopup: () => void;
|
|
146
146
|
/** Ask the host to navigate the pre-opened popup to the wrapper URL. */
|
|
147
147
|
requestNavigatePopup: (url: string, orderId: string) => void;
|
|
148
|
+
/** Ask the host to close the active fiat popup for this order, or the unbound pre-opened popup. */
|
|
149
|
+
requestClosePopup: (orderId: string | null) => void;
|
|
148
150
|
/**
|
|
149
151
|
* Subscribe to popup-closed notifications forwarded from the host bridge.
|
|
150
152
|
* Returns an unsubscribe function. The handler receives the orderId the host
|
|
@@ -152,6 +154,12 @@ declare interface FiatIframeBridge {
|
|
|
152
154
|
* against the current `orderId()` signal.
|
|
153
155
|
*/
|
|
154
156
|
onPopupClosed: (handler: (closedOrderId: string) => void) => () => void;
|
|
157
|
+
/**
|
|
158
|
+
* Subscribe to popup-blocked notifications forwarded from the host bridge.
|
|
159
|
+
* Blocked means the payment popup never opened, so checkout should show the
|
|
160
|
+
* manual payment handoff instead of treating it as user cancel.
|
|
161
|
+
*/
|
|
162
|
+
onPopupBlocked: (handler: (blockedOrderId: string) => void) => () => void;
|
|
155
163
|
/**
|
|
156
164
|
* Subscribe to provider terminal events forwarded from the host bridge.
|
|
157
165
|
* Returns an unsubscribe function. The host installs its own
|
|
@@ -185,7 +193,7 @@ declare interface ForwardedFiatProviderEvent {
|
|
|
185
193
|
export declare function getHostOrigin(): string | null;
|
|
186
194
|
|
|
187
195
|
/** Union of all Host → iframe messages. */
|
|
188
|
-
export declare type HostToIframeMessage = TfInitMessage | TfSetConfigMessage | TfSetStyleMessage | TfWalletStateMessage | TfSignResultMessage | TfFiatPopupClosedMessage | TfFiatProviderEventMessage;
|
|
196
|
+
export declare type HostToIframeMessage = TfInitMessage | TfSetConfigMessage | TfSetStyleMessage | TfWalletStateMessage | TfSignResultMessage | TfFiatPopupClosedMessage | TfFiatPopupBlockedMessage | TfFiatProviderEventMessage;
|
|
189
197
|
|
|
190
198
|
/**
|
|
191
199
|
* Wallet adapter that runs inside the widget iframe and proxies all
|
|
@@ -238,6 +246,8 @@ export declare class IframeReceiver {
|
|
|
238
246
|
private lastReportedHeight;
|
|
239
247
|
/** Subscribers to forwarded popup-closed events (set by useFiatCheckout in bridge mode). */
|
|
240
248
|
private readonly popupClosedHandlers;
|
|
249
|
+
/** Subscribers to forwarded popup-blocked events (set by useFiatCheckout in bridge mode). */
|
|
250
|
+
private readonly popupBlockedHandlers;
|
|
241
251
|
/** Subscribers to forwarded provider terminal events (also useFiatCheckout). */
|
|
242
252
|
private readonly providerEventHandlers;
|
|
243
253
|
constructor(hostOrigin: string, callbacks: IframeReceiverCallbacks);
|
|
@@ -254,6 +264,8 @@ export declare class IframeReceiver {
|
|
|
254
264
|
requestPreOpenPopup(): void;
|
|
255
265
|
/** Request the host to navigate the popup to a URL (fiat flow). */
|
|
256
266
|
requestNavigatePopup(url: string, orderId: string): void;
|
|
267
|
+
/** Request the host to close the active fiat popup for an order. */
|
|
268
|
+
requestClosePopup(orderId: string | null): void;
|
|
257
269
|
/** Clean up all listeners and observers. */
|
|
258
270
|
destroy(): void;
|
|
259
271
|
private handleMessage;
|
|
@@ -270,6 +282,8 @@ export declare interface IframeReceiverCallbacks {
|
|
|
270
282
|
onStyleUpdate: (style: StyleOverrides) => void;
|
|
271
283
|
/** Called on tf:fiatPopupClosed — used by fiat checkout in iframe mode. */
|
|
272
284
|
onFiatPopupClosed?: (orderId: string) => void;
|
|
285
|
+
/** Called on tf:fiatPopupBlocked — used by fiat checkout fallback in iframe mode. */
|
|
286
|
+
onFiatPopupBlocked?: (orderId: string) => void;
|
|
273
287
|
/**
|
|
274
288
|
* Called on tf:fiatProviderEvent — host bridge forwards a provider terminal
|
|
275
289
|
* event from the popup wrapper page so the widget can drive `paymentOutcome`.
|
|
@@ -278,7 +292,7 @@ export declare interface IframeReceiverCallbacks {
|
|
|
278
292
|
}
|
|
279
293
|
|
|
280
294
|
/** Union of all iframe → Host messages. */
|
|
281
|
-
export declare type IframeToHostMessage = TfReadyMessage | TfSignRequestMessage | TfConnectWalletMessage | TfDisconnectWalletMessage | TfEventMessage | TfResizeMessage | TfPreOpenPopupMessage | TfNavigatePopupMessage;
|
|
295
|
+
export declare type IframeToHostMessage = TfReadyMessage | TfSignRequestMessage | TfConnectWalletMessage | TfDisconnectWalletMessage | TfEventMessage | TfResizeMessage | TfPreOpenPopupMessage | TfNavigatePopupMessage | TfCloseFiatPopupMessage;
|
|
282
296
|
|
|
283
297
|
/** Check if the current window is running inside an iframe. */
|
|
284
298
|
export declare function isIframeMode(): boolean;
|
|
@@ -388,6 +402,11 @@ export declare const TF_PROTOCOL_VERSION = 1;
|
|
|
388
402
|
/** Union of all bridge messages (both directions). */
|
|
389
403
|
export declare type TfBridgeMessage = HostToIframeMessage | IframeToHostMessage;
|
|
390
404
|
|
|
405
|
+
/** Request host to close the active fiat payment popup for this order, or the unbound pre-opened popup. */
|
|
406
|
+
declare type TfCloseFiatPopupMessage = TfMessageEnvelope<"closeFiatPopup", {
|
|
407
|
+
orderId: string | null;
|
|
408
|
+
}>;
|
|
409
|
+
|
|
391
410
|
/** Request host to trigger wallet connection. */
|
|
392
411
|
export declare type TfConnectWalletMessage = TfMessageEnvelope<"connectWallet", {
|
|
393
412
|
chainType?: ChainType;
|
|
@@ -405,6 +424,11 @@ export declare type TfEventMessage = TfMessageEnvelope<"event", {
|
|
|
405
424
|
data: unknown;
|
|
406
425
|
}>;
|
|
407
426
|
|
|
427
|
+
/** Notify widget that the fiat popup could not be opened by the host browser. */
|
|
428
|
+
declare type TfFiatPopupBlockedMessage = TfMessageEnvelope<"fiatPopupBlocked", {
|
|
429
|
+
orderId: string;
|
|
430
|
+
}>;
|
|
431
|
+
|
|
408
432
|
/** Notify widget that the fiat popup was closed by the user. */
|
|
409
433
|
export declare type TfFiatPopupClosedMessage = TfMessageEnvelope<"fiatPopupClosed", {
|
|
410
434
|
orderId: string;
|
|
@@ -557,12 +581,13 @@ export declare class TokenFlightBridge {
|
|
|
557
581
|
private navigatePopup;
|
|
558
582
|
/**
|
|
559
583
|
* Subscribe to provider terminal events arriving on the host window from
|
|
560
|
-
* the popup's wrapper page. Origin-validated against the
|
|
561
|
-
* `fiatApiEndpoint`; filtered by the active `popupOrderId`. Drops
|
|
562
|
-
* that don't match the expected `FiatWidgetEvent` shape.
|
|
584
|
+
* the popup's wrapper page. Origin-validated against the configured or
|
|
585
|
+
* default `fiatApiEndpoint`; filtered by the active `popupOrderId`. Drops
|
|
586
|
+
* messages that don't match the expected `FiatWidgetEvent` shape.
|
|
563
587
|
*/
|
|
564
588
|
private installPopupMessageHandler;
|
|
565
589
|
private closePopup;
|
|
590
|
+
private handleCloseFiatPopup;
|
|
566
591
|
private static readonly WALLET_EVENTS;
|
|
567
592
|
private subscribeWalletEvents;
|
|
568
593
|
private unsubscribeWalletEvents;
|
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-
|
|
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-YKE1uT8W.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};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{t as e}from"./chunk-Dj_sP-dV.js";var t=e(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),n=e((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),r=e((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),i=e(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),a=e(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),o=e((e=>{var t=n().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),s=e((e=>{var t=n().getSymbolSize,r=7;e.getPositions=function(e){let n=t(e);return[[0,0],[n-r,0],[0,n-r]]}})),c=e((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),l=e((e=>{var t=r(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}}})),u=e((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),d=e((e=>{var t=u();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),f=e(((e,t)=>{var n=d();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),p=e((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),m=e((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
|
+
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),h=e((e=>{var t=p(),n=m();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),g=e((e=>{var t=n(),i=l(),a=r(),o=h(),s=p(),c=7973,u=t.getBCHDigit(c);function d(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function f(e,t){return o.getCharCountIndicator(e,t)+4}function m(e,t){let n=0;return e.forEach(function(e){let r=f(e.mode,t);n+=r+e.getBitsLength()}),n}function g(t,n){for(let r=1;r<=40;r++)if(m(t,r)<=e.getCapacity(r,n,o.MIXED))return r}e.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,r){if(!s.isValid(e))throw Error(`Invalid QR Code version`);r===void 0&&(r=o.BYTE);let a=(t.getSymbolTotalCodewords(e)-i.getTotalCodewordsCount(e,n))*8;if(r===o.MIXED)return a;let c=a-f(r,e);switch(r){case o.NUMERIC:return Math.floor(c/10*3);case o.ALPHANUMERIC:return Math.floor(c/11*2);case o.KANJI:return Math.floor(c/13);case o.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,r=a.from(t,a.M);if(Array.isArray(e)){if(e.length>1)return g(e,r);if(e.length===0)return 1;n=e[0]}else n=e;return d(n.mode,n.getLength(),r)},e.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-u>=0;)n^=c<<t.getBCHDigit(n)-u;return e<<12|n}})),_=e((e=>{var t=n(),r=1335,i=21522,a=t.getBCHDigit(r);e.getEncodedBits=function(e,n){let o=e.bit<<3|n,s=o<<10;for(;t.getBCHDigit(s)-a>=0;)s^=r<<t.getBCHDigit(s)-a;return(o<<10|s)^i}})),v=e(((e,t)=>{var n=h();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),y=e(((e,t)=>{var n=h(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),b=e(((e,t)=>{t.exports=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(i-55296)*1024+a-56320+65536,r+=1)}if(i<128){t.push(i);continue}if(i<2048){t.push(i>>6|192),t.push(i&63|128);continue}if(i<55296||i>=57344&&i<65536){t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128);continue}if(i>=65536&&i<=1114111){t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(i&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}})),x=e(((e,t)=>{var n=b(),r=h();function i(e){this.mode=r.BYTE,typeof e==`string`&&(e=n(e)),this.data=new Uint8Array(e)}i.getBitsLength=function(e){return e*8},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=i})),S=e(((e,t)=>{var r=h(),i=n();function a(e){this.mode=r.KANJI,this.data=e}a.getBitsLength=function(e){return e*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=i.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=a})),C=e(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e=e||{},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),w=e((e=>{var t=h(),r=v(),i=y(),a=x(),o=S(),s=m(),c=n(),l=C();function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function f(e){let n=d(s.NUMERIC,t.NUMERIC,e),r=d(s.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return c.isKanjiModeEnabled()?(i=d(s.BYTE,t.BYTE,e),a=d(s.KANJI,t.KANJI,e)):(i=d(s.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function p(e,n){switch(n){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return i.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return a.getBitsLength(e)}}function g(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function _(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:u(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:u(i.data)}])}}return n}function b(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=p(r[o].lastCount+l.length,l.mode)-p(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=p(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function w(e,n){let s,l=t.getBestModeForData(e);if(s=t.from(n,l),s!==t.BYTE&&s.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(s)+`.
|
|
4
|
+
Suggested mode is: `+t.toString(l));switch(s===t.KANJI&&!c.isKanjiModeEnabled()&&(s=t.BYTE),s){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new i(e);case t.KANJI:return new o(e);case t.BYTE:return new a(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(w(t,null)):t.data&&e.push(w(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=b(_(f(t,c.isKanjiModeEnabled())),n),i=l.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(g(a))},e.rawSplit=function(t){return e.fromArray(f(t,c.isKanjiModeEnabled()))}})),T=e((e=>{var t=n(),u=r(),d=i(),p=a(),m=o(),v=s(),y=c(),b=l(),x=f(),S=g(),C=_(),T=h(),E=w();function D(e,t){let n=e.size,r=v.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function O(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function k(e,t){let n=m.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function A(e,t){let n=e.size,r=S.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function j(e,t,n){let r=e.size,i=C.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function M(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function N(e,n,r){let i=new d;r.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),T.getCharCountIndicator(t.mode,e)),t.write(i)});let a=(t.getSymbolTotalCodewords(e)-b.getTotalCodewordsCount(e,n))*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);let o=(a-i.getLengthInBits())/8;for(let e=0;e<o;e++)i.put(e%2?17:236,8);return P(i,e,n)}function P(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-b.getTotalCodewordsCount(n,r),o=b.getBlocksCount(n,r),s=o-i%o,c=Math.floor(i/o),l=Math.floor(a/o),u=l+1,d=c-l,f=new x(d),p=0,m=Array(o),h=Array(o),g=0,_=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?l:u;m[e]=_.slice(p,p+t),h[e]=f.encode(m[e]),p+=t,g=Math.max(g,t)}let v=new Uint8Array(i),y=0,S,C;for(S=0;S<g;S++)for(C=0;C<o;C++)S<m[C].length&&(v[y++]=m[C][S]);for(S=0;S<d;S++)for(C=0;C<o;C++)v[y++]=h[C][S];return v}function F(e,n,r,i){let a;if(Array.isArray(e))a=E.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=E.rawSplit(e);t=S.getBestVersionForData(n,r)}a=E.fromString(e,t||40)}else throw Error(`Invalid data`);let o=S.getBestVersionForData(a,r);if(!o)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=o;else if(n<o)throw Error(`
|
|
5
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
6
|
+
Minimum version required to store current data is: `+o+`.
|
|
7
|
+
`);let s=N(n,r,a),c=new p(t.getSymbolSize(n));return D(c,n),O(c),k(c,n),j(c,r,0),n>=7&&A(c,n),M(c,s),isNaN(i)&&(i=y.getBestMask(c,j.bind(null,c,r))),y.applyMask(i,c),j(c,r,i),{modules:c,version:n,errorCorrectionLevel:r,maskPattern:i,segments:a}}e.create=function(e,n){if(e===void 0||e===``)throw Error(`No input text`);let r=u.M,i,a;return n!==void 0&&(r=u.from(n.errorCorrectionLevel,u.M),i=S.from(n.version),a=y.from(n.maskPattern),n.toSJISFunc&&t.setToSJISFunction(n.toSJISFunc)),F(e,i,r,a)}})),E=e((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),D=e((e=>{var t=E();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||(i={});let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),O=e((e=>{var t=E();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
8
|
+
`;return typeof a==`function`&&a(null,p),p}})),k=e((e=>{var n=t(),r=T(),i=D(),a=O();function o(e,t,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!n())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=t,t=a=void 0):c===3&&(t.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=t,t=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=t,t=a=void 0):c===2&&!t.getContext&&(a=i,i=t,t=void 0),new Promise(function(n,o){try{n(e(r.create(i,a),t,a))}catch(e){o(e)}})}try{let n=r.create(i,a);o(null,e(n,t,a))}catch(e){o(e)}}e.create=r.create,e.toCanvas=o.bind(null,i.render),e.toDataURL=o.bind(null,i.renderToDataURL),e.toString=o.bind(null,function(e,t,n){return a.render(e,n)})}));export default k();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{c as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function t(t,n){e(t,n),n.add(t)}function n(t,n,r){e(t,n),n.set(t,r)}function r(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function i(e,t){return e.get(r(e,t))}function a(e,t,n){return e.set(r(e,t),n),n}export{t as a,n as i,i as n,r,a as t};
|
|
@@ -0,0 +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-rc.4`}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
|
+
`);for(;a!==-1;){let e=r.slice(0,a).trim();r=r.slice(a+1),e&&(yield ke(e)),a=r.indexOf(`
|
|
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=`Search results`,m=`Tokens delivered to your wallet`,h=`You pay`,g=`Your tokens have been delivered`,_=e=>`≈ $${e.formatUsd}`,v=`Recipient Address`,y=`Confirm`,b=`Connect your wallet to see payment options`,x=`No tokens found`,S=`Connect wallet or enter an address to get a quote`,C=`Confirm in your wallet...`,w=`Refund tx`,T=e=>`Buy ${e.amt} ${e.sym}`,E=`Exchange`,D=`Swapping via DEX...`,O=`Transaction failed — Retry`,k=`No filler accepted the order`,A=`Back`,ne=`Pay`,j=`Executing...`,M=`Select destination token`,N=e=>`Filled on ${e.chain}`,P=`Payment confirmed`,re=`Buy`,F=`Close`,I=`Payment QR code`,L=`No offer available`,R=`Refund in progress`,z=e=>`Deposit on ${e.chain}`,B=`Route`,V=`Crypto`,H=`Signed in wallet`,U=`Order failed`,W=`Enter amount to get started`,G=`Recipient`,K=e=>`≈ $${e.addThousandsSeparator}`,q=`Buy with credit or debit card`,J=`View All Chains`,Y=`Swap`,X=`Sender`,Z=`Processing your order...`,Q=`Select payment token`,ie=e=>`Via ${e.provider}`,ae=`Quote details`,oe=`Total fee`,se=`Paid`,ce=`Try Again`,le=`Review Swap`,ue=`Provider filling your order`,de=`Swapping tokens`,fe=`Your tokens`,pe=e=>`Returning tokens on ${e.chain}`,me=`Card`,he=`Swap tokens`,ge=`Copy error`,_e=`Fiat payment`,ve=`Processing...`,ye=`Purchase failed`,be=`New Purchase`,xe=`This browser cannot open the payment window. Scan the QR code or copy the link to continue.`,Se=`Pay with credit or debit card`,$=`Confirmed on-chain`,Ce=`Sign in wallet`,we=`From`,Te=`Required to receive your tokens`,Ee=`MAX`,De=`Fee`,Oe=`Could not be completed`,ke=`Copy link`,Ae=`Top tokens`,je=`Fill tx`,Me=e=>`Delivered in ${e.seconds}s`,Ne=`Pay with`,Pe=`Swap Successful`,Fe=`Tokens delivered`,Ie=`Receive`,Le=`Min`,Re=`Search by name or address`,ze=e=>`~${e.value}s`,Be=`0`,Ve=`Provider`,He=`Est. time`,Ue=`Insufficient balance`,We=`Invalid address for this chain`,Ge=`Enter destination address`,Ke=`No tokens available`,qe=`Open payment link`,Je=`Max`,Ye=`Transfer tx`,Xe=`Confirm Swap`,Ze=`This token is not directly available for card purchase. We buy USDC first, then swap it to your desired token automatically.`,Qe=`Quote Failed`,$e=e=>`Compare ${e.count} more providers`,et=e=>`Buy ${e.arg0} directly`,tt=`Payment Failed`,nt=e=>`on ${e.chain}`,rt=e=>`~${e.value}m`,it=`No routes available`,at=`Tokens Landed!`,ot=`Awaiting payment`,st=e=>`Routed through ${e.token} for the best rate`,ct=`New Swap`,lt=`Enter recipient address`,ut=`Wallet doesn't match source chain`,dt=`View`,ft=`BEST RATE`,pt=`Your order could not be completed.`,mt=e=>`Delivering ${e.symbol} to your wallet...`,ht=`Your funds have been returned to your wallet.`,gt=`View quote details`,_t=`Signature submitted`,vt=`Deposit tx`,yt=`Connect Wallet`,bt=`Pay with tokens from your wallet`,xt=`Cancel order`,St=`You receive`,Ct=`Purchase Complete`,wt=`Selected token is unavailable for this purchase`,Tt=`Enter Recipient Address`,Et=`Recommended`,Dt=`Wallet account`,Ot=e=>`Balance: ${e.fromBalance}`,kt=`Purchase complete`,At=`Retry`,jt=`Select token`,Mt={"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,"15bw477":p,"1685rko":m,"17kq51m":h,"17wtaao":g,"188897k":_,"18cmny0":v,"18tbqwf":y,"18y1lrp":b,"19is1h8":x,"19ne1ha":S,"1bze7sg":C,"1c5n7ll":w,"1cei180":T,"1dyojgg":E,"1g8tdk7":D,"1hb73om":O,"1hdpo6q":k,"1hzmxtu":A,"1i7coq1":`Pay`,"1ih47b3":j,"1ix1b7w":M,"1ixbbo7":N,"1jhuo24":P,"1ka8utn":`Buy`,"1l0xxoj":F,"1ndiott":I,"1ne9nkz":L,"1nhkl7x":R,"1nn0owb":z,"1nvxkfy":B,"1o1b4a8":V,"1o4ofyx":H,"1ok4m5g":U,"1olegnl":W,"1oncz6g":G,"1ovj1tk":K,"1q45kup":q,"1qbiehv":J,"1rkfalq":Y,"1rnxx1g":X,"1spu5st":Z,"1t0r88u":Q,"1t86tnu":ie,"1tn6f91":ae,"1viukn9":oe,"1w0n607":se,"1w68n16":ce,"1x5xdes":le,"1y28pgi":ue,"1y6hn5o":de,"1yijk6g":fe,"27fhcv":pe,"2b8ghr":me,"2eikro":he,"2mzna2":ge,"2zh3gr":_e,"344av8":ve,"3pklqf":ye,"3u5vqs":be,"53b4uu":xe,"6c0jc7":Se,"6c5l2f":$,"6gkge0":Ce,"6s9hn9":we,"7m2ht3":Te,"7v6g6x":`MAX`,"9l4mg3":`Fee`,"9p7amh":Oe,"9zccf0":ke,bdctly:Ae,bdo3n8:je,biwlqk:Me,cgzgvn:Ne,cjn1xs:Pe,cnwfg3:Fe,cwk7r6:Ie,cx9lh3:`Min`,dizog6:Re,ek03j3:ze,epw9f3:`0`,evz7q4:Ve,f45rwo:He,fcy4ey:Ue,fo0vw0:We,fpand1:Ge,g7pjpv:Ke,gnnylt:qe,gtvgs9:`Max`,hzq69q:Ye,ibrnk6:Xe,ifug2i:Ze,jf8ts4:Qe,jmpbi6:$e,jnzipx:et,jssk7y:tt,k47stp:nt,knrcsh:rt,ln9xiv:it,mnlddk:at,n9zkql:ot,ofi1rq:st,pmqvh0:ct,pom1h2:lt,q4mqcd:ut,q5w460:dt,r7v9s7:ft,rvctng:pt,sykid7:mt,t1rvqg:ht,tbygoy:gt,tgp8yw:_t,tjg3i3:vt,u61kge:yt,udneg1:bt,uu5nf7:xt,va18uh:St,vum0cd:Ct,wuxjl9:wt,wx5bee:Tt,xel5qk:Et,xphk5n:Dt,y6jqu9:Ot,yhtv6l:kt,zkouah:At,zz4mrw:jt};export{Xe as _100907z,St as _108j3sk,se as _10lgc56,X as _10n9ta8,h as _113vzpe,lt as _11ncipg,V as _11p3b1r,it as _12qyh2x,R as _13ym6k2,me as _14oyo32,Ae as _15iyda3,S as _15vbpgm,xe as _15xhlup,s as _16j2pbi,Ze as _16ln1wz,Pe as _16pzx0g,Oe as _16rump9,M as _17g2rjk,_ as _18346vt,re as _1982g2x,Dt as _1biskvr,D as _1bjtgx1,Fe as _1cmz8k7,bt as _1cpadi9,K as _1d7sodl,ut as _1e023il,u as _1e5aqjt,z as _1ea99j0,te as _1f4czmp,$ as _1f8nqa3,le as _1f8umlr,G as _1fe46d3,Te as _1fikhaa,ct as _1fu9qvd,E as _1g7ofg0,Ne as _1gfjrn0,Me as _1gma9hv,pe as _1hs819x,_t as _1ht75o0,t as _1i8i0au,$e as _1i9sfkh,F as _1ib6ekl,q as _1ievltk,ft as _1in1gel,W as _1in9ocp,Ge as _1ju6xlj,T as _1jvje3y,De as _1kd3yrp,A as _1kez60s,de as _1krtsvx,st as _1kvlpuf,Se as _1l1rqi2,Y as _1l2nmmx,ne as _1lra4kg,gt as _1mmcyfz,wt as _1n1igys,O as _1na1vy4,ge as _1nd7gbf,o as _1nwhws6,ze as _1o0vi1j,Ye as _1o2h7a2,l as _1o8feo7,Ke as _1om32zr,w as _1oqs23j,ke as _1ovibcu,At as _1popw3r,ee as _1qamgmj,B as _1rggu8s,rt as _1s54fdc,c as _1s9ryeq,Ce as _1t3gki9,i as _1ulsa90,m as _1urf8wf,n as _1w2bswr,N as _1wwy4yj,e as _1wx2fw2,tt as _1x1qus,mt as _1y7hba4,x as _1yv1ajq,Tt as _3mtvnb,Ve as _3w8t28,Q as _41y3qp,J as _454sub,dt as _49235i,U as _4itr6p,H as _4opuqb,_e as _5af8qp,y as _5r87wo,b as _78b61s,we as _8edkty,je as _a5vz6z,Re as _al7a0k,Ee as _bii6w9,Be as _cnghfj,j as _czpegb,vt as _d7bf51,Qe as _doc1yy,xt as _ftpidr,L as _g3pfjv,ot as _gkmqsa,f as _hyiyqa,d as _i9ury1,v as _ide9vv,yt as _ig1w2,Ot as _jpt8np,oe as _kmeu9o,ue as _kqdlbv,Et as _l5s0fl,et as _l78r94,fe as _l800fy,g as _ly147p,Ie as _mdvri5,qe as _nb1pp5,Z as _np8jou,I as _nq4mpy,a as _nrzzox,nt as _o3um2w,P as _oj2fr8,Ct as _p5ybee,k as _pqml54,ye as _pr6lte,ve as _q0rsrj,ht as _qm85b2,p as _r3yix2,C as _sf0mgy,jt as _si8n6l,Je as _swoaip,kt as _t0vnn4,ie as _t91lwj,We as _ty2nen,pt as _u7tj7p,He as _uc0jju,r as _uu4paz,at as _vogk37,ae as _wa8i8c,ce as _xavgbs,he as _xkdtbf,be as _ystooe,Le as _z6jr7i,Ue as _zzusn5,Mt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,u as t}from"./dist-D3Q09jyE.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-
|
|
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-BORGC5lt.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-M3Wfb9U3.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-iWr5Czxc.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};
|