UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

10 lines • 216 kB
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import r,{useContext as a,createContext as i,useRef as s,useState as o,useMemo as l,useEffect as c,Suspense as d,lazy as u,useCallback as h}from"react";import p,{DEFAULT_SUPPORTED_CHAIN_IDS as w,rpc as m,PrivyClientError as y,getWallet as g,updateWallet as f,generateAuthorizationSignature as v}from"@privy-io/js-sdk-core";import{v4 as A}from"uuid";import*as k from"jose";import{base64url as T}from"jose";import{u as C,a as _,g as S,i as b,b as E,c as I,d as P,e as W,f as U,P as N,M as O,h as R,j as M,k as x,l as F}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import D from"eventemitter3";import{E as L,P as j,t as q,p as z,H,u as B,L as V,g as K,s as $,a as G,b as Y,c as J,i as Q,d as Z,e as X,R as ee,f as te,h as ne,j as re,k as ae,l as ie,m as se,n as oe,M as le,o as ce,q as de,S as ue,r as he,v as pe,w as we,x as me}from"./useActiveWallet-3RHPIBxJ.mjs";import{u as ye,t as ge,U as fe,g as ve}from"./useWallets-CR0z5IIt.mjs";import{P as Ae,a as ke,f as Te,b as Ce,c as _e,n as Se,d as be,u as Ee,e as Ie,I as Pe,g as We,h as Ue,i as Ne}from"./internal-context-Z-fyxadS.mjs";import{f as Oe,s as Re,W as Me,i as xe,a as Fe,P as De,e as Le,p as je,b as qe,l as ze}from"./use-export-wallet-CV4p7L0b.mjs";import{createCoinbaseWalletSDK as He}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as Be,STRING_TO_NUMBER_TXN_TYPE as Ve}from"@privy-io/ethereum";import{P as Ke,C as $e,a as Ge,H as Ye,O as Je,S as Qe,u as Ze,b as Xe,c as et,D as tt,d as nt,g as rt,V as at,R as it,e as st,f as ot,h as lt,i as ct,j as dt,I as ut,k as ht,l as pt,m as wt,W as mt}from"./context-WTldtXS8.mjs";import{createStore as yt}from"mipd";import{isMobile as gt,isIOS as ft,isAndroid as vt,isSafari as At}from"react-device-detect";import{toHex as kt,getAddress as Tt,isHex as Ct,hashAuthorization as _t}from"viem/utils";import{trigger as St}from"@privy-io/popup";import{u as bt,p as Et,a as It,b as Pt,f as Wt,c as Ut,d as Nt,e as Ot,o as Rt,g as Mt,h as xt,i as Ft,j as Dt,k as Lt,l as jt,m as qt,n as zt,q as Ht,r as Bt,s as Vt,t as Kt,v as $t,w as Gt,x as Yt,y as Jt,z as Qt,A as Zt,B as Xt,C as en,D as tn,E as nn,F as rn,G as an,H as sn,I as on,J as ln,K as cn,L as dn,M as un,N as hn,O as pn,P as wn,Q as mn,R as yn,S as gn,T as fn,U as vn,V as An,W as kn,X as Tn,Y as Cn,Z as _n,_ as Sn,$ as bn,a0 as En,a1 as In,a2 as Pn,a3 as Wn,a4 as Un}from"./paths-3HW55qZg.mjs";import{o as Nn,p as On,d as Rn,r as Mn,b as xn,s as Fn,a as Dn,c as Ln,u as jn,S as qn,e as zn,f as Hn}from"./usePrivy-6nkpbErN.mjs";import{base64 as Bn}from"@scure/base";import{styled as Vn,createGlobalStyle as Kn,css as $n}from"styled-components";import{u as Gn,a as Yn,p as Jn,e as Qn,P as Zn}from"./events-context-CI0iqAXA.mjs";import{create as Xn}from"zustand";import{Transition as er,Dialog as tr,TransitionChild as nr,DialogPanel as rr}from"@headlessui/react";import{EthereumProvider as ar,OPTIONAL_METHODS as ir,OPTIONAL_EVENTS as sr}from"@walletconnect/ethereum-provider";import{constructURL as or}from"@privy-io/urls";import{toHex as lr,zeroAddress as cr,getAddress as dr,createWalletClient as ur,http as hr,parseSignature as pr}from"viem";import{u as wr,P as mr}from"./PrivyPluginContext-2QN2dVUw.mjs";import{D as yr}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{g as gr,a as fr}from"./getPublicClient-B4uPLKn-.mjs";import{ofetch as vr}from"ofetch";import Ar from"js-cookie";import{F as kr}from"./frame-uzTmvtww.mjs";import{MfaAuthPasskeyVerify as Tr,MfaAuthPasskeyInit as Cr,MfaAuthTotpVerify as _r,MfaAuthPasskeyEnrollment as Sr,MfaAuthTotpUnenroll as br,MfaAuthTotpEnroll as Er,MfaAuthTotpInit as Ir}from"@privy-io/routes";import{selectPaymentRequirements as Pr,createPaymentHeader as Wr}from"x402/client";import{InvalidInputError as Ur}from"@privy-io/api-base";import{areAddressesEqual as Nr}from"@privy-io/are-addresses-equal";import{toAccount as Or}from"viem/accounts";import{u as Rr}from"./use-sign-with-user-signer-Do5Oi_rb.mjs";class Mr{static parse(e){try{return new Mr(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return k.decodeJwt(e),e}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=k.decodeJwt(e)}}class xr extends Mr{static parse(e){try{return new xr(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const Fr=({style:n,...r})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Dr="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";let jr,qr;class zr extends L{async initialize(){await this.importPromise,await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:Lr,id:"com.coinbase.wallet"}}async promptConnection(){try{await this.importPromise;let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Ae("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Oe(e)}}constructor(e,t,n,r,a){super("base_account",e,t,n),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base",this.setBaseAccountSdk=a,this.proxyProvider=new j(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...r,appChainIds:[t.id].concat(e.map((e=>e.id)))},jr?(this.proxyProvider.setWalletProvider(jr.getProvider()),this.setBaseAccountSdk(jr)):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{jr=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(jr.getProvider()),this.setBaseAccountSdk(jr)})).catch(console.error)}}let Hr=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class Br extends L{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:Dr,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new Ae("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Oe(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",qr=He({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(qr.getProvider())}constructor(e,t,n,r){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new j(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...r,appChainIds:[t.id].concat(e.map((e=>e.id)))},this.walletClientType="smartWalletOnly"===this.coinbaseWalletConfig.preference?.options?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!qr){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!Hr.includes(e))):[];e.length>0&&!e.every((e=>w.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),qr=He(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(qr.getProvider())}}const Vr=({...e})=>/*#__PURE__*/t("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});class Kr extends L{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[q(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Vr,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:r,imported:a,walletIndex:i}){super("privy",t,n,r),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}async function $r(){let e=xs();return e?e.getAccessToken():Promise.resolve(Re.get(Ke)||Re.get($e)||null)}const Gr=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];function Yr(e){return e?{"privy-ui":"t"}:void 0}class Jr{async authenticate(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new ke("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Et,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Te(e)}}async link(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new ke("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(It,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw Te(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new ke("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new ke("Email must be set when initialzing authentication.");let r=Yr(n);try{return await this.api.post(Pt,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw Te(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class Qr extends Jr{async link(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new ke("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(bt,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw Te(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Zr{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class Xr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.channelToken)throw new ke("Auth flow must be initialized first");try{let e=await this.api.post(Wt,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new ke("No response from authentication");return e}catch(e){throw Te(e)}}async link(){if(!this.api)throw new ke("Auth flow has no API instance");try{return await this.api.post(Ut,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw Te(e)}}async _startChannelOnce(){if(!this.api)throw new ke("Auth flow has no API instance");let e=await this.api.post(Nt,{token:this.captchaToken});gt&&!ft&&e.connect_uri&&Nn(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new ke("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.channelToken)throw new ke("Auth flow must be initialized first");let e=await this.api.get(Ot,{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Zr(this._startChannelOnce.bind(this)),this.pollForReady=new Zr(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function ea(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function ta(){if(!ea())return;let e=window.chrome;return e?.runtime?.id}function na(){if(!ea())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function ra(e){return new Promise(((t,n)=>{na()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let n=function(){if(!ea())return;let e=window.chrome;return e?.runtime?.lastError?.message}();if(n||!e){let e=`WebAuthFlow failed: ${n||"Response URI missing"}`;throw Error(e)}let r=new URL(e),a=ta();if(!a)throw Error("Invalid extension context");if("chrome-extension:"===r.protocol){if(r.hostname!==a)throw Error("Invalid responseUri origin")}else{if("https:"!==r.protocol)throw Error("Invalid responseUri protocol");{let e=r.hostname.split(".");if(3!==e.length||"chromiumapp"!==e[1]||"org"!==e[2]||e[0]!==a)throw Error("Invalid responseUri origin")}}let i=r.searchParams.get("privy_oauth_state"),s=r.searchParams.get("privy_oauth_code");if(!i||!s)throw Error("Invalid responseUri - missing required parameters");t({privyOAuthState:i,privyOAuthCode:s})}catch(e){n(e)}})):n(Error("Chrome identity API not available"))}))}function aa(e){return crypto.getRandomValues(new Uint8Array(e))}function ia(){return T.encode(aa(36))}function sa(){return ia()}async function oa(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return T.encode(t)}}class la{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new ke("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new ke("User denied confirmation during OAuth flow");let e=function(){let e=Re.get(Ge);if(!e)throw new ke("Authentication error.");return e}();try{let t=await this.api.post(Rt,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Re.del(Ge),Re.del(Ye),Re.del(Je),t}catch(e){let t=Te(e);if(t.privyErrorCode)throw new ke(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new ke("Invalid code during oauth flow.",void 0,Ce.OAUTH_USER_DENIED);throw new ke("Invalid code during OAuth flow.",void 0,Ce.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new ke("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new ke("User denied confirmation during OAuth flow");let e=Re.get(Ge);if(!e)throw new ke("Authentication error.");try{let t=await this.api.post(Mt,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Re.del(Ge),t}catch(e){throw Te(e)}}async getAuthorizationUrl(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.provider)throw new ke("Provider must be set when initializing OAuth authentication.");let e=ia();Re.put(Ge,e);let t=sa();Re.put(Qe,t);let n=await oa(e);this.meta.withPrivyUi||Re.put(Ye,!0),this.meta.disableSignup?Re.put(Je,!0):Re.del(Je);let r=Yr(this.meta.withPrivyUi),a=window.location.href,i=function(){let e=ta();if(e)return`https://${e}.chromiumapp.org`}();i&&(a=i);try{return await this.api.post(xt,{provider:this.meta.provider,redirect_to:this.meta.customOAuthRedirectUrl||a,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...r}})}catch(e){throw Te(e)}}constructor(e){this.meta=e}}function ca(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),r=e.get("privy_oauth_provider");if(!t||!n||!r)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:r,withPrivyUi:!Re.get(Ye),popupFlow:null!==window.opener&&a,disableSignup:!!Re.get(Je)}}function da(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Re.del(Qe),window.history.replaceState({},"",e)}class ua{async initRegisterFlow(e){if(!this.api)throw new ke("Auth flow has no API instance");this.authenticateForRegistration=!0,this.meta.initRegisterResponse=await this.initRegisterOnce.execute(e)}async initAuthenticationFlow(e){if(!this.api)throw new ke("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new ke("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async register(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new ke("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new ke("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,n=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ft,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new ke("Passkey request timed out or rejected by user.",void 0,Ce.PASSKEY_NOT_ALLOWED);throw Te(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new ke("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new ke("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());let t=this.meta.allowedCredentialsIds?.map((e=>({type:"public-key",id:e})))??this.meta.initAuthenticateResponse.options.allow_credentials;try{let n=await e.startAuthentication({optionsJSON:this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t})});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Dt,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new ke("Passkey request timed out or rejected by user.",void 0,Ce.PASSKEY_NOT_ALLOWED);throw Te(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new ke("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new ke("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,n=await e.startRegistration({optionsJSON:this._transformInitLinkOptionsToCamelCase(t)});return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Lt,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new ke("Passkey request timed out or rejected by user.",void 0,Ce.PASSKEY_NOT_ALLOWED);throw Te(e)}}async _initRegisterOnce(e){if(!this.api)throw new ke("Auth flow has no API instance");let t=Yr(e);return await this.api.post(jt,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new ke("Auth flow has no API instance");let t=Yr(e);return await this.api.post(qt,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new ke("Auth flow has no API instance");return await this.api.post(zt,{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret},hints:this.meta.hints}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}_transformInitAuthenticateOptionsToCamelCase(e){return{rpId:e.rp_id,challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}}_transformAuthenticationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}constructor({captchaToken:e,setPasskeyAuthState:t,hints:n}){this.authenticateForRegistration=!1,this.initRegisterOnce=new Zr(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new Zr(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Zr(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t,hints:n}}}const ha=({address:e,chainId:t,nonce:n})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${n}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class pa{get meta(){return{connectorType:this.wallet?.connectorType,walletClientType:this.wallet?.walletClientType,chainId:this.wallet?.chainId,address:this.wallet?.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new ke("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.walletClientType??this.wallet?.walletClientType,connectorType:this.connectorType??this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new ke("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Te(e)}}async link(){if(!this.client)throw new ke("SiweFlow has no client instance");try{if(!this.wallet)throw new ke("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw Te(e)}}async sign(){if(!this.client)throw new ke("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new ke("Could not prepare SIWE message");if(!this.wallet)throw new ke("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new ke("SiweFlow has no client instance");if(!this.wallet)throw new ke("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new ke("SiweFlow has no client instance");if(!this.wallet)throw new ke("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=ha({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a){this._meta={disableSignup:!1},this.getNonceOnce=new Zr(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=r,this.preparedMessage=a?.message,this.signature=a?.signature,this.walletClientType=a?.walletClientType,this.connectorType=a?.connectorType}}class wa{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new ke("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw Te(e)}}async link(){if(!this.client)throw new ke("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw Te(e)}}async sign(){let e,t;if(!this.client)throw new ke("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new ke("Could not prepare SIWS message");if(!n&&!this.wallet.provider.signMessage||n&&!this.wallet.provider.signTransaction)throw new ke("Wallet does not support the necessary signing methods");if(n&&this._plugin){let n=await this.wallet.provider.signTransaction({transaction:Bn.decode(this.preparedMessage)});e=Bn.encode(n.signedTransaction),t=this._plugin.getSignatureFromTransaction(n.signedTransaction,this.wallet.address)}else{e=this.preparedMessage;let n=await this.wallet.provider.signMessage({message:(new TextEncoder).encode(this.preparedMessage)});t=Bn.encode(n.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new ke("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new ke("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._plugin?this.preparedMessage=this._plugin.createSiwsMemoTransaction({address:e,nonce:this.nonce}):this.preparedMessage=On({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new Zr(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=r,this._meta.messageType=a,this._plugin=i}}class ma{async authenticate(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new ke("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Ht,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Te(e)}}async link(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new ke("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Bt,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw Te(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new ke("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new ke("phone nNumber must be set when initialzing authentication.");let r=Yr(n);try{return await this.api.post(Vt,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw Te(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class ya extends ma{async link(){if(!this.api)throw new ke("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new ke("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Kt,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw Te(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}const ga=/*#__PURE__*/i({enabled:!1,siteKey:"",provider:void 0,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:Se,setError:Se,setExecuting:Se,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:be,reset:Se,execute:Se});class fa extends _e{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const va=({children:e,appId:n,captchaSiteKey:r,enabledCaptchaProvider:a})=>{let i=s(null),c=s(null),[d,u]=o(),[h,p]=o(),[w,m]=o(!1),y=l((()=>a?w||d||h?!w||d||h?d&&!h?{status:"success",token:d}:h?{status:"error",error:h}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,d,h,w]),g=l((()=>a?"turnstile"===a?{remove:()=>{i.current?.remove(),m(!1),p(void 0),u(void 0)},reset:()=>{i.current?.reset(),m(!1),p(void 0),u(void 0)},execute:()=>{m(!0),i.current?.execute()},waitForResult:async()=>{try{return await z((()=>i.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new fa("Captcha failed",null,Ce.CAPTCHA_TIMEOUT)}}}:{remove:()=>{c.current?.removeCaptcha(),m(!1),p(void 0),u(void 0)},reset:()=>{c.current?.resetCaptcha(),m(!1),p(void 0),u(void 0)},execute:()=>{m(!0),c.current?.execute()},waitForResult:async()=>{try{return await z((()=>{let e=c.current?.getResponse();if(e)return e}),{interval:200,timeout:2e4})}catch(e){throw new fa("Captcha failed",null,Ce.CAPTCHA_TIMEOUT)}}}:null),[a]),f=l((()=>{if(!a||!g)return{...y,enabled:!1,siteKey:"",appId:n,setToken:Se,setError:Se,setExecuting:Se,waitForResult:()=>Promise.resolve(void 0),remove:be,reset:Se,execute:Se,provider:void 0,ref:{current:null}};let e={...y,enabled:!0,appId:n,setToken:u,setError:p,setExecuting:m};return"turnstile"===a?{...e,provider:"turnstile",ref:i,siteKey:r.split("t:")[1]??"",...g}:{...e,provider:"hcaptcha",ref:c,siteKey:r.split("h:")[1]??"",...g}}),[y,a,g,n,r]);/*#__PURE__*/return t(ga.Provider,{value:f,children:e})},Aa=()=>a(ga);async function ka(e){if(e.enabled){if("error"===e.status)throw new fa(e.error,null,Ce.CAPTCHA_FAILURE);return"success"===e.status?e.token:(e.execute(),await e.waitForResult())}}class Ta{async authenticate(){if(!this.api)throw new ke("Auth flow has no API instance");try{return await this.api.post($t,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Te(e)}}async link(){if(!this.api)throw new ke("Auth flow has no API instance");try{return await this.api.post(Gt,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw Te(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ca(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===Ce.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===Ce.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===Ce.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Ce.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Ce.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===Ce.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===Ce.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof fa&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function _a(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Sa(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}let ba=/*#__PURE__*/u((()=>import("./TurnstileWrapper-Co-t5mTh.mjs"))),Ea=/*#__PURE__*/u((()=>import("./HCaptchaWrapper-CUi9LJsp.mjs")));const Ia=n=>{let r=Aa();return c((()=>r.remove),[r.remove]),r.enabled&&r.provider?/*#__PURE__*/t(d,{fallback:null,children:/*#__PURE__*/e("div",{className:"hidden h-0 w-0",children:["turnstile"===r.provider&&/*#__PURE__*/t(ba,{...n,captchaContext:r}),"hcaptcha"===r.provider&&/*#__PURE__*/t(Ea,{...n,captchaContext:r})]})}):null};var Pa=/*#__PURE__*/Object.freeze({__proto__:null,AccountNotFoundScreen:()=>import("./AccountNotFoundScreen-C055cesr.mjs"),AffirmativeConsentScreen:()=>import("./AffirmativeConsentScreen-DXy2kEcy.mjs"),AllowlistRejectionScreen:()=>import("./AllowlistRejectionScreen-BIzWPeoe.mjs"),AuthenticateWithWalletScreen:()=>import("./AuthenticateWithWalletScreen-q3jQKiH6.mjs"),AwaitingEvmToSolBridgingScreen:()=>import("./AwaitingEvmToSolBridgingScreen-B4R4PEVm.mjs"),AwaitingExternalEthereumTransferScreen:()=>import("./AwaitingExternalEthereumTransferScreen-Dwy69FD1.mjs"),AwaitingPasswordlessCodeScreen:()=>import("./AwaitingPasswordlessCodeScreen-Ch_YXDTX.mjs"),AwaitingSolToEvmBridgingScreen:()=>import("./AwaitingSolToEvmBridgingScreen-spElnpUE.mjs"),CaptchaScreen:()=>import("./CaptchaScreen-BZy78GrD.mjs"),CoinbaseOnrampStatusScreen:()=>import("./CoinbaseOnrampStatusScreen-CTWZaE1o.mjs"),ConnectLedgerScreen:()=>import("./ConnectLedgerScreen-CIPOaq8e.mjs"),ConnectOnlyLandingScreen:()=>import("./ConnectOnlyLandingScreen-CbLV-cj4.mjs"),ConnectOnlyStatusScreen:()=>import("./ConnectOnlyStatusScreen-bmx1wwk1.mjs"),ConnectOrCreateScreen:()=>import("./ConnectOrCreateScreen-DXw5Y8gN.mjs"),ConnectionStatusScreen:()=>import("./ConnectionStatusScreen-D-9fLZfA.mjs"),CrossAppAuthScreen:()=>import("./CrossAppAuthScreen-Co723kT3.mjs"),DelegatedActionsConsentScreen:()=>import("./DelegatedActionsConsentScreen-CyQTJHgT.mjs"),DelegatedActionsRevokeScreen:()=>import("./DelegatedActionsRevokeScreen-CFm4F3CM.mjs"),EmbeddedWalletConnectingScreen:()=>import("./EmbeddedWalletConnectingScreen-DmTtzGwq.mjs"),EmbeddedWalletCreatedScreen:()=>import("./EmbeddedWalletCreatedScreen-Cj1c5KyP.mjs"),EmbeddedWalletKeyExportScreen:()=>import("./EmbeddedWalletKeyExportScreen-CsWRTEgd.mjs"),EmbeddedWalletOnAccountCreateScreen:()=>import("./EmbeddedWalletOnAccountCreateScreen-DBAmWm90.mjs"),EmbeddedWalletPasswordCreateScreen:()=>import("./RecoveryPasswordCreateScreen-Q1zuy9fu.mjs"),EmbeddedWalletPasswordUpdateScreen:()=>import("./EmbeddedWalletPasswordUpdateScreen-B5w6wtgf.mjs"),EmbeddedWalletPasswordUpdateSplashScreen:()=>import("./EmbeddedWalletPasswordUpdateSplashScreen-BvsscceO.mjs"),ErrorScreen:()=>import("./ErrorScreen-DtGc3Chy.mjs"),FarcasterConnectStatusScreen:()=>import("./FarcasterConnectStatusScreen-DGeCyr6b.mjs"),FarcasterSignerStatusScreen:()=>import("./FarcasterSignerStatusScreen-DASa1xq2.mjs"),FundSolWalletWithExternalSolanaWallet:()=>import("./FundSolWalletWithExternalSolanaWallet-0jNi_hvn.mjs"),FundWithBankDepositScreen:()=>import("./FundWithBankDepositScreen-D_uu3GEF.mjs"),FundingAmountEditScreen:()=>import("./FundingEditAmountScreen-vQUS-a80.mjs"),FundingMethodSelectionScreen:()=>import("./FundingMethodSelectionScreen-G8gkM1Mk.mjs"),InAppBrowserLoginNotPossible:()=>import("./InAppBrowserLoginNotPossible-C8mlSbYe.mjs"),InstallWalletScreen:()=>import("./InstallWalletScreen-D0kdHc5W.mjs"),LandingScreen:()=>import("./LandingScreen-0MlIkV3C.mjs"),LinkConflictScreen:()=>import("./LinkConflictScreen-DW31R5fr.mjs"),LinkEmailScreen:()=>import("./LinkEmailScreen-B10iXGH8.mjs"),LinkPasskeyScreen:()=>import("./LinkPasskeyScreen-OxaghvUl.mjs"),LinkPhoneScreen:()=>import("./LinkPhoneScreen-Cdg3eg7w.mjs"),LoginFailedScreen:()=>import("./LoginFailedScreen-BVOo2ycm.mjs"),ManualTransferScreen:()=>import("./ManualTransferScreen-_04Sq7zU.mjs"),MfaAuthEnrollmentFlowScreen:()=>import("./MfaAuthEnrollmentFlowScreen-DApO6DPY.mjs"),MfaAuthVerifyFlowScreen:()=>import("./MfaAuthVerifyFlowScreen-mdmdgWdO.mjs"),MfaEnrollmentFlowScreen:()=>import("./MfaEnrollmentFlowScreen-DRZTnt-I.mjs"),MoonpayStatusScreen:()=>import("./MoonpayStatusScreen-DDSK5dda.mjs"),OAuthStatusScreen:()=>import("./OAuthStatusScreen-DSAUQ_YN.mjs"),PasskeySelectSignupOrLogin:()=>import("./PasskeySelectSignupOrLogin-G19VpAdI.mjs"),PasskeyStatusScreen:()=>import("./PasskeyStatusScreen-TD2nYAnk.mjs"),PasswordRecoveryScreen:()=>import("./PasswordRecoveryScreen-C0oVVZYe.mjs"),RecoveryOAuthScreen:()=>import("./RecoveryOAuthStatusScreen-Ca9VYOrA.mjs"),RecoverySelectionScreen:()=>import("./RecoverySelectionScreen-scmqFA8Y.mjs"),SendTransactionScreen:()=>import("./index-BH9-XZRZ.mjs"),SetAutomaticRecoveryScreen:()=>import("./SetAutomaticRecoveryScreen-D-__1Pf7.mjs"),SignRequestScreen:()=>import("./SignRequestScreen-D6HSUOxx.mjs"),StandardSignAndSendTransactionScreen:()=>import("./StandardSignAndSendTransactionScreen-YlstFfkB.mjs"),TelegramAuthScreen:()=>import("./TelegramAuthScreen-DHCcieoC.mjs"),TransferFromWalletScreen:()=>import("./TransferFromWalletScreen-BG5Mj5tz.mjs"),UpdateEmailScreen:()=>import("./UpdateEmailScreen-ndRi1gY6.mjs"),UpdatePhoneScreen:()=>import("./UpdatePhoneScreen-DoH__glA.mjs"),UserLimitReachedScreen:()=>import("./UserLimitReachedScreen-BLzaOW7F.mjs"),WalletInterstitialScreen:()=>import("./WalletInterstitialScreen-BQ-ku50j.mjs")});function Wa(e){Gn("configureMfa",e)}const Ua=Xn((()=>({inProgressMfaFlow:void 0})));const Na=Kn` :root { ${e=>Oa(e.palette)} }; `;const Oa=e=>{let t=function(e){return{"--privy-color-background":e.background,"--privy-color-background-2":e.background2,"--privy-color-background-3":e.background3,"--privy-color-foreground":e.foreground,"--privy-color-foreground-2":e.foreground2,"--privy-color-foreground-3":e.foreground3,"--privy-color-foreground-4":e.foreground4,"--privy-color-foreground-accent":e.foregroundAccent,"--privy-color-accent":e.accent,"--privy-color-accent-light":e.accentLight,"--privy-color-accent-hover":e.accentHover,"--privy-color-accent-dark":e.accentDark,"--privy-color-accent-darkest":e.accentDarkest,"--privy-color-success":e.success,"--privy-color-success-dark":e.successDark,"--privy-color-success-light":e.successLight,"--privy-color-success-bg":e.successBg,"--privy-color-error":e.error,"--privy-color-error-light":e.errorLight,"--privy-color-error-bg":e.errorBg,"--privy-color-error-bg-hover":e.errorBgHover,"--privy-color-warn":e.warn,"--privy-color-warn-light":e.warnLight,"--privy-color-warn-bg":e.warnBg,"--privy-color-warning-dark":e.warningDark,"--privy-color-error-dark":e.errorDark,"--privy-color-info-bg":e.infoBg,"--privy-color-info-bg-hover":e.infoBgHover,"--privy-color-border-default":e.borderDefault,"--privy-color-border-hover":e.borderHover,"--privy-color-border-focus":e.borderFocus,"--privy-color-border-error":e.borderError,"--privy-color-border-success":e.borderSuccess,"--privy-color-border-warning":e.borderWarning,"--privy-color-border-info":e.borderInfo,"--privy-color-border-interactive":e.borderInteractive,"--privy-color-border-interactive-hover":e.borderInteractiveHover,"--privy-color-background-hover":e.backgroundHover,"--privy-color-background-clicked":e.backgroundClicked,"--privy-color-background-disabled":e.backgroundDisabled,"--privy-color-background-interactive":e.backgroundInteractive,"--privy-color-background-interactive-hover":e.backgroundInteractiveHover,"--privy-color-background-interactive-clicked":e.backgroundInteractiveClicked,"--privy-color-background-interactive-disabled":e.backgroundInteractiveDisabled,"--privy-color-foreground-hover":e.foregroundHover,"--privy-color-foreground-clicked":e.foregroundClicked,"--privy-color-foreground-disabled":e.foregroundDisabled,"--privy-color-foreground-interactive":e.foregroundInteractive,"--privy-color-foreground-interactive-hover":e.foregroundInteractiveHover,"--privy-link-navigation-color":e.linkNavigationColor,"--privy-link-navigation-decoration":e.linkNavigationDecoration,"--privy-accent-has-good-contrast":e.accentHasGoodContrast,"--privy-color-icon-default":e.iconDefault,"--privy-color-icon-muted":e.iconMuted,"--privy-color-icon-subtle":e.iconSubtle,"--privy-color-icon-inverse":e.iconInverse,"--privy-color-icon-success":e.iconSuccess,"--privy-color-icon-warning":e.iconWarning,"--privy-color-icon-error":e.iconError,"--privy-color-icon-interactive":e.iconInteractive,"--privy-color-icon-default-hover":e.iconDefaultHover,"--privy-color-icon-muted-hover":e.iconMutedHover,"--privy-color-icon-subtle-hover":e.iconSubtleHover,"--privy-color-icon-default-clicked":e.iconDefaultClicked,"--privy-color-icon-muted-clicked":e.iconMutedClicked,"--privy-color-icon-subtle-clicked":e.iconSubtleClicked,"--privy-color-icon-default-disabled":e.iconDefaultDisabled,"--privy-color-icon-muted-disabled":e.iconMutedDisabled,"--privy-color-icon-subtle-disabled":e.iconSubtleDisabled,"--privy-color-icon-error-hover":e.iconErrorHover,"--privy-color-icon-interactive-hover":e.iconInteractiveHover,"--privy-color-icon-error-clicked":e.iconErrorClicked,"--privy-color-icon-interactive-clicked":e.iconInteractiveClicked,"--privy-color-icon-muted-disabled-alt":e.iconMutedDisabledAlt,"--privy-color-icon-subtle-disabled-alt":e.iconSubtleDisabledAlt,"--privy-border-radius-xs":"6px","--privy-border-radius-sm":"8px","--privy-border-radius-md":"12px","--privy-border-radius-mdlg":"16px","--privy-border-radius-lg":"24px","--privy-border-radius-full":"9999px","--privy-height-modal-full":"620px","--privy-height-modal-compact":"480px"}}(e);return $n` ${Object.entries(t).map((([e,t])=>`${e}: ${t};`)).join("\n")} `},Ra=Vn.div` // css normalize only the privy application to avoid conflicts // with consuming application ${"\n *,\n ::before,\n ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n }\n\n line-height: 1.15;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n tab-size: 4;\n font-feature-settings: normal;\n\n margin: 0;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n display: inline;\n }\n\n a {\n color: inherit;\n text-decoration: inherit;\n }\n\n b,\n strong {\n font-weight: bolder;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n }\n\n ::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n :-moz-focusring {\n outline: 1px dotted ButtonText;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n legend {\n padding: 0;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n summary {\n display: list-item;\n }\n\n blockquote,\n