@privy-io/react-auth 1.73.2 → 1.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var wc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ad=(e,t,r)=>(wc(e,t,"read from private field"),r?r.call(e):t.get(e)),Qa=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},bc=(e,t,r,o)=>(wc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var xd=(e,t,r)=>(wc(e,t,"access private method"),r);import{getAddress as wo}from"@ethersproject/address";import{Web3Provider as Td}from"@ethersproject/providers";import{createStore as D8}from"mipd";import{useEffect as Nr,useMemo as U8,useRef as Li,useState as tt}from"react";import{isAndroid as F8}from"react-device-detect";import{ProviderErrors as B8,calculateTotalGasEstimate as H8,populateTransactionRequest as V8}from"@privy-io/js-sdk-core";import{FetchError as B2}from"ofetch";var Ze=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Pt=class extends Ze{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},C=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ja=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ie=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ne=e=>{if(e instanceof Ze)return e;if(!(e instanceof B2))return rt(e);if(!e.response)return new Pt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Pt(t||"ApiError",e.response.status,r||o,e,n)},rt=e=>e instanceof Ze?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var io=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},_t=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Xa=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var cr=class extends C{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var es="/api/v1/sessions",ts="/api/v1/sessions/logout",kd="/api/v1/sessions/fork",rs="/api/v1/sessions/fork/recover",Rd="/api/v1/siwe/init",Id="/api/v1/siwe/authenticate",Wd="/api/v1/siwe/link",Md="/api/v1/siwe/unlink",Od="/api/v1/farcaster/init",Ld="/api/v1/farcaster/authenticate",Nd="/api/v1/farcaster/link",Dd="/api/v1/farcaster/status",Ud="/api/v1/farcaster/unlink",Fd="/api/v1/passwordless/init",Bd="/api/v1/passwordless/authenticate",Hd="/api/v1/passwordless/link",Vd="/api/v1/passwordless/unlink",Gd="/api/v1/passwordless/update",qd="/api/v1/passwordless_sms/init",zd="/api/v1/passwordless_sms/link",$d="/api/v1/passwordless_sms/unlink",Kd="/api/v1/passwordless_sms/authenticate",os="/api/v1/oauth/init",jd="/api/v1/oauth/authenticate",ns="/api/v1/oauth/link",Yd="/api/v1/oauth/unlink",Zd="/api/v1/recovery/oauth/init",Qd="/api/v1/recovery/oauth/init_icloud",Jd="/api/v1/recovery/oauth/authenticate",Xd="/api/v1/passkeys/link/init",eu="/api/v1/passkeys/authenticate/init",tu="/api/v1/passkeys/link",ru="/api/v1/passkeys/authenticate",ou="/api/v1/passkeys/unlink",nu="/api/v1/telegram/authenticate",iu="/api/v1/telegram/link",au="/api/v1/telegram/unlink";var su="/api/v1/mfa/passwordless_sms/init",lu="/api/v1/mfa/passkeys/init",cu="/api/v1/users/me/accept_terms",is="/api/v1/analytics_events",pu="/api/v1/plugins/moonpay_on_ramp/sign",du="/api/v1/custom_jwt_account/authenticate";var Nn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(du,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){throw new Error("Unimplemented")}};var Eo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Bd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Hd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ne(t)}}async sendCodeEmail(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{return await this.api.post(Fd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ne(o)}}},as=class extends Eo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new C("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Gd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ne(r)}}};import{isMobile as V2,isIOS as G2}from"react-device-detect";var Ec=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},ss=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Tc(){try{let e="privy:__session_storage__test",t="blobby",r=new ss;return r.put(e,t),r.del(e),!0}catch{return!1}}function H2(){return typeof window<"u"&&window.localStorage?new ss:new Ec}var Q=H2();import{StaticJsonRpcProvider as Ui}from"@ethersproject/providers";function uu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var ls=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Sc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ls(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Sc(r))return!1}return!0},To=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),cs=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var mu=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},ps=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),fu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},pr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Pc=e=>new Promise(t=>setTimeout(t,e));function hu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,s=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(s,t)};s()})}var Fi=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,s=0;for(;!i&&s<o;){if(t.abortSignal?.aborted)return;e().then(l=>{i=!0,n(l)},(...l)=>{i=!0,a(...l)}),s+=1,await Pc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ds=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[i,s]of Object.entries(r))s!==void 0&&n.searchParams.set(i,s);let a=Object.entries(o);if(a.length>0){let i=new URLSearchParams;for(let[s,l]of a)i.append(s,l);n.hash=i.toString()}return n.href};var yu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),jo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function gu(e,t,r,o=3e3){let n=!1,a=window;return new Promise(i=>{a.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout(()=>{s()},o));function s(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",s);let l=e.getProviders(),c=[];for(let u of l)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||c.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of uu()){let h=ls(u);if(!l.some(m=>m.info.name===h)){if(Sc(u,!0)&&!c.find(m=>m.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:u});continue}if(h==="Phantom"&&!c.find(m=>m.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:u});continue}if(h==="Coinbase Wallet"&&!c.find(m=>m.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}c.find(m=>m.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}i(c)}})}function Dn(e){return`eip155:${String(Number(e))}`}var vu=(e,t,r,o)=>{let n=Number(e),a=t.find(s=>s.id===n);if(!a)throw new ie(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let s=new URL(a.rpcUrls.privy.http[0]);s.searchParams.append("privyAppId",o),i=s.toString()}else a.rpcUrls.public?.http[0]?i=a.rpcUrls.public.http[0]:i=a.rpcUrls.default?.http[0];if(!i)throw new ie(`No RPC url found for ${e}`);return i},Cu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ie(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},ao=(e,t,r,o)=>{let n=Number(e),a=t.find(s=>s.id===n);if(!a)throw new ie(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Ui(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Ui(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Ui({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.public?.http[0]?i=new Ui(a.rpcUrls.public.http[0]):i=new Ui(a.rpcUrls.default?.http[0]),!i)throw new ie(`No RPC url found for ${e}`);return i},Bi=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var us=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ms))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ms={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function wu(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function bu(e,t){let r=wu(t);if(r.deepLink)return Au(r.deepLink,e);if(r.universalLink)return _c(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function Eu(e,t){let r=wu(t);if(r.universalLink)return _c(r.universalLink,e)}var Tu="WALLETCONNECT_DEEPLINK_CHOICE";function Su(){try{localStorage.removeItem(Tu)}catch{}}function Pu({href:e,name:t}){try{localStorage.setItem(Tu,JSON.stringify({href:e,name:t}))}catch{}}function _u(e){return e.startsWith("http://")||e.startsWith("https://")}function Au(e,t){if(_u(e))return _c(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function _c(e,t){if(!_u(e))return Au(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function fs(e,t){window.open(e,t,"noreferrer noopener")}var De=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Hi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new De(this._startChannelOnce.bind(this)),this.pollForReady=new De(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(Ld,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Nd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ne(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(Od,{token:this.captchaToken});V2&&!G2&&t.connect_uri&&fs(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(Dd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var xu="1.73.2";var ku="34357d3c125c2bcf2ce2bc3309d98715",hs="https://auth.privy.io",Ru=2e4,Le=1400,Iu=2500,Ac=xu;var Yo="privy:token",xc="privy-token",ys="privy:refresh_token",Wu="privy-refresh-token",gs="privy-session",Vi="privy:session_transfer_token",z2="privy:wallet",Gi="privy:caid",qi=e=>`privy:cross-app:${e}`,Zo="privy:state_code",Qo="privy:code_verifier",Jo="privy:headless_oauth",vs=e=>`${z2}:${e}`,kc="privy:connectors",Rc="privy:connections";var Xo=12e4,so=1,Ic="0x1",Un=3e4,Mu="https://api.moonpay.com/v1",Ou="https://api.moonpay.com/v1",Lu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Nu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Du="deprecated";import{base64url as Bu}from"jose";async function Uu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Fu(e){return crypto.getRandomValues(new Uint8Array(e))}var $2="S256",K2="S256";function en(){return Bu.encode(Fu(36))}function Fn(){return en()}async function Bn(e,t=$2){if(t==K2){let r=await Uu(e);return Bu.encode(r)}else return e}function Hu(){let e=Q.get(Qo);if(!e)throw new C("Authentication error.");return e}function Cs(){return!!Q.get(Jo)}var Br=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Cs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Hu();try{let r=await this.api.post(jd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(Qo),this.meta.headless&&Q.del(Jo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=ne(r);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Q.get(Qo);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(ns,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(Qo),r}catch(r){throw ne(r)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=en();Q.put(Qo,t);let r=Fn();Q.put(Zo,r);let o=await Bn(t);this.meta.headless&&Q.put(Jo,!0);try{return await this.api.post(os,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ne(n)}}};function Wc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Vu,jsxs as j2}from"react/jsx-runtime";var ws=({style:e,...t})=>j2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Vu("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Vu("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as zi,jsxs as Y2}from"react/jsx-runtime";var bs=({style:e,...t})=>Y2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[zi("g",{clipPath:"url(#clip0)",children:zi("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),zi("defs",{children:zi("clipPath",{id:"clip0",children:zi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Gu}from"react/jsx-runtime";var Es=({style:e,...t})=>Gu("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Gu("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as Z2}from"@heroicons/react/24/outline";import{jsx as Q2}from"react/jsx-runtime";var qu=({style:e})=>Q2(Z2,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Ts,jsxs as J2}from"react/jsx-runtime";var Ss=({style:e,...t})=>J2("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ts("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ts("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ts("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ts("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as dr,jsxs as Ps}from"react/jsx-runtime";function _s(e){return Ps("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Ps("defs",{children:[Ps("linearGradient",{id:"b",children:[dr("stop",{offset:"0",stopColor:"#3771c8"}),dr("stop",{stopColor:"#3771c8",offset:".128"}),dr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Ps("linearGradient",{id:"a",children:[dr("stop",{offset:"0",stopColor:"#fd5"}),dr("stop",{offset:".1",stopColor:"#fd5"}),dr("stop",{offset:".5",stopColor:"#ff543e"}),dr("stop",{offset:"1",stopColor:"#c837ab"})]}),dr("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),dr("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),dr("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),dr("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),dr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as As}from"react/jsx-runtime";function xs({style:e,...t}){return As("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:As("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:As("g",{transform:"scale(5.12,5.12)",children:As("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as zu,jsxs as X2}from"react/jsx-runtime";function ks(e){return X2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[zu("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),zu("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as Mc,jsxs as ev}from"react/jsx-runtime";function Rs(e){return ev("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Mc("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Mc("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Mc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as $u}from"react/jsx-runtime";var Is=({style:e,...t})=>$u("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:$u("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Ku={google:{name:"Google",component:Ss},discord:{name:"Discord",component:bs},github:{name:"Github",component:Es},linkedin:{name:"LinkedIn",component:xs},twitter:{name:"Twitter",component:Is},spotify:{name:"Spotify",component:ks},instagram:{name:"Instagram",component:_s},tiktok:{name:"Tiktok",component:Rs},apple:{name:"Apple",component:ws}},$i=e=>e in Ku?Ku[e]:{name:"Unknown",component:qu};function ju(e,t){let r={detail:"",retryable:!1},o=Wc(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=$i(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=$i(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function Ki(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Cs(),popupFlow:window.opener!==null&&n}}function tn(){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"),Q.del(Zo),window.history.replaceState({},"",e)}var rn=class{constructor(t){this.initAuthenticateOnce=new De(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new De(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(ru,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(tu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(eu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Xd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Ws=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",i=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
1
+ var wc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ad=(e,t,r)=>(wc(e,t,"read from private field"),r?r.call(e):t.get(e)),Za=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},bc=(e,t,r,o)=>(wc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var xd=(e,t,r)=>(wc(e,t,"access private method"),r);import{getAddress as wo}from"@ethersproject/address";import{Web3Provider as Td}from"@ethersproject/providers";import{createStore as H8}from"mipd";import{useEffect as Nr,useMemo as V8,useRef as Oi,useState as tt}from"react";import{isAndroid as G8}from"react-device-detect";import{ProviderErrors as q8,calculateTotalGasEstimate as z8,populateTransactionRequest as $8}from"@privy-io/js-sdk-core";import{FetchError as H2}from"ofetch";var Ze=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Pt=class extends Ze{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},C=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Qa=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ie=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ne=e=>{if(e instanceof Ze)return e;if(!(e instanceof H2))return rt(e);if(!e.response)return new Pt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Pt(t||"ApiError",e.response.status,r||o,e,n)},rt=e=>e instanceof Ze?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var io=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},_t=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ja=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var cr=class extends C{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var Xa="/api/v1/sessions",es="/api/v1/sessions/logout",kd="/api/v1/sessions/fork",ts="/api/v1/sessions/fork/recover",Rd="/api/v1/siwe/init",Id="/api/v1/siwe/authenticate",Md="/api/v1/siwe/link",Wd="/api/v1/siwe/unlink",Od="/api/v1/farcaster/init",Ld="/api/v1/farcaster/authenticate",Nd="/api/v1/farcaster/link",Dd="/api/v1/farcaster/status",Ud="/api/v1/farcaster/unlink",Fd="/api/v1/passwordless/init",Bd="/api/v1/passwordless/authenticate",Hd="/api/v1/passwordless/link",Vd="/api/v1/passwordless/unlink",Gd="/api/v1/passwordless/update",qd="/api/v1/passwordless_sms/init",zd="/api/v1/passwordless_sms/link",$d="/api/v1/passwordless_sms/unlink",Kd="/api/v1/passwordless_sms/authenticate",rs="/api/v1/oauth/init",jd="/api/v1/oauth/authenticate",os="/api/v1/oauth/link",Yd="/api/v1/oauth/unlink",Zd="/api/v1/recovery/oauth/init",Qd="/api/v1/recovery/oauth/init_icloud",Jd="/api/v1/recovery/oauth/authenticate",Xd="/api/v1/passkeys/link/init",eu="/api/v1/passkeys/authenticate/init",tu="/api/v1/passkeys/link",ru="/api/v1/passkeys/authenticate",ou="/api/v1/passkeys/unlink",nu="/api/v1/telegram/authenticate",iu="/api/v1/telegram/link",au="/api/v1/telegram/unlink";var su="/api/v1/mfa/passwordless_sms/init",lu="/api/v1/mfa/passkeys/init",cu="/api/v1/users/me/accept_terms",ns="/api/v1/analytics_events",pu="/api/v1/plugins/moonpay_on_ramp/sign",du="/api/v1/custom_jwt_account/authenticate";var Ln=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(du,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){throw new Error("Unimplemented")}};var Eo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Bd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Hd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ne(t)}}async sendCodeEmail(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{return await this.api.post(Fd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ne(o)}}},is=class extends Eo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new C("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Gd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ne(r)}}};import{isMobile as G2,isIOS as q2}from"react-device-detect";var Ec=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},as=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Tc(){try{let e="privy:__session_storage__test",t="blobby",r=new as;return r.put(e,t),r.del(e),!0}catch{return!1}}function V2(){return typeof window<"u"&&window.localStorage?new as:new Ec}var J=V2();import{StaticJsonRpcProvider as Di}from"@ethersproject/providers";function uu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var ss=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Sc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ss(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Sc(r))return!1}return!0},To=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ls=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var mu=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},cs=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),hu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},pr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Pc=e=>new Promise(t=>setTimeout(t,e));function fu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,s=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(s,t)};s()})}var Ui=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,s=0;for(;!i&&s<o;){if(t.abortSignal?.aborted)return;e().then(l=>{i=!0,n(l)},(...l)=>{i=!0,a(...l)}),s+=1,await Pc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ps=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[i,s]of Object.entries(r))s!==void 0&&n.searchParams.set(i,s);let a=Object.entries(o);if(a.length>0){let i=new URLSearchParams;for(let[s,l]of a)i.append(s,l);n.hash=i.toString()}return n.href};var yu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),jo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function gu(e,t,r,o=3e3){let n=!1,a=window;return new Promise(i=>{a.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout(()=>{s()},o));function s(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",s);let l=e.getProviders(),c=[];for(let u of l)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||c.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of uu()){let f=ss(u);if(!l.some(m=>m.info.name===f)){if(Sc(u,!0)&&!c.find(m=>m.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:u});continue}if(f==="Phantom"&&!c.find(m=>m.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:u});continue}if(f==="Coinbase Wallet"&&!c.find(m=>m.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}c.find(m=>m.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}i(c)}})}function Nn(e){return`eip155:${String(Number(e))}`}var vu=(e,t,r,o)=>{let n=Number(e),a=t.find(s=>s.id===n);if(!a)throw new ie(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let s=new URL(a.rpcUrls.privy.http[0]);s.searchParams.append("privyAppId",o),i=s.toString()}else a.rpcUrls.public?.http[0]?i=a.rpcUrls.public.http[0]:i=a.rpcUrls.default?.http[0];if(!i)throw new ie(`No RPC url found for ${e}`);return i},Cu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ie(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},ao=(e,t,r,o)=>{let n=Number(e),a=t.find(s=>s.id===n);if(!a)throw new ie(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Di(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Di(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Di({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.public?.http[0]?i=new Di(a.rpcUrls.public.http[0]):i=new Di(a.rpcUrls.default?.http[0]),!i)throw new ie(`No RPC url found for ${e}`);return i},Fi=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ds=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(us))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var us={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function wu(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function bu(e,t){let r=wu(t);if(r.deepLink)return Au(r.deepLink,e);if(r.universalLink)return _c(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function Eu(e,t){let r=wu(t);if(r.universalLink)return _c(r.universalLink,e)}var Tu="WALLETCONNECT_DEEPLINK_CHOICE";function Su(){try{localStorage.removeItem(Tu)}catch{}}function Pu({href:e,name:t}){try{localStorage.setItem(Tu,JSON.stringify({href:e,name:t}))}catch{}}function _u(e){return e.startsWith("http://")||e.startsWith("https://")}function Au(e,t){if(_u(e))return _c(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function _c(e,t){if(!_u(e))return Au(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ms(e,t){window.open(e,t,"noreferrer noopener")}var De=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Bi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new De(this._startChannelOnce.bind(this)),this.pollForReady=new De(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(Ld,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Nd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ne(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(Od,{token:this.captchaToken});G2&&!q2&&t.connect_uri&&ms(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(Dd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var xu="1.74.0";var ku="34357d3c125c2bcf2ce2bc3309d98715",hs="https://auth.privy.io",Ru=2e4,Le=1400,Iu=2500,Ac=xu;var Yo="privy:token",xc="privy-token",fs="privy:refresh_token",Mu="privy-refresh-token",ys="privy-session",Hi="privy:session_transfer_token",$2="privy:wallet",Vi="privy:caid",Gi=e=>`privy:cross-app:${e}`,Zo="privy:state_code",Qo="privy:code_verifier",Jo="privy:headless_oauth",gs=e=>`${$2}:${e}`,kc="privy:connectors",Rc="privy:connections";var Xo=12e4,so=1,Ic="0x1",Dn=3e4,Wu="https://api.moonpay.com/v1",Ou="https://api.moonpay.com/v1",Lu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Nu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Du="deprecated";import{base64url as Bu}from"jose";async function Uu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Fu(e){return crypto.getRandomValues(new Uint8Array(e))}var K2="S256",j2="S256";function en(){return Bu.encode(Fu(36))}function Un(){return en()}async function Fn(e,t=K2){if(t==j2){let r=await Uu(e);return Bu.encode(r)}else return e}function Hu(){let e=J.get(Qo);if(!e)throw new C("Authentication error.");return e}function vs(){return!!J.get(Jo)}var Br=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:vs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Hu();try{let r=await this.api.post(jd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(Qo),this.meta.headless&&J.del(Jo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=ne(r);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=J.get(Qo);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(os,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(Qo),r}catch(r){throw ne(r)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=en();J.put(Qo,t);let r=Un();J.put(Zo,r);let o=await Fn(t);this.meta.headless&&J.put(Jo,!0);try{return await this.api.post(rs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ne(n)}}};function Mc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Vu,jsxs as Y2}from"react/jsx-runtime";var Cs=({style:e,...t})=>Y2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Vu("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Vu("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as qi,jsxs as Z2}from"react/jsx-runtime";var ws=({style:e,...t})=>Z2("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[qi("g",{clipPath:"url(#clip0)",children:qi("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),qi("defs",{children:qi("clipPath",{id:"clip0",children:qi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Gu}from"react/jsx-runtime";var bs=({style:e,...t})=>Gu("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Gu("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as Q2}from"@heroicons/react/24/outline";import{jsx as J2}from"react/jsx-runtime";var qu=({style:e})=>J2(Q2,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Es,jsxs as X2}from"react/jsx-runtime";var Ts=({style:e,...t})=>X2("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Es("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Es("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Es("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Es("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as dr,jsxs as Ss}from"react/jsx-runtime";function Ps(e){return Ss("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Ss("defs",{children:[Ss("linearGradient",{id:"b",children:[dr("stop",{offset:"0",stopColor:"#3771c8"}),dr("stop",{stopColor:"#3771c8",offset:".128"}),dr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Ss("linearGradient",{id:"a",children:[dr("stop",{offset:"0",stopColor:"#fd5"}),dr("stop",{offset:".1",stopColor:"#fd5"}),dr("stop",{offset:".5",stopColor:"#ff543e"}),dr("stop",{offset:"1",stopColor:"#c837ab"})]}),dr("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),dr("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),dr("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),dr("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),dr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as _s}from"react/jsx-runtime";function As({style:e,...t}){return _s("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:_s("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:_s("g",{transform:"scale(5.12,5.12)",children:_s("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as zu,jsxs as ev}from"react/jsx-runtime";function xs(e){return ev("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[zu("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),zu("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as Wc,jsxs as tv}from"react/jsx-runtime";function ks(e){return tv("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Wc("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Wc("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Wc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as $u}from"react/jsx-runtime";var Rs=({style:e,...t})=>$u("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:$u("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Ku={google:{name:"Google",component:Ts},discord:{name:"Discord",component:ws},github:{name:"Github",component:bs},linkedin:{name:"LinkedIn",component:As},twitter:{name:"Twitter",component:Rs},spotify:{name:"Spotify",component:xs},instagram:{name:"Instagram",component:Ps},tiktok:{name:"Tiktok",component:ks},apple:{name:"Apple",component:Cs}},zi=e=>e in Ku?Ku[e]:{name:"Unknown",component:qu};function ju(e,t){let r={detail:"",retryable:!1},o=Mc(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=zi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=zi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function $i(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:vs(),popupFlow:window.opener!==null&&n}}function tn(){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"),J.del(Zo),window.history.replaceState({},"",e)}var rn=class{constructor(t){this.initAuthenticateOnce=new De(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new De(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(ru,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(tu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(eu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Xd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Is=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",i=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
2
2
  ${e}
3
3
 
4
4
  ${a}
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${r}
10
10
  Issued At: ${i}
11
11
  Resources:
12
- - https://privy.io`};var lo=class{constructor(t,r,o){this.getNonceOnce=new De(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ne(t)}}async sign(){if(!this.client)throw new C("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new C("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new C("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Ws({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var on=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Kd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(zd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ne(t)}}async sendSmsCode(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(qd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ne(o)}}};var Hn=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(nu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(iu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ne(t)}}};function Lc(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function Yu(){let e;if(e=tv(),e)return Oc(),{...e,flowType:"login-url"};if(e=rv(),e)return Oc(),{...e,flowType:"web-app"};Oc()}function tv(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),a=e.get("last_name")||void 0,i=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:a,username:i,photo_url:s,auth_date:o,hash:r}}function rv(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash");if(!(!r||!o||!n||!a))return{query_id:r,user:o,auth_date:n,hash:a}}function Oc(){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"),window.history.replaceState({},"",e)}import{v4 as Kv}from"uuid";function Z(e){return e?new Date(e*1e3):null}function ov(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let a={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(a);break;case"email":let i={address:r.address,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(i);break;case"phone":let s={number:r.phoneNumber,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(s);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(u);break;case"twitter_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(h);break;case"discord_oauth":let m={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(m);break;case"github_oauth":let g={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(g);break;case"tiktok_oauth":let w={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(w);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let T={subject:r.subject,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(T);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)});break;case"farcaster":let _={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let b={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(b);break;case"telegram":let S={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:Z(r.first_verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(S);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Dt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var we=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,nn=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,Ms=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,nv=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ut=(e,t)=>we(e)||nn(e)?!1:t==="all-users"||t==="users-without-wallets"&&!nv(e)?.length;function Ft(e){if(!e)return null;let t=ov(e.linked_accounts),r=Dt(t,"wallet"),o=Dt(t,"email"),n=Dt(t,"phone"),a=Dt(t,"google_oauth"),i=Dt(t,"twitter_oauth"),s=Dt(t,"discord_oauth"),l=Dt(t,"github_oauth"),c=Dt(t,"spotify_oauth"),u=Dt(t,"instagram_oauth"),h=Dt(t,"tiktok_oauth"),m=Dt(t,"linkedin_oauth"),g=Dt(t,"apple_oauth"),w=Dt(t,"farcaster"),y=Dt(t,"telegram"),T=e.mfa_methods.map(({type:b,verified_at:S})=>({type:b,verifiedAt:Z(S)}));return{id:e.id,createdAt:Z(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:s&&{subject:s.subject,username:s.username,email:s.email},github:l&&{subject:l.subject,username:l.username,name:l.name,email:l.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:h&&{subject:h.subject,username:h.username,name:h.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email,vanityName:m.vanityName},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:T.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Ym}from"@ethersproject/address";import{isHexString as Hv}from"@ethersproject/bytes";import Vv from"eventemitter3";import uv from"@coinbase/wallet-sdk";import{jsx as Zu,jsxs as iv}from"react/jsx-runtime";var ji=({style:e,...t})=>iv("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zu("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Zu("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"})]});import{getAddress as Vr}from"@ethersproject/address";import{Web3Provider as rm}from"@ethersproject/providers";import{default as pv}from"eventemitter3";import cv from"eventemitter3";var av=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Qu=e=>av.includes(e);import{ErrorCode as sv}from"@ethersproject/logger";import{ProviderErrors as an}from"@privy-io/js-sdk-core";var Vn=class extends ie{constructor(){super("Wallet timeout");this.type="wallet_error"}},Gn=class extends ie{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof ie)return e;if(e?.code&&e?.reason){let t=new st(e);return e.code===sv.ACTION_REJECTED&&(t.details=an.E4001_USER_REJECTED_REQUEST),t}return e?.code?new st(e):new ie("Unknown connector error",e)},jt=class extends Ze{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},st=class extends jt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(an).find(a=>a.eipCode===o.code);this.details=n||an.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=an.E32002_CONNECTION_ALREADY_PENDING:this.details=an.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=an.E32002_WALLET_LOCKED))}},lv={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},co={...lv,...an};var Ve=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Vn,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Xo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ie(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw br(r)})}},So=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Yi=class extends cv{constructor(r,o,n,a,i,s=1){super();this.walletProxy=r,this.address=o,this.chainId=s,this.rpcConfig=n,this.chains=a,this.provider=ao(s,this.chains,n,{appId:i}),this.rpcTimeoutDuration=qn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new So(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await he()||!this.address)throw new So("Disconnected",4900);return(await em(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new So(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new So(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=ao(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await Ju(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Xu(Bi(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:jo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(a){throw console.warn(`Gas estimation failed with error: ${a} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return jo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Qu(r.method)){let o=await he();if(await tm(),!o||!this.address)throw new So("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new So("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await he();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Hr=class extends Ve{constructor(r){super(r,r.rpcTimeoutDuration)}},Po=class extends Ve{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var dv=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Bt=class extends pv{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Dn(r),this.walletClientType==="privy"&&Q.put(vs(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=qn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(s=>Vr(s.address)===Vr(r));return{address:Vr(r),chainId:o,meta:n,imported:a,switchChain:async s=>{if(!i)throw new ie("Wallet is not currently connected.");let l=this.wallets.find(g=>Vr(g.address)===Vr(r))?.chainId;if(!l)throw new ie("Unable to determine current chainId.");let c,u;if(typeof s=="number"?(c=`0x${s.toString(16)}`,u=s):(c=s,u=Number(s)),l===Dn(c))return;let h=this.chains.find(g=>g.id===u);if(!h)throw new ie(`Unsupported chainId: ${s}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await m()}catch(g){if(dv(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:h.name,nativeCurrency:h.nativeCurrency,rpcUrls:[h.rpcUrls.default?.http[0]??""],blockExplorerUrls:[h.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new ie(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return new rm(new Hr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return new Po(this.proxyProvider)},sign:async s=>{if(!await i())throw new ie("Wallet is not currently connected.");return await this.sign(s)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await Fi(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=Vr(n),i=[],s;if(this.walletClientType==="privy"){let c=Q.get(vs(a));this.chains.find(u=>u.id===Number(c))||(Q.del(vs(a)),c=null),s=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${s} on initialization`)}}else try{let c=await Fi(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")s=c;else if(typeof c=="number")s=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Ic}`,c),s=Ic}let l=Dn(s);if(!i.find(c=>Vr(c.address)===a)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(Vr(n),l,c,this.connectorType==="embedded_imported"))}Os(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>Vr(n)===Vr(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new rm(new Hr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var mv=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],fv=(e,t)=>e.makeWeb3Provider({options:t}),Nc,Ls=class extends Bt{constructor(r,o,n,a,i,s){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=a.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Nc){let l=[o.id].concat(r.map(u=>u.id)),c=this.connectionOptions!=="eoaOnly"?l.filter(u=>!mv.includes(u)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Nc=new uv({appName:i,appLogoUrl:s,appChainIds:l})}this.proxyProvider.setWalletProvider(fv(Nc,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:ji,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as om}from"react/jsx-runtime";var zn=({...e})=>om("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:om("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)"})});var Zi=class extends Bt{constructor(r,o,n,a,i=!1){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[jo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:zn,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as nm}from"react/jsx-runtime";var $n=({style:e,...t})=>nm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:nm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Yt,jsxs as hv}from"react/jsx-runtime";var Kn=({style:e,...t})=>hv("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[Yt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Yt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Yt("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),Yt("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),Yt("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),Yt("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),Yt("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),Yt("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),Yt("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),Yt("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),Yt("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),Yt("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),Yt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as im,jsxs as yv}from"react/jsx-runtime";var Gr=({style:e,...t})=>yv("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[im("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),im("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Yn=class extends Bt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let s=a.provider;this.proxyProvider.setWalletProvider(s)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},jn,Zn=class extends Bt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Qa(this,jn,void 0);this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?bc(this,jn,{name:"MetaMask",icon:Kn,id:"io.metamask"}):i==="phantom"&&bc(this,jn,{name:"Phantom",icon:Gr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Ad(this,jn)??{name:"Browser Extension",icon:$n,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};jn=new WeakMap;import{getAddress as RP}from"@ethersproject/address";import{Web3Provider as WP}from"@ethersproject/providers";import{isMobile as gv}from"react-device-detect";var Ns=class extends Yn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{gv||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Ds=class extends Bt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Ve(void 0,Xo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Us=class extends Ds{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Gr,id:"phantom"}}};import{EthereumProvider as Dv,OPTIONAL_EVENTS as Uv,OPTIONAL_METHODS as Fv}from"@walletconnect/ethereum-provider";import{isMobile as Bv}from"react-device-detect";import{createContext as kv,useContext as Rv,useEffect as Bc,useRef as Iv,useState as Wv}from"react";import{jsx as vv}from"react/jsx-runtime";function Fs({src:e,...t}){return vv("img",{src:e,...t,style:{display:"none"}})}import{useContext as qm,useEffect as Gm,useMemo as Pv,useState as _v}from"react";import{createContext as Av}from"react";var Zt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ku,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var am=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var Cv=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),sm=e=>Cv.has(e),lm=(e,t,r)=>r.indexOf(e)===t,cm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(sm).filter(lm):e?e.filter(sm).filter(lm):Zt.appearance.walletList;var pm={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var dm={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var um={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var mm={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var fm={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var hm={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var ym={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var gm={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var vm={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var Cm={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var wm={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var bm={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var Em={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var Tm={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Sm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Pm={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var _m={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var Am={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Bs={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var xm={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var km={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Rm={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Im={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Wm={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Mm={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Om={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Lm={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Nm={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Dm={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Um={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Qi=[pm,dm,um,Sm,Lm,Bs,xm,km,Rm,Im,Wm,Cm,wm,bm,Em,hm,ym,gm,vm,_m,Am,mm,fm,Nm,Um,Dm,Pm,Mm,Tm,Om],nA=new Set(Qi.map(e=>e.id));import sn from"tinycolor2";var Fm="#FFFFFF",wv="#000000",bv=Fm,Ev="#1E1E1D";function Tv(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function qr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return sn({...e.toHsl(),l:r})}function Bm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Fm,blackHex:i=wv}){let s;switch(e){case"light":s=bv;break;case"dark":s=Ev;break;default:s=e;break}let l=sn(s),c=sn(t),u=sn(r),h=sn(o),m=sn(n),g=Tv(l.getLuminance()),w=qr(l,g==="light"?-.04:.11),y=qr(l,g==="light"?-.88:.87),T=qr(l,g==="light"?-.77:.75),_=qr(l,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=qr(l,g==="light"?-.08:.25).desaturate(g==="light"?60:20),S=qr(c,.15),I=qr(c,-.06),N=qr(m,.3),W=qr(h,.3),R=sn(c.getLuminance()>.5?i:a),B=qr(u,-.16);return{colorScheme:g,background:l.toHslString(),background2:w.toHslString(),foreground:y.toHslString(),foreground2:T.toHslString(),foreground3:_.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:S.toHslString(),accentDark:I.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:m.toHslString(),errorLight:N.toHslString(),warn:h.toHslString(),warnLight:W.toHslString()}}function Dc(e,t,r){let o=r?console.warn:()=>{},n,a,i,s,l,c,u,h,m,g,w,y,T,_,b;t?.loginMethods?(n=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),l=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),w=t.loginMethods.includes("linkedin"),T=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),b=t.loginMethods.includes("telegram")):(n=e.emailAuth,a=e.smsAuth,s=e.walletAuth,l=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,y=e.githubOAuth,m=e.spotifyOAuth,g=e.instagramOAuth,h=e.tiktokOAuth,w=e.linkedinOAuth,T=e.appleOAuth,_=e.farcasterAuth,b=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?i=!1:e.passkeyAuth&&(i=!0);let S=[n,a].filter(Boolean),I=[l,c,u,y,m,g,h,w,T,_,b].filter(Boolean),N=[s].filter(Boolean);if(S.length+I.length+N.length===0)throw new Error("You must enable at least one login method");let W=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;W&&N.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),W=!1):!W&&I.length+S.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),W=!0);let R=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let B=cm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),q=am({input:t?.loginMethodsAndOrder}),Y=t?.intl?.defaultCountry??"US",{chains:M,defaultChain:z}=Sv({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),L=!!t?.defaultChain,Ue=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ye,Oe=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Ue?Ye=t?.embeddedWallets?.noPromptOnSignature??!0:Ye=t?.embeddedWallets?.noPromptOnSignature??Oe:Ye=Oe,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ye!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:de,...J}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Zt.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Bm({backgroundTheme:t?.appearance?.theme??Zt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Zt.appearance.accentColor}),loginGroupPriority:W?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:n,sms:a,passkey:i,google:l,twitter:c,discord:u,github:y,spotify:m,instagram:g,tiktok:h,linkedin:w,apple:T,farcaster:_,telegram:b},loginMethodsAndOrder:q,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Zt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Zt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Zt.rpcConfig.rpcTimeouts},chains:M,defaultChain:z,intl:{defaultCountry:Y},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captchaEnabled??Zt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Zt.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:R}},embeddedWallets:{...e.embeddedWalletConfig,...typeof de=="boolean"?{requireUserOwnedRecoveryOnCreate:de}:{},...Ue?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...J,noPromptOnSignature:Ye},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Ue?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Zt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Zt._render.standalone}}}function Hm(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(l=>l.id)}:void 0,...n?{supportedChains:n.map(l=>l.id)}:void 0,...a?{defaultChain:a.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Sv({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(l=>l.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(l=>l.rpcUrls.privyWalletOverride?l:Qi.find(u=>u.id===l.id)??l)}else n=Qi.concat(e??[]);let a=t?n[0]:Bs,i=r??a;if(!n.find(s=>s.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}var Vm=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),o=Math.imul(o^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as xv}from"react/jsx-runtime";var zm={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Uc=Dc(zm,void 0,!1),Fc=Av({appConfig:Uc,isServerConfigLoaded:!1}),$m=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=_v(null),i=Pv(()=>Dc(n??zm,o,!!n),[n,o]);return Gm(()=>{if(!n)return;let s=Hm(o,t),l=Vm(JSON.stringify(s)).toString(),c=`privy:sent:${n.id}:${l}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:s}),localStorage.setItem(c,"t"))},[o,t,n]),Gm(()=>{n||(async()=>{try{let l=await r.getServerConfig();l.customApiUrl&&r.updateApiUrl(l.customApiUrl),a(l)}catch(l){console.warn("Error generating app config: ",l)}})()},[]),xv(Fc.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},lt=()=>{let{appConfig:e}=qm(Fc);return e},Hs=()=>{let{isServerConfigLoaded:e}=qm(Fc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Ov,jsxs as Lv}from"react/jsx-runtime";var Km=kv({ready:!1,app:Uc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),Mv=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],jm=e=>{let t=lt(),r=e.authenticated,[o,n]=Wv(e.initialScreen);Bc(()=>{!r&&!Mv.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Iv(null);Bc(()=>{e.open||(a.current=null)},[e.open]),Bc(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(s,l=!0)=>{e.setInitialScreen(s),l&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return Lv(Km.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Ov(Fs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},x=()=>Rv(Km);import{jsx as Qn,jsxs as Nv}from"react/jsx-runtime";var Ji=({style:e,...t})=>{let{app:r}=x();return Nv("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Qn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Qn("g",{clipPath:"url(#clip0_1765_9946)",children:Qn("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Qn("defs",{children:Qn("clipPath",{id:"clip0_1765_9946",children:Qn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Er=class extends Bt{constructor(r,o,n,a,i,s,l,c){super(c||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=s,this.privyAppName=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=ms[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=us(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Kn,id:"io.metamask"}:{name:yu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Ji,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=ms[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,Su(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Gn)};this.onQrModalClosed=n,(async()=>{let i="",s=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(s?.length&&(i=s[0]),!i||i==="")throw new ie("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let l=us(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=qn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(s),r()})().catch(i=>{if(i){o(br(i));return}o(new ie("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let s=vu(i.id,this.chains,this.rpcConfig,this.privyAppId);s&&(r[i.id]=s)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Dv.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Uv,optionalMethods:Fv,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Bv&&this.walletEntry){let{redirect:s,href:l}=bu(i,this.walletEntry);Pu({href:l,name:this.walletEntry.displayName}),this.redirectUri=s;let c=Eu(i,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),fs(s,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=us(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var Vc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>Hv(o)).map(o=>Ym(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},qn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Xo:Xo,Xi=class extends Vv{constructor(r,o,n,a,i,s,l,c,u,h,m){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new Ve:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=s,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=u,this.privyAppName=h,this.privyAppLogo=m,this.storedConnections=Hc()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Q.get(kc)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(kc));let r=gu(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!To()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let s=new Yi(r,o,this.rpcConfig,this.chains,a,n.id),l=new Zi(s,this.chains,n,this.rpcConfig);this.addWalletConnector(l)}}addImportedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded_imported","privy");if(i)i.proxyProvider.walletProxy=r;else{let s=new Yi(r,o,this.rpcConfig,this.chains,a,n.id),l=!0,c=new Zi(s,this.chains,n,this.rpcConfig,l);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Hc(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Hc(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof Er&&a.resetConnection(o),a;let s=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ns(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Zn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Zn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Zn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Ls(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new Us(this.defaultChain):new Er(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return s&&this.addWalletConnector(s),s||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Q.put(Rc,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=Ym(r),this.emit("walletsUpdated")}};function Os(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var Gv=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Hc=()=>{let e=Q.get(Rc);return e&&Array.isArray(e)&&e.map(o=>Gv(o)).every(Boolean)?e:[]};import{ofetch as qv}from"ofetch";var zv=[es,rs,ts,is],Vs=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Ac,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=qv.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:a,options:i})=>{let s=new Headers(i.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-ca-id",this.clientAnalyticsId||""),s.set("privy-client",`react-auth:${this.sdkVersion}`);let l=zv.includes(a.toString());if(!s.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:l});c!==null&&s.set("authorization",`Bearer ${c}`)}i.headers=s,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new Ja}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ne(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ne(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ne(o)}}};var Zm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.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});import Jn from"js-cookie";function Qm(e){return e instanceof Eo?"email":e instanceof on?"sms":e instanceof lo?"siwe":e instanceof Nn?"custom_auth":e instanceof Br?e.meta.provider:null}import*as Jm from"jose";var Tr=class{static parse(t){try{return new Tr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Jm.decodeJwt(t)}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(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var $v=30,Gs=class{constructor(){this.authenticateOnce=new De(async t=>this._authenticate(t)),this.linkOnce=new De(async t=>this._link(t)),this.refreshOnce=new De(this._refresh.bind(this)),this.destroyOnce=new De(this._destroy.bind(this)),this.forkSessionOnce=new De(this._forkSession.bind(this))}get token(){try{let t=Q.get(Yo);return typeof t=="string"?new Tr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(ys);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(Vi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Q.get(qi(t));if(typeof r=="string"){let o=new Tr(r);return o.isExpired()?(Q.del(qi(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Jn.get(gs);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Du}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Tr.parse(this.token);return t!==null&&!t.isExpired($v)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?Q.put(qi(t),r):Q.del(qi(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:a}=r;this.handleTokenResponse(r);let i=a,s=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,l=Qm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Ft(o),isNewUser:n,oAuthTokens:s}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:Ft(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(es,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(rs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Ft(n.user)}catch(n){if(n instanceof Pt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw rt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(ts,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(kd,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Q.get(Yo);if(Q.put(Yo,t),!this.client?.useServerCookies){let o=Tr.parse(t)?.expiration;Jn.set(xc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Q.del(Yo),Jn.remove(xc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Q.put(ys,t),this.client?.useServerCookies||Jn.set(gs,"t",{sameSite:"Strict",secure:!0,expires:30})):(Q.del(ys),Jn.remove(Wu),Jn.remove(gs))}clearForkedToken(){Q.del(Vi)}};var Gc,qs,Xm,ea=class{constructor(t){Qa(this,qs);this.apiUrl=t.apiUrl||hs,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||Ru,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=xd(this,qs,Xm).call(this),Gc||(Gc=new Gs),this.session=Gc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:s,externalWalletConfig:l,appName:c}){this.connectors||(this.connectors=new Xi(this.appId,t,r,o,n,a,i,s,l,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Vs({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(su,{action:"verify"})}catch(t){throw ne(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(lu,{});return Zm(t.options)}catch(t){throw ne(t)}}async unlinkEmail(t){try{let r=await this.api.post(Vd,{address:t});return Ft(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(cu,{});return Ft(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post($d,{phoneNumber:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Md,{address:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Yd,{provider:t,subject:r});return Ft(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ud,{fid:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(au,{telegram_user_id:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(ou,{credential_id:t});return Ft(r)}catch(r){throw rt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(is,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(pu,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Tr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw rt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(Rd,{address:t,token:r})).nonce}catch(o){throw rt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Id,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Wd,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a});return Ft(i)}catch(i){throw rt(i)}}};qs=new WeakSet,Xm=function(){if(typeof window>"u")return null;try{let r=Q.get(Gi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Kv();try{return Q.put(Gi,t),t}catch{return t}};import{Turnstile as Xv}from"@marsidev/react-turnstile";import{useEffect as e3,useMemo as t3}from"react";import{useMemo as jv,useRef as Yv,useContext as Zv,useState as qc,createContext as Qv}from"react";import{jsx as Jv}from"react/jsx-runtime";var ef=Qv({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Qt=class extends Ze{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},tf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Yv(null),[a,i]=qc(),[s,l]=qc(),[c,u]=qc(!1),h=jv(()=>o?!c&&!a&&!s?{status:"ready"}:c&&!a&&!s?{status:"loading"}:a&&!s?{status:"success",token:a}:s?{status:"error",error:s}:{status:"ready"}:{status:"disabled"},[o,a,s,c]);return Jv(ef.Provider,{value:{...h,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:l,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),l(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),l(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await hu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>Zv(ef);import{jsx as rf}from"react/jsx-runtime";var zc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:s}=ye(),[,l]=t3(()=>r?.split("t:")||[],[r]);if(e3(()=>s.current?.remove,[]),!t)return null;if(!l)throw new Error("Unsupported captcha site key");return rf("div",{className:"hidden h-0 w-0",children:rf(Xv,{...e,ref:s,siteKey:l,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:c=>{e.onSuccess?.(c),a(c),i(!1)},onExpire:()=>{e.onExpire?.();try{s.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as g8,useEffect as c2,useRef as v8,useState as C8}from"react";import u2 from"styled-components";import{createContext as r3,useContext as o3}from"react";var $c=r3({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,crossAppAuthFlow:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedEthereumWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E}),k=()=>o3($c);import{createContext as n3,useContext as i3}from"react";var ge=n3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkCrossAppAccount:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkCrossAppAccount:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,setWalletRecovery:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,generateSiweMessage:E,linkWithSiwe:E,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),H=()=>i3(ge);import{useEffect as a3,useState as s3}from"react";var of=e=>{let[t,r]=s3("auto");return a3(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as l3,useContext as c3,useEffect as p3}from"react";var nf={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]}},Kc=l3(void 0),af=()=>c3(Kc);function Ie(e,t){if(!t)return;let o=af().current[e];return p3(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Xn(){let e=af();return(t,r,...o)=>D(e,t,r,...o)}function jc(e){Ie("configureMfa",e)}import{QuestionMarkCircleIcon as W3}from"@heroicons/react/24/outline";import ff from"styled-components";import ln,{css as sf}from"styled-components";import Zc from"styled-components";import{Fragment as u3,jsx as Yc,jsxs as m3}from"react/jsx-runtime";var Je=({success:e,fail:t})=>m3(u3,{children:[Yc(ct,{className:e?"success":t?"fail":""}),Yc(Qc,{className:e?"success":t?"fail":""})]}),ct=Zc.span`
12
+ - https://privy.io`};var lo=class{constructor(t,r,o){this.getNonceOnce=new De(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ne(t)}}async sign(){if(!this.client)throw new C("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new C("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new C("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Is({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var on=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Kd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(zd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ne(t)}}async sendSmsCode(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(qd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ne(o)}}};var Bn=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(nu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(iu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ne(t)}}};function Lc(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function Yu(){let e;if(e=rv(),e)return Oc(),{...e,flowType:"login-url"};if(e=ov(),e)return Oc(),{...e,flowType:"web-app"};Oc()}function rv(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),a=e.get("last_name")||void 0,i=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:a,username:i,photo_url:s,auth_date:o,hash:r}}function ov(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash");if(!(!r||!o||!n||!a))return{query_id:r,user:o,auth_date:n,hash:a}}function Oc(){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"),window.history.replaceState({},"",e)}import{v4 as jv}from"uuid";function Z(e){return e?new Date(e*1e3):null}function nv(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let a={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(a);break;case"email":let i={address:r.address,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(i);break;case"phone":let s={number:r.phoneNumber,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(s);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(u);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let m={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(m);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(v);break;case"tiktok_oauth":let w={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(w);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let T={subject:r.subject,email:r.email,type:r.type,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(T);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)});break;case"farcaster":let _={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let b={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:Z(r.verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(b);break;case"telegram":let S={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:Z(r.first_verified_at),firstVerifiedAt:Z(r.first_verified_at),latestVerifiedAt:Z(r.latest_verified_at)};t.push(S);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Dt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var we=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,nn=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,Ms=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,iv=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ut=(e,t)=>we(e)||nn(e)?!1:t==="all-users"||t==="users-without-wallets"&&!iv(e)?.length;function Ft(e){if(!e)return null;let t=nv(e.linked_accounts),r=Dt(t,"wallet"),o=Dt(t,"email"),n=Dt(t,"phone"),a=Dt(t,"google_oauth"),i=Dt(t,"twitter_oauth"),s=Dt(t,"discord_oauth"),l=Dt(t,"github_oauth"),c=Dt(t,"spotify_oauth"),u=Dt(t,"instagram_oauth"),f=Dt(t,"tiktok_oauth"),m=Dt(t,"linkedin_oauth"),v=Dt(t,"apple_oauth"),w=Dt(t,"farcaster"),y=Dt(t,"telegram"),T=e.mfa_methods.map(({type:b,verified_at:S})=>({type:b,verifiedAt:Z(S)}));return{id:e.id,createdAt:Z(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:s&&{subject:s.subject,username:s.username,email:s.email},github:l&&{subject:l.subject,username:l.username,name:l.name,email:l.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email,vanityName:m.vanityName},apple:v&&{subject:v.subject,email:v.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:T.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Ym}from"@ethersproject/address";import{isHexString as Vv}from"@ethersproject/bytes";import Gv from"eventemitter3";import mv from"@coinbase/wallet-sdk";import{jsx as Zu,jsxs as av}from"react/jsx-runtime";var Ki=({style:e,...t})=>av("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zu("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Zu("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"})]});import{getAddress as Vr}from"@ethersproject/address";import{Web3Provider as rm}from"@ethersproject/providers";import{default as dv}from"eventemitter3";import pv from"eventemitter3";var sv=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Qu=e=>sv.includes(e);import{ErrorCode as lv}from"@ethersproject/logger";import{ProviderErrors as an}from"@privy-io/js-sdk-core";var Hn=class extends ie{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vn=class extends ie{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof ie)return e;if(e?.code&&e?.reason){let t=new st(e);return e.code===lv.ACTION_REJECTED&&(t.details=an.E4001_USER_REJECTED_REQUEST),t}return e?.code?new st(e):new ie("Unknown connector error",e)},jt=class extends Ze{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},st=class extends jt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(an).find(a=>a.eipCode===o.code);this.details=n||an.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=an.E32002_CONNECTION_ALREADY_PENDING:this.details=an.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=an.E32002_WALLET_LOCKED))}},cv={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},co={...cv,...an};var Ve=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Hn,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Xo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ie(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw br(r)})}},So=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ji=class extends pv{constructor(r,o,n,a,i,s=1){super();this.walletProxy=r,this.address=o,this.chainId=s,this.rpcConfig=n,this.chains=a,this.provider=ao(s,this.chains,n,{appId:i}),this.rpcTimeoutDuration=Gn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new So(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await fe()||!this.address)throw new So("Disconnected",4900);return(await em(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new So(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new So(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=ao(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await Ju(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Xu(Fi(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:jo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(a){throw console.warn(`Gas estimation failed with error: ${a} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return jo(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Qu(r.method)){let o=await fe();if(await tm(),!o||!this.address)throw new So("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new So("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await fe();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Hr=class extends Ve{constructor(r){super(r,r.rpcTimeoutDuration)}},Po=class extends Ve{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var uv=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Bt=class extends dv{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Nn(r),this.walletClientType==="privy"&&J.put(gs(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Gn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(s=>Vr(s.address)===Vr(r));return{address:Vr(r),chainId:o,meta:n,imported:a,switchChain:async s=>{if(!i)throw new ie("Wallet is not currently connected.");let l=this.wallets.find(v=>Vr(v.address)===Vr(r))?.chainId;if(!l)throw new ie("Unable to determine current chainId.");let c,u;if(typeof s=="number"?(c=`0x${s.toString(16)}`,u=s):(c=s,u=Number(s)),l===Nn(c))return;let f=this.chains.find(v=>v.id===u);if(!f)throw new ie(`Unsupported chainId: ${s}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await m()}catch(v){if(uv(v,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&v.message?.includes("wallet_switchEthereumChain")?new ie(`Rainbow does not support the chainId ${o}`):v}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return new rm(new Hr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ie("Wallet is not currently connected.");return new Po(this.proxyProvider)},sign:async s=>{if(!await i())throw new ie("Wallet is not currently connected.");return await this.sign(s)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await Ui(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=Vr(n),i=[],s;if(this.walletClientType==="privy"){let c=J.get(gs(a));this.chains.find(u=>u.id===Number(c))||(J.del(gs(a)),c=null),s=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${s} on initialization`)}}else try{let c=await Ui(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")s=c;else if(typeof c=="number")s=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Ic}`,c),s=Ic}let l=Nn(s);if(!i.find(c=>Vr(c.address)===a)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(Vr(n),l,c,this.connectorType==="embedded_imported"))}Ws(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>Vr(n)===Vr(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new rm(new Hr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var hv=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],fv=(e,t)=>e.makeWeb3Provider({options:t}),Nc,Os=class extends Bt{constructor(r,o,n,a,i,s){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=a.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Nc){let l=[o.id].concat(r.map(u=>u.id)),c=this.connectionOptions!=="eoaOnly"?l.filter(u=>!hv.includes(u)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Nc=new mv({appName:i,appLogoUrl:s,appChainIds:l})}this.proxyProvider.setWalletProvider(fv(Nc,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:Ki,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as om}from"react/jsx-runtime";var qn=({...e})=>om("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:om("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)"})});var Yi=class extends Bt{constructor(r,o,n,a,i=!1){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[jo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:qn,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as nm}from"react/jsx-runtime";var zn=({style:e,...t})=>nm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:nm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Yt,jsxs as yv}from"react/jsx-runtime";var $n=({style:e,...t})=>yv("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[Yt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Yt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Yt("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),Yt("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),Yt("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),Yt("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),Yt("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),Yt("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),Yt("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),Yt("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),Yt("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),Yt("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),Yt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as im,jsxs as gv}from"react/jsx-runtime";var Gr=({style:e,...t})=>gv("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[im("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),im("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var jn=class extends Bt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let s=a.provider;this.proxyProvider.setWalletProvider(s)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},Kn,Yn=class extends Bt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Za(this,Kn,void 0);this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?bc(this,Kn,{name:"MetaMask",icon:$n,id:"io.metamask"}):i==="phantom"&&bc(this,Kn,{name:"Phantom",icon:Gr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Ad(this,Kn)??{name:"Browser Extension",icon:zn,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};Kn=new WeakMap;import{getAddress as OP}from"@ethersproject/address";import{Web3Provider as NP}from"@ethersproject/providers";import{isMobile as vv}from"react-device-detect";var Ls=class extends jn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{vv||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ie("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Ns=class extends Bt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Ve(void 0,Xo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Ds=class extends Ns{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Gr,id:"phantom"}}};import{EthereumProvider as Uv,OPTIONAL_EVENTS as Fv,OPTIONAL_METHODS as Bv}from"@walletconnect/ethereum-provider";import{isMobile as Hv}from"react-device-detect";import{createContext as Rv,useContext as Iv,useEffect as Bc,useRef as Mv,useState as Wv}from"react";import{jsx as Cv}from"react/jsx-runtime";function Us({src:e,...t}){return Cv("img",{src:e,...t,style:{display:"none"}})}import{useContext as qm,useEffect as Gm,useMemo as _v,useState as Av}from"react";import{createContext as xv}from"react";var Zt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ku,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var am=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var wv=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),sm=e=>wv.has(e),lm=(e,t,r)=>r.indexOf(e)===t,cm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(sm).filter(lm):e?e.filter(sm).filter(lm):Zt.appearance.walletList;var pm={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var dm={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var um={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var mm={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var hm={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var fm={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var ym={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var gm={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var vm={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var Cm={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var wm={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var bm={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var Em={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var Tm={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Sm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Pm={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var _m={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var Am={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Fs={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var xm={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var km={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Rm={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Im={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Mm={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Wm={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Om={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Lm={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Nm={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Dm={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Um={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Zi=[pm,dm,um,Sm,Lm,Fs,xm,km,Rm,Im,Mm,Cm,wm,bm,Em,fm,ym,gm,vm,_m,Am,mm,hm,Nm,Um,Dm,Pm,Wm,Tm,Om],lA=new Set(Zi.map(e=>e.id));import sn from"tinycolor2";var Fm="#FFFFFF",bv="#000000",Ev=Fm,Tv="#1E1E1D";function Sv(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function qr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return sn({...e.toHsl(),l:r})}function Bm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Fm,blackHex:i=bv}){let s;switch(e){case"light":s=Ev;break;case"dark":s=Tv;break;default:s=e;break}let l=sn(s),c=sn(t),u=sn(r),f=sn(o),m=sn(n),v=Sv(l.getLuminance()),w=qr(l,v==="light"?-.04:.11),y=qr(l,v==="light"?-.88:.87),T=qr(l,v==="light"?-.77:.75),_=qr(l,v==="light"?-.43:.45).desaturate(v==="light"?60:20),b=qr(l,v==="light"?-.08:.25).desaturate(v==="light"?60:20),S=qr(c,.15),I=qr(c,-.06),N=qr(m,.3),M=qr(f,.3),R=sn(c.getLuminance()>.5?i:a),B=qr(u,-.16);return{colorScheme:v,background:l.toHslString(),background2:w.toHslString(),foreground:y.toHslString(),foreground2:T.toHslString(),foreground3:_.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:S.toHslString(),accentDark:I.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:m.toHslString(),errorLight:N.toHslString(),warn:f.toHslString(),warnLight:M.toHslString()}}function Dc(e,t,r){let o=r?console.warn:()=>{},n,a,i,s,l,c,u,f,m,v,w,y,T,_,b;t?.loginMethods?(n=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),l=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),v=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),w=t.loginMethods.includes("linkedin"),T=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),b=t.loginMethods.includes("telegram")):(n=e.emailAuth,a=e.smsAuth,s=e.walletAuth,l=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,y=e.githubOAuth,m=e.spotifyOAuth,v=e.instagramOAuth,f=e.tiktokOAuth,w=e.linkedinOAuth,T=e.appleOAuth,_=e.farcasterAuth,b=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?i=!1:e.passkeyAuth&&(i=!0);let S=[n,a].filter(Boolean),I=[l,c,u,y,m,v,f,w,T,_,b].filter(Boolean),N=[s].filter(Boolean);if(S.length+I.length+N.length===0)throw new Error("You must enable at least one login method");let M=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;M&&N.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&I.length+S.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0);let R=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let B=cm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),q=am({input:t?.loginMethodsAndOrder}),Y=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:z}=Pv({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),L=!!t?.defaultChain,Ue=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ye,Oe=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Ue?Ye=t?.embeddedWallets?.noPromptOnSignature??!0:Ye=t?.embeddedWallets?.noPromptOnSignature??Oe:Ye=Oe,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ye!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:de,...X}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Zt.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Bm({backgroundTheme:t?.appearance?.theme??Zt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Zt.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:n,sms:a,passkey:i,google:l,twitter:c,discord:u,github:y,spotify:m,instagram:v,tiktok:f,linkedin:w,apple:T,farcaster:_,telegram:b},loginMethodsAndOrder:q,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Zt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Zt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Zt.rpcConfig.rpcTimeouts},chains:W,defaultChain:z,intl:{defaultCountry:Y},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captchaEnabled??Zt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Zt.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:R}},embeddedWallets:{...e.embeddedWalletConfig,...typeof de=="boolean"?{requireUserOwnedRecoveryOnCreate:de}:{},...Ue?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...X,noPromptOnSignature:Ye},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Ue?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Zt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Zt._render.standalone}}}function Hm(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(l=>l.id)}:void 0,...n?{supportedChains:n.map(l=>l.id)}:void 0,...a?{defaultChain:a.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Pv({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(l=>l.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(l=>l.rpcUrls.privyWalletOverride?l:Zi.find(u=>u.id===l.id)??l)}else n=Zi.concat(e??[]);let a=t?n[0]:Fs,i=r??a;if(!n.find(s=>s.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}var Vm=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),o=Math.imul(o^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as kv}from"react/jsx-runtime";var zm={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Uc=Dc(zm,void 0,!1),Fc=xv({appConfig:Uc,isServerConfigLoaded:!1}),$m=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=Av(null),i=_v(()=>Dc(n??zm,o,!!n),[n,o]);return Gm(()=>{if(!n)return;let s=Hm(o,t),l=Vm(JSON.stringify(s)).toString(),c=`privy:sent:${n.id}:${l}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:s}),localStorage.setItem(c,"t"))},[o,t,n]),Gm(()=>{n||(async()=>{try{let l=await r.getServerConfig();l.customApiUrl&&r.updateApiUrl(l.customApiUrl),a(l)}catch(l){console.warn("Error generating app config: ",l)}})()},[]),kv(Fc.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},lt=()=>{let{appConfig:e}=qm(Fc);return e},Bs=()=>{let{isServerConfigLoaded:e}=qm(Fc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Lv,jsxs as Nv}from"react/jsx-runtime";var Km=Rv({ready:!1,app:Uc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),Ov=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],jm=e=>{let t=lt(),r=e.authenticated,[o,n]=Wv(e.initialScreen);Bc(()=>{!r&&!Ov.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Mv(null);Bc(()=>{e.open||(a.current=null)},[e.open]),Bc(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(s,l=!0)=>{e.setInitialScreen(s),l&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return Nv(Km.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Lv(Us,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},x=()=>Iv(Km);import{jsx as Zn,jsxs as Dv}from"react/jsx-runtime";var Qi=({style:e,...t})=>{let{app:r}=x();return Dv("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Zn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zn("g",{clipPath:"url(#clip0_1765_9946)",children:Zn("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Zn("defs",{children:Zn("clipPath",{id:"clip0_1765_9946",children:Zn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Er=class extends Bt{constructor(r,o,n,a,i,s,l,c){super(c||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=s,this.privyAppName=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Ve(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=us[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ds(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:$n,id:"io.metamask"}:{name:yu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Qi,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=us[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,Su(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vn)};this.onQrModalClosed=n,(async()=>{let i="",s=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(s?.length&&(i=s[0]),!i||i==="")throw new ie("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let l=ds(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Gn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(s),r()})().catch(i=>{if(i){o(br(i));return}o(new ie("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let s=vu(i.id,this.chains,this.rpcConfig,this.privyAppId);s&&(r[i.id]=s)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Uv.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fv,optionalMethods:Bv,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Hv&&this.walletEntry){let{redirect:s,href:l}=bu(i,this.walletEntry);Pu({href:l,name:this.walletEntry.displayName}),this.redirectUri=s;let c=Eu(i,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),ms(s,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ds(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var Vc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>Vv(o)).map(o=>Ym(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Gn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Xo:Xo,Ji=class extends Gv{constructor(r,o,n,a,i,s,l,c,u,f,m){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new Ve:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=s,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=u,this.privyAppName=f,this.privyAppLogo=m,this.storedConnections=Hc()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;J.get(kc)&&(J.getKeys().forEach(o=>{o.startsWith("walletconnect")&&J.del(o)}),J.del(kc));let r=gu(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!To()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let s=new ji(r,o,this.rpcConfig,this.chains,a,n.id),l=new Yi(s,this.chains,n,this.rpcConfig);this.addWalletConnector(l)}}addImportedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded_imported","privy");if(i)i.proxyProvider.walletProxy=r;else{let s=new ji(r,o,this.rpcConfig,this.chains,a,n.id),l=!0,c=new Yi(s,this.chains,n,this.rpcConfig,l);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Hc(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Hc(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof Er&&a.resetConnection(o),a;let s=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ls(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Yn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Yn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Yn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new jn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Os(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new Ds(this.defaultChain):new Er(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return s&&this.addWalletConnector(s),s||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));J.put(Rc,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=Ym(r),this.emit("walletsUpdated")}};function Ws(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var qv=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Hc=()=>{let e=J.get(Rc);return e&&Array.isArray(e)&&e.map(o=>qv(o)).every(Boolean)?e:[]};import{ofetch as zv}from"ofetch";var $v=[Xa,ts,es,ns],Hs=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Ac,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=zv.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:a,options:i})=>{let s=new Headers(i.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-ca-id",this.clientAnalyticsId||""),s.set("privy-client",`react-auth:${this.sdkVersion}`);let l=$v.includes(a.toString());if(!s.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:l});c!==null&&s.set("authorization",`Bearer ${c}`)}i.headers=s,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new Qa}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ne(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ne(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ne(o)}}};var Zm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.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});import Qn from"js-cookie";function Qm(e){return e instanceof Eo?"email":e instanceof on?"sms":e instanceof lo?"siwe":e instanceof Ln?"custom_auth":e instanceof Br?e.meta.provider:null}import*as Jm from"jose";var Tr=class{static parse(t){try{return new Tr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Jm.decodeJwt(t)}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(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var Kv=30,Vs=class{constructor(){this.authenticateOnce=new De(async t=>this._authenticate(t)),this.linkOnce=new De(async t=>this._link(t)),this.refreshOnce=new De(this._refresh.bind(this)),this.destroyOnce=new De(this._destroy.bind(this)),this.forkSessionOnce=new De(this._forkSession.bind(this))}get token(){try{let t=J.get(Yo);return typeof t=="string"?new Tr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=J.get(fs);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=J.get(Hi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=J.get(Gi(t));if(typeof r=="string"){let o=new Tr(r);return o.isExpired()?(J.del(Gi(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Qn.get(ys);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Du}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Tr.parse(this.token);return t!==null&&!t.isExpired(Kv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?J.put(Gi(t),r):J.del(Gi(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:a}=r;this.handleTokenResponse(r);let i=a,s=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,l=Qm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Ft(o),isNewUser:n,oAuthTokens:s}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:Ft(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Xa,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(ts,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Ft(n.user)}catch(n){if(n instanceof Pt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw rt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(es,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(kd,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=J.get(Yo);if(J.put(Yo,t),!this.client?.useServerCookies){let o=Tr.parse(t)?.expiration;Qn.set(xc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else J.del(Yo),Qn.remove(xc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(J.put(fs,t),this.client?.useServerCookies||Qn.set(ys,"t",{sameSite:"Strict",secure:!0,expires:30})):(J.del(fs),Qn.remove(Mu),Qn.remove(ys))}clearForkedToken(){J.del(Hi)}};var Gc,Gs,Xm,Xi=class{constructor(t){Za(this,Gs);this.apiUrl=t.apiUrl||hs,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||Ru,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=xd(this,Gs,Xm).call(this),Gc||(Gc=new Vs),this.session=Gc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:s,externalWalletConfig:l,appName:c}){this.connectors||(this.connectors=new Ji(this.appId,t,r,o,n,a,i,s,l,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Hs({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(su,{action:"verify"})}catch(t){throw ne(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(lu,{});return Zm(t.options)}catch(t){throw ne(t)}}async unlinkEmail(t){try{let r=await this.api.post(Vd,{address:t});return Ft(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(cu,{});return Ft(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post($d,{phoneNumber:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Wd,{address:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Yd,{provider:t,subject:r});return Ft(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ud,{fid:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(au,{telegram_user_id:t});return Ft(r)}catch(r){throw rt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(ou,{credential_id:t});return Ft(r)}catch(r){throw rt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(ns,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(pu,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Tr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw rt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(Rd,{address:t,token:r})).nonce}catch(o){throw rt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Id,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Md,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a});return Ft(i)}catch(i){throw rt(i)}}};Gs=new WeakSet,Xm=function(){if(typeof window>"u")return null;try{let r=J.get(Vi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=jv();try{return J.put(Vi,t),t}catch{return t}};import{Turnstile as e3}from"@marsidev/react-turnstile";import{useEffect as t3,useMemo as r3}from"react";import{useMemo as Yv,useRef as Zv,useContext as Qv,useState as qc,createContext as Jv}from"react";import{jsx as Xv}from"react/jsx-runtime";var eh=Jv({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Qt=class extends Ze{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},th=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Zv(null),[a,i]=qc(),[s,l]=qc(),[c,u]=qc(!1),f=Yv(()=>o?!c&&!a&&!s?{status:"ready"}:c&&!a&&!s?{status:"loading"}:a&&!s?{status:"success",token:a}:s?{status:"error",error:s}:{status:"ready"}:{status:"disabled"},[o,a,s,c]);return Xv(eh.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:l,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),l(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),l(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await fu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>Qv(eh);import{jsx as rh}from"react/jsx-runtime";var zc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:s}=ye(),[,l]=r3(()=>r?.split("t:")||[],[r]);if(t3(()=>s.current?.remove,[]),!t)return null;if(!l)throw new Error("Unsupported captcha site key");return rh("div",{className:"hidden h-0 w-0",children:rh(e3,{...e,ref:s,siteKey:l,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:c=>{e.onSuccess?.(c),a(c),i(!1)},onExpire:()=>{e.onExpire?.();try{s.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as w8,useEffect as c2,useRef as b8,useState as E8}from"react";import u2 from"styled-components";import{createContext as o3,useContext as n3}from"react";var $c=o3({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,crossAppAuthFlow:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedEthereumWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E}),k=()=>n3($c);import{createContext as i3,useContext as a3}from"react";var ge=i3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkCrossAppAccount:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkCrossAppAccount:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,setWalletRecovery:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,generateSiweMessage:E,linkWithSiwe:E,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),H=()=>a3(ge);import{useEffect as s3,useState as l3}from"react";var oh=e=>{let[t,r]=l3("auto");return s3(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as c3,useContext as p3,useEffect as d3}from"react";var nh={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]}},Kc=c3(void 0),ih=()=>p3(Kc);function Ie(e,t){if(!t)return;let o=ih().current[e];return d3(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Jn(){let e=ih();return(t,r,...o)=>U(e,t,r,...o)}function jc(e){Ie("configureMfa",e)}import{QuestionMarkCircleIcon as W3}from"@heroicons/react/24/outline";import mh from"styled-components";import ln,{css as ah}from"styled-components";import Zc from"styled-components";import{Fragment as m3,jsx as Yc,jsxs as h3}from"react/jsx-runtime";var Je=({success:e,fail:t})=>h3(m3,{children:[Yc(ct,{className:e?"success":t?"fail":""}),Yc(Qc,{className:e?"success":t?"fail":""})]}),ct=Zc.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -48,7 +48,7 @@ Resources:
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,zr=e=>Yc(d3,{color:e.color||"var(--privy-color-foreground-3)"}),d3=Zc(ct)`
51
+ `,zr=e=>Yc(u3,{color:e.color||"var(--privy-color-foreground-3)"}),u3=Zc(ct)`
52
52
  && {
53
53
  height: 1rem;
54
54
  width: 1rem;
@@ -58,7 +58,7 @@ Resources:
58
58
  /* Override default Loader to match button transitions */
59
59
  transition: border-color 200ms ease;
60
60
  }
61
- `;import{jsx as Ht,jsxs as $s}from"react/jsx-runtime";var ta=ln.button`
61
+ `;import{jsx as Ht,jsxs as zs}from"react/jsx-runtime";var ea=ln.button`
62
62
  display: flex;
63
63
  flex-direction: row;
64
64
  align-items: center;
@@ -80,7 +80,7 @@ Resources:
80
80
  && {
81
81
  padding: 12px 16px;
82
82
  }
83
- `,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(cf,{disabled:t||r,...n,children:t?$s("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),lf=({children:e,loading:t,disabled:r,...o})=>Ht(f3,{disabled:r,...o,children:t?Ht(zr,{color:"var(--privy-color-foreground-accent)"}):e}),f3=ln(ta)`
83
+ `,D=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(lh,{disabled:t||r,...n,children:t?zs("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),sh=({children:e,loading:t,disabled:r,...o})=>Ht(f3,{disabled:r,...o,children:t?Ht(zr,{color:"var(--privy-color-foreground-accent)"}):e}),f3=ln(ea)`
84
84
  position: relative;
85
85
 
86
86
  && {
@@ -106,7 +106,7 @@ Resources:
106
106
  color: var(--privy-color-foreground-accent);
107
107
  background-color: var(--privy-color-accent-dark);
108
108
  }
109
- `,zs=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(cf,{as:"a",disabled:t||r,...n,children:t?$s("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),cf=ln(ta)`
109
+ `,qs=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(lh,{as:"a",disabled:t||r,...n,children:t?zs("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),lh=ln(ea)`
110
110
  position: relative;
111
111
 
112
112
  && {
@@ -132,7 +132,7 @@ Resources:
132
132
  }
133
133
 
134
134
  /* If an anchor tag, :disabled isn't a thing, so manually set state */
135
- ${e=>e.disabled?sf`
135
+ ${e=>e.disabled?ah`
136
136
  &&&,
137
137
  &&&:hover,
138
138
  &&&:active {
@@ -151,7 +151,7 @@ Resources:
151
151
  opacity: 1;
152
152
  animation: fadein 200ms ease;
153
153
  }
154
- `,Sr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(h3,{disabled:t||r,...n,children:t?$s("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),h3=ln(ta)`
154
+ `,Sr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ht(y3,{disabled:t||r,...n,children:t?zs("span",{children:[Ht(zr,{}),o?Ht("span",{children:o}):null]}):e}),y3=ln(ea)`
155
155
  && {
156
156
  border-width: 1px;
157
157
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -180,7 +180,7 @@ Resources:
180
180
  opacity: 1;
181
181
  animation: fadein 200ms ease;
182
182
  }
183
- `,ei=ln.button`
183
+ `,Xn=ln.button`
184
184
  && {
185
185
  padding: 12px 16px;
186
186
  font-weight: 500;
@@ -193,7 +193,7 @@ Resources:
193
193
  transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
194
194
  user-select: none;
195
195
 
196
- ${e=>e.invisible&&sf`
196
+ ${e=>e.invisible&&ah`
197
197
  pointer-events: none;
198
198
  `}
199
199
 
@@ -211,10 +211,10 @@ Resources:
211
211
  cursor: not-allowed;
212
212
  }
213
213
  }
214
- `,vk=ln.div`
214
+ `,Ek=ln.div`
215
215
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
216
216
  height: 44px;
217
- `,ti=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>$s(y3,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ht("span",{children:e}),Ht("span",{children:Ht(zr,{})})]}),y3=ln.button`
217
+ `,ei=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>zs(g3,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ht("span",{children:e}),Ht("span",{children:Ht(zr,{})})]}),g3=ln.button`
218
218
  && {
219
219
  color: var(--privy-color-accent);
220
220
  font-size: 16px;
@@ -256,7 +256,7 @@ Resources:
256
256
  cursor: not-allowed;
257
257
  }
258
258
  }
259
- `;import g3 from"styled-components";var pf=g3.span`
259
+ `;import v3 from"styled-components";var ch=v3.span`
260
260
  && {
261
261
  width: 82px;
262
262
  height: 82px;
@@ -268,7 +268,7 @@ Resources:
268
268
  display: inline-block;
269
269
  box-sizing: border-box;
270
270
  }
271
- `;import v3 from"@heroicons/react/24/outline/ArrowLeftIcon";import C3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import w3 from"@heroicons/react/24/outline/XMarkIcon";import ri from"styled-components";import{jsx as Vt,jsxs as df}from"react/jsx-runtime";var b3=({backFn:e})=>Vt("div",{children:Vt(Jc,{onClick:e,children:Vt(v3,{height:"16px",width:"16px",strokeWidth:2})})}),E3=({infoFn:e})=>Vt("div",{children:Vt(S3,{"aria-label":"info",onClick:e,children:Vt(C3,{height:"22px",width:"22px",strokeWidth:2})})}),T3=e=>Vt("div",{children:Vt(Jc,{"aria-label":"close modal",onClick:e.onClose,children:Vt(w3,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:a}=k(),i=lt();return df(P3,{children:[df(_3,{children:[e&&Vt(b3,{backFn:e}),t&&Vt(E3,{infoFn:t})]}),o&&Vt(x3,{id:"privy-dialog-title",children:o}),Vt(A3,{children:!i.render.standalone&&n&&Vt(T3,{onClose:r||(()=>a())})})]})},Jc=ri.button`
271
+ `;import C3 from"@heroicons/react/24/outline/ArrowLeftIcon";import w3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import b3 from"@heroicons/react/24/outline/XMarkIcon";import ti from"styled-components";import{jsx as Vt,jsxs as ph}from"react/jsx-runtime";var E3=({backFn:e})=>Vt("div",{children:Vt(Jc,{onClick:e,children:Vt(C3,{height:"16px",width:"16px",strokeWidth:2})})}),T3=({infoFn:e})=>Vt("div",{children:Vt(P3,{"aria-label":"info",onClick:e,children:Vt(w3,{height:"22px",width:"22px",strokeWidth:2})})}),S3=e=>Vt("div",{children:Vt(Jc,{"aria-label":"close modal",onClick:e.onClose,children:Vt(b3,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:a}=k(),i=lt();return ph(_3,{children:[ph(A3,{children:[e&&Vt(E3,{backFn:e}),t&&Vt(T3,{infoFn:t})]}),o&&Vt(k3,{id:"privy-dialog-title",children:o}),Vt(x3,{children:!i.render.standalone&&n&&Vt(S3,{onClose:r||(()=>a())})})]})},Jc=ti.button`
272
272
  && {
273
273
  cursor: pointer;
274
274
  display: flex;
@@ -287,11 +287,11 @@ Resources:
287
287
  opacity: 1;
288
288
  }
289
289
  }
290
- `,S3=ri(Jc)`
290
+ `,P3=ti(Jc)`
291
291
  && {
292
292
  background-color: transparent;
293
293
  }
294
- `,P3=ri.div`
294
+ `,_3=ti.div`
295
295
  padding: 16px 0;
296
296
  display: flex;
297
297
  align-items: center;
@@ -303,23 +303,23 @@ Resources:
303
303
  font-weight: 600;
304
304
  color: var(--privy-color-foreground);
305
305
  }
306
- `,_3=ri.div`
306
+ `,A3=ti.div`
307
307
  flex: 1;
308
308
  align-items: center;
309
309
  display: flex;
310
310
  gap: 8px;
311
- `,A3=ri.div`
311
+ `,x3=ti.div`
312
312
  flex: 1;
313
313
  display: flex;
314
314
  justify-content: flex-end;
315
- `,x3=ri.div`
315
+ `,k3=ti.div`
316
316
  overflow: hidden;
317
317
  white-space: nowrap;
318
318
  max-width: 100%;
319
319
  text-overflow: ellipsis;
320
320
  text-align: center;
321
321
  color: var(--privy-color-foreground-2);
322
- `;import k3 from"styled-components";var R3=k3.div`
322
+ `;import R3 from"styled-components";var I3=R3.div`
323
323
  display: flex;
324
324
  flex-direction: column;
325
325
  justify-content: center;
@@ -342,10 +342,10 @@ Resources:
342
342
  left: -19px;
343
343
  top: -19px;
344
344
  }
345
- `,Ke=R3;import _o,{css as I3}from"styled-components";var Ao=_o.div`
345
+ `,Ke=I3;import _o,{css as M3}from"styled-components";var Ao=_o.div`
346
346
  text-align: left;
347
347
  flex-grow: 1;
348
- `,Ks=_o.div`
348
+ `,$s=_o.div`
349
349
  display: flex;
350
350
  flex-direction: column;
351
351
  justify-content: flex-end;
@@ -365,13 +365,13 @@ Resources:
365
365
  &::-webkit-scrollbar {
366
366
  display: none;
367
367
  }
368
- `,uf=_o(Pr)`
368
+ `,dh=_o(Pr)`
369
369
  ${e=>{if(e.colorScheme==="light")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;";if(e.colorScheme==="dark")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;"}}
370
370
 
371
371
  background-repeat: no-repeat;
372
372
  background-size: 100% 32px, 100% 16px;
373
373
  background-attachment: local, scroll;
374
- `,mf=I3`
374
+ `,uh=M3`
375
375
  && {
376
376
  width: 100%;
377
377
  font-size: 16px;
@@ -408,14 +408,14 @@ Resources:
408
408
  max-width: 24px;
409
409
  }
410
410
  }
411
- `,js=_o.div`
411
+ `,Ks=_o.div`
412
412
  text-align: center;
413
413
  font-size: 14px;
414
414
  margin-bottom: 24px;
415
415
  `,Se=_o.button`
416
- ${mf}
416
+ ${uh}
417
417
  `,Xc=_o.a`
418
- ${mf}
418
+ ${uh}
419
419
  `,_r=_o.div`
420
420
  width: 100%;
421
421
  height: 100%;
@@ -423,7 +423,7 @@ Resources:
423
423
  display: flex;
424
424
  flex-direction: column;
425
425
  ${e=>e.if?"display: none;":""}
426
- `;import{Fragment as L3,jsx as cn,jsxs as ra}from"react/jsx-runtime";var hf=()=>{let{navigate:e,app:t}=x();return ra(L3,{children:[cn(P,{}),ra(M3,{children:[cn(Ke,{children:ra("div",{children:[cn(pf,{color:"var(--privy-color-warn-light)"}),cn(W3,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),ra(O3,{children:[cn("h3",{children:"Account not found"}),ra("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),cn(Ao,{}),cn(U,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},M3=ff.div`
426
+ `;import{Fragment as N3,jsx as cn,jsxs as ta}from"react/jsx-runtime";var hh=()=>{let{navigate:e,app:t}=x();return ta(N3,{children:[cn(P,{}),ta(O3,{children:[cn(Ke,{children:ta("div",{children:[cn(ch,{color:"var(--privy-color-warn-light)"}),cn(W3,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),ta(L3,{children:[cn("h3",{children:"Account not found"}),ta("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),cn(Ao,{}),cn(D,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},O3=mh.div`
427
427
  display: flex;
428
428
  flex-direction: column;
429
429
  align-items: center;
@@ -432,11 +432,11 @@ Resources:
432
432
  width: 100%;
433
433
  padding-bottom: 16px;
434
434
  margin-top: 24px;
435
- `,O3=ff.div`
435
+ `,L3=mh.div`
436
436
  display: flex;
437
437
  flex-direction: column;
438
438
  gap: 8px;
439
- `;import Cf from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import N3 from"@heroicons/react/24/solid/DocumentCheckIcon";import D3 from"styled-components";import yf from"styled-components";import{jsx as oi,jsxs as gf}from"react/jsx-runtime";var ep=yf.div`
439
+ `;import vh from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import D3 from"@heroicons/react/24/solid/DocumentCheckIcon";import U3 from"styled-components";import fh from"styled-components";import{jsx as ri,jsxs as yh}from"react/jsx-runtime";var ep=fh.div`
440
440
  margin-top: 16px;
441
441
  font-size: 13px;
442
442
  text-align: center;
@@ -445,7 +445,7 @@ Resources:
445
445
  && > a {
446
446
  color: var(--privy-color-accent);
447
447
  }
448
- `;function ni(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return oi(ep,{});if(!r&&!t)return oi(ep,{});let n=!!(t&&r);return gf(ep,{children:["By logging in I agree to the"," ",r&&oi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&oi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=()=>gf(K,{children:[oi(zn,{}),oi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),K=yf.div`
448
+ `;function oi(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return ri(ep,{});if(!r&&!t)return ri(ep,{});let n=!!(t&&r);return yh(ep,{children:["By logging in I agree to the"," ",r&&ri("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&ri("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=()=>yh(K,{children:[ri(qn,{}),ri("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),K=fh.div`
449
449
  display: flex;
450
450
  align-items: center;
451
451
  justify-content: center;
@@ -532,7 +532,7 @@ Resources:
532
532
  flex-direction: column;
533
533
  gap: 10px;
534
534
  padding-top: 20px;
535
- `,Ys=pt.div`
535
+ `,js=pt.div`
536
536
  display: flex;
537
537
  flex-direction: column;
538
538
  align-items: stretch;
@@ -540,11 +540,11 @@ Resources:
540
540
  padding: 1rem 0rem 0rem;
541
541
  flex-grow: 1;
542
542
  width: 100%;
543
- `,Zs=pt.div`
543
+ `,Ys=pt.div`
544
544
  display: flex;
545
545
  gap: 5px;
546
546
  width: 100%;
547
- `,Qs=pt.button`
547
+ `,Zs=pt.button`
548
548
  && {
549
549
  background-color: transparent;
550
550
  color: var(--privy-color-foreground-3);
@@ -562,7 +562,7 @@ Resources:
562
562
  &&:hover {
563
563
  color: var(--privy-color-error);
564
564
  }
565
- `,Js=pt.div`
565
+ `,Qs=pt.div`
566
566
  display: flex;
567
567
  align-items: center;
568
568
  gap: 0.5rem;
@@ -586,15 +586,15 @@ Resources:
586
586
  display: flex !important;
587
587
  align-items: flex-end;
588
588
  }
589
- `,Xs=pt.div`
589
+ `,Js=pt.div`
590
590
  width: 100%;
591
591
  display: flex;
592
592
  justify-content: space-between;
593
- `,vf=pt.p`
593
+ `,gh=pt.p`
594
594
  text-align: left;
595
595
  width: 100%;
596
596
  color: var(--privy-color-foreground-3) !important;
597
- `,oa=pt.button`
597
+ `,ra=pt.button`
598
598
  display: flex;
599
599
  flex-direction: row;
600
600
  align-items: center;
@@ -639,12 +639,12 @@ Resources:
639
639
  width: auto !important;
640
640
  color: white;
641
641
  }
642
- `,el=pt.div`
642
+ `,Xs=pt.div`
643
643
  color: var(--privy-color-error);
644
- `;import{Fragment as B3,jsx as $r,jsxs as na}from"react/jsx-runtime";var wf=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=x(),{acceptTerms:i,closePrivyModal:s,createAnalyticsEvent:l}=k(),c=h=>{h?.preventDefault(),s({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async h=>{h.preventDefault(),await i(),e&&Ut(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:m=>{console.error(m),l({eventName:"embedded_wallet_creation_failure_logout",payload:{error:m,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):s()};return $r(U3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},U3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>na(B3,{children:[$r(P,{closeable:!1}),$r(N3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),$r(pe,{style:{marginTop:24},children:"One last step"}),$r(ue,{children:"By signing up, you agree to our terms and privacy policy."}),na(Pr,{style:{marginTop:24},children:[e&&na(Xc,{target:"_blank",href:e,children:["View Terms ",$r(Cf,{style:{marginLeft:"auto"}})]}),t&&na(Xc,{target:"_blank",href:t,children:["View Privacy Policy ",$r(Cf,{style:{marginLeft:"auto"}})]})]}),na(F3,{style:{marginTop:24},children:[$r(Sr,{onClick:o,children:"No thanks"}),$r(U,{onClick:r,children:"Accept"})]}),$r($,{})]}),F3=D3.div`
644
+ `;import{Fragment as H3,jsx as $r,jsxs as oa}from"react/jsx-runtime";var Ch=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=x(),{acceptTerms:i,closePrivyModal:s,createAnalyticsEvent:l}=k(),c=f=>{f?.preventDefault(),s({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await i(),e&&Ut(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:m=>{console.error(m),l({eventName:"embedded_wallet_creation_failure_logout",payload:{error:m,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):s()};return $r(F3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},F3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>oa(H3,{children:[$r(P,{closeable:!1}),$r(D3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),$r(pe,{style:{marginTop:24},children:"One last step"}),$r(ue,{children:"By signing up, you agree to our terms and privacy policy."}),oa(Pr,{style:{marginTop:24},children:[e&&oa(Xc,{target:"_blank",href:e,children:["View Terms ",$r(vh,{style:{marginLeft:"auto"}})]}),t&&oa(Xc,{target:"_blank",href:t,children:["View Privacy Policy ",$r(vh,{style:{marginLeft:"auto"}})]})]}),oa(B3,{style:{marginTop:24},children:[$r(Sr,{onClick:o,children:"No thanks"}),$r(D,{onClick:r,children:"Accept"})]}),$r($,{})]}),B3=U3.div`
645
645
  display: flex;
646
646
  gap: 10px;
647
- `;import Ef from"styled-components";import H3 from"styled-components";var tl=H3.span`
647
+ `;import bh from"styled-components";import V3 from"styled-components";var el=V3.span`
648
648
  && {
649
649
  width: 82px;
650
650
  height: 82px;
@@ -659,7 +659,7 @@ Resources:
659
659
  transition: border-color 800ms;
660
660
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
661
661
  }
662
- `;import{jsx as bf}from"react/jsx-runtime";var rl=({style:e,...t})=>bf("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:bf("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as tp,jsx as Kr,jsxs as ol}from"react/jsx-runtime";var Tf=()=>{let{navigate:e,app:t}=x(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return ol(tp,{children:[Kr(P,{}),ol(V3,{children:[Kr(Ke,{children:ol("div",{children:[Kr(tl,{}),Kr(rl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),ol(G3,{children:[typeof r=="string"?Kr("h3",{children:r}):Kr(tp,{children:r}),typeof o=="string"?Kr("p",{children:o}):Kr(tp,{children:o})]}),t?.allowlistConfig.errorCtaLink?Kr(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Kr(U,{onClick:()=>{e("LANDING")},children:n})]})]})},V3=Ef.div`
662
+ `;import{jsx as wh}from"react/jsx-runtime";var tl=({style:e,...t})=>wh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:wh("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as tp,jsx as Kr,jsxs as rl}from"react/jsx-runtime";var Eh=()=>{let{navigate:e,app:t}=x(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return rl(tp,{children:[Kr(P,{}),rl(G3,{children:[Kr(Ke,{children:rl("div",{children:[Kr(el,{}),Kr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),rl(q3,{children:[typeof r=="string"?Kr("h3",{children:r}):Kr(tp,{children:r}),typeof o=="string"?Kr("p",{children:o}):Kr(tp,{children:o})]}),t?.allowlistConfig.errorCtaLink?Kr(D,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Kr(D,{onClick:()=>{e("LANDING")},children:n})]})]})},G3=bh.div`
663
663
  display: flex;
664
664
  flex-direction: column;
665
665
  align-items: center;
@@ -667,11 +667,11 @@ Resources:
667
667
  gap: 24px;
668
668
  width: 100%;
669
669
  padding-bottom: 16px;
670
- `,G3=Ef.div`
670
+ `,q3=bh.div`
671
671
  display: flex;
672
672
  flex-direction: column;
673
673
  gap: 8px;
674
- `;import $3 from"@heroicons/react/20/solid/CheckIcon";import K3 from"@heroicons/react/24/outline/EnvelopeIcon";import j3 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as np,useState as aa}from"react";import{isMobile as Y3}from"react-device-detect";import mn from"styled-components";import Jt from"styled-components";var mr=Jt.div`
674
+ `;import K3 from"@heroicons/react/20/solid/CheckIcon";import j3 from"@heroicons/react/24/outline/EnvelopeIcon";import Y3 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as np,useState as ia}from"react";import{isMobile as Z3}from"react-device-detect";import mn from"styled-components";import Jt from"styled-components";var mr=Jt.div`
675
675
  display: flex;
676
676
  flex-direction: column;
677
677
  align-items: flex-start;
@@ -686,12 +686,12 @@ Resources:
686
686
  justify-content: center;
687
687
  flex-grow: 1;
688
688
  width: 100%;
689
- `,Sf=Jt.div`
689
+ `,Th=Jt.div`
690
690
  display: flex;
691
691
  flex-direction: column;
692
692
  align-items: center;
693
693
  width: 100%;
694
- `,ii=Jt(xt)`
694
+ `,ni=Jt(xt)`
695
695
  padding: 20px 0;
696
696
  `,Ar=Jt(xt)`
697
697
  gap: 16px;
@@ -703,12 +703,12 @@ Resources:
703
703
  display: flex;
704
704
  flex-direction: column;
705
705
  gap: 8px;
706
- `,PR=Jt.div`
706
+ `,kR=Jt.div`
707
707
  display: flex;
708
708
  flex-direction: column;
709
709
  justify-content: space-between;
710
710
  height: 100%;
711
- `,Pf=Jt.div`
711
+ `,Sh=Jt.div`
712
712
  display: flex;
713
713
  flex-direction: column;
714
714
  justify-content: flex-start;
@@ -735,9 +735,9 @@ Resources:
735
735
  height: 16px;
736
736
  `,te=Jt.div`
737
737
  height: 12px;
738
- `,_f=Jt.div`
738
+ `,Ph=Jt.div`
739
739
  position: relative;
740
- `,Af=Jt.div`
740
+ `,_h=Jt.div`
741
741
  background-color: var(--privy-color-accent);
742
742
  display: flex;
743
743
  justify-content: center;
@@ -745,9 +745,9 @@ Resources:
745
745
  border-radius: 50%;
746
746
  border-color: white;
747
747
  border-width: 2px !important;
748
- `;import op from"styled-components";import{Fragment as z3,jsx as ia,jsxs as kf}from"react/jsx-runtime";var un=({title:e,description:t,children:r,...o})=>ia(xf,{...o,children:kf(z3,{children:[ia("h3",{children:e}),typeof t=="string"?ia("p",{children:t}):t,r]})}),jr=op(un)`
748
+ `;import op from"styled-components";import{Fragment as $3,jsx as na,jsxs as xh}from"react/jsx-runtime";var un=({title:e,description:t,children:r,...o})=>na(Ah,{...o,children:xh($3,{children:[na("h3",{children:e}),typeof t=="string"?na("p",{children:t}):t,r]})}),jr=op(un)`
749
749
  margin-bottom: 24px;
750
- `,xe=({title:e,description:t,icon:r,children:o,...n})=>kf(q3,{...n,children:[r||null,ia("h3",{children:e}),t&&typeof t=="string"?ia("p",{children:t}):t,o]}),xf=op.div`
750
+ `,xe=({title:e,description:t,icon:r,children:o,...n})=>xh(z3,{...n,children:[r||null,na("h3",{children:e}),t&&typeof t=="string"?na("p",{children:t}):t,o]}),Ah=op.div`
751
751
  display: flex;
752
752
  flex-direction: column;
753
753
  justify-content: flex-start;
@@ -767,7 +767,7 @@ Resources:
767
767
  color: var(--privy-color-foreground-2);
768
768
  font-size: 14px;
769
769
  }
770
- `,q3=op(xf)`
770
+ `,z3=op(Ah)`
771
771
  align-items: center;
772
772
  text-align: center;
773
773
  gap: 16px;
@@ -775,7 +775,7 @@ Resources:
775
775
  h3 {
776
776
  margin-bottom: 24px;
777
777
  }
778
- `;import{Fragment as n0,jsx as kt,jsxs as po}from"react/jsx-runtime";var ip=6,Rf=new Array(ip).fill(""),Z3=1400,Q3=30;var Wf=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:a}=x(),{closePrivyModal:i,resendEmailCode:s,resendSmsCode:l,getAuthMeta:c,loginWithCode:u,updateWallets:h,createAnalyticsEvent:m}=k(),{authenticated:g,logout:w,user:y}=H(),[T,_]=aa(Rf),[b,S]=aa(!1),[I,N]=aa(null),[W,R]=aa(null),[B,q]=aa(0);a.current=()=>null;let Y=c()?.email?0:1,M=Le,z=M-500;np(()=>{if(B){let de=setTimeout(()=>{q(B-1)},1e3);return()=>clearTimeout(de)}},[B]),np(()=>{if(g&&b&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let J=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},z);return()=>clearTimeout(J)}if(Ut(y,e?.embeddedWallets?.createOnLogin)){let J=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:Ee=>{console.error(Ee),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ee,screen:"AwaitingPasswordlessCodeScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},z);return()=>clearTimeout(J)}else{h();let J=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M);return()=>clearTimeout(J)}}},[g,b,y]),np(()=>{if(I&&W===0){let de=setTimeout(()=>{_(Rf),N(null),document.querySelector("input[name=code-0]")?.focus()},Z3);return()=>clearTimeout(de)}},[I]);let L=de=>{de.preventDefault();let J=de.currentTarget.value.replace(" ","");if(J==="")return;if(isNaN(Number(J))){N("Code should be numeric"),R(1);return}N(null),R(null);let Ee=Number(de.currentTarget.name?.charAt(5)),_e=[...J||[""]].slice(0,ip-Ee),vt=[...T.slice(0,Ee),..._e,...T.slice(Ee+_e.length)];_(vt);let sr=_e.length,Ot=Math.min(Math.max(Ee+sr,0),ip-1);isNaN(Number(de.currentTarget.value))||document.querySelector(`input[name=code-${Ot}]`)?.focus(),vt.every(it=>it&&!isNaN(+it))&&(document.querySelector(`input[name=code-${Ot}]`)?.blur(),u(vt.join("")).then(()=>S(!0)).catch(se=>{if(se?.status===422)N("Invalid or expired verification code");else if(se instanceof Pt&&se.privyErrorCode==="cannot_link_more_of_type")N(se.message);else if(se instanceof Pt&&se.privyErrorCode==="max_accounts_reached"){console.error(new cr(se).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(se instanceof Pt&&se.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(se instanceof Pt&&se.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:se,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else N("Issue verifying code");R(0)}))},Ue=de=>{W===1&&(N(null),R(null));let J=[...T.slice(0,de),"",...T.slice(de+1)];_(J),de>0&&document.querySelector(`input[name=code-${de-1}]`)?.focus()},Ye=Y==0?kt(K3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):kt(j3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Oe=Y==0?po("p",{children:["Please check ",kt(If,{children:c()?.email})," for an email from privy.io and enter your code below."]}):po("p",{children:["Please check ",kt(If,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return po(n0,{children:[kt(P,{backFn:()=>o()},"header"),po(J3,{children:[kt(xe,{title:"Enter confirmation code",description:Oe,icon:Ye}),po(Sf,{children:[po(X3,{children:[kt(e0,{fail:!!I,success:b,children:kt("span",{children:I||(b?"Success!":"")})}),kt("div",{children:T.map((de,J)=>kt("input",{name:`code-${J}`,type:"text",value:T[J],onChange:L,onKeyUp:Ee=>{Ee.key==="Backspace"&&Ue(J)},inputMode:"numeric",autoFocus:J===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:Y3?"one-time-code":"off"},J))})]}),po(t0,{children:[po("span",{children:["Didn't get ",Y==0?"an email":"a message","?"]}),B?po(o0,{children:[kt($3,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),kt("span",{children:"Code sent"})]}):kt(r0,{children:kt("button",{onClick:async()=>{q(Q3),Y==0?await s():await l()},children:"Resend code"})})]})]})]}),kt($,{})]})},J3=mn.div`
778
+ `;import{Fragment as i0,jsx as kt,jsxs as po}from"react/jsx-runtime";var ip=6,kh=new Array(ip).fill(""),Q3=1400,J3=30;var Ih=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:a}=x(),{closePrivyModal:i,resendEmailCode:s,resendSmsCode:l,getAuthMeta:c,loginWithCode:u,updateWallets:f,createAnalyticsEvent:m}=k(),{authenticated:v,logout:w,user:y}=H(),[T,_]=ia(kh),[b,S]=ia(!1),[I,N]=ia(null),[M,R]=ia(null),[B,q]=ia(0);a.current=()=>null;let Y=c()?.email?0:1,W=Le,z=W-500;np(()=>{if(B){let de=setTimeout(()=>{q(B-1)},1e3);return()=>clearTimeout(de)}},[B]),np(()=>{if(v&&b&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let X=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},z);return()=>clearTimeout(X)}if(Ut(y,e?.embeddedWallets?.createOnLogin)){let X=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:Ee=>{console.error(Ee),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ee,screen:"AwaitingPasswordlessCodeScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},z);return()=>clearTimeout(X)}else{f();let X=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),W);return()=>clearTimeout(X)}}},[v,b,y]),np(()=>{if(I&&M===0){let de=setTimeout(()=>{_(kh),N(null),document.querySelector("input[name=code-0]")?.focus()},Q3);return()=>clearTimeout(de)}},[I]);let L=de=>{de.preventDefault();let X=de.currentTarget.value.replace(" ","");if(X==="")return;if(isNaN(Number(X))){N("Code should be numeric"),R(1);return}N(null),R(null);let Ee=Number(de.currentTarget.name?.charAt(5)),_e=[...X||[""]].slice(0,ip-Ee),vt=[...T.slice(0,Ee),..._e,...T.slice(Ee+_e.length)];_(vt);let sr=_e.length,Ot=Math.min(Math.max(Ee+sr,0),ip-1);isNaN(Number(de.currentTarget.value))||document.querySelector(`input[name=code-${Ot}]`)?.focus(),vt.every(it=>it&&!isNaN(+it))&&(document.querySelector(`input[name=code-${Ot}]`)?.blur(),u(vt.join("")).then(()=>S(!0)).catch(se=>{if(se?.status===422)N("Invalid or expired verification code");else if(se instanceof Pt&&se.privyErrorCode==="cannot_link_more_of_type")N(se.message);else if(se instanceof Pt&&se.privyErrorCode==="max_accounts_reached"){console.error(new cr(se).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(se instanceof Pt&&se.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(se instanceof Pt&&se.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:se,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else N("Issue verifying code");R(0)}))},Ue=de=>{M===1&&(N(null),R(null));let X=[...T.slice(0,de),"",...T.slice(de+1)];_(X),de>0&&document.querySelector(`input[name=code-${de-1}]`)?.focus()},Ye=Y==0?kt(j3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):kt(Y3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Oe=Y==0?po("p",{children:["Please check ",kt(Rh,{children:c()?.email})," for an email from privy.io and enter your code below."]}):po("p",{children:["Please check ",kt(Rh,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return po(i0,{children:[kt(P,{backFn:()=>o()},"header"),po(X3,{children:[kt(xe,{title:"Enter confirmation code",description:Oe,icon:Ye}),po(Th,{children:[po(e0,{children:[kt(t0,{fail:!!I,success:b,children:kt("span",{children:I||(b?"Success!":"")})}),kt("div",{children:T.map((de,X)=>kt("input",{name:`code-${X}`,type:"text",value:T[X],onChange:L,onKeyUp:Ee=>{Ee.key==="Backspace"&&Ue(X)},inputMode:"numeric",autoFocus:X===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:Z3?"one-time-code":"off"},X))})]}),po(r0,{children:[po("span",{children:["Didn't get ",Y==0?"an email":"a message","?"]}),B?po(n0,{children:[kt(K3,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),kt("span",{children:"Code sent"})]}):kt(o0,{children:kt("button",{onClick:async()=>{q(J3),Y==0?await s():await l()},children:"Resend code"})})]})]})]}),kt($,{})]})},X3=mn.div`
779
779
  display: flex;
780
780
  flex-direction: column;
781
781
  align-items: flex-start;
@@ -783,7 +783,7 @@ Resources:
783
783
  margin: auto;
784
784
  gap: 16px;
785
785
  flex-grow: 1;
786
- `,X3=mn.div`
786
+ `,e0=mn.div`
787
787
  display: flex;
788
788
  flex-direction: column;
789
789
  width: 100%;
@@ -840,7 +840,7 @@ Resources:
840
840
  transform: translate(1px, 0px);
841
841
  }
842
842
  }
843
- `,e0=mn.div`
843
+ `,t0=mn.div`
844
844
  line-height: 20px;
845
845
  height: 20px;
846
846
  font-size: 13px;
@@ -848,7 +848,7 @@ Resources:
848
848
  display: flex;
849
849
  justify-content: flex-end;
850
850
  width: 100%;
851
- `,t0=mn.div`
851
+ `,r0=mn.div`
852
852
  font-size: 13px;
853
853
  color: var(--privy-color-foreground);
854
854
  display: flex;
@@ -859,13 +859,13 @@ Resources:
859
859
  // Equal opposing size buffer to account for auto margining when the
860
860
  // success/fail text does not show up
861
861
  padding-bottom: 32px;
862
- `,r0=mn.div`
862
+ `,o0=mn.div`
863
863
  color: var(--privy-color-accent);
864
864
  padding: 2px 0;
865
865
  > button {
866
866
  text-decoration: underline;
867
867
  }
868
- `,o0=mn.div`
868
+ `,n0=mn.div`
869
869
  display: flex;
870
870
  align-items: center;
871
871
  justify-content: center;
@@ -874,10 +874,10 @@ Resources:
874
874
  gap: 4px;
875
875
  background: var(--privy-color-background-2);
876
876
  color: var(--privy-color-foreground-2);
877
- `,If=mn.span`
877
+ `,Rh=mn.span`
878
878
  font-weight: 500;
879
879
  word-break: break-all;
880
- `;import c0 from"@heroicons/react/24/solid/CheckCircleIcon";import p0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as ap,useRef as d0,useState as si}from"react";import u0 from"styled-components";import i0 from"styled-components";import{Fragment as l0,jsx as ai,jsxs as s0}from"react/jsx-runtime";var Mf=({icon:e})=>{let t=e;return ai(l0,{children:ai(a0,{children:s0("div",{children:[ai(Je,{}),typeof t=="string"?ai("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?ai(t,{style:{width:"38px",height:"38px"}}):ai("span",{})]})})})},a0=i0.div`
880
+ `;import p0 from"@heroicons/react/24/solid/CheckCircleIcon";import d0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as ap,useRef as u0,useState as ai}from"react";import m0 from"styled-components";import a0 from"styled-components";import{Fragment as c0,jsx as ii,jsxs as l0}from"react/jsx-runtime";var Mh=({icon:e})=>{let t=e;return ii(c0,{children:ii(s0,{children:l0("div",{children:[ii(Je,{}),typeof t=="string"?ii("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?ii(t,{style:{width:"38px",height:"38px"}}):ii("span",{})]})})})},s0=a0.div`
881
881
  display: flex;
882
882
  flex-direction: column;
883
883
  justify-content: center;
@@ -900,14 +900,14 @@ Resources:
900
900
  left: -19px;
901
901
  top: -19px;
902
902
  }
903
- `;import{Fragment as f0,jsx as xr,jsxs as sp}from"react/jsx-runtime";var Lf=500,Of=Lf*2,Nf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=x(),{status:i,token:s,waitForResult:l,reset:c,execute:u}=ye(),h=d0([]),m=z=>{h.current=[z,...h.current]},[g,w]=si(!0);ap(()=>{let z=setTimeout(w,Of,!1);return m(z),()=>{h.current.forEach(L=>clearTimeout(L)),h.current=[]}},[]);let[y,T]=si(""),[_,b]=si("Checking that you are a human..."),[S,I]=si(xr(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[N,W]=si(!1),[R,B]=si(3),q=r?.captchaModalData,Y=async z=>{try{await q?.callback(z),q?.onSuccessNavigateTo&&n(q?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Qt)return;{let Ue={error:L,previousScreen:e||"LANDING"};a({errorModalData:Ue}),n(q?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};ap(()=>{if(i==="success"){let z=setTimeout(async()=>{let L=await l();!L||q?.userIntentRequired||Y(L)},Of);m(z)}else if(i==="ready"){let z=setTimeout(()=>{i==="ready"&&u()},Lf);m(z)}},[i]),ap(()=>{if(!g)switch(i){case"success":T("Success!"),b("CAPTCHA passed successfully."),I(xr(U,{onClick:()=>{W(!0),Y(s)},disabled:!q?.userIntentRequired,loading:N,children:q?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":T(""),b("Checking that you are a human..."),I(xr(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":T("Something went wrong"),R<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(b("You did not pass CAPTCHA. Please try again."),I(xr(U,{onClick:M,children:"Retry"})));break;case"ready":default:break}},[i,g,N]);let M=async()=>{if(R<=0)return;B(L=>L-1),c(),u();let z=await l();!z||q?.userIntentRequired||Y(z)};return sp(f0,{children:[xr(P,{backFn:!e||t===e?void 0:o}),sp(m0,{children:[i==="success"?xr(c0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?xr(p0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(Mf,{}),sp(je,{children:[y?xr("h3",{children:y}):null,xr("p",{children:_})]}),S]}),xr(K,{})]})},m0=u0.div`
903
+ `;import{Fragment as f0,jsx as xr,jsxs as sp}from"react/jsx-runtime";var Oh=500,Wh=Oh*2,Lh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=x(),{status:i,token:s,waitForResult:l,reset:c,execute:u}=ye(),f=u0([]),m=z=>{f.current=[z,...f.current]},[v,w]=ai(!0);ap(()=>{let z=setTimeout(w,Wh,!1);return m(z),()=>{f.current.forEach(L=>clearTimeout(L)),f.current=[]}},[]);let[y,T]=ai(""),[_,b]=ai("Checking that you are a human..."),[S,I]=ai(xr(D,{onClick:()=>{},disabled:!0,children:"Continue"})),[N,M]=ai(!1),[R,B]=ai(3),q=r?.captchaModalData,Y=async z=>{try{await q?.callback(z),q?.onSuccessNavigateTo&&n(q?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Qt)return;{let Ue={error:L,previousScreen:e||"LANDING"};a({errorModalData:Ue}),n(q?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};ap(()=>{if(i==="success"){let z=setTimeout(async()=>{let L=await l();!L||q?.userIntentRequired||Y(L)},Wh);m(z)}else if(i==="ready"){let z=setTimeout(()=>{i==="ready"&&u()},Oh);m(z)}},[i]),ap(()=>{if(!v)switch(i){case"success":T("Success!"),b("CAPTCHA passed successfully."),I(xr(D,{onClick:()=>{M(!0),Y(s)},disabled:!q?.userIntentRequired,loading:N,children:q?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":T(""),b("Checking that you are a human..."),I(xr(D,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":T("Something went wrong"),R<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(b("You did not pass CAPTCHA. Please try again."),I(xr(D,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[i,v,N]);let W=async()=>{if(R<=0)return;B(L=>L-1),c(),u();let z=await l();!z||q?.userIntentRequired||Y(z)};return sp(f0,{children:[xr(P,{backFn:!e||t===e?void 0:o}),sp(h0,{children:[i==="success"?xr(p0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?xr(d0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(Mh,{}),sp(je,{children:[y?xr("h3",{children:y}):null,xr("p",{children:_})]}),S]}),xr(K,{})]})},h0=m0.div`
904
904
  display: flex;
905
905
  flex-direction: column;
906
906
  align-items: center;
907
907
  justify-content: center;
908
908
  gap: 24px;
909
909
  width: 100%;
910
- `;import h0 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as $f}from"react-device-detect";import y0 from"styled-components";function li(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{jsx as kr,jsxs as Df}from"react/jsx-runtime";var Uf=({...e})=>Df("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[kr("defs",{children:Df("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[kr("stop",{offset:"0",stopColor:"#f1562b"}),kr("stop",{offset:"0.3",stopColor:"#f1542b"}),kr("stop",{offset:"0.41",stopColor:"#f04d2a"}),kr("stop",{offset:"0.49",stopColor:"#ef4229"}),kr("stop",{offset:"0.5",stopColor:"#ef4029"}),kr("stop",{offset:"0.56",stopColor:"#e83e28"}),kr("stop",{offset:"0.67",stopColor:"#e13c26"}),kr("stop",{offset:"1",stopColor:"#df3c26"})]})}),kr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),kr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Rr,jsxs as sa}from"react/jsx-runtime";var Ff=({style:e,...t})=>sa("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Rr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),sa("g",{mask:"url(#mask0_16909_31415)",children:[Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),sa("defs",{children:[sa("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72"}),Rr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),sa("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Rr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as Xt,jsxs as ci}from"react/jsx-runtime";var Bf=e=>ci("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Xt("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),Xt("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),Xt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),Xt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),Xt("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),ci("defs",{children:[ci("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"1",stopColor:"white"})]}),ci("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),ci("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),ci("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as ae,jsxs as er}from"react/jsx-runtime";var Hf=({style:e,...t})=>er("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[ae("g",{clipPath:"url(#clip0_5_32)",children:er("g",{clipPath:"url(#clip1_5_32)",children:[ae("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ae("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),ae("g",{mask:"url(#mask0_5_32)",children:ae("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ae("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),ae("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ae("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ae("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ae("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ae("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ae("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),ae("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ae("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),er("defs",{children:[er("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#174299"}),ae("stop",{offset:"1",stopColor:"#001E59"})]}),er("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ae("stop",{offset:"0.770277",stopColor:"#FF4000"}),ae("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FF4000"}),ae("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#8754C9"}),ae("stop",{offset:"1",stopColor:"#FF4000"})]}),er("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ae("stop",{offset:"0.723929",stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ae("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),er("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ae("stop",{stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),er("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[ae("stop",{stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),ae("clipPath",{id:"clip0_5_32",children:ae("rect",{width:"120",height:"120",fill:"white"})}),ae("clipPath",{id:"clip1_5_32",children:ae("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Yr,jsxs as Vf}from"react/jsx-runtime";var Gf=({style:e,...t})=>Vf("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Yr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Vf("g",{filter:"url(#filter0_d_12393_20043)",children:[Yr("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),Yr("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),Yr("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),Yr("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),Yr("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),Yr("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),Yr("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),Yr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),Yr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as la,jsxs as qf}from"react/jsx-runtime";var zf=({style:e,...t})=>qf("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[qf("g",{clipPath:"url(#clip0_1704_1423)",children:[la("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),la("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),la("defs",{children:la("clipPath",{id:"clip0_1704_1423",children:la("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as pi,jsxs as b0}from"react/jsx-runtime";var fr={coinbase_wallet:{logo:ji,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:ji,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Kn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Gr,displayName:"Phantom"},rainbow:{logo:Hf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Ji,displayName:"WalletConnect"},zerion:{logo:zf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Uf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Ff,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Gf,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Bf,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},fn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=x(),{connectWallet:i}=k(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,l=window.matchMedia("(display-mode: standalone)").matches,c;return n.connectorType==="phantom"?c=()=>{To()?(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a($f?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&$f&&!l&&!cs()?c=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:c=()=>{li(window.navigator.userAgent)&&!event?.isTrusted||(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},b0(w0,{onClick:c,children:[pi(C0,{icon:v0(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),pi("span",{children:g0(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),pi("span",{id:"connect-text",children:"Connect"})]})},g0=(e,t,r)=>{if(fr[e]?.displayName)return e==="coinbase_wallet"?fr[r].displayName:fr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},v0=(e,t,r)=>{if(fr[e]?.logo)return e==="coinbase_wallet"?fr[r].logo:fr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Ji},C0=({icon:e,name:t})=>typeof e=="string"?pi("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?pi(h0,{}):e?pi(e,{}):null,w0=y0(Se)`
910
+ `;import y0 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as zh}from"react-device-detect";import g0 from"styled-components";function si(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{jsx as kr,jsxs as Nh}from"react/jsx-runtime";var Dh=({...e})=>Nh("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[kr("defs",{children:Nh("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[kr("stop",{offset:"0",stopColor:"#f1562b"}),kr("stop",{offset:"0.3",stopColor:"#f1542b"}),kr("stop",{offset:"0.41",stopColor:"#f04d2a"}),kr("stop",{offset:"0.49",stopColor:"#ef4229"}),kr("stop",{offset:"0.5",stopColor:"#ef4029"}),kr("stop",{offset:"0.56",stopColor:"#e83e28"}),kr("stop",{offset:"0.67",stopColor:"#e13c26"}),kr("stop",{offset:"1",stopColor:"#df3c26"})]})}),kr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),kr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Rr,jsxs as aa}from"react/jsx-runtime";var Uh=({style:e,...t})=>aa("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Rr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),aa("g",{mask:"url(#mask0_16909_31415)",children:[Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Rr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),aa("defs",{children:[aa("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72"}),Rr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),aa("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Rr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Rr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as Xt,jsxs as li}from"react/jsx-runtime";var Fh=e=>li("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Xt("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),Xt("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),Xt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),Xt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),Xt("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),li("defs",{children:[li("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"1",stopColor:"white"})]}),li("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),li("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"#8697FF"}),Xt("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),li("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[Xt("stop",{stopColor:"white"}),Xt("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as ae,jsxs as er}from"react/jsx-runtime";var Bh=({style:e,...t})=>er("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[ae("g",{clipPath:"url(#clip0_5_32)",children:er("g",{clipPath:"url(#clip1_5_32)",children:[ae("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ae("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),ae("g",{mask:"url(#mask0_5_32)",children:ae("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ae("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),ae("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ae("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ae("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ae("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ae("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ae("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),ae("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ae("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),er("defs",{children:[er("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#174299"}),ae("stop",{offset:"1",stopColor:"#001E59"})]}),er("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ae("stop",{offset:"0.770277",stopColor:"#FF4000"}),ae("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FF4000"}),ae("stop",{offset:"1",stopColor:"#8754C9"})]}),er("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#8754C9"}),ae("stop",{offset:"1",stopColor:"#FF4000"})]}),er("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ae("stop",{offset:"0.723929",stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ae("stop",{stopColor:"#FFF700"}),ae("stop",{offset:"1",stopColor:"#FF9901"})]}),er("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ae("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),er("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ae("stop",{stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),er("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[ae("stop",{stopColor:"#00AAFF"}),ae("stop",{offset:"1",stopColor:"#01DA40"})]}),ae("clipPath",{id:"clip0_5_32",children:ae("rect",{width:"120",height:"120",fill:"white"})}),ae("clipPath",{id:"clip1_5_32",children:ae("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Yr,jsxs as Hh}from"react/jsx-runtime";var Vh=({style:e,...t})=>Hh("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Yr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Hh("g",{filter:"url(#filter0_d_12393_20043)",children:[Yr("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),Yr("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),Yr("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),Yr("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),Yr("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),Yr("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),Yr("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),Yr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),Yr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as sa,jsxs as Gh}from"react/jsx-runtime";var qh=({style:e,...t})=>Gh("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Gh("g",{clipPath:"url(#clip0_1704_1423)",children:[sa("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),sa("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),sa("defs",{children:sa("clipPath",{id:"clip0_1704_1423",children:sa("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as ci,jsxs as E0}from"react/jsx-runtime";var hr={coinbase_wallet:{logo:Ki,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Ki,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:$n,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Gr,displayName:"Phantom"},rainbow:{logo:Bh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Qi,displayName:"WalletConnect"},zerion:{logo:qh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Dh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Uh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Vh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Fh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},hn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=x(),{connectWallet:i}=k(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,l=window.matchMedia("(display-mode: standalone)").matches,c;return n.connectorType==="phantom"?c=()=>{To()?(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(zh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&zh&&!l&&!ls()?c=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:c=()=>{si(window.navigator.userAgent)&&!event?.isTrusted||(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},E0(b0,{onClick:c,children:[ci(w0,{icon:C0(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),ci("span",{children:v0(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),ci("span",{id:"connect-text",children:"Connect"})]})},v0=(e,t,r)=>{if(hr[e]?.displayName)return e==="coinbase_wallet"?hr[r].displayName:hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},C0=(e,t,r)=>{if(hr[e]?.logo)return e==="coinbase_wallet"?hr[r].logo:hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Qi},w0=({icon:e,name:t})=>typeof e=="string"?ci("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?ci(y0,{}):e?ci(e,{}):null,b0=g0(Se)`
911
911
  /* Show "Connect" on hover */
912
912
  > #connect-text {
913
913
  font-weight: 500;
@@ -929,21 +929,14 @@ Resources:
929
929
  display: none;
930
930
  }
931
931
  }
932
- `;import{Fragment as _0,jsx as di,jsxs as A0}from"react/jsx-runtime";var E0=["coinbase_wallet"],T0=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],S0=[],P0=["phantom"],ui=({connectOnly:e})=>{let{connectors:t}=k(),{app:r}=x(),o=ca(r.appearance.walletList,t,e,r.appearance.walletList);return A0(_0,{children:[...o]})},ca=(e,t,r,o,n)=>{let a=[],i=[],s=[],l=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let u=t.filter(({connectorType:h,walletClientType:m})=>m==="uniswap_wallet_extension"?!o.includes("uniswap"):m==="crypto.com_wallet_extension"?!o.includes("cryptocom"):h==="injected"&&!o.includes(m));for(let h of u){let{walletClientType:m,walletBranding:g}=h;(m==="unknown"?i:a).push(di(fn,{connectOnly:r,provider:m,logo:g.icon,displayName:g.name,connector:h},`${c}-${m}`))}}else if(P0.includes(c)){let u=t.find(h=>h.connectorType==="injected"&&h.walletClientType===c||h.connectorType===c);u&&a.push(di(fn,{connectOnly:r,provider:c,connector:u},c))}else if(T0.includes(c)){let u=t.find(h=>c==="uniswap"?h.walletClientType==="uniswap_wallet_extension":c==="cryptocom"?h.walletClientType==="crypto.com_wallet_extension":h.connectorType==="injected"&&h.walletClientType===c);n&&!u&&(u=l),u&&a.push(di(fn,{connectOnly:r,provider:c,connector:u},c))}else if(E0.includes(c)){let u=t.find(({connectorType:h})=>h===c);u&&a.push(di(fn,{connectOnly:r,provider:c,connector:u},c))}else S0.includes(c)?l&&s.push(di(fn,{connectOnly:r,provider:c,connector:l},c)):c==="wallet_connect"&&l&&s.push(di(fn,{connectOnly:r,provider:c,connector:l},c));return[...i,...a,...s]};import{Fragment as x0,jsx as pa,jsxs as k0}from"react/jsx-runtime";var Kf=()=>{let{app:e}=x(),{linkingOrConnectingHint:t}=k(),r=t?`Connect the wallet with address ${pr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return k0(x0,{children:[pa(P,{},"header"),pa(jr,{title:"Connect your wallet",description:r}),pa(Pr,{children:pa(ui,{connectOnly:!0})}),pa($,{})]})};import W0 from"styled-components";import R0 from"react";import{jsx as I0}from"react/jsx-runtime";var jf=()=>{let{app:e}=x(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?I0("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?R0.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as Yf}from"react/jsx-runtime";var mi=e=>{let{app:t}=x();return t?.appearance.logo?Yf(M0,{...e,children:Yf(jf,{})}):null},M0=W0.div`
933
- display: flex;
934
- flex-direction: column;
935
- align-items: center;
936
- padding: 24px 0;
937
- flex-grow: 1;
938
- justify-content: center;
939
- `;import{Fragment as O0,jsx as hn,jsxs as L0}from"react/jsx-runtime";var Zf=()=>{let{app:e}=x(),{linkingOrConnectingHint:t}=k(),r=t?`Connect the wallet with address ${pr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return L0(O0,{children:[hn(P,{},"header"),hn(mi,{}),hn(un,{title:"Connect your wallet",description:r}),hn(Pr,{children:hn(ui,{connectOnly:!0})}),e&&hn(ni,{app:e,alwaysShowImplicitConsent:!0}),hn($,{})]})};import{useEffect as rh,useState as oh}from"react";import{isMobile as G0}from"react-device-detect";import q0 from"styled-components";import{useEffect as lp,useState as xo}from"react";import{isMobile as nl}from"react-device-detect";import eh from"styled-components";import{useEffect as Qf,useRef as N0}from"react";var D0=(e,t)=>{let r=N0(()=>{});Qf(()=>{r.current=e}),Qf(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Jf=D0;import{useState as U0,useEffect as F0,useCallback as B0}from"react";function Xf(){let[e,t]=U0(!1),r=B0(()=>{document.hidden&&t(!0)},[]);return F0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as pp,jsx as dt,jsxs as fi}from"react/jsx-runtime";var cp=2,dp=e=>e?.privyErrorCode==="linked_to_another_user"?co.ERROR_USER_EXISTS:e instanceof st&&!e.details.default?e.details:e instanceof Vn?co.ERROR_TIMED_OUT:e instanceof Gn?co.ERROR_USER_REJECTED_CONNECTION:co.ERROR_WALLET_CONNECTION,th=()=>{let[e,t]=xo(!1),[r,o]=xo(!1),[n,a]=xo(void 0),{authenticated:i,logout:s}=H(),{app:l,navigate:c,navigateBack:u,lastScreen:h,currentScreen:m,setModalData:g}=x(),{getAuthFlow:w,walletConnectionStatus:y,closePrivyModal:T,initLoginWithWallet:_,loginWithWallet:b,updateWallets:S,createAnalyticsEvent:I}=k(),{walletConnectors:N}=H(),[W,R]=xo(0),{user:B}=H(),[q]=xo(B?.linkedAccounts.length||0),[Y,M]=xo(""),[z,L]=xo(""),[Ue,Ye]=xo(!1),{hasTabbedAway:Oe}=Xf(),{enabled:de,token:J}=ye(),Ee=nl&&y?.connector?.connectorType==="wallet_connect_v2"||nl&&y?.connector?.connectorType==="coinbase_wallet"||nl&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",_e=y?.status==="connected",vt=y?.status==="switching_to_supported_chain";lp(()=>{let G=w(),le=G instanceof lo?G:void 0;if(_e&&!le&&(de&&!J&&!i?(g({captchaModalData:{callback:at=>_(y.connectedWallet,at).then(()=>{Ye(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):_(y.connectedWallet,J).then(()=>{Ye(!0)})),le&&Ee&&_e&&!le.preparedMessage){le.buildSiweMessage();return}!le||Ee||!_e||r||(async()=>{o(!0),a(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Pc(2500),await Ot()}catch(at){console.warn("Auto-prompted signature failed",at)}finally{o(!1)}})()},[W,_e,Ue]),lp(()=>{if(B&&e){let le=Le-500;if(l?.legal.requireUsersAcceptTerms&&!B.hasAcceptedTerms){let $o=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},le);return()=>clearTimeout($o)}if(Ut(B,l?.embeddedWallets?.createOnLogin)){let $o=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Wn=>{console.error(Wn),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Wn,screen:"ConnectionStatusScreen"}}),s()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},le);return()=>clearTimeout($o)}S();let at=setTimeout(()=>T({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Le);return()=>clearTimeout(at)}},[B,e]);let sr=G=>{if(G?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(G?.privyErrorCode==="max_accounts_reached"){console.error(new cr(G).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(G?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}a(dp(G))};async function Ot(){try{await b(),t(!0)}catch(G){sr(G)}finally{o(!1)}}lp(()=>{y?.connectError&&sr(y?.connectError)},[y]),Jf(()=>{let G=it==="wallet_connect_v2"&&y?.connector instanceof Er?y.connector.redirectUri:void 0;G&&M(G);let le=it==="wallet_connect_v2"&&y?.connector instanceof Er?y.connector.fallbackUniversalRedirectUri:void 0;le&&L(le)},y?.connector instanceof Er&&!Y?500:null);let it=y?.connector?.connectorType||"injected",se=y?.connector?.walletClientType||"unknown",Dr=fr[se]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Fe=fr[se]?.logo||y?.connector?.walletBranding.icon||(G=>dt($n,{...G})),bo=Dr==="Browser Extension"?Dr.toLowerCase():Dr,O;e?O=`Successfully connected with ${bo}`:n?O=n.message:vt?O="Switching networks":_e?O=r&&Ee?"Signing":"Sign to verify":O=`Waiting for ${bo}`;let yt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let G=B?.linkedAccounts.length||0;q===G?yt="Wallet was already linked.":yt="You\u2019re good to go!"}else W>=cp&&n?yt="Unable to connect wallet":n?yt=n.detail:vt?yt="Switch your wallet to the requested network.":_e&&Ee?yt="Sign the message in your wallet to verify it belongs to you.":se==="metamask"&&nl?yt="Click continue to open and connect MetaMask.":se==="metamask"?yt="For the best experience, connect only one wallet at a time.":it==="wallet_connect"?yt="Open your mobile wallet app to continue":it==="coinbase_wallet"&&(cs()||(Vc(B)?yt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":yt="Open the Coinbase app on your phone to continue."));let Ur=N?.walletConnectors?.find(G=>G.walletClientType==="coinbase_wallet"),X=se==="coinbase_wallet"&&(Vc(B)||n===co.ERROR_USER_EXISTS);return fi(pp,{children:[dt(P,{backFn:!h||m===h?void 0:u}),fi(H0,{children:[dt(up,{walletLogo:Fe,success:e,fail:!!n}),fi(je,{children:[dt("h3",{children:O}),dt("p",{children:yt}),!_e&&Y&&!Oe?fi("p",{children:["Still here?"," ",dt("a",{href:Y,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),z&&fi(pp,{children:[" ","or"," ",dt("a",{href:z,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),X?dt(U,{onClick:()=>Ur&&Ur?.disconnect(),disabled:e,children:"Use a different wallet"}):n==co.ERROR_USER_EXISTS&&m!==h?dt(U,{onClick:u,children:"Use a different wallet"}):_e&&!e&&Ee?dt(U,{onClick:()=>{o(!0),Ot()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&W<cp?dt(U,{onClick:()=>{R(W+1),a(void 0),_e?(o(!0),Ot()):y?.connectRetry()},disabled:!e&&(!n?.retryable||W>=cp),children:"Retry"}):!e&&!n?dt(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),dt(K,{})]})},H0=eh.div`
932
+ `;import{Fragment as A0,jsx as pi,jsxs as x0}from"react/jsx-runtime";var T0=["coinbase_wallet"],S0=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],P0=[],_0=["phantom"],di=({connectOnly:e})=>{let{connectors:t}=k(),{app:r}=x(),o=la(r.appearance.walletList,t,e,r.appearance.walletList);return x0(A0,{children:[...o]})},la=(e,t,r,o,n)=>{let a=[],i=[],s=[],l=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let u=t.filter(({connectorType:f,walletClientType:m})=>m==="uniswap_wallet_extension"?!o.includes("uniswap"):m==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(m));for(let f of u){let{walletClientType:m,walletBranding:v}=f;(m==="unknown"?i:a).push(pi(hn,{connectOnly:r,provider:m,logo:v.icon,displayName:v.name,connector:f},`${c}-${m}`))}}else if(_0.includes(c)){let u=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);u&&a.push(pi(hn,{connectOnly:r,provider:c,connector:u},c))}else if(S0.includes(c)){let u=t.find(f=>c==="uniswap"?f.walletClientType==="uniswap_wallet_extension":c==="cryptocom"?f.walletClientType==="crypto.com_wallet_extension":f.connectorType==="injected"&&f.walletClientType===c);n&&!u&&(u=l),u&&a.push(pi(hn,{connectOnly:r,provider:c,connector:u},c))}else if(T0.includes(c)){let u=t.find(({connectorType:f})=>f===c);u&&a.push(pi(hn,{connectOnly:r,provider:c,connector:u},c))}else P0.includes(c)?l&&s.push(pi(hn,{connectOnly:r,provider:c,connector:l},c)):c==="wallet_connect"&&l&&s.push(pi(hn,{connectOnly:r,provider:c,connector:l},c));return[...i,...a,...s]};import{Fragment as k0,jsx as ca,jsxs as R0}from"react/jsx-runtime";var $h=()=>{let{app:e}=x(),{linkingOrConnectingHint:t}=k(),r=t?`Connect the wallet with address ${pr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return R0(k0,{children:[ca(P,{},"header"),ca(jr,{title:"Connect your wallet",description:r}),ca(Pr,{children:ca(di,{connectOnly:!0})}),ca($,{})]})};import{Fragment as I0,jsx as ui,jsxs as M0}from"react/jsx-runtime";var Kh=()=>{let{app:e}=x(),{linkingOrConnectingHint:t}=k(),r=t?`Connect the wallet with address ${pr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return M0(I0,{children:[ui(P,{},"header"),ui(un,{title:"Connect your wallet",description:r}),ui(Pr,{children:ui(di,{connectOnly:!0})}),e&&ui(oi,{app:e,alwaysShowImplicitConsent:!0}),ui($,{})]})};import{useEffect as Xh,useState as ef}from"react";import{isMobile as B0}from"react-device-detect";import H0 from"styled-components";import{useEffect as lp,useState as xo}from"react";import{isMobile as ol}from"react-device-detect";import Qh from"styled-components";import{useEffect as jh,useRef as W0}from"react";var O0=(e,t)=>{let r=W0(()=>{});jh(()=>{r.current=e}),jh(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Yh=O0;import{useState as L0,useEffect as N0,useCallback as D0}from"react";function Zh(){let[e,t]=L0(!1),r=D0(()=>{document.hidden&&t(!0)},[]);return N0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as pp,jsx as dt,jsxs as mi}from"react/jsx-runtime";var cp=2,dp=e=>e?.privyErrorCode==="linked_to_another_user"?co.ERROR_USER_EXISTS:e instanceof st&&!e.details.default?e.details:e instanceof Hn?co.ERROR_TIMED_OUT:e instanceof Vn?co.ERROR_USER_REJECTED_CONNECTION:co.ERROR_WALLET_CONNECTION,Jh=()=>{let[e,t]=xo(!1),[r,o]=xo(!1),[n,a]=xo(void 0),{authenticated:i,logout:s}=H(),{app:l,navigate:c,navigateBack:u,lastScreen:f,currentScreen:m,setModalData:v}=x(),{getAuthFlow:w,walletConnectionStatus:y,closePrivyModal:T,initLoginWithWallet:_,loginWithWallet:b,updateWallets:S,createAnalyticsEvent:I}=k(),{walletConnectors:N}=H(),[M,R]=xo(0),{user:B}=H(),[q]=xo(B?.linkedAccounts.length||0),[Y,W]=xo(""),[z,L]=xo(""),[Ue,Ye]=xo(!1),{hasTabbedAway:Oe}=Zh(),{enabled:de,token:X}=ye(),Ee=ol&&y?.connector?.connectorType==="wallet_connect_v2"||ol&&y?.connector?.connectorType==="coinbase_wallet"||ol&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",_e=y?.status==="connected",vt=y?.status==="switching_to_supported_chain";lp(()=>{let G=w(),le=G instanceof lo?G:void 0;if(_e&&!le&&(de&&!X&&!i?(v({captchaModalData:{callback:at=>_(y.connectedWallet,at).then(()=>{Ye(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):_(y.connectedWallet,X).then(()=>{Ye(!0)})),le&&Ee&&_e&&!le.preparedMessage){le.buildSiweMessage();return}!le||Ee||!_e||r||(async()=>{o(!0),a(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await Pc(2500),await Ot()}catch(at){console.warn("Auto-prompted signature failed",at)}finally{o(!1)}})()},[M,_e,Ue]),lp(()=>{if(B&&e){let le=Le-500;if(l?.legal.requireUsersAcceptTerms&&!B.hasAcceptedTerms){let $o=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},le);return()=>clearTimeout($o)}if(Ut(B,l?.embeddedWallets?.createOnLogin)){let $o=setTimeout(()=>{v({createWallet:{onSuccess:()=>{},onFailure:In=>{console.error(In),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:In,screen:"ConnectionStatusScreen"}}),s()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},le);return()=>clearTimeout($o)}S();let at=setTimeout(()=>T({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Le);return()=>clearTimeout(at)}},[B,e]);let sr=G=>{if(G?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(G?.privyErrorCode==="max_accounts_reached"){console.error(new cr(G).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(G?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}a(dp(G))};async function Ot(){try{await b(),t(!0)}catch(G){sr(G)}finally{o(!1)}}lp(()=>{y?.connectError&&sr(y?.connectError)},[y]),Yh(()=>{let G=it==="wallet_connect_v2"&&y?.connector instanceof Er?y.connector.redirectUri:void 0;G&&W(G);let le=it==="wallet_connect_v2"&&y?.connector instanceof Er?y.connector.fallbackUniversalRedirectUri:void 0;le&&L(le)},y?.connector instanceof Er&&!Y?500:null);let it=y?.connector?.connectorType||"injected",se=y?.connector?.walletClientType||"unknown",Dr=hr[se]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Fe=hr[se]?.logo||y?.connector?.walletBranding.icon||(G=>dt(zn,{...G})),bo=Dr==="Browser Extension"?Dr.toLowerCase():Dr,O;e?O=`Successfully connected with ${bo}`:n?O=n.message:vt?O="Switching networks":_e?O=r&&Ee?"Signing":"Sign to verify":O=`Waiting for ${bo}`;let yt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let G=B?.linkedAccounts.length||0;q===G?yt="Wallet was already linked.":yt="You\u2019re good to go!"}else M>=cp&&n?yt="Unable to connect wallet":n?yt=n.detail:vt?yt="Switch your wallet to the requested network.":_e&&Ee?yt="Sign the message in your wallet to verify it belongs to you.":se==="metamask"&&ol?yt="Click continue to open and connect MetaMask.":se==="metamask"?yt="For the best experience, connect only one wallet at a time.":it==="wallet_connect"?yt="Open your mobile wallet app to continue":it==="coinbase_wallet"&&(ls()||(Vc(B)?yt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":yt="Open the Coinbase app on your phone to continue."));let Ur=N?.walletConnectors?.find(G=>G.walletClientType==="coinbase_wallet"),Q=se==="coinbase_wallet"&&(Vc(B)||n===co.ERROR_USER_EXISTS);return mi(pp,{children:[dt(P,{backFn:!f||m===f?void 0:u}),mi(U0,{children:[dt(up,{walletLogo:Fe,success:e,fail:!!n}),mi(je,{children:[dt("h3",{children:O}),dt("p",{children:yt}),!_e&&Y&&!Oe?mi("p",{children:["Still here?"," ",dt("a",{href:Y,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),z&&mi(pp,{children:[" ","or"," ",dt("a",{href:z,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),Q?dt(D,{onClick:()=>Ur&&Ur?.disconnect(),disabled:e,children:"Use a different wallet"}):n==co.ERROR_USER_EXISTS&&m!==f?dt(D,{onClick:u,children:"Use a different wallet"}):_e&&!e&&Ee?dt(D,{onClick:()=>{o(!0),Ot()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&M<cp?dt(D,{onClick:()=>{R(M+1),a(void 0),_e?(o(!0),Ot()):y?.connectRetry()},disabled:!e&&(!n?.retryable||M>=cp),children:"Retry"}):!e&&!n?dt(D,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),dt(K,{})]})},U0=Qh.div`
940
933
  display: flex;
941
934
  flex-direction: column;
942
935
  align-items: center;
943
936
  justify-content: center;
944
937
  gap: 24px;
945
938
  width: 100%;
946
- `,V0=eh.div`
939
+ `,F0=Qh.div`
947
940
  display: flex;
948
941
  flex-direction: column;
949
942
  justify-content: center;
@@ -966,14 +959,14 @@ Resources:
966
959
  left: -19px;
967
960
  top: -19px;
968
961
  }
969
- `,up=e=>{let t=e.walletLogo;return dt(pp,{children:dt(V0,{children:fi("div",{children:[dt(Je,{success:e.success,fail:e.fail}),typeof t=="string"?dt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):dt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as $0,jsx as uo,jsxs as mp}from"react/jsx-runtime";var il=2,nh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=x(),{walletConnectionStatus:o,closePrivyModal:n}=k(),[a,i]=oh(void 0),[s,l]=oh(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";rh(()=>{if(c){let S=setTimeout(n,Le);return()=>clearTimeout(S)}},[c]);let h=S=>{i(dp(S))};rh(()=>{o?.connectError&&h(o?.connectError)},[o]);let m=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",w=fr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",y=fr[g]?.logo||o?.connector?.walletBranding.icon||(S=>uo($n,{...S})),T=w==="Browser Extension"?w.toLowerCase():w,_;c?_=`Successfully connected with ${T}`:a?_=a.message:u?_="Switching networks":_=`Waiting for ${T}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":s>=il&&a?b="Unable to connect wallet":a?b=a.detail:u?b="Switch your wallet to the requested network.":g==="metamask"&&G0?b="Click to continue to open and connect MetaMask.":g==="metamask"?b="For the best experience, connect only one wallet at a time.":m==="wallet_connect_v2"?b="Open your mobile wallet app to continue":m==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),mp($0,{children:[uo(P,{backFn:r===t?void 0:e}),mp(z0,{children:[uo(up,{walletLogo:y,success:c,fail:!!a}),mp(je,{children:[uo("h3",{children:_}),uo("p",{children:b})]}),a==co.ERROR_USER_EXISTS?uo(U,{onClick:e,children:"Use a different wallet"}):!c&&a?.retryable&&s<il?uo(U,{onClick:()=>{l(s+1),i(void 0),o?.connectRetry()},disabled:!c&&(!a?.retryable||s>=il),children:"Retry"}):!c&&a&&s>=il?uo(U,{onClick:e,children:"Use a different wallet"}):null]}),uo(K,{})]})},z0=q0.div`
962
+ `,up=e=>{let t=e.walletLogo;return dt(pp,{children:dt(F0,{children:mi("div",{children:[dt(Je,{success:e.success,fail:e.fail}),typeof t=="string"?dt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):dt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as G0,jsx as uo,jsxs as mp}from"react/jsx-runtime";var nl=2,tf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=x(),{walletConnectionStatus:o,closePrivyModal:n}=k(),[a,i]=ef(void 0),[s,l]=ef(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Xh(()=>{if(c){let S=setTimeout(n,Le);return()=>clearTimeout(S)}},[c]);let f=S=>{i(dp(S))};Xh(()=>{o?.connectError&&f(o?.connectError)},[o]);let m=o?.connector?.connectorType||"injected",v=o?.connector?.walletClientType||"unknown",w=hr[v]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",y=hr[v]?.logo||o?.connector?.walletBranding.icon||(S=>uo(zn,{...S})),T=w==="Browser Extension"?w.toLowerCase():w,_;c?_=`Successfully connected with ${T}`:a?_=a.message:u?_="Switching networks":_=`Waiting for ${T}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":s>=nl&&a?b="Unable to connect wallet":a?b=a.detail:u?b="Switch your wallet to the requested network.":v==="metamask"&&B0?b="Click to continue to open and connect MetaMask.":v==="metamask"?b="For the best experience, connect only one wallet at a time.":m==="wallet_connect_v2"?b="Open your mobile wallet app to continue":m==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),mp(G0,{children:[uo(P,{backFn:r===t?void 0:e}),mp(V0,{children:[uo(up,{walletLogo:y,success:c,fail:!!a}),mp(je,{children:[uo("h3",{children:_}),uo("p",{children:b})]}),a==co.ERROR_USER_EXISTS?uo(D,{onClick:e,children:"Use a different wallet"}):!c&&a?.retryable&&s<nl?uo(D,{onClick:()=>{l(s+1),i(void 0),o?.connectRetry()},disabled:!c&&(!a?.retryable||s>=nl),children:"Retry"}):!c&&a&&s>=nl?uo(D,{onClick:e,children:"Use a different wallet"}):null]}),uo(K,{})]})},V0=H0.div`
970
963
  display: flex;
971
964
  flex-direction: column;
972
965
  align-items: center;
973
966
  justify-content: center;
974
967
  gap: 24px;
975
968
  width: 100%;
976
- `;import{useEffect as sh,useMemo as K0,useState as j0}from"react";import Y0 from"styled-components";import{jsx as ih}from"react/jsx-runtime";var ah=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?ih("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):ih("span",{})};import{Fragment as Q0,jsx as mo,jsxs as al}from"react/jsx-runtime";var lh=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=x(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=k(),[a,i]=j0({}),s={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},l=Le,c=new C(`There was an issue connecting your ${s.name} account. Please try again.`),u=new De(async w=>{if(!e?.crossAppAuth?.popup){i({error:c});return}try{let y=await r({appId:w,popup:e.crossAppAuth.popup});i({data:y})}catch(y){y instanceof C?i({error:y}):y instanceof Pt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),i({error:c})):i({error:c})}}),h=()=>{a.data&&(o(),e?.crossAppAuth?.onSuccess(a.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(a.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=h,sh(()=>{s.id.length&&u.execute(s.id)},[s.id]),sh(()=>{if(!a.data)return;let w=setTimeout(h,l);return()=>clearTimeout(w)},[a.data]);let{title:m,subtitle:g}=K0(()=>a.data?{title:`Successfully connected with ${s.name}`,subtitle:"You're good to go!"}:a.error?{title:"Authentication failed",subtitle:a.error.message}:{title:`Connecting to ${s.name}`,subtitle:`Please check the pop-up from ${s.name} to continue`},[a,s.name]);return al(Q0,{children:[mo(P,{onClose:h}),mo(ee,{}),al(Z0,{children:[mo(Ke,{children:al("div",{children:[mo(Je,{success:!!a.data,fail:!!a.error}),mo(ah,{name:s.name,logoUrl:s.logoUrl})]})}),al(je,{children:[mo("h3",{children:m}),mo("p",{children:g})]})]}),mo(te,{}),mo(K,{})]})},Z0=Y0.div`
969
+ `;import{useEffect as nf,useMemo as q0,useState as z0}from"react";import $0 from"styled-components";import{jsx as rf}from"react/jsx-runtime";var of=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?rf("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):rf("span",{})};import{Fragment as j0,jsx as mo,jsxs as il}from"react/jsx-runtime";var af=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=x(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=k(),[a,i]=z0({}),s={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},l=Le,c=new C(`There was an issue connecting your ${s.name} account. Please try again.`),u=new De(async w=>{if(!e?.crossAppAuth?.popup){i({error:c});return}try{let y=await r({appId:w,popup:e.crossAppAuth.popup});i({data:y})}catch(y){y instanceof C?i({error:y}):y instanceof Pt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),i({error:c})):i({error:c})}}),f=()=>{a.data&&(o(),e?.crossAppAuth?.onSuccess(a.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(a.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,nf(()=>{s.id.length&&u.execute(s.id)},[s.id]),nf(()=>{if(!a.data)return;let w=setTimeout(f,l);return()=>clearTimeout(w)},[a.data]);let{title:m,subtitle:v}=q0(()=>a.data?{title:`Successfully connected with ${s.name}`,subtitle:"You're good to go!"}:a.error?{title:"Authentication failed",subtitle:a.error.message}:{title:`Connecting to ${s.name}`,subtitle:`Please check the pop-up from ${s.name} to continue`},[a,s.name]);return il(j0,{children:[mo(P,{onClose:f}),mo(ee,{}),il(K0,{children:[mo(Ke,{children:il("div",{children:[mo(Je,{success:!!a.data,fail:!!a.error}),mo(of,{name:s.name,logoUrl:s.logoUrl})]})}),il(je,{children:[mo("h3",{children:m}),mo("p",{children:v})]})]}),mo(te,{}),mo(K,{})]})},K0=$0.div`
977
970
  display: flex;
978
971
  flex-direction: column;
979
972
  align-items: center;
@@ -981,7 +974,7 @@ Resources:
981
974
  margin-left: 27px;
982
975
  margin-right: 27px;
983
976
  gap: 24px;
984
- `;import nC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as iC,useMemo as aC,useState as sC}from"react";import lC from"styled-components";import sl from"styled-components";import{jsx as fp,jsxs as rC}from"react/jsx-runtime";var hi=()=>fp(J0,{children:rC(X0,{children:[fp(eC,{}),fp(tC,{})]})}),J0=sl.div`
977
+ `;import tC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as rC,useMemo as oC,useState as nC}from"react";import iC from"styled-components";import al from"styled-components";import{jsx as hp,jsxs as X0}from"react/jsx-runtime";var hi=()=>hp(Y0,{children:X0(Z0,{children:[hp(Q0,{}),hp(J0,{})]})}),Y0=al.div`
985
978
  display: flex;
986
979
  justify-content: center;
987
980
  align-items: center;
@@ -993,14 +986,14 @@ Resources:
993
986
  @media all and (display-mode: standalone) {
994
987
  margin-bottom: 30px;
995
988
  }
996
- `,X0=sl.div`
989
+ `,Z0=al.div`
997
990
  position: relative;
998
991
  height: 140px;
999
992
  width: 140px;
1000
993
 
1001
994
  opacity: 1;
1002
995
  animation: fadein 200ms ease;
1003
- `,eC=sl.div`
996
+ `,Q0=al.div`
1004
997
  position: absolute;
1005
998
  top: 0;
1006
999
  right: 0;
@@ -1013,7 +1006,7 @@ Resources:
1013
1006
  border: 4px solid var(--privy-color-accent-light);
1014
1007
  border-radius: 50%;
1015
1008
  }
1016
- `,tC=sl.div`
1009
+ `,J0=al.div`
1017
1010
  position: absolute;
1018
1011
  top: 0;
1019
1012
  right: 0;
@@ -1037,20 +1030,20 @@ Resources:
1037
1030
  transform: rotate(360deg);
1038
1031
  }
1039
1032
  }
1040
- `;var ch=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ke=class extends Error{constructor(r,o){super(o);this.type=r}};function yi(e){let t=e.type;return typeof t=="string"&&ch.includes(t)}function oC(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function yn(e){return yi(e)&&e.type==="wallet_not_on_device"}function ph(e){return yi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function gn(e){return!!(yi(e)&&e.type==="mfa_timeout")}function vn(e){return!!(yi(e)&&e.type==="missing_or_invalid_mfa")}function hp(e){return!!(yi(e)&&e.type==="mfa_verification_max_attempts_reached")}function ll(e){return!!(yi(e)&&e.message.includes("code 429"))}function cl(e){return!!(oC(e)&&e.message==="MFA canceled")}function yp({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function pl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?yp({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function dl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function gp({api:e,provider:t}){let r=en(),o=Fn(),n=await Bn(r);try{return t==="icloud"?{url:(await e.post(Qd,{client_type:"web"})).url}:{url:(await e.post(Zd,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(a){throw ne(a)}}async function dh({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during OAuth flow");try{return(await e.post(Jd,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(a){let i=ne(a);throw i.privyErrorCode?new C(i.message||"Invalid code during OAuth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as mh,jsx as gi,jsxs as vp}from"react/jsx-runtime";var uh=1,fh=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=k(),{navigate:i,data:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=aC(()=>Date.now(),[]),[h,m]=sC(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:y,address:T}=s?.connectWallet,_=S=>{h||(m(!0),w(typeof S=="string"?new Error(S):S))};iC(()=>{let S=T?t?.linkedAccounts.find(W=>W.type==="wallet"&&W.walletClientType==="privy"&&W.address===T):we(t),I;return!e||!S?_("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let W=await r();if(!W)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:W,address:S.address}),y&&await a.verifyMfa({accessToken:W});let R=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<uh?I=setTimeout(()=>{i(g)},(uh-R)*1e3):i(g)}catch(R){if(yn(R)&&S.recoveryMethod==="privy"){let B=await r();if(!B)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:S.address}}),(await a?.recover({address:S.address,accessToken:B,recoveryMethod:S.recoveryMethod}))?.address||_(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}}),i(g)}catch{_("An error has occurred, please try again.")}}else if(yn(R)&&S.recoveryMethod!=="privy"){l({...s,recoverWallet:{privyWallet:S,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:S.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let B=dl(S.recoveryMethod);i(B)}else _(R)}})(),()=>clearTimeout(I)):void 0},[e,t,a]);let b=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=b,vp(mh,{children:[gi(P,{onClose:b}),h?vp(mh,{children:[vp(Ar,{children:[gi(nC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),gi(xe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),gi(U,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):gi(hi,{}),gi(cC,{})]})},cC=lC.div`
1033
+ `;var sf=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ke=class extends Error{constructor(r,o){super(o);this.type=r}};function fi(e){let t=e.type;return typeof t=="string"&&sf.includes(t)}function eC(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function fn(e){return fi(e)&&e.type==="wallet_not_on_device"}function lf(e){return fi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function yn(e){return!!(fi(e)&&e.type==="mfa_timeout")}function gn(e){return!!(fi(e)&&e.type==="missing_or_invalid_mfa")}function fp(e){return!!(fi(e)&&e.type==="mfa_verification_max_attempts_reached")}function sl(e){return!!(fi(e)&&e.message.includes("code 429"))}function ll(e){return!!(eC(e)&&e.message==="MFA canceled")}function yp({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function cl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?yp({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function pl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function gp({api:e,provider:t}){let r=en(),o=Un(),n=await Fn(r);try{return t==="icloud"?{url:(await e.post(Qd,{client_type:"web"})).url}:{url:(await e.post(Zd,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(a){throw ne(a)}}async function cf({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during OAuth flow");try{return(await e.post(Jd,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(a){let i=ne(a);throw i.privyErrorCode?new C(i.message||"Invalid code during OAuth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as df,jsx as yi,jsxs as vp}from"react/jsx-runtime";var pf=1,uf=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=k(),{navigate:i,data:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=oC(()=>Date.now(),[]),[f,m]=nC(!1),{onCompleteNavigateTo:v,onFailure:w,shouldForceMFA:y,address:T}=s?.connectWallet,_=S=>{f||(m(!0),w(typeof S=="string"?new Error(S):S))};rC(()=>{let S=T?t?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"&&M.address===T):we(t),I;return!e||!S?_("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:S.address}),y&&await a.verifyMfa({accessToken:M});let R=(Date.now()-u)/1e3;v==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<pf?I=setTimeout(()=>{i(v)},(pf-R)*1e3):i(v)}catch(R){if(fn(R)&&S.recoveryMethod==="privy"){let B=await r();if(!B)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:S.address}}),(await a?.recover({address:S.address,accessToken:B,recoveryMethod:S.recoveryMethod}))?.address||_(new Error("Unable to recover wallet")),v?i(v):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}}),i(v)}catch{_("An error has occurred, please try again.")}}else if(fn(R)&&S.recoveryMethod!=="privy"){l({...s,recoverWallet:{privyWallet:S,onCompleteNavigateTo:v,onFailure:w},recoveryOAuthStatus:{provider:S.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let B=pl(S.recoveryMethod);i(B)}else _(R)}})(),()=>clearTimeout(I)):void 0},[e,t,a]);let b=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=b,vp(df,{children:[yi(P,{onClose:b}),f?vp(df,{children:[vp(Ar,{children:[yi(tC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),yi(xe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),yi(D,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):yi(hi,{}),yi(aC,{})]})},aC=iC.div`
1041
1034
  height: 44px;
1042
- `;import pC from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as dC}from"react";import{Fragment as uC,jsx as vi,jsxs as hh}from"react/jsx-runtime";var yh=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=k(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=x(),{onSuccess:s,onFailure:l,callAuthOnSuccessOnClose:c}=a.createWallet,u=()=>{let h=we(e);h?(o(),s(h)):l(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return dC(()=>{let h=setTimeout(u,Iu);return()=>clearTimeout(h)},[]),i.current=u,hh(uC,{children:[vi(P,{onClose:u}),vi(ee,{}),hh(Ar,{children:[vi(pC,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),vi(xe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),vi(te,{}),vi($,{})]})};import mC from"@heroicons/react/20/solid/ExclamationTriangleIcon";import fC from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Ch,useRef as hC,useState as Cp}from"react";import ko from"styled-components";import{Fragment as SC,jsx as ot,jsxs as Ir}from"react/jsx-runtime";var wh=()=>{let[e,t]=Cp(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:s}=k(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=we(o)?.address,{onFailure:h,onSuccess:m,origin:g,appId:w,appClientId:y}=l.keyExport,T=b=>{a({shouldCallAuthOnSuccess:!1}),h(typeof b=="string"?new Error(b):b)},_=()=>{a({shouldCallAuthOnSuccess:!1}),m(),i({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return Ch(()=>{let b=we(o);if(!r||!b)return T("User must be authenticated before exporting their wallet");n().then(t,T)},[r,o]),c.current=_,Ir(SC,{children:[ot(P,{onClose:_}),Ir(vC,{children:[Ir(xe,{icon:ot(fC,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Ir(EC,{children:[ot(gC,{style:{marginRight:6}}),pr(u)]}),ot("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Ir(CC,{children:[Ir(gh,{children:[ot(vh,{children:"1"}),Ir("span",{children:[ot("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Ir(gh,{children:[ot(vh,{children:"2"}),ot("span",{children:"Copy this key into your other wallet"})]})]}),ot("div",{style:{width:"100%"},children:e&&ot(yC,{origin:g,appId:w,appClientId:y,accessToken:e,clientAnalyticsId:s,address:u,dimensions:{height:"44px"}})}),Ir(TC,{children:[Ir("div",{children:[ot(mC,{viewBox:"0 0 20 18"}),ot("h4",{children:"Warning"})]}),ot("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ot($,{})]})};function yC(e){let[t,r]=Cp(e.dimensions.width),[o,n]=Cp(void 0),a=hC(null);return Ch(()=>{if(a.current&&t===void 0){let{width:s}=a.current.getBoundingClientRect();r(s)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),ot("div",{ref:a,children:t&&Ir(wC,{children:[ot("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ds(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o},{token:e.accessToken})}),ot(bC,{children:"Loading..."})]})})}function gC(e){return ot("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ot("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var vC=ko.div`
1035
+ `;import sC from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as lC}from"react";import{Fragment as cC,jsx as gi,jsxs as mf}from"react/jsx-runtime";var hf=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=k(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=x(),{onSuccess:s,onFailure:l,callAuthOnSuccessOnClose:c}=a.createWallet,u=()=>{let f=we(e);f?(o(),s(f)):l(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return lC(()=>{let f=setTimeout(u,Iu);return()=>clearTimeout(f)},[]),i.current=u,mf(cC,{children:[gi(P,{onClose:u}),gi(ee,{}),mf(Ar,{children:[gi(sC,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),gi(xe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),gi(te,{}),gi($,{})]})};import pC from"@heroicons/react/20/solid/ExclamationTriangleIcon";import dC from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as gf,useRef as uC,useState as Cp}from"react";import ko from"styled-components";import{Fragment as bC,jsx as ot,jsxs as Ir}from"react/jsx-runtime";var vf=()=>{let[e,t]=Cp(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:s}=k(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),u=we(o)?.address,{onFailure:f,onSuccess:m,origin:v,appId:w,appClientId:y}=l.keyExport,T=b=>{a({shouldCallAuthOnSuccess:!1}),f(typeof b=="string"?new Error(b):b)},_=()=>{a({shouldCallAuthOnSuccess:!1}),m(),i({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return gf(()=>{let b=we(o);if(!r||!b)return T("User must be authenticated before exporting their wallet");n().then(t,T)},[r,o]),c.current=_,Ir(bC,{children:[ot(P,{onClose:_}),Ir(fC,{children:[Ir(xe,{icon:ot(dC,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Ir(CC,{children:[ot(hC,{style:{marginRight:6}}),pr(u)]}),ot("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Ir(yC,{children:[Ir(ff,{children:[ot(yf,{children:"1"}),Ir("span",{children:[ot("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Ir(ff,{children:[ot(yf,{children:"2"}),ot("span",{children:"Copy this key into your other wallet"})]})]}),ot("div",{style:{width:"100%"},children:e&&ot(mC,{origin:v,appId:w,appClientId:y,accessToken:e,clientAnalyticsId:s,address:u,dimensions:{height:"44px"}})}),Ir(wC,{children:[Ir("div",{children:[ot(pC,{viewBox:"0 0 20 18"}),ot("h4",{children:"Warning"})]}),ot("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ot($,{})]})};function mC(e){let[t,r]=Cp(e.dimensions.width),[o,n]=Cp(void 0),a=uC(null);return gf(()=>{if(a.current&&t===void 0){let{width:s}=a.current.getBoundingClientRect();r(s)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),ot("div",{ref:a,children:t&&Ir(gC,{children:[ot("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ps(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o},{token:e.accessToken})}),ot(vC,{children:"Loading..."})]})})}function hC(e){return ot("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ot("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var fC=ko.div`
1043
1036
  display: flex;
1044
1037
  flex-direction: column;
1045
1038
  text-align: left;
1046
- `,CC=ko.div`
1039
+ `,yC=ko.div`
1047
1040
  display: flex;
1048
1041
  flex-direction: column;
1049
1042
  gap: 24px;
1050
1043
  padding-bottom: 16px;
1051
1044
  margin-left: 11px;
1052
1045
  border-left: 1px solid var(--privy-color-foreground-4) !important;
1053
- `,gh=ko.div`
1046
+ `,ff=ko.div`
1054
1047
  display: flex;
1055
1048
  align-items: top;
1056
1049
  gap: 8px;
@@ -1059,7 +1052,7 @@ Resources:
1059
1052
  color: var(--privy-color-accent);
1060
1053
  text-decoration: underline;
1061
1054
  }
1062
- `,vh=ko.div`
1055
+ `,yf=ko.div`
1063
1056
  display: flex;
1064
1057
  align-items: center;
1065
1058
  justify-content: center;
@@ -1073,11 +1066,11 @@ Resources:
1073
1066
  border-radius: 100%;
1074
1067
  background: var(--privy-color-background);
1075
1068
  color: var(--privy-color-accent);
1076
- `,wC=ko.div`
1069
+ `,gC=ko.div`
1077
1070
  overflow: visible;
1078
1071
  position: relative;
1079
1072
  height: 44px;
1080
- `,bC=ko.div`
1073
+ `,vC=ko.div`
1081
1074
  position: absolute;
1082
1075
  display: flex;
1083
1076
  align-items: center;
@@ -1089,7 +1082,7 @@ Resources:
1089
1082
  border-radius: var(--privy-border-radius-md);
1090
1083
  background-color: var(--privy-color-background-2);
1091
1084
  color: var(--privy-color-foreground-3);
1092
- `,EC=ko.div`
1085
+ `,CC=ko.div`
1093
1086
  display: flex;
1094
1087
  align-items: center;
1095
1088
  padding-top: 1px;
@@ -1102,7 +1095,7 @@ Resources:
1102
1095
  font-size: 12px;
1103
1096
  font-weight: 500;
1104
1097
  margin: auto;
1105
- `,TC=ko.div`
1098
+ `,wC=ko.div`
1106
1099
  border: 1px solid var(--privy-color-background-2) !important;
1107
1100
  border-radius: var(--privy-border-radius-md);
1108
1101
  padding: 16px;
@@ -1124,9 +1117,9 @@ Resources:
1124
1117
  color: var(--privy-color-error);
1125
1118
  }
1126
1119
  }
1127
- `;import AC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as xC,useState as bh}from"react";import kC from"styled-components";import{useCallback as PC,useRef as _C}from"react";function ul(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=k(),o=_C(!1);return{createWallet:PC(async a=>{let i=await he();if(!i)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let s=await r(Un);if(!s)throw new Error("walletProxy does not exist.");let l=1e4,c=new Promise((g,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},l)});if(!await Promise.race([s.create({accessToken:i,recoveryPassword:a}),c]))throw new Error("walletProxy.create did not send a response.");let h=await e();if(!h)throw new Error("Failed to refresh user.");let m=we(h);if(!m)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:m.address}}),o.current=!0,m}catch(s){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:s.toString()}}),console.warn(s),s}},[])}}import{Fragment as IC,jsx as Ci,jsxs as Eh}from"react/jsx-runtime";var Th=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),[a,i]=bh(""),{embeddedWallets:s}=lt(),{authenticated:l}=H(),{closePrivyModal:c}=k(),{onSuccess:u,onFailure:h,callAuthOnSuccessOnClose:m}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=ul(),[y,T]=bh(null),_=new De(async()=>{try{let S=await w();if(!S)return;T(S),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(S){i(S.message)}});xC(()=>{if(!l){r("LANDING"),h(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let S=pl({walletAction:"create",availableRecoveryMethods:s.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(S)}_.execute()},[g,l]);let b=()=>{y?(u(y),c({shouldCallAuthOnSuccess:m})):(h(new _t("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,a?Eh(IC,{children:[Ci(P,{closeable:!1}),Eh(Ar,{children:[Ci(AC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ci(xe,{title:"Something went wrong",description:a})]}),Ci(U,{onClick:b,children:"Close"}),Ci(RC,{})]}):Ci(hi,{})},RC=kC.div`
1120
+ `;import SC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as PC,useState as Cf}from"react";import _C from"styled-components";import{useCallback as EC,useRef as TC}from"react";function dl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=k(),o=TC(!1);return{createWallet:EC(async a=>{let i=await fe();if(!i)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let s=await r(Dn);if(!s)throw new Error("walletProxy does not exist.");let l=1e4,c=new Promise((v,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},l)});if(!await Promise.race([s.create({accessToken:i,recoveryPassword:a}),c]))throw new Error("walletProxy.create did not send a response.");let f=await e();if(!f)throw new Error("Failed to refresh user.");let m=we(f);if(!m)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:m.address}}),o.current=!0,m}catch(s){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:s.toString()}}),console.warn(s),s}},[])}}import{Fragment as xC,jsx as vi,jsxs as wf}from"react/jsx-runtime";var bf=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),[a,i]=Cf(""),{embeddedWallets:s}=lt(),{authenticated:l}=H(),{closePrivyModal:c}=k(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:m}=o.createWallet,v=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=dl(),[y,T]=Cf(null),_=new De(async()=>{try{let S=await w();if(!S)return;T(S),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(S){i(S.message)}});PC(()=>{if(!l){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(v){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let S=cl({walletAction:"create",availableRecoveryMethods:s.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(S)}_.execute()},[v,l]);let b=()=>{y?(u(y),c({shouldCallAuthOnSuccess:m})):(f(new _t("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,a?wf(xC,{children:[vi(P,{closeable:!1}),wf(Ar,{children:[vi(SC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),vi(xe,{title:"Something went wrong",description:a})]}),vi(D,{onClick:b,children:"Close"}),vi(AC,{})]}):vi(hi,{})},AC=_C.div`
1128
1121
  height: 44px;
1129
- `;import{useEffect as Sw,useState as gl}from"react";import{useCallback as _p,useEffect as Tw}from"react";import NC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as DC,useState as Ep}from"react";import WC from"@heroicons/react/24/outline/ArrowPathIcon";import MC from"@heroicons/react/24/outline/EyeIcon";import OC from"@heroicons/react/24/outline/EyeSlashIcon";import wt,{css as wp}from"styled-components";var LC=wp`
1122
+ `;import{useEffect as bw,useState as yl}from"react";import{useCallback as _p,useEffect as ww}from"react";import WC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as OC,useState as Ep}from"react";import kC from"@heroicons/react/24/outline/ArrowPathIcon";import RC from"@heroicons/react/24/outline/EyeIcon";import IC from"@heroicons/react/24/outline/EyeSlashIcon";import wt,{css as wp}from"styled-components";var MC=wp`
1130
1123
  font-size: 14px;
1131
1124
  font-style: normal;
1132
1125
  font-weight: 400;
@@ -1134,8 +1127,8 @@ Resources:
1134
1127
  letter-spacing: -0.008px;
1135
1128
  text-align: left;
1136
1129
  transition: color 0.1s ease-in;
1137
- `,ml=wt.span`
1138
- ${LC}
1130
+ `,ul=wt.span`
1131
+ ${MC}
1139
1132
  transition: color 0.1s ease-in;
1140
1133
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1141
1134
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1148,13 +1141,13 @@ Resources:
1148
1141
  flex-direction: column;
1149
1142
  justify-content: center;
1150
1143
  flex-grow: 1;
1151
- `,Io=wt(U)`
1144
+ `,Io=wt(D)`
1152
1145
  ${e=>e.hideAnimations&&wp`
1153
1146
  && {
1154
1147
  transition: none;
1155
1148
  }
1156
1149
  `}
1157
- `,Sh=wp`
1150
+ `,Ef=wp`
1158
1151
  && {
1159
1152
  width: 100%;
1160
1153
  border-width: 1px;
@@ -1169,8 +1162,8 @@ Resources:
1169
1162
  font-weight: 300;
1170
1163
  line-height: 22px; /* 137.5% */
1171
1164
  }
1172
- `,wi=wt.input`
1173
- ${Sh}
1165
+ `,Ci=wt.input`
1166
+ ${Ef}
1174
1167
 
1175
1168
  &::placeholder {
1176
1169
  color: var(--privy-color-foreground-3);
@@ -1181,15 +1174,15 @@ Resources:
1181
1174
  overflow: hidden;
1182
1175
  text-overflow: ellipsis;
1183
1176
  white-space: nowrap;
1184
- `,Ph=wt.div`
1185
- ${Sh}
1186
- `,Wo=wt.div`
1177
+ `,Tf=wt.div`
1178
+ ${Ef}
1179
+ `,Mo=wt.div`
1187
1180
  position: relative;
1188
1181
  width: 100%;
1189
1182
  display: flex;
1190
1183
  align-items: center;
1191
1184
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1192
- `,Mo=wt.div`
1185
+ `,Wo=wt.div`
1193
1186
  display: flex;
1194
1187
  flex-direction: column;
1195
1188
  align-items: center;
@@ -1211,12 +1204,12 @@ Resources:
1211
1204
  font-weight: 400;
1212
1205
  line-height: 20px;
1213
1206
  }
1214
- `,da=wt.div`
1207
+ `,pa=wt.div`
1215
1208
  display: flex;
1216
1209
  flex-direction: column;
1217
1210
  gap: 10px;
1218
1211
  padding-bottom: 1rem;
1219
- `,ua=wt.div`
1212
+ `,da=wt.div`
1220
1213
  display: flex;
1221
1214
  text-align: left;
1222
1215
  align-items: center;
@@ -1236,13 +1229,13 @@ Resources:
1236
1229
  > :first-child {
1237
1230
  min-width: 24px;
1238
1231
  }
1239
- `,pL=wt.div`
1232
+ `,nL=wt.div`
1240
1233
  height: var(--privy-height-modal-full);
1241
1234
 
1242
1235
  @media (max-width: 440px) {
1243
1236
  height: var(--privy-height-modal-compact);
1244
1237
  }
1245
- `,bp=wt(ta)`
1238
+ `,bp=wt(ea)`
1246
1239
  display: flex;
1247
1240
  flex: 1;
1248
1241
  gap: 4px;
@@ -1254,7 +1247,7 @@ Resources:
1254
1247
  border-color: var(--privy-color-foreground-3);
1255
1248
  border-width: 1px;
1256
1249
  }
1257
- `,bi=wt.div`
1250
+ `,wi=wt.div`
1258
1251
  position: absolute;
1259
1252
  right: 0.5rem;
1260
1253
 
@@ -1262,7 +1255,7 @@ Resources:
1262
1255
  flex-direction: row;
1263
1256
  justify-content: space-around;
1264
1257
  align-items: center;
1265
- `,_h=wt(WC)`
1258
+ `,Sf=wt(kC)`
1266
1259
  height: 1.25rem;
1267
1260
  width: 1.25rem;
1268
1261
  stroke: var(--privy-color-accent);
@@ -1271,7 +1264,7 @@ Resources:
1271
1264
  :active {
1272
1265
  stroke: var(--privy-color-accent-light);
1273
1266
  }
1274
- `,Ei=wt(OC)`
1267
+ `,bi=wt(IC)`
1275
1268
  height: 1.25rem;
1276
1269
  width: 1.25rem;
1277
1270
  stroke: var(--privy-color-accent);
@@ -1280,7 +1273,7 @@ Resources:
1280
1273
  :active {
1281
1274
  stroke: var(--privy-color-accent-light);
1282
1275
  }
1283
- `,Ti=wt(MC)`
1276
+ `,Ei=wt(RC)`
1284
1277
  height: 1.25rem;
1285
1278
  width: 1.25rem;
1286
1279
  stroke: var(--privy-color-accent);
@@ -1289,7 +1282,7 @@ Resources:
1289
1282
  :active {
1290
1283
  stroke: var(--privy-color-accent-light);
1291
1284
  }
1292
- `,Ah=wt.progress`
1285
+ `,Pf=wt.progress`
1293
1286
  height: 4px;
1294
1287
  width: 100%;
1295
1288
  margin: 8px 0;
@@ -1305,7 +1298,7 @@ Resources:
1305
1298
  transition: all 0.1s ease-out;
1306
1299
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1307
1300
  }
1308
- `;import{Fragment as UC,jsx as tr,jsxs as fl}from"react/jsx-runtime";var xh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=Ep(!0),[s,l]=Ep(!1),[c,u]=Ep(""),h=r===c;return DC(()=>{c&&!s&&l(!0)},[c]),fl(UC,{children:[tr(P,{closeable:!1,backFn:n}),tr(ee,{}),fl(Ro,{children:[fl(Mo,{children:[tr(NC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),tr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),tr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),fl(Wo,{children:[tr(wi,{value:c,onChange:m=>u(m.target.value),onBlur:()=>l(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),tr(bi,{style:{right:"0.75rem"},children:a?tr(Ei,{onClick:()=>i(!1)}):tr(Ti,{onClick:()=>i(!0)})})]}),tr(ml,{"aria-hidden":!s||h,error:!0,children:"Passwords do not match"})]}),tr(Io,{onClick:o,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),tr(te,{}),tr($,{})]})};import VC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as GC}from"react";import qC from"styled-components";import fa from"styled-components";import{jsx as ma,jsxs as HC}from"react/jsx-runtime";var kh=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ma("label",{children:HC(FC,{className:e,children:[ma(Ih,{checked:t,...o}),ma(BC,{color:r,checked:t,children:ma(Rh,{viewBox:"0 0 24 24",children:ma("polyline",{points:"20 6 9 17 4 12"})})})]})});var EL=fa.label`
1301
+ `;import{Fragment as LC,jsx as tr,jsxs as ml}from"react/jsx-runtime";var _f=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=Ep(!0),[s,l]=Ep(!1),[c,u]=Ep(""),f=r===c;return OC(()=>{c&&!s&&l(!0)},[c]),ml(LC,{children:[tr(P,{closeable:!1,backFn:n}),tr(ee,{}),ml(Ro,{children:[ml(Wo,{children:[tr(WC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),tr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),tr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),ml(Mo,{children:[tr(Ci,{value:c,onChange:m=>u(m.target.value),onBlur:()=>l(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),tr(wi,{style:{right:"0.75rem"},children:a?tr(bi,{onClick:()=>i(!1)}):tr(Ei,{onClick:()=>i(!0)})})]}),tr(ul,{"aria-hidden":!s||f,error:!0,children:"Passwords do not match"})]}),tr(Io,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),tr(te,{}),tr($,{})]})};import FC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as BC}from"react";import HC from"styled-components";import ma from"styled-components";import{jsx as ua,jsxs as UC}from"react/jsx-runtime";var Af=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ua("label",{children:UC(NC,{className:e,children:[ua(kf,{checked:t,...o}),ua(DC,{color:r,checked:t,children:ua(xf,{viewBox:"0 0 24 24",children:ua("polyline",{points:"20 6 9 17 4 12"})})})]})});var yL=ma.label`
1309
1302
  && {
1310
1303
  cursor: pointer;
1311
1304
  display: flex;
@@ -1317,14 +1310,14 @@ Resources:
1317
1310
  border: 1px solid var(--privy-color-foreground-4);
1318
1311
  width: 100%;
1319
1312
  }
1320
- `,FC=fa.div`
1313
+ `,NC=ma.div`
1321
1314
  display: inline-block;
1322
1315
  vertical-align: middle;
1323
- `,Rh=fa.svg`
1316
+ `,xf=ma.svg`
1324
1317
  fill: none;
1325
1318
  stroke: white;
1326
1319
  stroke-width: 3px;
1327
- `,Ih=fa.input.attrs({type:"checkbox"})`
1320
+ `,kf=ma.input.attrs({type:"checkbox"})`
1328
1321
  border: 0;
1329
1322
  clip: rect(0 0 0 0);
1330
1323
  clippath: inset(50%);
@@ -1335,7 +1328,7 @@ Resources:
1335
1328
  position: absolute;
1336
1329
  white-space: nowrap;
1337
1330
  width: 1px;
1338
- `,BC=fa.div`
1331
+ `,DC=ma.div`
1339
1332
  display: inline-block;
1340
1333
  width: 18px;
1341
1334
  height: 18px;
@@ -1350,28 +1343,28 @@ Resources:
1350
1343
  border-width: 1px;
1351
1344
  }
1352
1345
 
1353
- ${Ih}:focus + & {
1346
+ ${kf}:focus + & {
1354
1347
  box-shadow: 0 0 0 1px ${e=>e.color};
1355
1348
  }
1356
1349
 
1357
- ${Rh} {
1350
+ ${xf} {
1358
1351
  visibility: ${e=>e.checked?"visible":"hidden"};
1359
1352
  }
1360
- `;import{Fragment as Wh,jsx as hr,jsxs as ha}from"react/jsx-runtime";var Mh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=GC(!1);return ha(Wh,{children:[hr(P,{closeable:!1,backFn:o}),hr(ee,{}),ha(Ro,{children:[ha(Mo,{children:[hr(VC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),hr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),hr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),hr(da,{children:ha(ua,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:s=>{s.preventDefault(),i(l=>!l)},children:[hr(kh,{color:"var(--privy-color-error)",readOnly:!0,checked:a}),hr(Wh,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ha(zC,{children:[n.initiatedBy==="user"&&hr(Sr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),hr(Io,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),hr(te,{}),hr($,{})]})},zC=qC.div`
1353
+ `;import{Fragment as Rf,jsx as fr,jsxs as ha}from"react/jsx-runtime";var If=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=BC(!1);return ha(Rf,{children:[fr(P,{closeable:!1,backFn:o}),fr(ee,{}),ha(Ro,{children:[ha(Wo,{children:[fr(FC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),fr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),fr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),fr(pa,{children:ha(da,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:s=>{s.preventDefault(),i(l=>!l)},children:[fr(Af,{color:"var(--privy-color-error)",readOnly:!0,checked:a}),fr(Rf,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ha(VC,{children:[n.initiatedBy==="user"&&fr(Sr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),fr(Io,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),fr(te,{}),fr($,{})]})},VC=HC.div`
1361
1354
  display: flex;
1362
1355
  gap: 10px;
1363
- `;import sw from"@heroicons/react/24/outline/KeyIcon";import Bh from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Hh,useMemo as Tp,useEffect as lw}from"react";import Vh from"styled-components";import $C from"fast-password-entropy";import*as Oh from"secure-password-utilities";import{DEFAULT_WORDLIST as KC}from"secure-password-utilities/wordlists";var jC=95,YC=8,ZC=3,QC=.3,JC=/[a-z]/,XC=/[A-Z]/,ew=/[0-9]/,tw="a-zA-Z0-9",Lh="!@#$%^&*()\\-_+.",Nh=`${tw}${Lh}`,rw=new RegExp(`[${Lh}]`),ow=new RegExp(`[${Nh}]`),Dh=new RegExp(`^[${Nh}]{6,}$`),Uh=(e="")=>{let t=e.split("").filter(r=>!ow.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},hl=()=>Oh.generatePassphrase(4,KC);function nw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function iw(e){if(e.length<YC)return 0;let t=0;JC.test(e)&&(t+=1),XC.test(e)&&(t+=1),ew.test(e)&&(t+=1),rw.test(e)&&(t+=1);let r=t/ZC;return Math.max(0,Math.min(1,r))}function aw(e=""){let t=iw(e),r=$C(e)/jC;return(t*QC+r)/2}function Fh(e=""){let t=aw(e);return{value:t,label:nw(t)}}import{Fragment as dw,jsx as bt,jsxs as Zr}from"react/jsx-runtime";var Gh=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:a,onClose:i,onBack:s,onPasswordChange:l,onPasswordGenerate:c})=>{let[u,h]=Hh(!1),[m,g]=Hh(!1);lw(()=>{r&&!m&&g(!0)},[r]);let w=Tp(()=>m?(r?.length||0)<6?"Password must be at least 6 characters":Dh.test(r||"")?null:`Invalid characters used ( ${Uh(r).join(" ")} )`:null,[r,m]),y=Tp(()=>w?{value:0,label:"Weak"}:Fh(r),[r,w]),T=Tp(()=>!!(!r?.length||w),[w,r]);return Zr(dw,{children:[bt(P,{onClose:i,closeable:o.initiatedBy==="user",backFn:s}),bt(ee,{}),Zr(Ro,{children:[Zr(Mo,{children:[bt(sw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Zr("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),bt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Zr(Wo,{children:[bt(wi,{value:r,onChange:_=>l(_.target.value),placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),Zr(bi,{style:{width:"3.5rem"},children:[u?bt(Ei,{onClick:()=>h(!1)}):bt(Ti,{onClick:()=>h(!0)}),bt(_h,{onClick:c})]})]}),bt(Ah,{value:y.value===0?.01:y.value,label:y.label}),bt(ml,{error:!!w,children:w||`Password Strength: ${m?y.label:"--"}`}),Zr(pw,{children:[bt(cw,{children:Zr(da,{children:[Zr(ua,{children:[bt(Bh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Zr(ua,{children:[bt(Bh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),bt(Io,{onClick:a,loading:t,disabled:T,hideAnimations:e,children:"Continue"})]})]}),bt(te,{}),bt($,{})]})},cw=Vh(da)`
1356
+ `;import nw from"@heroicons/react/24/outline/KeyIcon";import Uf from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Ff,useMemo as Tp,useEffect as iw}from"react";import Bf from"styled-components";import GC from"fast-password-entropy";import*as Mf from"secure-password-utilities";import{DEFAULT_WORDLIST as qC}from"secure-password-utilities/wordlists";var zC=95,$C=8,KC=3,jC=.3,YC=/[a-z]/,ZC=/[A-Z]/,QC=/[0-9]/,JC="a-zA-Z0-9",Wf="!@#$%^&*()\\-_+.",Of=`${JC}${Wf}`,XC=new RegExp(`[${Wf}]`),ew=new RegExp(`[${Of}]`),Lf=new RegExp(`^[${Of}]{6,}$`),Nf=(e="")=>{let t=e.split("").filter(r=>!ew.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},hl=()=>Mf.generatePassphrase(4,qC);function tw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function rw(e){if(e.length<$C)return 0;let t=0;YC.test(e)&&(t+=1),ZC.test(e)&&(t+=1),QC.test(e)&&(t+=1),XC.test(e)&&(t+=1);let r=t/KC;return Math.max(0,Math.min(1,r))}function ow(e=""){let t=rw(e),r=GC(e)/zC;return(t*jC+r)/2}function Df(e=""){let t=ow(e);return{value:t,label:tw(t)}}import{Fragment as lw,jsx as bt,jsxs as Zr}from"react/jsx-runtime";var Hf=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:a,onClose:i,onBack:s,onPasswordChange:l,onPasswordGenerate:c})=>{let[u,f]=Ff(!1),[m,v]=Ff(!1);iw(()=>{r&&!m&&v(!0)},[r]);let w=Tp(()=>m?(r?.length||0)<6?"Password must be at least 6 characters":Lf.test(r||"")?null:`Invalid characters used ( ${Nf(r).join(" ")} )`:null,[r,m]),y=Tp(()=>w?{value:0,label:"Weak"}:Df(r),[r,w]),T=Tp(()=>!!(!r?.length||w),[w,r]);return Zr(lw,{children:[bt(P,{onClose:i,closeable:o.initiatedBy==="user",backFn:s}),bt(ee,{}),Zr(Ro,{children:[Zr(Wo,{children:[bt(nw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Zr("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),bt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Zr(Mo,{children:[bt(Ci,{value:r,onChange:_=>l(_.target.value),placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),Zr(wi,{style:{width:"3.5rem"},children:[u?bt(bi,{onClick:()=>f(!1)}):bt(Ei,{onClick:()=>f(!0)}),bt(Sf,{onClick:c})]})]}),bt(Pf,{value:y.value===0?.01:y.value,label:y.label}),bt(ul,{error:!!w,children:w||`Password Strength: ${m?y.label:"--"}`}),Zr(sw,{children:[bt(aw,{children:Zr(pa,{children:[Zr(da,{children:[bt(Uf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Zr(da,{children:[bt(Uf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),bt(Io,{onClick:a,loading:t,disabled:T,hideAnimations:e,children:"Continue"})]})]}),bt(te,{}),bt($,{})]})},aw=Bf(pa)`
1364
1357
  flex: 1;
1365
1358
  padding-top: 1rem;
1366
- `,pw=Vh.div`
1359
+ `,sw=Bf.div`
1367
1360
  display: flex;
1368
1361
  flex-direction: column;
1369
1362
  height: 100%;
1370
- `;import uw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import mw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import fw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import hw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as yw,useCallback as qh}from"react";import{Fragment as Sp,jsx as zt,jsxs as Cn}from"react/jsx-runtime";var zh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,s]=yw(!1),l=qh(()=>{s(!0),o&&navigator.clipboard.writeText(o)},[o]),c=qh(()=>{let u=document.createElement("a"),h=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),m=new Blob([gw(r,o)],{type:"text/plain"}),g=URL.createObjectURL(m);u.href=g,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return Cn(Sp,{children:[zt(P,{backFn:a,closeable:!1}),zt(ee,{}),Cn(Ro,{children:[Cn(Mo,{children:[zt(hw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),zt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),zt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),zt(Wo,{centered:!0,children:zt(Ph,{children:o})}),Cn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[zt(bp,{onClick:l,children:i?Cn(Sp,{children:[zt(mw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Cn(Sp,{children:[zt(fw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Cn(bp,{onClick:c,children:[zt(uw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),zt(Io,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),zt(te,{}),zt($,{})]})},gw=(e,t)=>`Your wallet recovery password for ${e} is
1363
+ `;import cw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import pw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import dw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import uw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as mw,useCallback as Vf}from"react";import{Fragment as Sp,jsx as zt,jsxs as vn}from"react/jsx-runtime";var Gf=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,s]=mw(!1),l=Vf(()=>{s(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Vf(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),m=new Blob([hw(r,o)],{type:"text/plain"}),v=URL.createObjectURL(m);u.href=v,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(v)},5e3)},[o]);return vn(Sp,{children:[zt(P,{backFn:a,closeable:!1}),zt(ee,{}),vn(Ro,{children:[vn(Wo,{children:[zt(uw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),zt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),zt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),zt(Mo,{centered:!0,children:zt(Tf,{children:o})}),vn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[zt(bp,{onClick:l,children:i?vn(Sp,{children:[zt(pw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):vn(Sp,{children:[zt(dw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),vn(bp,{onClick:c,children:[zt(cw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),zt(Io,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),zt(te,{}),zt($,{})]})},hw=(e,t)=>`Your wallet recovery password for ${e} is
1371
1364
 
1372
1365
  ${t}
1373
1366
 
1374
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import vw from"@heroicons/react/24/solid/CheckCircleIcon";import Cw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as ww,jsx as fo,jsxs as Pp}from"react/jsx-runtime";var $h=({error:e,onClose:t})=>Pp(ww,{children:[fo(P,{closeable:!1}),fo(ee,{}),e?Pp(Ar,{children:[fo(Cw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),fo(xe,{title:"Something went wrong",description:e})]}):Pp(Ar,{children:[fo(vw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),fo(xe,{title:"Success"})]}),fo(U,{onClick:t,children:"Close"}),fo(te,{}),fo($,{})]});import{useReducer as bw}from"react";var Ew=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Kh=()=>{let[e,t]=bw(Ew,"creating");return{send:t,state:e}};import{jsx as ya}from"react/jsx-runtime";var yl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=x(),{send:n,state:a}=Kh(),i=_p(async()=>{a==="finalizing"&&await e(),n("next")},[a,n,e]);Tw(()=>{let c;return a==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Le)),()=>{c&&clearTimeout(c)}},[a,t.config.initiatedBy,t.onClose]);let s=_p(()=>{n("back")},[n]),l=_p(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return a==="creating"?ya(Gh,{...t,onSubmit:i,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?l:void 0}):a==="saving"?ya(zh,{...t,onSubmit:i,onBack:s}):a==="confirming"?ya(xh,{...t,onSubmit:i,onBack:s}):a==="finalizing"?ya(Mh,{...t,onSubmit:i,onBack:s}):a==="done"?ya($h,{...t,onSubmit:i}):null};import{jsx as Pw}from"react/jsx-runtime";var jh=()=>{let[e,t]=gl(null),[r,o]=gl(!1),[n,a]=gl(null),[i,s]=gl(""),{authenticated:l,getAccessToken:c,user:u}=H(),{walletProxy:h,refreshUser:m,closePrivyModal:g,createAnalyticsEvent:w}=k(),{app:y,navigate:T,data:_,onUserCloseViaDialogOrKeybindRef:b}=x(),{onSuccess:S,onFailure:I}=_.createWallet,N=we(u),W=e?.recoveryMethod==="user-passcode",R=N?.recoveryMethod==="user-passcode";Sw(()=>{l||(T("LANDING"),I(new Xa("User must be authenticated before setting a password on a Privy wallet")))},[l]);let B=()=>{if(n){I(n),g({shouldCallAuthOnSuccess:!1});return}if(!W){I(new _t("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}S(e),g({shouldCallAuthOnSuccess:!1})};b.current=B;let q=async()=>{let M=await c();if(M&&N?.address&&i&&h)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R}}),!(await h.setRecovery({accessToken:M,address:N.address,recoveryPassword:i,recoveryMethod:"user-passcode"})).address){a(new _t("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"error setting password"}});return}let L=await m(),Ue=we(L);if(!Ue){a(new _t("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"wallet disconnected"}});return}t(Ue),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R}})}catch(z){console.warn(z),a(z instanceof Error?z:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:z}})}},Y=async()=>{W?(S(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await q(),o(!1))};return Pw(yl,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:B},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,isResettingPassword:R,onPasswordGenerate:()=>s(hl()),onPasswordChange:s,onSubmit:Y,onClose:B})};import _w from"@heroicons/react/24/outline/UserCircleIcon";import Aw from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as xw,jsx as ho,jsxs as vl}from"react/jsx-runtime";var Yh=()=>{let{closePrivyModal:e}=k(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{onSuccess:a,onFailure:i}=t.setWalletPassword,s=()=>{i(new _t("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=s,vl(xw,{children:[ho(P,{onClose:s}),ho(ee,{}),vl(Ar,{children:[vl(_f,{children:[ho(_w,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),ho(Af,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:ho(Aw,{width:"12px",height:"12px",fill:"white"})})]}),vl(xe,{title:"Secure Your Account",children:["Please set a password to secure your account.",ho("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),ho(U,{onClick:()=>{r({createWallet:{onFailure:i,onSuccess:a,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),ho(te,{}),ho($,{})]})};import kw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Rw from"@heroicons/react/24/outline/PhoneIcon";import Zh from"styled-components";import{Fragment as Ow,jsx as yr,jsxs as Cl}from"react/jsx-runtime";var Iw=e=>{let t=yr(kw,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof C)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ke&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:yr(Rw,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ze)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:yr(rl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:yr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:yr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Pt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Qh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=x();return yr(ga,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},ga=({error:e,backFn:t,onClick:r})=>{let{reset:o}=ye(),n=Iw(e),a=()=>{e instanceof Ze&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return Cl(Ow,{children:[yr(P,{backFn:t}),Cl(Ww,{children:[yr(Ke,{children:Cl("div",{children:[yr(tl,{color:"var(--privy-color-error)"}),n.icon]})}),Cl(Mw,{children:[yr("h3",{children:n.title}),yr("p",{children:n.detail})]}),yr(U,{color:"var(--privy-color-error)",onClick:a,children:n.ctaText})]})]})},Ww=Zh.div`
1367
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import fw from"@heroicons/react/24/solid/CheckCircleIcon";import yw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as gw,jsx as ho,jsxs as Pp}from"react/jsx-runtime";var qf=({error:e,onClose:t})=>Pp(gw,{children:[ho(P,{closeable:!1}),ho(ee,{}),e?Pp(Ar,{children:[ho(yw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ho(xe,{title:"Something went wrong",description:e})]}):Pp(Ar,{children:[ho(fw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ho(xe,{title:"Success"})]}),ho(D,{onClick:t,children:"Close"}),ho(te,{}),ho($,{})]});import{useReducer as vw}from"react";var Cw=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},zf=()=>{let[e,t]=vw(Cw,"creating");return{send:t,state:e}};import{jsx as fa}from"react/jsx-runtime";var fl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=x(),{send:n,state:a}=zf(),i=_p(async()=>{a==="finalizing"&&await e(),n("next")},[a,n,e]);ww(()=>{let c;return a==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Le)),()=>{c&&clearTimeout(c)}},[a,t.config.initiatedBy,t.onClose]);let s=_p(()=>{n("back")},[n]),l=_p(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return a==="creating"?fa(Hf,{...t,onSubmit:i,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?l:void 0}):a==="saving"?fa(Gf,{...t,onSubmit:i,onBack:s}):a==="confirming"?fa(_f,{...t,onSubmit:i,onBack:s}):a==="finalizing"?fa(If,{...t,onSubmit:i,onBack:s}):a==="done"?fa(qf,{...t,onSubmit:i}):null};import{jsx as Ew}from"react/jsx-runtime";var $f=()=>{let[e,t]=yl(null),[r,o]=yl(!1),[n,a]=yl(null),[i,s]=yl(""),{authenticated:l,getAccessToken:c,user:u}=H(),{walletProxy:f,refreshUser:m,closePrivyModal:v,createAnalyticsEvent:w}=k(),{app:y,navigate:T,data:_,onUserCloseViaDialogOrKeybindRef:b}=x(),{onSuccess:S,onFailure:I}=_.createWallet,N=we(u),M=e?.recoveryMethod==="user-passcode",R=N?.recoveryMethod==="user-passcode";bw(()=>{l||(T("LANDING"),I(new Ja("User must be authenticated before setting a password on a Privy wallet")))},[l]);let B=()=>{if(n){I(n),v({shouldCallAuthOnSuccess:!1});return}if(!M){I(new _t("Exited before password was added to wallet")),v({shouldCallAuthOnSuccess:!1});return}S(e),v({shouldCallAuthOnSuccess:!1})};b.current=B;let q=async()=>{let W=await c();if(W&&N?.address&&i&&f)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R}}),!(await f.setRecovery({accessToken:W,address:N.address,recoveryPassword:i,recoveryMethod:"user-passcode"})).address){a(new _t("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"error setting password"}});return}let L=await m(),Ue=we(L);if(!Ue){a(new _t("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R,reason:"wallet disconnected"}});return}t(Ue),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:N.address,recoveryMethod:"user-passcode",isResettingPassword:R}})}catch(z){console.warn(z),a(z instanceof Error?z:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:z}})}},Y=async()=>{M?(S(e),v({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await q(),o(!1))};return Ew(fl,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:B},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,isResettingPassword:R,onPasswordGenerate:()=>s(hl()),onPasswordChange:s,onSubmit:Y,onClose:B})};import Tw from"@heroicons/react/24/outline/UserCircleIcon";import Sw from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as Pw,jsx as fo,jsxs as gl}from"react/jsx-runtime";var Kf=()=>{let{closePrivyModal:e}=k(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{onSuccess:a,onFailure:i}=t.setWalletPassword,s=()=>{i(new _t("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=s,gl(Pw,{children:[fo(P,{onClose:s}),fo(ee,{}),gl(Ar,{children:[gl(Ph,{children:[fo(Tw,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),fo(_h,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:fo(Sw,{width:"12px",height:"12px",fill:"white"})})]}),gl(xe,{title:"Secure Your Account",children:["Please set a password to secure your account.",fo("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),fo(D,{onClick:()=>{r({createWallet:{onFailure:i,onSuccess:a,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),fo(te,{}),fo($,{})]})};import _w from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Aw from"@heroicons/react/24/outline/PhoneIcon";import jf from"styled-components";import{Fragment as Iw,jsx as yr,jsxs as vl}from"react/jsx-runtime";var xw=e=>{let t=yr(_w,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof C)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ke&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:yr(Aw,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ze)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:yr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:yr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:yr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Pt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Yf=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=x();return yr(ya,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},ya=({error:e,backFn:t,onClick:r})=>{let{reset:o}=ye(),n=xw(e),a=()=>{e instanceof Ze&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return vl(Iw,{children:[yr(P,{backFn:t}),vl(kw,{children:[yr(Ke,{children:vl("div",{children:[yr(el,{color:"var(--privy-color-error)"}),n.icon]})}),vl(Rw,{children:[yr("h3",{children:n.title}),yr("p",{children:n.detail})]}),yr(D,{color:"var(--privy-color-error)",onClick:a,children:n.ctaText})]})]})},kw=jf.div`
1375
1368
  display: flex;
1376
1369
  flex-direction: column;
1377
1370
  align-items: center;
@@ -1379,11 +1372,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1379
1372
  gap: 24px;
1380
1373
  width: 100%;
1381
1374
  padding-bottom: 16px;
1382
- `,Mw=Zh.div`
1375
+ `,Rw=jf.div`
1383
1376
  display: flex;
1384
1377
  flex-direction: column;
1385
1378
  gap: 8px;
1386
- `;import{useEffect as ny,useRef as e4,useState as kp}from"react";import{isIOS as t4,isMobile as iy}from"react-device-detect";import ly from"styled-components";import{useState as Lw}from"react";import Nw from"styled-components";import{jsx as Jh}from"react/jsx-runtime";var wl=({style:e,color:t,...r})=>Jh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:Jh("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as Ap}from"react/jsx-runtime";var Xh=({color:e,...t})=>Ap("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:Ap("g",{children:Ap("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as ey,jsxs as Uw}from"react/jsx-runtime";var Oo=e=>{let[t,r]=Lw(!1);return Uw(Dw,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?ey(wl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):ey(Xh,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Dw=Nw.button`
1379
+ `;import{useEffect as ry,useRef as Qw,useState as kp}from"react";import{isIOS as Jw,isMobile as oy}from"react-device-detect";import ay from"styled-components";import{useState as Mw}from"react";import Ww from"styled-components";import{jsx as Zf}from"react/jsx-runtime";var Cl=({style:e,color:t,...r})=>Zf("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:Zf("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as Ap}from"react/jsx-runtime";var Qf=({color:e,...t})=>Ap("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:Ap("g",{children:Ap("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as Jf,jsxs as Lw}from"react/jsx-runtime";var Oo=e=>{let[t,r]=Mw(!1);return Lw(Ow,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Jf(Cl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Jf(Qf,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Ow=Ww.button`
1387
1380
  display: flex;
1388
1381
  align-items: center;
1389
1382
  gap: 6px;
@@ -1421,7 +1414,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1421
1414
  width: 14px;
1422
1415
  height: 14px;
1423
1416
  }
1424
- `;import{useState as Fw}from"react";import Bw from"styled-components";import{jsx as Vw}from"react/jsx-runtime";var bl=e=>{let[t,r]=Fw(!1);return Vw(Hw,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Hw=Bw.a`
1417
+ `;import{useState as Nw}from"react";import Dw from"styled-components";import{jsx as Fw}from"react/jsx-runtime";var wl=e=>{let[t,r]=Nw(!1);return Fw(Uw,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Uw=Dw.a`
1425
1418
  display: flex;
1426
1419
  align-items: center;
1427
1420
  gap: 6px;
@@ -1459,7 +1452,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1459
1452
  width: 14px;
1460
1453
  height: 14px;
1461
1454
  }
1462
- `;import Gw from"qrcode";import qw from"react";import zw from"styled-components";import{jsx as ty}from"react/jsx-runtime";var ry=()=>ty("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:ty("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as va,jsx as Rt,jsxs as oy}from"react/jsx-runtime";var rr=7,xp=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let s=e?.[i];s&&s[a]&&(s[a]=0)}return e},$w=e=>{let t=Gw.create(e,{errorCorrectionLevel:"high"}).modules,r=fu(Array.from(t.data),t.size);return r=xp(r,0,0,rr,rr),r=xp(r,r.length-rr,0,rr,rr),r=xp(r,0,r.length-rr,rr,rr),r},Kw=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Rt(va,{children:[0,1,2].map(a=>Rt("circle",{r:r*(rr-a*2)/2,cx:e+r*rr/2,cy:t+r*rr/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),jw=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-rr)*e,0],[0,(t-rr)*e]];return Rt(va,{children:n.map(([a,i])=>Rt(Kw,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},Yw=({matrix:e,cellSize:t,color:r})=>Rt(va,{children:e.map((a,i)=>a.map((s,l)=>s?Rt("rect",{height:t-.2*2,width:t-.2*2,x:i*t+t*(.2/2),y:l*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${i}-${l}`):Rt(qw.Fragment,{},`circle-${i}-${l}`)))}),Zw=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Rt(va,{});let a=t*(o||.15),i=Math.floor(t/2-a/2),s=Math.floor(t/2+a/2);(s-i)%2!==t%2&&(s+=1);let l=(s-i)*e,c=.1,u=l-l*c*2,h=r,m=i*e;return oy(va,{children:[Rt("rect",{x:i*e,y:i*e,width:l,height:l,fill:n}),Rt(h,{x:m+l*c,y:m+l*c,height:u,width:u})]})},Qw=e=>{let t=e.outputSize,r=$w(e.url),o=t/r.length;return oy("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Rt(Yw,{matrix:r,cellSize:o,color:e.fgColor}),Rt(jw,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Rt(Zw,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},Jw=zw.div`
1455
+ `;import Bw from"qrcode";import Hw from"react";import Vw from"styled-components";import{jsx as Xf}from"react/jsx-runtime";var ey=()=>Xf("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:Xf("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ga,jsx as Rt,jsxs as ty}from"react/jsx-runtime";var rr=7,xp=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let s=e?.[i];s&&s[a]&&(s[a]=0)}return e},Gw=e=>{let t=Bw.create(e,{errorCorrectionLevel:"high"}).modules,r=hu(Array.from(t.data),t.size);return r=xp(r,0,0,rr,rr),r=xp(r,r.length-rr,0,rr,rr),r=xp(r,0,r.length-rr,rr,rr),r},qw=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Rt(ga,{children:[0,1,2].map(a=>Rt("circle",{r:r*(rr-a*2)/2,cx:e+r*rr/2,cy:t+r*rr/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),zw=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-rr)*e,0],[0,(t-rr)*e]];return Rt(ga,{children:n.map(([a,i])=>Rt(qw,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},$w=({matrix:e,cellSize:t,color:r})=>Rt(ga,{children:e.map((a,i)=>a.map((s,l)=>s?Rt("rect",{height:t-.2*2,width:t-.2*2,x:i*t+t*(.2/2),y:l*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${i}-${l}`):Rt(Hw.Fragment,{},`circle-${i}-${l}`)))}),Kw=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Rt(ga,{});let a=t*(o||.15),i=Math.floor(t/2-a/2),s=Math.floor(t/2+a/2);(s-i)%2!==t%2&&(s+=1);let l=(s-i)*e,c=.1,u=l-l*c*2,f=r,m=i*e;return ty(ga,{children:[Rt("rect",{x:i*e,y:i*e,width:l,height:l,fill:n}),Rt(f,{x:m+l*c,y:m+l*c,height:u,width:u})]})},jw=e=>{let t=e.outputSize,r=Gw(e.url),o=t/r.length;return ty("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Rt($w,{matrix:r,cellSize:o,color:e.fgColor}),Rt(zw,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Rt(Kw,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},Yw=Vw.div`
1463
1456
  display: flex;
1464
1457
  justify-content: center;
1465
1458
  align-items: center;
@@ -1474,7 +1467,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1474
1467
  border-color: ${e=>e.borderColor};
1475
1468
  border-radius: var(--privy-border-radius-md);
1476
1469
  }
1477
- `,Si=e=>{let{appearance:t}=lt(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,a=t.palette.colorScheme==="dark"?r:o;return Rt(Jw,{size:n,bgColor:r,fgColor:o,borderColor:a,children:Rt(Qw,{url:e.url,logo:{element:e.squareLogoElement??ry},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as El,jsxs as Xw}from"react/jsx-runtime";var Qr=({style:e,...t})=>Xw("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[El("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),El("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),El("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),El("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as Tl,jsx as be,jsxs as Jr}from"react/jsx-runtime";var ay="#8a63d2",cy=1e3,r4=cy*2,o4=cy*120,py=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:s,app:l}=x(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:m}=k(),[g,w]=kp(void 0),[y,T]=kp(!1),[_,b]=kp(!1),S=e4([]),I=Le,N=c(),W=N?.meta.connectUri;return ny(()=>{let R=Date.now(),B=setInterval(async()=>{let q=await N.pollForReady.execute(),Y=Date.now()-R;if(q){clearInterval(B),T(!0);try{await u(),b(!0)}catch(M){let z={retryable:!1,message:"Authentication failed"};if(M?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(M?.privyErrorCode==="max_accounts_reached"){console.error(new cr(M).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else if(M?.privyErrorCode==="user_does_not_exist"){a("ACCOUNT_NOT_FOUND_SCREEN");return}else M?.privyErrorCode==="linked_to_another_user"?z.detail="This account has already been linked to another user.":M?.privyErrorCode==="invalid_credentials"?(z.retryable=!0,z.detail="Something went wrong. Try again."):M?.privyErrorCode==="too_many_requests"&&(z.detail="Too many requests. Please wait before trying again.");w(z)}}else Y>o4&&(clearInterval(B),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},r4);return()=>{clearInterval(B),S.current.forEach(q=>clearTimeout(q))}},[]),ny(()=>{if(r&&e&&_&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(B)}_&&(Ut(o,l?.embeddedWallets.createOnLogin)?S.current.push(setTimeout(()=>{s({createWallet:{onSuccess:()=>{},onFailure:B=>{console.error(B),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:B,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):S.current.push(setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[_,r,e,o]),iy||y?Jr(Tl,{children:[be(P,{backFn:n?i:void 0,onClose:h},"header"),be(ee,{}),t4?be(Tl,{children:Jr(n4,{children:[be(Ke,{children:Jr("div",{children:[be(Je,{success:_,fail:!!g}),be(Qr,{style:{width:"38px",height:"38px"}})]})}),Jr(je,{children:[be(pe,{children:g?g.message:"Sign in with Farcaster"}),be(ue,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),W&&be(U,{onClick:R=>{R.preventDefault(),window.location.href=W},children:"Open Warpcast app"})]})}):be(Tl,{children:Jr(sy,{children:[be(Ke,{children:Jr("div",{children:[be(Je,{success:_,fail:!!g}),be(Qr,{style:{width:"38px",height:"38px"}})]})}),Jr(je,{children:[be(pe,{children:g?g.message:"Signing in with Farcaster"}),be(ue,{children:g?g.detail:"This should only take a moment"}),be(xt,{children:W&&iy&&be(bl,{text:"Take me to Warpcast",url:W,color:ay})})]})]})}),be(K,{})]}):Jr(Tl,{children:[be(P,{backFn:n?i:void 0,onClose:h},"header"),be(ee,{}),be(sy,{children:Jr("div",{children:[be(pe,{children:"Sign in with Farcaster"}),be(ue,{children:"Scan with your phone's camera to continue."}),be(ii,{children:W?be(Si,{url:W,size:275,squareLogoElement:Qr}):be(ct,{})}),Jr(xt,{children:[be(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),W&&be(Oo,{text:W,itemName:"link",color:ay})]})]})}),be(K,{})]})},sy=ly.div`
1470
+ `,Ti=e=>{let{appearance:t}=lt(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,a=t.palette.colorScheme==="dark"?r:o;return Rt(Yw,{size:n,bgColor:r,fgColor:o,borderColor:a,children:Rt(jw,{url:e.url,logo:{element:e.squareLogoElement??ey},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as bl,jsxs as Zw}from"react/jsx-runtime";var Qr=({style:e,...t})=>Zw("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[bl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),bl("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),bl("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),bl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as El,jsx as be,jsxs as Jr}from"react/jsx-runtime";var ny="#8a63d2",sy=1e3,Xw=sy*2,e4=sy*120,ly=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:s,app:l}=x(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:m}=k(),[v,w]=kp(void 0),[y,T]=kp(!1),[_,b]=kp(!1),S=Qw([]),I=Le,N=c(),M=N?.meta.connectUri;return ry(()=>{let R=Date.now(),B=setInterval(async()=>{let q=await N.pollForReady.execute(),Y=Date.now()-R;if(q){clearInterval(B),T(!0);try{await u(),b(!0)}catch(W){let z={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new cr(W).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else if(W?.privyErrorCode==="user_does_not_exist"){a("ACCOUNT_NOT_FOUND_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?z.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(z.retryable=!0,z.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&(z.detail="Too many requests. Please wait before trying again.");w(z)}}else Y>e4&&(clearInterval(B),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},Xw);return()=>{clearInterval(B),S.current.forEach(q=>clearTimeout(q))}},[]),ry(()=>{if(r&&e&&_&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(B)}_&&(Ut(o,l?.embeddedWallets.createOnLogin)?S.current.push(setTimeout(()=>{s({createWallet:{onSuccess:()=>{},onFailure:B=>{console.error(B),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:B,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):S.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[_,r,e,o]),oy||y?Jr(El,{children:[be(P,{backFn:n?i:void 0,onClose:f},"header"),be(ee,{}),Jw?be(El,{children:Jr(t4,{children:[be(Ke,{children:Jr("div",{children:[be(Je,{success:_,fail:!!v}),be(Qr,{style:{width:"38px",height:"38px"}})]})}),Jr(je,{children:[be(pe,{children:v?v.message:"Sign in with Farcaster"}),be(ue,{children:v?v.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&be(D,{onClick:R=>{R.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):be(El,{children:Jr(iy,{children:[be(Ke,{children:Jr("div",{children:[be(Je,{success:_,fail:!!v}),be(Qr,{style:{width:"38px",height:"38px"}})]})}),Jr(je,{children:[be(pe,{children:v?v.message:"Signing in with Farcaster"}),be(ue,{children:v?v.detail:"This should only take a moment"}),be(xt,{children:M&&oy&&be(wl,{text:"Take me to Warpcast",url:M,color:ny})})]})]})}),be(K,{})]}):Jr(El,{children:[be(P,{backFn:n?i:void 0,onClose:f},"header"),be(ee,{}),be(iy,{children:Jr("div",{children:[be(pe,{children:"Sign in with Farcaster"}),be(ue,{children:"Scan with your phone's camera to continue."}),be(ni,{children:M?be(Ti,{url:M,size:275,squareLogoElement:Qr}):be(ct,{})}),Jr(xt,{children:[be(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&be(Oo,{text:M,itemName:"link",color:ny})]})]})}),be(K,{})]})},iy=ay.div`
1478
1471
  display: flex;
1479
1472
  flex-direction: column;
1480
1473
  align-items: center;
@@ -1482,14 +1475,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1482
1475
  margin-left: 27px;
1483
1476
  margin-right: 27px;
1484
1477
  gap: 24px;
1485
- `,n4=ly.div`
1478
+ `,t4=ay.div`
1486
1479
  display: flex;
1487
1480
  flex-direction: column;
1488
1481
  align-items: center;
1489
1482
  justify-content: center;
1490
1483
  gap: 24px;
1491
1484
  width: 100%;
1492
- `;import{useEffect as i4,useRef as a4,useState as Rp}from"react";import{isIOS as s4,isMobile as dy}from"react-device-detect";import fy from"styled-components";import{Fragment as Sl,jsx as Pe,jsxs as Wr}from"react/jsx-runtime";var uy="#8a63d2",hy=1e3,l4=hy*2,c4=hy*300,yy=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=x(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=k(),[i,s]=Rp(void 0),[l,c]=Rp(!1),[u,h]=Rp(!1),m=a4([]),g=Le,w=r?.farcasterSigner;i4(()=>{let T=Date.now(),_=setInterval(async()=>{if(!w?.public_key){clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(_),c(!1),h(!0),m.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let b=await n(w?.public_key),S=Date.now()-T;b.status==="approved"?(clearInterval(_),c(!1),h(!0),m.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):S>c4?(clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(_),s({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},l4);return()=>{clearInterval(_),m.current.forEach(b=>clearTimeout(b))}},[]);let y=w?.status==="pending_approval"?w.signer_approval_url:void 0;return dy||l?Wr(Sl,{children:[Pe(P,{backFn:e?t:void 0,onClose:a},"header"),Pe(ee,{}),s4?Pe(Sl,{children:Wr(p4,{children:[Pe(Ke,{children:Wr("div",{children:[Pe(Je,{success:u,fail:!!i}),Pe(Qr,{style:{width:"38px",height:"38px"}})]})}),Wr(je,{children:[Pe(pe,{children:i?i.message:"Add a signer to Farcaster"}),Pe(ue,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Pe(U,{onClick:T=>{T.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Pe(Sl,{children:Wr(my,{children:[Pe(Ke,{children:Wr("div",{children:[Pe(Je,{success:u,fail:!!i}),Pe(Qr,{style:{width:"38px",height:"38px"}})]})}),Wr(je,{children:[Pe(pe,{children:i?i.message:"Requesting signer from Farcaster"}),Pe(ue,{children:i?i.detail:"This should only take a moment"}),Pe(xt,{children:y&&dy&&Pe(bl,{text:"Take me to Warpcast",url:y,color:uy})})]})]})}),Pe(K,{})]}):Wr(Sl,{children:[Pe(P,{backFn:e?t:void 0,onClose:a},"header"),Pe(ee,{}),Pe(my,{children:Wr("div",{children:[Pe(pe,{children:"Add a signer to Farcaster"}),Wr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Pe(ii,{children:w?.status==="pending_approval"?Pe(Si,{url:w.signer_approval_url,size:275,squareLogoElement:Qr}):Pe(ct,{})}),Wr(xt,{children:[Pe(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&Pe(Oo,{text:w.signer_approval_url,itemName:"link",color:uy})]})]})}),Pe(K,{})]})},my=fy.div`
1485
+ `;import{useEffect as r4,useRef as o4,useState as Rp}from"react";import{isIOS as n4,isMobile as cy}from"react-device-detect";import uy from"styled-components";import{Fragment as Tl,jsx as Pe,jsxs as Mr}from"react/jsx-runtime";var py="#8a63d2",my=1e3,i4=my*2,a4=my*300,hy=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=x(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=k(),[i,s]=Rp(void 0),[l,c]=Rp(!1),[u,f]=Rp(!1),m=o4([]),v=Le,w=r?.farcasterSigner;r4(()=>{let T=Date.now(),_=setInterval(async()=>{if(!w?.public_key){clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(_),c(!1),f(!0),m.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v)));let b=await n(w?.public_key),S=Date.now()-T;b.status==="approved"?(clearInterval(_),c(!1),f(!0),m.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v))):S>a4?(clearInterval(_),s({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(_),s({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},i4);return()=>{clearInterval(_),m.current.forEach(b=>clearTimeout(b))}},[]);let y=w?.status==="pending_approval"?w.signer_approval_url:void 0;return cy||l?Mr(Tl,{children:[Pe(P,{backFn:e?t:void 0,onClose:a},"header"),Pe(ee,{}),n4?Pe(Tl,{children:Mr(s4,{children:[Pe(Ke,{children:Mr("div",{children:[Pe(Je,{success:u,fail:!!i}),Pe(Qr,{style:{width:"38px",height:"38px"}})]})}),Mr(je,{children:[Pe(pe,{children:i?i.message:"Add a signer to Farcaster"}),Pe(ue,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Pe(D,{onClick:T=>{T.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Pe(Tl,{children:Mr(dy,{children:[Pe(Ke,{children:Mr("div",{children:[Pe(Je,{success:u,fail:!!i}),Pe(Qr,{style:{width:"38px",height:"38px"}})]})}),Mr(je,{children:[Pe(pe,{children:i?i.message:"Requesting signer from Farcaster"}),Pe(ue,{children:i?i.detail:"This should only take a moment"}),Pe(xt,{children:y&&cy&&Pe(wl,{text:"Take me to Warpcast",url:y,color:py})})]})]})}),Pe(K,{})]}):Mr(Tl,{children:[Pe(P,{backFn:e?t:void 0,onClose:a},"header"),Pe(ee,{}),Pe(dy,{children:Mr("div",{children:[Pe(pe,{children:"Add a signer to Farcaster"}),Mr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Pe(ni,{children:w?.status==="pending_approval"?Pe(Ti,{url:w.signer_approval_url,size:275,squareLogoElement:Qr}):Pe(ct,{})}),Mr(xt,{children:[Pe(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&Pe(Oo,{text:w.signer_approval_url,itemName:"link",color:py})]})]})}),Pe(K,{})]})},dy=uy.div`
1493
1486
  display: flex;
1494
1487
  flex-direction: column;
1495
1488
  align-items: center;
@@ -1497,14 +1490,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1497
1490
  margin-left: 27px;
1498
1491
  margin-right: 27px;
1499
1492
  gap: 24px;
1500
- `,p4=fy.div`
1493
+ `,s4=uy.div`
1501
1494
  display: flex;
1502
1495
  flex-direction: column;
1503
1496
  align-items: center;
1504
1497
  justify-content: center;
1505
1498
  gap: 24px;
1506
1499
  width: 100%;
1507
- `;import u4 from"@heroicons/react/24/outline/ClockIcon";import m4 from"@heroicons/react/24/outline/EyeSlashIcon";import f4 from"@heroicons/react/24/outline/LinkIcon";import Xr from"styled-components";import{jsx as Ip,jsxs as d4}from"react/jsx-runtime";var Pl=({size:e=61,...t})=>Ip("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:d4("g",{id:"moonpay_symbol_wht 2",children:[Ip("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Ip("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as gy,jsx as It,jsxs as wn}from"react/jsx-runtime";var Wp=({title:e,desc:t,icon:r})=>wn(w4,{children:[It(E4,{children:r}),wn(b4,{children:[It(v4,{children:e}),It(C4,{children:t})]})]}),vy=({app:e,signedUrl:t,onContinue:r})=>wn(gy,{children:[wn(y4,{children:[It(Pl,{size:"3.75rem"}),wn(g4,{children:[e?.name," uses ",It("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),wn(T4,{children:[It(Wp,{icon:It(f4,{width:"1rem"}),title:"Purchase assets to fund your account",desc:wn(gy,{children:["Connect a payment method (",It("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),It(Wp,{icon:It(u4,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),It(Wp,{icon:It(m4,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),It(S4,{className:"mobile-only"})]}),It(h4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),It(zs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),h4=Xr.span`
1500
+ `;import c4 from"@heroicons/react/24/outline/ClockIcon";import p4 from"@heroicons/react/24/outline/EyeSlashIcon";import d4 from"@heroicons/react/24/outline/LinkIcon";import Xr from"styled-components";import{jsx as Ip,jsxs as l4}from"react/jsx-runtime";var Sl=({size:e=61,...t})=>Ip("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:l4("g",{id:"moonpay_symbol_wht 2",children:[Ip("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Ip("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as fy,jsx as It,jsxs as Cn}from"react/jsx-runtime";var Mp=({title:e,desc:t,icon:r})=>Cn(g4,{children:[It(C4,{children:r}),Cn(v4,{children:[It(f4,{children:e}),It(y4,{children:t})]})]}),yy=({app:e,signedUrl:t,onContinue:r})=>Cn(fy,{children:[Cn(m4,{children:[It(Sl,{size:"3.75rem"}),Cn(h4,{children:[e?.name," uses ",It("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Cn(w4,{children:[It(Mp,{icon:It(d4,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Cn(fy,{children:["Connect a payment method (",It("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),It(Mp,{icon:It(c4,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),It(Mp,{icon:It(p4,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),It(b4,{className:"mobile-only"})]}),It(u4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),It(qs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),u4=Xr.span`
1508
1501
  display: inline-block;
1509
1502
  color: var(--privy-color-foreground-3);
1510
1503
  text-align: center;
@@ -1513,13 +1506,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1513
1506
  font-weight: 400;
1514
1507
  line-height: 140%; /* 0.875rem */
1515
1508
  margin-bottom: 0.25rem;
1516
- `,y4=Xr.div`
1509
+ `,m4=Xr.div`
1517
1510
  display: flex;
1518
1511
  flex-direction: column;
1519
1512
  align-items: center;
1520
1513
  justify-content: center;
1521
1514
  padding: 1.5rem 0;
1522
- `,g4=Xr.span`
1515
+ `,h4=Xr.span`
1523
1516
  color: var(--privy-color-foreground);
1524
1517
  text-align: center;
1525
1518
  font-size: 1.125rem;
@@ -1528,46 +1521,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1528
1521
  margin: 1.5rem 0;
1529
1522
  text-align: center;
1530
1523
  max-width: 19.5rem;
1531
- `,v4=Xr.span`
1524
+ `,f4=Xr.span`
1532
1525
  color: var(--privy-color-foreground);
1533
1526
  font-size: 0.875rem;
1534
1527
  font-weight: 500;
1535
1528
  line-height: 1.225rem;
1536
1529
  width: 100%;
1537
- `,C4=Xr.span`
1530
+ `,y4=Xr.span`
1538
1531
  color: var(--privy-color-foreground-2);
1539
1532
  font-size: 0.875rem;
1540
1533
  font-weight: 400;
1541
1534
  line-height: 1.225rem;
1542
- `,w4=Xr.div`
1535
+ `,g4=Xr.div`
1543
1536
  display: flex;
1544
1537
  align-items: flex-start;
1545
1538
  gap: 0.5rem;
1546
1539
  align-self: stretch;
1547
- `,b4=Xr.div`
1540
+ `,v4=Xr.div`
1548
1541
  display: flex;
1549
1542
  flex-direction: column;
1550
1543
  gap: 0.25rem;
1551
1544
  align-items: flex-start;
1552
1545
  text-align: left;
1553
1546
  flex: 1 0 0;
1554
- `,E4=Xr.div`
1547
+ `,C4=Xr.div`
1555
1548
  padding-top: 2px;
1556
- `,T4=Xr.div`
1549
+ `,w4=Xr.div`
1557
1550
  display: flex;
1558
1551
  flex-direction: column;
1559
1552
  gap: 1.25rem;
1560
1553
  margin: 0 0.5rem;
1561
- `,S4=Xr.div`
1554
+ `,b4=Xr.div`
1562
1555
  margin: 30px 0;
1563
- `;import{ofetch as P4}from"ofetch";import{useEffect as _4,useRef as A4,useState as x4}from"react";var _l="moonpay",Cy="sdk_fiat_on_ramp_completed_with_status";async function wy(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function k4(e,t){let r=t?Ou:Mu,o=t?Nu:Lu;return P4(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function by(e,t=!1){let[r,o]=x4(null),{createAnalyticsEvent:n}=k(),a=A4(0);return _4(()=>{let i=setInterval(async()=>{if(e)try{let[s]=await k4(e,t),l=s.status==="waitingAuthorization"&&s.paymentMethod==="credit_debit_card"?"pending":s.status;o(l),["failed","completed","awaitingAuthorization"].includes(l)&&(n({eventName:Cy,payload:{status:l,provider:_l,paymentMethod:s.paymentMethod,cardPaymentType:s.cardPaymentType,currency:s.currency?.code,baseCurrencyAmount:s.baseCurrencyAmount,quoteCurrencyAmount:s.quoteCurrencyAmount,feeAmount:s.feeAmount,extraFeeAmount:s.extraFeeAmount,networkFeeAmount:s.networkFeeAmount}}),clearInterval(i))}catch(s){s.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n({eventName:Cy,payload:{status:"serviceFailure",provider:_l}}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as R4,jsx as Mp,jsxs as I4}from"react/jsx-runtime";var Ey=()=>{let{app:e,data:t,navigate:r}=x(),{createAnalyticsEvent:o}=k(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:I4(R4,{children:[Mp(P,{title:"Fund account"},"header"),Mp(vy,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:_l}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Mp($,{})]})};import W4 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import M4 from"@heroicons/react/24/solid/CheckCircleIcon";import O4 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as L4}from"react";import Ty from"styled-components";import{Fragment as Op,jsx as Wt,jsxs as bn}from"react/jsx-runtime";var Sy=()=>{let{app:e,data:t}=x(),{closePrivyModal:r}=k(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=by(o||null,e.fiatOnRamp.useSandbox);return bn(Op,{children:[Wt(P,{title:"Fund account"},"header"),Wt(D4,{status:n,onClickCta:r}),Wt($,{})]})},N4=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:bn(Op,{children:[bn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Wt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Wt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},D4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=L4(()=>N4(e),[e]);return bn(Op,{children:[bn(V4,{children:[Wt(B4,{status:e}),bn(je,{children:[Wt("h3",{children:r}),Wt(H4,{children:o})]})]}),n&&Wt(U,{onClick:t,children:n})]})},U4=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",F4=e=>{switch(e){case"serviceFailure":case"failed":return O4;case"completed":return M4;case"waitingAuthorization":return()=>Wt(W4,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},B4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return bn("div",{style:{position:"relative"},children:[Wt(ct,{color:o,style:{position:"absolute"}}),Wt(Qc,{color:o}),Wt(Pl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=F4(e),r=U4(e);return Wt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Wt(t,{width:"4rem",height:"4rem",color:r})})},H4=Ty.p`
1556
+ `;import{ofetch as E4}from"ofetch";import{useEffect as T4,useRef as S4,useState as P4}from"react";var Pl="moonpay",gy="sdk_fiat_on_ramp_completed_with_status";async function vy(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function _4(e,t){let r=t?Ou:Wu,o=t?Nu:Lu;return E4(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Cy(e,t=!1){let[r,o]=P4(null),{createAnalyticsEvent:n}=k(),a=S4(0);return T4(()=>{let i=setInterval(async()=>{if(e)try{let[s]=await _4(e,t),l=s.status==="waitingAuthorization"&&s.paymentMethod==="credit_debit_card"?"pending":s.status;o(l),["failed","completed","awaitingAuthorization"].includes(l)&&(n({eventName:gy,payload:{status:l,provider:Pl,paymentMethod:s.paymentMethod,cardPaymentType:s.cardPaymentType,currency:s.currency?.code,baseCurrencyAmount:s.baseCurrencyAmount,quoteCurrencyAmount:s.quoteCurrencyAmount,feeAmount:s.feeAmount,extraFeeAmount:s.extraFeeAmount,networkFeeAmount:s.networkFeeAmount}}),clearInterval(i))}catch(s){s.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n({eventName:gy,payload:{status:"serviceFailure",provider:Pl}}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as A4,jsx as Wp,jsxs as x4}from"react/jsx-runtime";var wy=()=>{let{app:e,data:t,navigate:r}=x(),{createAnalyticsEvent:o}=k(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:x4(A4,{children:[Wp(P,{title:"Fund account"},"header"),Wp(yy,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Pl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Wp($,{})]})};import k4 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import R4 from"@heroicons/react/24/solid/CheckCircleIcon";import I4 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as M4}from"react";import by from"styled-components";import{Fragment as Op,jsx as Mt,jsxs as wn}from"react/jsx-runtime";var Ey=()=>{let{app:e,data:t}=x(),{closePrivyModal:r}=k(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Cy(o||null,e.fiatOnRamp.useSandbox);return wn(Op,{children:[Mt(P,{title:"Fund account"},"header"),Mt(O4,{status:n,onClickCta:r}),Mt($,{})]})},W4=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:wn(Op,{children:[wn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Mt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Mt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},O4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=M4(()=>W4(e),[e]);return wn(Op,{children:[wn(F4,{children:[Mt(D4,{status:e}),wn(je,{children:[Mt("h3",{children:r}),Mt(U4,{children:o})]})]}),n&&Mt(D,{onClick:t,children:n})]})},L4=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",N4=e=>{switch(e){case"serviceFailure":case"failed":return I4;case"completed":return R4;case"waitingAuthorization":return()=>Mt(k4,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},D4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return wn("div",{style:{position:"relative"},children:[Mt(ct,{color:o,style:{position:"absolute"}}),Mt(Qc,{color:o}),Mt(Sl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=N4(e),r=L4(e);return Mt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Mt(t,{width:"4rem",height:"4rem",color:r})})},U4=by.p`
1564
1557
  font-size: 1rem;
1565
1558
  color: var(--privy-color-foreground-3);
1566
1559
  margin-bottom: 1rem;
1567
1560
  display: flex;
1568
1561
  flex-direction: column;
1569
1562
  gap: 1rem;
1570
- `,V4=Ty.div`
1563
+ `,F4=by.div`
1571
1564
  display: flex;
1572
1565
  flex-direction: column;
1573
1566
  align-items: center;
@@ -1575,7 +1568,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1575
1568
  margin-left: 1.75rem;
1576
1569
  margin-right: 1.75rem;
1577
1570
  padding: 2rem 0;
1578
- `;import G4 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import q4 from"styled-components";import{Fragment as $4,jsx as Lo,jsxs as K4}from"react/jsx-runtime";var Py=()=>{let{closePrivyModal:e}=k();return K4($4,{children:[Lo(P,{},"header"),Lo(z4,{children:Lo(G4,{style:{width:32,height:32}})}),Lo(jr,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),Lo(mr,{children:Lo(U,{onClick:()=>e(),children:"Close"})}),Lo(te,{}),Lo($,{})]})},z4=q4.div`
1571
+ `;import B4 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import H4 from"styled-components";import{Fragment as G4,jsx as Lo,jsxs as q4}from"react/jsx-runtime";var Ty=()=>{let{closePrivyModal:e}=k();return q4(G4,{children:[Lo(P,{},"header"),Lo(V4,{children:Lo(B4,{style:{width:32,height:32}})}),Lo(jr,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),Lo(mr,{children:Lo(D,{onClick:()=>e(),children:"Close"})}),Lo(te,{}),Lo($,{})]})},V4=H4.div`
1579
1572
  border-radius: 50%;
1580
1573
  height: 68px;
1581
1574
  width: 68px;
@@ -1585,7 +1578,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1585
1578
  background-color: var(--privy-color-accent);
1586
1579
  color: white;
1587
1580
  margin: 0 auto 24px auto;
1588
- `;import*as ky from"react-device-detect";import Q4 from"styled-components";import Lp from"styled-components";import{jsx as _y}from"react/jsx-runtime";var Ay=({style:e,...t})=>_y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:_y("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as Y4,jsxs as Z4}from"react/jsx-runtime";var xy=Lp.div`
1581
+ `;import*as Ay from"react-device-detect";import j4 from"styled-components";import Lp from"styled-components";import{jsx as Sy}from"react/jsx-runtime";var Py=({style:e,...t})=>Sy("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:Sy("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as $4,jsxs as K4}from"react/jsx-runtime";var _y=Lp.div`
1589
1582
  display: flex;
1590
1583
  flex-direction: column;
1591
1584
  justify-content: flex-start;
@@ -1596,7 +1589,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1596
1589
  border-left: 2px solid var(--privy-color-foreground-4);
1597
1590
  height: 12px;
1598
1591
  }
1599
- `,Al=({children:e})=>Z4(j4,{children:[Y4(Ay,{style:{width:"16px",height:"16px"}}),e]}),j4=Lp.div`
1592
+ `,_l=({children:e})=>K4(z4,{children:[$4(Py,{style:{width:"16px",height:"16px"}}),e]}),z4=Lp.div`
1600
1593
  display: flex;
1601
1594
  justify-content: flex-start;
1602
1595
  justify-items: center;
@@ -1614,15 +1607,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
1614
1607
  margin-bottom: auto;
1615
1608
  }
1616
1609
  }
1617
- `;import{Fragment as e5,jsx as gt,jsxs as Ca}from"react/jsx-runtime";var J4=()=>Ca(X4,{children:[gt(un,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),gt(xt,{children:gt(Gr,{style:{width:"152px",height:"152px"}})}),Ca(xy,{children:[gt(Al,{children:Ca("div",{children:[gt("span",{children:"Install the "}),gt("a",{href:ky.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),gt(Np,{}),gt(Al,{children:"Set up your first wallet"}),gt(Np,{}),gt(Al,{children:"Store your recovery phrase in a safe place!"})]}),gt(ei,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Ry=()=>{let{navigateBack:e}=x();return Ca(e5,{children:[gt(P,{backFn:e},"header"),gt(ee,{}),gt(J4,{}),gt(te,{}),Ca(K,{children:[gt("span",{children:"Still not sure? "}),gt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},X4=Q4(xt)`
1610
+ `;import{Fragment as Q4,jsx as gt,jsxs as va}from"react/jsx-runtime";var Y4=()=>va(Z4,{children:[gt(un,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),gt(xt,{children:gt(Gr,{style:{width:"152px",height:"152px"}})}),va(_y,{children:[gt(_l,{children:va("div",{children:[gt("span",{children:"Install the "}),gt("a",{href:Ay.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),gt(Np,{}),gt(_l,{children:"Set up your first wallet"}),gt(Np,{}),gt(_l,{children:"Store your recovery phrase in a safe place!"})]}),gt(Xn,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),xy=()=>{let{navigateBack:e}=x();return va(Q4,{children:[gt(P,{backFn:e},"header"),gt(ee,{}),gt(Y4,{}),gt(te,{}),va(K,{children:[gt("span",{children:"Still not sure? "}),gt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},Z4=j4(xt)`
1618
1611
  gap: 30px;
1619
1612
 
1620
1613
  > :first-child > svg {
1621
1614
  margin-top: 20px;
1622
1615
  }
1623
- `;import F5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as B5,useState as qy}from"react";import{isMobile as H5}from"react-device-detect";import V5 from"styled-components";import a5 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as s5}from"react";import t5 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as r5,useState as Iy}from"react";import My from"styled-components";import{Fragment as i5,jsx as wa,jsxs as Wy}from"react/jsx-runtime";var xl=r5((e,t)=>{let[r,o]=Iy(""),[n,a]=Iy(!1),{authenticated:i}=H(),{initLoginWithEmail:s}=k(),{navigate:l,setModalData:c,currentScreen:u}=x(),{enabled:h,token:m}=ye(),g=ps(r),w=n,y=n||!g,T=b=>{a(!0),s(r,b).then(()=>{l("AWAITING_PASSWORDLESS_CODE")}).catch(S=>{c({errorModalData:{error:S,previousScreen:u||"LANDING"}}),l("ERROR_SCREEN")}).finally(()=>{a(!1)})},_=()=>{h&&!m&&!i?(c({captchaModalData:{callback:b=>s(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),l("CAPTCHA_SCREEN")):T(m)};return Wy(i5,{children:[wa(o5,{children:Wy(n5,{stacked:e.stacked,children:[wa(t5,{}),wa("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&_()},value:r,autoComplete:"email"}),e.stacked?null:wa(ti,{isSubmitting:w,onClick:_,disabled:y,children:"Submit"})]})}),e.stacked?wa(U,{loadingText:null,loading:w,disabled:y,onClick:_,children:"Submit"}):null]})}),o5=My.div`
1616
+ `;import B5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as H5,useState as qy}from"react";import{isMobile as V5}from"react-device-detect";import G5 from"styled-components";import e5 from"styled-components";import J4 from"react";import{jsx as X4}from"react/jsx-runtime";var ky=()=>{let{app:e}=x(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?X4("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?J4.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as Ry}from"react/jsx-runtime";var Al=e=>{let{app:t}=x();return t?.appearance.logo?Ry(t5,{...e,children:Ry(ky,{})}):null},t5=e5.div`
1617
+ display: flex;
1618
+ flex-direction: column;
1619
+ align-items: center;
1620
+ padding: 24px 0;
1621
+ flex-grow: 1;
1622
+ justify-content: center;
1623
+ `;import s5 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as l5}from"react";import r5 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as o5,useState as Iy}from"react";import Wy from"styled-components";import{Fragment as a5,jsx as Ca,jsxs as My}from"react/jsx-runtime";var xl=o5((e,t)=>{let[r,o]=Iy(""),[n,a]=Iy(!1),{authenticated:i}=H(),{initLoginWithEmail:s}=k(),{navigate:l,setModalData:c,currentScreen:u}=x(),{enabled:f,token:m}=ye(),v=cs(r),w=n,y=n||!v,T=b=>{a(!0),s(r,b).then(()=>{l("AWAITING_PASSWORDLESS_CODE")}).catch(S=>{c({errorModalData:{error:S,previousScreen:u||"LANDING"}}),l("ERROR_SCREEN")}).finally(()=>{a(!1)})},_=()=>{f&&!m&&!i?(c({captchaModalData:{callback:b=>s(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),l("CAPTCHA_SCREEN")):T(m)};return My(a5,{children:[Ca(n5,{children:My(i5,{stacked:e.stacked,children:[Ca(r5,{}),Ca("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&_()},value:r,autoComplete:"email"}),e.stacked?null:Ca(ei,{isSubmitting:w,onClick:_,disabled:y,children:"Submit"})]})}),e.stacked?Ca(D,{loadingText:null,loading:w,disabled:y,onClick:_,children:"Submit"}):null]})}),n5=Wy.div`
1624
1624
  width: 100%;
1625
- `,n5=My.label`
1625
+ `,i5=Wy.label`
1626
1626
  display: block;
1627
1627
  position: relative;
1628
1628
  width: 100%;
@@ -1683,7 +1683,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1683
1683
  && > input::placeholder {
1684
1684
  color: var(--privy-color-foreground-3);
1685
1685
  }
1686
- `;import{Fragment as l5,jsx as kl,jsxs as Oy}from"react/jsx-runtime";var Rl=({isEditable:e,setIsEditable:t})=>{let r=s5(null);return Oy(l5,{children:[kl(_r,{if:!e,children:kl(xl,{ref:r})}),kl(_r,{if:e,children:Oy(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[kl(a5,{})," Continue with Email"]})})]})};import{useState as c5}from"react";import{jsx as Dp,jsxs as p5}from"react/jsx-runtime";var Il=()=>{let[e,t]=c5(!1),{currentScreen:r,navigate:o,setModalData:n}=x(),{enabled:a,token:i}=ye(),{initLoginWithFarcaster:s}=k();return p5(Se,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:c=>s(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await s(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Dp(Qr,{})," Farcaster",e&&Dp("span",{children:Dp(zr,{})})]})};import d5,{css as u5}from"styled-components";import{jsx as h5}from"react/jsx-runtime";var Wl=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=x(),{initLoginWithPasskey:n}=k();return h5(f5,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:i=>n(i),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},m5=u5`
1686
+ `;import{Fragment as c5,jsx as kl,jsxs as Oy}from"react/jsx-runtime";var Rl=({isEditable:e,setIsEditable:t})=>{let r=l5(null);return Oy(c5,{children:[kl(_r,{if:!e,children:kl(xl,{ref:r})}),kl(_r,{if:e,children:Oy(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[kl(s5,{})," Continue with Email"]})})]})};import{useState as p5}from"react";import{jsx as Dp,jsxs as d5}from"react/jsx-runtime";var Il=()=>{let[e,t]=p5(!1),{currentScreen:r,navigate:o,setModalData:n}=x(),{enabled:a,token:i}=ye(),{initLoginWithFarcaster:s}=k();return d5(Se,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:c=>s(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await s(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Dp(Qr,{})," Farcaster",e&&Dp("span",{children:Dp(zr,{})})]})};import u5,{css as m5}from"styled-components";import{jsx as y5}from"react/jsx-runtime";var Ml=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=x(),{initLoginWithPasskey:n}=k();return y5(f5,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:i=>n(i),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},h5=m5`
1687
1687
  && {
1688
1688
  width: 100%;
1689
1689
  font-size: 0.875rem;
@@ -1708,11 +1708,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1708
1708
  box-shadow: none;
1709
1709
  }
1710
1710
  }
1711
- `,f5=d5.button`
1712
- ${m5}
1713
- `;import x5 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as k5}from"react";import{forwardRef as S5,useState as Up}from"react";import By from"styled-components";import y5 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as g5,AsYouType as v5,getCountries as C5,getCountryCallingCode as Ml,getExampleNumber as w5}from"libphonenumber-js/min";import{jsx as T5,jsxs as E5}from"react/jsx-runtime";var ba=(e,t)=>g5(String(e),t),Ol=(e,t)=>`+${Ml(t)} ${e}`,Ly=e=>`*${e.replaceAll("-","").slice(-4)}`,Ny=e=>new v5(e),b5=C5().map(e=>({code:e,callCode:Ml(e)})),Dy=e=>{let t=w5(e,y5)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Uy=({value:e,onChange:t})=>T5("select",{value:e,onChange:t,children:b5.map(r=>E5("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as A5,jsx as Ea,jsxs as Fy}from"react/jsx-runtime";var Pi=S5((e,t)=>{let{app:r}=x(),[o,n]=Up(""),[a,i]=Up(r?.intl.defaultCountry??"US"),s=ba(o,a),l=Ny(a),c=Dy(a),u=Ml(a),h=!s,[m,g]=Up(!1),w=u.length,y=b=>{let S=b.target.value;i(S),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Ol(o,S),countryCode:S,isValid:ba(o,a)})},T=b=>{try{let S=b.replace(/\D/g,""),I=o.replace(/\D/g,""),N=S===I?b:l.input(b);n(N),e.onChange&&e.onChange({rawPhoneNumber:N,qualifiedPhoneNumber:Ol(b,a),countryCode:a,isValid:ba(b,a)})}catch(S){console.error("Error processing phone number:",S)}},_=()=>{g(!0);let b=Ol(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:a,isValid:ba(o,a)}).finally(()=>g(!1))};return Fy(A5,{children:[Ea(P5,{children:Fy(_5,{callingCodeLength:w,stacked:e.stacked,children:[Ea(Uy,{value:a,onChange:y}),Ea("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{T(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&_()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?Ea(ti,{isSubmitting:m,onClick:_,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?Ea(U,{loading:m,loadingText:null,onClick:_,disabled:h,children:"Submit"}):null]})}),P5=By.div`
1711
+ `,f5=u5.button`
1712
+ ${h5}
1713
+ `;import k5 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as R5}from"react";import{forwardRef as P5,useState as Up}from"react";import By from"styled-components";import g5 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as v5,AsYouType as C5,getCountries as w5,getCountryCallingCode as Wl,getExampleNumber as b5}from"libphonenumber-js/min";import{jsx as S5,jsxs as T5}from"react/jsx-runtime";var wa=(e,t)=>v5(String(e),t),Ol=(e,t)=>`+${Wl(t)} ${e}`,Ly=e=>`*${e.replaceAll("-","").slice(-4)}`,Ny=e=>new C5(e),E5=w5().map(e=>({code:e,callCode:Wl(e)})),Dy=e=>{let t=b5(e,g5)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Uy=({value:e,onChange:t})=>S5("select",{value:e,onChange:t,children:E5.map(r=>T5("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as x5,jsx as ba,jsxs as Fy}from"react/jsx-runtime";var Si=P5((e,t)=>{let{app:r}=x(),[o,n]=Up(""),[a,i]=Up(r?.intl.defaultCountry??"US"),s=wa(o,a),l=Ny(a),c=Dy(a),u=Wl(a),f=!s,[m,v]=Up(!1),w=u.length,y=b=>{let S=b.target.value;i(S),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Ol(o,S),countryCode:S,isValid:wa(o,a)})},T=b=>{try{let S=b.replace(/\D/g,""),I=o.replace(/\D/g,""),N=S===I?b:l.input(b);n(N),e.onChange&&e.onChange({rawPhoneNumber:N,qualifiedPhoneNumber:Ol(b,a),countryCode:a,isValid:wa(b,a)})}catch(S){console.error("Error processing phone number:",S)}},_=()=>{v(!0);let b=Ol(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:a,isValid:wa(o,a)}).finally(()=>v(!1))};return Fy(x5,{children:[ba(_5,{children:Fy(A5,{callingCodeLength:w,stacked:e.stacked,children:[ba(Uy,{value:a,onChange:y}),ba("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{T(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&_()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?ba(ei,{isSubmitting:m,onClick:_,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?ba(D,{loading:m,loadingText:null,onClick:_,disabled:f,children:"Submit"}):null]})}),_5=By.div`
1714
1714
  width: 100%;
1715
- `,_5=By.label`
1715
+ `,A5=By.label`
1716
1716
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1717
1717
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1718
1718
  display: block;
@@ -1799,11 +1799,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1799
1799
  && > input::placeholder {
1800
1800
  color: var(--privy-color-foreground-3);
1801
1801
  }
1802
- `;import{Fragment as R5,jsx as Ll,jsxs as Hy}from"react/jsx-runtime";var Nl=({isEditable:e,setIsEditable:t})=>{let r=k5(null),{authenticated:o}=H(),{navigate:n,setModalData:a,currentScreen:i}=x(),{initLoginWithSms:s}=k(),{enabled:l,token:c}=ye();async function u({qualifiedPhoneNumber:h}){if(l&&!c&&!o)a({captchaModalData:{callback:m=>s(h,m),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await s(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(m){a({errorModalData:{error:m,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Hy(R5,{children:[Ll(_r,{if:!e,children:Ll(Pi,{ref:r,onSubmit:u})}),Ll(_r,{if:e,children:Hy(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Ll(x5,{})," Continue with SMS"]})})]})};import{useState as I5}from"react";import{jsx as yo,jsxs as M5}from"react/jsx-runtime";var W5={apple:{logo:yo(ws,{}),displayName:"Apple"},discord:{logo:yo(bs,{}),displayName:"Discord"},github:{logo:yo(Es,{}),displayName:"GitHub"},google:{logo:yo(Ss,{}),displayName:"Google"},linkedin:{logo:yo(xs,{}),displayName:"LinkedIn"},spotify:{logo:yo(ks,{}),displayName:"Spotify"},instagram:{logo:yo(_s,{}),displayName:"Instagram"},twitter:{logo:yo(Is,{}),displayName:"Twitter"},tiktok:{logo:yo(Rs,{}),displayName:"TikTok"}},ut=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=x(),[a,i]=I5(!1),{initLoginWithOAuth:s}=k(),{displayName:l,logo:c}=W5[e];return M5(Se,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:h=>s(e,h),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):s(e)},disabled:a,children:[c," ",l]})};import{useState as O5}from"react";import{jsx as No,jsxs as Vy}from"react/jsx-runtime";function Dl(e){return Vy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[No("defs",{children:Vy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[No("stop",{offset:"0",stopColor:"#1d93d2"}),No("stop",{offset:"1",stopColor:"#38b0e3"})]})}),No("title",{children:"Telegram_logo"}),No("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),No("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),No("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),No("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as L5,jsxs as N5}from"react/jsx-runtime";var Ul=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=x(),[n,a]=O5(!1),{initLoginWithTelegram:i}=k();async function s(c){try{await i(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),a(!1)}}async function l(){if(a(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return N5(Se,{onClick:l,disabled:n,children:[L5(Dl,{})," Telegram"]})};import D5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Gy,jsxs as U5}from"react/jsx-runtime";var Fl=({onClick:e,text:t,icon:r})=>U5(Se,{onClick:e,children:[r,Gy(Ao,{children:t}),Gy(D5,{})]});import{Fragment as Fp,jsx as Xe,jsxs as Hl}from"react/jsx-runtime";var Vl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=k(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{appearance:{palette:{colorScheme:a}}}=lt(),i=o.loginMethodsAndOrder?.primary??[],s=o.loginMethodsAndOrder?.overflow??[],l=[...i,...s],c=o.loginMethods.passkey,[u,h]=qy("default"),[m,g]=qy("email");B5(()=>{let R=l.indexOf("sms"),B=l.indexOf("email");R>-1&&R<B&&g("sms")},[i,s]);let w=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{h("default")},150)};n.current=w;let y=R=>R==="email"?Xe(Rl,{isEditable:m==="email",setIsEditable:()=>{g("email")}},R):R==="sms"?Xe(Nl,{isEditable:m==="sms",setIsEditable:()=>{g("sms")}},R):R==="apple"?Xe(ut,{provider:"apple"},R):R==="discord"?Xe(ut,{provider:"discord"},R):R==="farcaster"?Xe(Il,{},R):R==="github"?Xe(ut,{provider:"github"},R):R==="google"?Xe(ut,{provider:"google"},R):R==="linkedin"?Xe(ut,{provider:"linkedin"},R):R==="tiktok"?Xe(ut,{provider:"tiktok"},R):R==="twitter"&&(!H5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Xe(ut,{provider:"twitter"},R):R==="telegram"?Xe(Ul,{},R):ca([R],r,e,l,o.externalWallets.walletConnect.enabled),T=i.map(y).flat(),_=s.map(y).flat(),b=[...T,..._],S=G5({primary:T.length,overflow:_.length}),[I,N]=mu(b,S),W=u==="default"?void 0:()=>{h("default")};return Hl(Fp,{children:[Xe(P,{title:o.appearance.landingHeader,onClose:w,backFn:W}),u==="default"&&Xe(q5,{}),u==="default"&&(typeof o.appearance.loginMessage=="string"?Xe(js,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Xe(Ks,{style:{overflow:"hidden"},children:Hl(uf,{colorScheme:a,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Hl(Fp,{children:[...I,N.length>0&&Xe(Fl,{text:"More options",icon:Xe(F5,{}),onClick:()=>h("overflow")})]}),u==="overflow"&&Hl(Fp,{children:[...N]}),c&&u==="default"&&Xe(Wl,{})]})}),o&&Xe(ni,{app:o}),Xe($,{})]})},Bl=5,G5=({primary:e,overflow:t})=>e<Bl?e:e===Bl&&t===0?Bl:Bl-1,q5=V5(mi)`
1802
+ `;import{Fragment as I5,jsx as Ll,jsxs as Hy}from"react/jsx-runtime";var Nl=({isEditable:e,setIsEditable:t})=>{let r=R5(null),{authenticated:o}=H(),{navigate:n,setModalData:a,currentScreen:i}=x(),{initLoginWithSms:s}=k(),{enabled:l,token:c}=ye();async function u({qualifiedPhoneNumber:f}){if(l&&!c&&!o)a({captchaModalData:{callback:m=>s(f,m),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await s(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(m){a({errorModalData:{error:m,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Hy(I5,{children:[Ll(_r,{if:!e,children:Ll(Si,{ref:r,onSubmit:u})}),Ll(_r,{if:e,children:Hy(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Ll(k5,{})," Continue with SMS"]})})]})};import{useState as M5}from"react";import{jsx as yo,jsxs as O5}from"react/jsx-runtime";var W5={apple:{logo:yo(Cs,{}),displayName:"Apple"},discord:{logo:yo(ws,{}),displayName:"Discord"},github:{logo:yo(bs,{}),displayName:"GitHub"},google:{logo:yo(Ts,{}),displayName:"Google"},linkedin:{logo:yo(As,{}),displayName:"LinkedIn"},spotify:{logo:yo(xs,{}),displayName:"Spotify"},instagram:{logo:yo(Ps,{}),displayName:"Instagram"},twitter:{logo:yo(Rs,{}),displayName:"Twitter"},tiktok:{logo:yo(ks,{}),displayName:"TikTok"}},ut=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=x(),[a,i]=M5(!1),{initLoginWithOAuth:s}=k(),{displayName:l,logo:c}=W5[e];return O5(Se,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:f=>s(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):s(e)},disabled:a,children:[c," ",l]})};import{useState as L5}from"react";import{jsx as No,jsxs as Vy}from"react/jsx-runtime";function Dl(e){return Vy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[No("defs",{children:Vy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[No("stop",{offset:"0",stopColor:"#1d93d2"}),No("stop",{offset:"1",stopColor:"#38b0e3"})]})}),No("title",{children:"Telegram_logo"}),No("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),No("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),No("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),No("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as N5,jsxs as D5}from"react/jsx-runtime";var Ul=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=x(),[n,a]=L5(!1),{initLoginWithTelegram:i}=k();async function s(c){try{await i(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),a(!1)}}async function l(){if(a(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return D5(Se,{onClick:l,disabled:n,children:[N5(Dl,{})," Telegram"]})};import U5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Gy,jsxs as F5}from"react/jsx-runtime";var Fl=({onClick:e,text:t,icon:r})=>F5(Se,{onClick:e,children:[r,Gy(Ao,{children:t}),Gy(U5,{})]});import{Fragment as Fp,jsx as Xe,jsxs as Hl}from"react/jsx-runtime";var Vl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=k(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{appearance:{palette:{colorScheme:a}}}=lt(),i=o.loginMethodsAndOrder?.primary??[],s=o.loginMethodsAndOrder?.overflow??[],l=[...i,...s],c=o.loginMethods.passkey,[u,f]=qy("default"),[m,v]=qy("email");H5(()=>{let R=l.indexOf("sms"),B=l.indexOf("email");R>-1&&R<B&&v("sms")},[i,s]);let w=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=w;let y=R=>R==="email"?Xe(Rl,{isEditable:m==="email",setIsEditable:()=>{v("email")}},R):R==="sms"?Xe(Nl,{isEditable:m==="sms",setIsEditable:()=>{v("sms")}},R):R==="apple"?Xe(ut,{provider:"apple"},R):R==="discord"?Xe(ut,{provider:"discord"},R):R==="farcaster"?Xe(Il,{},R):R==="github"?Xe(ut,{provider:"github"},R):R==="google"?Xe(ut,{provider:"google"},R):R==="linkedin"?Xe(ut,{provider:"linkedin"},R):R==="tiktok"?Xe(ut,{provider:"tiktok"},R):R==="twitter"&&(!V5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Xe(ut,{provider:"twitter"},R):R==="telegram"?Xe(Ul,{},R):la([R],r,e,l,o.externalWallets.walletConnect.enabled),T=i.map(y).flat(),_=s.map(y).flat(),b=[...T,..._],S=q5({primary:T.length,overflow:_.length}),[I,N]=mu(b,S),M=u==="default"?void 0:()=>{f("default")};return Hl(Fp,{children:[Xe(P,{title:o.appearance.landingHeader,onClose:w,backFn:M}),u==="default"&&Xe(z5,{}),u==="default"&&(typeof o.appearance.loginMessage=="string"?Xe(Ks,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Xe($s,{style:{overflow:"hidden"},children:Hl(dh,{colorScheme:a,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Hl(Fp,{children:[...I,N.length>0&&Xe(Fl,{text:"More options",icon:Xe(B5,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&Hl(Fp,{children:[...N]}),c&&u==="default"&&Xe(Ml,{})]})}),o&&Xe(oi,{app:o}),Xe($,{})]})},Bl=5,q5=({primary:e,overflow:t})=>e<Bl?e:e===Bl&&t===0?Bl:Bl-1,z5=G5(Al)`
1803
1803
  margin-bottom: 16px;
1804
- `;import j5 from"@heroicons/react/24/outline/EnvelopeIcon";import Y5 from"@heroicons/react/24/outline/PhoneIcon";import Z5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Q5,useState as jy}from"react";import{isMobile as J5}from"react-device-detect";import X5 from"styled-components";import{jsx as Ta,jsxs as zy}from"react/jsx-runtime";var $y=({...e})=>zy("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[zy("g",{clipPath:"url(#clip0_2856_1743)",children:[Ta("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ta("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ta("defs",{children:Ta("clipPath",{id:"clip0_2856_1743",children:Ta("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import z5 from"@heroicons/react/24/outline/ChevronRightIcon";import $5 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Bp,jsxs as K5}from"react/jsx-runtime";var Ky=({onClick:e,text:t})=>K5(Se,{onClick:e,children:[Bp($5,{}),Bp(Ao,{children:t}),Bp(z5,{})]});import{Fragment as Sa,jsx as We,jsxs as _i}from"react/jsx-runtime";var Gl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=k(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{email:a,sms:i,google:s,twitter:l,discord:c,github:u,spotify:h,instagram:m,tiktok:g,linkedin:w,apple:y,wallet:T,farcaster:_,passkey:b,telegram:S}=o?.loginMethods??{},I=o?.appearance.loginGroupPriority||"web2-first",N=o?.appearance.hideDirectWeb2Inputs,[W,R]=jy("default"),[B,q]=jy(a?"email":"sms");Q5(()=>{q(a?"email":"sms")},[a]);let Y=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{R("default")},150)};n.current=Y;let M=[a&&We(Rl,{isEditable:B==="email",setIsEditable:()=>{q("email")}}),i&&We(Nl,{isEditable:B==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),z=[s&&We(ut,{provider:"google"}),l&&(!J5||o?.loginConfig.twitterOAuthOnMobileEnabled)&&We(ut,{provider:"twitter"}),c&&We(ut,{provider:"discord"}),u&&We(ut,{provider:"github"}),h&&We(ut,{provider:"spotify"}),m&&We(ut,{provider:"instagram"}),g&&We(ut,{provider:"tiktok"}),w&&We(ut,{provider:"linkedin"}),y&&We(ut,{provider:"apple"}),_&&We(Il,{}),S&&We(Ul,{})].filter(Boolean),L=ca(o.appearance.walletList,r,e,o.appearance.walletList,o.externalWallets.walletConnect.enabled),Ue=W==="default"?void 0:()=>{R("default")},Ye=t6({priority:I,email:a,sms:i,social:z}),Oe=r6({priority:I,email:a,sms:i,social:z}),de=o6({priority:I,email:a,sms:i,social:z}),J=We(Ky,{text:de,onClick:()=>R("web3-overflow")}),Ee=We(Fl,{text:Ye,icon:Oe,onClick:()=>R("web2-overflow")}),_e=N?0:1;return _i(Sa,{children:[We(P,{title:o.appearance.landingHeader,onClose:Y,backFn:Ue}),W==="default"&&We(e6,{}),W==="default"&&(typeof o.appearance.loginMessage=="string"?We(js,{children:o.appearance.loginMessage}):o.appearance.loginMessage),We(Ks,{style:{overflow:"hidden",padding:2},children:_i(Pr,{children:[W==="default"&&I==="web2-first"&&_i(Sa,{children:[...M,...z.length+M.length>4?z.slice(0,3-M.length):z,M.length+z.length>4&&Ee,T&&J]}),W==="default"&&I==="web3-first"&&_i(Sa,{children:[T&&_i(Sa,{children:[...L.length>4?L.slice(0,3):L,L.length>4&&J]}),M.length+z.length>_e&&Ee,M.length+z.length===_e&&M.length?M[0]:null,M.length+z.length===_e&&z.length?z[0]:null]}),W==="web2-overflow"&&_i(Sa,{children:[...I==="web3-first"?M:[],...z]}),...W==="web3-overflow"?L:[],b&&W==="default"&&We(Wl,{})]})}),o&&We(ni,{app:o}),We($,{})]})},e6=X5(mi)`
1804
+ `;import Y5 from"@heroicons/react/24/outline/EnvelopeIcon";import Z5 from"@heroicons/react/24/outline/PhoneIcon";import Q5 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as J5,useState as jy}from"react";import{isMobile as X5}from"react-device-detect";import e6 from"styled-components";import{jsx as Ea,jsxs as zy}from"react/jsx-runtime";var $y=({...e})=>zy("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[zy("g",{clipPath:"url(#clip0_2856_1743)",children:[Ea("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ea("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ea("defs",{children:Ea("clipPath",{id:"clip0_2856_1743",children:Ea("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import $5 from"@heroicons/react/24/outline/ChevronRightIcon";import K5 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Bp,jsxs as j5}from"react/jsx-runtime";var Ky=({onClick:e,text:t})=>j5(Se,{onClick:e,children:[Bp(K5,{}),Bp(Ao,{children:t}),Bp($5,{})]});import{Fragment as Ta,jsx as Me,jsxs as Pi}from"react/jsx-runtime";var Gl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=k(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{email:a,sms:i,google:s,twitter:l,discord:c,github:u,spotify:f,instagram:m,tiktok:v,linkedin:w,apple:y,wallet:T,farcaster:_,passkey:b,telegram:S}=o?.loginMethods??{},I=o?.appearance.loginGroupPriority||"web2-first",N=o?.appearance.hideDirectWeb2Inputs,[M,R]=jy("default"),[B,q]=jy(a?"email":"sms");J5(()=>{q(a?"email":"sms")},[a]);let Y=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{R("default")},150)};n.current=Y;let W=[a&&Me(Rl,{isEditable:B==="email",setIsEditable:()=>{q("email")}}),i&&Me(Nl,{isEditable:B==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),z=[s&&Me(ut,{provider:"google"}),l&&(!X5||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Me(ut,{provider:"twitter"}),c&&Me(ut,{provider:"discord"}),u&&Me(ut,{provider:"github"}),f&&Me(ut,{provider:"spotify"}),m&&Me(ut,{provider:"instagram"}),v&&Me(ut,{provider:"tiktok"}),w&&Me(ut,{provider:"linkedin"}),y&&Me(ut,{provider:"apple"}),_&&Me(Il,{}),S&&Me(Ul,{})].filter(Boolean),L=la(o.appearance.walletList,r,e,o.appearance.walletList,o.externalWallets.walletConnect.enabled),Ue=M==="default"?void 0:()=>{R("default")},Ye=r6({priority:I,email:a,sms:i,social:z}),Oe=o6({priority:I,email:a,sms:i,social:z}),de=n6({priority:I,email:a,sms:i,social:z}),X=Me(Ky,{text:de,onClick:()=>R("web3-overflow")}),Ee=Me(Fl,{text:Ye,icon:Oe,onClick:()=>R("web2-overflow")}),_e=N?0:1;return Pi(Ta,{children:[Me(P,{title:o.appearance.landingHeader,onClose:Y,backFn:Ue}),M==="default"&&Me(t6,{}),M==="default"&&(typeof o.appearance.loginMessage=="string"?Me(Ks,{children:o.appearance.loginMessage}):o.appearance.loginMessage),Me($s,{style:{overflow:"hidden",padding:2},children:Pi(Pr,{children:[M==="default"&&I==="web2-first"&&Pi(Ta,{children:[...W,...z.length+W.length>4?z.slice(0,3-W.length):z,W.length+z.length>4&&Ee,T&&X]}),M==="default"&&I==="web3-first"&&Pi(Ta,{children:[T&&Pi(Ta,{children:[...L.length>4?L.slice(0,3):L,L.length>4&&X]}),W.length+z.length>_e&&Ee,W.length+z.length===_e&&W.length?W[0]:null,W.length+z.length===_e&&z.length?z[0]:null]}),M==="web2-overflow"&&Pi(Ta,{children:[...I==="web3-first"?W:[],...z]}),...M==="web3-overflow"?L:[],b&&M==="default"&&Me(Ml,{})]})}),o&&Me(oi,{app:o}),Me($,{})]})},t6=e6(Al)`
1805
1805
  margin-bottom: 16px;
1806
- `,t6=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",r6=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?We(Z5,{}):t&&r?We($y,{}):t?We(j5,{}):r?We(Y5,{}):null,o6=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Yy}from"react/jsx-runtime";var Zy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Yy(Vl,{connectOnly:!0}):Yy(Gl,{connectOnly:!0})};import{jsx as Qy}from"react/jsx-runtime";var Jy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Qy(Vl,{connectOnly:!1}):Qy(Gl,{connectOnly:!1})};import n6 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as i6,jsx as Do,jsxs as a6}from"react/jsx-runtime";var Xy=()=>{let{app:e}=x();return a6(i6,{children:[Do(P,{},"header"),Do(ee,{}),Do(xe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Do(n6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Do(mr,{children:Do(xl,{stacked:!0})}),Do(te,{}),Do($,{})]})};import s6 from"@heroicons/react/24/outline/ClockIcon";import l6 from"@heroicons/react/24/outline/TrashIcon";import c6 from"@heroicons/react/24/solid/CheckBadgeIcon";import p6 from"@heroicons/react/24/solid/CheckCircleIcon";import d6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as u6,useState as Pa}from"react";import gr,{css as ng}from"styled-components";import{jsx as eg}from"react/jsx-runtime";var En=({style:e,...t})=>eg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:eg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Ne,jsxs as tg}from"react/jsx-runtime";var Tn=({style:e,...t})=>tg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[tg("g",{clipPath:"url(#clip0_113_33841)",children:[Ne("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Ne("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Ne("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Ne("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Ne("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Ne("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Ne("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Ne("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Ne("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Ne("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Ne("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Ne("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Ne("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Ne("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Ne("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Ne("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Ne("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Ne("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Ne("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Ne("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Ne("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Ne("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Ne("defs",{children:Ne("clipPath",{id:"clip0_113_33841",children:Ne("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Hp,jsx as me,jsxs as $t}from"react/jsx-runtime";var rg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=Pa([]),i=t?e.length:2,s=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",l=async c=>{a(u=>u.concat([c])),await r(c),a(u=>u.filter(h=>h!==c))};return $t("div",{children:[me(C6,{children:"Your passkeys"}),$t(ag,{children:[e.slice(0,i).map(c=>$t(E6,{children:[$t("div",{children:[me(w6,{children:s(c)}),$t(b6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),me(S6,{disabled:n.includes(c.credentialId),onClick:()=>l(c.credentialId),children:n.includes(c.credentialId)?me(zr,{}):me(l6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&me(y6,{onClick:o,children:"View all"})]})]})},m6=()=>$t(ag,{children:[$t(qt,{children:[me(Gt,{children:me(c6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),$t(qt,{children:[me(Gt,{children:me(d6,{})}),"More secure than a password."]}),$t(qt,{children:[me(Gt,{children:me(s6,{})}),"Takes seconds to set up and use."]})]}),ig=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=k(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[a,i]=Pa(!1),[s,l]=Pa(""),[c,u]=Pa(!1),[h,m]=Pa(!1);u6(()=>{n.length===0&&m(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(y=>{if(y instanceof Ze){if(y.privyErrorCode==="cannot_link_more_of_type"){l("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){l("Passkey request timed out or rejected by user.");return}}l("Unknown error occurred.")}).finally(()=>{i(!1)})},w=async y=>(i(!0),await t(y).then(()=>u(!0)).catch(T=>{if(T instanceof Ze&&T.privyErrorCode==="missing_or_invalid_mfa"){l("Cannot unlink a passkey enrolled in MFA");return}l("Unknown error occurred.")}).finally(()=>{i(!1)}));return c?$t(Hp,{children:[me(P,{onClose:()=>o()},"header"),me(Ae,{children:me(Ge,{status:"success",children:me(p6,{})})}),me(og,{children:"Passkey added"}),me(g6,{children:"From now on, you can use your passkey to log in."}),me(Ct,{children:me(U,{onClick:()=>o(),children:"Done"})}),me(K,{})]}):h?$t(Hp,{children:[me(P,{backFn:()=>m(!1),onClose:()=>o()},"header"),me(rg,{passkeys:n,expanded:h,onUnlink:w,onExpand:()=>m(!0)}),me(K,{})]}):$t(Hp,{children:[me(P,{onClose:()=>o()},"header"),me(Ae,{children:$t(ql,{children:[me(En,{}),me(Tn,{})]})}),me(og,{children:"Secure your account with a passkey"}),me(v6,{}),n.length===0?me(m6,{}):me(rg,{passkeys:n,expanded:h,onUnlink:w,onExpand:()=>m(!0)}),$t(Ct,{style:{marginTop:"12px"},children:[s&&me(f6,{fail:!0,children:s}),me(U,{onClick:g,loading:a,children:"Add new passkey"})]}),me(K,{})]})},ql=gr.div`
1806
+ `,r6=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",o6=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Me(Q5,{}):t&&r?Me($y,{}):t?Me(Y5,{}):r?Me(Z5,{}):null,n6=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Yy}from"react/jsx-runtime";var Zy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Yy(Vl,{connectOnly:!0}):Yy(Gl,{connectOnly:!0})};import{jsx as Qy}from"react/jsx-runtime";var Jy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Qy(Vl,{connectOnly:!1}):Qy(Gl,{connectOnly:!1})};import i6 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as a6,jsx as Do,jsxs as s6}from"react/jsx-runtime";var Xy=()=>{let{app:e}=x();return s6(a6,{children:[Do(P,{},"header"),Do(ee,{}),Do(xe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Do(i6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Do(mr,{children:Do(xl,{stacked:!0})}),Do(te,{}),Do($,{})]})};import l6 from"@heroicons/react/24/outline/ClockIcon";import c6 from"@heroicons/react/24/outline/TrashIcon";import p6 from"@heroicons/react/24/solid/CheckBadgeIcon";import d6 from"@heroicons/react/24/solid/CheckCircleIcon";import u6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as m6,useState as Sa}from"react";import gr,{css as ng}from"styled-components";import{jsx as eg}from"react/jsx-runtime";var bn=({style:e,...t})=>eg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:eg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Ne,jsxs as tg}from"react/jsx-runtime";var En=({style:e,...t})=>tg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[tg("g",{clipPath:"url(#clip0_113_33841)",children:[Ne("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Ne("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Ne("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Ne("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Ne("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Ne("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Ne("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Ne("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Ne("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Ne("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Ne("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Ne("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Ne("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Ne("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Ne("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Ne("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Ne("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Ne("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Ne("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Ne("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Ne("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Ne("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Ne("defs",{children:Ne("clipPath",{id:"clip0_113_33841",children:Ne("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Hp,jsx as me,jsxs as $t}from"react/jsx-runtime";var rg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=Sa([]),i=t?e.length:2,s=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",l=async c=>{a(u=>u.concat([c])),await r(c),a(u=>u.filter(f=>f!==c))};return $t("div",{children:[me(w6,{children:"Your passkeys"}),$t(ag,{children:[e.slice(0,i).map(c=>$t(T6,{children:[$t("div",{children:[me(b6,{children:s(c)}),$t(E6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),me(P6,{disabled:n.includes(c.credentialId),onClick:()=>l(c.credentialId),children:n.includes(c.credentialId)?me(zr,{}):me(c6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&me(g6,{onClick:o,children:"View all"})]})]})},h6=()=>$t(ag,{children:[$t(qt,{children:[me(Gt,{children:me(p6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),$t(qt,{children:[me(Gt,{children:me(u6,{})}),"More secure than a password."]}),$t(qt,{children:[me(Gt,{children:me(l6,{})}),"Takes seconds to set up and use."]})]}),ig=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=k(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[a,i]=Sa(!1),[s,l]=Sa(""),[c,u]=Sa(!1),[f,m]=Sa(!1);m6(()=>{n.length===0&&m(!1)},[n.length]);let v=()=>{i(!0),r().then(()=>u(!0)).catch(y=>{if(y instanceof Ze){if(y.privyErrorCode==="cannot_link_more_of_type"){l("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){l("Passkey request timed out or rejected by user.");return}}l("Unknown error occurred.")}).finally(()=>{i(!1)})},w=async y=>(i(!0),await t(y).then(()=>u(!0)).catch(T=>{if(T instanceof Ze&&T.privyErrorCode==="missing_or_invalid_mfa"){l("Cannot unlink a passkey enrolled in MFA");return}l("Unknown error occurred.")}).finally(()=>{i(!1)}));return c?$t(Hp,{children:[me(P,{onClose:()=>o()},"header"),me(Ae,{children:me(Ge,{status:"success",children:me(d6,{})})}),me(og,{children:"Passkey added"}),me(v6,{children:"From now on, you can use your passkey to log in."}),me(Ct,{children:me(D,{onClick:()=>o(),children:"Done"})}),me(K,{})]}):f?$t(Hp,{children:[me(P,{backFn:()=>m(!1),onClose:()=>o()},"header"),me(rg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>m(!0)}),me(K,{})]}):$t(Hp,{children:[me(P,{onClose:()=>o()},"header"),me(Ae,{children:$t(ql,{children:[me(bn,{}),me(En,{})]})}),me(og,{children:"Secure your account with a passkey"}),me(C6,{}),n.length===0?me(h6,{}):me(rg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>m(!0)}),$t(Ct,{style:{marginTop:"12px"},children:[s&&me(f6,{fail:!0,children:s}),me(D,{onClick:v,loading:a,children:"Add new passkey"})]}),me(K,{})]})},ql=gr.div`
1807
1807
  display: flex;
1808
1808
  align-items: center;
1809
1809
  justify-content: center;
@@ -1827,7 +1827,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1827
1827
  display: flex;
1828
1828
  justify-content: flex-beginngin;
1829
1829
  width: 100%;
1830
- `,h6=ng`
1830
+ `,y6=ng`
1831
1831
  && {
1832
1832
  width: 100%;
1833
1833
  font-size: 0.875rem;
@@ -1852,8 +1852,8 @@ You will need this password to access your ${e} wallet on a new device. Please k
1852
1852
  box-shadow: none;
1853
1853
  }
1854
1854
  }
1855
- `,y6=gr.button`
1856
- ${h6}
1855
+ `,g6=gr.button`
1856
+ ${y6}
1857
1857
  `,ag=gr.div`
1858
1858
  display: flex;
1859
1859
  flex-direction: column;
@@ -1867,13 +1867,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1867
1867
  line-height: 18px;
1868
1868
  text-align: center;
1869
1869
  font-weight: 600;
1870
- `,g6=gr.div`
1870
+ `,v6=gr.div`
1871
1871
  font-size: 0.875rem;
1872
1872
  text-align: center;
1873
1873
  margin-top: 10px;
1874
- `,v6=gr.div`
1875
- height: 32px;
1876
1874
  `,C6=gr.div`
1875
+ height: 32px;
1876
+ `,w6=gr.div`
1877
1877
  line-height: 20px;
1878
1878
  height: 20px;
1879
1879
  font-size: 1em;
@@ -1881,18 +1881,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1881
1881
  display: flex;
1882
1882
  justify-content: flex-beginning;
1883
1883
  width: 100%;
1884
- `,w6=gr.div`
1884
+ `,b6=gr.div`
1885
1885
  font-size: 1em;
1886
1886
  line-height: 1.3em;
1887
1887
  font-weight: 500;
1888
1888
  color: var(--privy-color-foreground-2);
1889
1889
  padding: 0.2em 0;
1890
- `,b6=gr.div`
1890
+ `,E6=gr.div`
1891
1891
  font-size: 0.875rem;
1892
1892
  line-height: 1rem;
1893
1893
  color: #64668b;
1894
1894
  padding: 0.2em 0;
1895
- `,E6=gr.div`
1895
+ `,T6=gr.div`
1896
1896
  display: flex;
1897
1897
  align-items: center;
1898
1898
  justify-content: space-between;
@@ -1905,7 +1905,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1905
1905
  border: 1px solid #e2e3f0 !important;
1906
1906
  width: 100%;
1907
1907
  height: 5em;
1908
- `,T6=ng`
1908
+ `,S6=ng`
1909
1909
  :focus,
1910
1910
  :hover,
1911
1911
  :active {
@@ -1922,9 +1922,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1922
1922
  svg:hover {
1923
1923
  color: var(--privy-color-foreground-3);
1924
1924
  }
1925
- `,S6=gr.button`
1926
- ${T6}
1927
- `;import P6 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as _6,jsx as Uo,jsxs as A6}from"react/jsx-runtime";var sg=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=x(),{initLoginWithSms:a}=k();async function i({qualifiedPhoneNumber:s}){try{await a(s),o("AWAITING_PASSWORDLESS_CODE")}catch(l){n({errorModalData:{error:l,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return A6(_6,{children:[Uo(P,{},"header"),Uo(ee,{}),Uo(xe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Uo(P6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Uo(mr,{children:Uo(Pi,{stacked:!0,onSubmit:i})}),Uo(te,{}),Uo($,{})]})};import{Fragment as x6,jsx as _a,jsxs as k6}from"react/jsx-runtime";var lg=()=>{let{linkingOrConnectingHint:e}=k(),{app:t}=x(),r=e?`Link the wallet with address ${pr(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return k6(x6,{children:[_a(P,{},"header"),_a(jr,{title:"Link your wallet",description:r}),_a(Pr,{children:_a(ui,{connectOnly:!1})}),_a($,{})]})};import{jsx as cg,jsxs as R6}from"react/jsx-runtime";var pg=({style:e,...t})=>R6("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[cg("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),cg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as I6,jsx as Fo,jsxs as dg}from"react/jsx-runtime";var ug=()=>{let{closePrivyModal:e}=k(),{navigate:t}=x();return dg(I6,{children:[Fo(P,{},"header"),Fo(ee,{}),Fo(pg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Fo(jr,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),dg(mr,{children:[Fo(U,{onClick:()=>t("LANDING"),children:"Try again"}),Fo(Sr,{onClick:()=>e(),children:"Cancel"})]}),Fo(te,{}),Fo($,{})]})};import f7 from"@heroicons/react/24/solid/CheckBadgeIcon";import h7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import y7 from"@heroicons/react/24/solid/IdentificationIcon";import g7 from"@heroicons/react/24/solid/PhoneIcon";import v7 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Pg from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as C7,useState as Ai}from"react";import{useContext as W6}from"react";function Aa(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=W6(ge);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as M6}from"react";function Mr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenroll:i,enrollInMfa:s}=M6(ge);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenrollWithSms:()=>i("sms"),unenrollWithTotp:()=>i("totp"),unenrollWithPasskey:()=>i("passkey"),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}import O6 from"styled-components";import{jsx as mg,jsxs as N6}from"react/jsx-runtime";var fg=e=>N6(L6,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[mg("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),mg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),L6=O6.svg`
1925
+ `,P6=gr.button`
1926
+ ${S6}
1927
+ `;import _6 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as A6,jsx as Uo,jsxs as x6}from"react/jsx-runtime";var sg=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=x(),{initLoginWithSms:a}=k();async function i({qualifiedPhoneNumber:s}){try{await a(s),o("AWAITING_PASSWORDLESS_CODE")}catch(l){n({errorModalData:{error:l,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return x6(A6,{children:[Uo(P,{},"header"),Uo(ee,{}),Uo(xe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Uo(_6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Uo(mr,{children:Uo(Si,{stacked:!0,onSubmit:i})}),Uo(te,{}),Uo($,{})]})};import{Fragment as k6,jsx as Pa,jsxs as R6}from"react/jsx-runtime";var lg=()=>{let{linkingOrConnectingHint:e}=k(),{app:t}=x(),r=e?`Link the wallet with address ${pr(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return R6(k6,{children:[Pa(P,{},"header"),Pa(jr,{title:"Link your wallet",description:r}),Pa(Pr,{children:Pa(di,{connectOnly:!1})}),Pa($,{})]})};import{jsx as cg,jsxs as I6}from"react/jsx-runtime";var pg=({style:e,...t})=>I6("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[cg("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),cg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as M6,jsx as Fo,jsxs as dg}from"react/jsx-runtime";var ug=()=>{let{closePrivyModal:e}=k(),{navigate:t}=x();return dg(M6,{children:[Fo(P,{},"header"),Fo(ee,{}),Fo(pg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Fo(jr,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),dg(mr,{children:[Fo(D,{onClick:()=>t("LANDING"),children:"Try again"}),Fo(Sr,{onClick:()=>e(),children:"Cancel"})]}),Fo(te,{}),Fo($,{})]})};import f7 from"@heroicons/react/24/solid/CheckBadgeIcon";import y7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import g7 from"@heroicons/react/24/solid/IdentificationIcon";import v7 from"@heroicons/react/24/solid/PhoneIcon";import C7 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Pg from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as w7,useState as _i}from"react";import{useContext as W6}from"react";function _a(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=W6(ge);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as O6}from"react";function Wr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenroll:i,enrollInMfa:s}=O6(ge);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenrollWithSms:()=>i("sms"),unenrollWithTotp:()=>i("totp"),unenrollWithPasskey:()=>i("passkey"),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}import L6 from"styled-components";import{jsx as mg,jsxs as D6}from"react/jsx-runtime";var hg=e=>D6(N6,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[mg("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),mg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),N6=L6.svg`
1928
1928
  height: 90px;
1929
1929
  width: 90px;
1930
1930
 
@@ -1935,7 +1935,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1935
1935
  > path {
1936
1936
  fill: white;
1937
1937
  }
1938
- `;import Vp from"@heroicons/react/20/solid/CheckIcon";import D6 from"@heroicons/react/24/outline/ChevronRightIcon";import U6 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import F6 from"@heroicons/react/24/outline/FingerPrintIcon";import B6 from"@heroicons/react/24/outline/PhoneIcon";import Gp from"@heroicons/react/24/outline/TrashIcon";import H6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as V6,jsx as ve,jsxs as Kt}from"react/jsx-runtime";var hg=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:a,error:i,onClose:s,onBackToIntro:l,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let h=t.reduce((g,w)=>({...g,[w]:!0}),{}),m=r.reduce((g,w)=>({...g,[w]:!0}),{});return Kt(V6,{children:[ve(P,{backFn:e?l:void 0,onClose:s},"header"),ve(Ae,{children:ve(Ge,{children:ve(H6,{})})}),ve(pe,{children:"Choose a verification method"}),t.length>0?ve(ue,{children:"To add or delete verification methods, verification is required."}):ve(ue,{children:"How would you like to verify your identity? You can change this later."}),i&&ve(el,{style:{marginTop:"1.25rem"},children:i.message}),Kt(Ys,{children:[(m.totp||h.totp)&&Kt(Zs,{children:[ve(Se,{style:{justifyContent:"center"},disabled:h.totp||n,onClick:()=>c("totp"),children:n?ve(ct,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Kt(Xs,{children:[Kt(Js,{children:[ve(U6,{}),"Authenticator App"]}),h.totp?Kt(dn,{children:[ve(Vp,{}),"Added"]}):ve(dn,{children:"Recommended"})]})}),h.totp&&ve(Qs,{onClick:()=>u("totp"),children:ve(Gp,{})})]},"totp"),(m.sms||h.sms)&&Kt(Zs,{children:[ve(Se,{disabled:h.sms||o,onClick:()=>c("sms"),children:Kt(Xs,{children:[Kt(Js,{children:[ve(B6,{}),"SMS"]}),h.sms&&Kt(dn,{children:[ve(Vp,{}),"Added"]}),o&&ve(dn,{children:"Disabled"})]})}),h.sms&&ve(Qs,{onClick:()=>u("sms"),children:ve(Gp,{})})]},"sms"),(m.passkey||h.passkey)&&Kt(Zs,{children:[ve(Se,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:h.passkey||a,children:a?ve(ct,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Kt(Xs,{children:[Kt(Js,{children:[ve(F6,{}),"Passkey"]}),h.passkey?Kt(dn,{children:[ve(Vp,{}),"Added"]}):ve(dn,{isAccent:!0,children:ve(D6,{})})]})}),h.passkey&&ve(Qs,{onClick:()=>u("passkey"),children:ve(Gp,{})})]},"passkey")]}),ve(K,{})]})};import G6 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import q6 from"@heroicons/react/24/outline/ClockIcon";import z6 from"@heroicons/react/24/outline/ShieldCheckIcon";import $6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as K6,useState as xa}from"react";import zl from"styled-components";import{Fragment as qp,jsx as ce,jsxs as vr}from"react/jsx-runtime";var gg=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=H(),{data:n}=x(),{initLinkWithPasskey:a,linkWithPasskey:i}=k(),{initEnrollmentWithPasskey:s,submitEnrollmentWithPasskey:l}=Mr(),[c,u]=xa(!1),[h,m]=xa(!1),[g,w]=xa(!1),[y,T]=xa(null),_=K6(()=>o?.linkedAccounts.filter(N=>N.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},S=async N=>{u(!0);try{await s(),await l({credentialIds:N}),w(!0)}catch(W){T(W)}finally{u(!1)}},I=async()=>{m(!0),T(null);try{await a();let W=(await i())?.linkedAccounts.filter(R=>R.type==="passkey").map(R=>R.credentialId)??[];await S(W)}catch(N){T(N)}finally{m(!1)}};return _.length===0||h?ce(j6,{onReset:r,onClose:t,onClick:I,isCreating:h}):g?ce(Z6,{onClick:b,onClose:b}):y?ce(ga,{error:y,backFn:()=>T(null),onClick:()=>T(null)}):ce(Y6,{passkeys:_,isSubmitting:c,isCreating:h,onReset:r,onClose:t,onSubmitEnrollment:()=>S(_.map(N=>N.credentialId)),onAddPasskey:I})},j6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>vr(qp,{children:[ce(P,{backFn:e,onClose:t},"header"),ce(Ae,{children:vr(ql,{children:[ce(En,{}),ce(Tn,{})]})}),ce(pe,{children:"Set up passkey verification"}),vr(pn,{children:[vr(qt,{children:[ce(Gt,{children:ce(z6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),vr(qt,{children:[ce(Gt,{children:ce(q6,{})}),"Takes seconds to set up and use"]}),vr(qt,{children:[ce(Gt,{children:ce(G6,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ce(U,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ce(K,{})]}),Y6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:a,isCreating:i})=>{let[s,l]=xa(!1),c=s?n.length:n.length>3?2:3;return vr(qp,{children:[ce(P,{backFn:s?()=>l(!1):e,onClose:t},"header"),!s&&ce(Ae,{children:vr(ql,{children:[ce(En,{}),ce(Tn,{})]})}),ce(pe,{children:"Enable your passkeys for verification"}),vr(pn,{children:[n.slice(0,c).map(u=>vr(Q6,{children:[ce(J6,{children:e7(u)}),vr(X6,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!s&&n.length>3&&ce(yg,{onClick:()=>l(!0),children:"View All"})]}),ce(U,{style:{marginTop:"1.5rem"},onClick:o,loading:a,children:"Enable passkeys"}),n.length<5&&ce(yg,{style:{marginTop:"0.5rem"},onClick:r,disabled:i,children:i?ce(ct,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ce(K,{})]})},Z6=({onClick:e,onClose:t})=>vr(qp,{children:[ce(P,{onClose:t},"header"),ce(Ae,{children:ce(Ge,{status:"success",children:ce($6,{})})}),ce(pe,{children:"Passkey verification added"}),ce(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ce(Ct,{children:ce(U,{onClick:e,children:"Done"})}),ce(K,{})]}),Q6=zl.div`
1938
+ `;import Vp from"@heroicons/react/20/solid/CheckIcon";import U6 from"@heroicons/react/24/outline/ChevronRightIcon";import F6 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import B6 from"@heroicons/react/24/outline/FingerPrintIcon";import H6 from"@heroicons/react/24/outline/PhoneIcon";import Gp from"@heroicons/react/24/outline/TrashIcon";import V6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as G6,jsx as ve,jsxs as Kt}from"react/jsx-runtime";var fg=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:a,error:i,onClose:s,onBackToIntro:l,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let f=t.reduce((v,w)=>({...v,[w]:!0}),{}),m=r.reduce((v,w)=>({...v,[w]:!0}),{});return Kt(G6,{children:[ve(P,{backFn:e?l:void 0,onClose:s},"header"),ve(Ae,{children:ve(Ge,{children:ve(V6,{})})}),ve(pe,{children:"Choose a verification method"}),t.length>0?ve(ue,{children:"To add or delete verification methods, verification is required."}):ve(ue,{children:"How would you like to verify your identity? You can change this later."}),i&&ve(Xs,{style:{marginTop:"1.25rem"},children:i.message}),Kt(js,{children:[(m.totp||f.totp)&&Kt(Ys,{children:[ve(Se,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?ve(ct,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Kt(Js,{children:[Kt(Qs,{children:[ve(F6,{}),"Authenticator App"]}),f.totp?Kt(dn,{children:[ve(Vp,{}),"Added"]}):ve(dn,{children:"Recommended"})]})}),f.totp&&ve(Zs,{onClick:()=>u("totp"),children:ve(Gp,{})})]},"totp"),(m.sms||f.sms)&&Kt(Ys,{children:[ve(Se,{disabled:f.sms||o,onClick:()=>c("sms"),children:Kt(Js,{children:[Kt(Qs,{children:[ve(H6,{}),"SMS"]}),f.sms&&Kt(dn,{children:[ve(Vp,{}),"Added"]}),o&&ve(dn,{children:"Disabled"})]})}),f.sms&&ve(Zs,{onClick:()=>u("sms"),children:ve(Gp,{})})]},"sms"),(m.passkey||f.passkey)&&Kt(Ys,{children:[ve(Se,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||a,children:a?ve(ct,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Kt(Js,{children:[Kt(Qs,{children:[ve(B6,{}),"Passkey"]}),f.passkey?Kt(dn,{children:[ve(Vp,{}),"Added"]}):ve(dn,{isAccent:!0,children:ve(U6,{})})]})}),f.passkey&&ve(Zs,{onClick:()=>u("passkey"),children:ve(Gp,{})})]},"passkey")]}),ve(K,{})]})};import q6 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import z6 from"@heroicons/react/24/outline/ClockIcon";import $6 from"@heroicons/react/24/outline/ShieldCheckIcon";import K6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as j6,useState as Aa}from"react";import zl from"styled-components";import{Fragment as qp,jsx as ce,jsxs as vr}from"react/jsx-runtime";var gg=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=H(),{data:n}=x(),{initLinkWithPasskey:a,linkWithPasskey:i}=k(),{initEnrollmentWithPasskey:s,submitEnrollmentWithPasskey:l}=Wr(),[c,u]=Aa(!1),[f,m]=Aa(!1),[v,w]=Aa(!1),[y,T]=Aa(null),_=j6(()=>o?.linkedAccounts.filter(N=>N.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},S=async N=>{u(!0);try{await s(),await l({credentialIds:N}),w(!0)}catch(M){T(M)}finally{u(!1)}},I=async()=>{m(!0),T(null);try{await a();let M=(await i())?.linkedAccounts.filter(R=>R.type==="passkey").map(R=>R.credentialId)??[];await S(M)}catch(N){T(N)}finally{m(!1)}};return _.length===0||f?ce(Y6,{onReset:r,onClose:t,onClick:I,isCreating:f}):v?ce(Q6,{onClick:b,onClose:b}):y?ce(ya,{error:y,backFn:()=>T(null),onClick:()=>T(null)}):ce(Z6,{passkeys:_,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>S(_.map(N=>N.credentialId)),onAddPasskey:I})},Y6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>vr(qp,{children:[ce(P,{backFn:e,onClose:t},"header"),ce(Ae,{children:vr(ql,{children:[ce(bn,{}),ce(En,{})]})}),ce(pe,{children:"Set up passkey verification"}),vr(pn,{children:[vr(qt,{children:[ce(Gt,{children:ce($6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),vr(qt,{children:[ce(Gt,{children:ce(z6,{})}),"Takes seconds to set up and use"]}),vr(qt,{children:[ce(Gt,{children:ce(q6,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ce(D,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ce(K,{})]}),Z6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:a,isCreating:i})=>{let[s,l]=Aa(!1),c=s?n.length:n.length>3?2:3;return vr(qp,{children:[ce(P,{backFn:s?()=>l(!1):e,onClose:t},"header"),!s&&ce(Ae,{children:vr(ql,{children:[ce(bn,{}),ce(En,{})]})}),ce(pe,{children:"Enable your passkeys for verification"}),vr(pn,{children:[n.slice(0,c).map(u=>vr(J6,{children:[ce(X6,{children:t7(u)}),vr(e7,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!s&&n.length>3&&ce(yg,{onClick:()=>l(!0),children:"View All"})]}),ce(D,{style:{marginTop:"1.5rem"},onClick:o,loading:a,children:"Enable passkeys"}),n.length<5&&ce(yg,{style:{marginTop:"0.5rem"},onClick:r,disabled:i,children:i?ce(ct,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ce(K,{})]})},Q6=({onClick:e,onClose:t})=>vr(qp,{children:[ce(P,{onClose:t},"header"),ce(Ae,{children:ce(Ge,{status:"success",children:ce(K6,{})})}),ce(pe,{children:"Passkey verification added"}),ce(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ce(Ct,{children:ce(D,{onClick:e,children:"Done"})}),ce(K,{})]}),J6=zl.div`
1939
1939
  && {
1940
1940
  padding: 0.75rem 1rem;
1941
1941
  text-align: left;
@@ -1943,19 +1943,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1943
1943
  border: 1px solid var(--privy-color-foreground-4);
1944
1944
  width: 100%;
1945
1945
  }
1946
- `,J6=zl.div`
1946
+ `,X6=zl.div`
1947
1947
  font-size: 0.875rem;
1948
1948
  line-height: 1.375rem;
1949
1949
  font-weight: 500;
1950
1950
 
1951
1951
  color: var(--privy-color-foreground-1);
1952
- `,X6=zl.div`
1952
+ `,e7=zl.div`
1953
1953
  font-size: 0.75rem;
1954
1954
  font-weight: 400;
1955
1955
  line-height: 1.125rem;
1956
1956
 
1957
1957
  color: var(--privy-color-foreground-2);
1958
- `,e7=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",yg=zl.button`
1958
+ `,t7=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",yg=zl.button`
1959
1959
  && {
1960
1960
  width: 100%;
1961
1961
  font-size: 0.875rem;
@@ -1980,7 +1980,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1980
1980
  box-shadow: none;
1981
1981
  }
1982
1982
  }
1983
- `;import c7 from"@heroicons/react/24/solid/CheckCircleIcon";import wg from"@heroicons/react/24/solid/PhoneIcon";import{useState as $l}from"react";import{useState as zp}from"react";import{isMobile as t7}from"react-device-detect";import Cg from"styled-components";import{Fragment as l7,jsx as ka,jsxs as s7}from"react/jsx-runtime";var Ra=6,r7=new Array(Ra).fill("");function o7(e){return e.replace(/\s+/g,"")}function $p(e){return/^[0-9]{1}$/.test(e)}function vg(e){return e.length===Ra&&e.every($p)}function n7(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Sn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=zp(r7),[i,s]=zp(null),[l,c]=zp(null),u=async w=>{w.preventDefault();let y=o7(w.currentTarget.value);if(y==="")return;let T=n7(n,$p),_=y.split(""),b=!_.every($p),S=_.length+T>Ra;if(b){s("Passcode can only be numbers"),c(1);return}if(S){s("Passcode must be exactly 6 numbers"),c(1);return}s(null),c(null);let I=Number(w.currentTarget.name?.charAt(4)),N=[...y||[""]].slice(0,Ra-I),W=[...n.slice(0,I),...N,...n.slice(I+N.length)];a(W);let R=N.length,B=Math.min(Math.max(I+R,0),Ra-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),vg(W))try{await e(W.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(Y){c(1),s(Y.message)}else try{await e(null)}catch(Y){c(1),s(Y.message)}},h=w=>{l===1&&(s(null),c(null));let y=[...n.slice(0,w),"",...n.slice(w+1)];a(y),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),vg(y)?e(y.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return ka(l7,{children:s7(i7,{children:[ka("div",{children:n.map((w,y)=>ka("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:u,onKeyUp:T=>{T.key==="Backspace"&&h(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:g,autoComplete:t7?"one-time-code":"off",disabled:t},y))}),ka("div",{children:ka(a7,{fail:!!r||!!i,children:r||i})})]})})},i7=Cg.div`
1983
+ `;import p7 from"@heroicons/react/24/solid/CheckCircleIcon";import wg from"@heroicons/react/24/solid/PhoneIcon";import{useState as $l}from"react";import{useState as zp}from"react";import{isMobile as r7}from"react-device-detect";import Cg from"styled-components";import{Fragment as c7,jsx as xa,jsxs as l7}from"react/jsx-runtime";var ka=6,o7=new Array(ka).fill("");function n7(e){return e.replace(/\s+/g,"")}function $p(e){return/^[0-9]{1}$/.test(e)}function vg(e){return e.length===ka&&e.every($p)}function i7(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Tn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=zp(o7),[i,s]=zp(null),[l,c]=zp(null),u=async w=>{w.preventDefault();let y=n7(w.currentTarget.value);if(y==="")return;let T=i7(n,$p),_=y.split(""),b=!_.every($p),S=_.length+T>ka;if(b){s("Passcode can only be numbers"),c(1);return}if(S){s("Passcode must be exactly 6 numbers"),c(1);return}s(null),c(null);let I=Number(w.currentTarget.name?.charAt(4)),N=[...y||[""]].slice(0,ka-I),M=[...n.slice(0,I),...N,...n.slice(I+N.length)];a(M);let R=N.length,B=Math.min(Math.max(I+R,0),ka-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),vg(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(Y){c(1),s(Y.message)}else try{await e(null)}catch(Y){c(1),s(Y.message)}},f=w=>{l===1&&(s(null),c(null));let y=[...n.slice(0,w),"",...n.slice(w+1)];a(y),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),vg(y)?e(y.join("")):e(null)},v=o?"success":!!(r||i)?"fail":"";return xa(c7,{children:l7(a7,{children:[xa("div",{children:n.map((w,y)=>xa("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:u,onKeyUp:T=>{T.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:v,autoComplete:r7?"one-time-code":"off",disabled:t},y))}),xa("div",{children:xa(s7,{fail:!!r||!!i,children:r||i})})]})})},a7=Cg.div`
1984
1984
  display: flex;
1985
1985
  flex-direction: column;
1986
1986
  width: 100%;
@@ -2048,7 +2048,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2048
2048
  transform: translate(1px, 0px);
2049
2049
  }
2050
2050
  }
2051
- `,a7=Cg.div`
2051
+ `,s7=Cg.div`
2052
2052
  line-height: 20px;
2053
2053
  font-size: 13px;
2054
2054
  display: flex;
@@ -2056,7 +2056,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2056
2056
  width: 100%;
2057
2057
 
2058
2058
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2059
- `;import{Fragment as Kp,jsx as Me,jsxs as Pn}from"react/jsx-runtime";var bg=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=$l(""),[a,i]=$l(!1),[s,l]=$l(null),[c,u]=$l("enroll"),{initEnrollmentWithSms:h,submitEnrollmentWithSms:m}=Mr(),{app:g,data:w}=x();function y(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:S}){try{await h({phoneNumber:S}),n(S),u("verify")}catch(I){l(I)}}async function _(S){try{if(!S)return;await m({phoneNumber:o,mfaCode:S}),i(!0)}catch(I){throw ll(I)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):vn(I)?new Error("The code you entered is not valid"):gn(I)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):cl(I)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return s?Me(ga,{error:s,backFn:()=>l(null),onClick:()=>l(null)}):c==="enroll"?Pn(Kp,{children:[Me(P,{backFn:t,onClose:r},"header"),Me(Ae,{children:Me(Ge,{children:Me(wg,{})})}),Me(pe,{children:"Set up SMS verification"}),Me(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),Pn(ur,{children:[Me(Pi,{onSubmit:T}),Pn(vf,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),Me(K,{})]}):a?Pn(Kp,{children:[Me(P,{onClose:y},"header"),Me(Ae,{children:Me(Ge,{status:"success",children:Me(c7,{})})}),Me(pe,{children:"SMS verification added"}),Me(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Me(Ct,{children:Me(U,{onClick:y,children:"Done"})}),Me(K,{})]}):Pn(Kp,{children:[Me(P,{backFn:b,onClose:r},"header"),Me(Ae,{children:Me(Ge,{children:Me(wg,{})})}),Me(pe,{children:"Enter enrollment code"}),Pn(ur,{children:[Me(Sn,{onChange:_}),Pn(ue,{children:["To continue, enter the 6-digit code sent to ",Me("strong",{children:Ly(o)})]})]}),Me(K,{})]})};import u7 from"@heroicons/react/24/solid/CheckCircleIcon";import m7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as Tg}from"react";import p7 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as d7}from"react/jsx-runtime";var Eg=({size:e,authUrl:t})=>d7(Si,{url:t,squareLogoElement:p7,size:e,fgColor:"#1F1F1F"});import{Fragment as jp,jsx as Re,jsxs as Ia}from"react/jsx-runtime";var Sg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,a]=Tg("enroll"),[i,s]=Tg(!1),{submitEnrollmentWithTotp:l}=Mr(),{data:c}=x();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function h(){a("verify")}async function m(w){try{if(!w)return;await l({mfaCode:w}),s(!0)}catch(y){throw ll(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):vn(y)?new Error("The code you entered is not valid"):gn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):cl(y)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?a("enroll"):r()}return n==="enroll"?Ia(jp,{children:[Re(P,{backFn:r,onClose:t},"header"),Re(pe,{children:"Scan QR code"}),Re(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Re(ii,{children:Re(Eg,{authUrl:o.authUrl,size:200})}),Ia(Ct,{children:[Re(xt,{children:Re(Oo,{itemName:"secret",text:o.secret})}),Re(U,{onClick:h,children:"Continue"})]}),Re(K,{})]}):i?Ia(jp,{children:[Re(P,{onClose:u},"header"),Re(Ae,{children:Re(Ge,{status:"success",children:Re(u7,{})})}),Re(pe,{children:"Authenticator app verification added"}),Re(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Re(Ct,{children:Re(U,{onClick:u,children:"Done"})}),Re(K,{})]}):Ia(jp,{children:[Re(P,{backFn:g,onClose:t},"header"),Re(Ae,{children:Re(Ge,{children:Re(m7,{})})}),Re(pe,{children:"Enter enrollment code"}),Re(ur,{children:Re(Sn,{onChange:m})}),Ia(ue,{children:["To continue, enter the 6-digit code generated from your ",Re("strong",{children:"authenticator app"})]}),Re(K,{})]})};import{Fragment as xi,jsx as j,jsxs as or}from"react/jsx-runtime";var _g=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=Ai(null),{unenrollWithSms:n,unenrollWithTotp:a,unenrollWithPasskey:i}=Mr(),{app:s,ready:l,data:c,onUserCloseViaDialogOrKeybindRef:u}=x(),{closePrivyModal:h}=k(),{promptMfa:m}=Aa(),{initEnrollmentWithTotp:g}=Mr(),[w,y]=Ai(!1),[T,_]=Ai(null),[b,S]=Ai(null),I=()=>{h({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:N,submitEnrollmentWithPasskey:W}=Mr(),[R,B]=Ai(!1),[q,Y]=Ai(null);u.current=I;let M=e?.mfaMethods.includes("sms"),z=!!e?.phone,L=e?.mfaMethods.includes("totp"),Ue=e?.mfaMethods.includes("passkey"),Ye=M||L||Ue,Oe=e?.linkedAccounts.filter(se=>se.type==="passkey").map(se=>se.credentialId)??[];C7(()=>{Ye&&y(!0)},[Ye]);function de(){o(null),_(null)}function J(){y(!1)}async function Ee(){B(!0);try{await N(),await W({credentialIds:Oe})}catch(se){Y(se)}finally{B(!1)}}async function _e(se){if(await m().catch(Y),se==="totp"){_(se),S(null),g().then(Dr=>{S(Dr)}).catch(()=>{S(null),de()});return}if(se==="passkey"&&Oe.length===1)return await Ee();_(se)}if(!l||!e||!s)return or(xi,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(fg,{})}),j(ur,{children:j(ct,{})}),j(K,{})]});async function vt(){o(null);try{await n()}catch{o(null)}}async function sr(){o(null);try{await a()}catch{o(null)}}async function Ot(){o(null);try{await m(),await i()}catch{o(null)}}if(r==="sms")return or(xi,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(g7,{})})}),j(pe,{children:"Remove SMS verification?"}),or(ue,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),j(Ct,{children:j(U,{warn:!0,onClick:vt,children:"Remove SMS for MFA"})}),j(K,{})]});if(r==="totp")return or(xi,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(h7,{})})}),j(pe,{children:"Remove Authenticator App verification?"}),or(ue,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),j(Ct,{children:j(U,{warn:!0,onClick:sr,children:"Remove Authenticator App for MFA"})}),j(K,{})]});if(r==="passkey")return or(xi,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(v7,{})})}),j(pe,{children:"Are you sure you want to remove passkey verification?"}),j(ue,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),j(Ct,{children:j(U,{warn:!0,onClick:Ot,children:"Yes, remove"})}),j(K,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Ye)return or(xi,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(Pg,{})})}),j(pe,{children:"Add more security"}),or(ue,{children:[s?.name," does not have any verification methods enabled."]}),j(Ct,{children:j(U,{onClick:I,children:"Close"})}),j(K,{})]});let it=!Ye&&!w;return it?or(xi,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(Pg,{})})}),j(pe,{children:"Transaction Protection"}),j(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),or(pn,{children:[or(qt,{children:[j(Gt,{children:j(f7,{})}),"Enable 2-Step verification for your ",s?.name," wallet."]}),or(qt,{children:[j(Gt,{children:j(y7,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),or(Ct,{children:[j(U,{onClick:()=>y(!0),children:"Continue"}),j(Sr,{onClick:I,children:"Not now"})]}),j(K,{})]}):T==="sms"?j(bg,{onComplete:I,onReset:de,onClose:I}):T==="totp"&&b?j(Sg,{onComplete:I,onClose:I,onReset:de,totpInfo:b}):T==="passkey"?j(gg,{onComplete:I,onReset:de,onClose:I}):j(hg,{showIntro:it,userMfaMethods:e.mfaMethods,appMfaMethods:s.mfa.methods,userHasAuthSms:z,onBackToIntro:J,handleSelectMethod:_e,isTotpLoading:T==="totp"&&!b,isPasskeyLoading:R,error:q,onClose:I,setRemovingMfaMethod:o})};import hb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import yb from"@heroicons/react/24/outline/FingerPrintIcon";import gb from"@heroicons/react/24/outline/PhoneIcon";import vb from"@heroicons/react/24/outline/ShieldCheckIcon";import Cb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import wb from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as bb,useState as Ua}from"react";import{useMemo as ab,useEffect as sb,useState as t1}from"react";import lb from"styled-components";import{calculateTotalGasEstimate as cb,populateTransactionRequest as pb}from"@privy-io/js-sdk-core";import jg from"styled-components";import xg from"styled-components";import{jsx as Ag,jsxs as E7}from"react/jsx-runtime";var Kl=({label:e,children:t,valueStyles:r})=>E7(w7,{children:[Ag("div",{children:e}),Ag(b7,{style:{...r},children:t})]}),w7=xg.div`
2059
+ `;import{Fragment as Kp,jsx as We,jsxs as Sn}from"react/jsx-runtime";var bg=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=$l(""),[a,i]=$l(!1),[s,l]=$l(null),[c,u]=$l("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:m}=Wr(),{app:v,data:w}=x();function y(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:S}){try{await f({phoneNumber:S}),n(S),u("verify")}catch(I){l(I)}}async function _(S){try{if(!S)return;await m({phoneNumber:o,mfaCode:S}),i(!0)}catch(I){throw sl(I)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):gn(I)?new Error("The code you entered is not valid"):yn(I)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(I)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return s?We(ya,{error:s,backFn:()=>l(null),onClick:()=>l(null)}):c==="enroll"?Sn(Kp,{children:[We(P,{backFn:t,onClose:r},"header"),We(Ae,{children:We(Ge,{children:We(wg,{})})}),We(pe,{children:"Set up SMS verification"}),We(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),Sn(ur,{children:[We(Si,{onSubmit:T}),Sn(gh,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),We(K,{})]}):a?Sn(Kp,{children:[We(P,{onClose:y},"header"),We(Ae,{children:We(Ge,{status:"success",children:We(p7,{})})}),We(pe,{children:"SMS verification added"}),We(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),We(Ct,{children:We(D,{onClick:y,children:"Done"})}),We(K,{})]}):Sn(Kp,{children:[We(P,{backFn:b,onClose:r},"header"),We(Ae,{children:We(Ge,{children:We(wg,{})})}),We(pe,{children:"Enter enrollment code"}),Sn(ur,{children:[We(Tn,{onChange:_}),Sn(ue,{children:["To continue, enter the 6-digit code sent to ",We("strong",{children:Ly(o)})]})]}),We(K,{})]})};import m7 from"@heroicons/react/24/solid/CheckCircleIcon";import h7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as Tg}from"react";import d7 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as u7}from"react/jsx-runtime";var Eg=({size:e,authUrl:t})=>u7(Ti,{url:t,squareLogoElement:d7,size:e,fgColor:"#1F1F1F"});import{Fragment as jp,jsx as Re,jsxs as Ra}from"react/jsx-runtime";var Sg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,a]=Tg("enroll"),[i,s]=Tg(!1),{submitEnrollmentWithTotp:l}=Wr(),{data:c}=x();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){a("verify")}async function m(w){try{if(!w)return;await l({mfaCode:w}),s(!0)}catch(y){throw sl(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):gn(y)?new Error("The code you entered is not valid"):yn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(y)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){n==="verify"?a("enroll"):r()}return n==="enroll"?Ra(jp,{children:[Re(P,{backFn:r,onClose:t},"header"),Re(pe,{children:"Scan QR code"}),Re(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Re(ni,{children:Re(Eg,{authUrl:o.authUrl,size:200})}),Ra(Ct,{children:[Re(xt,{children:Re(Oo,{itemName:"secret",text:o.secret})}),Re(D,{onClick:f,children:"Continue"})]}),Re(K,{})]}):i?Ra(jp,{children:[Re(P,{onClose:u},"header"),Re(Ae,{children:Re(Ge,{status:"success",children:Re(m7,{})})}),Re(pe,{children:"Authenticator app verification added"}),Re(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Re(Ct,{children:Re(D,{onClick:u,children:"Done"})}),Re(K,{})]}):Ra(jp,{children:[Re(P,{backFn:v,onClose:t},"header"),Re(Ae,{children:Re(Ge,{children:Re(h7,{})})}),Re(pe,{children:"Enter enrollment code"}),Re(ur,{children:Re(Tn,{onChange:m})}),Ra(ue,{children:["To continue, enter the 6-digit code generated from your ",Re("strong",{children:"authenticator app"})]}),Re(K,{})]})};import{Fragment as Ai,jsx as j,jsxs as or}from"react/jsx-runtime";var _g=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=_i(null),{unenrollWithSms:n,unenrollWithTotp:a,unenrollWithPasskey:i}=Wr(),{app:s,ready:l,data:c,onUserCloseViaDialogOrKeybindRef:u}=x(),{closePrivyModal:f}=k(),{promptMfa:m}=_a(),{initEnrollmentWithTotp:v}=Wr(),[w,y]=_i(!1),[T,_]=_i(null),[b,S]=_i(null),I=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:N,submitEnrollmentWithPasskey:M}=Wr(),[R,B]=_i(!1),[q,Y]=_i(null);u.current=I;let W=e?.mfaMethods.includes("sms"),z=!!e?.phone,L=e?.mfaMethods.includes("totp"),Ue=e?.mfaMethods.includes("passkey"),Ye=W||L||Ue,Oe=e?.linkedAccounts.filter(se=>se.type==="passkey").map(se=>se.credentialId)??[];w7(()=>{Ye&&y(!0)},[Ye]);function de(){o(null),_(null)}function X(){y(!1)}async function Ee(){B(!0);try{await N(),await M({credentialIds:Oe})}catch(se){Y(se)}finally{B(!1)}}async function _e(se){if(await m().catch(Y),se==="totp"){_(se),S(null),v().then(Dr=>{S(Dr)}).catch(()=>{S(null),de()});return}if(se==="passkey"&&Oe.length===1)return await Ee();_(se)}if(!l||!e||!s)return or(Ai,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(hg,{})}),j(ur,{children:j(ct,{})}),j(K,{})]});async function vt(){o(null);try{await n()}catch{o(null)}}async function sr(){o(null);try{await a()}catch{o(null)}}async function Ot(){o(null);try{await m(),await i()}catch{o(null)}}if(r==="sms")return or(Ai,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(v7,{})})}),j(pe,{children:"Remove SMS verification?"}),or(ue,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),j(Ct,{children:j(D,{warn:!0,onClick:vt,children:"Remove SMS for MFA"})}),j(K,{})]});if(r==="totp")return or(Ai,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(y7,{})})}),j(pe,{children:"Remove Authenticator App verification?"}),or(ue,{children:["MFA adds an extra layer of security to your ",s?.name," account. Make sure you have other methods to secure your account."]}),j(Ct,{children:j(D,{warn:!0,onClick:sr,children:"Remove Authenticator App for MFA"})}),j(K,{})]});if(r==="passkey")return or(Ai,{children:[j(P,{backFn:de,onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(C7,{})})}),j(pe,{children:"Are you sure you want to remove passkey verification?"}),j(ue,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),j(Ct,{children:j(D,{warn:!0,onClick:Ot,children:"Yes, remove"})}),j(K,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Ye)return or(Ai,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(Pg,{})})}),j(pe,{children:"Add more security"}),or(ue,{children:[s?.name," does not have any verification methods enabled."]}),j(Ct,{children:j(D,{onClick:I,children:"Close"})}),j(K,{})]});let it=!Ye&&!w;return it?or(Ai,{children:[j(P,{onClose:I},"header"),j(Ae,{children:j(Ge,{children:j(Pg,{})})}),j(pe,{children:"Transaction Protection"}),j(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),or(pn,{children:[or(qt,{children:[j(Gt,{children:j(f7,{})}),"Enable 2-Step verification for your ",s?.name," wallet."]}),or(qt,{children:[j(Gt,{children:j(g7,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),or(Ct,{children:[j(D,{onClick:()=>y(!0),children:"Continue"}),j(Sr,{onClick:I,children:"Not now"})]}),j(K,{})]}):T==="sms"?j(bg,{onComplete:I,onReset:de,onClose:I}):T==="totp"&&b?j(Sg,{onComplete:I,onClose:I,onReset:de,totpInfo:b}):T==="passkey"?j(gg,{onComplete:I,onReset:de,onClose:I}):j(fg,{showIntro:it,userMfaMethods:e.mfaMethods,appMfaMethods:s.mfa.methods,userHasAuthSms:z,onBackToIntro:X,handleSelectMethod:_e,isTotpLoading:T==="totp"&&!b,isPasskeyLoading:R,error:q,onClose:I,setRemovingMfaMethod:o})};import vb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Cb from"@heroicons/react/24/outline/FingerPrintIcon";import wb from"@heroicons/react/24/outline/PhoneIcon";import bb from"@heroicons/react/24/outline/ShieldCheckIcon";import Eb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Tb from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as Sb,useState as Da}from"react";import{useMemo as cb,useEffect as pb,useState as t1}from"react";import db from"styled-components";import{calculateTotalGasEstimate as ub,populateTransactionRequest as mb}from"@privy-io/js-sdk-core";import jg from"styled-components";import xg from"styled-components";import{jsx as Ag,jsxs as T7}from"react/jsx-runtime";var Kl=({label:e,children:t,valueStyles:r})=>T7(b7,{children:[Ag("div",{children:e}),Ag(E7,{style:{...r},children:t})]}),b7=xg.div`
2060
2060
  display: flex;
2061
2061
  align-items: center;
2062
2062
  justify-content: space-between;
@@ -2071,7 +2071,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2071
2071
  color: var(--privy-color-foreground-2);
2072
2072
  text-align: right;
2073
2073
  }
2074
- `,b7=xg.div`
2074
+ `,E7=xg.div`
2075
2075
  font-size: 14px;
2076
2076
  line-height: 100%;
2077
2077
  display: flex;
@@ -2080,19 +2080,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
2080
2080
  border-radius: var(--privy-border-radius-full);
2081
2081
  background-color: var(--privy-color-background-2);
2082
2082
  padding: 4px 8px;
2083
- `;import Yl from"styled-components";import{BigNumber as T7}from"@ethersproject/bignumber";import{formatEther as kg}from"@ethersproject/units";import{QuantityToBigNumber as S7}from"@privy-io/js-sdk-core";var Wa=(e,t)=>{let r=(t*parseFloat(kg(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},eo=(e,t,r=6,o=!1)=>{let a=parseFloat(kg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},Yp=e=>e.map(S7).reduce((t,r)=>t.add(r),T7.from(0)).toHexString(),Rg=(e,t)=>{let{chains:r}=k(),o=`https://etherscan.io/address/${t}`,n=`${Cu(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as x7,jsx as jl,jsxs as Ig}from"react/jsx-runtime";var Wg=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yp(e),n=t?Wa(o,t):void 0,a=eo(o,r);return jl(Mg,{children:n||a})},Zp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yp(e),n=t?Wa(o,t):void 0,a=eo(o,r);return jl(Mg,{children:n?Ig(x7,{children:[jl(P7,{children:"USD"}),n==="<$0.01"?Ig(A7,{children:[jl(_7,{children:"<"}),"$0.01"]}):n]}):a})},Mg=Yl.span`
2083
+ `;import Yl from"styled-components";import{BigNumber as S7}from"@ethersproject/bignumber";import{formatEther as kg}from"@ethersproject/units";import{QuantityToBigNumber as P7}from"@privy-io/js-sdk-core";var _7=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),A7=e=>_7.format(e),Ia=(e,t)=>{let r=A7(t*parseFloat(kg(e)));return r==="$0.00"?"<$0.01":r},eo=(e,t,r=6,o=!1)=>{let a=parseFloat(kg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},Yp=e=>e.map(P7).reduce((t,r)=>t.add(r),S7.from(0)).toHexString(),Rg=(e,t)=>{let{chains:r}=k(),o=`https://etherscan.io/address/${t}`,n=`${Cu(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as I7,jsx as jl,jsxs as Ig}from"react/jsx-runtime";var Mg=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yp(e),n=t?Ia(o,t):void 0,a=eo(o,r);return jl(Wg,{children:n||a})},Zp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Yp(e),n=t?Ia(o,t):void 0,a=eo(o,r);return jl(Wg,{children:n?Ig(I7,{children:[jl(x7,{children:"USD"}),n==="<$0.01"?Ig(R7,{children:[jl(k7,{children:"<"}),"$0.01"]}):n]}):a})},Wg=Yl.span`
2084
2084
  font-size: 14px;
2085
2085
  line-height: 140%;
2086
2086
  display: flex;
2087
2087
  gap: 4px;
2088
2088
  align-items: center;
2089
- `,P7=Yl.span`
2089
+ `,x7=Yl.span`
2090
2090
  font-size: 12px;
2091
2091
  line-height: 12px;
2092
2092
  color: var(--privy-color-foreground-3);
2093
- `,_7=Yl.span`
2093
+ `,k7=Yl.span`
2094
2094
  font-size: 10px;
2095
- `,A7=Yl.span`
2095
+ `,R7=Yl.span`
2096
2096
  display: flex;
2097
2097
  align-items: center;
2098
2098
  `;import Qp from"styled-components";import{QuantityToBigNumber as Og}from"@privy-io/js-sdk-core";import{jsx as Bo,jsxs as Zl}from"react/jsx-runtime";var Lg=({gas:e,tokenPrice:t,tokenSymbol:r})=>Zl(rp,{style:{paddingBottom:"12px"},children:[Zl(Dg,{children:[Bo(Fg,{children:"Est. Fees"}),Bo("div",{children:Bo(Zp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&Bo(Ug,{children:`${eo(e,r)}`})]}),Ng=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Og(e.value||0).add(Og(t)).toHexString();return Zl(rp,{children:[Zl(Dg,{children:[Bo(Fg,{children:"Total (including fees)"}),Bo("div",{children:Bo(Zp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&Bo(Ug,{children:eo(n,o)})]})},Dg=Qp.div`
@@ -2114,19 +2114,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
2114
2114
  font-size: 14px;
2115
2115
  line-height: 22.4px;
2116
2116
  font-weight: 400;
2117
- `;import k7 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as _n,useState as R7}from"react";import Ho from"styled-components";import{createContext as Bg,useContext as Jz}from"react";var ki=Bg(void 0);var Ma=Bg(void 0);import{Fragment as U7,jsx as Or,jsxs as Hg}from"react/jsx-runtime";var Vg=({defaultValue:e,children:t})=>{let[r,o]=R7(e||null),n=a=>{o(r===a?null:a)};return Or(ki.Provider,{value:{activePanel:r,togglePanel:n},children:Or(I7,{children:t})})},Gg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=_n(ki),n=r===e;return Or(Ma.Provider,{value:{onToggle:()=>o(e),value:e},children:Or(L7,{isActive:n,"data-open":n,children:t})})},qg=({children:e})=>{let{activePanel:t}=_n(ki),{onToggle:r,value:o}=_n(Ma),n=t===o;return Hg(U7,{children:[Hg(W7,{onClick:r,"data-open":n,children:[Or(O7,{children:e}),Or(D7,{isactive:n,children:Or(k7,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Or(M7,{})]})},zg=({children:e})=>{let{activePanel:t}=_n(ki),{value:r}=_n(Ma);return Or(N7,{"data-open":t===r,children:Or(Kg,{children:e})})},$g=({children:e})=>{let{activePanel:t}=_n(ki),{value:r}=_n(Ma);return Or(Kg,{children:typeof e=="function"?e({isActive:t===r}):e})},I7=Ho.div`
2117
+ `;import M7 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Pn,useState as W7}from"react";import Ho from"styled-components";import{createContext as Bg,useContext as t$}from"react";var xi=Bg(void 0);var Ma=Bg(void 0);import{Fragment as H7,jsx as Or,jsxs as Hg}from"react/jsx-runtime";var Vg=({defaultValue:e,children:t})=>{let[r,o]=W7(e||null),n=a=>{o(r===a?null:a)};return Or(xi.Provider,{value:{activePanel:r,togglePanel:n},children:Or(O7,{children:t})})},Gg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Pn(xi),n=r===e;return Or(Ma.Provider,{value:{onToggle:()=>o(e),value:e},children:Or(U7,{isActive:n,"data-open":n,children:t})})},qg=({children:e})=>{let{activePanel:t}=Pn(xi),{onToggle:r,value:o}=Pn(Ma),n=t===o;return Hg(H7,{children:[Hg(L7,{onClick:r,"data-open":n,children:[Or(D7,{children:e}),Or(B7,{isactive:n,children:Or(M7,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Or(N7,{})]})},zg=({children:e})=>{let{activePanel:t}=Pn(xi),{value:r}=Pn(Ma);return Or(F7,{"data-open":t===r,children:Or(Kg,{children:e})})},$g=({children:e})=>{let{activePanel:t}=Pn(xi),{value:r}=Pn(Ma);return Or(Kg,{children:typeof e=="function"?e({isActive:t===r}):e})},O7=Ho.div`
2118
2118
  display: flex;
2119
2119
  flex-direction: column;
2120
2120
  width: 100%;
2121
2121
  gap: 8px;
2122
- `,W7=Ho.div`
2122
+ `,L7=Ho.div`
2123
2123
  display: flex;
2124
2124
  justify-content: space-between;
2125
2125
  align-items: center;
2126
2126
  width: 100%;
2127
2127
  cursor: pointer;
2128
2128
  padding-bottom: 8px;
2129
- `,M7=Ho.div`
2129
+ `,N7=Ho.div`
2130
2130
  width: 100%;
2131
2131
 
2132
2132
  && {
@@ -2134,13 +2134,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2134
2134
  border-color: var(--privy-color-foreground-4);
2135
2135
  }
2136
2136
  padding-bottom: 12px;
2137
- `,O7=Ho.div`
2137
+ `,D7=Ho.div`
2138
2138
  font-size: 14px;
2139
2139
  font-weight: 500;
2140
2140
  line-height: 19.6px;
2141
2141
  width: 100%;
2142
2142
  padding-right: 8px;
2143
- `,L7=Ho.div`
2143
+ `,U7=Ho.div`
2144
2144
  display: flex;
2145
2145
  flex-direction: column;
2146
2146
  width: 100%;
@@ -2152,7 +2152,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2152
2152
  border-color: var(--privy-color-foreground-4);
2153
2153
  border-radius: var(--privy-border-radius-md);
2154
2154
  }
2155
- `,N7=Ho.div`
2155
+ `,F7=Ho.div`
2156
2156
  position: relative;
2157
2157
  overflow: hidden;
2158
2158
  transition: max-height 25ms ease-out;
@@ -2170,32 +2170,32 @@ You will need this password to access your ${e} wallet on a new device. Please k
2170
2170
  gap: 12px;
2171
2171
  flex: 1 1 auto;
2172
2172
  min-height: 1px;
2173
- `,D7=Ho.div`
2173
+ `,B7=Ho.div`
2174
2174
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2175
- `;import F7 from"styled-components";import{jsx as H7}from"react/jsx-runtime";var Jp=({walletAddress:e,chainId:t=so})=>H7(B7,{href:Rg(t,e),target:"_blank",children:pr(e)}),B7=F7.a`
2175
+ `;import V7 from"styled-components";import{jsx as q7}from"react/jsx-runtime";var Jp=({walletAddress:e,chainId:t=so})=>q7(G7,{href:Rg(t,e),target:"_blank",children:pr(e)}),G7=V7.a`
2176
2176
  &:hover {
2177
2177
  text-decoration: underline;
2178
2178
  }
2179
- `;import{jsx as nr,jsxs as Xp}from"react/jsx-runtime";var Ri=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let s=r?.value||0,l=lt();return nr(Vg,{...l.render.standalone?{defaultValue:"details"}:{},children:Xp(Gg,{value:"details",children:[nr(qg,{children:Xp(V7,{children:[nr("div",{children:o?.title||o?.actionDescription||"Details"}),nr(G7,{children:nr(Wg,{weiQuantities:[s],tokenPrice:n,tokenSymbol:i})})]})}),Xp(zg,{children:[nr(Kl,{label:"From",children:nr(Jp,{walletAddress:e,chainId:r.chainId||so})}),nr(Kl,{label:"To",children:nr(Jp,{walletAddress:t,chainId:r.chainId||so})}),o&&o.action&&nr(Kl,{label:"Action",children:o.action}),a&&nr(Lg,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),nr($g,{children:({isActive:c})=>nr(Ng,{transactionData:r,displayFee:c,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},V7=jg.div`
2179
+ `;import{jsx as nr,jsxs as Xp}from"react/jsx-runtime";var ki=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let s=r?.value||0,l=lt();return nr(Vg,{...l.render.standalone?{defaultValue:"details"}:{},children:Xp(Gg,{value:"details",children:[nr(qg,{children:Xp(z7,{children:[nr("div",{children:o?.title||o?.actionDescription||"Details"}),nr($7,{children:nr(Mg,{weiQuantities:[s],tokenPrice:n,tokenSymbol:i})})]})}),Xp(zg,{children:[nr(Kl,{label:"From",children:nr(Jp,{walletAddress:e,chainId:r.chainId||so})}),nr(Kl,{label:"To",children:nr(Jp,{walletAddress:t,chainId:r.chainId||so})}),o&&o.action&&nr(Kl,{label:"Action",children:o.action}),a&&nr(Lg,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),nr($g,{children:({isActive:c})=>nr(Ng,{transactionData:r,displayFee:c,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},z7=jg.div`
2180
2180
  display: flex;
2181
2181
  flex-direction: row;
2182
2182
  justify-content: space-between;
2183
- `,G7=jg.div`
2183
+ `,$7=jg.div`
2184
2184
  flex-shrink: 0;
2185
2185
  padding-left: 8px;
2186
- `;import Jl from"styled-components";import q7 from"styled-components";var Ql=q7.img`
2186
+ `;import Jl from"styled-components";import K7 from"styled-components";var Ql=K7.img`
2187
2187
  && {
2188
2188
  height: ${e=>e.size==="sm"?"65px":"140px"};
2189
2189
  width: ${e=>e.size==="sm"?"65px":"140px"};
2190
2190
  border-radius: 16px;
2191
2191
  margin-bottom: 12px;
2192
2192
  }
2193
- `;import{jsx as Oa,jsxs as Y7}from"react/jsx-runtime";var ed=({description:e,contractInfo:t})=>Y7(z7,{children:[t.imgUrl&&Oa(Ql,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Oa($7,{children:Oa("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Oa(K7,{children:t.name}),Oa(j7,{children:e||t.actionText})]}),z7=Jl.div`
2193
+ `;import{jsx as Wa,jsxs as J7}from"react/jsx-runtime";var ed=({description:e,contractInfo:t})=>J7(j7,{children:[t.imgUrl&&Wa(Ql,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Wa(Y7,{children:Wa("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Wa(Z7,{children:t.name}),Wa(Q7,{children:e||t.actionText})]}),j7=Jl.div`
2194
2194
  display: flex;
2195
2195
  flex-direction: column;
2196
2196
  align-items: center;
2197
2197
  margin-bottom: 24px;
2198
- `,$7=Jl.div`
2198
+ `,Y7=Jl.div`
2199
2199
  font-size: 12px;
2200
2200
  line-height: 12px;
2201
2201
  padding: 7px;
@@ -2210,7 +2210,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2210
2210
  text-decoration: underline;
2211
2211
  }
2212
2212
  }
2213
- `,K7=Jl.div`
2213
+ `,Z7=Jl.div`
2214
2214
  margin-top: 8px;
2215
2215
 
2216
2216
  font-size: 18px;
@@ -2219,7 +2219,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2219
2219
  overflow: hidden;
2220
2220
  white-space: nowrap;
2221
2221
  text-overflow: ellipsis;
2222
- `,j7=Jl.div`
2222
+ `,Q7=Jl.div`
2223
2223
  margin-top: 12px;
2224
2224
  font-size: 14px;
2225
2225
  line-height: 22px;
@@ -2227,7 +2227,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2227
2227
  color: var(--privy-color-foreground-1);
2228
2228
  overflow: hidden;
2229
2229
  text-overflow: ellipsis;
2230
- `;import Z7 from"@heroicons/react/24/outline/WalletIcon";import rd from"styled-components";import{jsx as Yg,jsxs as td}from"react/jsx-runtime";var Zg=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=k(),i=a(t.chainId)||"ETH";return td(Q7,{children:[td(J7,{children:[Yg(Z7,{strokeWidth:"2",width:"16px",height:"16px"}),Yg("div",{children:pr(e)})]}),td(X7,{displayBalanceColor:n,hasFunds:o,children:[r?eo(r,i,6,!0):0," available"]})]})},Q7=rd.div`
2230
+ `;import X7 from"@heroicons/react/24/outline/WalletIcon";import rd from"styled-components";import{jsx as Yg,jsxs as td}from"react/jsx-runtime";var Zg=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=k(),i=a(t.chainId)||"ETH";return td(eb,{children:[td(tb,{children:[Yg(X7,{strokeWidth:"2",width:"16px",height:"16px"}),Yg("div",{children:pr(e)})]}),td(rb,{displayBalanceColor:n,hasFunds:o,children:[r?eo(r,i,6,!0):0," available"]})]})},eb=rd.div`
2231
2231
  display: flex;
2232
2232
  flex-direction: row;
2233
2233
  justify-content: space-between;
@@ -2240,12 +2240,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2240
2240
  border: 1px solid var(--privy-color-foreground-4);
2241
2241
  border-radius: var(--privy-border-radius-md);
2242
2242
  }
2243
- `,J7=rd.div`
2243
+ `,tb=rd.div`
2244
2244
  display: flex;
2245
2245
  flex-direction: row;
2246
2246
  align-items: center;
2247
2247
  gap: 8px;
2248
- `,X7=rd.div`
2248
+ `,rb=rd.div`
2249
2249
  display: flex;
2250
2250
  align-items: center;
2251
2251
  justify-content: center;
@@ -2255,7 +2255,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2255
2255
  background-color: var(--privy-color-background-2);
2256
2256
  padding: 5px 8px;
2257
2257
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2258
- `;import Xl from"styled-components";import{Fragment as Jg,jsx as La,jsxs as Xg}from"react/jsx-runtime";var e1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?Wa(n,o):void 0,i=eo(n,r);return Xg(eb,{children:[a?Xg(Jg,{children:[La(Qg,{children:a}),La(tb,{children:i})]}):La(Jg,{children:La(Qg,{children:i})}),La(rb,{children:e})]})},eb=Xl.div`
2258
+ `;import Xl from"styled-components";import{Fragment as Jg,jsx as Oa,jsxs as Xg}from"react/jsx-runtime";var e1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?Ia(n,o):void 0,i=eo(n,r);return Xg(ob,{children:[a?Xg(Jg,{children:[Oa(Qg,{children:a}),Oa(nb,{children:i})]}):Oa(Jg,{children:Oa(Qg,{children:i})}),Oa(ib,{children:e})]})},ob=Xl.div`
2259
2259
  display: flex;
2260
2260
  flex-direction: column;
2261
2261
  align-items: center;
@@ -2266,23 +2266,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2266
2266
  line-height: 48px;
2267
2267
  margin: 8px auto;
2268
2268
  }
2269
- `,tb=Xl.p`
2269
+ `,nb=Xl.p`
2270
2270
  margin-bottom: 12px;
2271
2271
  && {
2272
2272
  font-size: 17px;
2273
2273
  line-height: 17px;
2274
2274
  color: var(--privy-color-foreground-3);
2275
2275
  }
2276
- `,rb=Xl.div`
2276
+ `,ib=Xl.div`
2277
2277
  font-size: 16px;
2278
2278
  line-height: 22.4px;
2279
2279
  font-weight: 400;
2280
2280
  overflow: hidden;
2281
2281
  text-overflow: ellipsis;
2282
- `;import{useState as od,useEffect as ob}from"react";var ec=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=k(),[n,a]=od(!0),[i,s]=od(void 0),[l,c]=od(void 0);return ob(()=>{let u=e.chainId||so,h=o.find(g=>g.id===Number(u));if(!h)throw new ie(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(h);g?c(g):s(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){s(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:l,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as nb,useContext as ib}from"react";var nd=nb(null);function Na(){let e=ib(nd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as r1}from"react/jsx-runtime";var Da=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=Na(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:s}=k(),[l,c]=t1(null),[u,h]=t1(e),{tokenPrice:m}=ec(u),g=s(e.chainId)||"ETH",w=ab(()=>r.find(y=>y.walletClientType==="privy"),[r]);return sb(()=>{async function y(){if(!await t()||!o||!w)return u;let _=ao(u.chainId,a,n,{appId:i}),b=await pb(w.address,u,_),{totalGasEstimate:S}=await cb(b,_);return c(S.toHexString()),b}y().then(h).catch(console.error)},[o]),w?r1(db,{children:r1(Ri,{from:w.address,to:u.to,txn:u,gas:l??void 0,tokenPrice:m,tokenSymbol:g})}):null},db=lb.div`
2282
+ `;import{useState as od,useEffect as ab}from"react";var ec=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=k(),[n,a]=od(!0),[i,s]=od(void 0),[l,c]=od(void 0);return ab(()=>{let u=e.chainId||so,f=o.find(v=>v.id===Number(u));if(!f)throw new ie(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let v=await r(f);v?c(v):s(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(v){s(v)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:l,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as sb,useContext as lb}from"react";var nd=sb(null);function La(){let e=lb(nd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as r1}from"react/jsx-runtime";var Na=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=La(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:s}=k(),[l,c]=t1(null),[u,f]=t1(e),{tokenPrice:m}=ec(u),v=s(e.chainId)||"ETH",w=cb(()=>r.find(y=>y.walletClientType==="privy"),[r]);return pb(()=>{async function y(){if(!await t()||!o||!w)return u;let _=ao(u.chainId,a,n,{appId:i}),b=await mb(w.address,u,_),{totalGasEstimate:S}=await ub(b,_);return c(S.toHexString()),b}y().then(f).catch(console.error)},[o]),w?r1(hb,{children:r1(ki,{from:w.address,to:u.to,txn:u,gas:l??void 0,tokenPrice:m,tokenSymbol:v})}):null},hb=db.div`
2283
2283
  width: 100%;
2284
2284
  padding: 1rem 0;
2285
- `;import ub from"@heroicons/react/24/outline/CalendarIcon";import mb from"@heroicons/react/24/outline/ExclamationTriangleIcon";import fb from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as o1,jsx as Et,jsxs as Ii}from"react/jsx-runtime";var n1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:a,submitSuccess:i})=>{let{pendingTransaction:s}=k();return Ii(o1,{children:[Et(P,{onClose:r},"header"),Et(Ke,{children:Ii("div",{children:[Et(Je,{success:i,fail:!!t}),t?Et(mb,{style:{width:"38px",height:"38px"}}):Et(En,{style:{width:"38px",height:"38px"}})]})}),Et(pe,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Ii(pn,{children:[Ii(qt,{children:[Et(Gt,{children:Et(fb,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Ii(qt,{children:[Et(Gt,{children:Et(ub,{})}),"You last added a passkey on"," ",a?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),s&&Et(ur,{children:Et(Da,{pendingTransaction:s})}),t&&Ii(o1,{children:[Et(el,{style:{marginTop:"1.25rem"},children:t.message}),Et(U,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Et(oa,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Et(K,{})]})};import{Fragment as id,jsx as fe,jsxs as Lr}from"react/jsx-runtime";var ad=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=Ua(null),{init:a,cancel:i,submit:s}=Aa(),[l,c]=Ua(!1),[u,h]=Ua(!1),[m,g]=Ua(null),[w,y]=Ua(null);bb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let T=N=>hp(N)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):vn(N)?(c(!1),new Error("The code you entered is not valid")):gn(N)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(N),c(!1),new Error("Something went wrong."));async function _(N){y(null);try{if(!N||!o)return;await s(o,N),h(!0),c(!1),t()}catch(W){throw T(W)}}async function b(N){if(N==="passkey"){try{n(N);let W=await a(N);if(!W)throw new Error("something went wrong");g(W),await s(N,W),h(!0),c(!1),t()}catch(W){y(T(W))}return}try{n(N),await a(N)}catch(W){console.error(W)}}let S=()=>{n(null),y(null),i(),t()},I=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let N=r.linkedAccounts.filter(W=>W.type==="passkey"&&W.enrolledInMfa).sort((W,R)=>R.firstVerifiedAt.valueOf()-W.firstVerifiedAt.valueOf())[0];return fe(n1,{account:N,selectedMethod:o,submitSuccess:u,hasBlockingError:l,error:w,onClose:S,onBack:I,handleSubmit:()=>_(m).catch(y)})}return o?fe(Eb,{submitSuccess:u,hasBlockingError:l,handleSubmitCode:_,selectedMethod:o,onClose:S,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Lr(id,{children:[fe(P,{onClose:S},"header"),fe(Ae,{children:fe(Ge,{children:fe(vb,{})})}),fe(pe,{children:"Verify your identity"}),fe(ue,{children:"Choose a verification method"}),Lr(Ys,{children:[r.mfaMethods.includes("totp")&&Lr(Se,{onClick:()=>b("totp"),children:[fe(hb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Lr(Se,{onClick:()=>b("sms"),children:[fe(gb,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Lr(Se,{onClick:()=>b("passkey"),children:[fe(yb,{}),"Passkey"]},"passkey")]}),fe(K,{})]})},Eb=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:a})=>{let{app:i}=x(),{pendingTransaction:s}=k();switch(e){case"sms":return Lr(id,{children:[fe(P,{onClose:o},"header"),fe(Ae,{children:fe(Ge,{children:fe(wb,{})})}),fe(pe,{children:"Enter verification code"}),Lr(ur,{children:[fe(Sn,{success:t,disabled:r,onChange:a}),Lr(ue,{children:["To continue, please enter the 6-digit code sent to your ",fe("strong",{children:"mobile device"})]}),s&&fe(Da,{pendingTransaction:s})]}),n&&fe(oa,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Sr,{onClick:o,children:"Not now"}),fe(K,{})]});case"totp":return Lr(id,{children:[fe(P,{onClose:o},"header"),fe(Ae,{children:fe(Ge,{children:fe(Cb,{})})}),fe(pe,{children:"Enter verification code"}),Lr(ur,{children:[fe(Sn,{success:t,disabled:r,onChange:a}),Lr(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",fe("strong",{children:"authenticator app"})]}),s&&fe(Da,{pendingTransaction:s})]}),n&&fe(oa,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),fe(Sr,{onClick:o,children:"Not now"}),fe(K,{})]});default:return null}};import{useEffect as i1,useState as a1}from"react";import Tb from"styled-components";import{Fragment as Pb,jsx as to,jsxs as tc}from"react/jsx-runtime";var s1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:a,navigate:i,resetNavigation:s}=x(),{getAuthMeta:l,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:h,setReadyToTrue:m,closePrivyModal:g,createAnalyticsEvent:w}=k(),[y,T]=a1(!1),[_,b]=a1(void 0),S=l()?.provider||"google",{name:I,component:N}=$i(S),W=Xn(),R=Le;i1(()=>{u(S).then(Y=>{T(!0),m(!0),Y&&W("login","onOAuthLoginComplete",Y)}).catch(Y=>{if(m(!1),Y?.privyErrorCode==="allowlist_rejected"){b(void 0),s(),i("ALLOWLIST_REJECTION_SCREEN");return}if(Y?.privyErrorCode==="max_accounts_reached"){console.error(new cr(Y).toString()),b(void 0),s(),i("USER_LIMIT_REACHED_SCREEN");return}if(Y?.privyErrorCode==="user_does_not_exist"){b(void 0),s(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:M,detail:z}=ju(Y,S);b({retryable:M,detail:z,message:"Authentication failed"})}).finally(()=>{tn()})},[I,S]),i1(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let M=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(M)}if(Ut(o,n?.embeddedWallets?.createOnLogin)){let M=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:z,provider:S,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(M)}else{let M=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return h(),()=>clearTimeout(M)}}},[r,e,y,o]);let B=y?`Successfully connected with ${I}`:_?_.message:`Verifying connection to ${I}`,q="";return y?q="You\u2019re good to go!":_?q=_.detail:q="Just a few moments more",tc(Pb,{children:[to(P,{}),to(ee,{}),tc(Sb,{children:[to(Ke,{children:tc("div",{children:[to(Je,{success:y,fail:!!_}),to(N,{style:{width:"38px",height:"38px"}})]})}),tc(je,{children:[to("h3",{children:B}),to("p",{children:q})]}),_&&_?.retryable?to(ei,{onClick:()=>{tn(),c(S),b(void 0)},disabled:!y&&!_?.retryable,children:"Retry"}):null]}),to(te,{}),to(K,{})]})},Sb=Tb.div`
2285
+ `;import fb from"@heroicons/react/24/outline/CalendarIcon";import yb from"@heroicons/react/24/outline/ExclamationTriangleIcon";import gb from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as o1,jsx as Et,jsxs as Ri}from"react/jsx-runtime";var n1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:a,submitSuccess:i})=>{let{pendingTransaction:s}=k();return Ri(o1,{children:[Et(P,{onClose:r},"header"),Et(Ke,{children:Ri("div",{children:[Et(Je,{success:i,fail:!!t}),t?Et(yb,{style:{width:"38px",height:"38px"}}):Et(bn,{style:{width:"38px",height:"38px"}})]})}),Et(pe,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Ri(pn,{children:[Ri(qt,{children:[Et(Gt,{children:Et(gb,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Ri(qt,{children:[Et(Gt,{children:Et(fb,{})}),"You last added a passkey on"," ",a?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),s&&Et(ur,{children:Et(Na,{pendingTransaction:s})}),t&&Ri(o1,{children:[Et(Xs,{style:{marginTop:"1.25rem"},children:t.message}),Et(D,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Et(ra,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Et(K,{})]})};import{Fragment as id,jsx as he,jsxs as Lr}from"react/jsx-runtime";var ad=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=Da(null),{init:a,cancel:i,submit:s}=_a(),[l,c]=Da(!1),[u,f]=Da(!1),[m,v]=Da(null),[w,y]=Da(null);Sb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let T=N=>fp(N)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):gn(N)?(c(!1),new Error("The code you entered is not valid")):yn(N)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(N),c(!1),new Error("Something went wrong."));async function _(N){y(null);try{if(!N||!o)return;await s(o,N),f(!0),c(!1),t()}catch(M){throw T(M)}}async function b(N){if(N==="passkey"){try{n(N);let M=await a(N);if(!M)throw new Error("something went wrong");v(M),await s(N,M),f(!0),c(!1),t()}catch(M){y(T(M))}return}try{n(N),await a(N)}catch(M){console.error(M)}}let S=()=>{n(null),y(null),i(),t()},I=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let N=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,R)=>R.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return he(n1,{account:N,selectedMethod:o,submitSuccess:u,hasBlockingError:l,error:w,onClose:S,onBack:I,handleSubmit:()=>_(m).catch(y)})}return o?he(Pb,{submitSuccess:u,hasBlockingError:l,handleSubmitCode:_,selectedMethod:o,onClose:S,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Lr(id,{children:[he(P,{onClose:S},"header"),he(Ae,{children:he(Ge,{children:he(bb,{})})}),he(pe,{children:"Verify your identity"}),he(ue,{children:"Choose a verification method"}),Lr(js,{children:[r.mfaMethods.includes("totp")&&Lr(Se,{onClick:()=>b("totp"),children:[he(vb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Lr(Se,{onClick:()=>b("sms"),children:[he(wb,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Lr(Se,{onClick:()=>b("passkey"),children:[he(Cb,{}),"Passkey"]},"passkey")]}),he(K,{})]})},Pb=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:a})=>{let{app:i}=x(),{pendingTransaction:s}=k();switch(e){case"sms":return Lr(id,{children:[he(P,{onClose:o},"header"),he(Ae,{children:he(Ge,{children:he(Tb,{})})}),he(pe,{children:"Enter verification code"}),Lr(ur,{children:[he(Tn,{success:t,disabled:r,onChange:a}),Lr(ue,{children:["To continue, please enter the 6-digit code sent to your ",he("strong",{children:"mobile device"})]}),s&&he(Na,{pendingTransaction:s})]}),n&&he(ra,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),he(Sr,{onClick:o,children:"Not now"}),he(K,{})]});case"totp":return Lr(id,{children:[he(P,{onClose:o},"header"),he(Ae,{children:he(Ge,{children:he(Eb,{})})}),he(pe,{children:"Enter verification code"}),Lr(ur,{children:[he(Tn,{success:t,disabled:r,onChange:a}),Lr(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",he("strong",{children:"authenticator app"})]}),s&&he(Na,{pendingTransaction:s})]}),n&&he(ra,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),he(Sr,{onClick:o,children:"Not now"}),he(K,{})]});default:return null}};import{useEffect as i1,useState as a1}from"react";import _b from"styled-components";import{Fragment as xb,jsx as to,jsxs as tc}from"react/jsx-runtime";var s1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:a,navigate:i,resetNavigation:s}=x(),{getAuthMeta:l,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:m,closePrivyModal:v,createAnalyticsEvent:w}=k(),[y,T]=a1(!1),[_,b]=a1(void 0),S=l()?.provider||"google",{name:I,component:N}=zi(S),M=Jn(),R=Le;i1(()=>{u(S).then(Y=>{T(!0),m(!0),Y&&M("login","onOAuthLoginComplete",Y)}).catch(Y=>{if(m(!1),Y?.privyErrorCode==="allowlist_rejected"){b(void 0),s(),i("ALLOWLIST_REJECTION_SCREEN");return}if(Y?.privyErrorCode==="max_accounts_reached"){console.error(new cr(Y).toString()),b(void 0),s(),i("USER_LIMIT_REACHED_SCREEN");return}if(Y?.privyErrorCode==="user_does_not_exist"){b(void 0),s(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:W,detail:z}=ju(Y,S);b({retryable:W,detail:z,message:"Authentication failed"})}).finally(()=>{tn()})},[I,S]),i1(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(W)}if(Ut(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:z,provider:S,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(W)}else{let W=setTimeout(()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return f(),()=>clearTimeout(W)}}},[r,e,y,o]);let B=y?`Successfully connected with ${I}`:_?_.message:`Verifying connection to ${I}`,q="";return y?q="You\u2019re good to go!":_?q=_.detail:q="Just a few moments more",tc(xb,{children:[to(P,{}),to(ee,{}),tc(Ab,{children:[to(Ke,{children:tc("div",{children:[to(Je,{success:y,fail:!!_}),to(N,{style:{width:"38px",height:"38px"}})]})}),tc(je,{children:[to("h3",{children:B}),to("p",{children:q})]}),_&&_?.retryable?to(Xn,{onClick:()=>{tn(),c(S),b(void 0)},disabled:!y&&!_?.retryable,children:"Retry"}):null]}),to(te,{}),to(K,{})]})},Ab=_b.div`
2286
2286
  display: flex;
2287
2287
  flex-direction: column;
2288
2288
  align-items: center;
@@ -2290,17 +2290,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2290
2290
  margin-left: 27px;
2291
2291
  margin-right: 27px;
2292
2292
  gap: 24px;
2293
- `;import{useEffect as sd,useRef as _b,useState as l1}from"react";import c1 from"styled-components";import{Fragment as xb,jsx as go,jsxs as rc}from"react/jsx-runtime";var p1=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=x(),{loginWithPasskey:o,closePrivyModal:n}=k(),a=Le,[i,s]=l1("loading"),[l,c]=l1(null),u=_b([]),h=T=>{u.current=[T,...u.current]};sd(()=>()=>{u.current.forEach(T=>clearTimeout(T)),u.current=[]},[]);let m=()=>{switch(i){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(i){case"loading":return`Please follow prompts to verify your passkey.
2293
+ `;import{useEffect as sd,useRef as kb,useState as l1}from"react";import c1 from"styled-components";import{Fragment as Ib,jsx as go,jsxs as rc}from"react/jsx-runtime";var p1=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=x(),{loginWithPasskey:o,closePrivyModal:n}=k(),a=Le,[i,s]=l1("loading"),[l,c]=l1(null),u=kb([]),f=T=>{u.current=[T,...u.current]};sd(()=>()=>{u.current.forEach(T=>clearTimeout(T)),u.current=[]},[]);let m=()=>{switch(i){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},v=()=>{switch(i){case"loading":return`Please follow prompts to verify your passkey.
2294
2294
  You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(l instanceof Ze){if(l.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(l.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2295
2295
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2296
- You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(i){case"loading":case"success":return go(U,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return go(U,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{s("loading");try{await o(),s("success")}catch(T){c(T),s("error")}};return sd(()=>{i==="success"&&h(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[i]),sd(()=>{y()},[]),rc(xb,{children:[go(P,{backFn:!e||t===e?void 0:r}),rc(Ab,{children:[go(Ke,{children:rc("div",{children:[go(Je,{success:i==="success",fail:i==="error"}),go(Tn,{style:{width:"38px",height:"38px"}})]})}),rc(je,{children:[go("h3",{children:m()}),go("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),w()]}),go(K,{})]})},Ab=c1.div`
2296
+ You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(i){case"loading":case"success":return go(D,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return go(D,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{s("loading");try{await o(),s("success")}catch(T){c(T),s("error")}};return sd(()=>{i==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[i]),sd(()=>{y()},[]),rc(Ib,{children:[go(P,{backFn:!e||t===e?void 0:r}),rc(Rb,{children:[go(Ke,{children:rc("div",{children:[go(Je,{success:i==="success",fail:i==="error"}),go(En,{style:{width:"38px",height:"38px"}})]})}),rc(je,{children:[go("h3",{children:m()}),go("p",{style:{whiteSpace:"pre-wrap"},children:v()})]}),w()]}),go(K,{})]})},Rb=c1.div`
2297
2297
  display: flex;
2298
2298
  flex-direction: column;
2299
2299
  align-items: center;
2300
2300
  justify-content: center;
2301
2301
  gap: 24px;
2302
2302
  width: 100%;
2303
- `,gj=c1.div`
2303
+ `,wj=c1.div`
2304
2304
  display: flex;
2305
2305
  align-items: center;
2306
2306
  justify-content: center;
@@ -2316,9 +2316,9 @@ You will have to sign up with another method first to register a passkey for you
2316
2316
  stroke: var(--privy-color-accent) !important;
2317
2317
  fill: var(--privy-color-accent) !important;
2318
2318
  }
2319
- `;import{useEffect as Rb,useState as u1}from"react";import Ib from"styled-components";import{isMobile as kb}from"react-device-detect";var d1=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!To()&&kb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Mb,jsx as vo,jsxs as m1}from"react/jsx-runtime";var f1=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=u1(""),[a,i]=u1(!1);Rb(()=>{t&&r&&e().then(n)},[t,r]);let s=d1(o,!a),l={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(l.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(l.title="Still here?",l.description="You may need to install the Phantom mobile app.",l.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),m1(Mb,{children:[vo(P,{},"header"),vo(ee,{}),vo(jr,{title:l.title,description:l.description}),m1(mr,{children:[vo(Wb,{children:vo(Gr,{style:{width:"72px",height:"72px"}})}),vo(zs,{href:s,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!s,children:a?"Go to App Store":"Continue"}),l.footnote?vo("p",{children:l.footnote}):null]}),vo(te,{}),vo($,{})]})},Wb=Ib(xt)`
2319
+ `;import{useEffect as Wb,useState as u1}from"react";import Ob from"styled-components";import{isMobile as Mb}from"react-device-detect";var d1=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!To()&&Mb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Nb,jsx as vo,jsxs as m1}from"react/jsx-runtime";var h1=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=u1(""),[a,i]=u1(!1);Wb(()=>{t&&r&&e().then(n)},[t,r]);let s=d1(o,!a),l={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(l.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(l.title="Still here?",l.description="You may need to install the Phantom mobile app.",l.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),m1(Nb,{children:[vo(P,{},"header"),vo(ee,{}),vo(jr,{title:l.title,description:l.description}),m1(mr,{children:[vo(Lb,{children:vo(Gr,{style:{width:"72px",height:"72px"}})}),vo(qs,{href:s,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!s,children:a?"Go to App Store":"Continue"}),l.footnote?vo("p",{children:l.footnote}):null]}),vo(te,{}),vo($,{})]})},Lb=Ob(xt)`
2320
2320
  margin: 16px auto;
2321
- `;import Ob from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Lb,useState as oc}from"react";import nc,{css as Nb}from"styled-components";import{Fragment as Hb,jsx as Mt,jsxs as An}from"react/jsx-runtime";var h1=()=>{let[e,t]=oc(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=k(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),[u,h]=oc(void 0),[m,g]=oc(""),[w,y]=oc(!1),{privyWallet:T,onCompleteNavigateTo:_,onSuccess:b,onFailure:S}=l.recoverWallet,I=(R="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),S(typeof R=="string"?new _t(R):R)};c.current=I,Lb(()=>{if(!r||!T)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let N=R=>{R&&h(R)};return An(Hb,{children:[Mt(P,{onClose:I}),Mt(ee,{}),An(Ub,{children:[An(Db,{children:[Mt(Ob,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Mt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Mt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),An("div",{children:[An(Wo,{children:[Mt(wi,{type:e?"password":"text",onChange:R=>N(R.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),Mt(bi,{style:{right:"0.75rem"},children:e?Mt(Ei,{onClick:()=>t(!1)}):Mt(Ti,{onClick:()=>t(!0)})})]}),!!m&&Mt(Fb,{children:m})]}),An("div",{children:[An(Pf,{children:[Mt("h4",{children:"Why is this necessary?"}),Mt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Mt(Bb,{loading:w||!n,disabled:!u,onClick:async()=>{y(!0);let R=await o();if(R&&T&&u!==null)try{i({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:T.address}}),await n?.recover({address:T.address,accessToken:R,recoveryPin:u,recoveryMethod:T.recoveryMethod}),g(""),_?s(_):a({shouldCallAuthOnSuccess:!1}),b?.(T),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}})}catch(B){ph(B)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{y(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!T&&w,children:"Recover your account"})]})]}),Mt(te,{}),Mt($,{})]})},Db=nc.div`
2321
+ `;import Db from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Ub,useState as oc}from"react";import nc,{css as Fb}from"styled-components";import{Fragment as qb,jsx as Wt,jsxs as _n}from"react/jsx-runtime";var f1=()=>{let[e,t]=oc(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=k(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=x(),[u,f]=oc(void 0),[m,v]=oc(""),[w,y]=oc(!1),{privyWallet:T,onCompleteNavigateTo:_,onSuccess:b,onFailure:S}=l.recoverWallet,I=(R="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),S(typeof R=="string"?new _t(R):R)};c.current=I,Ub(()=>{if(!r||!T)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let N=R=>{R&&f(R)};return _n(qb,{children:[Wt(P,{onClose:I}),Wt(ee,{}),_n(Hb,{children:[_n(Bb,{children:[Wt(Db,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Wt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Wt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),_n("div",{children:[_n(Mo,{children:[Wt(Ci,{type:e?"password":"text",onChange:R=>N(R.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),Wt(wi,{style:{right:"0.75rem"},children:e?Wt(bi,{onClick:()=>t(!1)}):Wt(Ei,{onClick:()=>t(!0)})})]}),!!m&&Wt(Vb,{children:m})]}),_n("div",{children:[_n(Sh,{children:[Wt("h4",{children:"Why is this necessary?"}),Wt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Wt(Gb,{loading:w||!n,disabled:!u,onClick:async()=>{y(!0);let R=await o();if(R&&T&&u!==null)try{i({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:T.address}}),await n?.recover({address:T.address,accessToken:R,recoveryPin:u,recoveryMethod:T.recoveryMethod}),v(""),_?s(_):a({shouldCallAuthOnSuccess:!1}),b?.(T),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}})}catch(B){lf(B)?v("Invalid recovery password, please try again."):v("An error has occurred, please try again.")}finally{y(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!T&&w,children:"Recover your account"})]})]}),Wt(te,{}),Wt($,{})]})},Bb=nc.div`
2322
2322
  display: flex;
2323
2323
  flex-direction: column;
2324
2324
  align-items: center;
@@ -2340,26 +2340,26 @@ You will have to sign up with another method first to register a passkey for you
2340
2340
  font-weight: 400;
2341
2341
  line-height: 20px;
2342
2342
  }
2343
- `,Ub=nc.div`
2343
+ `,Hb=nc.div`
2344
2344
  display: flex;
2345
2345
  flex-direction: column;
2346
2346
  justify-content: space-between;
2347
- `,Fb=nc.div`
2347
+ `,Vb=nc.div`
2348
2348
  line-height: 20px;
2349
2349
  height: 20px;
2350
2350
  font-size: 13px;
2351
2351
  color: var(--privy-color-error);
2352
2352
  text-align: left;
2353
2353
  margin-top: 0.5rem;
2354
- `,Bb=nc(U)`
2355
- ${e=>e.hideAnimations&&Nb`
2354
+ `,Gb=nc(D)`
2355
+ ${e=>e.hideAnimations&&Fb`
2356
2356
  && {
2357
2357
  // Remove animations because the recoverWallet task on the iframe partially
2358
2358
  // blocks the renderer, so the animation stutters and doesn't look good
2359
2359
  transition: none;
2360
2360
  }
2361
2361
  `}
2362
- `;import{useCallback as Vb,useEffect as w1,useState as ld}from"react";import{jsx as ic,jsxs as y1}from"react/jsx-runtime";var ac=e=>y1("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[ic("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),ic("defs",{children:y1("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[ic("stop",{stopColor:"#3E82F4"}),ic("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Co,jsxs as g1}from"react/jsx-runtime";var sc=({style:e,...t})=>g1("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[g1("g",{clipPath:"url(#clip0_2115_829)",children:[Co("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Co("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Co("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Co("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Co("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Co("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Co("defs",{children:Co("clipPath",{id:"clip0_2115_829",children:Co("rect",{width:"16",height:"14",fill:"white"})})})]});import v1 from"styled-components";var Fa=v1.div`
2362
+ `;import{useCallback as zb,useEffect as w1,useState as ld}from"react";import{jsx as ic,jsxs as y1}from"react/jsx-runtime";var ac=e=>y1("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[ic("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),ic("defs",{children:y1("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[ic("stop",{stopColor:"#3E82F4"}),ic("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Co,jsxs as g1}from"react/jsx-runtime";var sc=({style:e,...t})=>g1("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[g1("g",{clipPath:"url(#clip0_2115_829)",children:[Co("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Co("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Co("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Co("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Co("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Co("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Co("defs",{children:Co("clipPath",{id:"clip0_2115_829",children:Co("rect",{width:"16",height:"14",fill:"white"})})})]});import v1 from"styled-components";var Ua=v1.div`
2363
2363
  display: flex;
2364
2364
  flex-direction: column;
2365
2365
  gap: 12px;
@@ -2367,18 +2367,18 @@ You will have to sign up with another method first to register a passkey for you
2367
2367
  padding-bottom: 24px;
2368
2368
  `,C1=v1.div`
2369
2369
  padding-bottom: 24px;
2370
- `;import{Fragment as E1,jsx as Vo,jsxs as lc}from"react/jsx-runtime";var b1={"google-drive":{name:"Google Drive",component:sc},icloud:{name:"iCloud",component:ac}},T1=()=>{let{logout:e}=H(),{navigate:t,setModalData:r,data:o}=x(),{recoveryOAuthFlow:n,closePrivyModal:a,createAnalyticsEvent:i}=k(),[s,l]=ld(!1),{provider:c,action:u,isInAccountCreateFlow:h}=o?.recoveryOAuthStatus,[m,g]=ld(void 0),[w,y]=ld(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let T=b1[c].name,_=b1[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,S=new De(async(Y="create-wallet")=>(y(!0),new Promise((M,z)=>{setTimeout(async()=>{try{let L=window.open();await n(c,Y,L),l(!0),M()}catch{g({message:`${Y==="recover"?"Recovery":"Back up"} with ${T} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${T} account associated with your backup.`:"",retryable:!0}),z()}},0)})));w1(()=>{u!=="recover"&&S.execute(h?"create-wallet":"set-recovery")},[]),w1(()=>{if(!s)return;let Y=setTimeout(()=>{h?(r({createWallet:{onSuccess:()=>{},onFailure:M=>{i({eventName:"embedded_wallet_creation_failure_logout",payload:{error:M,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):a({shouldCallAuthOnSuccess:!1})},Le);return()=>clearTimeout(Y)},[s]);let I=Vb(async()=>{await S.execute("recover"),b?t(b):l(!0)},[]),N=c==="google-drive"?"Google Drive":"Apple iCloud",W=u==="recover"?"recovered":"backed up",R=u==="recover"?"Recovering":"Backing up",B=s&&`Successfully ${W} with ${N}.`||m&&m.message||`${R} with ${N}...`,q=m?m.detail:"";return lc(E1,{children:[Vo(P,{}),w?Vo(E1,{children:lc(Fa,{children:[Vo(xe,{title:B,icon:Vo(_,{style:{width:"38px",height:"38px"}}),description:q}),m&&m?.retryable?Vo(U,{onClick:()=>{tn(),g(void 0),u==="create-wallet"?S.execute("create-wallet"):I()},disabled:!s&&!m?.retryable,children:"Try again"}):null]})}):lc(Fa,{children:[Vo(xe,{title:"Confirm it's really you",icon:Vo(_,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${N} where your account is backed up.`}),lc(U,{onClick:I,children:["Confirm with ",N]})]}),Vo($,{})]})};import{useEffect as S1,useState as Ba}from"react";import{jsx as Gb}from"react/jsx-runtime";var P1=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=x(),[n,a]=Ba(""),[i,s]=Ba(!1),[l,c]=Ba(),[u,h]=Ba(null),{authenticated:m}=H(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:y}=k(),{onSuccess:T,onFailure:_,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:S}=ul(),[I,N]=Ba(null),W=new De(async()=>{try{let q=await S(l);if(!q)return;N(q),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(T(q),g({shouldCallAuthOnSuccess:b}))}catch(q){a(q.message)}});S1(()=>{u||y(3e4).then(q=>h(q))},[u]),S1(()=>{if(!m){t("LANDING"),_(new Error("User must be authenticated before creating a Privy wallet"));return}},[m]);let R=()=>{I&&I?.recoveryMethod!=="user-passcode"?(_(new _t("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):I?(T(I),g({shouldCallAuthOnSuccess:b})):(_(new _t("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let B=async()=>{s(!0);let q=250;return W.execute().then(()=>new Promise(Y=>setTimeout(Y,q))).finally(()=>s(!1))};return Gb(yl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:i,buttonHideAnimations:!I&&i,isResettingPassword:!1,error:n,password:l||"",onClose:R,onPasswordChange:c,onPasswordGenerate:()=>c(hl()),onSubmit:B})};import qb from"@heroicons/react/24/outline/LockClosedIcon";import zb from"@heroicons/react/24/outline/PencilSquareIcon";import $b from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as Kb}from"react";import jb from"styled-components";import{Fragment as pd,jsx as mt,jsxs as Go}from"react/jsx-runtime";var cd=jb.div`
2370
+ `;import{Fragment as E1,jsx as Vo,jsxs as lc}from"react/jsx-runtime";var b1={"google-drive":{name:"Google Drive",component:sc},icloud:{name:"iCloud",component:ac}},T1=()=>{let{logout:e}=H(),{navigate:t,setModalData:r,data:o}=x(),{recoveryOAuthFlow:n,closePrivyModal:a,createAnalyticsEvent:i}=k(),[s,l]=ld(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[m,v]=ld(void 0),[w,y]=ld(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let T=b1[c].name,_=b1[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,S=new De(async(Y="create-wallet")=>(y(!0),new Promise((W,z)=>{setTimeout(async()=>{try{let L=window.open();await n(c,Y,L),l(!0),W()}catch{v({message:`${Y==="recover"?"Recovery":"Back up"} with ${T} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${T} account associated with your backup.`:"",retryable:!0}),z()}},0)})));w1(()=>{u!=="recover"&&S.execute(f?"create-wallet":"set-recovery")},[]),w1(()=>{if(!s)return;let Y=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:W=>{i({eventName:"embedded_wallet_creation_failure_logout",payload:{error:W,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):a({shouldCallAuthOnSuccess:!1})},Le);return()=>clearTimeout(Y)},[s]);let I=zb(async()=>{await S.execute("recover"),b?t(b):l(!0)},[]),N=c==="google-drive"?"Google Drive":"Apple iCloud",M=u==="recover"?"recovered":"backed up",R=u==="recover"?"Recovering":"Backing up",B=s&&`Successfully ${M} with ${N}.`||m&&m.message||`${R} with ${N}...`,q=m?m.detail:"";return lc(E1,{children:[Vo(P,{}),w?Vo(E1,{children:lc(Ua,{children:[Vo(xe,{title:B,icon:Vo(_,{style:{width:"38px",height:"38px"}}),description:q}),m&&m?.retryable?Vo(D,{onClick:()=>{tn(),v(void 0),u==="create-wallet"?S.execute("create-wallet"):I()},disabled:!s&&!m?.retryable,children:"Try again"}):null]})}):lc(Ua,{children:[Vo(xe,{title:"Confirm it's really you",icon:Vo(_,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${N} where your account is backed up.`}),lc(D,{onClick:I,children:["Confirm with ",N]})]}),Vo($,{})]})};import{useEffect as S1,useState as Fa}from"react";import{jsx as $b}from"react/jsx-runtime";var P1=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=x(),[n,a]=Fa(""),[i,s]=Fa(!1),[l,c]=Fa(),[u,f]=Fa(null),{authenticated:m}=H(),{closePrivyModal:v,isNewUserThisSession:w,initializeWalletProxy:y}=k(),{onSuccess:T,onFailure:_,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:S}=dl(),[I,N]=Fa(null),M=new De(async()=>{try{let q=await S(l);if(!q)return;N(q),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(T(q),v({shouldCallAuthOnSuccess:b}))}catch(q){a(q.message)}});S1(()=>{u||y(3e4).then(q=>f(q))},[u]),S1(()=>{if(!m){t("LANDING"),_(new Error("User must be authenticated before creating a Privy wallet"));return}},[m]);let R=()=>{I&&I?.recoveryMethod!=="user-passcode"?(_(new _t("User created a wallet but failed to set a password for it")),v({shouldCallAuthOnSuccess:!1})):I?(T(I),v({shouldCallAuthOnSuccess:b})):(_(new _t("User wallet creation failed")),v({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let B=async()=>{s(!0);let q=250;return M.execute().then(()=>new Promise(Y=>setTimeout(Y,q))).finally(()=>s(!1))};return $b(fl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:i,buttonHideAnimations:!I&&i,isResettingPassword:!1,error:n,password:l||"",onClose:R,onPasswordChange:c,onPasswordGenerate:()=>c(hl()),onSubmit:B})};import Kb from"@heroicons/react/24/outline/LockClosedIcon";import jb from"@heroicons/react/24/outline/PencilSquareIcon";import Yb from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as Zb}from"react";import Qb from"styled-components";import{Fragment as pd,jsx as mt,jsxs as Go}from"react/jsx-runtime";var cd=Qb.div`
2371
2371
  width: 24px;
2372
2372
  height: 24px;
2373
2373
  display: flex;
2374
2374
  justify-content: center;
2375
2375
  align-items: center;
2376
- `,Yb={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},Zb=({onClose:e})=>Go(C1,{children:[mt(xe,{title:"Why do I need to secure my account?",icon:mt($b,{width:48}),description:Go(pd,{children:[mt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),mt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),mt(U,{onClick:e,children:"Select backup method"})]}),_1=()=>{let[e,t]=Kb(!1),{navigate:r,setModalData:o,data:n}=x(),{user:a}=H(),{embeddedWallets:i}=lt(),s=we(a),l=s===null,{isInAccountCreateFlow:c,isResettingPassword:u}=n.recoverySelection,h=s?.recoveryMethod!=="privy",m=h?"Update backup method":"Secure your account",g=h?Go("span",{children:["Your account is currently secured using"," ",mt("strong",{children:Yb[s?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function w(y){o({recoveryOAuthStatus:{provider:y,action:l?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return Go(pd,{children:[mt(P,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?mt(Zb,{onClose:()=>t(!1)}):Go(pd,{children:[mt(xe,{title:m,icon:mt(qb,{width:48}),description:g}),mt(Fa,{children:i.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(s?.recoveryMethod||"")?y!==s?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return Go(Se,{onClick:()=>w("google-drive"),children:[mt(cd,{children:mt(sc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return Go(Se,{onClick:()=>w("icloud"),children:[mt(cd,{children:mt(ac,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return Go(Se,{onClick:()=>{let T=yp({isCreatingWallet:l,skipSplashScreen:!0});r(T)},children:[mt(cd,{children:mt(zb,{style:{width:18}})}),u?"Reset your":"Set a"," password"]},y);default:return null}})})]}),mt($,{})]})};import{BigNumber as N1}from"@ethersproject/bignumber";import{useMemo as _E,useEffect as D1,useState as ar}from"react";import Rn from"styled-components";import{ProviderErrors as ud,calculateTotalGasEstimate as AE,populateTransactionRequest as xE}from"@privy-io/js-sdk-core";import{EtherscanProvider as QY}from"@ethersproject/providers";import{QuantityToBigNumber as Qb}from"@privy-io/js-sdk-core";async function cc(e,t,r,o,n,a){o=Object.assign({chainId:so},o),Jb(o);let s=(await r.rpc({address:t,accessToken:e,requesterAppId:a,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(s)}async function pc(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,s=!n.sub(Qb(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:s}}function Jb(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Xb(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function Xb(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&eE(e);return t||r||o}function eE(e){return/^-?0x[a-f0-9]+$/i.test(e)}function dc(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}function A1(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as rE,ClipboardDocumentIcon as oE,ClipboardDocumentCheckIcon as nE}from"@heroicons/react/24/outline";import{useState as iE}from"react";import ir from"styled-components";import{ErrorCode as uc}from"@ethersproject/logger";var tE=new Set([uc.CALL_EXCEPTION,uc.NONCE_EXPIRED,uc.REPLACEMENT_UNDERPRICED,uc.TRANSACTION_REPLACED]),x1=e=>{let t;return e.code&&e.code!==-32e3&&tE.has(e.code)&&(t=e.transactionHash),t},k1=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as CE,jsx as Tt,jsxs as xn}from"react/jsx-runtime";var aE=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=x1(e),o=k1(e);return{errorCode:t,transactionHash:r,errorMessage:o}},sE=()=>xn(dE,{children:[Tt(mE,{}),Tt(uE,{})]}),M1=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=k(),[a,i]=iE(!1),{errorCode:s,transactionHash:l,errorMessage:c}=aE(e),u=n.find(h=>h.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return xn(CE,{children:[Tt(P,{onClose:r}),xn(lE,{children:[Tt(sE,{}),Tt(cE,{children:s}),Tt(pE,{children:"Please try again."}),xn(I1,{children:[Tt(R1,{children:"Error message"}),Tt(W1,{clickable:!1,children:c})]}),l&&xn(I1,{children:[Tt(R1,{children:"Transaction hash"}),xn(hE,{children:["Copy this hash to view details about the transaction on a"," ",Tt("u",{children:Tt("a",{href:u,children:"block explorer"})}),"."]}),xn(W1,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(l),i(!0)},children:[l,Tt(vE,{clicked:a})]})]}),Tt(fE,{onClick:()=>o({resetNonce:!!l}),children:"Retry transaction"})]}),Tt(K,{})]})},lE=ir.div`
2376
+ `,Jb={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},Xb=({onClose:e})=>Go(C1,{children:[mt(xe,{title:"Why do I need to secure my account?",icon:mt(Yb,{width:48}),description:Go(pd,{children:[mt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),mt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),mt(D,{onClick:e,children:"Select backup method"})]}),_1=()=>{let[e,t]=Zb(!1),{navigate:r,setModalData:o,data:n}=x(),{user:a}=H(),{embeddedWallets:i}=lt(),s=we(a),l=s===null,{isInAccountCreateFlow:c,isResettingPassword:u}=n.recoverySelection,f=s?.recoveryMethod!=="privy",m=f?"Update backup method":"Secure your account",v=f?Go("span",{children:["Your account is currently secured using"," ",mt("strong",{children:Jb[s?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function w(y){o({recoveryOAuthStatus:{provider:y,action:l?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return Go(pd,{children:[mt(P,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?mt(Xb,{onClose:()=>t(!1)}):Go(pd,{children:[mt(xe,{title:m,icon:mt(Kb,{width:48}),description:v}),mt(Ua,{children:i.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(s?.recoveryMethod||"")?y!==s?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return Go(Se,{onClick:()=>w("google-drive"),children:[mt(cd,{children:mt(sc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return Go(Se,{onClick:()=>w("icloud"),children:[mt(cd,{children:mt(ac,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return Go(Se,{onClick:()=>{let T=yp({isCreatingWallet:l,skipSplashScreen:!0});r(T)},children:[mt(cd,{children:mt(jb,{style:{width:18}})}),u?"Reset your":"Set a"," password"]},y);default:return null}})})]}),mt($,{})]})};import{BigNumber as N1}from"@ethersproject/bignumber";import{useMemo as kE,useEffect as D1,useState as ar}from"react";import kn from"styled-components";import{ProviderErrors as ud,calculateTotalGasEstimate as RE,populateTransactionRequest as IE}from"@privy-io/js-sdk-core";import{EtherscanProvider as eZ}from"@ethersproject/providers";import{QuantityToBigNumber as eE}from"@privy-io/js-sdk-core";async function cc(e,t,r,o,n,a){o=Object.assign({chainId:so},o),tE(o);let s=(await r.rpc({address:t,accessToken:e,requesterAppId:a,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(s)}async function pc(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,s=!n.sub(eE(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:s}}function tE(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!rE(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function rE(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&oE(e);return t||r||o}function oE(e){return/^-?0x[a-f0-9]+$/i.test(e)}function dc(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}function A1(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as iE,ClipboardDocumentIcon as aE,ClipboardDocumentCheckIcon as sE}from"@heroicons/react/24/outline";import{useState as lE}from"react";import ir from"styled-components";import{ErrorCode as uc}from"@ethersproject/logger";var nE=new Set([uc.CALL_EXCEPTION,uc.NONCE_EXPIRED,uc.REPLACEMENT_UNDERPRICED,uc.TRANSACTION_REPLACED]),x1=e=>{let t;return e.code&&e.code!==-32e3&&nE.has(e.code)&&(t=e.transactionHash),t},k1=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as EE,jsx as Tt,jsxs as An}from"react/jsx-runtime";var cE=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=x1(e),o=k1(e);return{errorCode:t,transactionHash:r,errorMessage:o}},pE=()=>An(hE,{children:[Tt(yE,{}),Tt(fE,{})]}),W1=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=k(),[a,i]=lE(!1),{errorCode:s,transactionHash:l,errorMessage:c}=cE(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return An(EE,{children:[Tt(P,{onClose:r}),An(dE,{children:[Tt(pE,{}),Tt(uE,{children:s}),Tt(mE,{children:"Please try again."}),An(I1,{children:[Tt(R1,{children:"Error message"}),Tt(M1,{clickable:!1,children:c})]}),l&&An(I1,{children:[Tt(R1,{children:"Transaction hash"}),An(vE,{children:["Copy this hash to view details about the transaction on a"," ",Tt("u",{children:Tt("a",{href:u,children:"block explorer"})}),"."]}),An(M1,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(l),i(!0)},children:[l,Tt(bE,{clicked:a})]})]}),Tt(gE,{onClick:()=>o({resetNonce:!!l}),children:"Retry transaction"})]}),Tt(K,{})]})},dE=ir.div`
2377
2377
  display: flex;
2378
2378
  flex-direction: column;
2379
2379
  align-items: center;
2380
2380
  justify-content: center;
2381
- `,cE=ir.span`
2381
+ `,uE=ir.span`
2382
2382
  color: var(--privy-color-foreground);
2383
2383
  text-align: center;
2384
2384
  font-size: 1.125rem;
@@ -2386,7 +2386,7 @@ You will have to sign up with another method first to register a passkey for you
2386
2386
  line-height: 1.25rem; /* 111.111% */
2387
2387
  text-align: center;
2388
2388
  margin: 10px;
2389
- `,pE=ir.span`
2389
+ `,mE=ir.span`
2390
2390
  margin-top: 4px;
2391
2391
  margin-bottom: 10px;
2392
2392
  color: var(--privy-color-foreground-3);
@@ -2397,7 +2397,7 @@ You will have to sign up with another method first to register a passkey for you
2397
2397
  font-weight: 400;
2398
2398
  line-height: 20px; /* 142.857% */
2399
2399
  letter-spacing: -0.008px;
2400
- `,dE=ir.div`
2400
+ `,hE=ir.div`
2401
2401
  position: relative;
2402
2402
  width: 60px;
2403
2403
  height: 60px;
@@ -2405,19 +2405,19 @@ You will have to sign up with another method first to register a passkey for you
2405
2405
  display: flex;
2406
2406
  justify-content: center;
2407
2407
  align-items: center;
2408
- `,uE=ir(rE)`
2408
+ `,fE=ir(iE)`
2409
2409
  position: absolute;
2410
2410
  width: 35px;
2411
2411
  height: 35px;
2412
2412
  color: var(--privy-color-error);
2413
- `,mE=ir.div`
2413
+ `,yE=ir.div`
2414
2414
  position: absolute;
2415
2415
  width: 60px;
2416
2416
  height: 60px;
2417
2417
  border-radius: 50%;
2418
2418
  background-color: var(--privy-color-error);
2419
2419
  opacity: 0.1;
2420
- `,fE=ir(U)`
2420
+ `,gE=ir(D)`
2421
2421
  && {
2422
2422
  margin-top: 24px;
2423
2423
  }
@@ -2435,7 +2435,7 @@ You will have to sign up with another method first to register a passkey for you
2435
2435
  flex-direction: column;
2436
2436
  justify-content: center;
2437
2437
  align-items: center;
2438
- `,hE=ir.text`
2438
+ `,vE=ir.text`
2439
2439
  position: relative;
2440
2440
  width: 100%;
2441
2441
  padding: 5px;
@@ -2443,7 +2443,7 @@ You will have to sign up with another method first to register a passkey for you
2443
2443
  color: var(--privy-color-foreground-3);
2444
2444
  text-align: left;
2445
2445
  word-wrap: break-word;
2446
- `,W1=ir.span`
2446
+ `,M1=ir.span`
2447
2447
  position: relative;
2448
2448
  width: 100%;
2449
2449
  background-color: var(--privy-color-background-2);
@@ -2461,54 +2461,54 @@ You will have to sign up with another method first to register a passkey for you
2461
2461
  &:hover {
2462
2462
  background-color: var(--privy-color-foreground-4);
2463
2463
  }`}
2464
- `,yE=ir(oE)`
2464
+ `,CE=ir(aE)`
2465
2465
  position: absolute;
2466
2466
  top: 13px;
2467
2467
  right: 13px;
2468
2468
  width: 24px;
2469
2469
  height: 24px;
2470
- `,gE=ir(nE)`
2470
+ `,wE=ir(sE)`
2471
2471
  position: absolute;
2472
2472
  top: 13px;
2473
2473
  right: 13px;
2474
2474
  width: 24px;
2475
2475
  height: 24px;
2476
- `,vE=({clicked:e})=>e?Tt(gE,{}):Tt(yE,{});import{Fragment as wE,jsx as mc}from"react/jsx-runtime";var O1=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return mc(ed,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return mc(ed,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return mc(wE,{children:mc(e1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})};import{BigNumber as dd}from"@ethersproject/bignumber";import bE from"styled-components";import{Fragment as SE,jsx as kn,jsxs as PE}from"react/jsx-runtime";var EE=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=dd.from(e.gasUsed),o=dd.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=dd.from(t);n=n.add(a)}return n.toString()}catch{return}else return},L1=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i,receiptHeader:s,receiptDescription:l})=>PE(SE,{children:[kn(P,{onClose:o}),kn(un,{title:s??"Transaction complete!",description:l??"You're all set."}),kn(Ri,{tokenPrice:n,from:t.from,to:t.to,gas:EE(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),kn(Ao,{}),kn(TE,{loading:!1,onClick:o,children:"All Done"}),kn(te,{}),kn($,{})]}),TE=bE(U)`
2476
+ `,bE=({clicked:e})=>e?Tt(wE,{}):Tt(CE,{});import{Fragment as TE,jsx as mc}from"react/jsx-runtime";var O1=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return mc(ed,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return mc(ed,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return mc(TE,{children:mc(e1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})};import{BigNumber as dd}from"@ethersproject/bignumber";import SE from"styled-components";import{Fragment as AE,jsx as xn,jsxs as xE}from"react/jsx-runtime";var PE=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=dd.from(e.gasUsed),o=dd.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=dd.from(t);n=n.add(a)}return n.toString()}catch{return}else return},L1=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i,receiptHeader:s,receiptDescription:l})=>xE(AE,{children:[xn(P,{onClose:o}),xn(un,{title:s??"Transaction complete!",description:l??"You're all set."}),xn(ki,{tokenPrice:n,from:t.from,to:t.to,gas:PE(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),xn(Ao,{}),xn(_E,{loading:!1,onClick:o,children:"All Done"}),xn(te,{}),xn($,{})]}),_E=SE(D)`
2477
2477
  && {
2478
2478
  margin-top: 24px;
2479
2479
  }
2480
2480
  transition: color 350ms ease, background-color 350ms ease;
2481
- `;import{Fragment as F1,jsx as St,jsxs as Wi}from"react/jsx-runtime";var B1=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=Na(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:s,nativeTokenSymbolForChainId:l,appId:c}=k(),{app:u,navigate:h,data:m,onUserCloseViaDialogOrKeybindRef:g,setModalData:w}=x(),{transactionRequest:y,onSuccess:T,onFailure:_,uiOptions:b,fundWalletConfig:S,requesterAppId:I}=m.sendTransaction,[N,W]=ar(null),[R,B]=ar(null),[q,Y]=ar(""),[M,z]=ar(),[L,Ue]=ar(),[Ye,Oe]=ar(!1),J={INSUFFICIENT_FUNDS:`Add funds on ${s.find(Be=>Be.id===y.chainId)?.name??"this network"} to complete the transaction.`,ERROR_PREPARING:"There was an error preparing your transaction. Your transaction request will likely fail."},Ee=()=>{Y(""),z(void 0),Ue(void 0)},_e=(Be,He,Mn)=>{Y(Be),z(new st(new jt(He??Be,Mn??ud.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[vt,sr]=ar(!1),[Ot,it]=ar(!0),[se,Dr]=ar(null),[Fe,bo]=ar(y),{tokenPrice:O,isTokenPriceLoading:yt}=ec(Fe),Ur=l(y.chainId)||"ETH",[X,G]=ar(null),[le,at]=ar(null),[$o,Wn]=ar(!0);D1(()=>{e||(h("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let lr=y.from?r.find(Be=>Be.address===y.from):r.find(Be=>Be.walletClientType==="privy"&&!Be.imported),Ni=async()=>{if(!lr)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Be,externalTransactionId:He}=await a(lr.address,{config:S?.config||{}});w({fiatOnRampPrompt:{signedUrl:Be},fiatOnRampStatus:{externalTransactionId:He}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},no=_E(()=>ao(Fe.chainId,s,i,{appId:c}),[Fe.chainId,i]);async function za(Be){let He=Be;if(!await t()||!o||!lr)return;try{He=await xE(lr.address,Be,no),bo(He)}catch(Fr){console.error(Fr),_e(J.ERROR_PREPARING,Fr.reason)}let On=N1.from(0),Ka=N1.from(0);try{({totalGasEstimate:On,l1ExecutionFeeEstimate:Ka}=await AE(He,no)),G(On.toHexString()),at(Ka.toHexString())}catch{G(null)}try{let{balance:Fr,hasSufficientFunds:ja}=await pc(lr.address,He,On,no);Dr(Fr.toHexString()),ja||(it(!1),_e(J.INSUFFICIENT_FUNDS,"Wallet has insufficient funds on this network for this transaction."),u?.fiatOnRamp.enabled&&Oe(!0))}catch(Fr){console.warn(`Failed to fetch wallet balance with error: ${Fr}`)}Wn(!1)}D1(()=>{za(Fe)},[o]);let qe=A1(Fe),$a=qe==="SEND"?`Send ${Ur}`:"Review transaction",Di={modalTitle:b.header||b.modalTitle||$a,buttonText:b.buttonText||"Submit"},Ko=()=>{vt||(R?T(R):_(M||new st(new jt("The user rejected the request",ud.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=Ko,O===void 0&&yt||$o?Wi(F1,{children:[b.transactionInfo?.contractInfo?.imgUrl&&St(Fs,{src:b.transactionInfo?.contractInfo?.imgUrl}),St(P,{title:Di.modalTitle,onClose:Ko}),St(U1,{children:St(hi,{})})]}):N!==null?St(L1,{txn:Fe,onClose:Ko,receipt:N,transactionInfo:b.transactionInfo,tokenPrice:O,tokenSymbol:Ur,l1GasEstimate:le,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):L?St(M1,{transactionError:L,chainId:Fe.chainId,onClose:Ko,onRetry:({resetNonce:Be})=>{Ee();let He=Fe;Be&&(He={...Fe,nonce:void 0}),za(He)}}):Wi(F1,{children:[St(P,{title:Di.modalTitle,onClose:Ko}),Wi(U1,{children:[Wi(WE,{children:[St(O1,{txn:Fe,txnFamily:qe,uiOptions:b,tokenSymbol:Ur,tokenPrice:O}),lr?St(Ri,{from:lr.address,to:Fe.to,txn:Fe,transactionInfo:b.transactionInfo,gas:X||void 0,tokenPrice:O,tokenSymbol:Ur}):null,St(OE,{})]}),Wi(ME,{children:[St(kE,{children:q}),St(Zg,{txn:Fe,address:lr?.address??"",hasFunds:Ot,balance:se}),Wi(RE,{children:[Ye&&St(U,{onClick:Ni,children:"Add Funds"}),St(IE,{disabled:vt||!Ot,loading:!o||vt,loadingText:vt?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{sr(!0);let Be=await t();if(Be&&!vt&&lr)try{let He=await cc(Be,lr.address,o,Fe,no,I);B(He);let Mn=await He.wait();W(dc(Mn)),Ee()}catch(He){console.warn({transaction:Fe,error:He}),Ue(He),z(new st(new jt(He.reason??"Error processing transaction",ud.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{sr(!1)}},children:Di.buttonText})]})]}),St(te,{}),St($,{})]})]})},U1=Rn.div`
2481
+ `;import{Fragment as F1,jsx as St,jsxs as Ii}from"react/jsx-runtime";var B1=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=La(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:s,nativeTokenSymbolForChainId:l,appId:c}=k(),{app:u,navigate:f,data:m,onUserCloseViaDialogOrKeybindRef:v,setModalData:w}=x(),{transactionRequest:y,onSuccess:T,onFailure:_,uiOptions:b,fundWalletConfig:S,requesterAppId:I}=m.sendTransaction,[N,M]=ar(null),[R,B]=ar(null),[q,Y]=ar(""),[W,z]=ar(),[L,Ue]=ar(),[Ye,Oe]=ar(!1),X={INSUFFICIENT_FUNDS:`Add funds on ${s.find(Be=>Be.id===y.chainId)?.name??"this network"} to complete the transaction.`,ERROR_PREPARING:"There was an error preparing your transaction. Your transaction request will likely fail."},Ee=()=>{Y(""),z(void 0),Ue(void 0)},_e=(Be,He,Mn)=>{Y(Be),z(new st(new jt(He??Be,Mn??ud.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[vt,sr]=ar(!1),[Ot,it]=ar(!0),[se,Dr]=ar(null),[Fe,bo]=ar(y),{tokenPrice:O,isTokenPriceLoading:yt}=ec(Fe),Ur=l(y.chainId)||"ETH",[Q,G]=ar(null),[le,at]=ar(null),[$o,In]=ar(!0);D1(()=>{e||(f("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let lr=y.from?r.find(Be=>Be.address===y.from):r.find(Be=>Be.walletClientType==="privy"&&!Be.imported),Li=async()=>{if(!lr)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Be,externalTransactionId:He}=await a(lr.address,{config:S?.config||{}});w({fiatOnRampPrompt:{signedUrl:Be},fiatOnRampStatus:{externalTransactionId:He}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},no=kE(()=>ao(Fe.chainId,s,i,{appId:c}),[Fe.chainId,i]);async function qa(Be){let He=Be;if(!await t()||!o||!lr)return;try{He=await IE(lr.address,Be,no),bo(He)}catch(Fr){console.error(Fr),_e(X.ERROR_PREPARING,Fr.reason)}let Wn=N1.from(0),$a=N1.from(0);try{({totalGasEstimate:Wn,l1ExecutionFeeEstimate:$a}=await RE(He,no)),G(Wn.toHexString()),at($a.toHexString())}catch{G(null)}try{let{balance:Fr,hasSufficientFunds:Ka}=await pc(lr.address,He,Wn,no);Dr(Fr.toHexString()),Ka||(it(!1),_e(X.INSUFFICIENT_FUNDS,"Wallet has insufficient funds on this network for this transaction."),u?.fiatOnRamp.enabled&&Oe(!0))}catch(Fr){console.warn(`Failed to fetch wallet balance with error: ${Fr}`)}In(!1)}D1(()=>{qa(Fe)},[o]);let qe=A1(Fe),za=qe==="SEND"?`Send ${Ur}`:"Review transaction",Ni={modalTitle:b.header||b.modalTitle||za,buttonText:b.buttonText||"Submit"},Ko=()=>{vt||(R?T(R):_(W||new st(new jt("The user rejected the request",ud.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return v.current=Ko,O===void 0&&yt||$o?Ii(F1,{children:[b.transactionInfo?.contractInfo?.imgUrl&&St(Us,{src:b.transactionInfo?.contractInfo?.imgUrl}),St(P,{title:Ni.modalTitle,onClose:Ko}),St(U1,{children:St(hi,{})})]}):N!==null?St(L1,{txn:Fe,onClose:Ko,receipt:N,transactionInfo:b.transactionInfo,tokenPrice:O,tokenSymbol:Ur,l1GasEstimate:le,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):L?St(W1,{transactionError:L,chainId:Fe.chainId,onClose:Ko,onRetry:({resetNonce:Be})=>{Ee();let He=Fe;Be&&(He={...Fe,nonce:void 0}),qa(He)}}):Ii(F1,{children:[St(P,{title:Ni.modalTitle,onClose:Ko}),Ii(U1,{children:[Ii(LE,{children:[St(O1,{txn:Fe,txnFamily:qe,uiOptions:b,tokenSymbol:Ur,tokenPrice:O}),lr?St(ki,{from:lr.address,to:Fe.to,txn:Fe,transactionInfo:b.transactionInfo,gas:Q||void 0,tokenPrice:O,tokenSymbol:Ur}):null,St(DE,{})]}),Ii(NE,{children:[St(ME,{children:q}),St(Zg,{txn:Fe,address:lr?.address??"",hasFunds:Ot,balance:se}),Ii(WE,{children:[Ye&&St(D,{onClick:Li,children:"Add Funds"}),St(OE,{disabled:vt||!Ot,loading:!o||vt,loadingText:vt?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{sr(!0);let Be=await t();if(Be&&!vt&&lr)try{let He=await cc(Be,lr.address,o,Fe,no,I);B(He);let Mn=await He.wait();M(dc(Mn)),Ee()}catch(He){console.warn({transaction:Fe,error:He}),Ue(He),z(new st(new jt(He.reason??"Error processing transaction",ud.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{sr(!1)}},children:Ni.buttonText})]})]}),St(te,{}),St($,{})]})]})},U1=kn.div`
2482
2482
  display: flex;
2483
2483
  flex-direction: column;
2484
2484
  justify-content: space-between;
2485
2485
  flex-grow: 1;
2486
- `,kE=Rn.div`
2486
+ `,ME=kn.div`
2487
2487
  font-size: 13px;
2488
2488
  color: var(--privy-color-error);
2489
2489
  width: 100%;
2490
2490
  margin-top: 16px;
2491
- `,RE=Rn.div`
2491
+ `,WE=kn.div`
2492
2492
  display: flex;
2493
2493
  direction: row;
2494
2494
  justify-content: space-between;
2495
2495
  align-items: center;
2496
2496
  gap: 8px;
2497
- `,IE=Rn(U)`
2497
+ `,OE=kn(D)`
2498
2498
  transition: color 350ms ease, background-color 350ms ease;
2499
- `,WE=Rn.div`
2499
+ `,LE=kn.div`
2500
2500
  height: 100%;
2501
2501
  display: flex;
2502
2502
  flex-direction: column;
2503
2503
  justify-content: space-evenly;
2504
2504
  flex-grow: 1;
2505
- `,ME=Rn.div`
2505
+ `,NE=kn.div`
2506
2506
  display: flex;
2507
2507
  flex-direction: column;
2508
2508
  gap: 8px;
2509
- `,OE=Rn.div`
2509
+ `,DE=kn.div`
2510
2510
  flex-grow: 1;
2511
- `;import{isHexString as DE}from"@ethersproject/bytes";import{toUtf8String as UE}from"@ethersproject/strings";import{useEffect as G1,useState as Ha}from"react";import Mi from"styled-components";import{ProviderErrors as md}from"@privy-io/js-sdk-core";import LE from"styled-components";var H1=LE.span`
2511
+ `;import{isHexString as BE}from"@ethersproject/bytes";import{toUtf8String as HE}from"@ethersproject/strings";import{useEffect as G1,useState as Ba}from"react";import Mi from"styled-components";import{ProviderErrors as md}from"@privy-io/js-sdk-core";import UE from"styled-components";var H1=UE.span`
2512
2512
  margin-top: 4px;
2513
2513
  color: var(--privy-color-foreground);
2514
2514
  text-align: center;
@@ -2516,13 +2516,13 @@ You will have to sign up with another method first to register a passkey for you
2516
2516
  font-size: 0.875rem;
2517
2517
  font-weight: 400;
2518
2518
  line-height: 1.375rem; /* 157.143% */
2519
- `;import NE from"styled-components";var V1=NE.span`
2519
+ `;import FE from"styled-components";var V1=FE.span`
2520
2520
  color: var(--privy-color-foreground);
2521
2521
  font-size: 1.125rem;
2522
2522
  font-weight: 600;
2523
2523
  line-height: 1.875rem; /* 166.667% */
2524
2524
  text-align: center;
2525
- `;import{Fragment as $1,jsx as Qe,jsxs as Va}from"react/jsx-runtime";var FE=e=>{if(!DE(e))return e;try{return UE(e)}catch{return e}},BE=e=>JSON.stringify(e,null,2),HE=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Qe(GE,{children:Object.entries(r).map(([o,n])=>Va("li",{children:[Va("strong",{children:[o,":"]})," ",t(n)]},o))}):Qe("span",{children:String(r)});return Qe("div",{children:t(e)})},VE=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Va($1,{children:[Qe(z1,{children:Qe(HE,{data:o})}),Qe(Oo,{text:BE(e.typedData),itemName:"full payload to clipboard"})," "]})},q1=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=k(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=x(),[i,s]=Ha(!0),[l,c]=Ha(""),[u,h]=Ha(),[m,g]=Ha(null),[w,y]=Ha(!1),T=m!==null;G1(()=>{e||o("LANDING")},[e]),G1(()=>{t(Un).then(q=>{s(!1),q||(c("An error has occurred, please try again."),h(new st(new jt(l,md.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:_,data:b,confirmAndSign:S,onSuccess:I,onFailure:N,uiOptions:W}=n.signMessage,R={title:W.title||"Sign message",description:W.description||"Signing this message will not cost you any fees.",buttonText:W.buttonText||"Sign and continue"},B=q=>{q?I(q):N(u||new st(new jt("The user rejected the request.",md.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),c(""),h(void 0)},200)};return a.current=()=>{B(m)},Va($1,{children:[Qe(P,{onClose:()=>B(m)}),Qe(ee,{}),W.iconUrl&&typeof W.iconUrl=="string"?Qe($E,{children:Qe(Ql,{size:"sm",src:W.iconUrl,alt:"app image"})}):null,Qe(V1,{children:R.title}),Qe(H1,{children:R.description}),_==="personal_sign"&&Qe(z1,{children:FE(b)}),_==="eth_signTypedData_v4"&&Qe(VE,{typedData:b}),Qe(KE,{}),Qe(qE,{fail:!0,children:l}),Qe(lf,{disabled:w||T||i,loading:w,onClick:async()=>{y(!0),c("");try{let q=await S();g(q),y(!1),setTimeout(()=>{B(q)},Le)}catch(q){console.error(q),c("An error has occurred, please try again."),h(new st(new jt(l,md.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:w?"Signing...":T?Va(zE,{children:[Qe(wl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Qe("span",{children:"Success"})]}):R.buttonText}),Qe(te,{}),Qe($,{})]})},z1=Mi.div`
2525
+ `;import{Fragment as $1,jsx as Qe,jsxs as Ha}from"react/jsx-runtime";var VE=e=>{if(!BE(e))return e;try{return HE(e)}catch{return e}},GE=e=>JSON.stringify(e,null,2),qE=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Qe($E,{children:Object.entries(r).map(([o,n])=>Ha("li",{children:[Ha("strong",{children:[o,":"]})," ",t(n)]},o))}):Qe("span",{children:String(r)});return Qe("div",{children:t(e)})},zE=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Ha($1,{children:[Qe(z1,{children:Qe(qE,{data:o})}),Qe(Oo,{text:GE(e.typedData),itemName:"full payload to clipboard"})," "]})},q1=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=k(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=x(),[i,s]=Ba(!0),[l,c]=Ba(""),[u,f]=Ba(),[m,v]=Ba(null),[w,y]=Ba(!1),T=m!==null;G1(()=>{e||o("LANDING")},[e]),G1(()=>{t(Dn).then(q=>{s(!1),q||(c("An error has occurred, please try again."),f(new st(new jt(l,md.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:_,data:b,confirmAndSign:S,onSuccess:I,onFailure:N,uiOptions:M}=n.signMessage,R={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=q=>{q?I(q):N(u||new st(new jt("The user rejected the request.",md.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{v(null),c(""),f(void 0)},200)};return a.current=()=>{B(m)},Ha($1,{children:[Qe(P,{onClose:()=>B(m)}),Qe(ee,{}),M.iconUrl&&typeof M.iconUrl=="string"?Qe(YE,{children:Qe(Ql,{size:"sm",src:M.iconUrl,alt:"app image"})}):null,Qe(V1,{children:R.title}),Qe(H1,{children:R.description}),_==="personal_sign"&&Qe(z1,{children:VE(b)}),_==="eth_signTypedData_v4"&&Qe(zE,{typedData:b}),Qe(ZE,{}),Qe(KE,{fail:!0,children:l}),Qe(sh,{disabled:w||T||i,loading:w,onClick:async()=>{y(!0),c("");try{let q=await S();v(q),y(!1),setTimeout(()=>{B(q)},Le)}catch(q){console.error(q),c("An error has occurred, please try again."),f(new st(new jt(l,md.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:w?"Signing...":T?Ha(jE,{children:[Qe(Cl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Qe("span",{children:"Success"})]}):R.buttonText}),Qe(te,{}),Qe($,{})]})},z1=Mi.div`
2526
2526
  margin-top: 1.5rem;
2527
2527
  background-color: var(--privy-color-background-2);
2528
2528
  border-radius: var(--privy-border-radius-md);
@@ -2541,7 +2541,7 @@ You will have to sign up with another method first to register a passkey for you
2541
2541
  display: none; /* Safari and Chrome */
2542
2542
  }
2543
2543
  }
2544
- `,GE=Mi.ul`
2544
+ `,$E=Mi.ul`
2545
2545
  margin-left: 12px !important;
2546
2546
  white-space: nowrap;
2547
2547
 
@@ -2553,7 +2553,7 @@ You will have to sign up with another method first to register a passkey for you
2553
2553
  font-weight: 500 !important;
2554
2554
  }
2555
2555
  }
2556
- `,qE=Mi.div`
2556
+ `,KE=Mi.div`
2557
2557
  line-height: 20px;
2558
2558
  height: 20px;
2559
2559
  font-size: 13px;
@@ -2563,20 +2563,20 @@ You will have to sign up with another method first to register a passkey for you
2563
2563
  width: 100%;
2564
2564
  margin-top: 16px;
2565
2565
  margin-bottom: 4px;
2566
- `,zE=Mi.span`
2566
+ `,jE=Mi.span`
2567
2567
  display: flex;
2568
2568
  align-items: center;
2569
2569
  gap: 8px;
2570
- `,$E=Mi.div`
2570
+ `,YE=Mi.div`
2571
2571
  display: flex;
2572
2572
  flex-direction: column;
2573
2573
  justify-content: center;
2574
2574
  align-items: center;
2575
2575
  width: 100%;
2576
2576
  height: 82px;
2577
- `,KE=Mi.div`
2577
+ `,ZE=Mi.div`
2578
2578
  flex-grow: 1;
2579
- `;import{useEffect as K1,useState as j1}from"react";import jE from"styled-components";import{Fragment as ZE,jsx as ro,jsxs as fc}from"react/jsx-runtime";var Y1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:a,navigate:i,resetNavigation:s}=x(),{initLoginWithTelegram:l,loginWithTelegram:c,updateWallets:u,setReadyToTrue:h,closePrivyModal:m,createAnalyticsEvent:g}=k(),[w,y]=j1(!1),[T,_]=j1(void 0),b=Le;async function S(){try{await c(),y(!0),h(!0)}catch(W){if(W?.privyErrorCode==="allowlist_rejected"){_(void 0),s(),i("ALLOWLIST_REJECTION_SCREEN");return}if(W?.privyErrorCode==="max_accounts_reached"){console.error(new cr(W).toString()),_(void 0),s(),i("USER_LIMIT_REACHED_SCREEN");return}if(W?.privyErrorCode==="user_does_not_exist"){_(void 0),s(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:R,detail:B}=Lc(W);_({retryable:R,detail:B,message:"Authentication failed"})}}K1(()=>{S()},[]),K1(()=>{if(!(r&&e&&w&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},b);return()=>clearTimeout(B)}if(Ut(o,n?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},b);return()=>clearTimeout(B)}u();let R=setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),b);return()=>clearTimeout(R)},[r,e,w,o]);let I=w?"Successfully connected with Telegram":T?T.message:"Verifying connection to Telegram",N="";return w?N="You\u2019re good to go!":T?N=T.detail:N="Just a few moments more",fc(ZE,{children:[ro(P,{}),ro(ee,{}),fc(YE,{children:[ro(Ke,{children:fc("div",{children:[ro(Je,{success:w,fail:!!T}),ro(Dl,{style:{width:"38px",height:"38px"}})]})}),fc(je,{children:[ro("h3",{children:I}),ro("p",{children:N})]}),T&&T?.retryable?ro(ei,{onClick:()=>{l().then(async()=>S()).catch(W=>{let{retryable:R,detail:B}=Lc(W);_({retryable:R,detail:B,message:"Authentication failed"})}),_(void 0)},disabled:!w&&!T?.retryable,children:"Retry"}):null]}),ro(te,{}),ro(K,{})]})},YE=jE.div`
2579
+ `;import{useEffect as K1,useState as j1}from"react";import QE from"styled-components";import{Fragment as XE,jsx as ro,jsxs as hc}from"react/jsx-runtime";var Y1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:a,navigate:i,resetNavigation:s}=x(),{initLoginWithTelegram:l,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:m,createAnalyticsEvent:v}=k(),[w,y]=j1(!1),[T,_]=j1(void 0),b=Le;async function S(){try{await c(),y(!0),f(!0)}catch(M){if(M?.privyErrorCode==="allowlist_rejected"){_(void 0),s(),i("ALLOWLIST_REJECTION_SCREEN");return}if(M?.privyErrorCode==="max_accounts_reached"){console.error(new cr(M).toString()),_(void 0),s(),i("USER_LIMIT_REACHED_SCREEN");return}if(M?.privyErrorCode==="user_does_not_exist"){_(void 0),s(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:R,detail:B}=Lc(M);_({retryable:R,detail:B,message:"Authentication failed"})}}K1(()=>{S()},[]),K1(()=>{if(!(r&&e&&w&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},b);return()=>clearTimeout(B)}if(Ut(o,n?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},b);return()=>clearTimeout(B)}u();let R=setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),b);return()=>clearTimeout(R)},[r,e,w,o]);let I=w?"Successfully connected with Telegram":T?T.message:"Verifying connection to Telegram",N="";return w?N="You\u2019re good to go!":T?N=T.detail:N="Just a few moments more",hc(XE,{children:[ro(P,{}),ro(ee,{}),hc(JE,{children:[ro(Ke,{children:hc("div",{children:[ro(Je,{success:w,fail:!!T}),ro(Dl,{style:{width:"38px",height:"38px"}})]})}),hc(je,{children:[ro("h3",{children:I}),ro("p",{children:N})]}),T&&T?.retryable?ro(Xn,{onClick:()=>{l().then(async()=>S()).catch(M=>{let{retryable:R,detail:B}=Lc(M);_({retryable:R,detail:B,message:"Authentication failed"})}),_(void 0)},disabled:!w&&!T?.retryable,children:"Retry"}):null]}),ro(te,{}),ro(K,{})]})},JE=QE.div`
2580
2580
  display: flex;
2581
2581
  flex-direction: column;
2582
2582
  align-items: center;
@@ -2584,9 +2584,9 @@ You will have to sign up with another method first to register a passkey for you
2584
2584
  margin-left: 27px;
2585
2585
  margin-right: 27px;
2586
2586
  gap: 24px;
2587
- `;import r8 from"@heroicons/react/24/outline/EnvelopeIcon";import QE from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as JE,useState as Z1}from"react";import J1 from"styled-components";import{Fragment as t8,jsx as Ga,jsxs as Q1}from"react/jsx-runtime";var X1=JE((e,t)=>{let[r,o]=Z1(""),[n,a]=Z1(!1),{authenticated:i,user:s}=H(),{initUpdateEmail:l}=k(),{navigate:c,setModalData:u,currentScreen:h}=x(),{enabled:m,token:g}=ye(),w=ps(r),y=n,T=n||!w,_=async S=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await l(s.email.address,r,S),c("AWAITING_PASSWORDLESS_CODE")}catch(I){u({errorModalData:{error:I,previousScreen:h||"LANDING"}})}a(!1)},b=()=>{m&&!g&&!i?(u({captchaModalData:{callback:S=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");return l(s.email.address,r,S)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):_(g)};return Q1(t8,{children:[Ga(XE,{children:Q1(e8,{children:[Ga(QE,{}),Ga("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:S=>o(S.target.value),onKeyUp:S=>{S.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:Ga(ti,{isSubmitting:y,onClick:b,disabled:T,children:"Submit"})]})}),e.stacked?Ga(U,{loadingText:null,loading:y,disabled:T,onClick:b,children:"Submit"}):null]})}),XE=J1.div`
2587
+ `;import i8 from"@heroicons/react/24/outline/EnvelopeIcon";import e8 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as t8,useState as Z1}from"react";import J1 from"styled-components";import{Fragment as n8,jsx as Va,jsxs as Q1}from"react/jsx-runtime";var X1=t8((e,t)=>{let[r,o]=Z1(""),[n,a]=Z1(!1),{authenticated:i,user:s}=H(),{initUpdateEmail:l}=k(),{navigate:c,setModalData:u,currentScreen:f}=x(),{enabled:m,token:v}=ye(),w=cs(r),y=n,T=n||!w,_=async S=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await l(s.email.address,r,S),c("AWAITING_PASSWORDLESS_CODE")}catch(I){u({errorModalData:{error:I,previousScreen:f||"LANDING"}})}a(!1)},b=()=>{m&&!v&&!i?(u({captchaModalData:{callback:S=>{if(!s?.email)throw new Error("User is required to have an email address to update it.");return l(s.email.address,r,S)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):_(v)};return Q1(n8,{children:[Va(r8,{children:Q1(o8,{children:[Va(e8,{}),Va("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:S=>o(S.target.value),onKeyUp:S=>{S.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:Va(ei,{isSubmitting:y,onClick:b,disabled:T,children:"Submit"})]})}),e.stacked?Va(D,{loadingText:null,loading:y,disabled:T,onClick:b,children:"Submit"}):null]})}),r8=J1.div`
2588
2588
  width: 100%;
2589
- `,e8=J1.label`
2589
+ `,o8=J1.label`
2590
2590
  display: block;
2591
2591
  position: relative;
2592
2592
  width: 100%;
@@ -2644,7 +2644,7 @@ You will have to sign up with another method first to register a passkey for you
2644
2644
  && > input::placeholder {
2645
2645
  color: var(--privy-color-foreground-3);
2646
2646
  }
2647
- `;import{Fragment as o8,jsx as qo,jsxs as n8}from"react/jsx-runtime";var e2=()=>n8(o8,{children:[qo(P,{},"header"),qo(ee,{}),qo(xe,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:qo(r8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),qo(mr,{children:qo(X1,{stacked:!0})}),qo(te,{}),qo($,{})]});import hd from"styled-components";import{jsx as t2}from"react/jsx-runtime";var r2=({style:e,...t})=>t2("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:t2("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as l8,jsx as In,jsxs as fd}from"react/jsx-runtime";var o2=()=>{let{navigate:e}=x();return fd(l8,{children:[In(P,{}),fd(i8,{children:[In(a8,{children:In(r2,{})}),fd(s8,{children:[In("h3",{children:"Unable to sign in"}),In("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),In(U,{onClick:()=>{e("LANDING")},children:"Go back"})]}),In($,{})]})},i8=hd.div`
2647
+ `;import{Fragment as a8,jsx as qo,jsxs as s8}from"react/jsx-runtime";var e2=()=>s8(a8,{children:[qo(P,{},"header"),qo(ee,{}),qo(xe,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:qo(i8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),qo(mr,{children:qo(X1,{stacked:!0})}),qo(te,{}),qo($,{})]});import fd from"styled-components";import{jsx as t2}from"react/jsx-runtime";var r2=({style:e,...t})=>t2("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:t2("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as d8,jsx as Rn,jsxs as hd}from"react/jsx-runtime";var o2=()=>{let{navigate:e}=x();return hd(d8,{children:[Rn(P,{}),hd(l8,{children:[Rn(c8,{children:Rn(r2,{})}),hd(p8,{children:[Rn("h3",{children:"Unable to sign in"}),Rn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Rn(D,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Rn($,{})]})},l8=fd.div`
2648
2648
  display: flex;
2649
2649
  flex-direction: column;
2650
2650
  align-items: center;
@@ -2653,7 +2653,7 @@ You will have to sign up with another method first to register a passkey for you
2653
2653
  width: 100%;
2654
2654
  padding-top: 8px;
2655
2655
  padding-bottom: 32px;
2656
- `,a8=hd.div`
2656
+ `,c8=fd.div`
2657
2657
  display: flex;
2658
2658
  align-items: center;
2659
2659
  justify-content: center;
@@ -2662,11 +2662,11 @@ You will have to sign up with another method first to register a passkey for you
2662
2662
  color: var(--privy-color-error);
2663
2663
  background-color: var(--privy-color-error-light);
2664
2664
  border-radius: 50%;
2665
- `,s8=hd.div`
2665
+ `,p8=fd.div`
2666
2666
  display: flex;
2667
2667
  flex-direction: column;
2668
2668
  gap: 8px;
2669
- `;import p8,{createGlobalStyle as d8}from"styled-components";var c8=`
2669
+ `;import m8,{createGlobalStyle as h8}from"styled-components";var u8=`
2670
2670
  *,
2671
2671
  ::before,
2672
2672
  ::after {
@@ -2896,7 +2896,7 @@ You will have to sign up with another method first to register a passkey for you
2896
2896
  [hidden] {
2897
2897
  display: none;
2898
2898
  }
2899
- `,n2=c8;var i2=d8`
2899
+ `,n2=u8;var i2=h8`
2900
2900
  :root {
2901
2901
  // Borders
2902
2902
  --privy-border-radius-sm: 6px;
@@ -2930,7 +2930,7 @@ You will have to sign up with another method first to register a passkey for you
2930
2930
  --privy-height-modal-full: 620px;
2931
2931
  --privy-height-modal-compact: 480px;
2932
2932
  };
2933
- `,yd=p8.div`
2933
+ `,yd=m8.div`
2934
2934
  // css normalize only the privy application to avoid conflicts
2935
2935
  // with consuming application
2936
2936
  ${n2}
@@ -2984,7 +2984,7 @@ You will have to sign up with another method first to register a passkey for you
2984
2984
  opacity: 1;
2985
2985
  }
2986
2986
  }
2987
- `;import{Dialog as a2,Transition as gd}from"@headlessui/react";import vd from"react";import qa from"styled-components";import{jsx as Oi,jsxs as y8}from"react/jsx-runtime";var s2=({children:e,open:t,onClick:r,...o})=>Oi(gd,{show:t,as:vd.Fragment,children:y8(a2,{onClose:r,...o,as:m8,children:[Oi(gd.Child,{as:vd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Oi(u8,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Oi(f8,{children:Oi(gd.Child,{as:vd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Oi(a2.Panel,{as:h8,children:e})})})]})}),u8=qa.div`
2987
+ `;import{Dialog as a2,Transition as gd}from"@headlessui/react";import vd from"react";import Ga from"styled-components";import{jsx as Wi,jsxs as C8}from"react/jsx-runtime";var s2=({children:e,open:t,onClick:r,...o})=>Wi(gd,{show:t,as:vd.Fragment,children:C8(a2,{onClose:r,...o,as:y8,children:[Wi(gd.Child,{as:vd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Wi(f8,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Wi(g8,{children:Wi(gd.Child,{as:vd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Wi(a2.Panel,{as:v8,children:e})})})]})}),f8=Ga.div`
2988
2988
  position: fixed;
2989
2989
  inset: 0;
2990
2990
 
@@ -2997,10 +2997,10 @@ You will have to sign up with another method first to register a passkey for you
2997
2997
  backdrop-filter: unset;
2998
2998
  -webkit-backdrop-filter: unset;
2999
2999
  }
3000
- `,m8=qa.div`
3000
+ `,y8=Ga.div`
3001
3001
  position: relative;
3002
3002
  z-index: 999999;
3003
- `,f8=qa.div`
3003
+ `,g8=Ga.div`
3004
3004
  position: fixed;
3005
3005
  inset: 0;
3006
3006
  display: flex;
@@ -3008,7 +3008,7 @@ You will have to sign up with another method first to register a passkey for you
3008
3008
  justify-content: center;
3009
3009
  width: 100vw;
3010
3010
  min-height: 100vh;
3011
- `,h8=qa.div`
3011
+ `,v8=Ga.div`
3012
3012
  // reset some default dialog styles
3013
3013
  padding: 0;
3014
3014
  background: transparent;
@@ -3055,13 +3055,13 @@ You will have to sign up with another method first to register a passkey for you
3055
3055
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3056
3056
  border-radius: var(--privy-border-radius-lg);
3057
3057
  }
3058
- `,l2=qa.div`
3058
+ `,l2=Ga.div`
3059
3059
  display: flex;
3060
3060
  flex-direction: column;
3061
3061
  align-items: center;
3062
3062
  justify-content: center;
3063
3063
  height: 100%;
3064
- `;import{Fragment as p2,jsx as et,jsxs as d2}from"react/jsx-runtime";var w8={["LANDING"]:Jy,["CONNECT_OR_CREATE"]:Zy,["AWAITING_PASSWORDLESS_CODE"]:Wf,["AWAITING_CONNECTION"]:th,["AWAITING_CONNECT_ONLY_CONNECTION"]:nh,["AWAITING_FARCASTER_CONNECTION"]:py,["AWAITING_FARCASTER_SIGNER"]:yy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:p1,["PHANTOM_INTERSTITIAL_SCREEN"]:f1,["LOGIN_FAILED_SCREEN"]:ug,["AWAITING_OAUTH_SCREEN"]:s1,["CROSS_APP_AUTH_SCREEN"]:lh,["ALLOWLIST_REJECTION_SCREEN"]:Tf,["ACCOUNT_NOT_FOUND_SCREEN"]:hf,["USER_LIMIT_REACHED_SCREEN"]:o2,["INSTALL_PHANTOM_SCREEN"]:Ry,["LINK_EMAIL_SCREEN"]:Xy,["LINK_PHONE_SCREEN"]:sg,["LINK_WALLET_SCREEN"]:lg,["LINK_PASSKEY_SCREEN"]:ig,["UPDATE_EMAIL_SCREEN"]:e2,["CONNECT_ONLY_LANDING_SCREEN"]:Zf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Kf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Th,["EMBEDDED_WALLET_CREATED_SCREEN"]:yh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:fh,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:h1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:_1,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:T1,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:wh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:q1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:B1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ey,["FIAT_ON_RAMP_STATUS_SCREEN"]:Sy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Yh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:jh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:P1,["MFA_ENROLLMENT_FLOW_SCREEN"]:_g,["CAPTCHA_SCREEN"]:Nf,["ERROR_SCREEN"]:Qh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Py,["AFFIRMATIVE_CONSENT_SCREEN"]:wf,["TELEGRAM_AUTH_SCREEN"]:Y1},b8=["LANDING","AWAITING_CONNECTION"],m2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=lt(),{ready:a,currentScreen:i}=x(),{status:s,execute:l,reset:c,enabled:u}=ye(),h=o&&i&&b8.includes(i)&&!n&&s==="ready";if(c2(()=>{h&&l()},[h]),c2(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN"&&i!=="CROSS_APP_AUTH_SCREEN"&&i!=="TELEGRAM_AUTH_SCREEN")return d2(p2,{children:[et(P,{}),et(ee,{}),et(l2,{children:et(ct,{})}),et(te,{}),et(K,{})]});if(!i&&e)return et(ad,{open:e,onClose:t});if(!i)return null;let m=w8[i];return d2(p2,{children:[et(_r,{if:!!e,children:et(m,{})}),et(_r,{if:!e,children:et(ad,{open:e,onClose:t})})]})},E8=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=v8(null),o=of(r);return et(S8,{style:{height:o},id:"privy-modal-content",children:et("div",{ref:r,children:et(m2,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},T8=()=>{let{closePrivyModal:e}=k(),{onUserCloseViaDialogOrKeybindRef:t}=x();return{gracefulClosePrivyModal:g8(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Cd=({open:e})=>{let{app:t}=x(),{gracefulClosePrivyModal:r}=T8(),[o,n]=C8(!1);jc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=e||o;return t.render.standalone?et(yd,{children:et(f2,{id:"privy-modal-content",children:et(m2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):et(s2,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:et(yd,{children:et(E8,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},f2=u2.div`
3064
+ `;import{Fragment as p2,jsx as et,jsxs as d2}from"react/jsx-runtime";var T8={["LANDING"]:Jy,["CONNECT_OR_CREATE"]:Zy,["AWAITING_PASSWORDLESS_CODE"]:Ih,["AWAITING_CONNECTION"]:Jh,["AWAITING_CONNECT_ONLY_CONNECTION"]:tf,["AWAITING_FARCASTER_CONNECTION"]:ly,["AWAITING_FARCASTER_SIGNER"]:hy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:p1,["PHANTOM_INTERSTITIAL_SCREEN"]:h1,["LOGIN_FAILED_SCREEN"]:ug,["AWAITING_OAUTH_SCREEN"]:s1,["CROSS_APP_AUTH_SCREEN"]:af,["ALLOWLIST_REJECTION_SCREEN"]:Eh,["ACCOUNT_NOT_FOUND_SCREEN"]:hh,["USER_LIMIT_REACHED_SCREEN"]:o2,["INSTALL_PHANTOM_SCREEN"]:xy,["LINK_EMAIL_SCREEN"]:Xy,["LINK_PHONE_SCREEN"]:sg,["LINK_WALLET_SCREEN"]:lg,["LINK_PASSKEY_SCREEN"]:ig,["UPDATE_EMAIL_SCREEN"]:e2,["CONNECT_ONLY_LANDING_SCREEN"]:Kh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:$h,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:bf,["EMBEDDED_WALLET_CREATED_SCREEN"]:hf,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:uf,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:f1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:_1,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:T1,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:vf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:q1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:B1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:wy,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ey,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Kf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:$f,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:P1,["MFA_ENROLLMENT_FLOW_SCREEN"]:_g,["CAPTCHA_SCREEN"]:Lh,["ERROR_SCREEN"]:Yf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Ty,["AFFIRMATIVE_CONSENT_SCREEN"]:Ch,["TELEGRAM_AUTH_SCREEN"]:Y1},S8=["LANDING","AWAITING_CONNECTION"],m2=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=lt(),{ready:a,currentScreen:i}=x(),{status:s,execute:l,reset:c,enabled:u}=ye(),f=o&&i&&S8.includes(i)&&!n&&s==="ready";if(c2(()=>{f&&l()},[f]),c2(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN"&&i!=="CROSS_APP_AUTH_SCREEN"&&i!=="TELEGRAM_AUTH_SCREEN")return d2(p2,{children:[et(P,{}),et(ee,{}),et(l2,{children:et(ct,{})}),et(te,{}),et(K,{})]});if(!i&&e)return et(ad,{open:e,onClose:t});if(!i)return null;let m=T8[i];return d2(p2,{children:[et(_r,{if:!!e,children:et(m,{})}),et(_r,{if:!e,children:et(ad,{open:e,onClose:t})})]})},P8=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=b8(null),o=oh(r);return et(A8,{style:{height:o},id:"privy-modal-content",children:et("div",{ref:r,children:et(m2,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},_8=()=>{let{closePrivyModal:e}=k(),{onUserCloseViaDialogOrKeybindRef:t}=x();return{gracefulClosePrivyModal:w8(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Cd=({open:e})=>{let{app:t}=x(),{gracefulClosePrivyModal:r}=_8(),[o,n]=E8(!1);jc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=e||o;return t.render.standalone?et(yd,{children:et(h2,{id:"privy-modal-content",children:et(m2,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):et(s2,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:et(yd,{children:et(P8,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},h2=u2.div`
3065
3065
  display: flex;
3066
3066
  flex-direction: column;
3067
3067
  text-align: center;
@@ -3070,7 +3070,7 @@ You will have to sign up with another method first to register a passkey for you
3070
3070
  width: 100%;
3071
3071
  background: var(--privy-color-background);
3072
3072
  padding: 0 16px;
3073
- `,S8=u2(f2)`
3073
+ `,A8=u2(h2)`
3074
3074
  transition: height 150ms ease-out;
3075
3075
  overflow: hidden;
3076
3076
 
@@ -3084,4 +3084,4 @@ You will have to sign up with another method first to register a passkey for you
3084
3084
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3085
3085
  border-radius: var(--privy-border-radius-lg);
3086
3086
  }
3087
- `;import{useRef as h2,useEffect as P8}from"react";import{jsx as A8}from"react/jsx-runtime";function _8({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function y2(e){let t=h2(null),r=h2();return P8(()=>{r.current?.remove(),r.current=_8(e),t.current?.after(r.current)},[e]),A8("div",{ref:t,hidden:!0})}import{useState as x8}from"react";import{useEffect as g2,useRef as v2}from"react";var hc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function zo(e,t,r,o,n,a=!1){let i=a,s=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ke("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((m,g)=>{r.current={resolve:m,reject:g};let w=1e3*60*5;setTimeout(()=>{let y=new ke("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},w)});return await e(h)}return await e()},l=4,c=null;for(let u=0;u<l;u++)try{c=await s(u),o.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),h}if(c===null){let u=new ke("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as O8}from"react/jsx-runtime";var k8=function(e){return()=>`id-${e++}`}(0);function R8(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function ft(e){return e.error!==void 0}var nt=new hc,wd=new Map,I8=(e,t)=>typeof t=="bigint"?t.toString():t,W8=(e,t)=>`${e}${JSON.stringify(t,I8)}`;function ht(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=W8(e,t);if(e==="privy:wallet:create"){let s=wd.get(a);if(s)return s}let i=new Promise((s,l)=>{let c=k8();nt.enqueue(c,{resolve:s,reject:l}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{wd.delete(a)});return wd.set(a,i),i}function M8(e){switch(e.event){case"privy:iframe:ready":let t=nt.dequeue(e.event,e.id);return ft(e)?t.reject(new ke(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=nt.dequeue(e.event,e.id);return ft(e)?r.reject(new ke(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=nt.dequeue(e.event,e.id);return ft(e)?o.reject(new ke(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=nt.dequeue(e.event,e.id);return ft(e)?n.reject(new ke(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let a=nt.dequeue(e.event,e.id);return ft(e)?a.reject(new ke(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:rpc":let i=nt.dequeue(e.event,e.id);return ft(e)?i.reject(new ke(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery":let s=nt.dequeue(e.event,e.id);return ft(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:verify":let l=nt.dequeue(e.event,e.id);return ft(e)?l.reject(new ke(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:submit-enrollment":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:unenroll":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:clear":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:init-signer":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:sign":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:solana-wallet:create":let c=nt.dequeue(e.event,e.id);return ft(e)?c.reject(new ke(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=nt.dequeue(e.event,e.id);return ft(e)?u.reject(new ke(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=nt.dequeue(e.event,e.id);return ft(e)?h.reject(new ke(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let m=nt.dequeue(e.event,e.id);return ft(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function C2(e){let t=v2(null),r=v2(e.mfaMethods),o=Xn(),[n,a]=x8(!1);return g2(()=>{r.current=e.mfaMethods},[e.mfaMethods]),g2(()=>{if(!n)return;let i=t.current;if(!i)return;function s(m){m&&m.origin===e.origin&&R8(m.data)&&M8(m.data)}let l={create(m){return ht("privy:wallet:create",m,i,e.origin)},import(m){return ht("privy:wallet:import",m,i,e.origin)},connect(m){return ht("privy:wallet:connect",m,i,e.origin)},recover(m){return zo(g=>ht("privy:wallet:recover",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!m.recoveryMethod||m.recoveryMethod==="privy")},rpc(m){return zo(g=>ht("privy:wallet:rpc",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(m){return ht("privy:solana-wallet:create",m,i,e.origin)},connectSolana(m){return ht("privy:solana-wallet:connect",m,i,e.origin)},recoverSolana(m){return ht("privy:solana-wallet:recover",m,i,e.origin)},rpcSolana(m){return ht("privy:solana-wallet:rpc",m,i,e.origin)},setRecovery(m){return zo(g=>ht("privy:wallet:set-recovery",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return zo(g=>ht("privy:mfa:verify",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return zo(g=>ht("privy:mfa:init-enrollment",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return zo(g=>ht("privy:mfa:submit-enrollment",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(m){return zo(g=>ht("privy:mfa:unenroll",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(m){return ht("privy:mfa:clear",m,i,e.origin)},initFarcasterSigner(m){return ht("privy:farcaster:init-signer",m,i,e.origin)},signFarcasterMessage(m){return ht("privy:farcaster:sign",m,i,e.origin)}};window.addEventListener("message",s);let c=()=>e.onLoad(l),u=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},h=new AbortController;return Fi(()=>ht("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",s),h.abort()}},[n]),O8("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:ds(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var yc=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t,r){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return(await this.walletProxy.rpcSolana({accessToken:r,publicKey:this.address,request:t})).response.data}async request(t){console.debug("EmbeddedSolanaProvider.request() called with args",t);let r=await he();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await w2())throw new C("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t,r);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function gc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(a=>a.provider_app_id===r);if(!n)throw new C("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function b2({api:e,appId:t}){let r=en(),o=Fn(),n=await Bn(r);try{let{url:a}=await e.post(os,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw ne(a)}}async function E2({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during cross-app auth flow");try{return(await e.post(ns,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(a){let i=ne(a);throw i.privyErrorCode?new C(i.message||"Invalid code during cross-app auth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during cross-app auth flow"?new C("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new C("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}async function T2({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let i=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),s()},12e4);function s(){t?.close(),window.removeEventListener("message",u)}let l,c=setInterval(()=>{t?.closed&&!l&&(s(),clearInterval(c),clearTimeout(i),n(new C("User rejected request")))},300);function u(h){h.data&&(h.data.type==="PRIVY_OAUTH_RESPONSE"&&h.data.stateCode&&h.data.authorizationCode&&(clearTimeout(i),o(h.data),s()),h.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(h.data.error)),s()),h.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(l=new BroadcastChannel("popup-privy-oauth"),l.onmessage=u))}window.addEventListener("message",u)})}var vc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let i=e?.linkedAccounts.find(m=>!!(m.type==="cross_app"&&m.embeddedWallets.find(g=>g.address===t)));if(!e||!i)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new C("Cannot request a signature with this wallet address");let s=r.getProviderAccessToken(i.providerApp.id),l=await gc({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id});if(!s){if(l.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await a({appId:i.providerApp.id})&&(s=r.getProviderAccessToken(i.providerApp.id))}if(!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new C("Transactions require a valid token");let c=window.open(void 0,void 0,bd({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");let u=new URL(`${l.apiUrl}/oauth/transact`);return u.searchParams.set("token",s||""),u.searchParams.set("request",L8(o)),c.location=u.href,new Promise((m,g)=>{let y=setTimeout(()=>{b(),g(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),T=setInterval(()=>{c.closed&&(b(),g(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),_=S=>{S.data&&(S.data.token?.action==="set"&&S.data.token?.value!==void 0?r.storeProviderAccessToken(i.providerApp.id,S.data.token.value):S.data.token?.action==="clear"&&r.storeProviderAccessToken(i.providerApp.id,null),S.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&S.data.result&&(b(),m(S.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),S.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&S.data.error&&(b(),g(S.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:S.data.error,address:t}})))};window.addEventListener("message",_);let b=()=>{c.close(),clearInterval(T),clearTimeout(y),window.removeEventListener("message",_)}})},L8=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),bd=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=n/window.screen.availWidth,s=a/window.screen.availHeight,l=(n-e)/2/i+r,c=(a-t)/2/s+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${l},top=${c}`};var N8="https://cdn.apple-cloudkit.com";async function Ed({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,a)=>{function i(){t?.close(),window.removeEventListener("message",s)}function s(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"&&l.data.stateCode&&l.data.authorizationCode&&(n(l.data),i()),l.origin===N8&&l.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:l.data.ckSession}),i()),l.data.type==="PRIVY_OAUTH_ERROR"&&(a(l.data.error),i()))}window.addEventListener("message",s)})}var S2=e=>({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});import{jsx as Cr,jsxs as P2}from"react/jsx-runtime";var oo;function G8(e){return typeof e=="string"&&e.length===25}function he(){if(!oo){let e=Q.get(Yo);return Promise.resolve(e||null)}return oo.getAccessToken()}var _2,Ju=(e,t,r)=>_2(e,t,r),A2,Xu=(e,t)=>A2(e,t),x2,em=(e,t)=>x2(e,t),k2,tm=()=>k2(),R2,w2=()=>R2(),q8=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(Vi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},z8=({config:e,...t})=>{if(!G8(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");oo||(oo=new ea({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Cr($m,{client:oo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Cr($8,{...t,client:oo})})},$8=e=>{let t=e.client,[r,o]=tt(!1),[n,a]=tt(!1),[i,s]=tt(!1),[l,c]=tt(null),[u,h]=tt([]),[m,g]=tt(null),w=Li(u),[y,T]=tt(!1),[_,b]=tt(null),[S,I]=tt(!1),[N,W]=tt({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[R,B]=tt({status:"initial"}),[q,Y]=tt(null),[M,z]=tt(null),L=lt(),Ue=Hs(),[Ye,Oe]=tt(!0),[de,J]=tt({}),[Ee,_e]=tt(null),[vt,sr]=tt(null),[Ot,it]=tt(!1),[se,Dr]=tt(!1),Fe=Li(null),bo=Li(null),O=Li(nf),[yt,Ur]=tt(!1);t.onStoreToken=p=>{p&&D(O,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{c(null),s(!1),D(O,"accessToken","onAccessTokenRemoved")};let X=Li(null),G=Li(null),le=p=>{b(p),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:p}})},at=p=>{L.embeddedWallets.createOnLogin!=="off"&&Oe(!0),le(p)};Nr(()=>{let p=nn(l);if(!p||!M)return;let d={address:p.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:zn,id:"io.privy.solana.wallet"},getProvider:async()=>new yc(M,p.address)};g(d)},[M,l]),Nr(()=>{if(!l){t.connectors?.removeEmbeddedWalletConnector();return}let p=we(l),d=Ms(l);if(p||t.connectors?.removeEmbeddedWalletConnector(),d||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!M){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}p&&t.connectors.addEmbeddedWalletConnector(M,p.address,L.defaultChain,e.appId),d&&t.connectors.addImportedWalletConnector(M,d.address,L.defaultChain,e.appId)},[M,l]),Nr(()=>{M&&vt?.(M)},[M]),Nr(()=>{(async()=>{if(!L.customAuth?.enabled)return;Oe(!0);let{getCustomAccessToken:d,isLoading:f}=L.customAuth;if(!(!n||f))try{let v=await d();if(!v&&i){await Ln.logout();return}if(!v||i)return;t.startAuthFlow(new Nn(v));let{user:A,isNewUser:F}=await t.authenticate();if(!A){await Ln.logout();return}c(A||null),T(F||!1),s(!0),Dr(!0)}catch(v){console.warn(v),i&&await Ln.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,i]),Nr(()=>{se&&M&&l&&Ut(l,L.embeddedWallets.createOnLogin)&&(Dr(!1),On(l,Un).catch(console.error))},[se&&M&&l]),Nr(()=>{async function p(){let d=$o(),f=Wn();q8();let v=D8();t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:v,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let A;t.connectors?.on("connectorInitialized",()=>{A&&clearTimeout(A);let Te=t.connectors.walletConnectors.length,oe=t.connectors.walletConnectors.reduce((ze,Ce)=>ze+(Ce.initialized?1:0),0);oe===Te?Ur(!0):A=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:oe,expected:Te}),Ur(!0)},1500)}),t.connectors?.initialize().then(()=>{za()});let F=await t.getAuthenticatedUser(),V=!!F;if(L.customAuth?.enabled||(s(!!F),F&&D(O,"login","onComplete",F,!1,!0,null,null),c(F)),d){G.current=V?"link":"login";return}if(f&&!V){G.current="login",at("TELEGRAM_AUTH_SCREEN");return}re.setReadyToTrue(!!F)}!n&&Ue&&p()},[t,Ee,n,Ue]),Nr(()=>{if(!n)return;if(!l){it(!0);return}if(!!!l.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){it(!0);return}let d=!!u.find(f=>f.walletClientType==="privy");it(d)},[n,l,u]);let $o=()=>{let p=Ki();if(p.inProgress&&p.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(p.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:p.stateCode,authorizationCode:p.authorizationCode});return}let d="privy:";function f(v){return v.startsWith(d)}return p.inProgress&&f(p.provider)&&!p.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:p.stateCode,authorizationCode:p.authorizationCode}),window.close()),!p.inProgress||p.headless?!1:(t.startAuthFlow(new Br(p)),at("AWAITING_OAUTH_SCREEN"),!0)},Wn=()=>{let p=Yu();if(!p||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let d=new Hn;return t.startAuthFlow(d),p.flowType==="login-url"&&(d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult={id:p.id,first_name:p.first_name,last_name:p.last_name,auth_date:p.auth_date,username:p.username,photo_url:p.photo_url,hash:p.hash}),p.flowType==="web-app"&&(d.meta.telegramAuthResult=void 0,d.meta.telegramWebAppData={query_id:p.query_id,user:p.user,auth_date:p.auth_date,hash:p.hash}),!0},lr=async(p,d,f,v)=>{let A=await t.connectors?.createWalletConnector(p,d)||null;Ni(A,d,f,v)};async function Ni(p,d,f,v){if(p)W({status:"disconnected",connectedWallet:null,connectError:null,connector:p,connectRetry:E});else return W({status:"disconnected",connectedWallet:null,connectError:new ie("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,f);p instanceof Er&&d&&await p.resetConnection(d),W({connector:p,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ni(p,d,f,v)});try{let A=await p.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(F=>F.id===Number(A?.chainId.replace("eip155:","")))&&!(A?.connectorType==="wallet_connect_v2"&&A?.walletClientType==="metamask")){W(F=>({...F,connector:p,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await A?.switchChain(L.defaultChain.id),A&&(A.chainId=Dn(jo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return W(F=>({...F,status:"connected",connectedWallet:A,connectError:null,connectRetry:E})),A&&D(O,"connectWallet","onSuccess",A),v?.(A,f)}catch(A){return A instanceof Ze?(console.warn(A.cause?A.cause:A.message),D(O,"connectWallet","onError",A.privyErrorCode||"generic_connect_wallet_error")):(console.warn(A),D(O,"connectWallet","onError","unknown_connect_wallet_error")),W(F=>({...F,status:"disconnected",connectedWallet:null,connectError:A})),v?.(null,f)}}let no=async(p,d)=>{if(p===null)return;let f=new lo(p,t,d);t.startAuthFlow(f)},za=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),f=p.get("privy_wallet_client");if(!d||!f)return;if(f==="phantom"&&!To()&&at("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");le("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),lr(d,f,void 0,no)};Nr(()=>{n&&i&&l===null&&t.getAuthenticatedUser().then(c)},[n,i,l,t]);let qe=()=>{if(!i)throw D(O,"linkAccount","onError","must_be_authenticated"),new C("User must be authenticated before linking an account.")},$a=()=>{qe(),X.current="siwe",G.current="link",le("LINK_WALLET_SCREEN")},Di=p=>{if(!i||!l)return!1;if(p.walletClientType==="privy")return!0;for(let d of l.linkedAccounts)if(d.type==="wallet"&&d.address===p.address&&d.walletClientType!=="privy")return!0;return!1},Ko=async p=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;if(W(f=>({...f,connector:d,status:"connected",connectedWallet:p,connectError:null,connectRetry:E})),L.captchaEnabled&&!i){let f={callback:v=>no(p,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};J({captchaModalData:f}),at("CAPTCHA_SCREEN")}else await no(p),at("AWAITING_CONNECTION")},Be=async(p,d)=>{if(!L.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:f,externalTransactionId:v}=await wy(t,p,d?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:v}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},He=()=>{h(p=>{let d=t.connectors?.wallets.map(f=>({...f,linked:Di(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Ko(f)},fund:async v=>{let{signedUrl:A,externalTransactionId:F}=await Be(f.address,v);J({fiatOnRampPrompt:{signedUrl:A},fiatOnRampStatus:{externalTransactionId:F}}),le("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(f.address);c(v)}}))||[];return Os(p,d)?p:d})};Nr(()=>{He()},[l?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");He(),t.connectors.on("walletsUpdated",He)}},[n]);let Mn=p=>{if(p&&"suggestedAddress"in p&&p.suggestedAddress){let d=wo(p.suggestedAddress);Y(d)}le(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let p=u[0],d=w.current.find(v=>v.address===p.address),f;if(p.walletClientType==="privy"?f=l?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===p.address&&v.walletClientType==="privy"):f=l?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===p.address&&v.walletClientType!=="privy"),!d&&f){let v=Object.assign({},l);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},c(v)}w.current=u},[u]);let On=async(p,d)=>{if(we(p))throw D(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,A]=await Promise.all([re.initializeWalletProxy(d),he()]);if(!v&&L.customAuth?.enabled)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!A||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((F,V)=>{Oe(!0),J({createWallet:{onSuccess:oe=>{D(O,"createWallet","onSuccess",oe),F(oe)},onFailure:oe=>{D(O,"createWallet","onError","unknown_embedded_wallet_error"),V(oe)},callAuthOnSuccessOnClose:!1}}),le("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:A});let F=await re.refreshUser(),V=we(F);if(!V)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(O,"createWallet","onSuccess",V),V}},Ka=p=>{if(!L.chains.map(d=>d.id).includes(p))throw new ie(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Fr=(p,d,f)=>new Promise(async(v,A)=>{let{requesterAppId:F}=d||{};if(!i||!l){D(O,"sendTransaction","onError","must_be_authenticated"),A(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=p.from,Te=V?l?.linkedAccounts.find($e=>$e.type==="wallet"&&$e.walletClientType==="privy"&&wo($e.address)===wo(V)):we(l);if(!Te){D(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have a Privy wallet before signing"));return}Oe(!0);let oe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ze=p.chainId?Number(p.chainId):oe.chainId;Ka(ze);let Ce=Object.assign({},p,{chainId:ze}),Nt=async()=>{let $e=await he();if(!$e||!M){D(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await re.recoverEmbeddedEthereumWallet()){D(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(new Error("Unable to connect to wallet"));return}let wr=ao(Ce.chainId,L.chains,L.rpcConfig,{appId:e.appId}),Cc=await V8(Te.address,Ce,wr);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:U2}=await H8(Cc,wr),{hasSufficientFunds:F2}=await pc(Te.address,Cc,U2,wr);if(!F2)throw new st(new jt("Wallet has insufficient funds for this transaction.",B8.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let _d=await cc($e,Te.address,M,Cc,wr,F);D(O,"sendTransaction","onSuccess",_d),v(_d)}catch(Za){D(O,"sendTransaction","onError","transaction_failure"),A(Za)}};if(L.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Nt();else{let $e={transactionRequest:Ce,onSuccess:wr=>{D(O,"sendTransaction","onSuccess",wr),v(wr)},onFailure:wr=>{D(O,"sendTransaction","onError","transaction_failure"),A(wr)},uiOptions:d||{},fundWalletConfig:f,requesterAppId:F},Za={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wr=>{D(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(wr)}};J({connectWallet:Za,sendTransaction:$e}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function ja(){return new Promise(async(p,d)=>{let f=await he();if(!f||!M)throw new Error("Must have valid access token to enroll in MFA");try{await M.verifyMfa({accessToken:f}),p()}catch(v){d(v)}})}let Sd=p=>p?.linkedAccounts.filter(d=>d.latestVerifiedAt!==null&&!(d.type==="wallet"&&d.walletClientType==="privy")).sort((d,f)=>f.latestVerifiedAt.getTime()-d.latestVerifiedAt.getTime())[0],Lt=p=>{if(p==="passkey"){if(l&&l.linkedAccounts.filter(d=>d.type==="passkey").length>=5)throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${p} linked.`)}else if(l?.[p])throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${p} linked.`)},N2=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new C("User can't link an account because Telegram linking is disabled.")};async function Pd({legacySetWalletPasswordFlow:p=!1}){b(null);let d=p?"setWalletPassword":"setWalletRecovery";if(!i||!l)throw D(O,d,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let f=we(l);if(!f||!M)throw D(O,d,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(nn(l))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await ja()}catch(A){throw D(O,d,"onError","missing_or_invalid_mfa"),A}return new Promise((A,F)=>{Oe(!0);let V={onSuccess:Ce=>{D(O,d,"onSuccess","user-passcode",Ce),A(Ce)},onFailure:Ce=>{D(O,d,"onError","user_exited_set_password_flow"),F(Ce)},callAuthOnSuccessOnClose:!1},Te=f.recoveryMethod==="user-passcode",ze={onCompleteNavigateTo:pl({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:p,isResettingPassword:Te}),shouldForceMFA:!1,onFailure:Ce=>{D(O,d,"onError","unknown_connect_wallet_error"),F(Ce)}};J({setWalletPassword:V,createWallet:V,connectWallet:ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Te}}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function Ya({appId:p}){qe(),X.current=`privy:${p}`,G.current="link";let d=window.open(void 0,void 0,bd({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:p}}),new Promise(async(f,v)=>{let{name:A,logoUrl:F}=await gc({api:t.api,providerAppId:p,requesterAppId:L.id});J({crossAppAuth:{appId:p,name:A,logoUrl:F,popup:d,onSuccess:f,onError:v}}),at("CROSS_APP_AUTH_SCREEN")})}let Ln={ready:n,authenticated:i,user:l,walletConnectors:t.connectors||null,connectWallet:Mn,importWallet:async({privateKey:p})=>{qe();let[d,f]=await Promise.all([re.initializeWalletProxy(15e3),he()]);if(d&&f){await d.import({privateKey:p,accessToken:f});let v=await re.refreshUser(),A=Ms(v);if(!A)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return D(O,"createWallet","onSuccess",A),A}else throw new C("User is not authenticated")},linkWallet:$a,linkCrossAppAccount:Ya,linkEmail:()=>{qe(),Lt("email"),X.current="email",G.current="link",le("LINK_EMAIL_SCREEN")},linkPhone:()=>{qe(),Lt("phone"),X.current="sms",G.current="link",le("LINK_PHONE_SCREEN")},linkGoogle:async()=>{qe(),Lt("google"),G.current="link",await re.initLoginWithOAuth("google")},linkTwitter:async()=>{qe(),Lt("twitter"),G.current="link",await re.initLoginWithOAuth("twitter")},linkDiscord:async()=>{qe(),Lt("discord"),G.current="link",await re.initLoginWithOAuth("discord")},linkGithub:async()=>{qe(),Lt("github"),G.current="link",await re.initLoginWithOAuth("github")},linkSpotify:async()=>{qe(),Lt("spotify"),G.current="link",await re.initLoginWithOAuth("spotify")},linkInstagram:async()=>{qe(),Lt("instagram"),G.current="link",await re.initLoginWithOAuth("instagram")},linkTiktok:async()=>{qe(),Lt("tiktok"),G.current="link",await re.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{qe(),Lt("linkedin"),G.current="link",await re.initLoginWithOAuth("linkedin")},linkApple:async()=>{qe(),Lt("apple"),G.current="link",await re.initLoginWithOAuth("apple")},linkPasskey:async()=>{qe(),Lt("passkey"),await re.initLinkWithPasskey(),le("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{qe(),Lt("telegram"),N2(),G.current="link",X.current="telegram",await re.initLoginWithTelegram(),le("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{qe(),Lt("farcaster"),await re.initLoginWithFarcaster(),G.current="link",X.current="farcaster",le("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(qe(),!l?.email)throw new C("User does not have an email linked to their account.");G.current="link",X.current="email",le("UPDATE_EMAIL_SCREEN")},login:async()=>{let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(f=>{_e(v=>f.bind(v))});if(_e(null),d){console.warn(p);return}}if(i){console.warn(p);return}G.current="login",at("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(p=>{_e(()=>p)}),_e(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}at("CONNECT_OR_CREATE")},logout:async()=>{if(l&&t.clearProviderAcccessTokens(l),b(null),await t.logout(),l&&M)try{await M.clearMfa({userId:l.id})}catch{}c(null),s(!1),D(O,"logout","onSuccess"),G.current=null,X.current=null,o(!1),Q.del(Gi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!l||!l.wallet)return new Ve;let p=u.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===p?.address));return!p||!d?new Ve:d.proxyProvider},getEthersProvider:()=>{if(!l||!l.wallet)return new Td(new Hr(new Ve));let p=u.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===p?.address));return!p||!d?new Td(new Hr(new Ve)):new Td(new Hr(d.proxyProvider))},getWeb3jsProvider:()=>{if(!l||!l.wallet)return new Po(new Ve);let p=u.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===p?.address));return!p||!d?new Po(new Ve):new Po(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkSpotify:async p=>{let d=await t.unlinkOAuth("spotify",p);return c(d),d},unlinkInstagram:async p=>{let d=await t.unlinkOAuth("instagram",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},unlinkFarcaster:async p=>{let d=await t.unlinkFarcaster(p);return c(d),d},unlinkTelegram:async p=>{let d=await t.unlinkTelegram(p);return c(d),d},unlinkPasskey:async p=>{let d=await t.unlinkPasskey(p);return c(d),d},unlinkCrossAppAccount:async({subject:p})=>{let d=l?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===p)?.providerApp;if(!d)throw new C("Invalid subject");t.storeProviderAccessToken(d.id,null);let f=await t.unlinkOAuth(`privy:${d.id}`,p);return c(f),f},setActiveWallet:async p=>{let d=u.find(v=>wo(v.address)===wo(p)),f=l?.linkedAccounts.find(v=>v.type==="wallet"&&wo(v.address)===wo(p));if(!d||!await d.isConnected())Y(p),$a();else if(!d.linked)d.loginOrLink();else{let v=Object.assign({},l);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!l)throw D(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return On(l,15e3)},setWalletRecovery:async()=>Pd({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Pd({legacySetWalletPasswordFlow:!0}),signMessage:(p,d,f)=>new Promise(async(v,A)=>{let{requesterAppId:F}=d||{};if(!i||!l){D(O,"signMessage","onError","must_be_authenticated"),A(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=f?l?.linkedAccounts.find(oe=>oe.type==="wallet"&&oe.walletClientType==="privy"&&wo(oe.address)===wo(f)):we(l);if(!V){D(O,"signMessage","onError","embedded_wallet_not_found"),A(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){D(O,"signMessage","onError","invalid_message"),A(new Error("Message must be a non-empty string"));return}Oe(!0);let Te=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await he();if(!M||!oe)throw new Error("Unable to connect to wallet");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:V.address,requesterAppId:F}});let{response:Ce}=await M.rpc({accessToken:oe,address:V.address,requesterAppId:F,request:{method:"personal_sign",params:[p,V.address]}}),Nt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:V.address,requesterAppId:F}}),Nt};if(L.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await Te();D(O,"signMessage","onSuccess",oe),v(oe)}catch(oe){D(O,"signMessage","onError","unable_to_sign"),A(oe??new st("Unable to sign message"))}}else{let Ce={method:"personal_sign",data:p,confirmAndSign:Te,onSuccess:$e=>{D(O,"signMessage","onSuccess",$e),v($e)},onFailure:$e=>{D(O,"signMessage","onError","unable_to_sign"),A($e)},uiOptions:d||{}},Nt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:$e=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),A($e)},address:V.address};J({signMessage:Ce,connectWallet:Nt}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(p,d)=>new Promise(async(f,v)=>{let{requesterAppId:A}=d||{};if(!i||!l){D(O,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=we(l);if(!F){D(O,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Oe(!0);let V=Bi(p),Te=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await he();if(!M||!oe)throw new Error("Unable to connect to wallet");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:F.address,requesterAppId:A}});let{response:Ce}=await M.rpc({accessToken:oe,address:F.address,requesterAppId:A,request:{method:"eth_signTypedData_v4",params:[F.address,V]}}),Nt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:F.address,requesterAppId:A}}),Nt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await Te();D(O,"signTypedData","onSuccess",oe),f(oe)}catch(oe){D(O,"signTypedData","onError","unable_to_sign"),v(oe??new st("Unable to sign message"))}}else{let Ce={method:"eth_signTypedData_v4",data:V,confirmAndSign:Te,onSuccess:$e=>{D(O,"signTypedData","onSuccess",$e),f($e)},onFailure:$e=>{D(O,"signTypedData","onError","unable_to_sign"),v($e)},uiOptions:d||{}},Nt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:$e=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),v($e)}};J({signMessage:Ce,connectWallet:Nt}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,f)=>{let A=await(await Fr(p,d,f)).wait();return dc(A)},exportWallet:()=>new Promise(async(p,d)=>{if(!i||!l){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!we(l)){d(new Error("Must have a Privy wallet before exporting"));return}Oe(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d,shouldForceMFA:!0};if(J(de),!await he()||!M){d(new Error("Must have valid access token to enroll in MFA"));return}if(!M){d(new Error("Must have a Privy wallet before exporting"));return}let F={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:p,onFailure:d};J({keyExport:F,connectWallet:v}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:ja,async init(p){switch(p){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}},async submit(p,d){switch(p){case"totp":case"sms":if(typeof d!="string")throw new C("Invalid MFA code");Fe.current?.resolve({mfaMethod:p,mfaCode:d,relyingParty:window.origin}),await new Promise((F,V)=>{bo.current={resolve:F,reject:V}});break;case"passkey":if(typeof d=="string")throw new C("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(d),A=S2(v);Fe.current?.resolve({mfaMethod:p,mfaCode:A,relyingParty:window.origin}),await new Promise((F,V)=>{bo.current={resolve:F,reject:V}});break;default:throw Fe.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${p}`)}},cancel(){Fe.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(p){let d=await he();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");await M.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,f)=>{if(!p){re.closePrivyModal(),d();return}L.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),J({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:d,onFailure:f}}),le("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await he();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");let d=await M.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await he();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(p){let d=await he();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:p}){let d=await he();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:p});let f=await t.getAuthenticatedUser();c(f)},async unenroll(p){let d=await he();if(!d||!M)throw new Error("Must have valid access token to remove MFA");p==="passkey"?await M.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:[]}):await M.unenrollMfa({method:p,accessToken:d});let f=await t.getAuthenticatedUser();c(f)},requestFarcasterSignerFromWarpcast:async()=>{let p=await he(),d=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!d)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await M.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let A=await t.getAuthenticatedUser();c(A||l||null)}J({farcasterSigner:v}),le("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let p=await he(),d=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!d)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(A=>Uint8Array.from(A.match(/.{1,2}/g).map(F=>parseInt(F,16))))(l.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async p=>{let d=await he(),f=l?.linkedAccounts.find(V=>V.type==="wallet"&&V.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let A=await import("@simplewebauthn/browser"),F=await M.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{hash:A.bufferToBase64URLString(p)},fid:BigInt(l.farcaster.fid),relyingParty:window.origin});return new Uint8Array(A.base64URLStringToBuffer(F.signature))},isHeadlessOAuthLoading:S,loginWithCode(p){return re.loginWithCode(p)},initLoginWithEmail(p){return re.initLoginWithEmail(p)},initLoginWithSms(p){return re.initLoginWithSms(p)},otpState:R,fundWallet(p,d){return re.fundWallet(p,d)},initLoginWithHeadlessOAuth(p,d){return re.initLoginWithHeadlessOAuth(p,d)},loginWithHeadlessOAuth(p){return re.loginWithHeadlessOAuth(p)},generateSiweMessage({address:p,chainId:d}){return re.generateSiweMessage({address:p,chainId:d})},linkWithSiwe({message:p,signature:d,chainId:f,walletClientType:v,connectorType:A}){return qe(),re.linkWithSiwe({message:p,signature:d,chainId:f,walletClientType:v,connectorType:A})},signMessageWithCrossAppWallet(p,{address:d}){return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"personal_sign",params:[p,d]},reconnect:Ya})},signTypedDataWithCrossAppWallet(p,{address:d}){let f=Bi(p);return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[d,f]},reconnect:Ya})},sendTransactionWithCrossAppWallet(p,{address:d}){return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[p]},reconnect:Ya})},isModalOpen:r,mfaMethods:L.mfa.methods};_2=Ln.signMessage,A2=Ln.signTypedData,x2=async(...p)=>{let d=await Fr(...p);return L.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let re=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:q,pendingTransaction:null,walletConnectionStatus:N,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:p=>L.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(M)return M;let d=new Promise(A=>{sr(()=>F=>A(F))}),f=new Promise(A=>setTimeout(()=>A(null),p)),v=await Promise.race([d,f]);return sr(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&l,f;d&&X.current&&(f=Sd(l)),G.current==="login"?p.shouldCallAuthOnSuccess&&d&&X.current?(D(O,"login","onComplete",l,y,!1,X.current,f??null),e.onSuccess?.(l,y)):D(O,"login","onError","exited_auth_flow"):G.current==="link"&&f&&(p.isSuccess&&d&&X.current?D(O,"linkAccount","onSuccess",l,X.current,f):D(O,"linkAccount","onError","exited_link_flow")),Y(null),G.current=null,X.current=null,T(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:le,connectWallet:Ni,initLoginWithWallet:async(p,d)=>{X.current="siwe",no(p,d)},loginWithWallet:async()=>{if(!n)throw new io;if(!(t.authFlow instanceof lo))throw new C("Must initialize SIWE flow first.");let p,d;if(i)try{({user:p}=await t.link()),X.current="siwe"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:p,isNewUser:d}=await t.authenticate()),X.current="siwe"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(p||l||null),T(d||!1),s(!0)},initLoginWithFarcaster:async p=>{let d=new Hi(p);t.startAuthFlow(d);try{X.current="farcaster",await d.initializeFarcasterConnect()}catch(f){throw G.current==="login"?D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new io;if(!(t.authFlow instanceof Hi))throw new C("Must initialize Farcaster flow first.");let p,d;if(i)try{({user:p}=await t.link()),X.current="farcaster"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:p,isNewUser:d}=await t.authenticate()),X.current="farcaster"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(p||null),T(d||!1),s(!0)},async crossAppAuthFlow({appId:p,popup:d}){let f=`privy:${p}`;X.current=f;let{url:v,stateCode:A,codeVerifier:F}=await b2({api:t.api,appId:p});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:p}}),new C("No authorization URL returned for cross-app auth.");try{let V=await T2({url:v,popup:d,provider:f}),Te=V.stateCode,oe=V.authorizationCode;if(Te!==A)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:f,storedStateCode:A??"",returnedStateCode:Te??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let ze=await E2({api:oo.api,appId:p,codeVerifier:F,stateCode:Te,authorizationCode:oe});ze&&t.storeProviderAccessToken(p,ze);let Ce=await re.refreshUser();if(!Ce)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:p}}),Ce}catch(V){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:V.toString(),provider:f}}),V}},async initLoginWithOAuth(p,d){if(X.current=p,Tc()){if(p==="google"&&li(window.navigator.userAgent)){at("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{at("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}p==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),Q.del(Jo);let f=new Br({provider:p});d&&f.addCaptchaToken(d),t.startAuthFlow(f);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(p==="twitter"&&F8&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(p){if(!n)throw new io;X.current="telegram";let d=new Hn(p);t.startAuthFlow(d),d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult=await new Promise((f,v)=>{if(!L.loginConfig.telegramAuthConfiguration)return v(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return v(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},A=>A?f(A):v(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof Hn))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let p,d;if(i)try{({user:p}=await t.link()),X.current="telegram"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{let f=await t.authenticate();p=f.user,d=f.isNewUser,X.current="telegram"}catch(f){throw G.current==="login"?D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}c(p),T(d||!1),s(!0)},async recoveryOAuthFlow(p,d,f){let v,A;function F(V){if(!V)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:p}}),new C("Recovery OAuth failed")}switch(p){case"google-drive":{let{url:V,codeVerifier:Te,stateCode:oe}=await gp({api:oo.api,provider:p});F(V);let ze,Ce;try{let Nt=await Ed({url:V,popup:f,provider:p});if(ze=Nt.stateCode,Ce=Nt.authorizationCode,ze!==oe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p,storedStateCode:oe??"",returnedStateCode:ze??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Nt){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Nt.toString(),provider:p}}),new C("Recovery OAuth failed")}[v,A]=await Promise.all([he(),dh({api:oo.api,provider:p,codeVerifier:Te,stateCode:ze,authorizationCode:Ce})]);break}case"icloud":{let{url:V}=await gp({api:oo.api,provider:p});F(V);let{ckWebAuthToken:Te}=await Ed({url:V,popup:f,provider:p});A=Te,v=await he();break}}if(!M)throw new C("Cannot connect to wallet proxy");if(!v)throw new C("Unable to authorize user");switch(d){case"recover":let V=de.recoverWallet?.privyWallet?.address;if(!V)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:V,recoveryMethod:p}}),await M.recover({address:V,accessToken:v,recoveryAccessToken:A,recoveryMethod:p}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:V,recoveryMethod:p}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await M.create({accessToken:v,recoveryAccessToken:A,recoveryMethod:p});let Te=await re.refreshUser(),oe=we(Te);if(!oe)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:oe.address}}),D(O,"createWallet","onSuccess",oe);break;case"set-recovery":let ze=we(l);if(!ze)throw D(O,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:p}}),await M.setRecovery({address:ze.address,accessToken:v,recoveryAccessToken:A,recoveryMethod:p});let Ce=we(await re.refreshUser());if(!Ce)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:ze.address,recoveryMethod:p}}),D(O,"setWalletRecovery","onSuccess",p,Ce);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(p){if(!(t.authFlow instanceof Br))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=Q.get(Zo),f=t.authFlow.meta.stateCode;if(d!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p,storedStateCode:d??"",returnedStateCode:f??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,A,F;if(i)try{let V=await t.link();v=V.user,F=V.oAuthTokens,X.current=p}catch(V){throw D(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}else try{let V=await t.authenticate();v=V.user,A=V.isNewUser,F=V.oAuthTokens,X.current=p}catch(V){throw G.current==="login"?D(O,"login","onError",V.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),V}return c(v),T(A||!1),s(!0),F&&D(O,"oAuthAuthorization","onOAuthTokenGrant",F),F},async initLoginWithPasskey(p){let d=new rn(p);t.startAuthFlow(d),G.current="login";try{X.current="passkey",await d.initAuthenticationFlow()}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new io;if(!(t.authFlow instanceof rn))throw new C("Must initialize Passkey flow first.");if(X.current!=="passkey")throw new C("Must init login with Passkey flow first.");let p,d;try{X.current="passkey",{user:p,isNewUser:d}=await t.authenticate()}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(p),T(d||!1),s(!0)},async initLinkWithPasskey(p){let d=new rn(p);t.startAuthFlow(d),G.current="link",X.current="passkey";try{await d.initLinkFlow()}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},async linkWithPasskey(){if(!n)throw new io;if(!(t.authFlow instanceof rn))throw new C("Must initialize Passkey flow first.");if(X.current!=="passkey")throw new C("Must init login with Passkey flow first.");let p;try{X.current="passkey",{user:p}=await t.link()}catch(d){throw D(O,"linkAccount","onError",d.privyErrorCode||"failed_to_link_account"),d}return c(p||l||null),p},async initLoginWithHeadlessOAuth(p,d){if(Tc()){if(p==="google"&&li(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Br({provider:p,headless:!0});d&&f.addCaptchaToken(d);let v=await t.startAuthFlow(f).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(p){I(!0),t.startAuthFlow(new Br(p));let d=Q.get(Zo),f=p.stateCode;if(d!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p.provider,storedStateCode:d??"",returnedStateCode:f??""}}),I(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,A;if(i)try{({user:v}=await t.link()),X.current=p.provider}catch(F){throw D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:v,isNewUser:A}=await t.authenticate()),X.current=p.provider}catch(F){throw G.current==="login"?D(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}return c(v),T(A||!1),s(!0),I(!1),v??void 0},initLoginWithEmail:async(p,d)=>{let f=new Eo(p,d);t.startAuthFlow(f);try{X.current="email",await f.sendCodeEmail()}catch(v){throw G.current==="login"?D(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},initUpdateEmail:async(p,d,f)=>{let v=new as(p,d,f);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(p,d)=>{B({status:"sending-code"});let f=new on(p,d);t.startAuthFlow(f);try{X.current="sms",await f.sendSmsCode(),B({status:"awaiting-code-input"})}catch(v){throw B({status:"error",error:v}),G.current==="login"?D(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):G.current==="link"&&D(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(B({status:"submitting-code"}),!n){let v=new io;throw B({status:"error",error:v}),v}if(t.authFlow instanceof Eo)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof on)t.authFlow.meta.smsCode=p.trim();else{let v=new C("Must initialize a passwordless code flow first");throw B({status:"error",error:v}),v}await he();let d,f;if(G.current==="link")try{({user:d}=await t.link())}catch(v){throw B({status:"error",error:v}),D(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}else try{({user:d,isNewUser:f}=await t.authenticate())}catch(v){throw B({status:"error",error:v}),D(O,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(d||l||null),T(f||!1),s(!0),B({status:"done"})},generateSiweMessage:async({address:p,chainId:d,captchaToken:f})=>{G.current="link",X.current="siwe";let v=await t.generateSiweNonce({address:p,captchaToken:f}),A=d.replace("eip155:","");return Ws({address:p,chainId:A,nonce:v})},linkWithSiwe:async({message:p,signature:d,chainId:f,walletClientType:v,connectorType:A})=>{let F;try{if(G.current!=="link"||X.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");F=await t.linkWithSiwe({message:p,signature:d,chainId:f,walletClientType:v,connectorType:A});let V=Sd(F);V&&D(O,"linkAccount","onSuccess",F,"siwe",V)}catch(V){throw D(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account"),G.current=null,X.current=null,V}c(F||l||null),G.current=null,X.current=null},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:M,createAnalyticsEvent:({eventName:p,payload:d,timestamp:f})=>t.createAnalyticsEvent({eventName:p,payload:d,timestamp:f}),acceptTerms:async()=>{let p=await t.acceptTerms();return c(p),p},getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedEthereumWallet:async()=>new Promise(async(p,d)=>{let f=we(l)||Ms(l),v=await he();if(!v||!M||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Oe(!0);try{await M.connect({accessToken:v,address:f.address}),p(!0)}catch(A){if(yn(A)&&f.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await M.recover({address:f.address,accessToken:v,recoveryMethod:f.recoveryMethod})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:f.address}}),p(!0);else if(yn(A)&&f.recoveryMethod!=="privy"){J({recoverWallet:{privyWallet:f,onFailure:d,onSuccess:()=>p(!0)},recoveryOAuthStatus:{provider:f.recoveryMethod,action:"recover"}});let F=dl(f.recoveryMethod);le(F)}else d(A)}}),embeddedSolanaWallet:m,createEmbeddedSolanaWallet:async()=>{Oe(!0);let p=await he(),d=nn(l),f=we(l);if(!l||!p)throw new C("User must be logged in to create a Solana wallet");if(d)throw new C("User already has an embedded Solana wallet.");if(f)if(f.recoveryMethod==="privy")await re.recoverEmbeddedEthereumWallet();else throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let v=await re.initializeWalletProxy(15e3);if(!v)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await v.createSolana({accessToken:p,ethereumAddress:f?.address});let A=await re.refreshUser(),F=nn(A);if(!F)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:F.address}}),F}catch(A){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",A)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(p,d)=>{let f=nn(l),v=await he();if(!v||!M||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Oe(!0);try{await M.connectSolana({accessToken:v,publicKey:f.address}),p(!0)}catch(A){yn(A)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await M.recoverSolana({publicKey:f.address,accessToken:v})).publicKey||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:f.address}}),p(!0)):d(A)}}),getFiatOnRampConfig:Be,setReadyToTrue:p=>{a(!0),Ee?.(p)},updateWallets:()=>He(),fundWallet:async(p,d)=>{let{signedUrl:f,externalTransactionId:v}=await Be(p,d);J({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:v}}),le("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async p=>{let d=await he(),f=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(p);if(v.status==="approved"){let A=await t.getAuthenticatedUser();c(A||l||null)}return v}}))();k2=re.recoverEmbeddedEthereumWallet,R2=re.recoverEmbeddedSolanaWallet;let D2=U8(()=>({wallets:u,ready:Ot&&yt}),[u,Ot,yt]);return Cr(ge.Provider,{value:Ln,children:Cr(Kc.Provider,{value:O,children:Cr(nd.Provider,{value:D2,children:Cr(tf,{...L,children:P2($c.Provider,{value:re,children:[P2(jm,{data:de,setModalData:J,setInitialScreen:b,initialScreen:_,authenticated:i,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!i&&Cr(zc,{delayedExecution:!1}),Cr(i2,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&Cr(Cd,{open:r})]}),Ye&&Ue?Cr(C2,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:l?.mfaMethods,mfaPromise:Fe,mfaSubmitPromise:bo,onLoad:z,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&Cr(_r,{if:!0,children:Cr(y2,{scriptHost:e.apiUrl||hs,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as K8}from"react";function j8(e){let{login:t}=K8(ge);return Ie("login",e),{login:t}}import{useContext as Y8}from"react";function Z8(e){let{logout:t}=Y8(ge);return Ie("logout",e),{logout:t}}import{useCallback as I2,useEffect as Q8}from"react";function J8(){let e=ye(),t=Hs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=H(),s=I2(async c=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),l=I2(async()=>{let c=Ki();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(u){throw u}finally{tn()}},[o]);return Q8(()=>{let c=Ki();a&&t&&c.inProgress&&c.headless&&!c.popupFlow&&l()},[a,t]),{initOAuth:s,loginWithOAuth:l,loading:n}}import{useCallback as W2}from"react";var X8=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=W2(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=W2(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as M2}from"react";var e9=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=M2(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=M2(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};import{useCallback as O2}from"react";var t9=()=>{let e=ye(),{generateSiweMessage:t,linkWithSiwe:r}=H(),o=O2(async({address:a,chainId:i})=>{if(!a||!i)throw new Error("wallet address and chainId required to generate nonce");return t({address:a,chainId:i}).then(s=>s)},[t]),n=O2(async({signature:a,message:i,chainId:s,walletClientType:l,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:s,walletClientType:l,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as r9}from"react";function o9(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkTelegram:g,linkFarcaster:w}=r9(ge);return Ie("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkFarcaster:w,linkTelegram:g}}import{useContext as n9}from"react";function i9(e){let{connectWallet:t}=n9(ge);return Ie("connectWallet",e),{connectWallet:t}}import{useContext as a9}from"react";function s9(e){let{createWallet:t}=a9(ge);return Ie("createWallet",e),{createWallet:t}}var l9=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var c9=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=k();return{createWallet:t,wallets:e?[e]:[]}};var p9=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=H();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as d9}from"react";function u9(e){let{sendTransaction:t}=d9(ge);return Ie("sendTransaction",e),{sendTransaction:t}}import{useContext as m9}from"react";function f9(e){let{setWalletPassword:t}=m9(ge);return Ie("setWalletPassword",e),{setWalletPassword:t}}import{useContext as h9}from"react";function y9(e){let{setWalletRecovery:t}=h9(ge);return Ie("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as g9}from"react";function v9(e){let{signMessage:t}=g9(ge);return Ie("signMessage",e),{signMessage:t}}import{useContext as C9}from"react";function w9(e){let{signTypedData:t}=C9(ge);return Ie("signTypedData",e),{signTypedData:t}}import{useContext as b9}from"react";var E9=()=>{let{isModalOpen:e}=b9(ge);return{isOpen:e}};import{useContext as T9}from"react";function S9(e){let{getAccessToken:t}=T9(ge);return Ie("accessToken",e),{getAccessToken:t}}function P9(e){let{authenticated:t,user:r}=H(),{initLoginWithOAuth:o}=k(),n=Xn();return Ie("oAuthAuthorization",e),{reauthorize:a=>_9(t,r,o,n,a.provider)}}var _9=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated"),new C("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(i=>i.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var A9=L2;function L2(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function x9(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function k9(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Hr as AsExternalProvider,zc as Captcha,Xi as ConnectorManager,Cd as LoginModal,ea as PrivyClient,z8 as PrivyProvider,Ve as PrivyProxyProvider,Qi as SUPPORTED_CHAINS,Ac as VERSION,Bt as WalletConnector,x9 as addRpcUrlOverrideToChain,hp as errorIndicatesMaxMfaRetries,gn as errorIndicatesMfaTimeout,vn as errorIndicatesMfaVerificationFailed,he as getAccessToken,k9 as getEmbeddedConnectedWallet,i9 as useConnectWallet,s9 as useCreateWallet,p9 as useCrossAppAccounts,A9 as useExperimentalFarcasterSigner,L2 as useFarcasterSigner,l9 as useFundWallet,o9 as useLinkAccount,t9 as useLinkWithSiwe,j8 as useLogin,X8 as useLoginWithEmail,J8 as useLoginWithOAuth,e9 as useLoginWithSms,Z8 as useLogout,Aa as useMfa,Mr as useMfaEnrollment,E9 as useModalStatus,P9 as useOAuthTokens,H as usePrivy,jc as useRegisterMfaListener,u9 as useSendTransaction,f9 as useSetWalletPassword,y9 as useSetWalletRecovery,v9 as useSignMessage,w9 as useSignTypedData,c9 as useSolanaWallets,S9 as useToken,Na as useWallets};
3087
+ `;import{useRef as f2,useEffect as x8}from"react";import{jsx as R8}from"react/jsx-runtime";function k8({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function y2(e){let t=f2(null),r=f2();return x8(()=>{r.current?.remove(),r.current=k8(e),t.current?.after(r.current)},[e]),R8("div",{ref:t,hidden:!0})}import{useState as I8}from"react";import{useEffect as g2,useRef as v2}from"react";var fc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function zo(e,t,r,o,n,a=!1){let i=a,s=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ke("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((m,v)=>{r.current={resolve:m,reject:v};let w=1e3*60*5;setTimeout(()=>{let y=new ke("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),v(y)},w)});return await e(f)}return await e()},l=4,c=null;for(let u=0;u<l;u++)try{c=await s(u),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),f}if(c===null){let u=new ke("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as D8}from"react/jsx-runtime";var M8=function(e){return()=>`id-${e++}`}(0);function W8(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function ht(e){return e.error!==void 0}var nt=new fc,wd=new Map,O8=(e,t)=>typeof t=="bigint"?t.toString():t,L8=(e,t)=>`${e}${JSON.stringify(t,O8)}`;function ft(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=L8(e,t);if(e==="privy:wallet:create"){let s=wd.get(a);if(s)return s}let i=new Promise((s,l)=>{let c=M8();nt.enqueue(c,{resolve:s,reject:l}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{wd.delete(a)});return wd.set(a,i),i}function N8(e){switch(e.event){case"privy:iframe:ready":let t=nt.dequeue(e.event,e.id);return ht(e)?t.reject(new ke(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=nt.dequeue(e.event,e.id);return ht(e)?r.reject(new ke(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=nt.dequeue(e.event,e.id);return ht(e)?o.reject(new ke(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=nt.dequeue(e.event,e.id);return ht(e)?n.reject(new ke(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let a=nt.dequeue(e.event,e.id);return ht(e)?a.reject(new ke(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:rpc":let i=nt.dequeue(e.event,e.id);return ht(e)?i.reject(new ke(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery":let s=nt.dequeue(e.event,e.id);return ht(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:verify":let l=nt.dequeue(e.event,e.id);return ht(e)?l.reject(new ke(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:submit-enrollment":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:unenroll":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:clear":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:init-signer":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:sign":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:solana-wallet:create":let c=nt.dequeue(e.event,e.id);return ht(e)?c.reject(new ke(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=nt.dequeue(e.event,e.id);return ht(e)?u.reject(new ke(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let f=nt.dequeue(e.event,e.id);return ht(e)?f.reject(new ke(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let m=nt.dequeue(e.event,e.id);return ht(e)?m.reject(new ke(e.error.type,e.error.message)):m.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function C2(e){let t=v2(null),r=v2(e.mfaMethods),o=Jn(),[n,a]=I8(!1);return g2(()=>{r.current=e.mfaMethods},[e.mfaMethods]),g2(()=>{if(!n)return;let i=t.current;if(!i)return;function s(m){m&&m.origin===e.origin&&W8(m.data)&&N8(m.data)}let l={create(m){return ft("privy:wallet:create",m,i,e.origin)},import(m){return ft("privy:wallet:import",m,i,e.origin)},connect(m){return ft("privy:wallet:connect",m,i,e.origin)},recover(m){return zo(v=>ft("privy:wallet:recover",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!m.recoveryMethod||m.recoveryMethod==="privy")},rpc(m){return zo(v=>ft("privy:wallet:rpc",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(m){return ft("privy:solana-wallet:create",m,i,e.origin)},connectSolana(m){return ft("privy:solana-wallet:connect",m,i,e.origin)},recoverSolana(m){return ft("privy:solana-wallet:recover",m,i,e.origin)},rpcSolana(m){return ft("privy:solana-wallet:rpc",m,i,e.origin)},setRecovery(m){return zo(v=>ft("privy:wallet:set-recovery",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return zo(v=>ft("privy:mfa:verify",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return zo(v=>ft("privy:mfa:init-enrollment",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return zo(v=>ft("privy:mfa:submit-enrollment",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(m){return zo(v=>ft("privy:mfa:unenroll",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(m){return ft("privy:mfa:clear",m,i,e.origin)},initFarcasterSigner(m){return ft("privy:farcaster:init-signer",m,i,e.origin)},signFarcasterMessage(m){return ft("privy:farcaster:sign",m,i,e.origin)}};window.addEventListener("message",s);let c=()=>e.onLoad(l),u=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},f=new AbortController;return Ui(()=>ft("privy:iframe:ready",{},i,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",s),f.abort()}},[n]),D8("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:ps(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var yc=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t,r){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return(await this.walletProxy.rpcSolana({accessToken:r,publicKey:this.address,request:t})).response.data}async request(t){console.debug("EmbeddedSolanaProvider.request() called with args",t);let r=await fe();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await w2())throw new C("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t,r);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function gc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(a=>a.provider_app_id===r);if(!n)throw new C("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function b2({api:e,appId:t}){let r=en(),o=Un(),n=await Fn(r);try{let{url:a}=await e.post(rs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw ne(a)}}async function E2({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during cross-app auth flow");try{return(await e.post(os,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(a){let i=ne(a);throw i.privyErrorCode?new C(i.message||"Invalid code during cross-app auth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during cross-app auth flow"?new C("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new C("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}async function T2({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let i=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),s()},12e4);function s(){t?.close(),window.removeEventListener("message",u)}let l,c=setInterval(()=>{t?.closed&&!l&&(s(),clearInterval(c),clearTimeout(i),n(new C("User rejected request")))},300);function u(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(i),o(f.data),s()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(f.data.error)),s()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(l=new BroadcastChannel("popup-privy-oauth"),l.onmessage=u))}window.addEventListener("message",u)})}var vc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let i=e?.linkedAccounts.find(m=>!!(m.type==="cross_app"&&m.embeddedWallets.find(v=>v.address===t)));if(!e||!i)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new C("Cannot request a signature with this wallet address");let s=r.getProviderAccessToken(i.providerApp.id),l=await gc({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id});if(!s){if(l.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await a({appId:i.providerApp.id})&&(s=r.getProviderAccessToken(i.providerApp.id))}if(!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new C("Transactions require a valid token");let c=window.open(void 0,void 0,bd({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");let u=new URL(`${l.apiUrl}/oauth/transact`);return u.searchParams.set("token",s||""),u.searchParams.set("request",U8(o)),c.location=u.href,new Promise((m,v)=>{let y=setTimeout(()=>{b(),v(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),T=setInterval(()=>{c.closed&&(b(),v(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),_=S=>{S.data&&(S.data.token?.action==="set"&&S.data.token?.value!==void 0?r.storeProviderAccessToken(i.providerApp.id,S.data.token.value):S.data.token?.action==="clear"&&r.storeProviderAccessToken(i.providerApp.id,null),S.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&S.data.result&&(b(),m(S.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),S.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&S.data.error&&(b(),v(S.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:S.data.error,address:t}})))};window.addEventListener("message",_);let b=()=>{c.close(),clearInterval(T),clearTimeout(y),window.removeEventListener("message",_)}})},U8=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),bd=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=n/window.screen.availWidth,s=a/window.screen.availHeight,l=(n-e)/2/i+r,c=(a-t)/2/s+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${l},top=${c}`};var F8="https://cdn.apple-cloudkit.com";async function Ed({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,a)=>{function i(){t?.close(),window.removeEventListener("message",s)}function s(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"&&l.data.stateCode&&l.data.authorizationCode&&(n(l.data),i()),l.origin===F8&&l.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:l.data.ckSession}),i()),l.data.type==="PRIVY_OAUTH_ERROR"&&(a(l.data.error),i()))}window.addEventListener("message",s)})}var B8={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",cross_app:"privy:"},S2=e=>{let t=B8[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};var P2=e=>({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});import{jsx as Cr,jsxs as _2}from"react/jsx-runtime";var oo;function K8(e){return typeof e=="string"&&e.length===25}function fe(){if(!oo){let e=J.get(Yo);return Promise.resolve(e||null)}return oo.getAccessToken()}var A2,Ju=(e,t,r)=>A2(e,t,r),x2,Xu=(e,t)=>x2(e,t),k2,em=(e,t)=>k2(e,t),R2,tm=()=>R2(),I2,w2=()=>I2(),j8=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;J.put(Hi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},Y8=({config:e,...t})=>{if(!K8(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");oo||(oo=new Xi({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Cr($m,{client:oo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Cr(Z8,{...t,client:oo})})},Z8=e=>{let t=e.client,[r,o]=tt(!1),[n,a]=tt(!1),[i,s]=tt(!1),[l,c]=tt(null),[u,f]=tt([]),[m,v]=tt(null),w=Oi(u),[y,T]=tt(!1),[_,b]=tt(null),[S,I]=tt(!1),[N,M]=tt({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[R,B]=tt({status:"initial"}),[q,Y]=tt(null),[W,z]=tt(null),L=lt(),Ue=Bs(),[Ye,Oe]=tt(!0),[de,X]=tt({}),[Ee,_e]=tt(null),[vt,sr]=tt(null),[Ot,it]=tt(!1),[se,Dr]=tt(!1),Fe=Oi(null),bo=Oi(null),O=Oi(nh),[yt,Ur]=tt(!1);t.onStoreToken=p=>{p&&U(O,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{c(null),s(!1),U(O,"accessToken","onAccessTokenRemoved")};let Q=Oi(null),G=Oi(null),le=p=>{b(p),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:p}})},at=p=>{L.embeddedWallets.createOnLogin!=="off"&&Oe(!0),le(p)};Nr(()=>{let p=nn(l);if(!p||!W)return;let d={address:p.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:qn,id:"io.privy.solana.wallet"},getProvider:async()=>new yc(W,p.address)};v(d)},[W,l]),Nr(()=>{if(!l){t.connectors?.removeEmbeddedWalletConnector();return}let p=we(l),d=Ms(l);if(p||t.connectors?.removeEmbeddedWalletConnector(),d||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!W){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}p&&t.connectors.addEmbeddedWalletConnector(W,p.address,L.defaultChain,e.appId),d&&t.connectors.addImportedWalletConnector(W,d.address,L.defaultChain,e.appId)},[W,l]),Nr(()=>{W&&vt?.(W)},[W]),Nr(()=>{(async()=>{if(!L.customAuth?.enabled)return;Oe(!0);let{getCustomAccessToken:d,isLoading:h}=L.customAuth;if(!(!n||h))try{let g=await d();if(!g&&i){await On.logout();return}if(!g||i)return;t.startAuthFlow(new Ln(g));let{user:A,isNewUser:F}=await t.authenticate();if(!A){await On.logout();return}c(A||null),T(F||!1),s(!0),Dr(!0)}catch(g){console.warn(g),i&&await On.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,i]),Nr(()=>{se&&W&&l&&Ut(l,L.embeddedWallets.createOnLogin)&&(Dr(!1),Wn(l,Dn).catch(console.error))},[se&&W&&l]),Nr(()=>{async function p(){let d=$o(),h=In();j8();let g=H8();t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:g,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let A;t.connectors?.on("connectorInitialized",()=>{A&&clearTimeout(A);let Te=t.connectors.walletConnectors.length,oe=t.connectors.walletConnectors.reduce((ze,Ce)=>ze+(Ce.initialized?1:0),0);oe===Te?Ur(!0):A=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:oe,expected:Te}),Ur(!0)},1500)}),t.connectors?.initialize().then(()=>{qa()});let F=await t.getAuthenticatedUser(),V=!!F;if(L.customAuth?.enabled||(s(!!F),F&&U(O,"login","onComplete",F,!1,!0,null,null),c(F)),d){G.current=V?"link":"login";return}if(h&&!V){G.current="login",at("TELEGRAM_AUTH_SCREEN");return}re.setReadyToTrue(!!F)}!n&&Ue&&p()},[t,Ee,n,Ue]),Nr(()=>{if(!n)return;if(!l){it(!0);return}if(!!!l.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){it(!0);return}let d=!!u.find(h=>h.walletClientType==="privy");it(d)},[n,l,u]);let $o=()=>{let p=$i();if(p.inProgress&&p.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(p.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:p.stateCode,authorizationCode:p.authorizationCode});return}let d="privy:";function h(g){return g.startsWith(d)}return p.inProgress&&h(p.provider)&&!p.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:p.stateCode,authorizationCode:p.authorizationCode}),window.close()),!p.inProgress||p.headless?!1:(t.startAuthFlow(new Br(p)),at("AWAITING_OAUTH_SCREEN"),!0)},In=()=>{let p=Yu();if(!p||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let d=new Bn;return t.startAuthFlow(d),p.flowType==="login-url"&&(d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult={id:p.id,first_name:p.first_name,last_name:p.last_name,auth_date:p.auth_date,username:p.username,photo_url:p.photo_url,hash:p.hash}),p.flowType==="web-app"&&(d.meta.telegramAuthResult=void 0,d.meta.telegramWebAppData={query_id:p.query_id,user:p.user,auth_date:p.auth_date,hash:p.hash}),!0},lr=async(p,d,h,g)=>{let A=await t.connectors?.createWalletConnector(p,d)||null;Li(A,d,h,g)};async function Li(p,d,h,g){if(p)M({status:"disconnected",connectedWallet:null,connectError:null,connector:p,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new ie("Unable to connect to wallet."),connector:null,connectRetry:E}),g?.(null,h);p instanceof Er&&d&&await p.resetConnection(d),M({connector:p,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Li(p,d,h,g)});try{let A=await p.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(F=>F.id===Number(A?.chainId.replace("eip155:","")))&&!(A?.connectorType==="wallet_connect_v2"&&A?.walletClientType==="metamask")){M(F=>({...F,connector:p,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await A?.switchChain(L.defaultChain.id),A&&(A.chainId=Nn(jo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return M(F=>({...F,status:"connected",connectedWallet:A,connectError:null,connectRetry:E})),A&&U(O,"connectWallet","onSuccess",A),g?.(A,h)}catch(A){return A instanceof Ze?(console.warn(A.cause?A.cause:A.message),U(O,"connectWallet","onError",A.privyErrorCode||"generic_connect_wallet_error")):(console.warn(A),U(O,"connectWallet","onError","unknown_connect_wallet_error")),M(F=>({...F,status:"disconnected",connectedWallet:null,connectError:A})),g?.(null,h)}}let no=async(p,d)=>{if(p===null)return;let h=new lo(p,t,d);t.startAuthFlow(h)},qa=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),h=p.get("privy_wallet_client");if(!d||!h)return;if(h==="phantom"&&!To()&&at("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");le("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),lr(d,h,void 0,no)};Nr(()=>{n&&i&&l===null&&t.getAuthenticatedUser().then(c)},[n,i,l,t]);let qe=p=>{if(!i)throw U(O,"linkAccount","onError","must_be_authenticated",{linkMethod:p}),new C("User must be authenticated before linking an account.")},za=()=>{qe("siwe"),Q.current="siwe",G.current="link",le("LINK_WALLET_SCREEN")},Ni=p=>{if(!i||!l)return!1;if(p.walletClientType==="privy")return!0;for(let d of l.linkedAccounts)if(d.type==="wallet"&&d.address===p.address&&d.walletClientType!=="privy")return!0;return!1},Ko=async p=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;if(M(h=>({...h,connector:d,status:"connected",connectedWallet:p,connectError:null,connectRetry:E})),L.captchaEnabled&&!i){let h={callback:g=>no(p,g),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};X({captchaModalData:h}),at("CAPTCHA_SCREEN")}else await no(p),at("AWAITING_CONNECTION")},Be=async(p,d)=>{if(!L.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:h,externalTransactionId:g}=await vy(t,p,d?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:h,externalTransactionId:g}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},He=()=>{f(p=>{let d=t.connectors?.wallets.map(h=>({...h,linked:Ni(h),loginOrLink:async()=>{if(!await h.isConnected())throw new C("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Ko(h)},fund:async g=>{let{signedUrl:A,externalTransactionId:F}=await Be(h.address,g);X({fiatOnRampPrompt:{signedUrl:A},fiatOnRampStatus:{externalTransactionId:F}}),le("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let g=await t.unlinkWallet(h.address);c(g)}}))||[];return Ws(p,d)?p:d})};Nr(()=>{He()},[l?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");He(),t.connectors.on("walletsUpdated",He)}},[n]);let Mn=p=>{if(p&&"suggestedAddress"in p&&p.suggestedAddress){let d=wo(p.suggestedAddress);Y(d)}le(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let p=u[0],d=w.current.find(g=>g.address===p.address),h;if(p.walletClientType==="privy"?h=l?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===p.address&&g.walletClientType==="privy"):h=l?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===p.address&&g.walletClientType!=="privy"),!d&&h){let g=Object.assign({},l);g.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(g)}w.current=u},[u]);let Wn=async(p,d)=>{if(we(p))throw U(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[g,A]=await Promise.all([re.initializeWalletProxy(d),fe()]);if(!g&&L.customAuth?.enabled)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!g||!A||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((F,V)=>{Oe(!0),X({createWallet:{onSuccess:oe=>{U(O,"createWallet","onSuccess",oe),F(oe)},onFailure:oe=>{U(O,"createWallet","onError","unknown_embedded_wallet_error"),V(oe)},callAuthOnSuccessOnClose:!1}}),le("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await g.create({accessToken:A});let F=await re.refreshUser(),V=we(F);if(!V)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(O,"createWallet","onSuccess",V),V}},$a=p=>{if(!L.chains.map(d=>d.id).includes(p))throw new ie(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Fr=(p,d,h)=>new Promise(async(g,A)=>{let{requesterAppId:F}=d||{};if(!i||!l){U(O,"sendTransaction","onError","must_be_authenticated"),A(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=p.from,Te=V?l?.linkedAccounts.find($e=>$e.type==="wallet"&&$e.walletClientType==="privy"&&wo($e.address)===wo(V)):we(l);if(!Te){U(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have a Privy wallet before signing"));return}Oe(!0);let oe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ze=p.chainId?Number(p.chainId):oe.chainId;$a(ze);let Ce=Object.assign({},p,{chainId:ze}),Nt=async()=>{let $e=await fe();if(!$e||!W){U(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await re.recoverEmbeddedEthereumWallet()){U(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(new Error("Unable to connect to wallet"));return}let wr=ao(Ce.chainId,L.chains,L.rpcConfig,{appId:e.appId}),Cc=await $8(Te.address,Ce,wr);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:F2}=await z8(Cc,wr),{hasSufficientFunds:B2}=await pc(Te.address,Cc,F2,wr);if(!B2)throw new st(new jt("Wallet has insufficient funds for this transaction.",q8.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let _d=await cc($e,Te.address,W,Cc,wr,F);U(O,"sendTransaction","onSuccess",_d),g(_d)}catch(Ya){U(O,"sendTransaction","onError","transaction_failure"),A(Ya)}};if(L.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Nt();else{let $e={transactionRequest:Ce,onSuccess:wr=>{U(O,"sendTransaction","onSuccess",wr),g(wr)},onFailure:wr=>{U(O,"sendTransaction","onError","transaction_failure"),A(wr)},uiOptions:d||{},fundWalletConfig:h,requesterAppId:F},Ya={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wr=>{U(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(wr)}};X({connectWallet:Ya,sendTransaction:$e}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ka(){return new Promise(async(p,d)=>{let h=await fe();if(!h||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:h}),p()}catch(g){d(g)}})}let Sd=p=>p?.linkedAccounts.filter(d=>d.latestVerifiedAt!==null&&!(d.type==="wallet"&&d.walletClientType==="privy")).sort((d,h)=>h.latestVerifiedAt.getTime()-d.latestVerifiedAt.getTime())[0],Lt=p=>{let d=l?.linkedAccounts.filter(A=>A.type===p).length??0,{displayName:h,loginMethod:g}=S2(p);if(p==="passkey"&&d>=5||p!=="passkey"&&d>=1)throw U(O,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:g}),new C(`User already has an account of type ${h} linked.`)},D2=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(O,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new C("User can't link an account because Telegram linking is disabled.")};async function Pd({legacySetWalletPasswordFlow:p=!1}){b(null);let d=p?"setWalletPassword":"setWalletRecovery";if(!i||!l)throw U(O,d,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=we(l);if(!h||!W)throw U(O,d,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(nn(l))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await Ka()}catch(A){throw U(O,d,"onError","missing_or_invalid_mfa"),A}return new Promise((A,F)=>{Oe(!0);let V={onSuccess:Ce=>{U(O,d,"onSuccess","user-passcode",Ce),A(Ce)},onFailure:Ce=>{U(O,d,"onError","user_exited_set_password_flow"),F(Ce)},callAuthOnSuccessOnClose:!1},Te=h.recoveryMethod==="user-passcode",ze={onCompleteNavigateTo:cl({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:p,isResettingPassword:Te}),shouldForceMFA:!1,onFailure:Ce=>{U(O,d,"onError","unknown_connect_wallet_error"),F(Ce)}};X({setWalletPassword:V,createWallet:V,connectWallet:ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Te}}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function ja({appId:p}){qe(`privy:${p}`),Q.current=`privy:${p}`,G.current="link";let d=window.open(void 0,void 0,bd({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:p}}),new Promise(async(h,g)=>{let{name:A,logoUrl:F}=await gc({api:t.api,providerAppId:p,requesterAppId:L.id});X({crossAppAuth:{appId:p,name:A,logoUrl:F,popup:d,onSuccess:h,onError:g}}),at("CROSS_APP_AUTH_SCREEN")})}let On={ready:n,authenticated:i,user:l,walletConnectors:t.connectors||null,connectWallet:Mn,importWallet:async({privateKey:p})=>{qe("siwe");let[d,h]=await Promise.all([re.initializeWalletProxy(15e3),fe()]);if(d&&h){await d.import({privateKey:p,accessToken:h});let g=await re.refreshUser(),A=Ms(g);if(!A)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(O,"createWallet","onSuccess",A),A}else throw new C("User is not authenticated")},linkWallet:za,linkCrossAppAccount:ja,linkEmail:()=>{qe("email"),Lt("email"),Q.current="email",G.current="link",le("LINK_EMAIL_SCREEN")},linkPhone:()=>{qe("sms"),Lt("phone"),Q.current="sms",G.current="link",le("LINK_PHONE_SCREEN")},linkGoogle:async()=>{qe("google"),Lt("google_oauth"),G.current="link",await re.initLoginWithOAuth("google")},linkTwitter:async()=>{qe("twitter"),Lt("twitter_oauth"),G.current="link",await re.initLoginWithOAuth("twitter")},linkDiscord:async()=>{qe("discord"),Lt("discord_oauth"),G.current="link",await re.initLoginWithOAuth("discord")},linkGithub:async()=>{qe("github"),Lt("github_oauth"),G.current="link",await re.initLoginWithOAuth("github")},linkSpotify:async()=>{qe("spotify"),Lt("spotify_oauth"),G.current="link",await re.initLoginWithOAuth("spotify")},linkInstagram:async()=>{qe("instagram"),Lt("instagram_oauth"),G.current="link",await re.initLoginWithOAuth("instagram")},linkTiktok:async()=>{qe("tiktok"),Lt("tiktok_oauth"),G.current="link",await re.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{qe("linkedin"),Lt("linkedin_oauth"),G.current="link",await re.initLoginWithOAuth("linkedin")},linkApple:async()=>{qe("apple"),Lt("apple_oauth"),G.current="link",await re.initLoginWithOAuth("apple")},linkPasskey:async()=>{qe("passkey"),Lt("passkey"),await re.initLinkWithPasskey(),le("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{qe("telegram"),Lt("telegram"),D2(),G.current="link",Q.current="telegram",await re.initLoginWithTelegram(),le("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{qe("farcaster"),Lt("farcaster"),await re.initLoginWithFarcaster(),G.current="link",Q.current="farcaster",le("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(qe("email"),!l?.email)throw new C("User does not have an email linked to their account.");G.current="link",Q.current="email",le("UPDATE_EMAIL_SCREEN")},login:async()=>{let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(h=>{_e(g=>h.bind(g))});if(_e(null),d){console.warn(p);return}}if(i){console.warn(p);return}G.current="login",at("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(p=>{_e(()=>p)}),_e(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}at("CONNECT_OR_CREATE")},logout:async()=>{if(l&&t.clearProviderAcccessTokens(l),b(null),await t.logout(),l&&W)try{await W.clearMfa({userId:l.id})}catch{}c(null),s(!1),U(O,"logout","onSuccess"),G.current=null,Q.current=null,o(!1),J.del(Vi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!l||!l.wallet)return new Ve;let p=u.find(h=>l.wallet&&h.address===l.wallet.address),d=t.connectors?.walletConnectors.find(h=>h.wallets.find(g=>g.address===p?.address));return!p||!d?new Ve:d.proxyProvider},getEthersProvider:()=>{if(!l||!l.wallet)return new Td(new Hr(new Ve));let p=u.find(h=>l.wallet&&h.address===l.wallet.address),d=t.connectors?.walletConnectors.find(h=>h.wallets.find(g=>g.address===p?.address));return!p||!d?new Td(new Hr(new Ve)):new Td(new Hr(d.proxyProvider))},getWeb3jsProvider:()=>{if(!l||!l.wallet)return new Po(new Ve);let p=u.find(h=>l.wallet&&h.address===l.wallet.address),d=t.connectors?.walletConnectors.find(h=>h.wallets.find(g=>g.address===p?.address));return!p||!d?new Po(new Ve):new Po(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkSpotify:async p=>{let d=await t.unlinkOAuth("spotify",p);return c(d),d},unlinkInstagram:async p=>{let d=await t.unlinkOAuth("instagram",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},unlinkFarcaster:async p=>{let d=await t.unlinkFarcaster(p);return c(d),d},unlinkTelegram:async p=>{let d=await t.unlinkTelegram(p);return c(d),d},unlinkPasskey:async p=>{let d=await t.unlinkPasskey(p);return c(d),d},unlinkCrossAppAccount:async({subject:p})=>{let d=l?.linkedAccounts.find(g=>g.type==="cross_app"&&g.subject===p)?.providerApp;if(!d)throw new C("Invalid subject");t.storeProviderAccessToken(d.id,null);let h=await t.unlinkOAuth(`privy:${d.id}`,p);return c(h),h},setActiveWallet:async p=>{let d=u.find(g=>wo(g.address)===wo(p)),h=l?.linkedAccounts.find(g=>g.type==="wallet"&&wo(g.address)===wo(p));if(!d||!await d.isConnected())Y(p),za();else if(!d.linked)d.loginOrLink();else{let g=Object.assign({},l);g.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(g)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!l)throw U(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Wn(l,15e3)},setWalletRecovery:async()=>Pd({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Pd({legacySetWalletPasswordFlow:!0}),signMessage:(p,d,h)=>new Promise(async(g,A)=>{let{requesterAppId:F}=d||{};if(!i||!l){U(O,"signMessage","onError","must_be_authenticated"),A(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=h?l?.linkedAccounts.find(oe=>oe.type==="wallet"&&oe.walletClientType==="privy"&&wo(oe.address)===wo(h)):we(l);if(!V){U(O,"signMessage","onError","embedded_wallet_not_found"),A(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){U(O,"signMessage","onError","invalid_message"),A(new Error("Message must be a non-empty string"));return}Oe(!0);let Te=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await fe();if(!W||!oe)throw new Error("Unable to connect to wallet");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:V.address,requesterAppId:F}});let{response:Ce}=await W.rpc({accessToken:oe,address:V.address,requesterAppId:F,request:{method:"personal_sign",params:[p,V.address]}}),Nt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:V.address,requesterAppId:F}}),Nt};if(L.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await Te();U(O,"signMessage","onSuccess",oe),g(oe)}catch(oe){U(O,"signMessage","onError","unable_to_sign"),A(oe??new st("Unable to sign message"))}}else{let Ce={method:"personal_sign",data:p,confirmAndSign:Te,onSuccess:$e=>{U(O,"signMessage","onSuccess",$e),g($e)},onFailure:$e=>{U(O,"signMessage","onError","unable_to_sign"),A($e)},uiOptions:d||{}},Nt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:$e=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),A($e)},address:V.address};X({signMessage:Ce,connectWallet:Nt}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(p,d)=>new Promise(async(h,g)=>{let{requesterAppId:A}=d||{};if(!i||!l){U(O,"signTypedData","onError","must_be_authenticated"),g(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=we(l);if(!F){U(O,"signTypedData","onError","embedded_wallet_not_found"),g(new Error("Must have a Privy wallet before signing"));return}Oe(!0);let V=Fi(p),Te=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let oe=await fe();if(!W||!oe)throw new Error("Unable to connect to wallet");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:F.address,requesterAppId:A}});let{response:Ce}=await W.rpc({accessToken:oe,address:F.address,requesterAppId:A,request:{method:"eth_signTypedData_v4",params:[F.address,V]}}),Nt=Ce.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:F.address,requesterAppId:A}}),Nt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let oe=await Te();U(O,"signTypedData","onSuccess",oe),h(oe)}catch(oe){U(O,"signTypedData","onError","unable_to_sign"),g(oe??new st("Unable to sign message"))}}else{let Ce={method:"eth_signTypedData_v4",data:V,confirmAndSign:Te,onSuccess:$e=>{U(O,"signTypedData","onSuccess",$e),h($e)},onFailure:$e=>{U(O,"signTypedData","onError","unable_to_sign"),g($e)},uiOptions:d||{}},Nt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:$e=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),g($e)}};X({signMessage:Ce,connectWallet:Nt}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,h)=>{let A=await(await Fr(p,d,h)).wait();return dc(A)},exportWallet:()=>new Promise(async(p,d)=>{if(!i||!l){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!we(l)){d(new Error("Must have a Privy wallet before exporting"));return}Oe(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d,shouldForceMFA:!0};if(X(de),!await fe()||!W){d(new Error("Must have valid access token to enroll in MFA"));return}if(!W){d(new Error("Must have a Privy wallet before exporting"));return}let F={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:p,onFailure:d};X({keyExport:F,connectWallet:g}),le("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ka,async init(p){switch(p){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}},async submit(p,d){switch(p){case"totp":case"sms":if(typeof d!="string")throw new C("Invalid MFA code");Fe.current?.resolve({mfaMethod:p,mfaCode:d,relyingParty:window.origin}),await new Promise((F,V)=>{bo.current={resolve:F,reject:V}});break;case"passkey":if(typeof d=="string")throw new C("Invalid authenticator response");let g=await(await import("@simplewebauthn/browser")).startAuthentication(d),A=P2(g);Fe.current?.resolve({mfaMethod:p,mfaCode:A,relyingParty:window.origin}),await new Promise((F,V)=>{bo.current={resolve:F,reject:V}});break;default:throw Fe.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${p}`)}},cancel(){Fe.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(p){let d=await fe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,h)=>{if(!p){re.closePrivyModal(),d();return}L.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),X({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:d,onFailure:h}}),le("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await fe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");let d=await W.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await fe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(p){let d=await fe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:p}){let d=await fe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:p});let h=await t.getAuthenticatedUser();c(h)},async unenroll(p){let d=await fe();if(!d||!W)throw new Error("Must have valid access token to remove MFA");p==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:[]}):await W.unenrollMfa({method:p,accessToken:d});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let p=await fe(),d=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!d)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let g=await W.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(g.status==="approved"){let A=await t.getAuthenticatedUser();c(A||l||null)}X({farcasterSigner:g}),le("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let p=await fe(),d=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!d)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(A=>Uint8Array.from(A.match(/.{1,2}/g).map(F=>parseInt(F,16))))(l.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async p=>{let d=await fe(),h=l?.linkedAccounts.find(V=>V.type==="wallet"&&V.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await re.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!l.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let A=await import("@simplewebauthn/browser"),F=await W.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{hash:A.bufferToBase64URLString(p)},fid:BigInt(l.farcaster.fid),relyingParty:window.origin});return new Uint8Array(A.base64URLStringToBuffer(F.signature))},isHeadlessOAuthLoading:S,loginWithCode(p){return re.loginWithCode(p)},initLoginWithEmail(p){return re.initLoginWithEmail(p)},initLoginWithSms(p){return re.initLoginWithSms(p)},otpState:R,fundWallet(p,d){return re.fundWallet(p,d)},initLoginWithHeadlessOAuth(p,d){return re.initLoginWithHeadlessOAuth(p,d)},loginWithHeadlessOAuth(p){return re.loginWithHeadlessOAuth(p)},generateSiweMessage({address:p,chainId:d}){return re.generateSiweMessage({address:p,chainId:d})},linkWithSiwe({message:p,signature:d,chainId:h,walletClientType:g,connectorType:A}){return qe("siwe"),re.linkWithSiwe({message:p,signature:d,chainId:h,walletClientType:g,connectorType:A})},signMessageWithCrossAppWallet(p,{address:d}){return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"personal_sign",params:[p,d]},reconnect:ja})},signTypedDataWithCrossAppWallet(p,{address:d}){let h=Fi(p);return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[d,h]},reconnect:ja})},sendTransactionWithCrossAppWallet(p,{address:d}){return vc({user:l,client:t,address:d,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[p]},reconnect:ja})},isModalOpen:r,mfaMethods:L.mfa.methods};A2=On.signMessage,x2=On.signTypedData,k2=async(...p)=>{let d=await Fr(...p);return L.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let re=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:q,pendingTransaction:null,walletConnectionStatus:N,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:p=>L.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(W)return W;let d=new Promise(A=>{sr(()=>F=>A(F))}),h=new Promise(A=>setTimeout(()=>A(null),p)),g=await Promise.race([d,h]);return sr(null),g},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&l,h;d&&Q.current&&(h=Sd(l)),G.current==="login"?p.shouldCallAuthOnSuccess&&d&&Q.current?(U(O,"login","onComplete",l,y,!1,Q.current,h??null),e.onSuccess?.(l,y)):U(O,"login","onError","exited_auth_flow"):G.current==="link"&&h&&(p.isSuccess&&d&&Q.current?U(O,"linkAccount","onSuccess",l,Q.current,h):Q.current&&U(O,"linkAccount","onError","exited_link_flow",{linkMethod:Q.current})),Y(null),G.current=null,Q.current=null,T(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:le,connectWallet:Li,initLoginWithWallet:async(p,d)=>{Q.current="siwe",no(p,d)},loginWithWallet:async()=>{if(!n)throw new io;if(!(t.authFlow instanceof lo))throw new C("Must initialize SIWE flow first.");let p,d;if(i)try{({user:p}=await t.link()),Q.current="siwe"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:p,isNewUser:d}=await t.authenticate()),Q.current="siwe"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(p||l||null),T(d||!1),s(!0)},initLoginWithFarcaster:async p=>{let d=new Bi(p);t.startAuthFlow(d);try{Q.current="farcaster",await d.initializeFarcasterConnect()}catch(h){throw G.current==="login"?U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),h}},loginWithFarcaster:async()=>{if(!n)throw new io;if(!(t.authFlow instanceof Bi))throw new C("Must initialize Farcaster flow first.");let p,d;if(i)try{({user:p}=await t.link()),Q.current="farcaster"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:p,isNewUser:d}=await t.authenticate()),Q.current="farcaster"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(p||null),T(d||!1),s(!0)},async crossAppAuthFlow({appId:p,popup:d}){let h=`privy:${p}`;Q.current=h;let{url:g,stateCode:A,codeVerifier:F}=await b2({api:t.api,appId:p});if(!g)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:p}}),new C("No authorization URL returned for cross-app auth.");try{let V=await T2({url:g,popup:d,provider:h}),Te=V.stateCode,oe=V.authorizationCode;if(Te!==A)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:A??"",returnedStateCode:Te??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let ze=await E2({api:oo.api,appId:p,codeVerifier:F,stateCode:Te,authorizationCode:oe});ze&&t.storeProviderAccessToken(p,ze);let Ce=await re.refreshUser();if(!Ce)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:p}}),Ce}catch(V){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:V.toString(),provider:h}}),V}},async initLoginWithOAuth(p,d){if(Q.current=p,Tc()){if(p==="google"&&si(window.navigator.userAgent)){at("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{at("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}p==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),J.del(Jo);let h=new Br({provider:p});d&&h.addCaptchaToken(d),t.startAuthFlow(h);let g=await t.authFlow.getAuthorizationUrl();g&&g.url&&(p==="twitter"&&G8&&(g.url=g.url.replace("x.com","twitter.com")),window.location.assign(g.url))},async initLoginWithTelegram(p){if(!n)throw new io;Q.current="telegram";let d=new Bn(p);t.startAuthFlow(d),d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult=await new Promise((h,g)=>{if(!L.loginConfig.telegramAuthConfiguration)return g(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return g(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},A=>A?h(A):g(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof Bn))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let p,d;if(i)try{({user:p}=await t.link()),Q.current="telegram"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}else try{let h=await t.authenticate();p=h.user,d=h.isNewUser,Q.current="telegram"}catch(h){throw G.current==="login"?U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}c(p),T(d||!1),s(!0)},async recoveryOAuthFlow(p,d,h){let g,A;function F(V){if(!V)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:p}}),new C("Recovery OAuth failed")}switch(p){case"google-drive":{let{url:V,codeVerifier:Te,stateCode:oe}=await gp({api:oo.api,provider:p});F(V);let ze,Ce;try{let Nt=await Ed({url:V,popup:h,provider:p});if(ze=Nt.stateCode,Ce=Nt.authorizationCode,ze!==oe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p,storedStateCode:oe??"",returnedStateCode:ze??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Nt){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Nt.toString(),provider:p}}),new C("Recovery OAuth failed")}[g,A]=await Promise.all([fe(),cf({api:oo.api,provider:p,codeVerifier:Te,stateCode:ze,authorizationCode:Ce})]);break}case"icloud":{let{url:V}=await gp({api:oo.api,provider:p});F(V);let{ckWebAuthToken:Te}=await Ed({url:V,popup:h,provider:p});A=Te,g=await fe();break}}if(!W)throw new C("Cannot connect to wallet proxy");if(!g)throw new C("Unable to authorize user");switch(d){case"recover":let V=de.recoverWallet?.privyWallet?.address;if(!V)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:V,recoveryMethod:p}}),await W.recover({address:V,accessToken:g,recoveryAccessToken:A,recoveryMethod:p}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:V,recoveryMethod:p}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:g,recoveryAccessToken:A,recoveryMethod:p});let Te=await re.refreshUser(),oe=we(Te);if(!oe)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:oe.address}}),U(O,"createWallet","onSuccess",oe);break;case"set-recovery":let ze=we(l);if(!ze)throw U(O,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:p}}),await W.setRecovery({address:ze.address,accessToken:g,recoveryAccessToken:A,recoveryMethod:p});let Ce=we(await re.refreshUser());if(!Ce)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:ze.address,recoveryMethod:p}}),U(O,"setWalletRecovery","onSuccess",p,Ce);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(p){if(!(t.authFlow instanceof Br))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=J.get(Zo),h=t.authFlow.meta.stateCode;if(d!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p,storedStateCode:d??"",returnedStateCode:h??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let g,A,F;if(i)try{let V=await t.link();g=V.user,F=V.oAuthTokens,Q.current=p}catch(V){throw U(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:p}),V}else try{let V=await t.authenticate();g=V.user,A=V.isNewUser,F=V.oAuthTokens,Q.current=p}catch(V){throw G.current==="login"?U(O,"login","onError",V.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:p}),V}return c(g),T(A||!1),s(!0),F&&g&&U(O,"oAuthAuthorization","onOAuthTokenGrant",F,{user:g}),F},async initLoginWithPasskey(p){let d=new rn(p);t.startAuthFlow(d),G.current="login";try{Q.current="passkey",await d.initAuthenticationFlow()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new io;if(!(t.authFlow instanceof rn))throw new C("Must initialize Passkey flow first.");if(Q.current!=="passkey")throw new C("Must init login with Passkey flow first.");let p,d;try{Q.current="passkey",{user:p,isNewUser:d}=await t.authenticate()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(p),T(d||!1),s(!0)},async initLinkWithPasskey(p){let d=new rn(p);t.startAuthFlow(d),G.current="link",Q.current="passkey";try{await d.initLinkFlow()}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new io;if(!(t.authFlow instanceof rn))throw new C("Must initialize Passkey flow first.");if(Q.current!=="passkey")throw new C("Must init login with Passkey flow first.");let p;try{Q.current="passkey",{user:p}=await t.link()}catch(d){throw U(O,"linkAccount","onError",d.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),d}return c(p||l||null),p},async initLoginWithHeadlessOAuth(p,d){if(Tc()){if(p==="google"&&si(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new Br({provider:p,headless:!0});d&&h.addCaptchaToken(d);let g=await t.startAuthFlow(h).getAuthorizationUrl();g?.url&&window.location.assign(g.url)},async loginWithHeadlessOAuth(p){I(!0),t.startAuthFlow(new Br(p));let d=J.get(Zo),h=p.stateCode;if(d!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:p.provider,storedStateCode:d??"",returnedStateCode:h??""}}),I(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let g,A;if(i)try{({user:g}=await t.link()),Q.current=p.provider}catch(F){throw U(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account",{linkMethod:p.provider}),F}else try{({user:g,isNewUser:A}=await t.authenticate()),Q.current=p.provider}catch(F){throw G.current==="login"?U(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account",{linkMethod:p.provider}),F}return c(g),T(A||!1),s(!0),I(!1),g??void 0},initLoginWithEmail:async(p,d)=>{let h=new Eo(p,d);t.startAuthFlow(h);try{Q.current="email",await h.sendCodeEmail()}catch(g){throw G.current==="login"?U(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),g}},initUpdateEmail:async(p,d,h)=>{let g=new is(p,d,h);t.startAuthFlow(g),await g.sendCodeEmail()},initLoginWithSms:async(p,d)=>{B({status:"sending-code"});let h=new on(p,d);t.startAuthFlow(h);try{Q.current="sms",await h.sendSmsCode(),B({status:"awaiting-code-input"})}catch(g){throw B({status:"error",error:g}),G.current==="login"?U(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),g}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(B({status:"submitting-code"}),!n){let g=new io;throw B({status:"error",error:g}),g}if(t.authFlow instanceof Eo)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof on)t.authFlow.meta.smsCode=p.trim();else{let g=new C("Must initialize a passwordless code flow first");throw B({status:"error",error:g}),g}await fe();let d,h;if(G.current==="link")try{({user:d}=await t.link())}catch(g){throw B({status:"error",error:g}),U(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account",{linkMethod:Q.current}),g}else try{({user:d,isNewUser:h}=await t.authenticate())}catch(g){throw B({status:"error",error:g}),U(O,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}c(d||l||null),T(h||!1),s(!0),B({status:"done"})},generateSiweMessage:async({address:p,chainId:d,captchaToken:h})=>{G.current="link",Q.current="siwe";let g=await t.generateSiweNonce({address:p,captchaToken:h}),A=d.replace("eip155:","");return Is({address:p,chainId:A,nonce:g})},linkWithSiwe:async({message:p,signature:d,chainId:h,walletClientType:g,connectorType:A})=>{let F;try{if(G.current!=="link"||Q.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");F=await t.linkWithSiwe({message:p,signature:d,chainId:h,walletClientType:g,connectorType:A});let V=Sd(F);V&&U(O,"linkAccount","onSuccess",F,"siwe",V)}catch(V){throw U(O,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),G.current=null,Q.current=null,V}c(F||l||null),G.current=null,Q.current=null},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:W,createAnalyticsEvent:({eventName:p,payload:d,timestamp:h})=>t.createAnalyticsEvent({eventName:p,payload:d,timestamp:h}),acceptTerms:async()=>{let p=await t.acceptTerms();return c(p),p},getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedEthereumWallet:async()=>new Promise(async(p,d)=>{let h=we(l)||Ms(l),g=await fe();if(!g||!W||!h){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Oe(!0);try{await W.connect({accessToken:g,address:h.address}),p(!0)}catch(A){if(fn(A)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await W.recover({address:h.address,accessToken:g,recoveryMethod:h.recoveryMethod})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),p(!0);else if(fn(A)&&h.recoveryMethod!=="privy"){X({recoverWallet:{privyWallet:h,onFailure:d,onSuccess:()=>p(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let F=pl(h.recoveryMethod);le(F)}else d(A)}}),embeddedSolanaWallet:m,createEmbeddedSolanaWallet:async()=>{Oe(!0);let p=await fe(),d=nn(l),h=we(l);if(!l||!p)throw new C("User must be logged in to create a Solana wallet");if(d)throw new C("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await re.recoverEmbeddedEthereumWallet();else throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let g=await re.initializeWalletProxy(15e3);if(!g)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await g.createSolana({accessToken:p,ethereumAddress:h?.address});let A=await re.refreshUser(),F=nn(A);if(!F)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:F.address}}),F}catch(A){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",A)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(p,d)=>{let h=nn(l),g=await fe();if(!g||!W||!h){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Oe(!0);try{await W.connectSolana({accessToken:g,publicKey:h.address}),p(!0)}catch(A){fn(A)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await W.recoverSolana({publicKey:h.address,accessToken:g})).publicKey||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),p(!0)):d(A)}}),getFiatOnRampConfig:Be,setReadyToTrue:p=>{a(!0),Ee?.(p)},updateWallets:()=>He(),fundWallet:async(p,d)=>{let{signedUrl:h,externalTransactionId:g}=await Be(p,d);X({fiatOnRampPrompt:{signedUrl:h},fiatOnRampStatus:{externalTransactionId:g}}),le("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async p=>{let d=await fe(),h=l?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!l?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let g=await t.requestFarcasterSignerStatus(p);if(g.status==="approved"){let A=await t.getAuthenticatedUser();c(A||l||null)}return g}}))();R2=re.recoverEmbeddedEthereumWallet,I2=re.recoverEmbeddedSolanaWallet;let U2=V8(()=>({wallets:u,ready:Ot&&yt}),[u,Ot,yt]);return Cr(ge.Provider,{value:On,children:Cr(Kc.Provider,{value:O,children:Cr(nd.Provider,{value:U2,children:Cr(th,{...L,children:_2($c.Provider,{value:re,children:[_2(jm,{data:de,setModalData:X,setInitialScreen:b,initialScreen:_,authenticated:i,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!i&&Cr(zc,{delayedExecution:!1}),Cr(i2,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&Cr(Cd,{open:r})]}),Ye&&Ue?Cr(C2,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:l?.mfaMethods,mfaPromise:Fe,mfaSubmitPromise:bo,onLoad:z,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&Cr(_r,{if:!0,children:Cr(y2,{scriptHost:e.apiUrl||hs,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as Q8}from"react";function J8(e){let{login:t}=Q8(ge);return Ie("login",e),{login:t}}import{useContext as X8}from"react";function e9(e){let{logout:t}=X8(ge);return Ie("logout",e),{logout:t}}import{useCallback as M2,useEffect as t9}from"react";function r9(){let e=ye(),t=Bs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=H(),s=M2(async c=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),l=M2(async()=>{let c=$i();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(u){throw u}finally{tn()}},[o]);return t9(()=>{let c=$i();a&&t&&c.inProgress&&c.headless&&!c.popupFlow&&l()},[a,t]),{initOAuth:s,loginWithOAuth:l,loading:n}}import{useCallback as W2}from"react";var o9=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=W2(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=W2(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as O2}from"react";var n9=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=O2(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=O2(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};import{useCallback as L2}from"react";var i9=()=>{let e=ye(),{generateSiweMessage:t,linkWithSiwe:r}=H(),o=L2(async({address:a,chainId:i})=>{if(!a||!i)throw new Error("wallet address and chainId required to generate nonce");return t({address:a,chainId:i}).then(s=>s)},[t]),n=L2(async({signature:a,message:i,chainId:s,walletClientType:l,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:s,walletClientType:l,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as a9}from"react";function s9(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:m,linkTelegram:v,linkFarcaster:w}=a9(ge);return Ie("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:s,linkGithub:l,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:m,linkFarcaster:w,linkTelegram:v}}import{useContext as l9}from"react";function c9(e){let{connectWallet:t}=l9(ge);return Ie("connectWallet",e),{connectWallet:t}}import{useContext as p9}from"react";function d9(e){let{createWallet:t}=p9(ge);return Ie("createWallet",e),{createWallet:t}}var u9=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var m9=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=k();return{createWallet:t,wallets:e?[e]:[]}};var h9=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=H();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as f9}from"react";function y9(e){let{sendTransaction:t}=f9(ge);return Ie("sendTransaction",e),{sendTransaction:t}}import{useContext as g9}from"react";function v9(e){let{setWalletPassword:t}=g9(ge);return Ie("setWalletPassword",e),{setWalletPassword:t}}import{useContext as C9}from"react";function w9(e){let{setWalletRecovery:t}=C9(ge);return Ie("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as b9}from"react";function E9(e){let{signMessage:t}=b9(ge);return Ie("signMessage",e),{signMessage:t}}import{useContext as T9}from"react";function S9(e){let{signTypedData:t}=T9(ge);return Ie("signTypedData",e),{signTypedData:t}}import{useContext as P9}from"react";var _9=()=>{let{isModalOpen:e}=P9(ge);return{isOpen:e}};import{useContext as A9}from"react";function x9(e){let{getAccessToken:t}=A9(ge);return Ie("accessToken",e),{getAccessToken:t}}function k9(e){let{authenticated:t,user:r}=H(),{initLoginWithOAuth:o}=k(),n=Jn();return Ie("oAuthAuthorization",e),{reauthorize:a=>R9(t,r,o,n,a.provider)}}var R9=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new C("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(i=>i.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var I9=N2;function N2(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function M9(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function W9(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Hr as AsExternalProvider,zc as Captcha,Ji as ConnectorManager,Cd as LoginModal,Xi as PrivyClient,Y8 as PrivyProvider,Ve as PrivyProxyProvider,Zi as SUPPORTED_CHAINS,Ac as VERSION,Bt as WalletConnector,M9 as addRpcUrlOverrideToChain,fp as errorIndicatesMaxMfaRetries,yn as errorIndicatesMfaTimeout,gn as errorIndicatesMfaVerificationFailed,fe as getAccessToken,W9 as getEmbeddedConnectedWallet,c9 as useConnectWallet,d9 as useCreateWallet,h9 as useCrossAppAccounts,I9 as useExperimentalFarcasterSigner,N2 as useFarcasterSigner,u9 as useFundWallet,s9 as useLinkAccount,i9 as useLinkWithSiwe,J8 as useLogin,o9 as useLoginWithEmail,r9 as useLoginWithOAuth,n9 as useLoginWithSms,e9 as useLogout,_a as useMfa,Wr as useMfaEnrollment,_9 as useModalStatus,k9 as useOAuthTokens,H as usePrivy,jc as useRegisterMfaListener,y9 as useSendTransaction,v9 as useSetWalletPassword,w9 as useSetWalletRecovery,E9 as useSignMessage,S9 as useSignTypedData,m9 as useSolanaWallets,x9 as useToken,La as useWallets};