UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines • 213 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 C}from"jose";import{u as T,a as _,g as b,i as S,b as E,c as I,d as P,e as W,f as U,h as N,j as O,P as R,M,k as x,l as F,m as L}from"./get-is-unified-wallet-DvKS5IUO.mjs";import D from"eventemitter3";import{E as j,P as z,t as q,p as H,H as V,u as B,L as K,g as $,s as G,a as Y,b as J,c as Q,i as Z,d as X,e as ee,f as te,h as ne,j as re,k as ae,R as ie,l as se,m as oe,n as le,M as ce,o as de,q as ue,S as he,r as pe,v as we,w as me,x as ye}from"./useActiveWallet-Bsy5GTCV.mjs";import{u as ge,t as fe,g as ve,U as Ae}from"./useWallets-D0lpBS44.mjs";import{P as ke,a as Ce,f as Te,b as _e,c as be,n as Se,d as Ee,u as Ie,e as Pe,g as We,I as Ue,h as Ne,i as Oe}from"./internal-context-e-Eni5bG.mjs";import{f as Re,u as Me,W as xe,i as Fe,a as Le,p as De,e as je,P as ze,b as qe,l as He}from"./prepareFundingModalData-CIgFwA7s.mjs";import{createCoinbaseWalletSDK as Ve}from"@coinbase/wallet-sdk";import{toViemTransactionSerializable as Be,STRING_TO_NUMBER_TXN_TYPE as Ke}from"@privy-io/ethereum";import{P as $e,C as Ge,a as Ye,H as Je,O as Qe,S as Ze,u as Xe,b as et,c as tt,D as nt,d as rt,g as at,V as it,R as st,e as ot,f as lt,h as ct,i as dt,j as ut,I as ht,k as pt,l as wt,m as mt,W as yt}from"./context-Bycd1SKV.mjs";import{createStore as gt}from"mipd";import{isMobile as ft,isIOS as vt,isAndroid as At,isSafari as kt}from"react-device-detect";import{toHex as Ct,isAddress as Tt,getAddress as _t,isHex as bt,hashAuthorization as St}from"viem/utils";import{trigger as Et}from"@privy-io/popup";import{u as It,p as Pt,a as Wt,b as Ut,f as Nt,c as Ot,d as Rt,e as Mt,o as xt,g as Ft,h as Lt,i as Dt,j as jt,k as zt,l as qt,m as Ht,n as Vt,q as Bt,r as Kt,s as $t,t as Gt,v as Yt,w as Jt,x as Qt,y as Zt,z as Xt,A as en,B as tn,C as nn,D as rn,E as an,F as sn,G as on,H as ln,I as cn,J as dn,K as un,L as hn,M as pn,N as wn,O as mn,P as yn,Q as gn,R as fn,S as vn,T as An,U as kn,V as Cn,W as Tn,X as _n,Y as bn,Z as Sn,_ as En,$ as In,a0 as Pn,a1 as Wn,a2 as Un,a3 as Nn,a4 as On}from"./paths-3HW55qZg.mjs";import{o as Rn,p as Mn,d as xn,r as Fn,b as Ln,s as Dn,a as jn,u as zn,c as qn,S as Hn,e as Vn,P as Bn,f as Kn}from"./usePrivy-BaiIHGte.mjs";import{base64 as $n}from"@scure/base";import{styled as Gn,createGlobalStyle as Yn,css as Jn}from"styled-components";import{u as Qn,a as Zn,p as Xn,e as er,P as tr}from"./events-context-CI0iqAXA.mjs";import{create as nr}from"zustand";import{Transition as rr,Dialog as ar,TransitionChild as ir,DialogPanel as sr}from"@headlessui/react";import{EthereumProvider as or,OPTIONAL_METHODS as lr,OPTIONAL_EVENTS as cr}from"@walletconnect/ethereum-provider";import{constructURL as dr}from"@privy-io/urls";import{toHex as ur,zeroAddress as hr,getAddress as pr,createWalletClient as wr,http as mr,parseSignature as yr}from"viem";import{g as gr,a as fr}from"./getPublicClient-A9RSftUZ.mjs";import{ofetch as vr}from"ofetch";import Ar from"js-cookie";import{F as kr}from"./frame-CwE9r3cT.mjs";import{MfaAuthPasskeyVerify as Cr,MfaAuthPasskeyInit as Tr,MfaAuthTotpVerify as _r,MfaAuthPasskeyEnrollment as br,MfaAuthTotpUnenroll as Sr,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{toAccount as Nr}from"viem/accounts";import{u as Or}from"./use-sign-with-user-signer-eEm9Olt_.mjs";import"./getEmbeddedConnectedWallet-CM6cDQCS.mjs";class Rr{static parse(e){try{return new Rr(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 Mr extends Rr{static parse(e){try{return new Mr(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const xr=({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"})]}),Fr="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 Dr,jr;class zr extends j{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 ke("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Re(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 z(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...r,appChainIds:[t.id].concat(e.map((e=>e.id)))},Dr?(this.proxyProvider.setWalletProvider(Dr.getProvider()),this.setBaseAccountSdk(Dr)):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{Dr=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(Dr.getProvider()),this.setBaseAccountSdk(Dr)})).catch(console.error)}}let qr=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class Hr extends j{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:Fr,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 ke("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Re(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",jr=Ve({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(jr.getProvider())}constructor(e,t,n,r){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new z(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"),!jr){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!qr.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(", ")}`),jr=Ve(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(jr.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 Br extends j{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 Kr(){let e=Ws();return e?e.getAccessToken():Promise.resolve(Me.get($e)||Me.get(Ge)||null)}const $r=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];function Gr(e){return e?{"privy-ui":"t"}:void 0}class Yr{async authenticate(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new Ce("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Pt,{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 Ce("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new Ce("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Wt,{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 Ce("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new Ce("Email must be set when initialzing authentication.");let r=Gr(n);try{return await this.api.post(Ut,{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 Jr extends Yr{async link(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new Ce("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(It,{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 Qr{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 Zr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.channelToken)throw new Ce("Auth flow must be initialized first");try{let e=await this.api.post(Nt,{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 Ce("No response from authentication");return e}catch(e){throw Te(e)}}async link(){if(!this.api)throw new Ce("Auth flow has no API instance");try{return await this.api.post(Ot,{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 Ce("Auth flow has no API instance");let e=await this.api.post(Rt,{token:this.captchaToken});ft&&!vt&&e.connect_uri&&Rn(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new Ce("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.channelToken)throw new Ce("Auth flow must be initialized first");let e=await this.api.get(Mt,{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 Qr(this._startChannelOnce.bind(this)),this.pollForReady=new Qr(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function Xr(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function ea(){if(!Xr())return;let e=window.chrome;return e?.runtime?.id}function ta(){if(!Xr())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function na(e){return new Promise(((t,n)=>{ta()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let n=function(){if(!Xr())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=ea();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 ra(e){return crypto.getRandomValues(new Uint8Array(e))}function aa(){return C.encode(ra(36))}function ia(){return aa()}async function sa(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 C.encode(t)}}class oa{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new Ce("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new Ce("User denied confirmation during OAuth flow");let e=function(){let e=Me.get(Ye);if(!e)throw new Ce("Authentication error.");return e}();try{let t=await this.api.post(xt,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Me.del(Ye),Me.del(Je),Me.del(Qe),t}catch(e){let t=Te(e);if(t.privyErrorCode)throw new Ce(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new Ce("Invalid code during oauth flow.",void 0,_e.OAUTH_USER_DENIED);throw new Ce("Invalid code during OAuth flow.",void 0,_e.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new Ce("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new Ce("User denied confirmation during OAuth flow");let e=Me.get(Ye);if(!e)throw new Ce("Authentication error.");try{let t=await this.api.post(Ft,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Me.del(Ye),t}catch(e){throw Te(e)}}async getAuthorizationUrl(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.provider)throw new Ce("Provider must be set when initializing OAuth authentication.");let e=aa();Me.put(Ye,e);let t=ia();Me.put(Ze,t);let n=await sa(e);this.meta.withPrivyUi||Me.put(Je,!0),this.meta.disableSignup?Me.put(Qe,!0):Me.del(Qe);let r=Gr(this.meta.withPrivyUi),a=window.location.href,i=function(){let e=ea();if(e)return`https://${e}.chromiumapp.org`}();i&&(a=i);try{return await this.api.post(Lt,{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 la(){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:!Me.get(Je),popupFlow:null!==window.opener&&a,disableSignup:!!Me.get(Qe)}}function ca(){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"),Me.del(Ze),window.history.replaceState({},"",e)}class da{async initRegisterFlow(e){if(!this.api)throw new Ce("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 Ce("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new Ce("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 Ce("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Ce("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(Dt,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new Ce("Passkey request timed out or rejected by user.",void 0,_e.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 Ce("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Ce("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(jt,{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 Ce("Passkey request timed out or rejected by user.",void 0,_e.PASSKEY_NOT_ALLOWED);throw Te(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new Ce("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new Ce("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(zt,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new Ce("Passkey request timed out or rejected by user.",void 0,_e.PASSKEY_NOT_ALLOWED);throw Te(e)}}async _initRegisterOnce(e){if(!this.api)throw new Ce("Auth flow has no API instance");let t=Gr(e);return await this.api.post(qt,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new Ce("Auth flow has no API instance");let t=Gr(e);return await this.api.post(Ht,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new Ce("Auth flow has no API instance");return await this.api.post(Vt,{})}_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 Qr(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new Qr(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Qr(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t,hints:n}}}const ua=({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 ha{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 Ce("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 Ce("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 Ce("SiweFlow has no client instance");try{if(!this.wallet)throw new Ce("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 Ce("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new Ce("Could not prepare SIWE message");if(!this.wallet)throw new Ce("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 Ce("SiweFlow has no client instance");if(!this.wallet)throw new Ce("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 Ce("SiweFlow has no client instance");if(!this.wallet)throw new Ce("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=ua({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a){this._meta={disableSignup:!1},this.getNonceOnce=new Qr(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 pa{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 Ce("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 Ce("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 Ce("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new Ce("Could not prepare SIWS message");if(!n&&!this.wallet.provider.signMessage||n&&!this.wallet.provider.signTransaction)throw new Ce("Wallet does not support the necessary signing methods");if(n&&this._plugin){let n=await this.wallet.provider.signTransaction({transaction:$n.decode(this.preparedMessage)});e=$n.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=$n.encode(n.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new Ce("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new Ce("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=Mn({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 Qr(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 wa{async authenticate(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new Ce("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,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw Te(e)}}async link(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new Ce("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Kt,{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 Ce("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new Ce("phone nNumber must be set when initialzing authentication.");let r=Gr(n);try{return await this.api.post($t,{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 ma extends wa{async link(){if(!this.api)throw new Ce("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new Ce("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Gt,{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 ya=/*#__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:Ee,reset:Se,execute:Se});class ga extends be{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const fa=({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 H((()=>i.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new ga("Captcha failed",null,_e.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 H((()=>c.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new ga("Captcha failed",null,_e.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:Ee,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(ya.Provider,{value:f,children:e})},va=()=>a(ya);class Aa{async authenticate(){if(!this.api)throw new Ce("Auth flow has no API instance");try{return await this.api.post(Yt,{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 Ce("Auth flow has no API instance");try{return await this.api.post(Jt,{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 ka(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===_e.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===_e.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===_e.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===_e.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===_e.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===_e.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===_e.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof ga&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Ca(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Ta(){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 _a=/*#__PURE__*/u((()=>import("./TurnstileWrapper-Co-t5mTh.mjs"))),ba=/*#__PURE__*/u((()=>import("./HCaptchaWrapper-Dl2Jt_Df.mjs")));const Sa=n=>{let r=va();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(_a,{...n,captchaContext:r}),"hcaptcha"===r.provider&&/*#__PURE__*/t(ba,{...n,captchaContext:r})]})}):null};var Ea=/*#__PURE__*/Object.freeze({__proto__:null,AccountNotFoundScreen:()=>import("./AccountNotFoundScreen-Bk2ZDlxR.mjs"),AffirmativeConsentScreen:()=>import("./AffirmativeConsentScreen-CMcGT-7c.mjs"),AllowlistRejectionScreen:()=>import("./AllowlistRejectionScreen-CgdkdFzy.mjs"),AuthenticateWithWalletScreen:()=>import("./AuthenticateWithWalletScreen-fhyjSxI8.mjs"),AwaitingEvmToSolBridgingScreen:()=>import("./AwaitingEvmToSolBridgingScreen-DbNP1yPY.mjs"),AwaitingExternalEthereumTransferScreen:()=>import("./AwaitingExternalEthereumTransferScreen-COnzLcDW.mjs"),AwaitingPasswordlessCodeScreen:()=>import("./AwaitingPasswordlessCodeScreen-D9BoqETu.mjs"),AwaitingSolToEvmBridgingScreen:()=>import("./AwaitingSolToEvmBridgingScreen-JY-d6qlj.mjs"),CaptchaScreen:()=>import("./CaptchaScreen-D3uGo3qJ.mjs"),CoinbaseOnrampStatusScreen:()=>import("./CoinbaseOnrampStatusScreen-Ce2Z_vJB.mjs"),ConnectLedgerScreen:()=>import("./ConnectLedgerScreen-CRDZ_shP.mjs"),ConnectOnlyLandingScreen:()=>import("./ConnectOnlyLandingScreen-NSgaj_D4.mjs"),ConnectOnlyStatusScreen:()=>import("./ConnectOnlyStatusScreen-DAGVWgFv.mjs"),ConnectOrCreateScreen:()=>import("./ConnectOrCreateScreen-CuVcGxrh.mjs"),ConnectionStatusScreen:()=>import("./ConnectionStatusScreen-DVtobAVi.mjs"),CrossAppAuthScreen:()=>import("./CrossAppAuthScreen-B0633bnY.mjs"),DelegatedActionsConsentScreen:()=>import("./DelegatedActionsConsentScreen-Cm3QtgBC.mjs"),DelegatedActionsRevokeScreen:()=>import("./DelegatedActionsRevokeScreen-C2WBGR2c.mjs"),EmbeddedWalletConnectingScreen:()=>import("./EmbeddedWalletConnectingScreen-CpKPkmKa.mjs"),EmbeddedWalletCreatedScreen:()=>import("./EmbeddedWalletCreatedScreen-CMyRcNaG.mjs"),EmbeddedWalletKeyExportScreen:()=>import("./EmbeddedWalletKeyExportScreen-nkSO3O1P.mjs"),EmbeddedWalletOnAccountCreateScreen:()=>import("./EmbeddedWalletOnAccountCreateScreen-rwdmo9iN.mjs"),EmbeddedWalletPasswordCreateScreen:()=>import("./RecoveryPasswordCreateScreen-Brv0MUPN.mjs"),EmbeddedWalletPasswordUpdateScreen:()=>import("./EmbeddedWalletPasswordUpdateScreen-Tcp68U7U.mjs"),EmbeddedWalletPasswordUpdateSplashScreen:()=>import("./EmbeddedWalletPasswordUpdateSplashScreen-5PH-3FQ3.mjs"),ErrorScreen:()=>import("./ErrorScreen-BdxNEgU1.mjs"),FarcasterConnectStatusScreen:()=>import("./FarcasterConnectStatusScreen-CruCPzPD.mjs"),FarcasterSignerStatusScreen:()=>import("./FarcasterSignerStatusScreen-DBAyc7bd.mjs"),FundSolWalletWithExternalSolanaWallet:()=>import("./FundSolWalletWithExternalSolanaWallet-Fxpj9pEN.mjs"),FundingAmountEditScreen:()=>import("./FundingEditAmountScreen-yKYKiyG9.mjs"),FundingMethodSelectionScreen:()=>import("./FundingMethodSelectionScreen-Dr-QG6BQ.mjs"),InAppBrowserLoginNotPossible:()=>import("./InAppBrowserLoginNotPossible-BYO_nlWy.mjs"),InstallWalletScreen:()=>import("./InstallWalletScreen-Cma1GXX4.mjs"),LandingScreen:()=>import("./LandingScreen-DCR5C-gA.mjs"),LinkConflictScreen:()=>import("./LinkConflictScreen-C8kM_4ZL.mjs"),LinkEmailScreen:()=>import("./LinkEmailScreen-DsrprT7p.mjs"),LinkPasskeyScreen:()=>import("./LinkPasskeyScreen-yKY5ebtx.mjs"),LinkPhoneScreen:()=>import("./LinkPhoneScreen-BklMbJs1.mjs"),LoginFailedScreen:()=>import("./LoginFailedScreen-CVGjcD9g.mjs"),ManualTransferScreen:()=>import("./ManualTransferScreen-C6MTkQcg.mjs"),MfaAuthEnrollmentFlowScreen:()=>import("./MfaAuthEnrollmentFlowScreen-BrEYUoOi.mjs"),MfaAuthVerifyFlowScreen:()=>import("./MfaAuthVerifyFlowScreen-D_LbAt1N.mjs"),MfaEnrollmentFlowScreen:()=>import("./MfaEnrollmentFlowScreen-BseHvqlH.mjs"),MoonpayStatusScreen:()=>import("./MoonpayStatusScreen-D-Qnyxst.mjs"),OAuthStatusScreen:()=>import("./OAuthStatusScreen-pEjYhAdx.mjs"),PasskeySelectSignupOrLogin:()=>import("./PasskeySelectSignupOrLogin-CmmjfwZM.mjs"),PasskeyStatusScreen:()=>import("./PasskeyStatusScreen-AiT-3Rq0.mjs"),PasswordRecoveryScreen:()=>import("./PasswordRecoveryScreen-BW7BBSLI.mjs"),RecoveryOAuthScreen:()=>import("./RecoveryOAuthStatusScreen-BGxGq84t.mjs"),RecoverySelectionScreen:()=>import("./RecoverySelectionScreen-CluXGpRG.mjs"),SendTransactionScreen:()=>import("./index-C9_VQk69.mjs"),SetAutomaticRecoveryScreen:()=>import("./SetAutomaticRecoveryScreen-nXcm7pIi.mjs"),SignRequestScreen:()=>import("./SignRequestScreen-Cp5zIIZ3.mjs"),StandardSignAndSendTransactionScreen:()=>import("./StandardSignAndSendTransactionScreen-bbPFP1pO.mjs"),TelegramAuthScreen:()=>import("./TelegramAuthScreen-DorSPB8G.mjs"),TransferFromWalletScreen:()=>import("./TransferFromWalletScreen-BeSvua3b.mjs"),UpdateEmailScreen:()=>import("./UpdateEmailScreen-BolXWblK.mjs"),UpdatePhoneScreen:()=>import("./UpdatePhoneScreen-G2aRPp1w.mjs"),UserLimitReachedScreen:()=>import("./UserLimitReachedScreen-BUXcfdpd.mjs"),WalletInterstitialScreen:()=>import("./WalletInterstitialScreen-6lMKxpAk.mjs")});function Ia(e){Qn("configureMfa",e)}const Pa=nr((()=>({inProgressMfaFlow:void 0})));const Wa=/*#__PURE__*/Yn([":root{","};"],(e=>Ua(e.palette)));const Ua=e=> /*#__PURE__*/Jn(["",""],Object.entries(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)).map((([e,t])=>`${e}: ${t};`)).join("\n")),Na=/*#__PURE__*/Gn.div.withConfig({displayName:"StylesWrapper",componentId:"sc-188229e4-0"})([""," color:var(--privy-color-foreground-2);h3{font-size:16px;line-height:24px;font-weight:500;color:var(--privy-color-foreground-2);}h4{font-size:14px;line-height:20px;font-weight:500;color:var(--privy-color-foreground);}p{font-size:13px;line-height:20px;color:var(--privy-color-foreground-2);}button:focus,input:focus,optgroup:focus,select:focus,textarea:focus{outline:none;border-color:var(--privy-color-accent-light);box-shadow:0 0 0 3px var(--privy-color-border-focus);}.mobile-only{@media (min-width:441px){display:none;}}@keyframes fadein{0%{opacity:0;}100%{opacity:1;}}"],"\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-appe