@privy-io/react-auth 1.75.1 → 1.76.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 Xc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var fu=(e,t,r)=>(Xc(e,t,"read from private field"),r?r.call(e):t.get(e)),cs=(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)},ed=(e,t,r,o)=>(Xc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var hu=(e,t,r)=>(Xc(e,t,"access private method"),r);import{getAddress as Io}from"@ethersproject/address";import{Web3Provider as iu}from"@ethersproject/providers";import{createStore as sS}from"mipd";import{useEffect as Kr,useMemo as lS,useRef as Ji,useState as at}from"react";import{isAndroid as cS}from"react-device-detect";import{ProviderErrors as dS,calculateTotalGasEstimate as pS,populateTransactionRequest as uS}from"@privy-io/js-sdk-core";import{FetchError as n3}from"ofetch";var et=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}]`:""}`}},Rt=class extends et{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},C=class extends et{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ds=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ce=class extends et{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof et)return e;if(!(e instanceof n3))return lt(e);if(!e.response)return new Rt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Rt(t||"ApiError",e.response.status,r||o,e,n)},lt=e=>e instanceof et?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var Co=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Mt=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ps=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var wr=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 us="/api/v1/sessions",ms="/api/v1/sessions/logout",yu="/api/v1/sessions/fork",fs="/api/v1/sessions/fork/recover",gu="/api/v1/siwe/init",vu="/api/v1/siwe/authenticate",Cu="/api/v1/siwe/link",wu="/api/v1/siwe/unlink",bu="/api/v1/farcaster/init",Eu="/api/v1/farcaster/authenticate",Tu="/api/v1/farcaster/link",Su="/api/v1/farcaster/status",_u="/api/v1/farcaster/unlink",Pu="/api/v1/passwordless/init",xu="/api/v1/passwordless/authenticate",Au="/api/v1/passwordless/link",ku="/api/v1/passwordless/unlink",Ru="/api/v1/passwordless/update",Mu="/api/v1/passwordless_sms/init",Iu="/api/v1/passwordless_sms/link",Wu="/api/v1/passwordless_sms/unlink",Lu="/api/v1/passwordless_sms/authenticate",hs="/api/v1/oauth/init",Ou="/api/v1/oauth/authenticate",ys="/api/v1/oauth/link",Nu="/api/v1/oauth/unlink",Du="/api/v1/recovery/oauth/init",Uu="/api/v1/recovery/oauth/init_icloud",Fu="/api/v1/recovery/oauth/authenticate",Bu="/api/v1/passkeys/link/init",Hu="/api/v1/passkeys/authenticate/init",Vu="/api/v1/passkeys/link",Gu="/api/v1/passkeys/authenticate",qu="/api/v1/passkeys/unlink",zu="/api/v1/telegram/authenticate",$u="/api/v1/telegram/link",Ku="/api/v1/telegram/unlink";var ju="/api/v1/mfa/passwordless_sms/init",Yu="/api/v1/mfa/passkeys/init",Zu="/api/v1/users/me/accept_terms",gs="/api/v1/analytics_events",Qu="/api/v1/plugins/moonpay_on_ramp/sign",Ju="/api/v1/custom_jwt_account/authenticate";var Jn=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(Ju,{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 le(t)}}async link(){throw new Error("Unimplemented")}};var Wo=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(xu,{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 le(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(Au,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(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(Pu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},vs=class extends Wo{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(Ru,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as a3,isIOS as s3}from"react-device-detect";var td=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)}},Cs=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 rd(){try{let e="privy:__session_storage__test",t="blobby",r=new Cs;return r.put(e,t),r.del(e),!0}catch{return!1}}function i3(){return typeof window<"u"&&window.localStorage?new Cs:new td}var J=i3();import{StaticJsonRpcProvider as ea}from"@ethersproject/providers";function Xu(){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 ws=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 od=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ws(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!od(r))return!1}return!0},Lo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),bs=()=>{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 em=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Es=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,}))$/),tm=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Qe=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},nd=e=>new Promise(t=>setTimeout(t,e));function rm(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var ta=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(s=>{a=!0,n(s)},(...s)=>{a=!0,i(...s)}),l+=1,await nd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ts=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,l]of Object.entries(r))l!==void 0&&n.searchParams.set(a,l);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[l,s]of i)a.append(l,s);n.hash=a.toString()}return n.href};var om=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),pn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function nm(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let m of s)t.includes("coinbase_wallet")&&m.info.rdns==="com.coinbase.wallet"||c.push({type:m.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:m});for(let m of Xu()){let f=ws(m);if(!s.some(u=>u.info.name===f)){if(od(m,!0)&&!c.find(u=>u.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:m});continue}if(f==="Phantom"&&!c.find(u=>u.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:m});continue}if(f==="Coinbase Wallet"&&!c.find(u=>u.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:m});continue}c.find(u=>u.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:m})}}a(c)}})}function Xn(e){return`eip155:${String(Number(e))}`}var im=(e,t,r,o)=>{let n=Number(e),i=t.find(a=>a.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);return id(i,r,o)},id=(e,t,r)=>{let o=e.id,n=Number(e.id),i;if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[n])i=t.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let a=new URL(e.rpcUrls.privy.http[0]);a.searchParams.append("privyAppId",r),i=a.toString()}else e.rpcUrls.public?.http[0]?i=e.rpcUrls.public.http[0]:i=e.rpcUrls.default?.http[0];if(!i)throw new ce(`No RPC url found for ${o}`);return i},am=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ce(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},rr=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new ea(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new ea(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new ea({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new ea(i.rpcUrls.public.http[0]):a=new ea(i.rpcUrls.default?.http[0]),!a)throw new ce(`No RPC url found for ${e}`);return a},ra=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 Ss=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(_s))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var _s={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 sm(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function lm(e,t){let r=sm(t);if(r.deepLink)return fm(r.deepLink,e);if(r.universalLink)return ad(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function cm(e,t){let r=sm(t);if(r.universalLink)return ad(r.universalLink,e)}var dm="WALLETCONNECT_DEEPLINK_CHOICE";function pm(){try{localStorage.removeItem(dm)}catch{}}function um({href:e,name:t}){try{localStorage.setItem(dm,JSON.stringify({href:e,name:t}))}catch{}}function mm(e){return e.startsWith("http://")||e.startsWith("https://")}function fm(e,t){if(mm(e))return ad(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 ad(e,t){if(!mm(e))return fm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ps(e,t){window.open(e,t,"noreferrer noopener")}var Oe=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 oa=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Oe(this._startChannelOnce.bind(this)),this.pollForReady=new Oe(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(Eu,{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 le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Tu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(bu,{token:this.captchaToken});a3&&!s3&&t.connect_uri&&Ps(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(Su,{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 hm="1.75.1";var ym="34357d3c125c2bcf2ce2bc3309d98715",xs="https://auth.privy.io",gm=2e4,Ne=1400,As=2500,sd=hm;var un="privy:token",ld="privy-token",ks="privy:refresh_token",vm="privy-refresh-token",Rs="privy-session",na="privy:session_transfer_token",c3="privy:wallet",ia="privy:caid",aa=e=>`privy:cross-app:${e}`,mn="privy:state_code",fn="privy:code_verifier",hn="privy:headless_oauth",Ms=e=>`${c3}:${e}`,cd="privy:connectors",dd="privy:connections";var yn=12e4,wo=1,pd="0x1",ei=3e4,Cm="https://api.moonpay.com/v1",wm="https://api.moonpay.com/v1",bm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Em="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Tm="deprecated";import{base64url as Pm}from"jose";async function Sm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function _m(e){return crypto.getRandomValues(new Uint8Array(e))}var d3="S256",p3="S256";function gn(){return Pm.encode(_m(36))}function ti(){return gn()}async function ri(e,t=d3){if(t==p3){let r=await Sm(e);return Pm.encode(r)}else return e}function xm(){let e=J.get(fn);if(!e)throw new C("Authentication error.");return e}function Is(){return!!J.get(hn)}var Zr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Is();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=xm();try{let r=await this.api.post(Ou,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(fn),this.meta.headless&&J.del(hn),{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=le(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(fn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(ys,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(fn),r}catch(r){throw le(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=gn();J.put(fn,t);let r=ti();J.put(mn,r);let o=await ri(t);this.meta.headless&&J.put(hn,!0);try{return await this.api.post(hs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function ud(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Am,jsxs as u3}from"react/jsx-runtime";var Ws=({style:e,...t})=>u3("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:[Am("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"}),Am("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 sa,jsxs as m3}from"react/jsx-runtime";var Ls=({style:e,...t})=>m3("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:[sa("g",{clipPath:"url(#clip0)",children:sa("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"})}),sa("defs",{children:sa("clipPath",{id:"clip0",children:sa("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as km}from"react/jsx-runtime";var Os=({style:e,...t})=>km("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:km("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 f3}from"@heroicons/react/24/outline";import{jsx as h3}from"react/jsx-runtime";var Rm=({style:e})=>h3(f3,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Ns,jsxs as y3}from"react/jsx-runtime";var Ds=({style:e,...t})=>y3("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:[Ns("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"}),Ns("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"}),Ns("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"}),Ns("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 br,jsxs as Us}from"react/jsx-runtime";function Fs(e){return Us("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:[Us("defs",{children:[Us("linearGradient",{id:"b",children:[br("stop",{offset:"0",stopColor:"#3771c8"}),br("stop",{stopColor:"#3771c8",offset:".128"}),br("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Us("linearGradient",{id:"a",children:[br("stop",{offset:"0",stopColor:"#fd5"}),br("stop",{offset:".1",stopColor:"#fd5"}),br("stop",{offset:".5",stopColor:"#ff543e"}),br("stop",{offset:"1",stopColor:"#c837ab"})]}),br("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"}),br("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"})]}),br("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)"}),br("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)"}),br("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 Bs}from"react/jsx-runtime";function Hs({style:e,...t}){return Bs("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:Bs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Bs("g",{transform:"scale(5.12,5.12)",children:Bs("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 Mm,jsxs as g3}from"react/jsx-runtime";function Vs(e){return g3("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Mm("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"}),Mm("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 md,jsxs as v3}from"react/jsx-runtime";function Gs(e){return v3("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:[md("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"}),md("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"}),md("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 Im}from"react/jsx-runtime";var qs=({style:e,...t})=>Im("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:Im("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 Wm={google:{name:"Google",component:Ds},discord:{name:"Discord",component:Ls},github:{name:"Github",component:Os},linkedin:{name:"LinkedIn",component:Hs},twitter:{name:"Twitter",component:qs},spotify:{name:"Spotify",component:Vs},instagram:{name:"Instagram",component:Fs},tiktok:{name:"Tiktok",component:Gs},apple:{name:"Apple",component:Ws}},la=e=>e in Wm?Wm[e]:{name:"Unknown",component:Rm};function Lm(e,t){let r={detail:"",retryable:!1},o=ud(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=la(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=la(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 ca(){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:Is(),popupFlow:window.opener!==null&&n}}function vn(){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(mn),window.history.replaceState({},"",e)}var Cn=class{constructor(t){this.initAuthenticateOnce=new Oe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Oe(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(Gu,{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"):le(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(Vu,{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"):le(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Hu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Bu,{})}_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 zs=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",a=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
1
+ var nd=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var gu=(e,t,r)=>(nd(e,t,"read from private field"),r?r.call(e):t.get(e)),fs=(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)},id=(e,t,r,o)=>(nd(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var vu=(e,t,r)=>(nd(e,t,"access private method"),r);import{getAddress as Oo}from"@ethersproject/address";import{Web3Provider as lu}from"@ethersproject/providers";import{createStore as o_}from"mipd";import{useEffect as Yr,useMemo as n_,useRef as Xi,useState as st}from"react";import{isAndroid as i_}from"react-device-detect";import{ProviderErrors as a_,calculateTotalGasEstimate as s_,populateTransactionRequest as l_}from"@privy-io/js-sdk-core";import{FetchError as kC}from"ofetch";var Xe=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}]`:""}`}},Mt=class extends Xe{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},w=class extends Xe{constructor(r,o,n){super(r,o,n);this.type="client_error"}},hs=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ce=class extends Xe{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof Xe)return e;if(!(e instanceof kC))return et(e);if(!e.response)return new Mt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Mt(t||"ApiError",e.response.status,r||o,e,n)},et=e=>e instanceof Xe?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var bo=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Wt=class extends w{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ys=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var br=class extends w{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 gs="/api/v1/sessions",vs="/api/v1/sessions/logout",Cu="/api/v1/sessions/fork",Cs="/api/v1/sessions/fork/recover",wu="/api/v1/siwe/init",bu="/api/v1/siwe/authenticate",Eu="/api/v1/siwe/link",Tu="/api/v1/siwe/unlink",Su="/api/v1/farcaster/init",_u="/api/v1/farcaster/authenticate",Pu="/api/v1/farcaster/link",Au="/api/v1/farcaster/status",xu="/api/v1/farcaster/unlink",ku="/api/v1/passwordless/init",Ru="/api/v1/passwordless/authenticate",Iu="/api/v1/passwordless/link",Mu="/api/v1/passwordless/unlink",Wu="/api/v1/passwordless/update",Ou="/api/v1/passwordless_sms/init",Lu="/api/v1/passwordless_sms/link",Nu="/api/v1/passwordless_sms/unlink",Du="/api/v1/passwordless_sms/authenticate",ws="/api/v1/oauth/init",Uu="/api/v1/oauth/authenticate",bs="/api/v1/oauth/link",Fu="/api/v1/oauth/unlink",Bu="/api/v1/recovery/oauth/init",Hu="/api/v1/recovery/oauth/init_icloud",Gu="/api/v1/recovery/oauth/authenticate",Vu="/api/v1/passkeys/link/init",qu="/api/v1/passkeys/authenticate/init",zu="/api/v1/passkeys/link",$u="/api/v1/passkeys/authenticate",Ku="/api/v1/passkeys/unlink",ju="/api/v1/telegram/authenticate",Yu="/api/v1/telegram/link",Zu="/api/v1/telegram/unlink";var Qu="/api/v1/mfa/passwordless_sms/init",Ju="/api/v1/mfa/passkeys/init",Xu="/api/v1/users/me/accept_terms",Es="/api/v1/analytics_events",em="/api/v1/custom_jwt_account/authenticate",tm="/api/v1/plugins/moonpay_on_ramp/sign",rm="/api/v1/funding/coinbase_on_ramp/init",om="/api/v1/funding/coinbase_on_ramp/status";var ei=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(em,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){throw new Error("Unimplemented")}};var Lo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Ru,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Iu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(t)}}async sendCodeEmail(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{return await this.api.post(ku,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},Ts=class extends Lo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new w("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Wu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as IC,isIOS as MC}from"react-device-detect";var ad=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 sd(){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 RC(){return typeof window<"u"&&window.localStorage?new Ss:new ad}var Q=RC();import{StaticJsonRpcProvider as ta}from"@ethersproject/providers";function nm(){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 _s=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 ld=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||_s(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!ld(r))return!1}return!0},No=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Ps=()=>{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 im=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},As=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,}))$/),am=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},ct=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},cd=e=>new Promise(t=>setTimeout(t,e));function sm(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var ra=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(s=>{a=!0,n(s)},(...s)=>{a=!0,i(...s)}),l+=1,await cd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},xs=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,l]of Object.entries(r))l!==void 0&&n.searchParams.set(a,l);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[l,s]of i)a.append(l,s);n.hash=a.toString()}return n.href};var lm=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),hn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function cm(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let m of s)t.includes("coinbase_wallet")&&m.info.rdns==="com.coinbase.wallet"||c.push({type:m.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:m});for(let m of nm()){let f=_s(m);if(!s.some(u=>u.info.name===f)){if(ld(m,!0)&&!c.find(u=>u.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:m});continue}if(f==="Phantom"&&!c.find(u=>u.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:m});continue}if(f==="Coinbase Wallet"&&!c.find(u=>u.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:m});continue}c.find(u=>u.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:m})}}a(c)}})}function ti(e){return`eip155:${String(Number(e))}`}var dm=(e,t,r,o)=>{let n=Number(e),i=t.find(a=>a.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);return dd(i,r,o)},dd=(e,t,r)=>{let o=e.id,n=Number(e.id),i;if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[n])i=t.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let a=new URL(e.rpcUrls.privy.http[0]);a.searchParams.append("privyAppId",r),i=a.toString()}else e.rpcUrls.public?.http[0]?i=e.rpcUrls.public.http[0]:i=e.rpcUrls.default?.http[0];if(!i)throw new ce(`No RPC url found for ${o}`);return i},pm=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ce(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Gt=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new ta(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new ta(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new ta({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new ta(i.rpcUrls.public.http[0]):a=new ta(i.rpcUrls.default?.http[0]),!a)throw new ce(`No RPC url found for ${e}`);return a},oa=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 ks=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rs={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 um(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function mm(e,t){let r=um(t);if(r.deepLink)return Cm(r.deepLink,e);if(r.universalLink)return pd(r.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}function fm(e,t){let r=um(t);if(r.universalLink)return pd(r.universalLink,e)}var hm="WALLETCONNECT_DEEPLINK_CHOICE";function ym(){try{localStorage.removeItem(hm)}catch{}}function gm({href:e,name:t}){try{localStorage.setItem(hm,JSON.stringify({href:e,name:t}))}catch{}}function vm(e){return e.startsWith("http://")||e.startsWith("https://")}function Cm(e,t){if(vm(e))return pd(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 pd(e,t){if(!vm(e))return Cm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Is(e,t){window.open(e,t,"noreferrer noopener")}var Le=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 na=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");try{let t=await this.api.post(_u,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new w("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Pu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post(Su,{token:this.captchaToken});IC&&!MC&&t.connect_uri&&Is(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new w("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");let t=await this.api.get(Au,{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 wm="1.76.0";var bm="34357d3c125c2bcf2ce2bc3309d98715",Ms="https://auth.privy.io",Em=2e4,Ne=1400,Ws=2500,ud=wm;var yn="privy:token",md="privy-token",Os="privy:refresh_token",Tm="privy-refresh-token",fd="privy:id_token",hd="privy-id-token",Ls="privy-session",ia="privy:session_transfer_token",OC="privy:wallet",aa="privy:caid",sa=e=>`privy:cross-app:${e}`,gn="privy:state_code",vn="privy:code_verifier",Cn="privy:headless_oauth",Ns=e=>`${OC}:${e}`,yd="privy:connectors",gd="privy:connections";var wn=12e4,Eo=1,vd="0x1",ri=3e4,Sm="https://api.moonpay.com/v1",_m="https://api.moonpay.com/v1",Pm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Am="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var xm="deprecated";import{base64url as Im}from"jose";async function km(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Rm(e){return crypto.getRandomValues(new Uint8Array(e))}var LC="S256",NC="S256";function bn(){return Im.encode(Rm(36))}function oi(){return bn()}async function ni(e,t=LC){if(t==NC){let r=await km(e);return Im.encode(r)}else return e}function Mm(){let e=Q.get(vn);if(!e)throw new w("Authentication error.");return e}function Ds(){return!!Q.get(Cn)}var Jr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Ds();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 w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Mm();try{let r=await this.api.post(Uu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(vn),this.meta.headless&&Q.del(Cn),{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=le(r);throw o.privyErrorCode?new w(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Q.get(vn);if(!t)throw new w("Authentication error.");try{let r=await this.api.post(bs,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(vn),r}catch(r){throw le(r)}}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initializing OAuth authentication.");let t=bn();Q.put(vn,t);let r=oi();Q.put(gn,r);let o=await ni(t);this.meta.headless&&Q.put(Cn,!0);try{return await this.api.post(ws,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function Cd(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Wm,jsxs as DC}from"react/jsx-runtime";var Us=({style:e,...t})=>DC("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:[Wm("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"}),Wm("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 la,jsxs as UC}from"react/jsx-runtime";var Fs=({style:e,...t})=>UC("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:[la("g",{clipPath:"url(#clip0)",children:la("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"})}),la("defs",{children:la("clipPath",{id:"clip0",children:la("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Om}from"react/jsx-runtime";var Bs=({style:e,...t})=>Om("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:Om("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 FC}from"@heroicons/react/24/outline";import{jsx as BC}from"react/jsx-runtime";var Lm=({style:e})=>BC(FC,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Hs,jsxs as HC}from"react/jsx-runtime";var Gs=({style:e,...t})=>HC("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:[Hs("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"}),Hs("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"}),Hs("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"}),Hs("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 Er,jsxs as Vs}from"react/jsx-runtime";function qs(e){return Vs("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:[Vs("defs",{children:[Vs("linearGradient",{id:"b",children:[Er("stop",{offset:"0",stopColor:"#3771c8"}),Er("stop",{stopColor:"#3771c8",offset:".128"}),Er("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Vs("linearGradient",{id:"a",children:[Er("stop",{offset:"0",stopColor:"#fd5"}),Er("stop",{offset:".1",stopColor:"#fd5"}),Er("stop",{offset:".5",stopColor:"#ff543e"}),Er("stop",{offset:"1",stopColor:"#c837ab"})]}),Er("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"}),Er("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"})]}),Er("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)"}),Er("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)"}),Er("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 zs}from"react/jsx-runtime";function $s({style:e,...t}){return zs("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:zs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:zs("g",{transform:"scale(5.12,5.12)",children:zs("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 Nm,jsxs as GC}from"react/jsx-runtime";function Ks(e){return GC("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Nm("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"}),Nm("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 wd,jsxs as VC}from"react/jsx-runtime";function js(e){return VC("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:[wd("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"}),wd("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"}),wd("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 Dm}from"react/jsx-runtime";var Ys=({style:e,...t})=>Dm("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:Dm("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 Um={google:{name:"Google",component:Gs},discord:{name:"Discord",component:Fs},github:{name:"Github",component:Bs},linkedin:{name:"LinkedIn",component:$s},twitter:{name:"Twitter",component:Ys},spotify:{name:"Spotify",component:Ks},instagram:{name:"Instagram",component:qs},tiktok:{name:"Tiktok",component:js},apple:{name:"Apple",component:Us}},ca=e=>e in Um?Um[e]:{name:"Unknown",component:Lm};function Fm(e,t){let r={detail:"",retryable:!1},o=Cd(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=ca(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=ca(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 da(){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:Ds(),popupFlow:window.opener!==null&&n}}function En(){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(gn),window.history.replaceState({},"",e)}var Tn=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new w("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new w("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 w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("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($u,{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 w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new w("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new w("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(zu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new w("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async _initAuthenticateOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(qu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new w("Auth flow has no API instance");return await this.api.post(Vu,{})}_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 Zs=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",a=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
2
2
  ${e}
3
3
 
4
4
  ${i}
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${r}
10
10
  Issued At: ${a}
11
11
  Resources:
12
- - https://privy.io`};var bo=class{constructor(t,r,o){this.getNonceOnce=new Oe(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 le(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 le(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=zs({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var wn=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(Lu,{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 le(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(Iu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(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(Mu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}};var oi=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(zu,{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 le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post($u,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw le(t)}}};function fd(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 Nm(){let e;if(e=C3(),e)return Om(),{...e,flowType:"login-url"};if(e=w3(),e)return Om(),{...e,flowType:"web-app"}}function C3(){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"),i=e.get("last_name")||void 0,a=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:l,auth_date:o,hash:r}}function w3(){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")||""),i=t.get("hash");if(!(!r||!o||!n||!i))return{query_id:r,user:o,auth_date:n,hash:i}}function Om(){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 yC}from"uuid";function X(e){return e?new Date(e*1e3):null}function b3(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(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 i={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let m={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(m);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(u);break;case"github_oauth":let g={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let P={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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(P);break;case"passkey":let A={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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(A);break;case"telegram":let T={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:X(r.first_verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(T);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Vt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var he=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,bn=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,$s=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,E3=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Gt=(e,t)=>he(e)||bn(e)?!1:t==="all-users"||t==="users-without-wallets"&&!E3(e)?.length;function qt(e){if(!e)return null;let t=b3(e.linked_accounts),r=Vt(t,"wallet"),o=Vt(t,"email"),n=Vt(t,"phone"),i=Vt(t,"google_oauth"),a=Vt(t,"twitter_oauth"),l=Vt(t,"discord_oauth"),s=Vt(t,"github_oauth"),c=Vt(t,"spotify_oauth"),m=Vt(t,"instagram_oauth"),f=Vt(t,"tiktok_oauth"),u=Vt(t,"linkedin_oauth"),g=Vt(t,"apple_oauth"),w=Vt(t,"farcaster"),y=Vt(t,"telegram"),b=e.mfa_methods.map(({type:A,verified_at:T})=>({type:A,verifiedAt:X(T)}));return{id:e.id,createdAt:X(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:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email,vanityName:u.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:b.map(A=>A.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Uf}from"@ethersproject/address";import{isHexString as dC}from"@ethersproject/bytes";import pC from"eventemitter3";import R3 from"@coinbase/wallet-sdk";import{jsx as Dm,jsxs as T3}from"react/jsx-runtime";var En=({style:e,...t})=>T3("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:[Dm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Dm("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 Jr}from"@ethersproject/address";import{Web3Provider as Gm}from"@ethersproject/providers";import{default as A3}from"eventemitter3";import x3 from"eventemitter3";var S3=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Um=e=>S3.includes(e);import{ErrorCode as _3}from"@ethersproject/logger";import{ProviderErrors as Tn}from"@privy-io/js-sdk-core";var ni=class extends ce{constructor(){super("Wallet timeout");this.type="wallet_error"}},ii=class extends ce{constructor(){super("User rejected connection");this.type="wallet_error"}},Ir=e=>{if(e instanceof ce)return e;if(e?.code&&e?.reason){let t=new Ct(e);return e.code===_3.ACTION_REJECTED&&(t.details=Tn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ct(e):new ce("Unknown connector error",e)},Er=class extends et{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ct=class extends Er{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Tn).find(i=>i.eipCode===o.code);this.details=n||Tn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Tn.E32002_CONNECTION_ALREADY_PENDING:this.details=Tn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Tn.E32002_WALLET_LOCKED))}},P3={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}},Eo={...P3,...Tn};var $e=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 ni,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||yn,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 ce(`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 Ir(r)})}},Oo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},da=class extends x3{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=rr(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=ai(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Oo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new Oo("Disconnected",4900);return(await Hm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Oo(`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 Oo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=rr(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 Fm(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 Bm(ra(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:pn(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(i){throw console.warn(`Gas estimation failed with error: ${i} 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 pn(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(Um(r.method)){let o=await we();if(await Vm(),!o||!this.address)throw new Oo("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 Oo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();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}}},Qr=class extends $e{constructor(r){super(r,r.rpcTimeoutDuration)}},No=class extends $e{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 k3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},zt=class extends A3{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Xn(r),this.walletClientType==="privy"&&J.put(Ms(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=i,this.rpcTimeoutDuration=ai(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>Jr(l.address)===Jr(r));return{address:Jr(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new ce("Wallet is not currently connected.");let s=this.wallets.find(g=>Jr(g.address)===Jr(r))?.chainId;if(!s)throw new ce("Unable to determine current chainId.");let c,m;if(typeof l=="number"?(c=`0x${l.toString(16)}`,m=l):(c=l,m=Number(l)),s===Xn(c))return;let f=this.chains.find(g=>g.id===m);if(!f)throw new ce(`Unsupported chainId: ${l}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await u()}catch(g){if(k3(g,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??""]}]}),u();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new ce(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Gm(new Qr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new No(this.proxyProvider)},sign:async l=>{if(!await a())throw new ce("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await ta(()=>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],i=Jr(n),a=[],l;if(this.walletClientType==="privy"){let c=J.get(Ms(i));this.chains.find(m=>m.id===Number(c))||(J.del(Ms(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await ta(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`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 ${pd}`,c),l=pd}let s=Xn(l);if(!a.find(c=>Jr(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(Jr(n),s,c,this.connectorType==="embedded_imported"))}Ks(a,this.wallets)||(this.wallets=a,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=>Jr(n)===Jr(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 Gm(new Qr(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 M3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],I3=(e,t)=>e.makeWeb3Provider({options:t}),hd,js=class extends zt{constructor(r,o,n,i,a,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"all",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!hd){let s=[o.id].concat(r.map(m=>m.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(m=>!M3.includes(m)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),hd=new R3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(I3(hd,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:En,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 ce("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}};import{jsx as qm}from"react/jsx-runtime";var Do=({...e})=>qm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:qm("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 pa=class extends zt{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(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:[pn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Do,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as zm}from"react/jsx-runtime";var si=({style:e,...t})=>zm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:zm("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 or,jsxs as W3}from"react/jsx-runtime";var li=({style:e,...t})=>W3("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:[or("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),or("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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 $m,jsxs as L3}from"react/jsx-runtime";var Xr=({style:e,...t})=>L3("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:[$m("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),$m("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 di=class extends zt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}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 ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}},ci,pi=class extends zt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";cs(this,ci,void 0);this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?ed(this,ci,{name:"MetaMask",icon:li,id:"io.metamask"}):a==="phantom"&&ed(this,ci,{name:"Phantom",icon:Xr,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 fu(this,ci)??{name:"Browser Extension",icon:si,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 ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}};ci=new WeakMap;import{getAddress as eA}from"@ethersproject/address";import{Web3Provider as rA}from"@ethersproject/providers";import{isMobile as O3}from"react-device-detect";var Ys=class extends di{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{O3||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 ce("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Ir(t)}}};var Zs=class extends zt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new $e(void 0,yn);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 Qs=class extends Zs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Xr,id:"phantom"}}};import{EthereumProvider as aC,OPTIONAL_EVENTS as sC,OPTIONAL_METHODS as lC}from"@walletconnect/ethereum-provider";import{isMobile as cC}from"react-device-detect";import{createContext as J3,useContext as X3,useEffect as Cd,useRef as eC,useState as tC}from"react";import{jsx as N3}from"react/jsx-runtime";function Km({src:e,...t}){return N3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Wf,useEffect as If,useMemo as j3,useState as Y3}from"react";import{createContext as Z3}from"react";var It={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ym,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var jm=({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 D3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),Ym=e=>D3.has(e),Zm=(e,t,r)=>r.indexOf(e)===t,Qm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ym).filter(Zm):e?e.filter(Ym).filter(Zm):It.appearance.walletList;var Jm={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 Xm={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 ef={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 tf={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 rf={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 of={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 nf={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 af={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 sf={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 lf={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 cf={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 df={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 pf={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 uf={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 mf={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 ff={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 hf={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 yf={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 Js={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 gf={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 vf={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 Cf={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 wf={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 bf={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 Ef={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 Tf={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 Sf={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 _f={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 Pf={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 xf={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 ua=[Jm,Xm,ef,mf,Sf,Js,gf,vf,Cf,wf,bf,lf,cf,df,pf,of,nf,af,sf,hf,yf,tf,rf,_f,xf,Pf,ff,Ef,uf,Tf],Ak=new Set(ua.map(e=>e.id));import Sn from"tinycolor2";var Af="#FFFFFF",U3="#040217",F3=Af,B3="#1E1E1D";function H3(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 Wr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Sn({...e.toHsl(),l:r})}var V3="#51BA81",G3="#FFB74D",q3="#EC6351",z3=Af,$3=U3;function kf({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=F3;break;case"dark":r=B3;break;default:r=e;break}let o=Sn(r),n=Sn(t),i=Sn(V3),a=Sn(G3),l=Sn(q3),s=H3(o.getLuminance()),c=Wr(o,s==="light"?-.04:.11),m=Wr(o,s==="light"?-.88:.87),f=Wr(o,s==="light"?-.7:.75),u=Wr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),g=Wr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),w=Wr(n,.15),y=Wr(n,-.06),b=Wr(l,.3),P=Wr(a,.3),A=Sn(n.getLuminance()>.5?$3:z3),T=Wr(i,-.16),x=Wr(i,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:u.toHslString(),foreground4:g.toHslString(),accent:n.toHslString(),accentLight:w.toHslString(),accentDark:y.toHslString(),foregroundAccent:A.toHslString(),success:i.toHslString(),successDark:T.toHslString(),successLight:x.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:a.toHslString(),warnLight:P.toHslString()}}function yd(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,m,f,u,g,w,y,b,P,A;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),m=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),w=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),P=t.loginMethods.includes("farcaster"),A=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,y=e.githubOAuth,u=e.spotifyOAuth,g=e.instagramOAuth,f=e.tiktokOAuth,w=e.linkedinOAuth,b=e.appleOAuth,P=e.farcasterAuth,A=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let T=[n,i].filter(Boolean),x=[s,c,m,y,u,g,f,w,b,P,A].filter(Boolean),R=[l].filter(Boolean);if(T.length+x.length+R.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&&R.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&x.length+T.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 D=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let B=Qm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=jm({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:L,defaultChain:N}=K3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain,ve=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Me,Y=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ve?Me=t?.embeddedWallets?.noPromptOnSignature??!0:Me=t?.embeddedWallets?.noPromptOnSignature??Y:Me=Y,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Me!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:te,...ee}=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??It.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:kf({backgroundTheme:t?.appearance?.theme??It.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??It.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:m,github:y,spotify:u,instagram:g,tiktok:f,linkedin:w,apple:b,farcaster:P,telegram:A},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??It.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??It.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??It.rpcConfig.rpcTimeouts},chains:L,defaultChain:N,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??It.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??It.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:D}},embeddedWallets:{...e.embeddedWalletConfig,...typeof te=="boolean"?{requireUserOwnedRecoveryOnCreate:te}:{},...ve?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ee,noPromptOnSignature:Me},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ve?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??It._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??It.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??It.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??It.fundingMethodConfig.moonpay.useSandbox}}}}function Rf(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function K3({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(s=>s.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(s=>s.rpcUrls.privyWalletOverride?s:ua.find(m=>m.id===s.id)??s)}else n=ua.concat(e??[]);let i=t?n[0]:Js,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Mf=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,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 Q3}from"react/jsx-runtime";var Lf={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:""},gd=yd(Lf,void 0,!1),vd=Z3({appConfig:gd,isServerConfigLoaded:!1}),Of=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=Y3(null),a=j3(()=>yd(n??Lf,o,!!n),[n,o]);return If(()=>{if(!n)return;let l=Rf(o,t),s=Mf(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),If(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Q3(vd.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ge=()=>{let{appConfig:e}=Wf(vd);return e},Xs=()=>{let{isServerConfigLoaded:e}=Wf(vd);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as oC,jsxs as nC}from"react/jsx-runtime";var Nf=J3({ready:!1,app:gd,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),rC=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Df=e=>{let t=Ge(),r=e.authenticated,[o,n]=tC(e.initialScreen);Cd(()=>{!r&&!rC.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=eC(null);Cd(()=>{e.open||(i.current=null)},[e.open]),Cd(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return nC(Nf.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&oC(Km,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},S=()=>X3(Nf);import{jsx as ui,jsxs as iC}from"react/jsx-runtime";var ma=({style:e,...t})=>{let{app:r}=S();return iC("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:[ui("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),ui("g",{clipPath:"url(#clip0_1765_9946)",children:ui("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"})}),ui("defs",{children:ui("clipPath",{id:"clip0_1765_9946",children:ui("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Lr=class extends zt{constructor(r,o,n,i,a,l,s,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=_s[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=Ss(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:li,id:"io.metamask"}:{name:om(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ma,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=_s[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,pm(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new ii)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ce("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ss(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=ai(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Ir(a));return}o(new ce("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 a of this.chains){let l=im(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await aC.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:sC,optionalMethods:lC,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),cC&&this.walletEntry){let{redirect:l,href:s}=lm(a,this.walletEntry);um({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=cm(a,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Ps(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Ss(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var bd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>dC(o)).map(o=>Uf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},ai=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yn:yn,fa=class extends pC{constructor(r,o,n,i,a,l,s,c,m,f,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new $e:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=m,this.privyAppName=f,this.privyAppLogo=u,this.storedConnections=wd()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.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(cd)&&(J.getKeys().forEach(o=>{o.startsWith("walletconnect")&&J.del(o)}),J.del(cd));let r=nm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Lo()&&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(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.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,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new da(r,o,this.rpcConfig,this.chains,i,n.id),s=new pa(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new da(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new pa(l,this.chains,n,this.rpcConfig,s);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=wd(),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=wd(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Lr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ys(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new di(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new js(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new Qs(this.defaultChain):new Lr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||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(dd,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=Uf(r),this.emit("walletsUpdated")}};function Ks(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 uC=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",wd=()=>{let e=J.get(dd);return e&&Array.isArray(e)&&e.map(o=>uC(o)).every(Boolean)?e:[]};import{ofetch as mC}from"ofetch";var fC=[us,fs,ms,gs],el=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=sd,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=mC.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:i,options:a})=>{let l=new Headers(a.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=fC.includes(i.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}a.headers=l,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new ds}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};var Ff=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 mi from"js-cookie";function Bf(e){return e instanceof Wo?"email":e instanceof wn?"sms":e instanceof bo?"siwe":e instanceof Jn?"custom_auth":e instanceof Zr?e.meta.provider:null}import*as Hf from"jose";var Or=class{static parse(t){try{return new Or(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Hf.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 hC=30,tl=class{constructor(){this.authenticateOnce=new Oe(async t=>this._authenticate(t)),this.linkOnce=new Oe(async t=>this._link(t)),this.refreshOnce=new Oe(this._refresh.bind(this)),this.destroyOnce=new Oe(this._destroy.bind(this)),this.forkSessionOnce=new Oe(this._forkSession.bind(this))}get token(){try{let t=J.get(un);return typeof t=="string"?new Or(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=J.get(ks);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=J.get(na);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=J.get(aa(t));if(typeof r=="string"){let o=new Or(r);return o.isExpired()?(J.del(aa(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=mi.get(Rs);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!==Tm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Or.parse(this.token);return t!==null&&!t.isExpired(hC)}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(aa(t),r):J.del(aa(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:i}=r;this.handleTokenResponse(r);let a=i,l=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0,s=Bf(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:qt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),lt(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:qt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),lt(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 i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(us,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(fs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),qt(n.user)}catch(n){if(n instanceof Rt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw lt(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(ms,{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(yu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw lt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=J.get(un);if(J.put(un,t),!this.client?.useServerCookies){let o=Or.parse(t)?.expiration;mi.set(ld,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else J.del(un),mi.remove(ld),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(J.put(ks,t),this.client?.useServerCookies||mi.set(Rs,"t",{sameSite:"Strict",secure:!0,expires:30})):(J.del(ks),mi.remove(vm),mi.remove(Rs))}clearForkedToken(){J.del(na)}};var Ed,rl,Vf,ha=class{constructor(t){cs(this,rl);this.apiUrl=t.apiUrl||xs,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||gm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=hu(this,rl,Vf).call(this),Ed||(Ed=new tl),this.session=Ed,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new fa(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new el({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(ju,{action:"verify"})}catch(t){throw le(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Yu,{});return Ff(t.options)}catch(t){throw le(t)}}async unlinkEmail(t){try{let r=await this.api.post(ku,{address:t});return qt(r)}catch(r){throw lt(r)}}async acceptTerms(){try{let t=await this.api.post(Zu,{});return qt(t)}catch(t){throw lt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Wu,{phoneNumber:t});return qt(r)}catch(r){throw lt(r)}}async unlinkWallet(t){try{let r=await this.api.post(wu,{address:t});return qt(r)}catch(r){throw lt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Nu,{provider:t,subject:r});return qt(o)}catch(o){throw lt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(_u,{fid:t});return qt(r)}catch(r){throw lt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Ku,{telegram_user_id:t});return qt(r)}catch(r){throw lt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(qu,{credential_id:t});return qt(r)}catch(r){throw lt(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(gs,{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(Qu,t)}catch(r){throw lt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Or.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,i=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}: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,fundingConfig:i}}catch(t){throw lt(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(gu,{address:t,token:r})).nonce}catch(o){throw lt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(vu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Cu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i});return qt(a)}catch(a){throw lt(a)}}};rl=new WeakSet,Vf=function(){if(typeof window>"u")return null;try{let r=J.get(ia);if(typeof r=="string"&&r.length>0)return r}catch{}let t=yC();try{return J.put(ia,t),t}catch{return t}};import{Turnstile as EC}from"@marsidev/react-turnstile";import{useEffect as TC,useMemo as SC}from"react";import{useMemo as gC,useRef as vC,useContext as CC,useState as Td,createContext as wC}from"react";import{jsx as bC}from"react/jsx-runtime";var Gf=wC({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}),nr=class extends et{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},qf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=vC(null),[i,a]=Td(),[l,s]=Td(),[c,m]=Td(!1),f=gC(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return bC(Gf.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:m,remove(){o&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){o&&(m(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await rm(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new nr("Captcha failed",null,"captcha_timeout")}}},children:e})},be=()=>CC(Gf);import{jsx as zf}from"react/jsx-runtime";var Sd=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=be(),[,s]=SC(()=>r?.split("t:")||[],[r]);if(TC(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return zf("div",{className:"hidden h-0 w-0",children:zf(EC,{...e,ref:l,siteKey:s,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"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as H9,useEffect as wv,useRef as V9,useState as G9}from"react";import Tv from"styled-components";import{createContext as _C,useContext as PC}from"react";var _d=_C({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,getMoonpaySignedUrl:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E}),I=()=>PC(_d);import{createContext as xC,useContext as AC}from"react";var Se=xC({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:[]}),q=()=>AC(Se);import{useEffect as kC,useState as RC}from"react";var $f=e=>{let[t,r]=RC("auto");return kC(()=>{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 MC,useContext as IC,useEffect as WC}from"react";var Kf={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:[]}},Pd=MC(void 0),jf=()=>IC(Pd);function ke(e,t){if(!t)return;let o=jf().current[e];return WC(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function fi(){let e=jf();return(t,r,...o)=>U(e,t,r,...o)}function xd(e){ke("configureMfa",e)}import{QuestionMarkCircleIcon as t0}from"@heroicons/react/24/outline";import th from"styled-components";import _n,{css as Yf}from"styled-components";import kd from"styled-components";import{Fragment as OC,jsx as Ad,jsxs as NC}from"react/jsx-runtime";var ot=({success:e,fail:t})=>NC(OC,{children:[Ad(mt,{className:e?"success":t?"fail":""}),Ad(Rd,{className:e?"success":t?"fail":""})]}),mt=kd.span`
12
+ - https://privy.io`};var To=class{constructor(t,r,o){this.getNonceOnce=new Le(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 w("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,identity_token:o.identity_token,is_new_user:o.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.client)throw new w("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 le(t)}}async sign(){if(!this.client)throw new w("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("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 w("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new w("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=Zs({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Sn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Du,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Lu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(t)}}async sendSmsCode(t,r){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Ou,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}};var ii=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=await this.api.post(ju,{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,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Yu,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw le(t)}}};function bd(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 Hm(){let e;if(e=qC(),e)return Bm(),{...e,flowType:"login-url"};if(e=zC(),e)return Bm(),{...e,flowType:"web-app"}}function qC(){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"),i=e.get("last_name")||void 0,a=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:l,auth_date:o,hash:r}}function zC(){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")||""),i=t.get("hash");if(!(!r||!o||!n||!i))return{query_id:r,user:o,auth_date:n,hash:i}}function Bm(){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 H3}from"uuid";function ee(e){return e?new Date(e*1e3):null}function $C(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:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(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 i={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(a);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let m={subject:r.subject,username:r.username,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(m);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(u);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(v);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)});break;case"farcaster":let T={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:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(T);break;case"passkey":let k={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:ee(r.verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(k);break;case"telegram":let E={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:ee(r.first_verified_at),firstVerifiedAt:ee(r.first_verified_at),latestVerifiedAt:ee(r.latest_verified_at)};t.push(E);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Vt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var he=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,_n=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,Qs=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,KC=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),qt=(e,t)=>he(e)||_n(e)?!1:t==="all-users"||t==="users-without-wallets"&&!KC(e)?.length;function zt(e){if(!e)return null;let t=$C(e.linked_accounts),r=Vt(t,"wallet"),o=Vt(t,"email"),n=Vt(t,"phone"),i=Vt(t,"google_oauth"),a=Vt(t,"twitter_oauth"),l=Vt(t,"discord_oauth"),s=Vt(t,"github_oauth"),c=Vt(t,"spotify_oauth"),m=Vt(t,"instagram_oauth"),f=Vt(t,"tiktok_oauth"),u=Vt(t,"linkedin_oauth"),v=Vt(t,"apple_oauth"),g=Vt(t,"farcaster"),y=Vt(t,"telegram"),b=e.mfa_methods.map(({type:k,verified_at:E})=>({type:k,verifiedAt:ee(E)}));return{id:e.id,createdAt:ee(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:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email,vanityName:u.vanityName},apple:v&&{subject:v.subject,email:v.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:b.map(k=>k.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Vf}from"@ethersproject/address";import{isHexString as L3}from"@ethersproject/bytes";import N3 from"eventemitter3";import t3 from"@coinbase/wallet-sdk";import{jsx as Gm,jsxs as jC}from"react/jsx-runtime";var So=({style:e,...t})=>jC("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:[Gm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Gm("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 eo}from"@ethersproject/address";import{Web3Provider as jm}from"@ethersproject/providers";import{default as XC}from"eventemitter3";import JC from"eventemitter3";var YC=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Vm=e=>YC.includes(e);import{ErrorCode as ZC}from"@ethersproject/logger";import{ProviderErrors as Pn}from"@privy-io/js-sdk-core";var ai=class extends ce{constructor(){super("Wallet timeout");this.type="wallet_error"}},si=class extends ce{constructor(){super("User rejected connection");this.type="wallet_error"}},Lr=e=>{if(e instanceof ce)return e;if(e?.code&&e?.reason){let t=new Ct(e);return e.code===ZC.ACTION_REJECTED&&(t.details=Pn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ct(e):new ce("Unknown connector error",e)},Tr=class extends Xe{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ct=class extends Tr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Pn).find(i=>i.eipCode===o.code);this.details=n||Pn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Pn.E32002_CONNECTION_ALREADY_PENDING:this.details=Pn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Pn.E32002_WALLET_LOCKED))}},QC={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}},_o={...QC,...Pn};var je=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 ai,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||wn,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 ce(`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 Lr(r)})}},Do=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},pa=class extends JC{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Gt(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=li(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Do(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new Do("Disconnected",4900);return(await $m(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Do(`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 Do(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Gt(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 qm(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 zm(oa(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:hn(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(i){throw console.warn(`Gas estimation failed with error: ${i} 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 hn(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(Vm(r.method)){let o=await we();if(await Km(),!o||!this.address)throw new Do("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 Do("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();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}}},Xr=class extends je{constructor(r){super(r,r.rpcTimeoutDuration)}},Uo=class extends je{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 e3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},$t=class extends XC{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=ti(r),this.walletClientType==="privy"&&Q.put(Ns(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=i,this.rpcTimeoutDuration=li(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>eo(l.address)===eo(r));return{address:eo(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new ce("Wallet is not currently connected.");let s=this.wallets.find(v=>eo(v.address)===eo(r))?.chainId;if(!s)throw new ce("Unable to determine current chainId.");let c,m;if(typeof l=="number"?(c=`0x${l.toString(16)}`,m=l):(c=l,m=Number(l)),s===ti(c))return;let f=this.chains.find(v=>v.id===m);if(!f)throw new ce(`Unsupported chainId: ${l}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await u()}catch(v){if(e3(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??""]}]}),u();throw this.walletClientType==="rainbow"&&v.message?.includes("wallet_switchEthereumChain")?new ce(`Rainbow does not support the chainId ${o}`):v}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new jm(new Xr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Uo(this.proxyProvider)},sign:async l=>{if(!await a())throw new ce("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await ra(()=>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],i=eo(n),a=[],l;if(this.walletClientType==="privy"){let c=Q.get(Ns(i));this.chains.find(m=>m.id===Number(c))||(Q.del(Ns(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await ra(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`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 ${vd}`,c),l=vd}let s=ti(l);if(!a.find(c=>eo(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(eo(n),s,c,this.connectorType==="embedded_imported"))}Js(a,this.wallets)||(this.wallets=a,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=>eo(n)===eo(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 jm(new Xr(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 r3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],o3=(e,t)=>e.makeWeb3Provider({options:t}),Ed,Xs=class extends $t{constructor(r,o,n,i,a,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"all",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Ed){let s=[o.id].concat(r.map(m=>m.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(m=>!r3.includes(m)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Ed=new t3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(o3(Ed,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:So,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 ce("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};import{jsx as Ym}from"react/jsx-runtime";var Fo=({...e})=>Ym("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ym("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 ua=class extends $t{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(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:[hn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Fo,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Zm}from"react/jsx-runtime";var ci=({style:e,...t})=>Zm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Zm("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 or,jsxs as n3}from"react/jsx-runtime";var di=({style:e,...t})=>n3("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:[or("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),or("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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"}),or("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 Qm,jsxs as i3}from"react/jsx-runtime";var to=({style:e,...t})=>i3("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:[Qm("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Qm("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 ui=class extends $t{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}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 ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}},pi,mi=class extends $t{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";fs(this,pi,void 0);this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?id(this,pi,{name:"MetaMask",icon:di,id:"io.metamask"}):a==="phantom"&&id(this,pi,{name:"Phantom",icon:to,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 gu(this,pi)??{name:"Browser Extension",icon:ci,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 ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Lr(r)}}};pi=new WeakMap;import{getAddress as Zx}from"@ethersproject/address";import{Web3Provider as Jx}from"@ethersproject/providers";import{isMobile as a3}from"react-device-detect";var el=class extends ui{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{a3||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 ce("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Lr(t)}}};var tl=class extends $t{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new je(void 0,wn);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 rl=class extends tl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:to,id:"phantom"}}};import{EthereumProvider as I3,OPTIONAL_EVENTS as M3,OPTIONAL_METHODS as W3}from"@walletconnect/ethereum-provider";import{isMobile as O3}from"react-device-detect";import{createContext as T3,useContext as S3,useEffect as Pd,useRef as _3,useState as P3}from"react";import{jsx as s3}from"react/jsx-runtime";function Jm({src:e,...t}){return s3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Uf,useEffect as Df,useMemo as C3,useState as w3}from"react";import{createContext as b3}from"react";var Ot={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:bm,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var Xm=({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 l3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),ef=e=>l3.has(e),tf=(e,t,r)=>r.indexOf(e)===t,rf=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(ef).filter(tf):e?e.filter(ef).filter(tf):Ot.appearance.walletList;var of={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 nf={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 af={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 sf={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 lf={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 cf={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 df={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 pf={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 uf={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 mf={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 ff={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 hf={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 yf={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 gf={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 vf={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 Cf={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 wf={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 bf={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 ol={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 Ef={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 Tf={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 Sf={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 _f={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 Pf={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 Af={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 xf={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 kf={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 Rf={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 If={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 Mf={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 ma=[of,nf,af,vf,kf,ol,Ef,Tf,Sf,_f,Pf,mf,ff,hf,yf,cf,df,pf,uf,wf,bf,sf,lf,Rf,Mf,If,Cf,Af,gf,xf],SR=new Set(ma.map(e=>e.id));import An from"tinycolor2";var Wf="#FFFFFF",c3="#040217",d3=Wf,p3="#1E1E1D";function u3(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 Nr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return An({...e.toHsl(),l:r})}var m3="#51BA81",f3="#FFB74D",h3="#EC6351",y3=Wf,g3=c3;function Of({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=d3;break;case"dark":r=p3;break;default:r=e;break}let o=An(r),n=An(t),i=An(m3),a=An(f3),l=An(h3),s=u3(o.getLuminance()),c=Nr(o,s==="light"?-.04:.11),m=Nr(o,s==="light"?-.88:.87),f=Nr(o,s==="light"?-.7:.75),u=Nr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),v=Nr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),g=Nr(n,.15),y=Nr(n,-.06),b=Nr(l,.3),T=Nr(a,.3),k=An(n.getLuminance()>.5?g3:y3),E=Nr(i,-.16),P=Nr(i,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:u.toHslString(),foreground4:v.toHslString(),accent:n.toHslString(),accentLight:g.toHslString(),accentDark:y.toHslString(),foregroundAccent:k.toHslString(),success:i.toHslString(),successDark:E.toHslString(),successLight:P.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:a.toHslString(),warnLight:T.toHslString()}}function Td(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,m,f,u,v,g,y,b,T,k;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),m=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),v=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),T=t.loginMethods.includes("farcaster"),k=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,y=e.githubOAuth,u=e.spotifyOAuth,v=e.instagramOAuth,f=e.tiktokOAuth,g=e.linkedinOAuth,b=e.appleOAuth,T=e.farcasterAuth,k=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let E=[n,i].filter(Boolean),P=[s,c,m,y,u,v,f,g,b,T,k].filter(Boolean),x=[l].filter(Boolean);if(E.length+P.length+x.length===0)throw new Error("You must enable at least one login method");let I=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;I&&x.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&P.length+E.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let N=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let H=rf({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=Xm({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:D}=v3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain,ve=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ie,Y=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ve?Ie=t?.embeddedWallets?.noPromptOnSignature??!0:Ie=t?.embeddedWallets?.noPromptOnSignature??Y:Ie=Y,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ie!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:X,...te}=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??Ot.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Of({backgroundTheme:t?.appearance?.theme??Ot.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ot.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:H},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:m,github:y,spotify:u,instagram:v,tiktok:f,linkedin:g,apple:b,farcaster:T,telegram:k},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ot.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ot.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ot.rpcConfig.rpcTimeouts},chains:O,defaultChain:D,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??Ot.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Ot.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:N}},embeddedWallets:{...e.embeddedWalletConfig,...typeof X=="boolean"?{requireUserOwnedRecoveryOnCreate:X}:{},...ve?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...te,noPromptOnSignature:Ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ve?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Ot._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Ot.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Ot.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Ot.fundingMethodConfig.moonpay.useSandbox}}}}function Lf(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function v3({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(s=>s.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(s=>s.rpcUrls.privyWalletOverride?s:ma.find(m=>m.id===s.id)??s)}else n=ma.concat(e??[]);let i=t?n[0]:ol,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Nf=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,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 E3}from"react/jsx-runtime";var Ff={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:""},Sd=Td(Ff,void 0,!1),_d=b3({appConfig:Sd,isServerConfigLoaded:!1}),Bf=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=w3(null),a=C3(()=>Td(n??Ff,o,!!n),[n,o]);return Df(()=>{if(!n)return;let l=Lf(o,t),s=Nf(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),Df(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),E3(_d.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ve=()=>{let{appConfig:e}=Uf(_d);return e},nl=()=>{let{isServerConfigLoaded:e}=Uf(_d);return e};var S=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as x3,jsxs as k3}from"react/jsx-runtime";var Hf=T3({ready:!1,app:Sd,currentScreen:null,lastScreen:null,navigate:S,navigateBack:S,resetNavigation:S,setModalData:S,onUserCloseViaDialogOrKeybindRef:void 0}),A3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Gf=e=>{let t=Ve(),r=e.authenticated,[o,n]=P3(e.initialScreen);Pd(()=>{!r&&!A3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=_3(null);Pd(()=>{e.open||(i.current=null)},[e.open]),Pd(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return k3(Hf.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&x3(Jm,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>S3(Hf);import{jsx as fi,jsxs as R3}from"react/jsx-runtime";var fa=({style:e,...t})=>{let{app:r}=_();return R3("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:[fi("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),fi("g",{clipPath:"url(#clip0_1765_9946)",children:fi("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"})}),fi("defs",{children:fi("clipPath",{id:"clip0_1765_9946",children:fi("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Dr=class extends $t{constructor(r,o,n,i,a,l,s,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new je(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=Rs[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=ks(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:di,id:"io.metamask"}:{name:lm(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||fa,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=Rs[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,ym(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new si)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ce("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ks(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=li(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Lr(a));return}o(new ce("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 a of this.chains){let l=dm(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await I3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:M3,optionalMethods:W3,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),O3&&this.walletEntry){let{redirect:l,href:s}=mm(a,this.walletEntry);gm({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=fm(a,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Is(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=ks(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var xd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>L3(o)).map(o=>Vf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},li=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||wn:wn,ha=class extends N3{constructor(r,o,n,i,a,l,s,c,m,f,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new je:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=m,this.privyAppName=f,this.privyAppLogo=u,this.storedConnections=Ad()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.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(yd)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(yd));let r=cm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!No()&&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(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.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,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new pa(r,o,this.rpcConfig,this.chains,i,n.id),s=new ua(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new pa(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new ua(l,this.chains,n,this.rpcConfig,s);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=Ad(),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=Ad(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Dr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new el(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new mi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new ui(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Xs(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new rl(this.defaultChain):new Dr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||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(gd,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=Vf(r),this.emit("walletsUpdated")}};function Js(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 D3=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Ad=()=>{let e=Q.get(gd);return e&&Array.isArray(e)&&e.map(o=>D3(o)).every(Boolean)?e:[]};import{ofetch as U3}from"ofetch";var F3=[gs,Cs,vs,Es],il=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=ud,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=U3.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:i,options:a})=>{let l=new Headers(a.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=F3.includes(i.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}a.headers=l,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new hs}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};var qf=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 Bo from"js-cookie";function zf(e){return e instanceof Lo?"email":e instanceof Sn?"sms":e instanceof To?"siwe":e instanceof ei?"custom_auth":e instanceof Jr?e.meta.provider:null}import*as $f from"jose";var Sr=class{static parse(t){try{return new Sr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=$f.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 B3=30,al=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=Q.get(yn);return typeof t=="string"?new Sr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(Os);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(ia);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Q.get(sa(t));if(typeof r=="string"){let o=new Sr(r);return o.isExpired()?(Q.del(sa(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=Bo.get(Ls);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!==xm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Sr.parse(this.token);return t!==null&&!t.isExpired(B3)}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(sa(t),r):Q.del(sa(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:i}=r;this.handleTokenResponse(r);let a=i,l=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0,s=zf(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:zt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),et(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:zt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),et(r)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("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 i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(gs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Cs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),zt(n.user)}catch(n){if(n instanceof Mt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw et(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&(this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token))}async _destroy(){try{await this.api?.post(vs,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Cu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw et(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Q.get(yn);if(Q.put(yn,t),!this.client?.useServerCookies){let o=Sr.parse(t)?.expiration;Bo.set(md,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Q.del(yn),Bo.remove(md),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Q.put(Os,t),this.client?.useServerCookies||Bo.set(Ls,"t",{sameSite:"Strict",secure:!0,expires:30})):(Q.del(Os),Bo.remove(Tm),Bo.remove(Ls))}storeIdentityToken(t){if(this.client?.useServerCookies)return;Q.put(fd,t);let r=Sr.parse(t)?.expiration;Bo.set(hd,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}clearIdentityToken(){Q.del(fd),Bo.remove(hd)}clearForkedToken(){Q.del(ia)}};var kd,sl,Kf,ya=class{constructor(t){fs(this,sl);this.apiUrl=t.apiUrl||Ms,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||Em,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=vu(this,sl,Kf).call(this),kd||(kd=new al),this.session=kd,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new ha(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new il({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 w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new w("No auth flow in progress.");let{oAuthTokens:t}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:t}}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(Qu,{action:"verify"})}catch(t){throw le(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Ju,{});return qf(t.options)}catch(t){throw le(t)}}async acceptTerms(){try{let t=await this.api.post(Xu,{});return zt(t)}catch(t){throw et(t)}}async unlinkEmail(t){try{let r=await this.api.post(Mu,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(r)}}async unlinkPhone(t){try{let r=await this.api.post(Nu,{phoneNumber:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(r)}}async unlinkWallet(t){try{let r=await this.api.post(Tu,{address:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Fu,{provider:t,subject:r});return await this.getAuthenticatedUser()??zt(o)}catch(o){throw et(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(xu,{fid:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Zu,{telegram_user_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Ku,{credential_id:t});return await this.getAuthenticatedUser()??zt(r)}catch(r){throw et(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(Es,{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(tm,t)}catch(r){throw et(r)}}async initCoinbaseOnRamp(t){try{return this.api.post(rm,t)}catch(r){throw et(r)}}async getCoinbaseOnRampStatus({partnerUserId:t}){try{return this.api.get(`${om}?partnerUserId=${t}`)}catch(r){throw et(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Sr.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,i=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}: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,fundingConfig:i}}catch(t){throw et(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(wu,{address:t,token:r})).nonce}catch(o){throw et(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(bu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Eu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i});return zt(a)}catch(a){throw et(a)}}};sl=new WeakSet,Kf=function(){if(typeof window>"u")return null;try{let r=Q.get(aa);if(typeof r=="string"&&r.length>0)return r}catch{}let t=H3();try{return Q.put(aa,t),t}catch{return t}};import{Turnstile as K3}from"@marsidev/react-turnstile";import{useEffect as j3,useMemo as Y3}from"react";import{useMemo as G3,useRef as V3,useContext as q3,useState as Rd,createContext as z3}from"react";import{jsx as $3}from"react/jsx-runtime";var jf=z3({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:S,setError:S,setExecuting:S,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:S,reset:S,execute:S}),nr=class extends Xe{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Yf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=V3(null),[i,a]=Rd(),[l,s]=Rd(),[c,m]=Rd(!1),f=G3(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return $3(jf.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:m,remove(){o&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){o&&(m(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await sm(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new nr("Captcha failed",null,"captcha_timeout")}}},children:e})},be=()=>q3(jf);import{jsx as Zf}from"react/jsx-runtime";var Id=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=be(),[,s]=Y3(()=>r?.split("t:")||[],[r]);if(j3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Zf("div",{className:"hidden h-0 w-0",children:Zf(K3,{...e,ref:l,siteKey:s,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"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as US,useEffect as Kv,useRef as FS,useState as BS}from"react";import Zv from"styled-components";import{createContext as Z3,useContext as Q3}from"react";var Md=Z3({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:S,initializeWalletProxy:S,getAuthMeta:S,getAuthFlow:S,closePrivyModal:S,openPrivyModal:S,connectWallet:S,initLoginWithWallet:S,loginWithWallet:S,initLoginWithFarcaster:S,loginWithFarcaster:S,loginWithCode:S,initLoginWithEmail:S,initLoginWithSms:S,initUpdateEmail:S,resendEmailCode:S,resendSmsCode:S,initLoginWithHeadlessOAuth:S,loginWithHeadlessOAuth:S,crossAppAuthFlow:S,initLoginWithOAuth:S,recoveryOAuthFlow:S,loginWithOAuth:S,initLoginWithPasskey:S,loginWithPasskey:S,initLinkWithPasskey:S,linkWithPasskey:S,refreshUser:S,walletProxy:null,createAnalyticsEvent:S,acceptTerms:S,getUsdTokenPrice:S,recoverEmbeddedEthereumWallet:S,getMoonpaySignedUrl:S,initCoinbaseOnRamp:S,getCoinbaseOnRampStatus:S,updateWallets:S,fundWallet:S,setReadyToTrue:S,requestFarcasterSignerStatus:S,initLoginWithTelegram:S,loginWithTelegram:S,generateSiweMessage:S,linkWithSiwe:S,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:S,recoverEmbeddedSolanaWallet:S}),M=()=>Q3(Md);import{createContext as J3,useContext as X3}from"react";var Se=J3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:S,login:S,connectOrCreateWallet:S,linkEmail:S,linkPhone:S,linkFarcaster:S,linkWallet:S,linkCrossAppAccount:S,linkGoogle:S,linkTwitter:S,linkDiscord:S,linkGithub:S,linkSpotify:S,linkInstagram:S,linkTelegram:S,linkTiktok:S,linkLinkedIn:S,linkApple:S,linkPasskey:S,updateEmail:S,logout:S,getAccessToken:S,getEthereumProvider:S,getEthersProvider:S,getWeb3jsProvider:S,unlinkEmail:S,unlinkPhone:S,unlinkWallet:S,unlinkGoogle:S,unlinkTwitter:S,unlinkDiscord:S,unlinkGithub:S,unlinkSpotify:S,unlinkInstagram:S,unlinkTiktok:S,unlinkLinkedIn:S,unlinkApple:S,unlinkCrossAppAccount:S,unlinkFarcaster:S,unlinkTelegram:S,unlinkPasskey:S,setActiveWallet:S,forkSession:S,createWallet:S,importWallet:S,signMessage:S,signTypedData:S,enrollInMfa:S,initEnrollmentWithSms:S,initEnrollmentWithTotp:S,initEnrollmentWithPasskey:S,promptMfa:S,init:S,submitEnrollmentWithSms:S,submitEnrollmentWithTotp:S,submitEnrollmentWithPasskey:S,unenroll:S,submit:S,cancel:S,sendTransaction:S,exportWallet:S,setWalletPassword:S,setWalletRecovery:S,requestFarcasterSignerFromWarpcast:S,getFarcasterSignerPublicKey:S,signFarcasterMessage:S,initLoginWithEmail:S,initLoginWithSms:S,otpState:{status:"initial"},loginWithCode:S,fundWallet:S,initLoginWithHeadlessOAuth:S,loginWithHeadlessOAuth:S,generateSiweMessage:S,linkWithSiwe:S,signMessageWithCrossAppWallet:S,signTypedDataWithCrossAppWallet:S,sendTransactionWithCrossAppWallet:S,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),q=()=>X3(Se);import{useEffect as e0,useState as t0}from"react";var Qf=e=>{let[t,r]=t0("auto");return e0(()=>{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 r0,useContext as o0,useEffect as n0}from"react";var Jf={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:[]},fundWallet:{onUserExited:[]}},Wd=r0(void 0),Xf=()=>o0(Wd);function Ae(e,t){if(!t)return;let o=Xf().current[e];return n0(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function F(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function hi(){let e=Xf();return(t,r,...o)=>F(e,t,r,...o)}function Od(e){Ae("configureMfa",e)}import{QuestionMarkCircleIcon as P0}from"@heroicons/react/24/outline";import ah from"styled-components";import xn,{css as eh}from"styled-components";import Nd from"styled-components";import{Fragment as a0,jsx as Ld,jsxs as s0}from"react/jsx-runtime";var ot=({success:e,fail:t})=>s0(a0,{children:[Ld(nt,{className:e?"success":t?"fail":""}),Ld(ga,{className:e?"success":t?"fail":""})]}),nt=Nd.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -42,13 +42,13 @@ Resources:
42
42
  border-color: var(--privy-color-error);
43
43
  border-bottom-color: var(--privy-color-error);
44
44
  }
45
- `,Rd=kd(mt)`
45
+ `,ga=Nd(nt)`
46
46
  && {
47
47
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,eo=e=>Ad(LC,{color:e.color||"var(--privy-color-foreground-3)"}),LC=kd(mt)`
51
+ `,ro=e=>Ld(i0,{color:e.color||"var(--privy-color-foreground-3)"}),i0=Nd(nt)`
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 $t,jsxs as il}from"react/jsx-runtime";var ya=_n.button`
61
+ `;import{jsx as Kt,jsxs as dl}from"react/jsx-runtime";var va=xn.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
- `,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(Zf,{disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),ol=({children:e,loading:t,disabled:r,...o})=>$t(DC,{disabled:r,...o,children:t?$t(eo,{color:"var(--privy-color-foreground-accent)"}):e}),DC=_n(ya)`
83
+ `,B=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(th,{disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),ll=({children:e,loading:t,disabled:r,...o})=>Kt(l0,{disabled:r,...o,children:t?Kt(ro,{color:"var(--privy-color-foreground-accent)"}):e}),l0=xn(va)`
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
- `,nl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(Zf,{as:"a",disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),Zf=_n(ya)`
109
+ `,cl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(th,{as:"a",disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),th=xn(va)`
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?Yf`
135
+ ${e=>e.disabled?eh`
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
- `,Nr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(UC,{disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),UC=_n(ya)`
154
+ `,Ur=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Kt(c0,{disabled:t||r,...n,children:t?dl("span",{children:[Kt(ro,{}),o?Kt("span",{children:o}):null]}):e}),c0=xn(va)`
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
- `,hi=_n.button`
183
+ `,Ho=xn.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&&Yf`
196
+ ${e=>e.invisible&&eh`
197
197
  pointer-events: none;
198
198
  `}
199
199
 
@@ -211,10 +211,10 @@ Resources:
211
211
  cursor: not-allowed;
212
212
  }
213
213
  }
214
- `,VM=_n.div`
214
+ `,UM=xn.div`
215
215
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
216
216
  height: 44px;
217
- `,yi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>il(FC,{isSubmitting:o,onClick:t,disabled:r,...n,children:[$t("span",{children:e}),$t("span",{children:$t(eo,{})})]}),FC=_n.button`
217
+ `,yi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>dl(d0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Kt("span",{children:e}),Kt("span",{children:Kt(ro,{})})]}),d0=xn.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 BC from"styled-components";var Qf=BC.span`
259
+ `;import p0 from"styled-components";var rh=p0.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 HC from"@heroicons/react/24/outline/ArrowLeftIcon";import VC from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import GC from"@heroicons/react/24/outline/XMarkIcon";import gi from"styled-components";import{jsx as Kt,jsxs as Jf}from"react/jsx-runtime";var qC=({backFn:e})=>Kt("div",{children:Kt(Md,{onClick:e,children:Kt(HC,{height:"16px",width:"16px",strokeWidth:2})})}),zC=({infoFn:e})=>Kt("div",{children:Kt(KC,{"aria-label":"info",onClick:e,children:Kt(VC,{height:"22px",width:"22px",strokeWidth:2})})}),$C=e=>Kt("div",{children:Kt(Md,{"aria-label":"close modal",onClick:e.onClose,children:Kt(GC,{height:"16px",width:"16px",strokeWidth:2})})});var _=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=I(),a=Ge();return Jf(jC,{children:[Jf(YC,{children:[e&&Kt(qC,{backFn:e}),t&&Kt(zC,{infoFn:t})]}),o&&Kt(QC,{id:"privy-dialog-title",children:o}),Kt(ZC,{children:!a.render.standalone&&n&&Kt($C,{onClose:r||(()=>i())})})]})},Md=gi.button`
271
+ `;import u0 from"@heroicons/react/24/outline/ArrowLeftIcon";import m0 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import f0 from"@heroicons/react/24/outline/XMarkIcon";import gi from"styled-components";import{jsx as jt,jsxs as oh}from"react/jsx-runtime";var h0=({backFn:e})=>jt("div",{children:jt(Dd,{onClick:e,children:jt(u0,{height:"16px",width:"16px",strokeWidth:2})})}),y0=({infoFn:e})=>jt("div",{children:jt(v0,{"aria-label":"info",onClick:e,children:jt(m0,{height:"22px",width:"22px",strokeWidth:2})})}),g0=e=>jt("div",{children:jt(Dd,{"aria-label":"close modal",onClick:e.onClose,children:jt(f0,{height:"16px",width:"16px",strokeWidth:2})})});var A=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),a=Ve();return oh(C0,{children:[oh(w0,{children:[e&&jt(h0,{backFn:e}),t&&jt(y0,{infoFn:t})]}),o&&jt(E0,{id:"privy-dialog-title",children:o}),jt(b0,{children:!a.render.standalone&&n&&jt(g0,{onClose:r||(()=>i())})})]})},Dd=gi.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
- `,KC=gi(Md)`
290
+ `,v0=gi(Dd)`
291
291
  && {
292
292
  background-color: transparent;
293
293
  }
294
- `,jC=gi.div`
294
+ `,C0=gi.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
- `,YC=gi.div`
306
+ `,w0=gi.div`
307
307
  flex: 1;
308
308
  align-items: center;
309
309
  display: flex;
310
310
  gap: 8px;
311
- `,ZC=gi.div`
311
+ `,b0=gi.div`
312
312
  flex: 1;
313
313
  display: flex;
314
314
  justify-content: flex-end;
315
- `,QC=gi.div`
315
+ `,E0=gi.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 JC from"styled-components";var XC=JC.div`
322
+ `;import T0 from"styled-components";var S0=T0.div`
323
323
  display: flex;
324
324
  flex-direction: column;
325
325
  justify-content: center;
@@ -342,15 +342,15 @@ Resources:
342
342
  left: -19px;
343
343
  top: -19px;
344
344
  }
345
- `,Je=XC;import Uo,{css as e0}from"styled-components";var to=Uo.div`
345
+ `,Je=S0;import Go,{css as _0}from"styled-components";var oo=Go.div`
346
346
  text-align: left;
347
347
  flex-grow: 1;
348
- `,al=Uo.div`
348
+ `,pl=Go.div`
349
349
  display: flex;
350
350
  flex-direction: column;
351
351
  justify-content: flex-end;
352
352
  flex-grow: 1;
353
- `,jt=Uo.div`
353
+ `,Yt=Go.div`
354
354
  display: flex;
355
355
  flex-direction: column;
356
356
  gap: 12px;
@@ -365,13 +365,13 @@ Resources:
365
365
  &::-webkit-scrollbar {
366
366
  display: none;
367
367
  }
368
- `,Xf=Uo(jt)`
368
+ `,nh=Go(Yt)`
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
- `,eh=e0`
374
+ `,ih=_0`
375
375
  && {
376
376
  width: 100%;
377
377
  font-size: 16px;
@@ -408,22 +408,22 @@ Resources:
408
408
  max-width: 24px;
409
409
  }
410
410
  }
411
- `,sl=Uo.div`
411
+ `,ul=Go.div`
412
412
  text-align: center;
413
413
  font-size: 14px;
414
414
  margin-bottom: 24px;
415
- `,Ee=Uo.button`
416
- ${eh}
417
- `,Id=Uo.a`
418
- ${eh}
419
- `,Dr=Uo.div`
415
+ `,Ee=Go.button`
416
+ ${ih}
417
+ `,Ud=Go.a`
418
+ ${ih}
419
+ `,Fr=Go.div`
420
420
  width: 100%;
421
421
  height: 100%;
422
422
  min-height: inherit;
423
423
  display: flex;
424
424
  flex-direction: column;
425
425
  ${e=>e.if?"display: none;":""}
426
- `;import{Fragment as n0,jsx as Pn,jsxs as ga}from"react/jsx-runtime";var rh=()=>{let{navigate:e,app:t}=S();return ga(n0,{children:[Pn(_,{}),ga(r0,{children:[Pn(Je,{children:ga("div",{children:[Pn(Qf,{color:"var(--privy-color-warn-light)"}),Pn(t0,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),ga(o0,{children:[Pn("h3",{children:"Account not found"}),ga("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),Pn(to,{}),Pn(F,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},r0=th.div`
426
+ `;import{Fragment as k0,jsx as kn,jsxs as Ca}from"react/jsx-runtime";var sh=()=>{let{navigate:e,app:t}=_();return Ca(k0,{children:[kn(A,{}),Ca(A0,{children:[kn(Je,{children:Ca("div",{children:[kn(rh,{color:"var(--privy-color-warn-light)"}),kn(P0,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),Ca(x0,{children:[kn("h3",{children:"Account not found"}),Ca("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),kn(oo,{}),kn(B,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},A0=ah.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
- `,o0=th.div`
435
+ `,x0=ah.div`
436
436
  display: flex;
437
437
  flex-direction: column;
438
438
  gap: 8px;
439
- `;import ah from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import i0 from"@heroicons/react/24/solid/DocumentCheckIcon";import a0 from"styled-components";import oh from"styled-components";import{jsx as vi,jsxs as nh}from"react/jsx-runtime";var Wd=oh.div`
439
+ `;import ph from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import R0 from"@heroicons/react/24/solid/DocumentCheckIcon";import I0 from"styled-components";import lh from"styled-components";import{jsx as vi,jsxs as ch}from"react/jsx-runtime";var Fd=lh.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 Ci(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return vi(Wd,{});if(!r&&!t)return vi(Wd,{});let n=!!(t&&r);return nh(Wd,{children:["By logging in I agree to the"," ",r&&vi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&vi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=()=>nh(Z,{children:[vi(Do,{}),vi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),Z=oh.div`
448
+ `;function Ci(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return vi(Fd,{});if(!r&&!t)return vi(Fd,{});let n=!!(t&&r);return ch(Fd,{children:["By logging in I agree to the"," ",r&&vi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&vi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var z=()=>ch(Z,{children:[vi(Fo,{}),vi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),Z=lh.div`
449
449
  display: flex;
450
450
  align-items: center;
451
451
  justify-content: center;
@@ -472,7 +472,7 @@ Resources:
472
472
  @media all and (display-mode: standalone) {
473
473
  padding-bottom: 30px;
474
474
  }
475
- `;import ft from"styled-components";var Ie=ft.div`
475
+ `;import ft from"styled-components";var Me=ft.div`
476
476
  display: flex;
477
477
  flex-direction: column;
478
478
  align-items: center;
@@ -490,7 +490,7 @@ Resources:
490
490
  font-size: 0.875rem;
491
491
 
492
492
  text-align: center;
493
- `,Tr=ft.div`
493
+ `,_r=ft.div`
494
494
  display: flex;
495
495
  flex-direction: column;
496
496
  align-items: center;
@@ -500,7 +500,7 @@ Resources:
500
500
  @media (max-width: 440px) {
501
501
  padding: 10px 10px 20px;
502
502
  }
503
- `,xn=ft.div`
503
+ `,Rn=ft.div`
504
504
  display: flex;
505
505
  flex-direction: column;
506
506
  align-items: stretch;
@@ -508,7 +508,7 @@ Resources:
508
508
  padding: 1rem 0rem 0rem;
509
509
  flex-grow: 1;
510
510
  width: 100%;
511
- `,Yt=ft.div`
511
+ `,Zt=ft.div`
512
512
  width: 25px;
513
513
  display: flex;
514
514
  align-items: center;
@@ -520,7 +520,7 @@ Resources:
520
520
  width: 25px !important;
521
521
  color: var(--privy-color-accent);
522
522
  }
523
- `,Zt=ft.div`
523
+ `,Qt=ft.div`
524
524
  display: flex;
525
525
  align-items: center;
526
526
  gap: 10px;
@@ -532,7 +532,7 @@ Resources:
532
532
  flex-direction: column;
533
533
  gap: 10px;
534
534
  padding-top: 20px;
535
- `,ll=ft.div`
535
+ `,ml=ft.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
- `,cl=ft.div`
543
+ `,fl=ft.div`
544
544
  display: flex;
545
545
  gap: 5px;
546
546
  width: 100%;
547
- `,dl=ft.button`
547
+ `,hl=ft.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
- `,pl=ft.div`
565
+ `,yl=ft.div`
566
566
  display: flex;
567
567
  align-items: center;
568
568
  gap: 0.5rem;
@@ -572,7 +572,7 @@ Resources:
572
572
  height: 20px !important;
573
573
  width: 20px !important;
574
574
  }
575
- `,An=ft.div`
575
+ `,In=ft.div`
576
576
  display: flex;
577
577
  align-items: center;
578
578
  gap: 6px;
@@ -586,15 +586,15 @@ Resources:
586
586
  display: flex !important;
587
587
  align-items: flex-end;
588
588
  }
589
- `,ul=ft.div`
589
+ `,gl=ft.div`
590
590
  width: 100%;
591
591
  display: flex;
592
592
  justify-content: space-between;
593
- `,ih=ft.p`
593
+ `,dh=ft.p`
594
594
  text-align: left;
595
595
  width: 100%;
596
596
  color: var(--privy-color-foreground-3) !important;
597
- `,va=ft.button`
597
+ `,wa=ft.button`
598
598
  display: flex;
599
599
  flex-direction: row;
600
600
  align-items: center;
@@ -624,7 +624,7 @@ Resources:
624
624
  &:hover {
625
625
  text-decoration: underline;
626
626
  }
627
- `,Ke=ft.div`
627
+ `,Ye=ft.div`
628
628
  display: flex;
629
629
  align-items: center;
630
630
  justify-content: center;
@@ -639,12 +639,12 @@ Resources:
639
639
  width: auto !important;
640
640
  color: white;
641
641
  }
642
- `,ml=ft.div`
642
+ `,vl=ft.div`
643
643
  color: var(--privy-color-error);
644
- `;import{Fragment as c0,jsx as ro,jsxs as Ca}from"react/jsx-runtime";var sh=()=>{let{user:e,logout:t}=q(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=S(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=I(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let m=async f=>{f.preventDefault(),await a(),e&&Gt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:u=>{console.error(u),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:u,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return ro(s0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:m,onDecline:c})},s0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Ca(c0,{children:[ro(_,{closeable:!1}),ro(i0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),ro(de,{style:{marginTop:24},children:"One last step"}),ro(ue,{children:"By signing up, you agree to our terms and privacy policy."}),Ca(jt,{style:{marginTop:24},children:[e&&Ca(Id,{target:"_blank",href:e,children:["View Terms ",ro(ah,{style:{marginLeft:"auto"}})]}),t&&Ca(Id,{target:"_blank",href:t,children:["View Privacy Policy ",ro(ah,{style:{marginLeft:"auto"}})]})]}),Ca(l0,{style:{marginTop:24},children:[ro(Nr,{onClick:o,children:"No thanks"}),ro(F,{onClick:r,children:"Accept"})]}),ro($,{})]}),l0=a0.div`
644
+ `;import{Fragment as O0,jsx as no,jsxs as ba}from"react/jsx-runtime";var uh=()=>{let{user:e,logout:t}=q(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let m=async f=>{f.preventDefault(),await a(),e&&qt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:u=>{console.error(u),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:u,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return no(M0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:m,onDecline:c})},M0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ba(O0,{children:[no(A,{closeable:!1}),no(R0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),no(de,{style:{marginTop:24},children:"One last step"}),no(ue,{children:"By signing up, you agree to our terms and privacy policy."}),ba(Yt,{style:{marginTop:24},children:[e&&ba(Ud,{target:"_blank",href:e,children:["View Terms ",no(ph,{style:{marginLeft:"auto"}})]}),t&&ba(Ud,{target:"_blank",href:t,children:["View Privacy Policy ",no(ph,{style:{marginLeft:"auto"}})]})]}),ba(W0,{style:{marginTop:24},children:[no(Ur,{onClick:o,children:"No thanks"}),no(B,{onClick:r,children:"Accept"})]}),no(z,{})]}),W0=I0.div`
645
645
  display: flex;
646
646
  gap: 10px;
647
- `;import ch from"styled-components";import d0 from"styled-components";var fl=d0.span`
647
+ `;import fh from"styled-components";import L0 from"styled-components";var Cl=L0.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 lh}from"react/jsx-runtime";var hl=({style:e,...t})=>lh("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:lh("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 Ld,jsx as oo,jsxs as yl}from"react/jsx-runtime";var dh=()=>{let{navigate:e,app:t}=S(),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 yl(Ld,{children:[oo(_,{}),yl(p0,{children:[oo(Je,{children:yl("div",{children:[oo(fl,{}),oo(hl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),yl(u0,{children:[typeof r=="string"?oo("h3",{children:r}):oo(Ld,{children:r}),typeof o=="string"?oo("p",{children:o}):oo(Ld,{children:o})]}),t?.allowlistConfig.errorCtaLink?oo(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):oo(F,{onClick:()=>{e("LANDING")},children:n})]})]})},p0=ch.div`
662
+ `;import{jsx as mh}from"react/jsx-runtime";var wl=({style:e,...t})=>mh("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:mh("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 Bd,jsx as io,jsxs as bl}from"react/jsx-runtime";var hh=()=>{let{navigate:e,app:t}=_(),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 bl(Bd,{children:[io(A,{}),bl(N0,{children:[io(Je,{children:bl("div",{children:[io(Cl,{}),io(wl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),bl(D0,{children:[typeof r=="string"?io("h3",{children:r}):io(Bd,{children:r}),typeof o=="string"?io("p",{children:o}):io(Bd,{children:o})]}),t?.allowlistConfig.errorCtaLink?io(B,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):io(B,{onClick:()=>{e("LANDING")},children:n})]})]})},N0=fh.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
- `,u0=ch.div`
670
+ `,D0=fh.div`
671
671
  display: flex;
672
672
  flex-direction: column;
673
673
  gap: 8px;
674
- `;import h0 from"@heroicons/react/20/solid/CheckIcon";import y0 from"@heroicons/react/24/outline/EnvelopeIcon";import g0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Nd,useState as ba}from"react";import{isMobile as v0}from"react-device-detect";import Rn from"styled-components";import Qt from"styled-components";var Sr=Qt.div`
674
+ `;import B0 from"@heroicons/react/20/solid/CheckIcon";import H0 from"@heroicons/react/24/outline/EnvelopeIcon";import G0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Gd,useState as Ta}from"react";import{isMobile as V0}from"react-device-detect";import Wn from"styled-components";import Jt from"styled-components";var Pr=Jt.div`
675
675
  display: flex;
676
676
  flex-direction: column;
677
677
  align-items: flex-start;
@@ -679,36 +679,36 @@ Resources:
679
679
  margin-top: auto;
680
680
  gap: 16px;
681
681
  flex-grow: 100;
682
- `,wt=Qt.div`
682
+ `,wt=Jt.div`
683
683
  display: flex;
684
684
  flex-direction: column;
685
685
  align-items: center;
686
686
  justify-content: center;
687
687
  flex-grow: 1;
688
688
  width: 100%;
689
- `,ph=Qt.div`
689
+ `,yh=Jt.div`
690
690
  display: flex;
691
691
  flex-direction: column;
692
692
  align-items: center;
693
693
  width: 100%;
694
- `,wi=Qt(wt)`
694
+ `,wi=Jt(wt)`
695
695
  padding: 20px 0;
696
- `,ir=Qt(wt)`
696
+ `,ir=Jt(wt)`
697
697
  gap: 16px;
698
- `,Fo=Qt.div`
698
+ `,Vo=Jt.div`
699
699
  display: flex;
700
700
  flex-direction: column;
701
701
  width: 100%;
702
- `,Xe=Qt.div`
702
+ `,qe=Jt.div`
703
703
  display: flex;
704
704
  flex-direction: column;
705
705
  gap: 8px;
706
- `,YI=Qt.div`
706
+ `,zW=Jt.div`
707
707
  display: flex;
708
708
  flex-direction: column;
709
709
  justify-content: space-between;
710
710
  height: 100%;
711
- `,uh=Qt.div`
711
+ `,gh=Jt.div`
712
712
  display: flex;
713
713
  flex-direction: column;
714
714
  justify-content: flex-start;
@@ -731,15 +731,15 @@ Resources:
731
731
  color: var(--privy-color-foreground-3);
732
732
  font-size: 14px;
733
733
  }
734
- `,oe=Qt.div`
734
+ `,oe=Jt.div`
735
735
  height: 16px;
736
- `,ne=Qt.div`
736
+ `,ne=Jt.div`
737
737
  height: 12px;
738
- `,mh=Qt.div`
738
+ `,vh=Jt.div`
739
739
  position: relative;
740
- `,bi=Qt.div`
740
+ `,bi=Jt.div`
741
741
  height: ${e=>e.height??"12"}px;
742
- `,fh=Qt.div`
742
+ `,Ch=Jt.div`
743
743
  background-color: var(--privy-color-accent);
744
744
  display: flex;
745
745
  justify-content: center;
@@ -747,9 +747,9 @@ Resources:
747
747
  border-radius: 50%;
748
748
  border-color: white;
749
749
  border-width: 2px !important;
750
- `;import Od from"styled-components";import{Fragment as f0,jsx as wa,jsxs as yh}from"react/jsx-runtime";var kn=({title:e,description:t,children:r,...o})=>wa(hh,{...o,children:yh(f0,{children:[wa("h3",{children:e}),typeof t=="string"?wa("p",{children:t}):t,r]})}),no=Od(kn)`
750
+ `;import Hd from"styled-components";import{Fragment as F0,jsx as Ea,jsxs as bh}from"react/jsx-runtime";var Mn=({title:e,description:t,children:r,...o})=>Ea(wh,{...o,children:bh(F0,{children:[Ea("h3",{children:e}),typeof t=="string"?Ea("p",{children:t}):t,r]})}),ao=Hd(Mn)`
751
751
  margin-bottom: 24px;
752
- `,ye=({title:e,description:t,icon:r,children:o,...n})=>yh(m0,{...n,children:[r||null,wa("h3",{children:e}),t&&typeof t=="string"?wa("p",{children:t}):t,o]}),hh=Od.div`
752
+ `,ye=({title:e,description:t,icon:r,children:o,...n})=>bh(U0,{...n,children:[r||null,Ea("h3",{children:e}),t&&typeof t=="string"?Ea("p",{children:t}):t,o]}),wh=Hd.div`
753
753
  display: flex;
754
754
  flex-direction: column;
755
755
  justify-content: flex-start;
@@ -769,7 +769,7 @@ Resources:
769
769
  color: var(--privy-color-foreground-2);
770
770
  font-size: 14px;
771
771
  }
772
- `,m0=Od(hh)`
772
+ `,U0=Hd(wh)`
773
773
  align-items: center;
774
774
  text-align: center;
775
775
  gap: 16px;
@@ -777,7 +777,7 @@ Resources:
777
777
  h3 {
778
778
  margin-bottom: 24px;
779
779
  }
780
- `;import{Fragment as x0,jsx as Wt,jsxs as To}from"react/jsx-runtime";var Dd=6,gh=new Array(Dd).fill(""),C0=1400,w0=30;var Ch=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:i}=S(),{closePrivyModal:a,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:m,updateWallets:f,createAnalyticsEvent:u}=I(),{authenticated:g,logout:w,user:y}=q(),[b,P]=ba(gh),[A,T]=ba(!1),[x,R]=ba(null),[M,D]=ba(null),[B,K]=ba(0);i.current=()=>null;let j=c()?.email?0:1,L=Ne,N=L-500;Nd(()=>{if(B){let te=setTimeout(()=>{K(B-1)},1e3);return()=>clearTimeout(te)}},[B]),Nd(()=>{if(g&&A&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let ee=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},N);return()=>clearTimeout(ee)}if(Gt(y,e?.embeddedWallets?.createOnLogin)){let ee=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:_e=>{console.error(_e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:_e,screen:"AwaitingPasswordlessCodeScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},N);return()=>clearTimeout(ee)}else{f();let ee=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),L);return()=>clearTimeout(ee)}}},[g,A,y]),Nd(()=>{if(x&&M===0){let te=setTimeout(()=>{P(gh),R(null),document.querySelector("input[name=code-0]")?.focus()},C0);return()=>clearTimeout(te)}},[x]);let W=te=>{te.preventDefault();let ee=te.currentTarget.value.replace(" ","");if(ee==="")return;if(isNaN(Number(ee))){R("Code should be numeric"),D(1);return}R(null),D(null);let _e=Number(te.currentTarget.name?.charAt(5)),Te=[...ee||[""]].slice(0,Dd-_e),ze=[...b.slice(0,_e),...Te,...b.slice(_e+Te.length)];P(ze);let Ve=Te.length,pt=Math.min(Math.max(_e+Ve,0),Dd-1);isNaN(Number(te.currentTarget.value))||document.querySelector(`input[name=code-${pt}]`)?.focus(),ze.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${pt}]`)?.blur(),m(ze.join("")).then(()=>T(!0)).catch(ae=>{if(ae?.status===422)R("Invalid or expired verification code");else if(ae instanceof Rt&&ae.privyErrorCode==="cannot_link_more_of_type")R(ae.message);else if(ae instanceof Rt&&ae.privyErrorCode==="max_accounts_reached"){console.error(new wr(ae).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(ae instanceof Rt&&ae.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(ae instanceof Rt&&ae.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:ae,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else R("Issue verifying code");D(0)}))},ve=te=>{M===1&&(R(null),D(null));let ee=[...b.slice(0,te),"",...b.slice(te+1)];P(ee),te>0&&document.querySelector(`input[name=code-${te-1}]`)?.focus()},Me=j==0?Wt(y0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Wt(g0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Y=j==0?To("p",{children:["Please check ",Wt(vh,{children:c()?.email})," for an email from privy.io and enter your code below."]}):To("p",{children:["Please check ",Wt(vh,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return To(x0,{children:[Wt(_,{backFn:()=>o()},"header"),To(b0,{children:[Wt(ye,{title:"Enter confirmation code",description:Y,icon:Me}),To(ph,{children:[To(E0,{children:[Wt(T0,{fail:!!x,success:A,children:Wt("span",{children:x||(A?"Success!":"")})}),Wt("div",{children:b.map((te,ee)=>Wt("input",{name:`code-${ee}`,type:"text",value:b[ee],onChange:W,onKeyUp:_e=>{_e.key==="Backspace"&&ve(ee)},inputMode:"numeric",autoFocus:ee===0,pattern:"[0-9]",className:`${A?"success":""} ${x?"fail":""}`,autoComplete:v0?"one-time-code":"off"},ee))})]}),To(S0,{children:[To("span",{children:["Didn't get ",j==0?"an email":"a message","?"]}),B?To(P0,{children:[Wt(h0,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),Wt("span",{children:"Code sent"})]}):Wt(_0,{children:Wt("button",{onClick:async()=>{K(w0),j==0?await l():await s()},children:"Resend code"})})]})]})]}),Wt($,{})]})},b0=Rn.div`
780
+ `;import{Fragment as J0,jsx as Lt,jsxs as Po}from"react/jsx-runtime";var Vd=6,Eh=new Array(Vd).fill(""),q0=1400,z0=30;var Sh=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:i}=_(),{closePrivyModal:a,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:m,updateWallets:f,createAnalyticsEvent:u}=M(),{authenticated:v,logout:g,user:y}=q(),[b,T]=Ta(Eh),[k,E]=Ta(!1),[P,x]=Ta(null),[I,N]=Ta(null),[H,K]=Ta(0);i.current=()=>null;let j=c()?.email?0:1,O=Ne,D=O-500;Gd(()=>{if(H){let X=setTimeout(()=>{K(H-1)},1e3);return()=>clearTimeout(X)}},[H]),Gd(()=>{if(v&&k&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let te=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},D);return()=>clearTimeout(te)}if(qt(y,e?.embeddedWallets?.createOnLogin)){let te=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:_e=>{console.error(_e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:_e,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(te)}else{f();let te=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),O);return()=>clearTimeout(te)}}},[v,k,y]),Gd(()=>{if(P&&I===0){let X=setTimeout(()=>{T(Eh),x(null),document.querySelector("input[name=code-0]")?.focus()},q0);return()=>clearTimeout(X)}},[P]);let W=X=>{X.preventDefault();let te=X.currentTarget.value.replace(" ","");if(te==="")return;if(isNaN(Number(te))){x("Code should be numeric"),N(1);return}x(null),N(null);let _e=Number(X.currentTarget.name?.charAt(5)),Te=[...te||[""]].slice(0,Vd-_e),Ke=[...b.slice(0,_e),...Te,...b.slice(_e+Te.length)];T(Ke);let Ge=Te.length,ut=Math.min(Math.max(_e+Ge,0),Vd-1);isNaN(Number(X.currentTarget.value))||document.querySelector(`input[name=code-${ut}]`)?.focus(),Ke.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${ut}]`)?.blur(),m(Ke.join("")).then(()=>E(!0)).catch(se=>{if(se?.status===422)x("Invalid or expired verification code");else if(se instanceof Mt&&se.privyErrorCode==="cannot_link_more_of_type")x(se.message);else if(se instanceof Mt&&se.privyErrorCode==="max_accounts_reached"){console.error(new br(se).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(se instanceof Mt&&se.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:se,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else x("Issue verifying code");N(0)}))},ve=X=>{I===1&&(x(null),N(null));let te=[...b.slice(0,X),"",...b.slice(X+1)];T(te),X>0&&document.querySelector(`input[name=code-${X-1}]`)?.focus()},Ie=j==0?Lt(H0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Lt(G0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Y=j==0?Po("p",{children:["Please check ",Lt(Th,{children:c()?.email})," for an email from privy.io and enter your code below."]}):Po("p",{children:["Please check ",Lt(Th,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Po(J0,{children:[Lt(A,{backFn:()=>o()},"header"),Po($0,{children:[Lt(ye,{title:"Enter confirmation code",description:Y,icon:Ie}),Po(yh,{children:[Po(K0,{children:[Lt(j0,{fail:!!P,success:k,children:Lt("span",{children:P||(k?"Success!":"")})}),Lt("div",{children:b.map((X,te)=>Lt("input",{name:`code-${te}`,type:"text",value:b[te],onChange:W,onKeyUp:_e=>{_e.key==="Backspace"&&ve(te)},inputMode:"numeric",autoFocus:te===0,pattern:"[0-9]",className:`${k?"success":""} ${P?"fail":""}`,autoComplete:V0?"one-time-code":"off"},te))})]}),Po(Y0,{children:[Po("span",{children:["Didn't get ",j==0?"an email":"a message","?"]}),H?Po(Q0,{children:[Lt(B0,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),Lt("span",{children:"Code sent"})]}):Lt(Z0,{children:Lt("button",{onClick:async()=>{K(z0),j==0?await l():await s()},children:"Resend code"})})]})]})]}),Lt(z,{})]})},$0=Wn.div`
781
781
  display: flex;
782
782
  flex-direction: column;
783
783
  align-items: flex-start;
@@ -785,7 +785,7 @@ Resources:
785
785
  margin: auto;
786
786
  gap: 16px;
787
787
  flex-grow: 1;
788
- `,E0=Rn.div`
788
+ `,K0=Wn.div`
789
789
  display: flex;
790
790
  flex-direction: column;
791
791
  width: 100%;
@@ -842,7 +842,7 @@ Resources:
842
842
  transform: translate(1px, 0px);
843
843
  }
844
844
  }
845
- `,T0=Rn.div`
845
+ `,j0=Wn.div`
846
846
  line-height: 20px;
847
847
  height: 20px;
848
848
  font-size: 13px;
@@ -850,7 +850,7 @@ Resources:
850
850
  display: flex;
851
851
  justify-content: flex-end;
852
852
  width: 100%;
853
- `,S0=Rn.div`
853
+ `,Y0=Wn.div`
854
854
  font-size: 13px;
855
855
  color: var(--privy-color-foreground);
856
856
  display: flex;
@@ -861,13 +861,13 @@ Resources:
861
861
  // Equal opposing size buffer to account for auto margining when the
862
862
  // success/fail text does not show up
863
863
  padding-bottom: 32px;
864
- `,_0=Rn.div`
864
+ `,Z0=Wn.div`
865
865
  color: var(--privy-color-accent);
866
866
  padding: 2px 0;
867
867
  > button {
868
868
  text-decoration: underline;
869
869
  }
870
- `,P0=Rn.div`
870
+ `,Q0=Wn.div`
871
871
  display: flex;
872
872
  align-items: center;
873
873
  justify-content: center;
@@ -876,10 +876,10 @@ Resources:
876
876
  gap: 4px;
877
877
  background: var(--privy-color-background-2);
878
878
  color: var(--privy-color-foreground-2);
879
- `,vh=Rn.span`
879
+ `,Th=Wn.span`
880
880
  font-weight: 500;
881
881
  word-break: break-all;
882
- `;import I0 from"@heroicons/react/24/solid/CheckCircleIcon";import W0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ud,useRef as L0,useState as Ti}from"react";import O0 from"styled-components";import A0 from"styled-components";import{Fragment as M0,jsx as Ei,jsxs as R0}from"react/jsx-runtime";var wh=({icon:e})=>{let t=e;return Ei(M0,{children:Ei(k0,{children:R0("div",{children:[Ei(ot,{}),typeof t=="string"?Ei("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Ei(t,{style:{width:"38px",height:"38px"}}):Ei("span",{})]})})})},k0=A0.div`
882
+ `;import ow from"@heroicons/react/24/solid/CheckCircleIcon";import nw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as qd,useRef as iw,useState as Ti}from"react";import aw from"styled-components";import X0 from"styled-components";import{Fragment as rw,jsx as Ei,jsxs as tw}from"react/jsx-runtime";var _h=({icon:e})=>{let t=e;return Ei(rw,{children:Ei(ew,{children:tw("div",{children:[Ei(ot,{}),typeof t=="string"?Ei("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Ei(t,{style:{width:"38px",height:"38px"}}):Ei("span",{})]})})})},ew=X0.div`
883
883
  display: flex;
884
884
  flex-direction: column;
885
885
  justify-content: center;
@@ -902,14 +902,14 @@ Resources:
902
902
  left: -19px;
903
903
  top: -19px;
904
904
  }
905
- `;import{Fragment as D0,jsx as Ur,jsxs as Fd}from"react/jsx-runtime";var Eh=500,bh=Eh*2,Th=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=S(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=be(),f=L0([]),u=N=>{f.current=[N,...f.current]},[g,w]=Ti(!0);Ud(()=>{let N=setTimeout(w,bh,!1);return u(N),()=>{f.current.forEach(W=>clearTimeout(W)),f.current=[]}},[]);let[y,b]=Ti(""),[P,A]=Ti("Checking that you are a human..."),[T,x]=Ti(Ur(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,M]=Ti(!1),[D,B]=Ti(3),K=r?.captchaModalData,j=async N=>{try{await K?.callback(N),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(W){if(W instanceof nr)return;{let ve={error:W,previousScreen:e||"LANDING"};i({errorModalData:ve}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Ud(()=>{if(a==="success"){let N=setTimeout(async()=>{let W=await s();!W||K?.userIntentRequired||j(W)},bh);u(N)}else if(a==="ready"){let N=setTimeout(()=>{a==="ready"&&m()},Eh);u(N)}},[a]),Ud(()=>{if(!g)switch(a){case"success":b("Success!"),A("CAPTCHA passed successfully."),x(Ur(F,{onClick:()=>{M(!0),j(l)},disabled:!K?.userIntentRequired,loading:R,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":b(""),A("Checking that you are a human..."),x(Ur(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":b("Something went wrong"),D<=0?(A("If you use an adblocker or VPN, try disabling and re-attempting."),x(null)):(A("You did not pass CAPTCHA. Please try again."),x(Ur(F,{onClick:L,children:"Retry"})));break;case"ready":default:break}},[a,g,R]);let L=async()=>{if(D<=0)return;B(W=>W-1),c(),m();let N=await s();!N||K?.userIntentRequired||j(N)};return Fd(D0,{children:[Ur(_,{backFn:!e||t===e?void 0:o}),Fd(N0,{children:[a==="success"?Ur(I0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Ur(W0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Ur(wh,{}),Fd(Xe,{children:[y?Ur("h3",{children:y}):null,Ur("p",{children:P})]}),T]}),Ur(Z,{})]})},N0=O0.div`
905
+ `;import{Fragment as lw,jsx as Br,jsxs as zd}from"react/jsx-runtime";var Ah=500,Ph=Ah*2,xh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=be(),f=iw([]),u=D=>{f.current=[D,...f.current]},[v,g]=Ti(!0);qd(()=>{let D=setTimeout(g,Ph,!1);return u(D),()=>{f.current.forEach(W=>clearTimeout(W)),f.current=[]}},[]);let[y,b]=Ti(""),[T,k]=Ti("Checking that you are a human..."),[E,P]=Ti(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"})),[x,I]=Ti(!1),[N,H]=Ti(3),K=r?.captchaModalData,j=async D=>{try{await K?.callback(D),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(W){if(W instanceof nr)return;{let ve={error:W,previousScreen:e||"LANDING"};i({errorModalData:ve}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};qd(()=>{if(a==="success"){let D=setTimeout(async()=>{let W=await s();!W||K?.userIntentRequired||j(W)},Ph);u(D)}else if(a==="ready"){let D=setTimeout(()=>{a==="ready"&&m()},Ah);u(D)}},[a]),qd(()=>{if(!v)switch(a){case"success":b("Success!"),k("CAPTCHA passed successfully."),P(Br(B,{onClick:()=>{I(!0),j(l)},disabled:!K?.userIntentRequired,loading:x,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":b(""),k("Checking that you are a human..."),P(Br(B,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":b("Something went wrong"),N<=0?(k("If you use an adblocker or VPN, try disabling and re-attempting."),P(null)):(k("You did not pass CAPTCHA. Please try again."),P(Br(B,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[a,v,x]);let O=async()=>{if(N<=0)return;H(W=>W-1),c(),m();let D=await s();!D||K?.userIntentRequired||j(D)};return zd(lw,{children:[Br(A,{backFn:!e||t===e?void 0:o}),zd(sw,{children:[a==="success"?Br(ow,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Br(nw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Br(_h,{}),zd(qe,{children:[y?Br("h3",{children:y}):null,Br("p",{children:T})]}),E]}),Br(Z,{})]})},sw=aw.div`
906
906
  display: flex;
907
907
  flex-direction: column;
908
908
  align-items: center;
909
909
  justify-content: center;
910
910
  gap: 24px;
911
911
  width: 100%;
912
- `;import{isMobile as Bh}from"react-device-detect";import Hh from"styled-components";import U0 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Bd}from"react/jsx-runtime";var gl=({icon:e,name:t})=>typeof e=="string"?Bd("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Bd(U0,{}):e?Bd(e,{}):null;import H0 from"styled-components";import{keyframes as F0,css as Sh}from"styled-components";var B0=F0`
912
+ `;import{isMobile as $h}from"react-device-detect";import Kh from"styled-components";import cw from"@heroicons/react/24/outline/WalletIcon";import{jsx as $d}from"react/jsx-runtime";var El=({icon:e,name:t})=>typeof e=="string"?$d("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?$d(cw,{}):e?$d(e,{}):null;import uw,{css as Rh,keyframes as mw}from"styled-components";import{keyframes as dw,css as kh}from"styled-components";var pw=dw`
913
913
  from, to {
914
914
  background: var(--privy-color-foreground-4);
915
915
  color: var(--privy-color-foreground-4);
@@ -919,23 +919,37 @@ Resources:
919
919
  background: var(--privy-color-foreground-accent);
920
920
  color: var(--privy-color-foreground-accent);
921
921
  }
922
- `,vl=Sh`
923
- ${e=>e.$isLoading?Sh`
922
+ `,Tl=kh`
923
+ ${e=>e.$isLoading?kh`
924
924
  width: 35%;
925
- animation: ${B0} 2s linear infinite;
925
+ animation: ${pw} 2s linear infinite;
926
926
  border-radius: var(--privy-border-radius-sm);
927
927
  `:""}
928
- `;import{jsx as G0}from"react/jsx-runtime";var Jt=({children:e,color:t,isLoading:r,className:o})=>G0(V0,{$color:t,$isLoading:r,className:o,children:e}),V0=H0.span`
928
+ `;import{jsx as hw}from"react/jsx-runtime";var Xt=({children:e,color:t,isLoading:r,isPulsing:o,className:n})=>hw(fw,{$color:t,$isLoading:r,$isPulsing:o,className:n,children:e}),fw=uw.span`
929
929
  padding: 0.125rem 0.5rem;
930
930
  font-size: 0.75rem;
931
931
  font-weight: 500;
932
932
  line-height: 1.125rem; /* 150% */
933
933
  border-radius: var(--privy-border-radius-sm);
934
934
 
935
- ${e=>e.$color==="green"?"color:var(--privy-color-success-dark);background-color:var(--privy-color-success-light);":e.$color==="red"?"color:var(--privy-color-error);background-color:var(--privy-color-error-light);":e.$color==="gray"?"color:var(--privy-color-foreground-2);background-color:var(--privy-color-background-2);":""}
935
+ ${e=>{let t,r;e.$color==="green"&&(t="var(--privy-color-success-dark)",r="var(--privy-color-success-light)"),e.$color==="red"&&(t="var(--privy-color-error)",r="var(--privy-color-error-light)"),e.$color==="gray"&&(t="var(--privy-color-foreground-2)",r="var(--privy-color-background-2)");let o=mw`
936
+ from, to {
937
+ background-color: ${r};
938
+ }
936
939
 
937
- ${vl}
938
- `;import{GlobeAltIcon as z0}from"@heroicons/react/24/outline";import{jsx as Fr,jsxs as _h}from"react/jsx-runtime";var Ph=({...e})=>_h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Fr("defs",{children:_h("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:[Fr("stop",{offset:"0",stopColor:"#f1562b"}),Fr("stop",{offset:"0.3",stopColor:"#f1542b"}),Fr("stop",{offset:"0.41",stopColor:"#f04d2a"}),Fr("stop",{offset:"0.49",stopColor:"#ef4229"}),Fr("stop",{offset:"0.5",stopColor:"#ef4029"}),Fr("stop",{offset:"0.56",stopColor:"#e83e28"}),Fr("stop",{offset:"0.67",stopColor:"#e13c26"}),Fr("stop",{offset:"1",stopColor:"#df3c26"})]})}),Fr("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"}),Fr("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 xh,jsxs as q0}from"react/jsx-runtime";var Ah=({...e})=>q0("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[xh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),xh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Br,jsxs as Ea}from"react/jsx-runtime";var kh=({style:e,...t})=>Ea("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:[Br("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"}),Br("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Br("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"})}),Ea("g",{mask:"url(#mask0_16909_31415)",children:[Br("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"}),Br("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"}),Br("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"}}),Br("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"}})]}),Ea("defs",{children:[Ea("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Br("stop",{stopColor:"#002D72"}),Br("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),Ea("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Br("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Br("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as ar,jsxs as Si}from"react/jsx-runtime";var Rh=e=>Si("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[ar("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),ar("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)"}),ar("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)"}),ar("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)"}),ar("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)"}),Si("defs",{children:[Si("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"1",stopColor:"white"})]}),Si("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as pe,jsxs as sr}from"react/jsx-runtime";var Mh=({style:e,...t})=>sr("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:[pe("g",{clipPath:"url(#clip0_5_32)",children:sr("g",{clipPath:"url(#clip1_5_32)",children:[pe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:pe("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"})}),pe("g",{mask:"url(#mask0_5_32)",children:pe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),pe("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)"}),pe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),pe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),pe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),pe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),pe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),pe("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)"}),pe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),pe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),sr("defs",{children:[sr("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#174299"}),pe("stop",{offset:"1",stopColor:"#001E59"})]}),sr("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[pe("stop",{offset:"0.770277",stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#8754C9"}),pe("stop",{offset:"1",stopColor:"#FF4000"})]}),sr("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[pe("stop",{offset:"0.723929",stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[pe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("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:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),pe("clipPath",{id:"clip0_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})}),pe("clipPath",{id:"clip1_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as io,jsxs as Ih}from"react/jsx-runtime";var Wh=({style:e,...t})=>Ih("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:[io("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Ih("g",{filter:"url(#filter0_d_12393_20043)",children:[io("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"}),io("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"}),io("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"}),io("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"}),io("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"}),io("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"}),io("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"}),io("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"}),io("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 Ta,jsxs as Lh}from"react/jsx-runtime";var Oh=({style:e,...t})=>Lh("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:[Lh("g",{clipPath:"url(#clip0_1704_1423)",children:[Ta("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"}),Ta("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"})]}),Ta("defs",{children:Ta("clipPath",{id:"clip0_1704_1423",children:Ta("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Nh}from"react/jsx-runtime";var _r={coinbase_wallet:{logo:En,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:En,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:li,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Xr,displayName:"Phantom"},rainbow:{logo:Mh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:ma,displayName:"WalletConnect"},zerion:{logo:Oh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Ph,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:kh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Wh,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:Rh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},Bo=(e,t,r)=>{if(_r[e]?.displayName)return e==="coinbase_wallet"?_r[r].displayName:_r[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Cl=(e,t,r)=>{if(_r[e]?.logo)return e==="coinbase_wallet"?_r[r].logo:_r[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return ma},wl=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return Nh(Ah,{height:r,width:o});default:return Nh(z0,{height:r,width:o})}};function _i(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as $0,useEffect as K0,useState as j0}from"react";import{createContext as Y0}from"react";import{jsx as Z0}from"react/jsx-runtime";var Uh=Y0({}),Fh=({children:e})=>{let t=Ge(),[r,o]=j0({});return ke("login",{onComplete:(n,i,a,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(J.put(Dh(t.id),s.type),s.type==="wallet"?(J.put(Hd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(J.del(Hd(t.id)),o({accountType:s.type})))}}),K0(()=>{if(!t.id)return;let n=J.get(Dh(t.id)),i=J.get(Hd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:i}:{accountType:n})},[t.id]),Z0(Uh.Provider,{value:r,children:e})},Dh=e=>`privy:${e}:recent-login-method`,Hd=e=>`privy:${e}:recent-login-wallet-client`,St=()=>$0(Uh);import{jsx as bl,jsxs as X0}from"react/jsx-runtime";var Mn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=S(),{connectWallet:a}=I(),l=St(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,m;return n.connectorType==="phantom"?m=()=>{Lo()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Bh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Bh&&!c&&!bs()?m=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:m=()=>{_i(window.navigator.userAgent)&&!event?.isTrusted||(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},X0(Q0,{onClick:m,children:[bl(gl,{icon:Cl(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),bl("span",{children:Bo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?bl(J0,{color:"gray",children:"Recent"}):bl("span",{id:"connect-text",children:"Connect"})]})},Q0=Hh(Ee)`
940
+ 50% {
941
+ background-color: rgba(${r}, 0.8);
942
+ }
943
+ `;return Rh`
944
+ color: ${t};
945
+ background-color: ${r};
946
+ ${e.$isPulsing&&Rh`
947
+ animation: ${o} 3s linear infinite;
948
+ `};
949
+ `}}
950
+
951
+ ${Tl}
952
+ `;import{GlobeAltIcon as gw}from"@heroicons/react/24/outline";import{jsx as Hr,jsxs as Ih}from"react/jsx-runtime";var Mh=({...e})=>Ih("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Hr("defs",{children:Ih("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:[Hr("stop",{offset:"0",stopColor:"#f1562b"}),Hr("stop",{offset:"0.3",stopColor:"#f1542b"}),Hr("stop",{offset:"0.41",stopColor:"#f04d2a"}),Hr("stop",{offset:"0.49",stopColor:"#ef4229"}),Hr("stop",{offset:"0.5",stopColor:"#ef4029"}),Hr("stop",{offset:"0.56",stopColor:"#e83e28"}),Hr("stop",{offset:"0.67",stopColor:"#e13c26"}),Hr("stop",{offset:"1",stopColor:"#df3c26"})]})}),Hr("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"}),Hr("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 Wh,jsxs as yw}from"react/jsx-runtime";var Oh=({...e})=>yw("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Wh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),Wh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Gr,jsxs as Sa}from"react/jsx-runtime";var Lh=({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:[Gr("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"}),Gr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Gr("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:[Gr("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"}),Gr("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"}),Gr("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"}}),Gr("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:[Gr("stop",{stopColor:"#002D72"}),Gr("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:[Gr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Gr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as ar,jsxs as Si}from"react/jsx-runtime";var Nh=e=>Si("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[ar("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),ar("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)"}),ar("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)"}),ar("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)"}),ar("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)"}),Si("defs",{children:[Si("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"1",stopColor:"white"})]}),Si("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as pe,jsxs as sr}from"react/jsx-runtime";var Dh=({style:e,...t})=>sr("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:[pe("g",{clipPath:"url(#clip0_5_32)",children:sr("g",{clipPath:"url(#clip1_5_32)",children:[pe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:pe("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"})}),pe("g",{mask:"url(#mask0_5_32)",children:pe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),pe("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)"}),pe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),pe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),pe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),pe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),pe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),pe("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)"}),pe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),pe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),sr("defs",{children:[sr("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#174299"}),pe("stop",{offset:"1",stopColor:"#001E59"})]}),sr("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[pe("stop",{offset:"0.770277",stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#8754C9"}),pe("stop",{offset:"1",stopColor:"#FF4000"})]}),sr("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[pe("stop",{offset:"0.723929",stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[pe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("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:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),pe("clipPath",{id:"clip0_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})}),pe("clipPath",{id:"clip1_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as so,jsxs as Uh}from"react/jsx-runtime";var Fh=({style:e,...t})=>Uh("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:[so("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Uh("g",{filter:"url(#filter0_d_12393_20043)",children:[so("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"}),so("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"}),so("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"}),so("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"}),so("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"}),so("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"}),so("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"}),so("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"}),so("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 _a,jsxs as Bh}from"react/jsx-runtime";var Hh=({style:e,...t})=>Bh("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:[Bh("g",{clipPath:"url(#clip0_1704_1423)",children:[_a("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"}),_a("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"})]}),_a("defs",{children:_a("clipPath",{id:"clip0_1704_1423",children:_a("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Gh}from"react/jsx-runtime";var Ar={coinbase_wallet:{logo:So,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:So,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:di,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:to,displayName:"Phantom"},rainbow:{logo:Dh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:fa,displayName:"WalletConnect"},zerion:{logo:Hh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Mh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Lh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Fh,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:Nh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},qo=(e,t,r)=>{if(Ar[e]?.displayName)return e==="coinbase_wallet"?Ar[r].displayName:Ar[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Sl=(e,t,r)=>{if(Ar[e]?.logo)return e==="coinbase_wallet"?Ar[r].logo:Ar[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return fa},_l=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return Gh(Oh,{height:r,width:o});default:return Gh(gw,{height:r,width:o})}};function _i(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as vw,useEffect as Cw,useState as ww}from"react";import{createContext as bw}from"react";import{jsx as Ew}from"react/jsx-runtime";var qh=bw({}),zh=({children:e})=>{let t=Ve(),[r,o]=ww({});return Ae("login",{onComplete:(n,i,a,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(Q.put(Vh(t.id),s.type),s.type==="wallet"?(Q.put(Kd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(Q.del(Kd(t.id)),o({accountType:s.type})))}}),Cw(()=>{if(!t.id)return;let n=Q.get(Vh(t.id)),i=Q.get(Kd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:i}:{accountType:n})},[t.id]),Ew(qh.Provider,{value:r,children:e})},Vh=e=>`privy:${e}:recent-login-method`,Kd=e=>`privy:${e}:recent-login-wallet-client`,St=()=>vw(qh);import{jsx as Pl,jsxs as _w}from"react/jsx-runtime";var On=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=M(),l=St(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,m;return n.connectorType==="phantom"?m=()=>{No()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i($h?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&$h&&!c&&!Ps()?m=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:m=()=>{_i(window.navigator.userAgent)&&!event?.isTrusted||(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},_w(Tw,{onClick:m,children:[Pl(El,{icon:Sl(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),Pl("span",{children:qo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?Pl(Sw,{color:"gray",children:"Recent"}):Pl("span",{id:"connect-text",children:"Connect"})]})},Tw=Kh(Ee)`
939
953
  /* Show "Connect" on hover */
940
954
  > #connect-text {
941
955
  font-weight: 500;
@@ -957,16 +971,16 @@ Resources:
957
971
  display: none;
958
972
  }
959
973
  }
960
- `,J0=Hh(Jt)`
974
+ `,Sw=Kh(Xt)`
961
975
  margin-left: auto;
962
- `;import{Fragment as nw,jsx as Pi,jsxs as iw}from"react/jsx-runtime";var ew=["coinbase_wallet"],tw=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],rw=[],ow=["phantom"],xi=({connectOnly:e})=>{let{connectors:t}=I(),{app:r}=S(),o=Ho(r.appearance.walletList,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return iw(nw,{children:[...o]})},Ho=(e,t,r,o,n)=>{let i=[],a=[],l=[],s=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let m=t.filter(({connectorType:f,walletClientType:u})=>u==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(u));for(let f of m){let{walletClientType:u,walletBranding:g}=f;(u==="unknown"?a:i).push(Pi(Mn,{connectOnly:r,provider:u,logo:g.icon,displayName:g.name,connector:f},`${c}-${u}`))}}else if(ow.includes(c)){let m=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else if(tw.includes(c)){let m=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&&!m&&(m=s),m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else if(ew.includes(c)){let m=t.find(({connectorType:f})=>f===c);m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else rw.includes(c)?s&&l.push(Pi(Mn,{connectOnly:r,provider:c,connector:s},c)):c==="wallet_connect"&&s&&l.push(Pi(Mn,{connectOnly:r,provider:c,connector:s},c));return[...a,...i,...l]};import{Fragment as aw,jsx as Sa,jsxs as sw}from"react/jsx-runtime";var Vh=()=>{let{app:e}=S(),{linkingOrConnectingHint:t}=I(),r=t?`Connect the wallet with address ${Qe(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return sw(aw,{children:[Sa(_,{},"header"),Sa(no,{title:"Connect your wallet",description:r}),Sa(jt,{children:Sa(xi,{connectOnly:!0})}),Sa($,{})]})};import{Fragment as lw,jsx as Ai,jsxs as cw}from"react/jsx-runtime";var Gh=()=>{let{app:e}=S(),{linkingOrConnectingHint:t}=I(),r=t?`Connect the wallet with address ${Qe(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return cw(lw,{children:[Ai(_,{},"header"),Ai(kn,{title:"Connect your wallet",description:r}),Ai(jt,{children:Ai(xi,{connectOnly:!0})}),e&&Ai(Ci,{app:e,alwaysShowImplicitConsent:!0}),Ai($,{})]})};import{useEffect as Yh,useState as Zh}from"react";import{isMobile as gw}from"react-device-detect";import vw from"styled-components";import{useEffect as Vd,useState as Vo}from"react";import{isMobile as El}from"react-device-detect";import Kh from"styled-components";import{useEffect as qh,useRef as dw}from"react";var pw=(e,t)=>{let r=dw(()=>{});qh(()=>{r.current=e}),qh(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},zh=pw;import{useState as uw,useEffect as mw,useCallback as fw}from"react";function $h(){let[e,t]=uw(!1),r=fw(()=>{document.hidden&&t(!0)},[]);return mw(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as qd,jsx as ht,jsxs as ki}from"react/jsx-runtime";var Gd=2,zd=e=>e?.privyErrorCode==="linked_to_another_user"?Eo.ERROR_USER_EXISTS:e instanceof Ct&&!e.details.default?e.details:e instanceof ni?Eo.ERROR_TIMED_OUT:e instanceof ii?Eo.ERROR_USER_REJECTED_CONNECTION:Eo.ERROR_WALLET_CONNECTION,jh=()=>{let[e,t]=Vo(!1),[r,o]=Vo(!1),[n,i]=Vo(void 0),{authenticated:a,logout:l}=q(),{app:s,navigate:c,navigateBack:m,lastScreen:f,currentScreen:u,setModalData:g}=S(),{getAuthFlow:w,walletConnectionStatus:y,closePrivyModal:b,initLoginWithWallet:P,loginWithWallet:A,updateWallets:T,createAnalyticsEvent:x}=I(),{walletConnectors:R}=q(),[M,D]=Vo(0),{user:B}=q(),[K]=Vo(B?.linkedAccounts.length||0),[j,L]=Vo(""),[N,W]=Vo(""),[ve,Me]=Vo(!1),{hasTabbedAway:Y}=$h(),{enabled:te,token:ee}=be(),_e=El&&y?.connector?.connectorType==="wallet_connect_v2"||El&&y?.connector?.connectorType==="coinbase_wallet"||El&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",Te=y?.status==="connected",ze=y?.status==="switching_to_supported_chain";Vd(()=>{let G=w(),ie=G instanceof bo?G:void 0;if(Te&&!ie&&(te&&!ee&&!a?(g({captchaModalData:{callback:ut=>P(y.connectedWallet,ut).then(()=>{Me(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):P(y.connectedWallet,ee).then(()=>{Me(!0)})),ie&&_e&&Te&&!ie.preparedMessage){ie.buildSiweMessage();return}!ie||_e||!Te||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await nd(2500),await pt()}catch(ut){console.warn("Auto-prompted signature failed",ut)}finally{o(!1)}})()},[M,Te,ve]),Vd(()=>{if(B&&e){let ie=Ne-500;if(s?.legal.requireUsersAcceptTerms&&!B.hasAcceptedTerms){let Xi=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ie);return()=>clearTimeout(Xi)}if(Gt(B,s?.embeddedWallets?.createOnLogin)){let Xi=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:ns=>{console.error(ns),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ns,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ie);return()=>clearTimeout(Xi)}T();let ut=setTimeout(()=>b({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Ne);return()=>clearTimeout(ut)}},[B,e]);let Ve=G=>{if(G?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(G?.privyErrorCode==="max_accounts_reached"){console.error(new wr(G).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(G?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}i(zd(G))};async function pt(){try{await A(),t(!0)}catch(G){Ve(G)}finally{o(!1)}}Vd(()=>{y?.connectError&&Ve(y?.connectError)},[y]),zh(()=>{let G=Fe==="wallet_connect_v2"&&y?.connector instanceof Lr?y.connector.redirectUri:void 0;G&&L(G);let ie=Fe==="wallet_connect_v2"&&y?.connector instanceof Lr?y.connector.fallbackUniversalRedirectUri:void 0;ie&&W(ie)},y?.connector instanceof Lr&&!j?500:null);let Fe=y?.connector?.connectorType||"injected",ae=y?.connector?.walletClientType||"unknown",Ft=_r[ae]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Rr=_r[ae]?.logo||y?.connector?.walletBranding.icon||(G=>ht(si,{...G})),jr=Ft==="Browser Extension"?Ft.toLowerCase():Ft,O;e?O=`Successfully connected with ${jr}`:n?O=n.message:ze?O="Switching networks":Te?O=r&&_e?"Signing":"Sign to verify":O=`Waiting for ${jr}`;let rt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let G=B?.linkedAccounts.length||0;K===G?rt="Wallet was already linked.":rt="You\u2019re good to go!"}else M>=Gd&&n?rt="Unable to connect wallet":n?rt=n.detail:ze?rt="Switch your wallet to the requested network.":Te&&_e?rt="Sign the message in your wallet to verify it belongs to you.":ae==="metamask"&&El?rt="Click continue to open and connect MetaMask.":ae==="metamask"?rt="For the best experience, connect only one wallet at a time.":Fe==="wallet_connect"?rt="Open your mobile wallet app to continue":Fe==="coinbase_wallet"&&(bs()||(bd(B)?rt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":rt="Open the Coinbase app on your phone to continue."));let Mr=R?.walletConnectors?.find(G=>G.walletClientType==="coinbase_wallet"),V=ae==="coinbase_wallet"&&(bd(B)||n===Eo.ERROR_USER_EXISTS);return ki(qd,{children:[ht(_,{backFn:!f||u===f?void 0:m}),ki(hw,{children:[ht($d,{walletLogo:Rr,success:e,fail:!!n}),ki(Xe,{children:[ht("h3",{children:O}),ht("p",{children:rt}),!Te&&j&&!Y?ki("p",{children:["Still here?"," ",ht("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),N&&ki(qd,{children:[" ","or"," ",ht("a",{href:N,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),V?ht(F,{onClick:()=>Mr&&Mr?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Eo.ERROR_USER_EXISTS&&u!==f?ht(F,{onClick:m,children:"Use a different wallet"}):Te&&!e&&_e?ht(F,{onClick:()=>{o(!0),pt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&M<Gd?ht(F,{onClick:()=>{D(M+1),i(void 0),Te?(o(!0),pt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||M>=Gd),children:"Retry"}):!e&&!n?ht(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ht(Z,{})]})},hw=Kh.div`
976
+ `;import{Fragment as Rw,jsx as Pi,jsxs as Iw}from"react/jsx-runtime";var Pw=["coinbase_wallet"],Aw=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],xw=[],kw=["phantom"],Ai=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=_(),o=zo(r.appearance.walletList,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return Iw(Rw,{children:[...o]})},zo=(e,t,r,o,n)=>{let i=[],a=[],l=[],s=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let m=t.filter(({connectorType:f,walletClientType:u})=>u==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(u));for(let f of m){let{walletClientType:u,walletBranding:v}=f;(u==="unknown"?a:i).push(Pi(On,{connectOnly:r,provider:u,logo:v.icon,displayName:v.name,connector:f},`${c}-${u}`))}}else if(kw.includes(c)){let m=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else if(Aw.includes(c)){let m=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&&!m&&(m=s),m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else if(Pw.includes(c)){let m=t.find(({connectorType:f})=>f===c);m&&i.push(Pi(On,{connectOnly:r,provider:c,connector:m},c))}else xw.includes(c)?s&&l.push(Pi(On,{connectOnly:r,provider:c,connector:s},c)):c==="wallet_connect"&&s&&l.push(Pi(On,{connectOnly:r,provider:c,connector:s},c));return[...a,...i,...l]};import{Fragment as Mw,jsx as Pa,jsxs as Ww}from"react/jsx-runtime";var jh=()=>{let{app:e}=_(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${ct(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Ww(Mw,{children:[Pa(A,{},"header"),Pa(ao,{title:"Connect your wallet",description:r}),Pa(Yt,{children:Pa(Ai,{connectOnly:!0})}),Pa(z,{})]})};import{Fragment as Ow,jsx as xi,jsxs as Lw}from"react/jsx-runtime";var Yh=()=>{let{app:e}=_(),{linkingOrConnectingHint:t}=M(),r=t?`Connect the wallet with address ${ct(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Lw(Ow,{children:[xi(A,{},"header"),xi(Mn,{title:"Connect your wallet",description:r}),xi(Yt,{children:xi(Ai,{connectOnly:!0})}),e&&xi(Ci,{app:e,alwaysShowImplicitConsent:!0}),xi(z,{})]})};import{useEffect as ty,useState as ry}from"react";import{isMobile as Vw}from"react-device-detect";import qw from"styled-components";import{useEffect as jd,useState as $o}from"react";import{isMobile as Al}from"react-device-detect";import Xh from"styled-components";import{useEffect as Zh,useRef as Nw}from"react";var Dw=(e,t)=>{let r=Nw(()=>{});Zh(()=>{r.current=e}),Zh(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Qh=Dw;import{useState as Uw,useEffect as Fw,useCallback as Bw}from"react";function Jh(){let[e,t]=Uw(!1),r=Bw(()=>{document.hidden&&t(!0)},[]);return Fw(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Zd,jsx as ht,jsxs as ki}from"react/jsx-runtime";var Yd=2,Qd=e=>e?.privyErrorCode==="linked_to_another_user"?_o.ERROR_USER_EXISTS:e instanceof Ct&&!e.details.default?e.details:e instanceof ai?_o.ERROR_TIMED_OUT:e instanceof si?_o.ERROR_USER_REJECTED_CONNECTION:_o.ERROR_WALLET_CONNECTION,ey=()=>{let[e,t]=$o(!1),[r,o]=$o(!1),[n,i]=$o(void 0),{authenticated:a,logout:l}=q(),{app:s,navigate:c,navigateBack:m,lastScreen:f,currentScreen:u,setModalData:v}=_(),{getAuthFlow:g,walletConnectionStatus:y,closePrivyModal:b,initLoginWithWallet:T,loginWithWallet:k,updateWallets:E,createAnalyticsEvent:P}=M(),{walletConnectors:x}=q(),[I,N]=$o(0),{user:H}=q(),[K]=$o(H?.linkedAccounts.length||0),[j,O]=$o(""),[D,W]=$o(""),[ve,Ie]=$o(!1),{hasTabbedAway:Y}=Jh(),{enabled:X,token:te}=be(),_e=Al&&y?.connector?.connectorType==="wallet_connect_v2"||Al&&y?.connector?.connectorType==="coinbase_wallet"||Al&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",Te=y?.status==="connected",Ke=y?.status==="switching_to_supported_chain";jd(()=>{let V=g(),ie=V instanceof To?V:void 0;if(Te&&!ie&&(X&&!te&&!a?(v({captchaModalData:{callback:mt=>T(y.connectedWallet,mt).then(()=>{Ie(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):T(y.connectedWallet,te).then(()=>{Ie(!0)})),ie&&_e&&Te&&!ie.preparedMessage){ie.buildSiweMessage();return}!ie||_e||!Te||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await cd(2500),await ut()}catch(mt){console.warn("Auto-prompted signature failed",mt)}finally{o(!1)}})()},[I,Te,ve]),jd(()=>{if(H&&e){let ie=Ne-500;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let ea=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ie);return()=>clearTimeout(ea)}if(qt(H,s?.embeddedWallets?.createOnLogin)){let ea=setTimeout(()=>{v({createWallet:{onSuccess:()=>{},onFailure:cs=>{console.error(cs),P({eventName:"embedded_wallet_creation_failure_logout",payload:{error:cs,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ie);return()=>clearTimeout(ea)}E();let mt=setTimeout(()=>b({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Ne);return()=>clearTimeout(mt)}},[H,e]);let Ge=V=>{if(V?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(V?.privyErrorCode==="max_accounts_reached"){console.error(new br(V).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(V?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}i(Qd(V))};async function ut(){try{await k(),t(!0)}catch(V){Ge(V)}finally{o(!1)}}jd(()=>{y?.connectError&&Ge(y?.connectError)},[y]),Qh(()=>{let V=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.redirectUri:void 0;V&&O(V);let ie=Fe==="wallet_connect_v2"&&y?.connector instanceof Dr?y.connector.fallbackUniversalRedirectUri:void 0;ie&&W(ie)},y?.connector instanceof Dr&&!j?500:null);let Fe=y?.connector?.connectorType||"injected",se=y?.connector?.walletClientType||"unknown",Ft=Ar[se]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Wr=Ar[se]?.logo||y?.connector?.walletBranding.icon||(V=>ht(ci,{...V})),Zr=Ft==="Browser Extension"?Ft.toLowerCase():Ft,L;e?L=`Successfully connected with ${Zr}`:n?L=n.message:Ke?L="Switching networks":Te?L=r&&_e?"Signing":"Sign to verify":L=`Waiting for ${Zr}`;let rt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let V=H?.linkedAccounts.length||0;K===V?rt="Wallet was already linked.":rt="You\u2019re good to go!"}else I>=Yd&&n?rt="Unable to connect wallet":n?rt=n.detail:Ke?rt="Switch your wallet to the requested network.":Te&&_e?rt="Sign the message in your wallet to verify it belongs to you.":se==="metamask"&&Al?rt="Click continue to open and connect MetaMask.":se==="metamask"?rt="For the best experience, connect only one wallet at a time.":Fe==="wallet_connect"?rt="Open your mobile wallet app to continue":Fe==="coinbase_wallet"&&(Ps()||(xd(H)?rt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":rt="Open the Coinbase app on your phone to continue."));let Or=x?.walletConnectors?.find(V=>V.walletClientType==="coinbase_wallet"),G=se==="coinbase_wallet"&&(xd(H)||n===_o.ERROR_USER_EXISTS);return ki(Zd,{children:[ht(A,{backFn:!f||u===f?void 0:m}),ki(Hw,{children:[ht(Jd,{walletLogo:Wr,success:e,fail:!!n}),ki(qe,{children:[ht("h3",{children:L}),ht("p",{children:rt}),!Te&&j&&!Y?ki("p",{children:["Still here?"," ",ht("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),D&&ki(Zd,{children:[" ","or"," ",ht("a",{href:D,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),G?ht(B,{onClick:()=>Or&&Or?.disconnect(),disabled:e,children:"Use a different wallet"}):n==_o.ERROR_USER_EXISTS&&u!==f?ht(B,{onClick:m,children:"Use a different wallet"}):Te&&!e&&_e?ht(B,{onClick:()=>{o(!0),ut()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&I<Yd?ht(B,{onClick:()=>{N(I+1),i(void 0),Te?(o(!0),ut()):y?.connectRetry()},disabled:!e&&(!n?.retryable||I>=Yd),children:"Retry"}):!e&&!n?ht(B,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ht(Z,{})]})},Hw=Xh.div`
963
977
  display: flex;
964
978
  flex-direction: column;
965
979
  align-items: center;
966
980
  justify-content: center;
967
981
  gap: 24px;
968
982
  width: 100%;
969
- `,yw=Kh.div`
983
+ `,Gw=Xh.div`
970
984
  display: flex;
971
985
  flex-direction: column;
972
986
  justify-content: center;
@@ -989,14 +1003,14 @@ Resources:
989
1003
  left: -19px;
990
1004
  top: -19px;
991
1005
  }
992
- `,$d=e=>{let t=e.walletLogo;return ht(qd,{children:ht(yw,{children:ki("div",{children:[ht(ot,{success:e.success,fail:e.fail}),typeof t=="string"?ht("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ht(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as ww,jsx as So,jsxs as Kd}from"react/jsx-runtime";var Tl=2,Qh=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=S(),{walletConnectionStatus:i,closePrivyModal:a}=I(),[l,s]=Zh(void 0),[c,m]=Zh(0),f=i?.status==="connected",u=i?.status==="switching_to_supported_chain";Yh(()=>{if(f){let R;if(n?.externalConnectWallet?.onCompleteNavigateTo){let M=n.externalConnectWallet.onCompleteNavigateTo;R=setTimeout(()=>{t(M)},Ne)}else R=setTimeout(a,Ne);return()=>clearTimeout(R)}},[f]);let g=R=>{s(zd(R))};Yh(()=>{i?.connectError&&g(i?.connectError)},[i]);let w=i?.connector?.connectorType||"injected",y=i?.connector?.walletClientType||"unknown",b=_r[y]?.displayName||i?.connector?.walletBranding.name||"Browser Extension",P=_r[y]?.logo||i?.connector?.walletBranding.icon||(R=>So(si,{...R})),A=b==="Browser Extension"?b.toLowerCase():b,T;f?T=`Successfully connected with ${A}`:l?T=l.message:u?T="Switching networks":T=`Waiting for ${A}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return f?x="You\u2019re good to go!":c>=Tl&&l?x="Unable to connect wallet":l?x=l.detail:u?x="Switch your wallet to the requested network.":y==="metamask"&&gw?x="Click to continue to open and connect MetaMask.":y==="metamask"?x="For the best experience, connect only one wallet at a time.":w==="wallet_connect_v2"?x="Open your mobile wallet app to continue":w==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),Kd(ww,{children:[So(_,{backFn:o===r?void 0:e}),Kd(Cw,{children:[So($d,{walletLogo:P,success:f,fail:!!l}),Kd(Xe,{children:[So("h3",{children:T}),So("p",{children:x})]}),l==Eo.ERROR_USER_EXISTS?So(F,{onClick:e,children:"Use a different wallet"}):!f&&l?.retryable&&c<Tl?So(F,{onClick:()=>{m(c+1),s(void 0),i?.connectRetry()},disabled:!f&&(!l?.retryable||c>=Tl),children:"Retry"}):!f&&l&&c>=Tl?So(F,{onClick:e,children:"Use a different wallet"}):null]}),So(Z,{})]})},Cw=vw.div`
1006
+ `,Jd=e=>{let t=e.walletLogo;return ht(Zd,{children:ht(Gw,{children:ki("div",{children:[ht(ot,{success:e.success,fail:e.fail}),typeof t=="string"?ht("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ht(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as $w,jsx as Ao,jsxs as Xd}from"react/jsx-runtime";var xl=2,oy=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=_(),{walletConnectionStatus:i,closePrivyModal:a}=M(),[l,s]=ry(void 0),[c,m]=ry(0),f=i?.status==="connected",u=i?.status==="switching_to_supported_chain";ty(()=>{if(f){let x;if(n?.externalConnectWallet?.onCompleteNavigateTo){let I=n.externalConnectWallet.onCompleteNavigateTo;x=setTimeout(()=>{t(I)},Ne)}else x=setTimeout(a,Ne);return()=>clearTimeout(x)}},[f]);let v=x=>{s(Qd(x))};ty(()=>{i?.connectError&&v(i?.connectError)},[i]);let g=i?.connector?.connectorType||"injected",y=i?.connector?.walletClientType||"unknown",b=Ar[y]?.displayName||i?.connector?.walletBranding.name||"Browser Extension",T=Ar[y]?.logo||i?.connector?.walletBranding.icon||(x=>Ao(ci,{...x})),k=b==="Browser Extension"?b.toLowerCase():b,E;f?E=`Successfully connected with ${k}`:l?E=l.message:u?E="Switching networks":E=`Waiting for ${k}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return f?P="You\u2019re good to go!":c>=xl&&l?P="Unable to connect wallet":l?P=l.detail:u?P="Switch your wallet to the requested network.":y==="metamask"&&Vw?P="Click to continue to open and connect MetaMask.":y==="metamask"?P="For the best experience, connect only one wallet at a time.":g==="wallet_connect_v2"?P="Open your mobile wallet app to continue":g==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),Xd($w,{children:[Ao(A,{backFn:o===r?void 0:e}),Xd(zw,{children:[Ao(Jd,{walletLogo:T,success:f,fail:!!l}),Xd(qe,{children:[Ao("h3",{children:E}),Ao("p",{children:P})]}),l==_o.ERROR_USER_EXISTS?Ao(B,{onClick:e,children:"Use a different wallet"}):!f&&l?.retryable&&c<xl?Ao(B,{onClick:()=>{m(c+1),s(void 0),i?.connectRetry()},disabled:!f&&(!l?.retryable||c>=xl),children:"Retry"}):!f&&l&&c>=xl?Ao(B,{onClick:e,children:"Use a different wallet"}):null]}),Ao(Z,{})]})},zw=qw.div`
993
1007
  display: flex;
994
1008
  flex-direction: column;
995
1009
  align-items: center;
996
1010
  justify-content: center;
997
1011
  gap: 24px;
998
1012
  width: 100%;
999
- `;import{useEffect as ey,useMemo as bw,useState as Ew}from"react";import Tw from"styled-components";import{jsx as Jh}from"react/jsx-runtime";var Xh=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?Jh("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):Jh("span",{})};import{Fragment as _w,jsx as _o,jsxs as Sl}from"react/jsx-runtime";var ty=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=S(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=I(),[i,a]=Ew({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=Ne,c=new C(`There was an issue connecting your ${l.name} account. Please try again.`),m=new Oe(async w=>{if(!e?.crossAppAuth?.popup){a({error:c});return}try{let y=await r({appId:w,popup:e.crossAppAuth.popup});a({data:y})}catch(y){y instanceof C?a({error:y}):y instanceof Rt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),a({error:c})):a({error:c})}}),f=()=>{i.data&&(o(),e?.crossAppAuth?.onSuccess(i.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(i.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,ey(()=>{l.id.length&&m.execute(l.id)},[l.id]),ey(()=>{if(!i.data)return;let w=setTimeout(f,s);return()=>clearTimeout(w)},[i.data]);let{title:u,subtitle:g}=bw(()=>i.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:i.error?{title:"Authentication failed",subtitle:i.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[i,l.name]);return Sl(_w,{children:[_o(_,{onClose:f}),_o(oe,{}),Sl(Sw,{children:[_o(Je,{children:Sl("div",{children:[_o(ot,{success:!!i.data,fail:!!i.error}),_o(Xh,{name:l.name,logoUrl:l.logoUrl})]})}),Sl(Xe,{children:[_o("h3",{children:u}),_o("p",{children:g})]})]}),_o(ne,{}),_o(Z,{})]})},Sw=Tw.div`
1013
+ `;import{useEffect as ay,useMemo as Kw,useState as jw}from"react";import Yw from"styled-components";import{jsx as ny}from"react/jsx-runtime";var iy=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?ny("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):ny("span",{})};import{Fragment as Qw,jsx as xo,jsxs as kl}from"react/jsx-runtime";var sy=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=_(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=M(),[i,a]=jw({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=Ne,c=new w(`There was an issue connecting your ${l.name} account. Please try again.`),m=new Le(async g=>{if(!e?.crossAppAuth?.popup){a({error:c});return}try{let y=await r({appId:g,popup:e.crossAppAuth.popup});a({data:y})}catch(y){y instanceof w?a({error:y}):y instanceof Mt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),a({error:c})):a({error:c})}}),f=()=>{i.data&&(o(),e?.crossAppAuth?.onSuccess(i.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(i.error??new w("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,ay(()=>{l.id.length&&m.execute(l.id)},[l.id]),ay(()=>{if(!i.data)return;let g=setTimeout(f,s);return()=>clearTimeout(g)},[i.data]);let{title:u,subtitle:v}=Kw(()=>i.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:i.error?{title:"Authentication failed",subtitle:i.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[i,l.name]);return kl(Qw,{children:[xo(A,{onClose:f}),xo(oe,{}),kl(Zw,{children:[xo(Je,{children:kl("div",{children:[xo(ot,{success:!!i.data,fail:!!i.error}),xo(iy,{name:l.name,logoUrl:l.logoUrl})]})}),kl(qe,{children:[xo("h3",{children:u}),xo("p",{children:v})]})]}),xo(ne,{}),xo(Z,{})]})},Zw=Yw.div`
1000
1014
  display: flex;
1001
1015
  flex-direction: column;
1002
1016
  align-items: center;
@@ -1004,7 +1018,7 @@ Resources:
1004
1018
  margin-left: 27px;
1005
1019
  margin-right: 27px;
1006
1020
  gap: 24px;
1007
- `;import Iw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ww,useMemo as Lw,useState as Ow}from"react";import Nw from"styled-components";import _l from"styled-components";import{jsx as jd,jsxs as Rw}from"react/jsx-runtime";var Pl=()=>jd(Pw,{children:Rw(xw,{children:[jd(Aw,{}),jd(kw,{})]})}),Pw=_l.div`
1021
+ `;import n4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as i4,useMemo as a4,useState as s4}from"react";import l4 from"styled-components";import Rl from"styled-components";import{jsx as ep,jsxs as r4}from"react/jsx-runtime";var Il=()=>ep(Jw,{children:r4(Xw,{children:[ep(e4,{}),ep(t4,{})]})}),Jw=Rl.div`
1008
1022
  display: flex;
1009
1023
  justify-content: center;
1010
1024
  align-items: center;
@@ -1016,14 +1030,14 @@ Resources:
1016
1030
  @media all and (display-mode: standalone) {
1017
1031
  margin-bottom: 30px;
1018
1032
  }
1019
- `,xw=_l.div`
1033
+ `,Xw=Rl.div`
1020
1034
  position: relative;
1021
1035
  height: 140px;
1022
1036
  width: 140px;
1023
1037
 
1024
1038
  opacity: 1;
1025
1039
  animation: fadein 200ms ease;
1026
- `,Aw=_l.div`
1040
+ `,e4=Rl.div`
1027
1041
  position: absolute;
1028
1042
  top: 0;
1029
1043
  right: 0;
@@ -1036,7 +1050,7 @@ Resources:
1036
1050
  border: 4px solid var(--privy-color-accent-light);
1037
1051
  border-radius: 50%;
1038
1052
  }
1039
- `,kw=_l.div`
1053
+ `,t4=Rl.div`
1040
1054
  position: absolute;
1041
1055
  top: 0;
1042
1056
  right: 0;
@@ -1060,20 +1074,20 @@ Resources:
1060
1074
  transform: rotate(360deg);
1061
1075
  }
1062
1076
  }
1063
- `;var ry=["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 We=class extends Error{constructor(r,o){super(o);this.type=r}};function Ri(e){let t=e.type;return typeof t=="string"&&ry.includes(t)}function Mw(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function In(e){return Ri(e)&&e.type==="wallet_not_on_device"}function oy(e){return Ri(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Wn(e){return!!(Ri(e)&&e.type==="mfa_timeout")}function Ln(e){return!!(Ri(e)&&e.type==="missing_or_invalid_mfa")}function Yd(e){return!!(Ri(e)&&e.type==="mfa_verification_max_attempts_reached")}function xl(e){return!!(Ri(e)&&e.message.includes("code 429"))}function Al(e){return!!(Mw(e)&&e.message==="MFA canceled")}function Zd({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function kl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?Zd({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Rl(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 Qd({api:e,provider:t}){let r=gn(),o=ti(),n=await ri(r);try{return t==="icloud"?{url:(await e.post(Uu,{client_type:"web"})).url}:{url:(await e.post(Du,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw le(i)}}async function ny({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(Fu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=le(i);throw a.privyErrorCode?new C(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.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 ay,jsx as Mi,jsxs as Jd}from"react/jsx-runtime";var iy=1,sy=()=>{let{authenticated:e,user:t,getAccessToken:r}=q(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=I(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=S(),m=Lw(()=>Date.now(),[]),[f,u]=Ow(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:y,address:b}=l?.connectWallet,P=T=>{f||(u(!0),w(typeof T=="string"?new Error(T):T))};Ww(()=>{let T=b?t?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"&&M.address===b):he(t),x;return!e||!T?P("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let M=await r();if(!M)return P("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:M,address:T.address}),y&&await i.verifyMfa({accessToken:M});let D=(Date.now()-m)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<iy?x=setTimeout(()=>{a(g)},(iy-D)*1e3):a(g)}catch(D){if(In(D)&&T.recoveryMethod==="privy"){let B=await r();if(!B)return P("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:T.address}}),(await i?.recover({address:T.address,accessToken:B,recoveryMethod:T.recoveryMethod}))?.address||P(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}}),a(g)}catch{P("An error has occurred, please try again.")}}else if(In(D)&&T.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:T.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let B=Rl(T.recoveryMethod);a(B)}else P(D)}})(),()=>clearTimeout(x)):void 0},[e,t,i]);let A=()=>{P("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=A,Jd(ay,{children:[Mi(_,{onClose:A}),f?Jd(ay,{children:[Jd(ir,{children:[Mi(Iw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Mi(ye,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Mi(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Mi(Pl,{}),Mi(Dw,{})]})},Dw=Nw.div`
1077
+ `;var ly=["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 We=class extends Error{constructor(r,o){super(o);this.type=r}};function Ri(e){let t=e.type;return typeof t=="string"&&ly.includes(t)}function o4(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Ln(e){return Ri(e)&&e.type==="wallet_not_on_device"}function cy(e){return Ri(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Nn(e){return!!(Ri(e)&&e.type==="mfa_timeout")}function Dn(e){return!!(Ri(e)&&e.type==="missing_or_invalid_mfa")}function tp(e){return!!(Ri(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ml(e){return!!(Ri(e)&&e.message.includes("code 429"))}function Wl(e){return!!(o4(e)&&e.message==="MFA canceled")}function rp({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Ol({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?rp({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Ll(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 op({api:e,provider:t}){let r=bn(),o=oi(),n=await ni(r);try{return t==="icloud"?{url:(await e.post(Hu,{client_type:"web"})).url}:{url:(await e.post(Bu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw le(i)}}async function dy({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during OAuth flow");try{return(await e.post(Gu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as uy,jsx as Ii,jsxs as np}from"react/jsx-runtime";var py=1,my=()=>{let{authenticated:e,user:t,getAccessToken:r}=q(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),m=a4(()=>Date.now(),[]),[f,u]=s4(!1),{onCompleteNavigateTo:v,onFailure:g,shouldForceMFA:y,address:b}=l?.connectWallet,T=E=>{f||(u(!0),g(typeof E=="string"?new Error(E):E))};i4(()=>{let E=b?t?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"&&I.address===b):he(t),P;return!e||!E?T("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await r();if(!I)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:E.address}),y&&await i.verifyMfa({accessToken:I});let N=(Date.now()-m)/1e3;v==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&N<py?P=setTimeout(()=>{a(v)},(py-N)*1e3):a(v)}catch(N){if(Ln(N)&&E.recoveryMethod==="privy"){let H=await r();if(!H)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:E.address}}),(await i?.recover({address:E.address,accessToken:H,recoveryMethod:E.recoveryMethod}))?.address||T(new Error("Unable to recover wallet")),v?a(v):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:E.address}}),a(v)}catch{T("An error has occurred, please try again.")}}else if(Ln(N)&&E.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:v,onFailure:g},recoveryOAuthStatus:{provider:E.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=Ll(E.recoveryMethod);a(H)}else T(N)}})(),()=>clearTimeout(P)):void 0},[e,t,i]);let k=()=>{T("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=k,np(uy,{children:[Ii(A,{onClose:k}),f?np(uy,{children:[np(ir,{children:[Ii(n4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ii(ye,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Ii(B,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Ii(Il,{}),Ii(c4,{})]})},c4=l4.div`
1064
1078
  height: 44px;
1065
- `;import Uw from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Fw}from"react";import{Fragment as Bw,jsx as Ii,jsxs as ly}from"react/jsx-runtime";var cy=()=>{let{user:e}=q(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=I(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let f=he(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Fw(()=>{let f=setTimeout(m,As);return()=>clearTimeout(f)},[]),a.current=m,ly(Bw,{children:[Ii(_,{onClose:m}),Ii(oe,{}),ly(ir,{children:[Ii(Uw,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Ii(ye,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Ii(ne,{}),Ii($,{})]})};import Hw from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Vw from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as uy,useRef as Gw,useState as Xd}from"react";import Go from"styled-components";import{Fragment as Jw,jsx as ct,jsxs as Hr}from"react/jsx-runtime";var my=()=>{let[e,t]=Xd(null),{authenticated:r,user:o,getAccessToken:n}=q(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=I(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),m=he(o)?.address,{onFailure:f,onSuccess:u,origin:g,appId:w,appClientId:y}=s.keyExport,b=A=>{i({shouldCallAuthOnSuccess:!1}),f(typeof A=="string"?new Error(A):A)},P=()=>{i({shouldCallAuthOnSuccess:!1}),u(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:m}})};return uy(()=>{let A=he(o);if(!r||!A)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[r,o]),c.current=P,Hr(Jw,{children:[ct(_,{onClose:P}),Hr($w,{children:[Hr(ye,{icon:ct(Vw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Hr(Zw,{children:[ct(zw,{style:{marginRight:6}}),Qe(m)]}),ct("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Hr(Kw,{children:[Hr(dy,{children:[ct(py,{children:"1"}),Hr("span",{children:[ct("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."]})]}),Hr(dy,{children:[ct(py,{children:"2"}),ct("span",{children:"Copy this key into your other wallet"})]})]}),ct("div",{style:{width:"100%"},children:e&&ct(qw,{origin:g,appId:w,appClientId:y,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),Hr(Qw,{children:[Hr("div",{children:[ct(Hw,{viewBox:"0 0 20 18"}),ct("h4",{children:"Warning"})]}),ct("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ct($,{})]})};function qw(e){let[t,r]=Xd(e.dimensions.width),[o,n]=Xd(void 0),i=Gw(null);return uy(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),ct("div",{ref:i,children:t&&Hr(jw,{children:[ct("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ts(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})}),ct(Yw,{children:"Loading..."})]})})}function zw(e){return ct("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ct("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 $w=Go.div`
1079
+ `;import d4 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as p4}from"react";import{Fragment as u4,jsx as Mi,jsxs as fy}from"react/jsx-runtime";var hy=()=>{let{user:e}=q(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let f=he(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return p4(()=>{let f=setTimeout(m,Ws);return()=>clearTimeout(f)},[]),a.current=m,fy(u4,{children:[Mi(A,{onClose:m}),Mi(oe,{}),fy(ir,{children:[Mi(d4,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Mi(ye,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Mi(ne,{}),Mi(z,{})]})};import m4 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import f4 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as vy,useRef as h4,useState as ip}from"react";import Ko from"styled-components";import{Fragment as S4,jsx as dt,jsxs as Vr}from"react/jsx-runtime";var Cy=()=>{let[e,t]=ip(null),{authenticated:r,user:o,getAccessToken:n}=q(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),m=he(o)?.address,{onFailure:f,onSuccess:u,origin:v,appId:g,appClientId:y}=s.keyExport,b=k=>{i({shouldCallAuthOnSuccess:!1}),f(typeof k=="string"?new Error(k):k)},T=()=>{i({shouldCallAuthOnSuccess:!1}),u(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:m}})};return vy(()=>{let k=he(o);if(!r||!k)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[r,o]),c.current=T,Vr(S4,{children:[dt(A,{onClose:T}),Vr(v4,{children:[Vr(ye,{icon:dt(f4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Vr(E4,{children:[dt(g4,{style:{marginRight:6}}),ct(m)]}),dt("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Vr(C4,{children:[Vr(yy,{children:[dt(gy,{children:"1"}),Vr("span",{children:[dt("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."]})]}),Vr(yy,{children:[dt(gy,{children:"2"}),dt("span",{children:"Copy this key into your other wallet"})]})]}),dt("div",{style:{width:"100%"},children:e&&dt(y4,{origin:v,appId:g,appClientId:y,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),Vr(T4,{children:[Vr("div",{children:[dt(m4,{viewBox:"0 0 20 18"}),dt("h4",{children:"Warning"})]}),dt("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),dt(z,{})]})};function y4(e){let[t,r]=ip(e.dimensions.width),[o,n]=ip(void 0),i=h4(null);return vy(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),dt("div",{ref:i,children:t&&Vr(w4,{children:[dt("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:xs(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})}),dt(b4,{children:"Loading..."})]})})}function g4(e){return dt("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:dt("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 v4=Ko.div`
1066
1080
  display: flex;
1067
1081
  flex-direction: column;
1068
1082
  text-align: left;
1069
- `,Kw=Go.div`
1083
+ `,C4=Ko.div`
1070
1084
  display: flex;
1071
1085
  flex-direction: column;
1072
1086
  gap: 24px;
1073
1087
  padding-bottom: 16px;
1074
1088
  margin-left: 11px;
1075
1089
  border-left: 1px solid var(--privy-color-foreground-4) !important;
1076
- `,dy=Go.div`
1090
+ `,yy=Ko.div`
1077
1091
  display: flex;
1078
1092
  align-items: top;
1079
1093
  gap: 8px;
@@ -1082,7 +1096,7 @@ Resources:
1082
1096
  color: var(--privy-color-accent);
1083
1097
  text-decoration: underline;
1084
1098
  }
1085
- `,py=Go.div`
1099
+ `,gy=Ko.div`
1086
1100
  display: flex;
1087
1101
  align-items: center;
1088
1102
  justify-content: center;
@@ -1096,11 +1110,11 @@ Resources:
1096
1110
  border-radius: 100%;
1097
1111
  background: var(--privy-color-background);
1098
1112
  color: var(--privy-color-accent);
1099
- `,jw=Go.div`
1113
+ `,w4=Ko.div`
1100
1114
  overflow: visible;
1101
1115
  position: relative;
1102
1116
  height: 44px;
1103
- `,Yw=Go.div`
1117
+ `,b4=Ko.div`
1104
1118
  position: absolute;
1105
1119
  display: flex;
1106
1120
  align-items: center;
@@ -1112,7 +1126,7 @@ Resources:
1112
1126
  border-radius: var(--privy-border-radius-md);
1113
1127
  background-color: var(--privy-color-background-2);
1114
1128
  color: var(--privy-color-foreground-3);
1115
- `,Zw=Go.div`
1129
+ `,E4=Ko.div`
1116
1130
  display: flex;
1117
1131
  align-items: center;
1118
1132
  padding-top: 1px;
@@ -1125,7 +1139,7 @@ Resources:
1125
1139
  font-size: 12px;
1126
1140
  font-weight: 500;
1127
1141
  margin: auto;
1128
- `,Qw=Go.div`
1142
+ `,T4=Ko.div`
1129
1143
  border: 1px solid var(--privy-color-background-2) !important;
1130
1144
  border-radius: var(--privy-border-radius-md);
1131
1145
  padding: 16px;
@@ -1147,9 +1161,9 @@ Resources:
1147
1161
  color: var(--privy-color-error);
1148
1162
  }
1149
1163
  }
1150
- `;import t4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as r4,useState as fy}from"react";import o4 from"styled-components";import{useCallback as Xw,useRef as e4}from"react";function Ml(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=I(),o=e4(!1);return{createWallet:Xw(async i=>{let a=await we();if(!a)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 l=await r(ei);if(!l)throw new Error("walletProxy does not exist.");let s=2e4,c=new Promise((g,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),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 u=he(f);if(!u)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:u.address}}),o.current=!0,u}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as i4,jsx as Wi,jsxs as hy}from"react/jsx-runtime";var yy=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=S(),[i,a]=fy(""),{embeddedWallets:l}=Ge(),{authenticated:s}=q(),{closePrivyModal:c}=I(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:u}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=Ml(),[y,b]=fy(null),P=new Oe(async()=>{try{let T=await w();if(!T)return;b(T),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(T){a(T.message)}});r4(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let T=kl({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(T)}P.execute()},[g,s]);let A=()=>{y?(m(y),c({shouldCallAuthOnSuccess:u})):(f(new Mt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?hy(i4,{children:[Wi(_,{closeable:!1}),hy(ir,{children:[Wi(t4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Wi(ye,{title:"Something went wrong",description:i})]}),Wi(F,{onClick:A,children:"Close"}),Wi(n4,{})]}):Wi(Pl,{})},n4=o4.div`
1164
+ `;import A4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as x4,useState as wy}from"react";import k4 from"styled-components";import{useCallback as _4,useRef as P4}from"react";function Nl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=P4(!1);return{createWallet:_4(async i=>{let a=await we();if(!a)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 l=await r(ri);if(!l)throw new Error("walletProxy does not exist.");let s=2e4,c=new Promise((v,g)=>{setTimeout(()=>{g(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),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 u=he(f);if(!u)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:u.address}}),o.current=!0,u}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as I4,jsx as Wi,jsxs as by}from"react/jsx-runtime";var Ey=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),[i,a]=wy(""),{embeddedWallets:l}=Ve(),{authenticated:s}=q(),{closePrivyModal:c}=M(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:u}=o.createWallet,v=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:g}=Nl(),[y,b]=wy(null),T=new Le(async()=>{try{let E=await g();if(!E)return;b(E),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(E){a(E.message)}});x4(()=>{if(!s){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 E=Ol({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(E)}T.execute()},[v,s]);let k=()=>{y?(m(y),c({shouldCallAuthOnSuccess:u})):(f(new Wt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?by(I4,{children:[Wi(A,{closeable:!1}),by(ir,{children:[Wi(A4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Wi(ye,{title:"Something went wrong",description:i})]}),Wi(B,{onClick:k,children:"Close"}),Wi(R4,{})]}):Wi(Il,{})},R4=k4.div`
1151
1165
  height: 44px;
1152
- `;import{useEffect as J4,useState as Nl}from"react";import{useCallback as ap,useEffect as Q4}from"react";import d4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as p4,useState as rp}from"react";import a4 from"@heroicons/react/24/outline/ArrowPathIcon";import s4 from"@heroicons/react/24/outline/EyeIcon";import l4 from"@heroicons/react/24/outline/EyeSlashIcon";import _t,{css as ep}from"styled-components";var c4=ep`
1166
+ `;import{useEffect as S5,useState as Hl}from"react";import{useCallback as up,useEffect as T5}from"react";import N4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as D4,useState as lp}from"react";import M4 from"@heroicons/react/24/outline/ArrowPathIcon";import W4 from"@heroicons/react/24/outline/EyeIcon";import O4 from"@heroicons/react/24/outline/EyeSlashIcon";import _t,{css as ap}from"styled-components";var L4=ap`
1153
1167
  font-size: 14px;
1154
1168
  font-style: normal;
1155
1169
  font-weight: 400;
@@ -1157,8 +1171,8 @@ Resources:
1157
1171
  letter-spacing: -0.008px;
1158
1172
  text-align: left;
1159
1173
  transition: color 0.1s ease-in;
1160
- `,Il=_t.span`
1161
- ${c4}
1174
+ `,Dl=_t.span`
1175
+ ${L4}
1162
1176
  transition: color 0.1s ease-in;
1163
1177
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1164
1178
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1166,18 +1180,18 @@ Resources:
1166
1180
  &[aria-hidden='true'] {
1167
1181
  visibility: hidden;
1168
1182
  }
1169
- `,qo=_t.div`
1183
+ `,jo=_t.div`
1170
1184
  display: flex;
1171
1185
  flex-direction: column;
1172
1186
  justify-content: center;
1173
1187
  flex-grow: 1;
1174
- `,zo=_t(F)`
1175
- ${e=>e.hideAnimations&&ep`
1188
+ `,Yo=_t(B)`
1189
+ ${e=>e.hideAnimations&&ap`
1176
1190
  && {
1177
1191
  transition: none;
1178
1192
  }
1179
1193
  `}
1180
- `,gy=ep`
1194
+ `,Ty=ap`
1181
1195
  && {
1182
1196
  width: 100%;
1183
1197
  border-width: 1px;
@@ -1192,8 +1206,8 @@ Resources:
1192
1206
  font-weight: 300;
1193
1207
  line-height: 22px; /* 137.5% */
1194
1208
  }
1195
- `,Li=_t.input`
1196
- ${gy}
1209
+ `,Oi=_t.input`
1210
+ ${Ty}
1197
1211
 
1198
1212
  &::placeholder {
1199
1213
  color: var(--privy-color-foreground-3);
@@ -1204,15 +1218,15 @@ Resources:
1204
1218
  overflow: hidden;
1205
1219
  text-overflow: ellipsis;
1206
1220
  white-space: nowrap;
1207
- `,vy=_t.div`
1208
- ${gy}
1209
- `,$o=_t.div`
1221
+ `,Sy=_t.div`
1222
+ ${Ty}
1223
+ `,Zo=_t.div`
1210
1224
  position: relative;
1211
1225
  width: 100%;
1212
1226
  display: flex;
1213
1227
  align-items: center;
1214
1228
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1215
- `,Ko=_t.div`
1229
+ `,Qo=_t.div`
1216
1230
  display: flex;
1217
1231
  flex-direction: column;
1218
1232
  align-items: center;
@@ -1234,12 +1248,12 @@ Resources:
1234
1248
  font-weight: 400;
1235
1249
  line-height: 20px;
1236
1250
  }
1237
- `,_a=_t.div`
1251
+ `,Aa=_t.div`
1238
1252
  display: flex;
1239
1253
  flex-direction: column;
1240
1254
  gap: 10px;
1241
1255
  padding-bottom: 1rem;
1242
- `,Pa=_t.div`
1256
+ `,xa=_t.div`
1243
1257
  display: flex;
1244
1258
  text-align: left;
1245
1259
  align-items: center;
@@ -1259,13 +1273,13 @@ Resources:
1259
1273
  > :first-child {
1260
1274
  min-width: 24px;
1261
1275
  }
1262
- `,ZD=_t.div`
1276
+ `,$U=_t.div`
1263
1277
  height: var(--privy-height-modal-full);
1264
1278
 
1265
1279
  @media (max-width: 440px) {
1266
1280
  height: var(--privy-height-modal-compact);
1267
1281
  }
1268
- `,tp=_t(ya)`
1282
+ `,sp=_t(va)`
1269
1283
  display: flex;
1270
1284
  flex: 1;
1271
1285
  gap: 4px;
@@ -1277,7 +1291,7 @@ Resources:
1277
1291
  border-color: var(--privy-color-foreground-3);
1278
1292
  border-width: 1px;
1279
1293
  }
1280
- `,Oi=_t.div`
1294
+ `,Li=_t.div`
1281
1295
  position: absolute;
1282
1296
  right: 0.5rem;
1283
1297
 
@@ -1285,7 +1299,7 @@ Resources:
1285
1299
  flex-direction: row;
1286
1300
  justify-content: space-around;
1287
1301
  align-items: center;
1288
- `,Cy=_t(a4)`
1302
+ `,_y=_t(M4)`
1289
1303
  height: 1.25rem;
1290
1304
  width: 1.25rem;
1291
1305
  stroke: var(--privy-color-accent);
@@ -1294,7 +1308,7 @@ Resources:
1294
1308
  :active {
1295
1309
  stroke: var(--privy-color-accent-light);
1296
1310
  }
1297
- `,Ni=_t(l4)`
1311
+ `,Ni=_t(O4)`
1298
1312
  height: 1.25rem;
1299
1313
  width: 1.25rem;
1300
1314
  stroke: var(--privy-color-accent);
@@ -1303,7 +1317,7 @@ Resources:
1303
1317
  :active {
1304
1318
  stroke: var(--privy-color-accent-light);
1305
1319
  }
1306
- `,Di=_t(s4)`
1320
+ `,Di=_t(W4)`
1307
1321
  height: 1.25rem;
1308
1322
  width: 1.25rem;
1309
1323
  stroke: var(--privy-color-accent);
@@ -1312,7 +1326,7 @@ Resources:
1312
1326
  :active {
1313
1327
  stroke: var(--privy-color-accent-light);
1314
1328
  }
1315
- `,wy=_t.progress`
1329
+ `,Py=_t.progress`
1316
1330
  height: 4px;
1317
1331
  width: 100%;
1318
1332
  margin: 8px 0;
@@ -1328,7 +1342,7 @@ Resources:
1328
1342
  transition: all 0.1s ease-out;
1329
1343
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1330
1344
  }
1331
- `;import{Fragment as u4,jsx as lr,jsxs as Wl}from"react/jsx-runtime";var by=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=rp(!0),[l,s]=rp(!1),[c,m]=rp(""),f=r===c;return p4(()=>{c&&!l&&s(!0)},[c]),Wl(u4,{children:[lr(_,{closeable:!1,backFn:n}),lr(oe,{}),Wl(qo,{children:[Wl(Ko,{children:[lr(d4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),lr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),lr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Wl($o,{children:[lr(Li,{value:c,onChange:u=>m(u.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),lr(Oi,{style:{right:"0.75rem"},children:i?lr(Ni,{onClick:()=>a(!1)}):lr(Di,{onClick:()=>a(!0)})})]}),lr(Il,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),lr(zo,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),lr(ne,{}),lr($,{})]})};import y4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as g4}from"react";import v4 from"styled-components";import Aa from"styled-components";import{jsx as xa,jsxs as h4}from"react/jsx-runtime";var Ey=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>xa("label",{children:h4(m4,{className:e,children:[xa(Sy,{checked:t,...o}),xa(f4,{color:r,checked:t,children:xa(Ty,{viewBox:"0 0 24 24",children:xa("polyline",{points:"20 6 9 17 4 12"})})})]})});var lU=Aa.label`
1345
+ `;import{Fragment as U4,jsx as lr,jsxs as Ul}from"react/jsx-runtime";var Ay=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=lp(!0),[l,s]=lp(!1),[c,m]=lp(""),f=r===c;return D4(()=>{c&&!l&&s(!0)},[c]),Ul(U4,{children:[lr(A,{closeable:!1,backFn:n}),lr(oe,{}),Ul(jo,{children:[Ul(Qo,{children:[lr(N4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),lr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),lr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Ul(Zo,{children:[lr(Oi,{value:c,onChange:u=>m(u.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),lr(Li,{style:{right:"0.75rem"},children:i?lr(Ni,{onClick:()=>a(!1)}):lr(Di,{onClick:()=>a(!0)})})]}),lr(Dl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),lr(Yo,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),lr(ne,{}),lr(z,{})]})};import G4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as V4}from"react";import q4 from"styled-components";import Ra from"styled-components";import{jsx as ka,jsxs as H4}from"react/jsx-runtime";var xy=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ka("label",{children:H4(F4,{className:e,children:[ka(Ry,{checked:t,...o}),ka(B4,{color:r,checked:t,children:ka(ky,{viewBox:"0 0 24 24",children:ka("polyline",{points:"20 6 9 17 4 12"})})})]})});var nF=Ra.label`
1332
1346
  && {
1333
1347
  cursor: pointer;
1334
1348
  display: flex;
@@ -1340,14 +1354,14 @@ Resources:
1340
1354
  border: 1px solid var(--privy-color-foreground-4);
1341
1355
  width: 100%;
1342
1356
  }
1343
- `,m4=Aa.div`
1357
+ `,F4=Ra.div`
1344
1358
  display: inline-block;
1345
1359
  vertical-align: middle;
1346
- `,Ty=Aa.svg`
1360
+ `,ky=Ra.svg`
1347
1361
  fill: none;
1348
1362
  stroke: white;
1349
1363
  stroke-width: 3px;
1350
- `,Sy=Aa.input.attrs({type:"checkbox"})`
1364
+ `,Ry=Ra.input.attrs({type:"checkbox"})`
1351
1365
  border: 0;
1352
1366
  clip: rect(0 0 0 0);
1353
1367
  clippath: inset(50%);
@@ -1358,7 +1372,7 @@ Resources:
1358
1372
  position: absolute;
1359
1373
  white-space: nowrap;
1360
1374
  width: 1px;
1361
- `,f4=Aa.div`
1375
+ `,B4=Ra.div`
1362
1376
  display: inline-block;
1363
1377
  width: 18px;
1364
1378
  height: 18px;
@@ -1373,28 +1387,28 @@ Resources:
1373
1387
  border-width: 1px;
1374
1388
  }
1375
1389
 
1376
- ${Sy}:focus + & {
1390
+ ${Ry}:focus + & {
1377
1391
  box-shadow: 0 0 0 1px ${e=>e.color};
1378
1392
  }
1379
1393
 
1380
- ${Ty} {
1394
+ ${ky} {
1381
1395
  visibility: ${e=>e.checked?"visible":"hidden"};
1382
1396
  }
1383
- `;import{Fragment as _y,jsx as Pr,jsxs as ka}from"react/jsx-runtime";var Py=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=g4(!1);return ka(_y,{children:[Pr(_,{closeable:!1,backFn:o}),Pr(oe,{}),ka(qo,{children:[ka(Ko,{children:[Pr(y4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Pr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Pr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Pr(_a,{children:ka(Pa,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[Pr(Ey,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),Pr(_y,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ka(C4,{children:[n.initiatedBy==="user"&&Pr(Nr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Pr(zo,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),Pr(ne,{}),Pr($,{})]})},C4=v4.div`
1397
+ `;import{Fragment as Iy,jsx as xr,jsxs as Ia}from"react/jsx-runtime";var My=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=V4(!1);return Ia(Iy,{children:[xr(A,{closeable:!1,backFn:o}),xr(oe,{}),Ia(jo,{children:[Ia(Qo,{children:[xr(G4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),xr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),xr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),xr(Aa,{children:Ia(xa,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[xr(xy,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),xr(Iy,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Ia(z4,{children:[n.initiatedBy==="user"&&xr(Ur,{onClick:n.onCancel,disabled:t,children:"Cancel"}),xr(Yo,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),xr(ne,{}),xr(z,{})]})},z4=q4.div`
1384
1398
  display: flex;
1385
1399
  gap: 10px;
1386
- `;import O4 from"@heroicons/react/24/outline/KeyIcon";import Wy from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Ly,useMemo as op,useEffect as N4}from"react";import Oy from"styled-components";import w4 from"fast-password-entropy";import*as xy from"secure-password-utilities";import{DEFAULT_WORDLIST as b4}from"secure-password-utilities/wordlists";var E4=95,T4=8,S4=3,_4=.3,P4=/[a-z]/,x4=/[A-Z]/,A4=/[0-9]/,k4="a-zA-Z0-9",Ay="!@#$%^&*()\\-_+.",ky=`${k4}${Ay}`,R4=new RegExp(`[${Ay}]`),M4=new RegExp(`[${ky}]`),Ry=new RegExp(`^[${ky}]{6,}$`),My=(e="")=>{let t=e.split("").filter(r=>!M4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Ll=()=>xy.generatePassphrase(4,b4);function I4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function W4(e){if(e.length<T4)return 0;let t=0;P4.test(e)&&(t+=1),x4.test(e)&&(t+=1),A4.test(e)&&(t+=1),R4.test(e)&&(t+=1);let r=t/S4;return Math.max(0,Math.min(1,r))}function L4(e=""){let t=W4(e),r=w4(e)/E4;return(t*_4+r)/2}function Iy(e=""){let t=L4(e);return{value:t,label:I4(t)}}import{Fragment as F4,jsx as Pt,jsxs as ao}from"react/jsx-runtime";var Ny=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[m,f]=Ly(!1),[u,g]=Ly(!1);N4(()=>{r&&!u&&g(!0)},[r]);let w=op(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Ry.test(r||"")?null:`Invalid characters used ( ${My(r).join(" ")} )`:null,[r,u]),y=op(()=>w?{value:0,label:"Weak"}:Iy(r),[r,w]),b=op(()=>!!(!r?.length||w),[w,r]);return ao(F4,{children:[Pt(_,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),Pt(oe,{}),ao(qo,{children:[ao(Ko,{children:[Pt(O4,{height:48,width:48,stroke:"var(--privy-color-accent)"}),ao("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),ao($o,{children:[Pt(Li,{value:r,onChange:P=>s(P.target.value),placeholder:"enter or generate a strong password",type:m?"password":"text",style:{paddingRight:"3.8rem"}}),ao(Oi,{style:{width:"3.5rem"},children:[m?Pt(Ni,{onClick:()=>f(!1)}):Pt(Di,{onClick:()=>f(!0)}),Pt(Cy,{onClick:c})]})]}),Pt(wy,{value:y.value===0?.01:y.value,label:y.label}),Pt(Il,{error:!!w,children:w||`Password Strength: ${u?y.label:"--"}`}),ao(U4,{children:[Pt(D4,{children:ao(_a,{children:[ao(Pa,{children:[Pt(Wy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),ao(Pa,{children:[Pt(Wy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Pt(zo,{onClick:i,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),Pt(ne,{}),Pt($,{})]})},D4=Oy(_a)`
1400
+ `;import s5 from"@heroicons/react/24/outline/KeyIcon";import Fy from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as By,useMemo as cp,useEffect as l5}from"react";import Hy from"styled-components";import $4 from"fast-password-entropy";import*as Wy from"secure-password-utilities";import{DEFAULT_WORDLIST as K4}from"secure-password-utilities/wordlists";var j4=95,Y4=8,Z4=3,Q4=.3,J4=/[a-z]/,X4=/[A-Z]/,e5=/[0-9]/,t5="a-zA-Z0-9",Oy="!@#$%^&*()\\-_+.",Ly=`${t5}${Oy}`,r5=new RegExp(`[${Oy}]`),o5=new RegExp(`[${Ly}]`),Ny=new RegExp(`^[${Ly}]{6,}$`),Dy=(e="")=>{let t=e.split("").filter(r=>!o5.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Fl=()=>Wy.generatePassphrase(4,K4);function n5(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function i5(e){if(e.length<Y4)return 0;let t=0;J4.test(e)&&(t+=1),X4.test(e)&&(t+=1),e5.test(e)&&(t+=1),r5.test(e)&&(t+=1);let r=t/Z4;return Math.max(0,Math.min(1,r))}function a5(e=""){let t=i5(e),r=$4(e)/j4;return(t*Q4+r)/2}function Uy(e=""){let t=a5(e);return{value:t,label:n5(t)}}import{Fragment as p5,jsx as Pt,jsxs as lo}from"react/jsx-runtime";var Gy=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[m,f]=By(!1),[u,v]=By(!1);l5(()=>{r&&!u&&v(!0)},[r]);let g=cp(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Ny.test(r||"")?null:`Invalid characters used ( ${Dy(r).join(" ")} )`:null,[r,u]),y=cp(()=>g?{value:0,label:"Weak"}:Uy(r),[r,g]),b=cp(()=>!!(!r?.length||g),[g,r]);return lo(p5,{children:[Pt(A,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),Pt(oe,{}),lo(jo,{children:[lo(Qo,{children:[Pt(s5,{height:48,width:48,stroke:"var(--privy-color-accent)"}),lo("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),lo(Zo,{children:[Pt(Oi,{value:r,onChange:T=>s(T.target.value),placeholder:"enter or generate a strong password",type:m?"password":"text",style:{paddingRight:"3.8rem"}}),lo(Li,{style:{width:"3.5rem"},children:[m?Pt(Ni,{onClick:()=>f(!1)}):Pt(Di,{onClick:()=>f(!0)}),Pt(_y,{onClick:c})]})]}),Pt(Py,{value:y.value===0?.01:y.value,label:y.label}),Pt(Dl,{error:!!g,children:g||`Password Strength: ${u?y.label:"--"}`}),lo(d5,{children:[Pt(c5,{children:lo(Aa,{children:[lo(xa,{children:[Pt(Fy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),lo(xa,{children:[Pt(Fy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Pt(Yo,{onClick:i,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),Pt(ne,{}),Pt(z,{})]})},c5=Hy(Aa)`
1387
1401
  flex: 1;
1388
1402
  padding-top: 1rem;
1389
- `,U4=Oy.div`
1403
+ `,d5=Hy.div`
1390
1404
  display: flex;
1391
1405
  flex-direction: column;
1392
1406
  height: 100%;
1393
- `;import B4 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import H4 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import V4 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import G4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as q4,useCallback as Dy}from"react";import{Fragment as np,jsx as Xt,jsxs as On}from"react/jsx-runtime";var Uy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=q4(!1),s=Dy(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Dy(()=>{let m=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),u=new Blob([z4(r,o)],{type:"text/plain"}),g=URL.createObjectURL(u);m.href=g,m.target="_blank",m.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return On(np,{children:[Xt(_,{backFn:i,closeable:!1}),Xt(oe,{}),On(qo,{children:[On(Ko,{children:[Xt(G4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Xt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Xt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Xt($o,{centered:!0,children:Xt(vy,{children:o})}),On("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Xt(tp,{onClick:s,children:a?On(np,{children:[Xt(H4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):On(np,{children:[Xt(V4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),On(tp,{onClick:c,children:[Xt(B4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Xt(zo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Xt(ne,{}),Xt($,{})]})},z4=(e,t)=>`Your wallet recovery password for ${e} is
1407
+ `;import u5 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import m5 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import f5 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import h5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as y5,useCallback as Vy}from"react";import{Fragment as dp,jsx as er,jsxs as Un}from"react/jsx-runtime";var qy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=y5(!1),s=Vy(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Vy(()=>{let m=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),u=new Blob([g5(r,o)],{type:"text/plain"}),v=URL.createObjectURL(u);m.href=v,m.target="_blank",m.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(v)},5e3)},[o]);return Un(dp,{children:[er(A,{backFn:i,closeable:!1}),er(oe,{}),Un(jo,{children:[Un(Qo,{children:[er(h5,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),er("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),er("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),er(Zo,{centered:!0,children:er(Sy,{children:o})}),Un("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[er(sp,{onClick:s,children:a?Un(dp,{children:[er(m5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Un(dp,{children:[er(f5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Un(sp,{onClick:c,children:[er(u5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),er(Yo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),er(ne,{}),er(z,{})]})},g5=(e,t)=>`Your wallet recovery password for ${e} is
1394
1408
 
1395
1409
  ${t}
1396
1410
 
1397
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import $4 from"@heroicons/react/24/solid/CheckCircleIcon";import K4 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as j4,jsx as Po,jsxs as ip}from"react/jsx-runtime";var Fy=({error:e,onClose:t})=>ip(j4,{children:[Po(_,{closeable:!1}),Po(oe,{}),e?ip(ir,{children:[Po(K4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Po(ye,{title:"Something went wrong",description:e})]}):ip(ir,{children:[Po($4,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Po(ye,{title:"Success"})]}),Po(F,{onClick:t,children:"Close"}),Po(ne,{}),Po($,{})]});import{useReducer as Y4}from"react";var Z4=(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}},By=()=>{let[e,t]=Y4(Z4,"creating");return{send:t,state:e}};import{jsx as Ra}from"react/jsx-runtime";var Ol=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=S(),{send:n,state:i}=By(),a=ap(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);Q4(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Ne)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=ap(()=>{n("back")},[n]),s=ap(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ra(Ny,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ra(Uy,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ra(by,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ra(Py,{...t,onSubmit:a,onBack:l}):i==="done"?Ra(Fy,{...t,onSubmit:a}):null};import{jsx as X4}from"react/jsx-runtime";var Hy=()=>{let[e,t]=Nl(null),[r,o]=Nl(!1),[n,i]=Nl(null),[a,l]=Nl(""),{authenticated:s,getAccessToken:c,user:m}=q(),{walletProxy:f,refreshUser:u,closePrivyModal:g,createAnalyticsEvent:w}=I(),{app:y,navigate:b,data:P,onUserCloseViaDialogOrKeybindRef:A}=S(),{onSuccess:T,onFailure:x}=P.createWallet,R=he(m),M=e?.recoveryMethod==="user-passcode",D=R?.recoveryMethod==="user-passcode";J4(()=>{s||(b("LANDING"),x(new ps("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){x(n),g({shouldCallAuthOnSuccess:!1});return}if(!M){x(new Mt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}T(e),g({shouldCallAuthOnSuccess:!1})};A.current=B;let K=async()=>{let L=await c();if(L&&R?.address&&a&&f)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}}),!(await f.setRecovery({accessToken:L,address:R.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new Mt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"error setting password"}});return}let W=await u(),ve=he(W);if(!ve){i(new Mt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"wallet disconnected"}});return}t(ve),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}})}catch(N){console.warn(N),i(N instanceof Error?N:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:R.address,reason:N}})}},j=async()=>{M?(T(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return X4(Ol,{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:a,isResettingPassword:D,onPasswordGenerate:()=>l(Ll()),onPasswordChange:l,onSubmit:j,onClose:B})};import e5 from"@heroicons/react/24/outline/UserCircleIcon";import t5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as r5,jsx as xo,jsxs as Dl}from"react/jsx-runtime";var Vy=()=>{let{closePrivyModal:e}=I(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new Mt("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,Dl(r5,{children:[xo(_,{onClose:l}),xo(oe,{}),Dl(ir,{children:[Dl(mh,{children:[xo(e5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),xo(fh,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:xo(t5,{width:"12px",height:"12px",fill:"white"})})]}),Dl(ye,{title:"Secure Your Account",children:["Please set a password to secure your account.",xo("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),xo(F,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),xo(ne,{}),xo($,{})]})};import o5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import n5 from"@heroicons/react/24/outline/PhoneIcon";import Gy from"styled-components";import{Fragment as l5,jsx as xr,jsxs as Ul}from"react/jsx-runtime";var i5=e=>{let t=xr(o5,{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};case"insufficient_balance":return{title:"Insufficient balance",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 We&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:xr(n5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof et)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:xr(hl,{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:xr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:xr("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 Rt&&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}}},qy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=S(),i=r?.errorModalData?.previousScreen||(o===n?void 0:o);return xr(Nn,{error:r?.errorModalData?.error||new Error,backFn:()=>i?e(i,!1):t(),onClick:()=>e(i||"LANDING",!1)})},Nn=({error:e,backFn:t,onClick:r})=>{let{reset:o}=be(),n=i5(e),i=()=>{e instanceof et&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return Ul(l5,{children:[xr(_,{backFn:t}),Ul(a5,{children:[xr(Je,{children:Ul("div",{children:[xr(fl,{color:"var(--privy-color-error)"}),n.icon]})}),Ul(s5,{children:[xr("h3",{children:n.title}),xr("p",{children:n.detail})]}),xr(F,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},a5=Gy.div`
1411
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import v5 from"@heroicons/react/24/solid/CheckCircleIcon";import C5 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as w5,jsx as ko,jsxs as pp}from"react/jsx-runtime";var zy=({error:e,onClose:t})=>pp(w5,{children:[ko(A,{closeable:!1}),ko(oe,{}),e?pp(ir,{children:[ko(C5,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ko(ye,{title:"Something went wrong",description:e})]}):pp(ir,{children:[ko(v5,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ko(ye,{title:"Success"})]}),ko(B,{onClick:t,children:"Close"}),ko(ne,{}),ko(z,{})]});import{useReducer as b5}from"react";var E5=(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}},$y=()=>{let[e,t]=b5(E5,"creating");return{send:t,state:e}};import{jsx as Ma}from"react/jsx-runtime";var Bl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=_(),{send:n,state:i}=$y(),a=up(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);T5(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Ne)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=up(()=>{n("back")},[n]),s=up(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ma(Gy,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ma(qy,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ma(Ay,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ma(My,{...t,onSubmit:a,onBack:l}):i==="done"?Ma(zy,{...t,onSubmit:a}):null};import{jsx as _5}from"react/jsx-runtime";var Ky=()=>{let[e,t]=Hl(null),[r,o]=Hl(!1),[n,i]=Hl(null),[a,l]=Hl(""),{authenticated:s,getAccessToken:c,user:m}=q(),{walletProxy:f,refreshUser:u,closePrivyModal:v,createAnalyticsEvent:g}=M(),{app:y,navigate:b,data:T,onUserCloseViaDialogOrKeybindRef:k}=_(),{onSuccess:E,onFailure:P}=T.createWallet,x=he(m),I=e?.recoveryMethod==="user-passcode",N=x?.recoveryMethod==="user-passcode";S5(()=>{s||(b("LANDING"),P(new ys("User must be authenticated before setting a password on a Privy wallet")))},[s]);let H=()=>{if(n){P(n),v({shouldCallAuthOnSuccess:!1});return}if(!I){P(new Wt("Exited before password was added to wallet")),v({shouldCallAuthOnSuccess:!1});return}E(e),v({shouldCallAuthOnSuccess:!1})};k.current=H;let K=async()=>{let O=await c();if(O&&x?.address&&a&&f)try{if(g({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:x.address,recoveryMethod:"user-passcode",isResettingPassword:N}}),!(await f.setRecovery({accessToken:O,address:x.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,recoveryMethod:"user-passcode",isResettingPassword:N,reason:"error setting password"}});return}let W=await u(),ve=he(W);if(!ve){i(new Wt("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,recoveryMethod:"user-passcode",isResettingPassword:N,reason:"wallet disconnected"}});return}t(ve),g({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:x.address,recoveryMethod:"user-passcode",isResettingPassword:N}})}catch(D){console.warn(D),i(D instanceof Error?D:new Error("Error setting password on privy wallet")),g({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:x.address,reason:D}})}},j=async()=>{I?(E(e),v({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return _5(Bl,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:H},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,isResettingPassword:N,onPasswordGenerate:()=>l(Fl()),onPasswordChange:l,onSubmit:j,onClose:H})};import P5 from"@heroicons/react/24/outline/UserCircleIcon";import A5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as x5,jsx as Ro,jsxs as Gl}from"react/jsx-runtime";var jy=()=>{let{closePrivyModal:e}=M(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new Wt("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,Gl(x5,{children:[Ro(A,{onClose:l}),Ro(oe,{}),Gl(ir,{children:[Gl(vh,{children:[Ro(P5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Ro(Ch,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Ro(A5,{width:"12px",height:"12px",fill:"white"})})]}),Gl(ye,{title:"Secure Your Account",children:["Please set a password to secure your account.",Ro("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),Ro(B,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Ro(ne,{}),Ro(z,{})]})};import k5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import R5 from"@heroicons/react/24/outline/PhoneIcon";import Yy from"styled-components";import{Fragment as O5,jsx as kr,jsxs as Vl}from"react/jsx-runtime";var I5=e=>{let t=kr(k5,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof w)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};case"insufficient_balance":return{title:"Insufficient balance",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 We&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:kr(R5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Xe)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:kr(wl,{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:kr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:kr("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 Mt&&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}}},Zy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),i=r?.errorModalData?.previousScreen||(o===n?void 0:o);return kr(Fn,{error:r?.errorModalData?.error||new Error,backFn:()=>i?e(i,!1):t(),onClick:()=>e(i||"LANDING",!1)})},Fn=({error:e,backFn:t,onClick:r})=>{let{reset:o}=be(),n=I5(e),i=()=>{e instanceof Xe&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return Vl(O5,{children:[kr(A,{backFn:t}),Vl(M5,{children:[kr(Je,{children:Vl("div",{children:[kr(Cl,{color:"var(--privy-color-error)"}),n.icon]})}),Vl(W5,{children:[kr("h3",{children:n.title}),kr("p",{children:n.detail})]}),kr(B,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},M5=Yy.div`
1398
1412
  display: flex;
1399
1413
  flex-direction: column;
1400
1414
  align-items: center;
@@ -1402,11 +1416,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1402
1416
  gap: 24px;
1403
1417
  width: 100%;
1404
1418
  padding-bottom: 16px;
1405
- `,s5=Gy.div`
1419
+ `,W5=Yy.div`
1406
1420
  display: flex;
1407
1421
  flex-direction: column;
1408
1422
  gap: 8px;
1409
- `;import{useEffect as Qy,useRef as A5,useState as cp}from"react";import{isIOS as k5,isMobile as Jy}from"react-device-detect";import tg from"styled-components";import{useState as c5}from"react";import d5 from"styled-components";import{jsx as zy}from"react/jsx-runtime";var Ui=({style:e,color:t,...r})=>zy("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:zy("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as sp}from"react/jsx-runtime";var $y=({color:e,...t})=>sp("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:sp("g",{children:sp("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 Ky,jsxs as u5}from"react/jsx-runtime";var jo=e=>{let[t,r]=c5(!1);return u5(p5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Ky(Ui,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Ky($y,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},p5=d5.button`
1423
+ `;import{useEffect as og,useRef as e6,useState as hp}from"react";import{isIOS as t6,isMobile as ng}from"react-device-detect";import sg from"styled-components";import{useState as L5}from"react";import N5 from"styled-components";import{jsx as Qy}from"react/jsx-runtime";var Ui=({style:e,color:t,...r})=>Qy("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:Qy("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as mp}from"react/jsx-runtime";var Jy=({color:e,...t})=>mp("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:mp("g",{children:mp("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 Xy,jsxs as U5}from"react/jsx-runtime";var Jo=e=>{let[t,r]=L5(!1);return U5(D5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Xy(Ui,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Xy(Jy,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},D5=N5.button`
1410
1424
  display: flex;
1411
1425
  align-items: center;
1412
1426
  gap: 6px;
@@ -1444,7 +1458,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1444
1458
  width: 14px;
1445
1459
  height: 14px;
1446
1460
  }
1447
- `;import{useState as m5}from"react";import f5 from"styled-components";import{jsx as y5}from"react/jsx-runtime";var Fl=e=>{let[t,r]=m5(!1);return y5(h5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},h5=f5.a`
1461
+ `;import{useState as F5}from"react";import B5 from"styled-components";import{jsx as G5}from"react/jsx-runtime";var ql=e=>{let[t,r]=F5(!1);return G5(H5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},H5=B5.a`
1448
1462
  display: flex;
1449
1463
  align-items: center;
1450
1464
  gap: 6px;
@@ -1482,7 +1496,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1482
1496
  width: 14px;
1483
1497
  height: 14px;
1484
1498
  }
1485
- `;import g5 from"qrcode";import v5 from"react";import C5 from"styled-components";import{jsx as jy}from"react/jsx-runtime";var Yy=()=>jy("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:jy("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Ma,jsx as Lt,jsxs as Zy}from"react/jsx-runtime";var cr=7,lp=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},w5=e=>{let t=g5.create(e,{errorCorrectionLevel:"high"}).modules,r=tm(Array.from(t.data),t.size);return r=lp(r,0,0,cr,cr),r=lp(r,r.length-cr,0,cr,cr),r=lp(r,0,r.length-cr,cr,cr),r},b5=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Lt(Ma,{children:[0,1,2].map(i=>Lt("circle",{r:r*(cr-i*2)/2,cx:e+r*cr/2,cy:t+r*cr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),E5=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-cr)*e,0],[0,(t-cr)*e]];return Lt(Ma,{children:n.map(([i,a])=>Lt(b5,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},T5=({matrix:e,cellSize:t,color:r})=>Lt(Ma,{children:e.map((i,a)=>i.map((l,s)=>l?Lt("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):Lt(v5.Fragment,{},`circle-${a}-${s}`)))}),S5=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Lt(Ma,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,m=s-s*c*2,f=r,u=a*e;return Zy(Ma,{children:[Lt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),Lt(f,{x:u+s*c,y:u+s*c,height:m,width:m})]})},_5=e=>{let t=e.outputSize,r=w5(e.url),o=t/r.length;return Zy("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Lt(T5,{matrix:r,cellSize:o,color:e.fgColor}),Lt(E5,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Lt(S5,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},P5=C5.div`
1499
+ `;import V5 from"qrcode";import q5 from"react";import z5 from"styled-components";import{jsx as eg}from"react/jsx-runtime";var tg=()=>eg("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:eg("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Wa,jsx as Nt,jsxs as rg}from"react/jsx-runtime";var cr=7,fp=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},$5=e=>{let t=V5.create(e,{errorCorrectionLevel:"high"}).modules,r=am(Array.from(t.data),t.size);return r=fp(r,0,0,cr,cr),r=fp(r,r.length-cr,0,cr,cr),r=fp(r,0,r.length-cr,cr,cr),r},K5=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Nt(Wa,{children:[0,1,2].map(i=>Nt("circle",{r:r*(cr-i*2)/2,cx:e+r*cr/2,cy:t+r*cr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),j5=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-cr)*e,0],[0,(t-cr)*e]];return Nt(Wa,{children:n.map(([i,a])=>Nt(K5,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},Y5=({matrix:e,cellSize:t,color:r})=>Nt(Wa,{children:e.map((i,a)=>i.map((l,s)=>l?Nt("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):Nt(q5.Fragment,{},`circle-${a}-${s}`)))}),Z5=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Nt(Wa,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,m=s-s*c*2,f=r,u=a*e;return rg(Wa,{children:[Nt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),Nt(f,{x:u+s*c,y:u+s*c,height:m,width:m})]})},Q5=e=>{let t=e.outputSize,r=$5(e.url),o=t/r.length;return rg("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Nt(Y5,{matrix:r,cellSize:o,color:e.fgColor}),Nt(j5,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Nt(Z5,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},J5=z5.div`
1486
1500
  display: flex;
1487
1501
  justify-content: center;
1488
1502
  align-items: center;
@@ -1497,7 +1511,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1497
1511
  border-color: ${e=>e.borderColor};
1498
1512
  border-radius: var(--privy-border-radius-md);
1499
1513
  }
1500
- `,Yo=e=>{let{appearance:t}=Ge(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return Lt(P5,{size:n,bgColor:r,fgColor:o,borderColor:i,children:Lt(_5,{url:e.url,logo:{element:e.squareLogoElement??Yy},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as Bl,jsxs as x5}from"react/jsx-runtime";var so=({style:e,...t})=>x5("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 Hl,jsx as Ae,jsxs as lo}from"react/jsx-runtime";var Xy="#8a63d2",rg=1e3,R5=rg*2,M5=rg*120,og=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=S(),{getAuthFlow:c,loginWithFarcaster:m,closePrivyModal:f,createAnalyticsEvent:u}=I(),[g,w]=cp(void 0),[y,b]=cp(!1),[P,A]=cp(!1),T=A5([]),x=Ne,R=c(),M=R?.meta.connectUri;return Qy(()=>{let D=Date.now(),B=setInterval(async()=>{let K=await R.pollForReady.execute(),j=Date.now()-D;if(K){clearInterval(B),b(!0);try{await m(),A(!0)}catch(L){let N={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(L?.privyErrorCode==="max_accounts_reached"){console.error(new wr(L).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else if(L?.privyErrorCode==="user_does_not_exist"){i("ACCOUNT_NOT_FOUND_SCREEN");return}else L?.privyErrorCode==="linked_to_another_user"?N.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(N.retryable=!0,N.detail="Something went wrong. Try again."):L?.privyErrorCode==="too_many_requests"&&(N.detail="Too many requests. Please wait before trying again.");w(N)}}else j>M5&&(clearInterval(B),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},R5);return()=>{clearInterval(B),T.current.forEach(K=>clearTimeout(K))}},[]),Qy(()=>{if(r&&e&&P&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},x);return()=>clearTimeout(B)}P&&(Gt(o,s?.embeddedWallets.createOnLogin)?T.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:B=>{console.error(B),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:B,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},x)):T.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),x)))}},[P,r,e,o]),Jy||y?lo(Hl,{children:[Ae(_,{backFn:n?a:void 0,onClose:f},"header"),Ae(oe,{}),k5?Ae(Hl,{children:lo(I5,{children:[Ae(Je,{children:lo("div",{children:[Ae(ot,{success:P,fail:!!g}),Ae(so,{style:{width:"38px",height:"38px"}})]})}),lo(Xe,{children:[Ae(de,{children:g?g.message:"Sign in with Farcaster"}),Ae(ue,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&Ae(F,{onClick:D=>{D.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):Ae(Hl,{children:lo(eg,{children:[Ae(Je,{children:lo("div",{children:[Ae(ot,{success:P,fail:!!g}),Ae(so,{style:{width:"38px",height:"38px"}})]})}),lo(Xe,{children:[Ae(de,{children:g?g.message:"Signing in with Farcaster"}),Ae(ue,{children:g?g.detail:"This should only take a moment"}),Ae(wt,{children:M&&Jy&&Ae(Fl,{text:"Take me to Warpcast",url:M,color:Xy})})]})]})}),Ae(Z,{})]}):lo(Hl,{children:[Ae(_,{backFn:n?a:void 0,onClose:f},"header"),Ae(oe,{}),Ae(eg,{children:lo("div",{children:[Ae(de,{children:"Sign in with Farcaster"}),Ae(ue,{children:"Scan with your phone's camera to continue."}),Ae(wi,{children:M?Ae(Yo,{url:M,size:275,squareLogoElement:so}):Ae(mt,{})}),lo(wt,{children:[Ae(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&Ae(jo,{text:M,itemName:"link",color:Xy})]})]})}),Ae(Z,{})]})},eg=tg.div`
1514
+ `,Xo=e=>{let{appearance:t}=Ve(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return Nt(J5,{size:n,bgColor:r,fgColor:o,borderColor:i,children:Nt(Q5,{url:e.url,logo:{element:e.squareLogoElement??tg},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as zl,jsxs as X5}from"react/jsx-runtime";var co=({style:e,...t})=>X5("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:[zl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),zl("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"}),zl("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"}),zl("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 $l,jsx as ke,jsxs as po}from"react/jsx-runtime";var ig="#8a63d2",lg=1e3,r6=lg*2,o6=lg*120,cg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:m,closePrivyModal:f,createAnalyticsEvent:u}=M(),[v,g]=hp(void 0),[y,b]=hp(!1),[T,k]=hp(!1),E=e6([]),P=Ne,x=c(),I=x?.meta.connectUri;return og(()=>{let N=Date.now(),H=setInterval(async()=>{let K=await x.pollForReady.execute(),j=Date.now()-N;if(K){clearInterval(H),b(!0);try{await m(),k(!0)}catch(O){let D={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(O?.privyErrorCode==="max_accounts_reached"){console.error(new br(O).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else if(O?.privyErrorCode==="user_does_not_exist"){i("ACCOUNT_NOT_FOUND_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?D.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(D.retryable=!0,D.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(D.detail="Too many requests. Please wait before trying again.");g(D)}}else j>o6&&(clearInterval(H),g({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},r6);return()=>{clearInterval(H),E.current.forEach(K=>clearTimeout(K))}},[]),og(()=>{if(r&&e&&T&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},P);return()=>clearTimeout(H)}T&&(qt(o,s?.embeddedWallets.createOnLogin)?E.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},P)):E.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),P)))}},[T,r,e,o]),ng||y?po($l,{children:[ke(A,{backFn:n?a:void 0,onClose:f},"header"),ke(oe,{}),t6?ke($l,{children:po(n6,{children:[ke(Je,{children:po("div",{children:[ke(ot,{success:T,fail:!!v}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:v?v.message:"Sign in with Farcaster"}),ke(ue,{children:v?v.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),I&&ke(B,{onClick:N=>{N.preventDefault(),window.location.href=I},children:"Open Warpcast app"})]})}):ke($l,{children:po(ag,{children:[ke(Je,{children:po("div",{children:[ke(ot,{success:T,fail:!!v}),ke(co,{style:{width:"38px",height:"38px"}})]})}),po(qe,{children:[ke(de,{children:v?v.message:"Signing in with Farcaster"}),ke(ue,{children:v?v.detail:"This should only take a moment"}),ke(wt,{children:I&&ng&&ke(ql,{text:"Take me to Warpcast",url:I,color:ig})})]})]})}),ke(Z,{})]}):po($l,{children:[ke(A,{backFn:n?a:void 0,onClose:f},"header"),ke(oe,{}),ke(ag,{children:po("div",{children:[ke(de,{children:"Sign in with Farcaster"}),ke(ue,{children:"Scan with your phone's camera to continue."}),ke(wi,{children:I?ke(Xo,{url:I,size:275,squareLogoElement:co}):ke(nt,{})}),po(wt,{children:[ke(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),I&&ke(Jo,{text:I,itemName:"link",color:ig})]})]})}),ke(Z,{})]})},ag=sg.div`
1501
1515
  display: flex;
1502
1516
  flex-direction: column;
1503
1517
  align-items: center;
@@ -1505,14 +1519,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1505
1519
  margin-left: 27px;
1506
1520
  margin-right: 27px;
1507
1521
  gap: 24px;
1508
- `,I5=tg.div`
1522
+ `,n6=sg.div`
1509
1523
  display: flex;
1510
1524
  flex-direction: column;
1511
1525
  align-items: center;
1512
1526
  justify-content: center;
1513
1527
  gap: 24px;
1514
1528
  width: 100%;
1515
- `;import{useEffect as W5,useRef as L5,useState as dp}from"react";import{isIOS as O5,isMobile as ng}from"react-device-detect";import sg from"styled-components";import{Fragment as Vl,jsx as Re,jsxs as Vr}from"react/jsx-runtime";var ig="#8a63d2",lg=1e3,N5=lg*2,D5=lg*300,cg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=S(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=I(),[a,l]=dp(void 0),[s,c]=dp(!1),[m,f]=dp(!1),u=L5([]),g=Ne,w=r?.farcasterSigner;W5(()=>{let b=Date.now(),P=setInterval(async()=>{if(!w?.public_key){clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(P),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let A=await n(w?.public_key),T=Date.now()-b;A.status==="approved"?(clearInterval(P),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):T>D5?(clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):A.status==="revoked"&&(clearInterval(P),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},N5);return()=>{clearInterval(P),u.current.forEach(A=>clearTimeout(A))}},[]);let y=w?.status==="pending_approval"?w.signer_approval_url:void 0;return ng||s?Vr(Vl,{children:[Re(_,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),O5?Re(Vl,{children:Vr(U5,{children:[Re(Je,{children:Vr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(so,{style:{width:"38px",height:"38px"}})]})}),Vr(Xe,{children:[Re(de,{children:a?a.message:"Add a signer to Farcaster"}),Re(ue,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Re(F,{onClick:b=>{b.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Re(Vl,{children:Vr(ag,{children:[Re(Je,{children:Vr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(so,{style:{width:"38px",height:"38px"}})]})}),Vr(Xe,{children:[Re(de,{children:a?a.message:"Requesting signer from Farcaster"}),Re(ue,{children:a?a.detail:"This should only take a moment"}),Re(wt,{children:y&&ng&&Re(Fl,{text:"Take me to Warpcast",url:y,color:ig})})]})]})}),Re(Z,{})]}):Vr(Vl,{children:[Re(_,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),Re(ag,{children:Vr("div",{children:[Re(de,{children:"Add a signer to Farcaster"}),Vr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Re(wi,{children:w?.status==="pending_approval"?Re(Yo,{url:w.signer_approval_url,size:275,squareLogoElement:so}):Re(mt,{})}),Vr(wt,{children:[Re(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&Re(jo,{text:w.signer_approval_url,itemName:"link",color:ig})]})]})}),Re(Z,{})]})},ag=sg.div`
1529
+ `;import{useEffect as i6,useRef as a6,useState as yp}from"react";import{isIOS as s6,isMobile as dg}from"react-device-detect";import mg from"styled-components";import{Fragment as Kl,jsx as Re,jsxs as qr}from"react/jsx-runtime";var pg="#8a63d2",fg=1e3,l6=fg*2,c6=fg*300,hg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=yp(void 0),[s,c]=yp(!1),[m,f]=yp(!1),u=a6([]),v=Ne,g=r?.farcasterSigner;i6(()=>{let b=Date.now(),T=setInterval(async()=>{if(!g?.public_key){clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}g.status==="approved"&&(clearInterval(T),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v)));let k=await n(g?.public_key),E=Date.now()-b;k.status==="approved"?(clearInterval(T),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v))):E>c6?(clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):k.status==="revoked"&&(clearInterval(T),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},l6);return()=>{clearInterval(T),u.current.forEach(k=>clearTimeout(k))}},[]);let y=g?.status==="pending_approval"?g.signer_approval_url:void 0;return dg||s?qr(Kl,{children:[Re(A,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),s6?Re(Kl,{children:qr(d6,{children:[Re(Je,{children:qr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Add a signer to Farcaster"}),Re(ue,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Re(B,{onClick:b=>{b.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Re(Kl,{children:qr(ug,{children:[Re(Je,{children:qr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(co,{style:{width:"38px",height:"38px"}})]})}),qr(qe,{children:[Re(de,{children:a?a.message:"Requesting signer from Farcaster"}),Re(ue,{children:a?a.detail:"This should only take a moment"}),Re(wt,{children:y&&dg&&Re(ql,{text:"Take me to Warpcast",url:y,color:pg})})]})]})}),Re(Z,{})]}):qr(Kl,{children:[Re(A,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),Re(ug,{children:qr("div",{children:[Re(de,{children:"Add a signer to Farcaster"}),qr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Re(wi,{children:g?.status==="pending_approval"?Re(Xo,{url:g.signer_approval_url,size:275,squareLogoElement:co}):Re(nt,{})}),qr(wt,{children:[Re(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),g?.status==="pending_approval"&&Re(Jo,{text:g.signer_approval_url,itemName:"link",color:pg})]})]})}),Re(Z,{})]})},ug=mg.div`
1516
1530
  display: flex;
1517
1531
  flex-direction: column;
1518
1532
  align-items: center;
@@ -1520,14 +1534,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1520
1534
  margin-left: 27px;
1521
1535
  margin-right: 27px;
1522
1536
  gap: 24px;
1523
- `,U5=sg.div`
1537
+ `,d6=mg.div`
1524
1538
  display: flex;
1525
1539
  flex-direction: column;
1526
1540
  align-items: center;
1527
1541
  justify-content: center;
1528
1542
  gap: 24px;
1529
1543
  width: 100%;
1530
- `;import{formatUnits as n6,parseUnits as i6}from"@ethersproject/units";import{CheckCircleIcon as a6}from"@heroicons/react/24/outline";import{useEffect as hp,useState as Wa}from"react";import s6 from"styled-components";import{calculateTotalGasEstimate as l6,populateTransactionRequest as c6}from"@privy-io/js-sdk-core";import{jsx as F5}from"react/jsx-runtime";function dr({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=S(),i;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?i=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?i=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):i=void 0:i=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,F5(_,{title:e,backFn:i})}import Gl from"styled-components";import{jsx as pp,jsxs as q5}from"react/jsx-runtime";var up=()=>pp(B5,{children:q5(H5,{children:[pp(V5,{}),pp(G5,{})]})}),B5=Gl.div`
1544
+ `;import{getAddress as wg}from"@ethersproject/address";import{formatUnits as k6,parseUnits as R6}from"@ethersproject/units";import{CheckCircleIcon as I6}from"@heroicons/react/24/outline";import{useEffect as bp,useState as La}from"react";import M6 from"styled-components";import{calculateTotalGasEstimate as W6,populateTransactionRequest as O6}from"@privy-io/js-sdk-core";import{jsx as p6}from"react/jsx-runtime";function dr({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=_(),i;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?i=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?i=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):i=void 0:i=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,p6(A,{title:e,backFn:i})}import jl from"styled-components";import{jsx as gp,jsxs as y6}from"react/jsx-runtime";var vp=()=>gp(u6,{children:y6(m6,{children:[gp(f6,{}),gp(h6,{})]})}),u6=jl.div`
1531
1545
  display: flex;
1532
1546
  justify-content: center;
1533
1547
  align-items: center;
@@ -1536,14 +1550,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1536
1550
  @media all and (display-mode: standalone) {
1537
1551
  margin-bottom: 30px;
1538
1552
  }
1539
- `,H5=Gl.div`
1553
+ `,m6=jl.div`
1540
1554
  position: relative;
1541
1555
  height: 96px;
1542
1556
  width: 96px;
1543
1557
 
1544
1558
  opacity: 1;
1545
1559
  animation: fadein 200ms ease;
1546
- `,V5=Gl.div`
1560
+ `,f6=jl.div`
1547
1561
  position: absolute;
1548
1562
  top: 0;
1549
1563
  right: 0;
@@ -1556,7 +1570,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1556
1570
  border: 4px solid #f1f2f9;
1557
1571
  border-radius: 50%;
1558
1572
  }
1559
- `,G5=Gl.div`
1573
+ `,h6=jl.div`
1560
1574
  position: absolute;
1561
1575
  top: 0;
1562
1576
  right: 0;
@@ -1580,33 +1594,67 @@ You will need this password to access your ${e} wallet on a new device. Please k
1580
1594
  transform: rotate(360deg);
1581
1595
  }
1582
1596
  }
1583
- `;import dg from"styled-components";var ql=dg.span`
1597
+ `;import yg from"styled-components";var Yl=yg.span`
1584
1598
  display: flex;
1585
1599
  flex-direction: column;
1586
1600
  gap: 0.35rem;
1587
1601
  width: 100%;
1588
- `,pr=dg.span`
1602
+ `,pr=yg.span`
1589
1603
  display: flex;
1590
1604
  width: 100%;
1591
1605
  justify-content: space-between;
1592
- `;import z5 from"styled-components";var ur=z5.span`
1606
+ `;import g6 from"styled-components";var ur=g6.span`
1593
1607
  color: var(--privy-color-foreground-3);
1594
1608
  font-size: 0.875rem;
1595
1609
  font-weight: 400;
1596
1610
  line-height: 1.375rem; /* 157.143% */
1597
- `;import $5 from"styled-components";var mr=$5.span`
1611
+ `;import v6 from"styled-components";var mr=v6.span`
1598
1612
  color: var(--privy-color-foreground);
1599
1613
  font-size: 0.875rem;
1600
1614
  font-weight: 500;
1601
1615
  line-height: 1.375rem; /* 157.143% */
1602
1616
 
1603
- ${vl}
1604
- `;import{EtherscanProvider as PH}from"@ethersproject/providers";import{QuantityToBigNumber as K5}from"@privy-io/js-sdk-core";async function zl(e,t,r,o,n,i){o=Object.assign({chainId:wo},o),j5(o);let l=(await r.rpc({address:t,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(l)}async function Fi(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(K5(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function j5(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Y5(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 Y5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Z5(e);return t||r||o}function Z5(e){return/^-?0x[a-f0-9]+$/i.test(e)}function $l(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}}import{useState as mp,useEffect as Q5}from"react";var co=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=I(),[n,i]=mp(!0),[a,l]=mp(void 0),[s,c]=mp(void 0);return Q5(()=>{let m=e.chainId||wo,f=o.find(g=>g.id===Number(m));if(!f)throw new ce(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as J5,useContext as X5}from"react";var fp=J5(null);function Gr(){let e=X5(fp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}function Bi(e){let r=new RegExp(/^eip155:(?<chainId>\d+)$/gm).exec(e)?.groups?.chainId;if(r)return parseInt(r);throw new Error("Chain ID not compatible with CAIP-2 format.")}import{BigNumber as e6}from"@ethersproject/bignumber";import{formatEther as pg}from"@ethersproject/units";import{QuantityToBigNumber as t6}from"@privy-io/js-sdk-core";var r6=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),o6=e=>r6.format(e),Kl=(e,t)=>{let r=(t*parseFloat(e)).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},po=(e,t)=>{let r=o6(t*parseFloat(pg(e)));return r==="$0.00"?"<$0.01":r},fr=(e,t,r=6,o=!1)=>{let i=parseFloat(pg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Ia=e=>e.map(t6).reduce((t,r)=>t.add(r),e6.from(0)).toHexString(),ug=(e,t)=>{let{chains:r}=I(),o=`https://etherscan.io/address/${t}`,n=`${am(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as jl,jsx as De,jsxs as uo}from"react/jsx-runtime";var mg=()=>{let{chains:e,rpcConfig:t,appId:r,closePrivyModal:o}=I(),{navigate:n,setModalData:i,app:a,data:l}=S(),[s,c]=Wa(null),[m,f]=Wa(null),[u,g]=Wa(null),[w,y]=Wa(null),[b,P]=Wa(!1),A=l?.funding&&i6(l.funding.amount,"ether").toHexString(),T=l?.funding&&l.funding.chain.id,{wallets:x}=Gr(),{tokenPrice:R,isTokenPriceLoading:M}=co({chainId:s?.chainId&&Bi(s.chainId)?Bi(s.chainId):void 0}),D=async Y=>{for(let te of Y)T&&Bi(te.chainId)!==T&&await te.switchChain(T)},B=new Oe(async()=>{let Y=x[0];if(!Y){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}c(Y);let te=x.find(Fe=>Fe.walletClientType==="privy");if(!te){console.error("Embedded wallet wasn't found."),n("ERROR_SCREEN",!1);return}if(f(te),!T){console.error(`Chain ID not found for input ${l?.funding?.chain.id}.`),n("ERROR_SCREEN",!1);return}let ee=rr(T,e,t,{appId:r}),_e={from:Y.address,to:te.address,value:A,chainId:T},Te=await c6(Y.address,_e,ee),{totalGasEstimate:ze}=await l6(Te,ee),{balance:Ve,hasSufficientFunds:pt}=await Fi(Y.address,Te,ze,ee);if(y({gas:ze.toHexString(),balance:Ve.toHexString()}),!pt){g(new C(`Wallet ${Qe(Y.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}await D([Y,te]);try{let ae=await(await Y.getEthersProvider()).getSigner(),{wait:Ft}=await ae.sendTransaction(Te);await Ft(1),P(!0)}catch(Fe){g(Fe)}});hp(()=>{B.execute()},[]),hp(()=>{if(!u)return;let Y={error:u,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};i({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Y}),n("ERROR_SCREEN",!1)},[u]);let K=s?Bo(s.walletClientType,s.connectorType,s.walletClientType)||"wallet":null,j=!s||!w||M||!l?.funding||!A,L=j?void 0:Ia([w.gas,A]),N=L&&R?po(L,R):void 0,W=L?fr(L,"ETH"):void 0,ve=w&&R?po(w.gas,R):void 0,Me=w?fr(w.gas,"ETH"):void 0;return hp(()=>{if(!b)return;let Y=setTimeout(o,As);return()=>clearTimeout(Y)},[b]),j?uo(jl,{children:[De(dr,{}),De(up,{}),De("div",{style:{marginTop:"1rem"}}),De($,{})]}):b?uo(jl,{children:[De(dr,{}),De(oe,{}),uo(ir,{children:[De(a6,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),De(ye,{title:"Success!",description:`You\u2019ve successfully added ${n6(A,"ether")} ETH to your ${a.name} wallet. It may take a minute before the funds are available to use.`})]}),De(ne,{}),De($,{})]}):uo(jl,{children:[De(dr,{}),De(up,{}),De(wt,{style:{marginTop:"16px"},children:De(gl,{icon:Cl(s.walletClientType,s.connectorType,s.walletClientType),name:s.walletClientType})}),De(ye,{style:{marginTop:"8px",marginBottom:"12px"},title:`Confirming with ${K}`}),w&&De(jl,{children:uo(ql,{children:[uo(pr,{children:[De(ur,{children:"Total"}),De(mr,{children:N||W})]}),uo(pr,{children:[De(ur,{children:"To"}),De(mr,{children:Qe(m?.address)})]}),uo(pr,{children:[De(ur,{children:"Network"}),De(mr,{children:uo(d6,{children:[wl(l.funding.chain.id)," ",l.funding.chain.name]})})]}),uo(pr,{children:[De(ur,{children:"Estimated fee"}),De(mr,{children:ve||Me})]})]})}),De(bi,{height:24}),De($,{})]})},d6=s6.div`
1617
+ ${Tl}
1618
+ `;import{EtherscanProvider as EG}from"@ethersproject/providers";import{QuantityToBigNumber as C6}from"@privy-io/js-sdk-core";async function Zl(e,t,r,o,n,i){o=Object.assign({chainId:Eo},o),w6(o);let l=(await r.rpc({address:t,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(l)}async function Fi(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(C6(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function w6(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!b6(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 b6(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&E6(e);return t||r||o}function E6(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Ql(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}}import{useState as Cp,useEffect as T6}from"react";var uo=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=Cp(!0),[a,l]=Cp(void 0),[s,c]=Cp(void 0);return T6(()=>{let m=e.chainId||Eo,f=o.find(v=>v.id===Number(m));if(!f)throw new ce(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let v=await r(f);v?c(v):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(v){l(v)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as S6,useContext as _6}from"react";var wp=S6(null);function zr(){let e=_6(wp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}function Bi(e){let r=new RegExp(/^eip155:(?<chainId>\d+)$/gm).exec(e)?.groups?.chainId;if(r)return parseInt(r);throw new Error("Chain ID not compatible with CAIP-2 format.")}import{BigNumber as P6}from"@ethersproject/bignumber";import{formatEther as gg}from"@ethersproject/units";import{QuantityToBigNumber as A6}from"@privy-io/js-sdk-core";var x6=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),vg=e=>x6.format(e),Jl=(e,t)=>{let r=vg(t*parseFloat(e));return r!=="$0.00"?r:"<$0.01"},mo=(e,t)=>{let r=vg(t*parseFloat(gg(e)));return r==="$0.00"?"<$0.01":r},fr=(e,t,r=6,o=!1)=>{let i=parseFloat(gg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Oa=e=>e.map(A6).reduce((t,r)=>t.add(r),P6.from(0)).toHexString(),Cg=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${pm(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as Xl,jsx as De,jsxs as fo}from"react/jsx-runtime";var bg=()=>{let{chains:e,rpcConfig:t,appId:r,closePrivyModal:o}=M(),{navigate:n,setModalData:i,app:a,data:l}=_(),[s,c]=La(null),[m,f]=La(null),[u,v]=La(null),[g,y]=La(null),[b,T]=La(!1),k=l?.funding&&R6(l.funding.amount,"ether").toHexString(),E=l?.funding&&l.funding.chain.id,{wallets:P}=zr(),{tokenPrice:x,isTokenPriceLoading:I}=uo({chainId:s?.chainId&&Bi(s.chainId)?Bi(s.chainId):void 0}),N=async Y=>{for(let X of Y)E&&Bi(X.chainId)!==E&&await X.switchChain(E)},H=new Le(async()=>{let Y=P[0];if(!Y){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}c(Y);let X=P.find(Fe=>wg(Fe.address)===wg(l?.funding?.address??""));if(!X){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}if(f(X),!E){console.error(`Chain ID not found for input ${l?.funding?.chain.id}.`),n("ERROR_SCREEN",!1);return}let te=Gt(E,e,t,{appId:r}),_e={from:Y.address,to:X.address,value:k,chainId:E},Te=await O6(Y.address,_e,te),{totalGasEstimate:Ke}=await W6(Te,te),{balance:Ge,hasSufficientFunds:ut}=await Fi(Y.address,Te,Ke,te);if(y({gas:Ke.toHexString(),balance:Ge.toHexString()}),!ut){v(new w(`Wallet ${ct(Y.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}await N([Y,X]);try{let se=await(await Y.getEthersProvider()).getSigner(),{wait:Ft}=await se.sendTransaction(Te);await Ft(1),T(!0)}catch(Fe){v(Fe)}});bp(()=>{H.execute()},[]),bp(()=>{if(!u)return;let Y={error:u,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};i({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Y}),n("ERROR_SCREEN",!1)},[u]);let K=s?qo(s.walletClientType,s.connectorType,s.walletClientType)||"wallet":null,j=!s||!g||I||!l?.funding||!k,O=j?void 0:Oa([g.gas,k]),D=O&&x?mo(O,x):void 0,W=O?fr(O,"ETH"):void 0,ve=g&&x?mo(g.gas,x):void 0,Ie=g?fr(g.gas,"ETH"):void 0;return bp(()=>{if(!b)return;let Y=setTimeout(o,Ws);return()=>clearTimeout(Y)},[b]),j?fo(Xl,{children:[De(dr,{}),De(vp,{}),De("div",{style:{marginTop:"1rem"}}),De(z,{})]}):b?fo(Xl,{children:[De(dr,{}),De(oe,{}),fo(ir,{children:[De(I6,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),De(ye,{title:"Success!",description:`You\u2019ve successfully added ${k6(k,"ether")} ETH to your ${a.name} wallet. It may take a minute before the funds are available to use.`})]}),De(ne,{}),De(z,{})]}):fo(Xl,{children:[De(dr,{}),De(vp,{}),De(wt,{style:{marginTop:"16px"},children:De(El,{icon:Sl(s.walletClientType,s.connectorType,s.walletClientType),name:s.walletClientType})}),De(ye,{style:{marginTop:"8px",marginBottom:"12px"},title:`Confirming with ${K}`}),g&&De(Xl,{children:fo(Yl,{children:[fo(pr,{children:[De(ur,{children:"Total"}),De(mr,{children:D||W})]}),fo(pr,{children:[De(ur,{children:"To"}),De(mr,{children:ct(m?.address)})]}),fo(pr,{children:[De(ur,{children:"Network"}),De(mr,{children:fo(L6,{children:[_l(l.funding.chain.id)," ",l.funding.chain.name]})})]}),fo(pr,{children:[De(ur,{children:"Estimated fee"}),De(mr,{children:ve||Ie})]})]})}),De(bi,{height:24}),De(z,{})]})},L6=M6.div`
1605
1619
  display: flex;
1606
1620
  flex-direction: row;
1607
1621
  align-items: center;
1608
1622
  gap: 4px;
1609
- `;import{WalletIcon as k6}from"@heroicons/react/24/outline";import{jsx as yp,jsxs as p6}from"react/jsx-runtime";var Hi=({size:e=61,...t})=>yp("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:p6("g",{id:"moonpay_symbol_wht 2",children:[yp("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),yp("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 Ao from"styled-components";import u6 from"@heroicons/react/24/outline/ClockIcon";import m6 from"@heroicons/react/24/outline/TrashIcon";import f6 from"@heroicons/react/24/solid/CheckBadgeIcon";import h6 from"@heroicons/react/24/solid/CheckCircleIcon";import y6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as g6,useState as La}from"react";import Ar,{css as vg}from"styled-components";import{jsx as fg}from"react/jsx-runtime";var Dn=({style:e,...t})=>fg("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:fg("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 Be,jsxs as hg}from"react/jsx-runtime";var Un=({style:e,...t})=>hg("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:[hg("g",{clipPath:"url(#clip0_113_33841)",children:[Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as gp,jsx as fe,jsxs as er}from"react/jsx-runtime";var yg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=La([]),a=t?e.length:2,l=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",s=async c=>{i(m=>m.concat([c])),await r(c),i(m=>m.filter(f=>f!==c))};return er("div",{children:[fe(T6,{children:"Your passkeys"}),er(wg,{children:[e.slice(0,a).map(c=>er(P6,{children:[er("div",{children:[fe(S6,{children:l(c)}),er(_6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),fe(A6,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?fe(eo,{}):fe(m6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&fe(vp,{onClick:o,children:"View all"})]})]})},v6=()=>er(wg,{children:[er(Zt,{children:[fe(Yt,{children:fe(f6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),er(Zt,{children:[fe(Yt,{children:fe(y6,{})}),"More secure than a password."]}),er(Zt,{children:[fe(Yt,{children:fe(u6,{})}),"Takes seconds to set up and use."]})]}),Cg=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=I(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=La(!1),[l,s]=La(""),[c,m]=La(!1),[f,u]=La(!1);g6(()=>{n.length===0&&u(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>m(!0)).catch(y=>{if(y instanceof et){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},w=async y=>(a(!0),await t(y).then(()=>m(!0)).catch(b=>{if(b instanceof et&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?er(gp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Ie,{children:fe(Ke,{status:"success",children:fe(h6,{})})}),fe(gg,{children:"Passkey added"}),fe(b6,{children:"From now on, you can use your passkey to log in."}),fe(Tt,{children:fe(F,{onClick:()=>o(),children:"Done"})}),fe(Z,{})]}):f?er(gp,{children:[fe(_,{backFn:()=>u(!1),onClose:()=>o()},"header"),fe(yg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>u(!0)}),fe(Z,{})]}):er(gp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Ie,{children:er(Yl,{children:[fe(Dn,{}),fe(Un,{})]})}),fe(gg,{children:"Secure your account with a passkey"}),fe(E6,{}),n.length===0?fe(v6,{}):fe(yg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>u(!0)}),er(Tt,{style:{marginTop:"12px"},children:[l&&fe(C6,{fail:!0,children:l}),fe(F,{onClick:g,loading:i,children:"Add new passkey"})]}),fe(Z,{})]})},Yl=Ar.div`
1623
+ `;import D6 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import U6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as F6,useMemo as B6,useState as xg}from"react";import kg from"styled-components";async function ec({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(i=>i.provider_app_id===r);if(!n)throw new w("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 Eg({api:e,appId:t}){let r=bn(),o=oi(),n=await ni(r);try{let{url:i}=await e.post(ws,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw le(i)}}async function Tg({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new w("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new w("User denied confirmation during cross-app auth flow");try{return(await e.post(bs,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(i){let a=le(i);throw a.privyErrorCode?new w(a.message||"Invalid code during cross-app auth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during cross-app auth flow"?new w("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new w("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}var tc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let a=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(v=>v.address===t)));if(!e||!a)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new w("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(a.providerApp.id),s=await ec({api:r.api,requesterAppId:n,providerAppId:a.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new w("Cannot transact against a read-only provider app");await i({appId:a.providerApp.id})&&(l=r.getProviderAccessToken(a.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new w("Transactions require a valid token");let c=window.open(void 0,void 0,Na({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new w("Failed to initialize signature request");let m=new URL(`${s.apiUrl}/oauth/transact`);return m.searchParams.set("token",l||""),m.searchParams.set("request",N6(o)),c.location=m.href,new Promise((u,v)=>{let y=setTimeout(()=>{k(),v(new w("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(k(),v(new w("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),T=E=>{E.data&&(E.data.token?.action==="set"&&E.data.token?.value!==void 0?r.storeProviderAccessToken(a.providerApp.id,E.data.token.value):E.data.token?.action==="clear"&&r.storeProviderAccessToken(a.providerApp.id,null),E.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&E.data.result&&(k(),u(E.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),E.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&E.data.error&&(k(),v(E.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:E.data.error,address:t}})))};window.addEventListener("message",T);let k=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",T)}})},N6=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),Na=({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,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=n/window.screen.availWidth,l=i/window.screen.availHeight,s=(n-e)/2/a+r,c=(i-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var Hi="sdk_fiat_on_ramp_completed_with_status";var Sg={1:"ethereum",8453:"base",10:"optimism",137:"polygon",42161:"arbitrum"},_g=e=>!!Sg[e];function Pg(e){let t=Sg[e];if(!t)throw new w(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}var Ag=({input:e,amount:t,blockchain:r})=>{let o=new URL("https://pay.coinbase.com/buy/select-asset");return o.searchParams.set("appId",e.app_id),o.searchParams.set("sessionToken",e.session_token),o.searchParams.set("defaultExperience","buy"),o.searchParams.set("presetCryptoAmount",t),o.searchParams.set("defaultNetwork",r),o.searchParams.set("partnerUserId",e.partner_user_id),{url:o}};import{Fragment as Mg,jsx as hr,jsxs as Da}from"react/jsx-runtime";var H6=240,Rg=1500,G6=Math.floor(H6*1e3/Rg),Ig=()=>{let{data:e,setModalData:t,navigate:r}=_(),{closePrivyModal:o,createAnalyticsEvent:n,initCoinbaseOnRamp:i,getCoinbaseOnRampStatus:a}=M(),l=e?.funding,[s,c]=xg(!1),[m,f]=xg(!1);return F6(()=>{if(s)return;c(!0);let u=async()=>{try{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp"}});let g=window.open(void 0,void 0,Na({w:440,h:680})),y=Pg(l.chain.id),b=await i({addresses:[{address:l.address,blockchains:[y]}]}),{url:T}=Ag({input:b,amount:l.amount,blockchain:y});if(!g)throw new Error("Unable to initiate Coinbase Onramp flow.");g.location=T.toString();let k=0,E=!1;for(;k<G6;){k++;let{status:P}=await a({partnerUserId:b.partner_user_id});if(P==="success"){E=!0;break}if(P==="failure")throw new Error("There was an error completing Coinbase Onramp flow.");if(g.closed)throw new Error("User exited Coinbase Onramp flow before transaction response.");await new Promise(x=>setTimeout(x,Rg))}if(!E)throw new Error("Timed out waiting for transaction response from Coinbase Onramp.");n({eventName:Hi,payload:{status:"success",provider:"coinbase-onramp"}}),f(!0)}catch(g){console.error(g),n({eventName:Hi,payload:{status:"failure",provider:"coinbase-onramp",error:g.message}}),t({funding:{...l,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),r("FUNDING_METHOD_SELECTION_SCREEN")}finally{c(!1)}},v=setTimeout(()=>void u(),500);return()=>clearTimeout(v)},[]),Da(Mg,{children:[hr(A,{title:"Fund account"},"header"),hr(q6,{isSucccess:m,onClickCta:o}),hr(z,{})]})},V6=e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""},q6=({isSucccess:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=B6(()=>V6(e),[e]);return Da(Mg,{children:[Da(Y6,{children:[hr(K6,{isSucccess:e}),Da(qe,{children:[hr("h3",{children:r}),hr(j6,{children:o})]})]}),n&&hr(B,{onClick:t,children:n})]})},z6=e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)",$6=e=>e?U6:()=>hr(D6,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),K6=({isSucccess:e})=>{if(!e){let o="var(--privy-color-foreground-4)";return Da("div",{style:{position:"relative"},children:[hr(nt,{color:o,style:{position:"absolute"}}),hr(ga,{color:o}),hr(So,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let t=$6(e),r=z6(e);return hr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&hr(t,{width:"4rem",height:"4rem",color:r})})},j6=kg.p`
1624
+ font-size: 1rem;
1625
+ color: var(--privy-color-foreground-3);
1626
+ margin-bottom: 1rem;
1627
+ display: flex;
1628
+ flex-direction: column;
1629
+ gap: 1rem;
1630
+ `,Y6=kg.div`
1631
+ display: flex;
1632
+ flex-direction: column;
1633
+ align-items: center;
1634
+ justify-content: center;
1635
+ margin-left: 1.75rem;
1636
+ margin-right: 1.75rem;
1637
+ padding: 2rem 0;
1638
+ `;import{getAddress as jg}from"@ethersproject/address";import{PencilIcon as bb,WalletIcon as Eb}from"@heroicons/react/24/outline";import{useEffect as Tb,useRef as Sb,useState as _b}from"react";import{ExclamationTriangleIcon as Z6}from"@heroicons/react/24/outline";import Q6 from"styled-components";import{jsx as X6,jsxs as eb}from"react/jsx-runtime";var Wg=({children:e})=>eb(J6,{children:[X6(Z6,{width:"3rem",color:"var(--privy-color-error)"}),e]}),J6=Q6.div`
1639
+ display: flex;
1640
+ gap: 0.5rem;
1641
+ background-color: var(--privy-color-error-light);
1642
+
1643
+ align-items: flex-start;
1644
+ text-align: left;
1645
+ padding: 0.5rem 0.75rem;
1646
+
1647
+ font-size: 0.75rem;
1648
+ font-weight: 400;
1649
+ line-height: 1.125rem; /* 150% */
1650
+
1651
+ padding: 0.5rem 0.75rem;
1652
+
1653
+ && {
1654
+ border: 1px solid var(--privy-color-error);
1655
+ border-radius: var(--privy-border-radius-sm);
1656
+ }
1657
+ `;import{jsx as Ep,jsxs as tb}from"react/jsx-runtime";var Gi=({size:e=61,...t})=>Ep("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:tb("g",{id:"moonpay_symbol_wht 2",children:[Ep("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Ep("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 Ir,{keyframes as Cb}from"styled-components";import rb from"@heroicons/react/24/outline/ClockIcon";import ob from"@heroicons/react/24/outline/TrashIcon";import nb from"@heroicons/react/24/solid/CheckBadgeIcon";import ib from"@heroicons/react/24/solid/CheckCircleIcon";import ab from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as sb,useState as Ua}from"react";import Rr,{css as Ug}from"styled-components";import{jsx as Og}from"react/jsx-runtime";var Bn=({style:e,...t})=>Og("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:Og("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 Be,jsxs as Lg}from"react/jsx-runtime";var Hn=({style:e,...t})=>Lg("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:[Lg("g",{clipPath:"url(#clip0_113_33841)",children:[Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Tp,jsx as fe,jsxs as tr}from"react/jsx-runtime";var Ng=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=Ua([]),a=t?e.length:2,l=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",s=async c=>{i(m=>m.concat([c])),await r(c),i(m=>m.filter(f=>f!==c))};return tr("div",{children:[fe(mb,{children:"Your passkeys"}),tr(Bg,{children:[e.slice(0,a).map(c=>tr(yb,{children:[tr("div",{children:[fe(fb,{children:l(c)}),tr(hb,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),fe(vb,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?fe(ro,{}):fe(ob,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&fe(Sp,{onClick:o,children:"View all"})]})]})},lb=()=>tr(Bg,{children:[tr(Qt,{children:[fe(Zt,{children:fe(nb,{})}),"Log in with Touch ID, Face ID, or a security key."]}),tr(Qt,{children:[fe(Zt,{children:fe(ab,{})}),"More secure than a password."]}),tr(Qt,{children:[fe(Zt,{children:fe(rb,{})}),"Takes seconds to set up and use."]})]}),Fg=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=Ua(!1),[l,s]=Ua(""),[c,m]=Ua(!1),[f,u]=Ua(!1);sb(()=>{n.length===0&&u(!1)},[n.length]);let v=()=>{a(!0),r().then(()=>m(!0)).catch(y=>{if(y instanceof Xe){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},g=async y=>(a(!0),await t(y).then(()=>m(!0)).catch(b=>{if(b instanceof Xe&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?tr(Tp,{children:[fe(A,{onClose:()=>o()},"header"),fe(Me,{children:fe(Ye,{status:"success",children:fe(ib,{})})}),fe(Dg,{children:"Passkey added"}),fe(pb,{children:"From now on, you can use your passkey to log in."}),fe(Tt,{children:fe(B,{onClick:()=>o(),children:"Done"})}),fe(Z,{})]}):f?tr(Tp,{children:[fe(A,{backFn:()=>u(!1),onClose:()=>o()},"header"),fe(Ng,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),fe(Z,{})]}):tr(Tp,{children:[fe(A,{onClose:()=>o()},"header"),fe(Me,{children:tr(rc,{children:[fe(Bn,{}),fe(Hn,{})]})}),fe(Dg,{children:"Secure your account with a passkey"}),fe(ub,{}),n.length===0?fe(lb,{}):fe(Ng,{passkeys:n,expanded:f,onUnlink:g,onExpand:()=>u(!0)}),tr(Tt,{style:{marginTop:"12px"},children:[l&&fe(cb,{fail:!0,children:l}),fe(B,{onClick:v,loading:i,children:"Add new passkey"})]}),fe(Z,{})]})},rc=Rr.div`
1610
1658
  display: flex;
1611
1659
  align-items: center;
1612
1660
  justify-content: center;
@@ -1622,7 +1670,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1622
1670
  stroke: var(--privy-color-accent) !important;
1623
1671
  fill: var(--privy-color-accent) !important;
1624
1672
  }
1625
- `,C6=Ar.div`
1673
+ `,cb=Rr.div`
1626
1674
  line-height: 20px;
1627
1675
  height: 20px;
1628
1676
  font-size: 13px;
@@ -1630,7 +1678,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1630
1678
  display: flex;
1631
1679
  justify-content: flex-beginngin;
1632
1680
  width: 100%;
1633
- `,w6=vg`
1681
+ `,db=Ug`
1634
1682
  && {
1635
1683
  width: 100%;
1636
1684
  font-size: 0.875rem;
@@ -1655,9 +1703,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1655
1703
  box-shadow: none;
1656
1704
  }
1657
1705
  }
1658
- `,vp=Ar.button`
1659
- ${w6}
1660
- `,wg=Ar.div`
1706
+ `,Sp=Rr.button`
1707
+ ${db}
1708
+ `,Bg=Rr.div`
1661
1709
  display: flex;
1662
1710
  flex-direction: column;
1663
1711
  align-items: stretch;
@@ -1665,18 +1713,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1665
1713
  padding: 0.5rem 0rem 0rem;
1666
1714
  flex-grow: 1;
1667
1715
  width: 100%;
1668
- `,gg=Ar.div`
1716
+ `,Dg=Rr.div`
1669
1717
  font-size: 18px;
1670
1718
  line-height: 18px;
1671
1719
  text-align: center;
1672
1720
  font-weight: 600;
1673
- `,b6=Ar.div`
1721
+ `,pb=Rr.div`
1674
1722
  font-size: 0.875rem;
1675
1723
  text-align: center;
1676
1724
  margin-top: 10px;
1677
- `,E6=Ar.div`
1725
+ `,ub=Rr.div`
1678
1726
  height: 32px;
1679
- `,T6=Ar.div`
1727
+ `,mb=Rr.div`
1680
1728
  line-height: 20px;
1681
1729
  height: 20px;
1682
1730
  font-size: 1em;
@@ -1684,18 +1732,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1684
1732
  display: flex;
1685
1733
  justify-content: flex-beginning;
1686
1734
  width: 100%;
1687
- `,S6=Ar.div`
1735
+ `,fb=Rr.div`
1688
1736
  font-size: 1em;
1689
1737
  line-height: 1.3em;
1690
1738
  font-weight: 500;
1691
1739
  color: var(--privy-color-foreground-2);
1692
1740
  padding: 0.2em 0;
1693
- `,_6=Ar.div`
1741
+ `,hb=Rr.div`
1694
1742
  font-size: 0.875rem;
1695
1743
  line-height: 1rem;
1696
1744
  color: #64668b;
1697
1745
  padding: 0.2em 0;
1698
- `,P6=Ar.div`
1746
+ `,yb=Rr.div`
1699
1747
  display: flex;
1700
1748
  align-items: center;
1701
1749
  justify-content: space-between;
@@ -1708,7 +1756,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1708
1756
  border: 1px solid #e2e3f0 !important;
1709
1757
  width: 100%;
1710
1758
  height: 5em;
1711
- `,x6=vg`
1759
+ `,gb=Ug`
1712
1760
  :focus,
1713
1761
  :hover,
1714
1762
  :active {
@@ -1725,40 +1773,57 @@ You will need this password to access your ${e} wallet on a new device. Please k
1725
1773
  svg:hover {
1726
1774
  color: var(--privy-color-foreground-3);
1727
1775
  }
1728
- `,A6=Ar.button`
1729
- ${x6}
1730
- `;var bg=Ao.div`
1776
+ `,vb=Rr.button`
1777
+ ${gb}
1778
+ `;var Hg=Ir.div`
1731
1779
  display: flex;
1732
1780
  flex-direction: column;
1733
1781
  gap: 12px;
1734
1782
  padding-top: 24px;
1735
1783
  padding-bottom: 24px;
1736
- `,Zl=Ao.div`
1784
+ `,oc=Ir.div`
1737
1785
  width: 24px;
1738
1786
  height: 24px;
1739
1787
  display: flex;
1740
1788
  justify-content: center;
1741
1789
  align-items: center;
1742
- `,Ql=Ao.div`
1790
+ `,nc=Ir.div`
1743
1791
  display: flex;
1744
1792
  flex-direction: column;
1745
1793
  justify-content: center;
1746
1794
  align-items: center;
1747
1795
  gap: 8px;
1748
- `,Jl=Ao.div`
1796
+ `,ic=Ir.div`
1749
1797
  display: flex;
1750
1798
  align-items: baseline;
1751
1799
  gap: 4px;
1752
- `,Xl=Ao.div`
1753
- font-size: 42px;
1754
- `,ec=Ao.div`
1800
+ `,Gg=Ir.div`
1801
+ font-size: 42px !important;
1802
+ `,Vg=Ir.input`
1803
+ font-size: 42px !important;
1804
+ text-align: right;
1805
+
1806
+ // HACK: The only way this is centerable is to set a content-based width.
1807
+ // The --funding-input-length is updated via the component.
1808
+ // Note that 'ch' has 98.25% global browser adoption
1809
+ width: calc(1ch * var(--funding-input-length));
1810
+
1811
+ &:focus {
1812
+ outline: none !important;
1813
+ border: none !important;
1814
+ box-shadow: none !important;
1815
+ }
1816
+ `,qg=Ir.div`
1817
+ cursor: pointer;
1818
+ padding-left: 4px;
1819
+ `,ac=Ir.div`
1755
1820
  font-size: 18px;
1756
- `,tc=Ao.div`
1821
+ `,sc=Ir.div`
1757
1822
  font-size: 12px;
1758
1823
  color: var(--privy-color-foreground-3);
1759
1824
  // we need this container to maintain a static height if there's no content
1760
1825
  height: 20px;
1761
- `,Eg=Ao.div`
1826
+ `,zg=Ir.div`
1762
1827
  display: flex;
1763
1828
  flex-direction: row;
1764
1829
  line-height: 22px;
@@ -1768,24 +1833,34 @@ You will need this password to access your ${e} wallet on a new device. Please k
1768
1833
  margin-right: 6px;
1769
1834
  margin: auto;
1770
1835
  }
1771
- `,Tg=Ao(vp)`
1836
+ `,$g=Ir(Sp)`
1772
1837
  margin-top: 16px;
1773
- `;import{Fragment as R6,jsx as hr,jsxs as Zo}from"react/jsx-runtime";var Sg=()=>{let{wallets:e}=Gr(),{app:t,navigate:r,data:o}=S(),n=o?.funding,{tokenPrice:i}=co({chainId:n.chain.id}),a=i?Kl(n.amount,i):void 0,l=e.find(c=>Qe(c.address)===Qe(n.address)),s=l&&l.walletClientType!=="privy"?Bo(l.walletClientType,l.connectorType,l.walletClientType):t.name;return Zo(R6,{children:[hr(dr,{}),Zo("h3",{children:["Add funds to your"," ",s?.toLowerCase().endsWith("wallet")?s:s+" wallet"]}),hr(Fo,{style:{marginTop:"32px"},children:Zo(Ql,{children:[Zo(Jl,{children:[hr(Xl,{children:n.amount}),hr(ec,{children:n.chain.nativeCurrency.symbol})]}),hr(tc,{children:a?`${a} USD`:"..."})]})}),Zo(bg,{children:[t.fundingConfig?.methods.sort().map(c=>{switch(c){case"moonpay":return Zo(Ee,{onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[hr(Zl,{children:hr(Hi,{style:{width:24}})}),"Moonpay"]},c);case"coinbase-onramp":return Zo(Ee,{onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[hr(Zl,{children:hr(En,{style:{width:24}})}),"Coinbase OnRamp"]},c);case"external":return Zo(Ee,{onClick:()=>{r("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[hr(Zl,{children:hr(k6,{style:{width:24}})}),"Transfer from wallet"]},c)}}),hr(Tg,{onClick:()=>r("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),hr($,{})]})};import{formatUnits as H6}from"@ethersproject/units";import{DocumentDuplicateIcon as V6,InformationCircleIcon as G6,QrCodeIcon as q6}from"@heroicons/react/24/outline";import{useEffect as z6,useState as bp}from"react";import Vi from"styled-components";import U6 from"styled-components";import M6 from"styled-components";var _g=M6.div`
1838
+ `,wb=Cb`
1839
+ from {
1840
+ opacity: 0;
1841
+ }
1842
+ to {
1843
+ opacity: 1;
1844
+ }
1845
+ `,Kg=Ir(Ho)`
1846
+ border-radius: var(--privy-border-radius-md) !important;
1847
+ animation: ${wb} 0.3s ease-in-out;
1848
+ `;import{Fragment as Pb,jsx as At,jsxs as en}from"react/jsx-runtime";var Yg=()=>{let{wallets:e}=zr(),{app:t,navigate:r,data:o,setModalData:n}=_(),i=o?.funding,a=Sb(null),[l,s]=_b(!1);Tb(()=>{a.current&&a.current.style.setProperty("--funding-input-length",Math.max(i.amount.length,1).toString())},[i.amount]);let c=t.fundingConfig?.methods.slice()??[],{tokenPrice:m}=uo({chainId:i.chain.id}),f=m?Jl(i.amount,m):void 0,u=e.find(b=>jg(b.address)===jg(i.address)),v=u&&u.walletClientType!=="privy"?qo(u.walletClientType,u.connectorType,u.walletClientType):t.name,g=parseFloat(i.amount),y=!isNaN(g)&&g>0;return en(Pb,{children:[At(dr,{}),en("h3",{children:["Add funds to your"," ",v?.toLowerCase().endsWith("wallet")?v:v+" wallet"]}),At(Vo,{style:{marginTop:"32px"},children:en(nc,{children:[en(ic,{onClick:()=>a.current?.focus(),children:[At(Vg,{ref:a,value:i.amount,onFocus:()=>s(!0),onBlur:()=>s(!1),onChange:b=>{let T=b.target.value;/^[0-9.]*$/.test(T)&&T.split(".").length-1<=1&&n({...o,funding:{...i,amount:T}})}}),At(ac,{children:i.chain.nativeCurrency.symbol}),!l&&At(qg,{children:At(bb,{width:12,height:12})})]}),At(sc,{children:f&&y?f:""})]})}),en(Hg,{children:[i.errorMessage&&At(Wg,{children:i.errorMessage}),c.sort().map(b=>{switch(b){case"moonpay":return en(Ee,{disabled:!y,onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[At(oc,{children:At(Gi,{style:{width:24}})}),"Moonpay"]},b);case"coinbase-onramp":return _g(Number(i.chain.id))?en(Ee,{disabled:!y,onClick:()=>{r("COINBASE_ONRAMP_STATUS_SCREEN")},children:[At(oc,{children:At(So,{style:{width:24}})}),"Coinbase Onramp"]},b):null;case"external":return en(Ee,{disabled:!y,onClick:()=>{r("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[At(oc,{children:At(Eb,{style:{width:24}})}),"Transfer from wallet"]},b)}}),At($g,{disabled:!y,onClick:()=>r("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),At(z,{})]})};import{formatUnits as Db}from"@ethersproject/units";import{DocumentDuplicateIcon as Ub,InformationCircleIcon as Fb,QrCodeIcon as Bb}from"@heroicons/react/24/outline";import{useEffect as Hb,useMemo as Gb,useState as Pp}from"react";import Vi from"styled-components";import Ob from"styled-components";import Ab from"styled-components";var Zg=Ab.div`
1774
1849
  display: flex;
1775
1850
  flex-direction: column;
1776
- `;import I6 from"styled-components";var Oa=I6.span`
1851
+ `;import xb from"styled-components";var Fa=xb.span`
1777
1852
  text-align: left;
1778
1853
  font-size: 0.75rem;
1779
1854
  font-weight: 500;
1780
1855
  line-height: 1.125rem; /* 150% */
1781
1856
 
1782
1857
  color: var(--privy-color-error);
1783
- `;import W6 from"styled-components";var Pg=W6.span`
1858
+ `;import kb from"styled-components";var Qg=kb.span`
1784
1859
  color: var(--privy-color-foreground-3);
1785
1860
  font-size: 0.75rem;
1786
1861
  font-weight: 500;
1787
1862
  line-height: 1.125rem; /* 150% */
1788
- `;import L6 from"@heroicons/react/24/outline/Square2StackIcon";import O6 from"styled-components";import{jsx as xg,jsxs as D6}from"react/jsx-runtime";var Na=({address:e,showCopyIcon:t,url:r,className:o})=>r?xg("a",{title:e,className:o,href:`${r}/address/${e}`,target:"_blank",children:Qe(e)}):D6("button",{title:e,className:o,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[Qe(e),t&&xg(N6,{})]}),N6=O6(L6)`
1863
+ `;import Rb from"@heroicons/react/24/outline/Square2StackIcon";import Ib from"styled-components";import{jsx as Jg,jsxs as Wb}from"react/jsx-runtime";var Ba=({address:e,showCopyIcon:t,url:r,className:o})=>r?Jg("a",{title:e,className:o,href:`${r}/address/${e}`,target:"_blank",children:ct(e)}):Wb("button",{title:e,className:o,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[ct(e),t&&Jg(Mb,{})]}),Mb=Ib(Rb)`
1789
1864
  && {
1790
1865
  display: inline;
1791
1866
  }
@@ -1794,7 +1869,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1794
1869
  width: 0.875rem;
1795
1870
  margin-left: 0.125rem;
1796
1871
  color: var(--privy-color-foreground-3);
1797
- `;import{Fragment as B6,jsx as rc,jsxs as Cp}from"react/jsx-runtime";var oc=({errMsg:e,balance:t,address:r,isLoading:o,className:n,title:i})=>Cp(B6,{children:[Cp(F6,{className:n,$state:e?"error":void 0,children:[Cp(_g,{children:[rc(Pg,{children:i||"Pay with"}),rc(Na,{address:r,showCopyIcon:!!e})]}),rc(Jt,{isLoading:o,color:e?"red":"green",children:t})]}),e&&rc(Oa,{style:{marginTop:"0.25rem"},children:e})]}),F6=U6.div`
1872
+ `;import{Fragment as Nb,jsx as lc,jsxs as _p}from"react/jsx-runtime";var cc=({errMsg:e,balance:t,address:r,isLoading:o,className:n,title:i,isPulsing:a,statusColor:l="green"})=>{let s;return l?s=l:e?s="red":s="green",_p(Nb,{children:[_p(Lb,{className:n,$state:e?"error":void 0,children:[_p(Zg,{children:[lc(Qg,{children:i||"Pay with"}),lc(Ba,{address:r,showCopyIcon:!!e})]}),lc(Xt,{isLoading:o,isPulsing:a,color:s,children:t})]}),e&&lc(Fa,{style:{marginTop:"0.25rem"},children:e})]})},Lb=Ob.div`
1798
1873
  && {
1799
1874
  border-width: 1px;
1800
1875
  }
@@ -1808,11 +1883,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1808
1883
  align-items: center;
1809
1884
 
1810
1885
  ${e=>e.$state==="error"?"border-color: var(--privy-color-error);":""}
1811
- `;import{Fragment as wp,jsx as je,jsxs as Ot}from"react/jsx-runtime";var Ag=()=>{let{wallets:e}=Gr(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:i}=S(),{chains:a,rpcConfig:l,appId:s}=I(),[c,m]=bp("default"),[f,u]=bp(void 0),g=r?.funding,{tokenPrice:w}=co({chainId:g.chain.id}),y=w?Kl(g.amount,w):void 0,b=e.find(T=>Qe(T.address)===Qe(g.address)),P=b&&b.walletClientType!=="privy"?Bo(b.walletClientType,b.connectorType,b.walletClientType):t.name;if(!g)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:i||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),je(wp,{});z6(()=>{rr(g.chain.id,a,l,{appId:s}).getBalance(g.address).then(x=>u(x.toString())).catch(()=>u(void 0))},[]);let A=je(oc,{title:"Your wallet",errMsg:void 0,isLoading:!g||!f,balance:`${f?parseFloat(H6(f,"ether")).toPrecision(4):""} ETH`,address:g.address});return c==="qr-code"?Ot(wp,{children:[je(_,{backFn:()=>m("default")}),Ot(Fo,{style:{gap:"24px",marginBottom:"24px"},children:[Ot("div",{children:[je(de,{children:"Scan QR code"}),Ot(ue,{children:["Scan this code using your mobile wallet to send funds to your ",P," ","wallet."]})]}),je(Yo,{url:g.address,size:200,squareLogoElement:$6}),A]}),je($,{})]}):Ot(wp,{children:[je(dr,{}),je(ye,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),Ot(Fo,{style:{gap:"16px"},children:[Ot(Y6,{children:[je(G6,{height:"20px",width:"20px",color:"#4f46e5"}),Ot(Z6,{children:["Make sure to send on ",g.chain.name,"."]})]}),Ot(Q6,{children:[je(bi,{height:16}),Ot(Ql,{children:[Ot(Jl,{children:[je(Xl,{children:g.amount}),je(ec,{children:g.chain.nativeCurrency.symbol})]}),je(tc,{children:y?`${y} USD`:"..."}),Ot(Eg,{children:[wl(g.chain.id),g.chain.name]})]}),je(bi,{height:8}),Ot(j6,{children:[je(K6,{text:g.address}),je(Rg,{onClick:()=>m("qr-code"),children:Ot(kg,{children:[je(q6,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),A]}),je(bi,{height:16}),je($,{})]})},$6=({...e})=>je(Do,{color:"black",...e}),K6=e=>{let[t,r]=bp(!1);return je(Rg,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:Ot(kg,{children:[t?je(Ui,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):je(V6,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},j6=Vi.div`
1886
+ `;import{Fragment as dc,jsx as ze,jsxs as xt}from"react/jsx-runtime";var Vb=2e3,Xg=()=>{let{wallets:e}=zr(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:i}=_(),{chains:a,rpcConfig:l,appId:s,closePrivyModal:c}=M(),[m,f]=Pp("default"),[u,v]=Pp(void 0),g=r?.funding,{tokenPrice:y}=uo({chainId:g.chain.id}),b=y?Jl(g.amount,y):void 0,T=e.find(x=>ct(x.address)===ct(g.address)),k=T&&T.walletClientType!=="privy"?qo(T.walletClientType,T.connectorType,T.walletClientType):t.name;if(!g)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:i||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),ze(dc,{});Hb(()=>{let x=Gt(g.chain.id,a,l,{appId:s});function I(){x.getBalance(g.address).then(H=>v(parseFloat(Db(H,"ether")))).catch(()=>v(void 0))}let N=setInterval(I,Vb);return I(),()=>clearInterval(N)},[]);let E=Gb(()=>u!==void 0?u>=parseFloat(g.amount):!1,[u,g.amount]),P=xt(dc,{children:[ze(cc,{title:"Your wallet",errMsg:void 0,isLoading:!g||u===void 0,isPulsing:!E,balance:`${u!==void 0?u.toPrecision(2):""} ETH`,address:g.address,statusColor:E?"green":"gray"}),E&&ze(Kg,{onClick:()=>c(),children:"Close"})]});return m==="qr-code"?xt(dc,{children:[ze(A,{backFn:()=>f("default")}),xt(Vo,{style:{gap:"24px",marginBottom:"24px"},children:[xt("div",{children:[ze(de,{children:"Scan QR code"}),xt(ue,{children:["Scan this code using your mobile wallet to send funds to your ",k," ","wallet."]})]}),ze(Xo,{url:g.address,size:200,squareLogoElement:qb}),P]}),ze(z,{})]}):xt(dc,{children:[ze(dr,{}),ze(ye,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),xt(Vo,{style:{gap:"16px"},children:[xt(Kb,{children:[ze(Fb,{height:"20px",width:"20px",color:"#4f46e5"}),xt(jb,{children:["Make sure to send on ",g.chain.name,"."]})]}),xt(Yb,{children:[ze(bi,{height:16}),xt(nc,{children:[xt(ic,{children:[ze(Gg,{children:g.amount}),ze(ac,{children:g.chain.nativeCurrency.symbol})]}),ze(sc,{children:b?`${b} USD`:"..."}),xt(zg,{children:[_l(g.chain.id),g.chain.name]})]}),ze(bi,{height:8}),xt($b,{children:[ze(zb,{text:g.address}),ze(t1,{onClick:()=>f("qr-code"),children:xt(e1,{children:[ze(Bb,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),P]}),ze(bi,{height:16}),ze(z,{})]})},qb=({...e})=>ze(Fo,{color:"black",...e}),zb=e=>{let[t,r]=Pp(!1);return ze(t1,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:xt(e1,{children:[t?ze(Ui,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):ze(Ub,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},$b=Vi.div`
1812
1887
  display: flex;
1813
1888
  flex-direction: row;
1814
1889
  gap: 8px;
1815
- `,Y6=Vi.div`
1890
+ `,Kb=Vi.div`
1816
1891
  display: flex;
1817
1892
  flex-direction: row;
1818
1893
  padding: 8px;
@@ -1821,11 +1896,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1821
1896
  svg {
1822
1897
  margin-right: 12px;
1823
1898
  }
1824
- `,Z6=Vi.div`
1899
+ `,jb=Vi.div`
1825
1900
  line-height: 20px;
1826
1901
  font-size: 18px
1827
1902
  text-align: center;
1828
- `,Q6=Vi.div`
1903
+ `,Yb=Vi.div`
1829
1904
  display: flex;
1830
1905
  flex-direction: column;
1831
1906
  background-color: #f1f2f9;
@@ -1835,11 +1910,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1835
1910
  }
1836
1911
  padding: 16px;
1837
1912
  gap: 8px;
1838
- `,kg=Vi.span`
1913
+ `,e1=Vi.span`
1839
1914
  display: flex;
1840
1915
  align-items: center;
1841
1916
  margin: auto;
1842
- `,Rg=Vi.button`
1917
+ `,t1=Vi.button`
1843
1918
  display: flex;
1844
1919
  align-items: center;
1845
1920
  width: 100%;
@@ -1875,7 +1950,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1875
1950
  width: 18px;
1876
1951
  height: 18px;
1877
1952
  }
1878
- `;import{useEffect as yb,useState as gb}from"react";import J6 from"@heroicons/react/24/outline/ClockIcon";import X6 from"@heroicons/react/24/outline/EyeSlashIcon";import eb from"@heroicons/react/24/outline/LinkIcon";import mo from"styled-components";import{Fragment as Mg,jsx as Nt,jsxs as Fn}from"react/jsx-runtime";var Ep=({title:e,desc:t,icon:r})=>Fn(ab,{children:[Nt(lb,{children:r}),Fn(sb,{children:[Nt(nb,{children:e}),Nt(ib,{children:t})]})]}),Ig=({app:e,signedUrl:t,onContinue:r})=>Fn(Mg,{children:[Fn(rb,{children:[Nt(Hi,{size:"3.75rem"}),Fn(ob,{children:[e?.name," uses ",Nt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Fn(cb,{children:[Nt(Ep,{icon:Nt(eb,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Fn(Mg,{children:["Connect a payment method (",Nt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Nt(Ep,{icon:Nt(J6,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Nt(Ep,{icon:Nt(X6,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Nt(db,{className:"mobile-only"})]}),Nt(tb,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Nt(nl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),tb=mo.span`
1953
+ `;import{useEffect as fE,useState as hE}from"react";import Zb from"@heroicons/react/24/outline/ClockIcon";import Qb from"@heroicons/react/24/outline/EyeSlashIcon";import Jb from"@heroicons/react/24/outline/LinkIcon";import ho from"styled-components";import{Fragment as r1,jsx as Dt,jsxs as Gn}from"react/jsx-runtime";var Ap=({title:e,desc:t,icon:r})=>Gn(nE,{children:[Dt(aE,{children:r}),Gn(iE,{children:[Dt(rE,{children:e}),Dt(oE,{children:t})]})]}),o1=({app:e,signedUrl:t,onContinue:r})=>Gn(r1,{children:[Gn(eE,{children:[Dt(Gi,{size:"3.75rem"}),Gn(tE,{children:[e?.name," uses ",Dt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Gn(sE,{children:[Dt(Ap,{icon:Dt(Jb,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Gn(r1,{children:["Connect a payment method (",Dt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Dt(Ap,{icon:Dt(Zb,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Dt(Ap,{icon:Dt(Qb,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Dt(lE,{className:"mobile-only"})]}),Dt(Xb,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Dt(cl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),Xb=ho.span`
1879
1954
  display: inline-block;
1880
1955
  color: var(--privy-color-foreground-3);
1881
1956
  text-align: center;
@@ -1884,13 +1959,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1884
1959
  font-weight: 400;
1885
1960
  line-height: 140%; /* 0.875rem */
1886
1961
  margin-bottom: 0.25rem;
1887
- `,rb=mo.div`
1962
+ `,eE=ho.div`
1888
1963
  display: flex;
1889
1964
  flex-direction: column;
1890
1965
  align-items: center;
1891
1966
  justify-content: center;
1892
1967
  padding: 1.5rem 0;
1893
- `,ob=mo.span`
1968
+ `,tE=ho.span`
1894
1969
  color: var(--privy-color-foreground);
1895
1970
  text-align: center;
1896
1971
  font-size: 1.125rem;
@@ -1899,46 +1974,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1899
1974
  margin: 1.5rem 0;
1900
1975
  text-align: center;
1901
1976
  max-width: 19.5rem;
1902
- `,nb=mo.span`
1977
+ `,rE=ho.span`
1903
1978
  color: var(--privy-color-foreground);
1904
1979
  font-size: 0.875rem;
1905
1980
  font-weight: 500;
1906
1981
  line-height: 1.225rem;
1907
1982
  width: 100%;
1908
- `,ib=mo.span`
1983
+ `,oE=ho.span`
1909
1984
  color: var(--privy-color-foreground-2);
1910
1985
  font-size: 0.875rem;
1911
1986
  font-weight: 400;
1912
1987
  line-height: 1.225rem;
1913
- `,ab=mo.div`
1988
+ `,nE=ho.div`
1914
1989
  display: flex;
1915
1990
  align-items: flex-start;
1916
1991
  gap: 0.5rem;
1917
1992
  align-self: stretch;
1918
- `,sb=mo.div`
1993
+ `,iE=ho.div`
1919
1994
  display: flex;
1920
1995
  flex-direction: column;
1921
1996
  gap: 0.25rem;
1922
1997
  align-items: flex-start;
1923
1998
  text-align: left;
1924
1999
  flex: 1 0 0;
1925
- `,lb=mo.div`
2000
+ `,aE=ho.div`
1926
2001
  padding-top: 2px;
1927
- `,cb=mo.div`
2002
+ `,sE=ho.div`
1928
2003
  display: flex;
1929
2004
  flex-direction: column;
1930
2005
  gap: 1.25rem;
1931
2006
  margin: 0 0.5rem;
1932
- `,db=mo.div`
2007
+ `,lE=ho.div`
1933
2008
  margin: 30px 0;
1934
- `;import{ofetch as pb}from"ofetch";import{useEffect as ub,useRef as mb,useState as fb}from"react";var nc="moonpay",Wg="sdk_fiat_on_ramp_completed_with_status";function Lg(e){switch(e){case"eip155:42161":return"ETH_ARBITRUM";case"eip155:43114":return"AVAX_CCHAIN";case"eip155:8453":return"ETH_BASE";case"eip155:42220":return"CELO_CELO";case"eip155:137":return"MATIC_POLYGON";case"eip155:1":return"ETH_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function Og(e){return parseFloat(e)}function Ng(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function ic(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function Dg(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function hb(e,t){let r=t?wm:Cm,o=t?Em:bm;return pb(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Ug(e,t=!1){let[r,o]=fb(null),{createAnalyticsEvent:n}=I(),i=mb(0);return ub(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await hb(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Wg,payload:{status:s,provider:nc,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n({eventName:Wg,payload:{status:"serviceFailure",provider:nc}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as vb,jsx as Tp,jsxs as Cb}from"react/jsx-runtime";var Fg=()=>{let{app:e,data:t,navigate:r,setModalData:o}=S(),{createAnalyticsEvent:n,getMoonpaySignedUrl:i}=I(),[a,l]=gb(null),s=t?.funding;return yb(()=>{if(a||!s)return;async function c(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:f}=await i(s.address,{...e.fundingMethodConfig.moonpay,...s.moonpayConfigOverride,currencyCode:s.moonpayConfigOverride?.currencyCode??Lg(`eip155:${s.chain.id}`),quoteCurrencyAmount:s.moonpayConfigOverride?.quoteCurrencyAmount??Og(s.amount)});l(m),o({moonpayStatus:{externalTransactionId:f},funding:t?.funding})}c()},[a,s]),Cb(vb,{children:[Tp(dr,{}),Tp(Ig,{app:e,signedUrl:a,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:nc}}),r("MOONPAY_STATUS_SCREEN")}}),Tp($,{})]})};import wb from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import bb from"@heroicons/react/24/solid/CheckCircleIcon";import Eb from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as Tb}from"react";import Bg from"styled-components";import{Fragment as Sp,jsx as Dt,jsxs as Bn}from"react/jsx-runtime";var Hg=()=>{let{app:e,data:t}=S(),{closePrivyModal:r}=I(),{externalTransactionId:o}=t?.moonpayStatus,n=Ug(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return Bn(Sp,{children:[Dt(_,{title:"Fund account"},"header"),Dt(_b,{status:n,onClickCta:r}),Dt($,{})]})},Sb=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(Sp,{children:[Bn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Dt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Dt("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:""}}},_b=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=Tb(()=>Sb(e),[e]);return Bn(Sp,{children:[Bn(Rb,{children:[Dt(Ab,{status:e}),Bn(Xe,{children:[Dt("h3",{children:r}),Dt(kb,{children:o})]})]}),n&&Dt(F,{onClick:t,children:n})]})},Pb=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)",xb=e=>{switch(e){case"serviceFailure":case"failed":return Eb;case"completed":return bb;case"waitingAuthorization":return()=>Dt(wb,{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}},Ab=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Bn("div",{style:{position:"relative"},children:[Dt(mt,{color:o,style:{position:"absolute"}}),Dt(Rd,{color:o}),Dt(Hi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=xb(e),r=Pb(e);return Dt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Dt(t,{width:"4rem",height:"4rem",color:r})})},kb=Bg.p`
2009
+ `;import{ofetch as cE}from"ofetch";import{useEffect as dE,useRef as pE,useState as uE}from"react";var pc="moonpay";function n1(e){switch(e){case"eip155:42161":return"ETH_ARBITRUM";case"eip155:43114":return"AVAX_CCHAIN";case"eip155:8453":return"ETH_BASE";case"eip155:42220":return"CELO_CELO";case"eip155:137":return"MATIC_POLYGON";case"eip155:1":return"ETH_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function i1(e){return parseFloat(e)}function a1(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function uc(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function s1(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function mE(e,t){let r=t?_m:Sm,o=t?Am:Pm;return cE(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function l1(e,t=!1){let[r,o]=uE(null),{createAnalyticsEvent:n}=M(),{data:i,navigate:a,setModalData:l}=_(),s=i?.funding,c=pE(0);return dE(()=>{let m=setInterval(async()=>{if(e)try{let[f]=await mE(e,t),u=f.status==="waitingAuthorization"&&f.paymentMethod==="credit_debit_card"?"pending":f.status;if(["failed","completed","awaitingAuthorization"].includes(u)&&(n({eventName:Hi,payload:{status:u,provider:pc,paymentMethod:f.paymentMethod,cardPaymentType:f.cardPaymentType,currency:f.currency?.code,baseCurrencyAmount:f.baseCurrencyAmount,quoteCurrencyAmount:f.quoteCurrencyAmount,feeAmount:f.feeAmount,extraFeeAmount:f.extraFeeAmount,networkFeeAmount:f.networkFeeAmount}}),clearInterval(m)),u==="failed"||u==="serviceFailure"){l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN");return}o(u)}catch(f){f.response?.status!==404&&(c.current+=1),c.current>=3&&(n({eventName:Hi,payload:{status:"serviceFailure",provider:pc}}),clearInterval(m),l({funding:{...s,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),a("FUNDING_METHOD_SELECTION_SCREEN"))}},3e3);return()=>clearInterval(m)},[e,c]),r}import{Fragment as yE,jsx as xp,jsxs as gE}from"react/jsx-runtime";var c1=()=>{let{app:e,data:t,navigate:r,setModalData:o}=_(),{createAnalyticsEvent:n,getMoonpaySignedUrl:i}=M(),[a,l]=hE(null),s=t?.funding;return fE(()=>{if(a||!s)return;async function c(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:f}=await i(s.address,{...e.fundingMethodConfig.moonpay,...s.moonpayConfigOverride,currencyCode:s.moonpayConfigOverride?.currencyCode??n1(`eip155:${s.chain.id}`),quoteCurrencyAmount:s.moonpayConfigOverride?.quoteCurrencyAmount??i1(s.amount)});l(m),o({moonpayStatus:{externalTransactionId:f},funding:t?.funding})}c()},[a,s]),gE(yE,{children:[xp(dr,{}),xp(o1,{app:e,signedUrl:a,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:pc}}),r("MOONPAY_STATUS_SCREEN")}}),xp(z,{})]})};import vE from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import CE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as wE}from"react";import d1 from"styled-components";import{Fragment as u1,jsx as yr,jsxs as Ha}from"react/jsx-runtime";var p1=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.moonpayStatus,n=l1(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return Ha(u1,{children:[yr(A,{title:"Fund account"},"header"),yr(EE,{status:n,onClickCta:r}),yr(z,{})]})},bE=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"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:""}}},EE=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=wE(()=>bE(e),[e]);return Ha(u1,{children:[Ha(AE,{children:[yr(_E,{status:e}),Ha(qe,{children:[yr("h3",{children:r}),yr(PE,{children:o})]})]}),n&&yr(B,{onClick:t,children:n})]})},TE=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)",SE=e=>{switch(e){case"completed":return CE;case"waitingAuthorization":return()=>yr(vE,{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}},_E=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Ha("div",{style:{position:"relative"},children:[yr(nt,{color:o,style:{position:"absolute"}}),yr(ga,{color:o}),yr(Gi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=SE(e),r=TE(e);return yr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&yr(t,{width:"4rem",height:"4rem",color:r})})},PE=d1.p`
1935
2010
  font-size: 1rem;
1936
2011
  color: var(--privy-color-foreground-3);
1937
2012
  margin-bottom: 1rem;
1938
2013
  display: flex;
1939
2014
  flex-direction: column;
1940
2015
  gap: 1rem;
1941
- `,Rb=Bg.div`
2016
+ `,AE=d1.div`
1942
2017
  display: flex;
1943
2018
  flex-direction: column;
1944
2019
  align-items: center;
@@ -1946,7 +2021,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1946
2021
  margin-left: 1.75rem;
1947
2022
  margin-right: 1.75rem;
1948
2023
  padding: 2rem 0;
1949
- `;import{useEffect as Fb,useState as Bb}from"react";import Mb from"styled-components";var Gi=Mb.span`
2024
+ `;import{useEffect as NE,useState as DE}from"react";import xE from"styled-components";var qi=xE.span`
1950
2025
  margin-top: 4px;
1951
2026
  color: var(--privy-color-foreground);
1952
2027
  text-align: center;
@@ -1954,7 +2029,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1954
2029
  font-size: 0.875rem;
1955
2030
  font-weight: 400;
1956
2031
  line-height: 1.375rem; /* 157.143% */
1957
- `;import Ib,{css as Wb}from"styled-components";import{jsx as Ob}from"react/jsx-runtime";var ac=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=S(),{initLoginWithPasskey:n}=I();return Ob(_p,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),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"})},Lb=Wb`
2032
+ `;import kE,{css as RE}from"styled-components";import{jsx as ME}from"react/jsx-runtime";var mc=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=M();return ME(kp,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),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"})},IE=RE`
1958
2033
  && {
1959
2034
  width: 100%;
1960
2035
  font-size: 0.875rem;
@@ -1979,9 +2054,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1979
2054
  box-shadow: none;
1980
2055
  }
1981
2056
  }
1982
- `,_p=Ib.button`
1983
- ${Lb}
1984
- `;import Nb from"@heroicons/react/24/outline/ChevronRightIcon";import Db from"@heroicons/react/24/outline/WalletIcon";import{jsx as Pp,jsxs as Ub}from"react/jsx-runtime";var sc=({onClick:e,text:t})=>Ub(Ee,{onClick:e,children:[Pp(Db,{}),Pp(to,{children:t}),Pp(Nb,{})]});import{Fragment as Vg,jsx as Qo,jsxs as lc}from"react/jsx-runtime";var Gg=()=>{let{connectors:e}=I(),{app:t,setModalData:r,data:o,navigate:n}=S(),[i,a]=Bb("default"),l=Ho(t.appearance.walletList,e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),s=Qo(sc,{text:"More wallets",onClick:()=>a("overflow")});return Fb(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),i==="overflow"?lc(Vg,{children:[Qo(_,{backFn:()=>a("default")},"header"),lc(jt,{children:[Qo(Gi,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),Qo($,{})]}):lc(Vg,{children:[Qo(dr,{}),Qo(ye,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),lc(jt,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&s,Qo(_p,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),Qo($,{})]})};import Hb from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Vb from"styled-components";import{Fragment as qb,jsx as Jo,jsxs as zb}from"react/jsx-runtime";var qg=()=>{let{closePrivyModal:e}=I();return zb(qb,{children:[Jo(_,{},"header"),Jo(Gb,{children:Jo(Hb,{style:{width:32,height:32}})}),Jo(no,{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"}}),Jo(Sr,{children:Jo(F,{onClick:()=>e(),children:"Close"})}),Jo(ne,{}),Jo($,{})]})},Gb=Vb.div`
2057
+ `,kp=kE.button`
2058
+ ${IE}
2059
+ `;import WE from"@heroicons/react/24/outline/ChevronRightIcon";import OE from"@heroicons/react/24/outline/WalletIcon";import{jsx as Rp,jsxs as LE}from"react/jsx-runtime";var fc=({onClick:e,text:t})=>LE(Ee,{onClick:e,children:[Rp(OE,{}),Rp(oo,{children:t}),Rp(WE,{})]});import{Fragment as m1,jsx as tn,jsxs as hc}from"react/jsx-runtime";var f1=()=>{let{connectors:e}=M(),{app:t,setModalData:r,data:o,navigate:n}=_(),[i,a]=DE("default"),l=zo(t.appearance.walletList,e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),s=tn(fc,{text:"More wallets",onClick:()=>a("overflow")});return NE(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),i==="overflow"?hc(m1,{children:[tn(A,{backFn:()=>a("default")},"header"),hc(Yt,{children:[tn(qi,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),tn(z,{})]}):hc(m1,{children:[tn(dr,{}),tn(ye,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),hc(Yt,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&s,tn(kp,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),tn(z,{})]})};import UE from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import FE from"styled-components";import{Fragment as HE,jsx as rn,jsxs as GE}from"react/jsx-runtime";var h1=()=>{let{closePrivyModal:e}=M();return GE(HE,{children:[rn(A,{},"header"),rn(BE,{children:rn(UE,{style:{width:32,height:32}})}),rn(ao,{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"}}),rn(Pr,{children:rn(B,{onClick:()=>e(),children:"Close"})}),rn(ne,{}),rn(z,{})]})},BE=FE.div`
1985
2060
  border-radius: 50%;
1986
2061
  height: 68px;
1987
2062
  width: 68px;
@@ -1991,18 +2066,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1991
2066
  background-color: var(--privy-color-accent);
1992
2067
  color: white;
1993
2068
  margin: 0 auto 24px auto;
1994
- `;import*as jg from"react-device-detect";import Yb from"styled-components";import xp from"styled-components";import{jsx as zg}from"react/jsx-runtime";var $g=({style:e,...t})=>zg("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:zg("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 Kb,jsxs as jb}from"react/jsx-runtime";var Kg=xp.div`
2069
+ `;import*as C1 from"react-device-detect";import $E from"styled-components";import Ip from"styled-components";import{jsx as y1}from"react/jsx-runtime";var g1=({style:e,...t})=>y1("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:y1("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 qE,jsxs as zE}from"react/jsx-runtime";var v1=Ip.div`
1995
2070
  display: flex;
1996
2071
  flex-direction: column;
1997
2072
  justify-content: flex-start;
1998
2073
  gap: 4px;
1999
- `,Ap=xp.div`
2074
+ `,Mp=Ip.div`
2000
2075
  &&& {
2001
2076
  margin-left: 7px; /* TODO: This is a total hack */
2002
2077
  border-left: 2px solid var(--privy-color-foreground-4);
2003
2078
  height: 12px;
2004
2079
  }
2005
- `,cc=({children:e})=>jb($b,{children:[Kb($g,{style:{width:"16px",height:"16px"}}),e]}),$b=xp.div`
2080
+ `,yc=({children:e})=>zE(VE,{children:[qE(g1,{style:{width:"16px",height:"16px"}}),e]}),VE=Ip.div`
2006
2081
  display: flex;
2007
2082
  justify-content: flex-start;
2008
2083
  justify-items: center;
@@ -2020,22 +2095,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
2020
2095
  margin-bottom: auto;
2021
2096
  }
2022
2097
  }
2023
- `;import{Fragment as Jb,jsx as bt,jsxs as Da}from"react/jsx-runtime";var Zb=()=>Da(Qb,{children:[bt(kn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),bt(wt,{children:bt(Xr,{style:{width:"152px",height:"152px"}})}),Da(Kg,{children:[bt(cc,{children:Da("div",{children:[bt("span",{children:"Install the "}),bt("a",{href:jg.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"})]})}),bt(Ap,{}),bt(cc,{children:"Set up your first wallet"}),bt(Ap,{}),bt(cc,{children:"Store your recovery phrase in a safe place!"})]}),bt(hi,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Yg=()=>{let{navigateBack:e}=S();return Da(Jb,{children:[bt(_,{backFn:e},"header"),bt(oe,{}),bt(Zb,{}),bt(ne,{}),Da(Z,{children:[bt("span",{children:"Still not sure? "}),bt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},Qb=Yb(wt)`
2098
+ `;import{Fragment as YE,jsx as bt,jsxs as Ga}from"react/jsx-runtime";var KE=()=>Ga(jE,{children:[bt(Mn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),bt(wt,{children:bt(to,{style:{width:"152px",height:"152px"}})}),Ga(v1,{children:[bt(yc,{children:Ga("div",{children:[bt("span",{children:"Install the "}),bt("a",{href:C1.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"})]})}),bt(Mp,{}),bt(yc,{children:"Set up your first wallet"}),bt(Mp,{}),bt(yc,{children:"Store your recovery phrase in a safe place!"})]}),bt(Ho,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),w1=()=>{let{navigateBack:e}=_();return Ga(YE,{children:[bt(A,{backFn:e},"header"),bt(oe,{}),bt(KE,{}),bt(ne,{}),Ga(Z,{children:[bt("span",{children:"Still not sure? "}),bt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},jE=$E(wt)`
2024
2099
  gap: 30px;
2025
2100
 
2026
2101
  > :first-child > svg {
2027
2102
  margin-top: 20px;
2028
2103
  }
2029
- `;import V7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as G7,useState as p1}from"react";import{isMobile as q7}from"react-device-detect";import z7 from"styled-components";var Xb={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:"},Xo=e=>{let t=Xb[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import r7 from"styled-components";import e7 from"react";import{jsx as t7}from"react/jsx-runtime";var Zg=()=>{let{app:e}=S(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?t7("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?e7.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 Qg}from"react/jsx-runtime";var dc=e=>{let{app:t}=S();return t?.appearance.logo?Qg(o7,{...e,children:Qg(Zg,{})}):null},o7=r7.div`
2104
+ `;import F7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as B7,useState as N1}from"react";import{isMobile as H7}from"react-device-detect";import G7 from"styled-components";var ZE={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:"},on=e=>{let t=ZE[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import XE from"styled-components";import QE from"react";import{jsx as JE}from"react/jsx-runtime";var b1=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?JE("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?QE.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 E1}from"react/jsx-runtime";var gc=e=>{let{app:t}=_();return t?.appearance.logo?E1(e7,{...e,children:E1(b1,{})}):null},e7=XE.div`
2030
2105
  display: flex;
2031
2106
  flex-direction: column;
2032
2107
  align-items: center;
2033
2108
  padding: 24px 0;
2034
2109
  flex-grow: 1;
2035
2110
  justify-content: center;
2036
- `;import c7 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as d7}from"react";import n7 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as i7,useState as kp}from"react";import Xg from"styled-components";import{Fragment as l7,jsx as Hn,jsxs as Jg}from"react/jsx-runtime";var pc=i7((e,t)=>{let[r,o]=kp(""),[n,i]=kp(!1),{authenticated:a}=q(),{initLoginWithEmail:l}=I(),{navigate:s,setModalData:c,currentScreen:m}=S(),{enabled:f,token:u}=be(),[g,w]=kp(!1),{accountType:y}=St(),b=Es(r),P=n,A=n||!b,T=R=>{i(!0),l(r,R).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(M=>{c({errorModalData:{error:M,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},x=()=>{f&&!u&&!a?(c({captchaModalData:{callback:R=>l(r,R),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):T(u)};return Jg(l7,{children:[Hn(a7,{children:Jg(s7,{stacked:e.stacked,children:[Hn(n7,{}),Hn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>w(!0),onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&x()},value:r,autoComplete:"email"}),y==="email"&&!g?Hn(Jt,{color:"gray",children:"Recent"}):e.stacked?Hn("span",{}):Hn(yi,{isSubmitting:P,onClick:x,disabled:A,children:"Submit"})]})}),e.stacked?Hn(F,{loadingText:null,loading:P,disabled:A,onClick:x,children:"Submit"}):null]})}),a7=Xg.div`
2111
+ `;import a7 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as s7}from"react";import t7 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as r7,useState as Wp}from"react";import S1 from"styled-components";import{Fragment as i7,jsx as Vn,jsxs as T1}from"react/jsx-runtime";var vc=r7((e,t)=>{let[r,o]=Wp(""),[n,i]=Wp(!1),{authenticated:a}=q(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:m}=_(),{enabled:f,token:u}=be(),[v,g]=Wp(!1),{accountType:y}=St(),b=As(r),T=n,k=n||!b,E=x=>{i(!0),l(r,x).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{c({errorModalData:{error:I,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},P=()=>{f&&!u&&!a?(c({captchaModalData:{callback:x=>l(r,x),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):E(u)};return T1(i7,{children:[Vn(o7,{children:T1(n7,{stacked:e.stacked,children:[Vn(t7,{}),Vn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>g(!0),onChange:x=>o(x.target.value),onKeyUp:x=>{x.key==="Enter"&&P()},value:r,autoComplete:"email"}),y==="email"&&!v?Vn(Xt,{color:"gray",children:"Recent"}):e.stacked?Vn("span",{}):Vn(yi,{isSubmitting:T,onClick:P,disabled:k,children:"Submit"})]})}),e.stacked?Vn(B,{loadingText:null,loading:T,disabled:k,onClick:P,children:"Submit"}):null]})}),o7=S1.div`
2037
2112
  width: 100%;
2038
- `,s7=Xg.label`
2113
+ `,n7=S1.label`
2039
2114
  display: block;
2040
2115
  position: relative;
2041
2116
  width: 100%;
@@ -2102,11 +2177,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
2102
2177
  && > input::placeholder {
2103
2178
  color: var(--privy-color-foreground-3);
2104
2179
  }
2105
- `;import{Fragment as p7,jsx as uc,jsxs as e1}from"react/jsx-runtime";var mc=({isEditable:e,setIsEditable:t})=>{let r=d7(null);return e1(p7,{children:[uc(Dr,{if:!e,children:uc(pc,{ref:r})}),uc(Dr,{if:e,children:e1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[uc(c7,{})," Continue with Email"]})})]})};import{useState as u7}from"react";import m7 from"styled-components";import{jsx as fc,jsxs as h7}from"react/jsx-runtime";var hc=()=>{let[e,t]=u7(!1),{currentScreen:r,navigate:o,setModalData:n}=S(),{enabled:i,token:a}=be(),{initLoginWithFarcaster:l}=I(),{accountType:s}=St();return h7(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:m=>l(m),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[fc(so,{})," Farcaster",e&&fc("span",{children:fc(eo,{})}),s==="farcaster"&&fc(f7,{color:"gray",children:"Recent"})]})},f7=m7(Jt)`
2180
+ `;import{Fragment as l7,jsx as Cc,jsxs as _1}from"react/jsx-runtime";var wc=({isEditable:e,setIsEditable:t})=>{let r=s7(null);return _1(l7,{children:[Cc(Fr,{if:!e,children:Cc(vc,{ref:r})}),Cc(Fr,{if:e,children:_1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Cc(a7,{})," Continue with Email"]})})]})};import{useState as c7}from"react";import d7 from"styled-components";import{jsx as bc,jsxs as u7}from"react/jsx-runtime";var Ec=()=>{let[e,t]=c7(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=be(),{initLoginWithFarcaster:l}=M(),{accountType:s}=St();return u7(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:m=>l(m),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[bc(co,{})," Farcaster",e&&bc("span",{children:bc(ro,{})}),s==="farcaster"&&bc(p7,{color:"gray",children:"Recent"})]})},p7=d7(Xt)`
2106
2181
  margin-left: auto;
2107
- `;import A7 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as k7}from"react";import{forwardRef as S7,useState as vc}from"react";import a1 from"styled-components";import y7 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as g7,AsYouType as v7,getCountries as C7,getCountryCallingCode as yc,getExampleNumber as w7}from"libphonenumber-js/min";import{jsx as T7,jsxs as E7}from"react/jsx-runtime";var Ua=(e,t)=>g7(String(e),t),gc=(e,t)=>`+${yc(t)} ${e}`,t1=e=>`*${e.replaceAll("-","").slice(-4)}`,r1=e=>new v7(e),b7=C7().map(e=>({code:e,callCode:yc(e)})),o1=e=>{let t=w7(e,y7)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},n1=({value:e,onChange:t})=>T7("select",{value:e,onChange:t,children:b7.map(r=>E7("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as x7,jsx as Vn,jsxs as i1}from"react/jsx-runtime";var qi=S7((e,t)=>{let{app:r}=S(),[o,n]=vc(!1),{accountType:i}=St(),[a,l]=vc(""),[s,c]=vc(r?.intl.defaultCountry??"US"),m=Ua(a,s),f=r1(s),u=o1(s),g=yc(s),w=!m,[y,b]=vc(!1),P=g.length,A=R=>{let M=R.target.value;c(M),l(""),e.onChange&&e.onChange({rawPhoneNumber:a,qualifiedPhoneNumber:gc(a,M),countryCode:M,isValid:Ua(a,s)})},T=R=>{try{let M=R.replace(/\D/g,""),D=a.replace(/\D/g,""),B=M===D?R:f.input(R);l(B),e.onChange&&e.onChange({rawPhoneNumber:B,qualifiedPhoneNumber:gc(R,s),countryCode:s,isValid:Ua(R,s)})}catch(M){console.error("Error processing phone number:",M)}},x=()=>{b(!0);let R=gc(a,s);e.onSubmit({rawPhoneNumber:a,qualifiedPhoneNumber:R,countryCode:s,isValid:Ua(a,s)}).finally(()=>b(!1))};return i1(x7,{children:[Vn(_7,{children:i1(P7,{callingCodeLength:P,stacked:e.stacked,children:[Vn(n1,{value:s,onChange:A}),Vn("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:u,onFocus:()=>n(!0),onChange:R=>{T(R.target.value)},onKeyUp:R=>{R.key==="Enter"&&x()},value:a,autoComplete:"tel"}),i==="phone"&&!o?Vn(Jt,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?Vn(yi,{isSubmitting:y,onClick:x,disabled:w,children:"Submit"}):Vn("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?Vn(F,{loading:y,loadingText:null,onClick:x,disabled:w,children:"Submit"}):null]})}),_7=a1.div`
2182
+ `;import _7 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as P7}from"react";import{forwardRef as b7,useState as _c}from"react";import I1 from"styled-components";import m7 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as f7,AsYouType as h7,getCountries as y7,getCountryCallingCode as Tc,getExampleNumber as g7}from"libphonenumber-js/min";import{jsx as w7,jsxs as C7}from"react/jsx-runtime";var Va=(e,t)=>f7(String(e),t),Sc=(e,t)=>`+${Tc(t)} ${e}`,P1=e=>`*${e.replaceAll("-","").slice(-4)}`,A1=e=>new h7(e),v7=y7().map(e=>({code:e,callCode:Tc(e)})),x1=e=>{let t=g7(e,m7)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},k1=({value:e,onChange:t})=>w7("select",{value:e,onChange:t,children:v7.map(r=>C7("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as S7,jsx as qn,jsxs as R1}from"react/jsx-runtime";var zi=b7((e,t)=>{let{app:r}=_(),[o,n]=_c(!1),{accountType:i}=St(),[a,l]=_c(""),[s,c]=_c(r?.intl.defaultCountry??"US"),m=Va(a,s),f=A1(s),u=x1(s),v=Tc(s),g=!m,[y,b]=_c(!1),T=v.length,k=x=>{let I=x.target.value;c(I),l(""),e.onChange&&e.onChange({rawPhoneNumber:a,qualifiedPhoneNumber:Sc(a,I),countryCode:I,isValid:Va(a,s)})},E=x=>{try{let I=x.replace(/\D/g,""),N=a.replace(/\D/g,""),H=I===N?x:f.input(x);l(H),e.onChange&&e.onChange({rawPhoneNumber:H,qualifiedPhoneNumber:Sc(x,s),countryCode:s,isValid:Va(x,s)})}catch(I){console.error("Error processing phone number:",I)}},P=()=>{b(!0);let x=Sc(a,s);e.onSubmit({rawPhoneNumber:a,qualifiedPhoneNumber:x,countryCode:s,isValid:Va(a,s)}).finally(()=>b(!1))};return R1(S7,{children:[qn(E7,{children:R1(T7,{callingCodeLength:T,stacked:e.stacked,children:[qn(k1,{value:s,onChange:k}),qn("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:u,onFocus:()=>n(!0),onChange:x=>{E(x.target.value)},onKeyUp:x=>{x.key==="Enter"&&P()},value:a,autoComplete:"tel"}),i==="phone"&&!o?qn(Xt,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?qn(yi,{isSubmitting:y,onClick:P,disabled:g,children:"Submit"}):qn("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?qn(B,{loading:y,loadingText:null,onClick:P,disabled:g,children:"Submit"}):null]})}),E7=I1.div`
2108
2183
  width: 100%;
2109
- `,P7=a1.label`
2184
+ `,T7=I1.label`
2110
2185
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
2111
2186
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
2112
2187
  display: block;
@@ -2199,15 +2274,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
2199
2274
  && > input::placeholder {
2200
2275
  color: var(--privy-color-foreground-3);
2201
2276
  }
2202
- `;import{Fragment as R7,jsx as Cc,jsxs as s1}from"react/jsx-runtime";var wc=({isEditable:e,setIsEditable:t})=>{let r=k7(null),{authenticated:o}=q(),{navigate:n,setModalData:i,currentScreen:a}=S(),{initLoginWithSms:l}=I(),{enabled:s,token:c}=be();async function m({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:u=>l(f,u),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(u){i({errorModalData:{error:u,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return s1(R7,{children:[Cc(Dr,{if:!e,children:Cc(qi,{ref:r,onSubmit:m})}),Cc(Dr,{if:e,children:s1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Cc(A7,{})," Continue with SMS"]})})]})};import{useState as M7}from"react";import I7 from"styled-components";import{jsx as fo,jsxs as O7}from"react/jsx-runtime";var W7={apple:{logo:fo(Ws,{}),displayName:"Apple"},discord:{logo:fo(Ls,{}),displayName:"Discord"},github:{logo:fo(Os,{}),displayName:"GitHub"},google:{logo:fo(Ds,{}),displayName:"Google"},linkedin:{logo:fo(Hs,{}),displayName:"LinkedIn"},spotify:{logo:fo(Vs,{}),displayName:"Spotify"},instagram:{logo:fo(Fs,{}),displayName:"Instagram"},twitter:{logo:fo(qs,{}),displayName:"Twitter"},tiktok:{logo:fo(Gs,{}),displayName:"TikTok"}},xt=({provider:e})=>{let{enabled:t,token:r}=be(),{navigate:o,setModalData:n}=S(),[i,a]=M7(!1),{initLoginWithOAuth:l}=I(),{accountType:s}=St(),c=s?Xo(s):null,{displayName:m,logo:f}=W7[e];return O7(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:g=>l(e,g),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[f," ",m,c?.loginMethod===e&&fo(L7,{color:"gray",children:"Recent"})]})},L7=I7(Jt)`
2277
+ `;import{Fragment as A7,jsx as Pc,jsxs as M1}from"react/jsx-runtime";var Ac=({isEditable:e,setIsEditable:t})=>{let r=P7(null),{authenticated:o}=q(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=be();async function m({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:u=>l(f,u),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(u){i({errorModalData:{error:u,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return M1(A7,{children:[Pc(Fr,{if:!e,children:Pc(zi,{ref:r,onSubmit:m})}),Pc(Fr,{if:e,children:M1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Pc(_7,{})," Continue with SMS"]})})]})};import{useState as x7}from"react";import k7 from"styled-components";import{jsx as yo,jsxs as M7}from"react/jsx-runtime";var R7={apple:{logo:yo(Us,{}),displayName:"Apple"},discord:{logo:yo(Fs,{}),displayName:"Discord"},github:{logo:yo(Bs,{}),displayName:"GitHub"},google:{logo:yo(Gs,{}),displayName:"Google"},linkedin:{logo:yo($s,{}),displayName:"LinkedIn"},spotify:{logo:yo(Ks,{}),displayName:"Spotify"},instagram:{logo:yo(qs,{}),displayName:"Instagram"},twitter:{logo:yo(Ys,{}),displayName:"Twitter"},tiktok:{logo:yo(js,{}),displayName:"TikTok"}},kt=({provider:e})=>{let{enabled:t,token:r}=be(),{navigate:o,setModalData:n}=_(),[i,a]=x7(!1),{initLoginWithOAuth:l}=M(),{accountType:s}=St(),c=s?on(s):null,{displayName:m,logo:f}=R7[e];return M7(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:v=>l(e,v),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[f," ",m,c?.loginMethod===e&&yo(I7,{color:"gray",children:"Recent"})]})},I7=k7(Xt)`
2203
2278
  margin-left: auto;
2204
- `;import{useState as N7}from"react";import D7 from"styled-components";import{jsx as en,jsxs as l1}from"react/jsx-runtime";function bc(e){return l1("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[en("defs",{children:l1("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[en("stop",{offset:"0",stopColor:"#1d93d2"}),en("stop",{offset:"1",stopColor:"#38b0e3"})]})}),en("title",{children:"Telegram_logo"}),en("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),en("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"}),en("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"}),en("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 c1,jsxs as F7}from"react/jsx-runtime";var Ec=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=S(),[n,i]=N7(!1),{initLoginWithTelegram:a}=I(),{accountType:l}=St();async function s(m){try{await a(m),r("TELEGRAM_AUTH_SCREEN")}catch(f){console.error(f),i(!1)}}async function c(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return F7(Ee,{onClick:c,disabled:n,children:[c1(bc,{}),"Telegram",l==="telegram"&&c1(U7,{color:"gray",children:"Recent"})]})},U7=D7(Jt)`
2279
+ `;import{useState as W7}from"react";import O7 from"styled-components";import{jsx as nn,jsxs as W1}from"react/jsx-runtime";function xc(e){return W1("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[nn("defs",{children:W1("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[nn("stop",{offset:"0",stopColor:"#1d93d2"}),nn("stop",{offset:"1",stopColor:"#38b0e3"})]})}),nn("title",{children:"Telegram_logo"}),nn("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),nn("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"}),nn("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"}),nn("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 O1,jsxs as N7}from"react/jsx-runtime";var kc=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=_(),[n,i]=W7(!1),{initLoginWithTelegram:a}=M(),{accountType:l}=St();async function s(m){try{await a(m),r("TELEGRAM_AUTH_SCREEN")}catch(f){console.error(f),i(!1)}}async function c(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return N7(Ee,{onClick:c,disabled:n,children:[O1(xc,{}),"Telegram",l==="telegram"&&O1(L7,{color:"gray",children:"Recent"})]})},L7=O7(Xt)`
2205
2280
  margin-left: auto;
2206
- `;import B7 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as d1,jsxs as H7}from"react/jsx-runtime";var Tc=({onClick:e,text:t,icon:r})=>H7(Ee,{onClick:e,children:[r,d1(to,{children:t}),d1(B7,{})]});import{Fragment as Rp,jsx as nt,jsxs as _c}from"react/jsx-runtime";var Pc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=I(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{appearance:{palette:{colorScheme:i}}}=Ge(),{accountType:a,walletClientType:l}=St(),s=a?Xo(a):null,c=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],f=[...c,...m],u=o.loginMethods.passkey,g=[];l&&f.includes(l)?g.push(l):a&&f.includes(s?.loginMethod)&&g.push(s?.loginMethod);let[w,y]=p1("default"),[b,P]=p1(a==="phone"?"sms":"email");G7(()=>{a==="phone"&&P("sms");let N=f.indexOf("sms"),W=f.indexOf("email");N>-1&&N<W&&P("sms")},[a,c,m]);let A=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{y("default")},150)};n.current=A;let T=N=>N==="email"?nt(mc,{isEditable:b==="email",setIsEditable:()=>{P("email")}},N):N==="sms"?nt(wc,{isEditable:b==="sms",setIsEditable:()=>{P("sms")}},N):N==="apple"?nt(xt,{provider:"apple"},N):N==="discord"?nt(xt,{provider:"discord"},N):N==="farcaster"?nt(hc,{},N):N==="github"?nt(xt,{provider:"github"},N):N==="google"?nt(xt,{provider:"google"},N):N==="linkedin"?nt(xt,{provider:"linkedin"},N):N==="tiktok"?nt(xt,{provider:"tiktok"},N):N==="twitter"&&(!q7||o?.loginConfig.twitterOAuthOnMobileEnabled)?nt(xt,{provider:"twitter"},N):N==="telegram"?nt(Ec,{},N):Ho([N],r,e,f,o.externalWallets.walletConnect.enabled),x=g.flatMap(T),R=c.filter(N=>N!==l&&N!==s?.loginMethod).flatMap(T),M=m.filter(N=>N!==l&&N!==s?.loginMethod).flatMap(T),D=[...x,...R,...M],B=$7({primary:R.length+x.length,overflow:M.length}),[K,j]=em(D,B),L=w==="default"?void 0:()=>{y("default")};return _c(Rp,{children:[nt(_,{title:o.appearance.landingHeader,onClose:A,backFn:L}),w==="default"&&nt(K7,{}),w==="default"&&(typeof o.appearance.loginMessage=="string"?nt(sl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),nt(al,{style:{overflow:"hidden"},children:_c(Xf,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[w==="default"&&_c(Rp,{children:[...K,j.length>0&&nt(Tc,{text:"More options",icon:nt(V7,{}),onClick:()=>y("overflow")})]}),w==="overflow"&&_c(Rp,{children:[...j]}),u&&w==="default"&&nt(ac,{})]})}),o&&nt(Ci,{app:o}),nt($,{})]})},Sc=5,$7=({primary:e,overflow:t})=>e<Sc?e:e===Sc&&t===0?Sc:Sc-1,K7=z7(dc)`
2281
+ `;import D7 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as L1,jsxs as U7}from"react/jsx-runtime";var Rc=({onClick:e,text:t,icon:r})=>U7(Ee,{onClick:e,children:[r,L1(oo,{children:t}),L1(D7,{})]});import{Fragment as Op,jsx as it,jsxs as Mc}from"react/jsx-runtime";var Wc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{appearance:{palette:{colorScheme:i}}}=Ve(),{accountType:a,walletClientType:l}=St(),s=a?on(a):null,c=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],f=[...c,...m],u=o.loginMethods.passkey,v=[];l&&f.includes(l)?v.push(l):a&&f.includes(s?.loginMethod)&&v.push(s?.loginMethod);let[g,y]=N1("default"),[b,T]=N1(a==="phone"?"sms":"email");B7(()=>{a==="phone"&&T("sms");let D=f.indexOf("sms"),W=f.indexOf("email");D>-1&&D<W&&T("sms")},[a,c,m]);let k=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{y("default")},150)};n.current=k;let E=D=>D==="email"?it(wc,{isEditable:b==="email",setIsEditable:()=>{T("email")}},D):D==="sms"?it(Ac,{isEditable:b==="sms",setIsEditable:()=>{T("sms")}},D):D==="apple"?it(kt,{provider:"apple"},D):D==="discord"?it(kt,{provider:"discord"},D):D==="farcaster"?it(Ec,{},D):D==="github"?it(kt,{provider:"github"},D):D==="google"?it(kt,{provider:"google"},D):D==="linkedin"?it(kt,{provider:"linkedin"},D):D==="tiktok"?it(kt,{provider:"tiktok"},D):D==="twitter"&&(!H7||o?.loginConfig.twitterOAuthOnMobileEnabled)?it(kt,{provider:"twitter"},D):D==="telegram"?it(kc,{},D):zo([D],r,e,f,o.externalWallets.walletConnect.enabled),P=v.flatMap(E),x=c.filter(D=>D!==l&&D!==s?.loginMethod).flatMap(E),I=m.filter(D=>D!==l&&D!==s?.loginMethod).flatMap(E),N=[...P,...x,...I],H=V7({primary:x.length+P.length,overflow:I.length}),[K,j]=im(N,H),O=g==="default"?void 0:()=>{y("default")};return Mc(Op,{children:[it(A,{title:o.appearance.landingHeader,onClose:k,backFn:O}),g==="default"&&it(q7,{}),g==="default"&&(typeof o.appearance.loginMessage=="string"?it(ul,{children:o.appearance.loginMessage}):o.appearance.loginMessage),it(pl,{style:{overflow:"hidden"},children:Mc(nh,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[g==="default"&&Mc(Op,{children:[...K,j.length>0&&it(Rc,{text:"More options",icon:it(F7,{}),onClick:()=>y("overflow")})]}),g==="overflow"&&Mc(Op,{children:[...j]}),u&&g==="default"&&it(mc,{})]})}),o&&it(Ci,{app:o}),it(z,{})]})},Ic=5,V7=({primary:e,overflow:t})=>e<Ic?e:e===Ic&&t===0?Ic:Ic-1,q7=G7(gc)`
2207
2282
  margin-bottom: 16px;
2208
- `;import j7 from"@heroicons/react/24/outline/EnvelopeIcon";import Y7 from"@heroicons/react/24/outline/PhoneIcon";import Z7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Q7,useMemo as f1,useState as h1}from"react";import{isMobile as J7}from"react-device-detect";import X7 from"styled-components";import{toObjectKeys as eE}from"@privy-io/js-sdk-core";import{jsx as Fa,jsxs as u1}from"react/jsx-runtime";var m1=({...e})=>u1("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[u1("g",{clipPath:"url(#clip0_2856_1743)",children:[Fa("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"}),Fa("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"})]}),Fa("defs",{children:Fa("clipPath",{id:"clip0_2856_1743",children:Fa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as Ba,jsx as qe,jsxs as zi}from"react/jsx-runtime";var xc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=I(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=S(),i=Ge(),{accountType:a,walletClientType:l}=St(),s=a?Xo(a):null,c=o?.login,m=f1(()=>c?.loginMethods?eE(c.loginMethods,!0):null,[c]),{email:f,sms:u,google:g,twitter:w,discord:y,github:b,spotify:P,instagram:A,tiktok:T,linkedin:x,apple:R,wallet:M,farcaster:D,telegram:B}=m??i.loginMethods,{passkey:K}=i.loginMethods,j=[f&&"email",u&&"sms",g&&"google",w&&"twitter",y&&"discord",b&&"github",P&&"spotify",A&&"instagram",T&&"tiktok",x&&"linkedin",R&&"apple",D&&"farcaster",B&&"telegram"].filter(V=>!!V),L=j.length>0,N=f1(()=>M&&!L?"web3-first":M&&i?.appearance.loginGroupPriority||"web2-first",[M,L,i?.appearance.loginGroupPriority]),W=i?.appearance.hideDirectWeb2Inputs,[ve,Me]=h1("default"),[Y,te]=h1(y1({accountType:a,sms:u,email:f}));Q7(()=>{te(y1({accountType:a,sms:u,email:f}))},[f,u,a]);let ee=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{Me("default")},150)};n.current=ee;let _e=[];l&&M?_e.push(l):s?.loginMethod&&j.includes(s.loginMethod)&&_e.push(s.loginMethod);let Te=V=>V==="email"?qe(mc,{isEditable:Y==="email",setIsEditable:()=>{te("email")}},V):V==="sms"?qe(wc,{isEditable:Y==="sms",setIsEditable:()=>{te("sms")}},V):V==="apple"?qe(xt,{provider:"apple"},V):V==="discord"?qe(xt,{provider:"discord"},V):V==="farcaster"?qe(hc,{},V):V==="github"?qe(xt,{provider:"github"},V):V==="google"?qe(xt,{provider:"google"},V):V==="linkedin"?qe(xt,{provider:"linkedin"},V):V==="tiktok"?qe(xt,{provider:"tiktok"},V):V==="twitter"&&(!J7||i?.loginConfig.twitterOAuthOnMobileEnabled)?qe(xt,{provider:"twitter"},V):V==="telegram"?qe(Ec,{},V):Ho([V],r,e,[],i.externalWallets.walletConnect.enabled),ze=Ho(i.appearance.walletList.filter(V=>V!==l),r,e,[...i.appearance.walletList,l],i.externalWallets.walletConnect.enabled),Ve=j.filter(V=>V!==s?.loginMethod).flatMap(Te),pt=_e.flatMap(Te);N==="web3-first"&&ve==="default"?ze.unshift(...pt):N==="web2-first"&&Ve.unshift(...pt);let Fe=ve==="default"?void 0:()=>{Me("default")},ae=j.filter(V=>V!=="email"&&V!=="sms"),Ft=rE({priority:N,email:f,sms:u,social:ae}),Rr=oE({priority:N,email:f,sms:u,social:ae}),jr=nE({priority:N}),O=qe(sc,{text:jr,onClick:()=>Me("web3-overflow")}),rt=qe(Tc,{text:Ft,icon:Rr,onClick:()=>Me("web2-overflow")}),Mr=W?0:1;return zi(Ba,{children:[qe(_,{title:i.appearance.landingHeader,onClose:ee,backFn:Fe}),ve==="default"&&qe(tE,{}),ve==="default"&&(typeof i.appearance.loginMessage=="string"?qe(sl,{children:i.appearance.loginMessage}):i.appearance.loginMessage),qe(al,{style:{overflow:"hidden",padding:2},children:zi(jt,{children:[ve==="default"&&N==="web2-first"&&zi(Ba,{children:[...Ve.length>4?Ve.slice(0,3):Ve,Ve.length>4&&rt,M&&O]}),ve==="default"&&N==="web3-first"&&zi(Ba,{children:[M&&zi(Ba,{children:[...ze.length>4?ze.slice(0,3):ze,ze.length>4&&O]}),Ve.length>Mr&&rt,Ve.length===Mr&&Ve[0]]}),ve==="web2-overflow"&&zi(Ba,{children:[...N==="web3-first"?Ve:Ve.slice(3)]}),...ve==="web3-overflow"?ze:[],K&&ve==="default"&&qe(ac,{})]})}),i&&qe(Ci,{app:i}),qe($,{})]})},tE=X7(dc)`
2283
+ `;import z7 from"@heroicons/react/24/outline/EnvelopeIcon";import $7 from"@heroicons/react/24/outline/PhoneIcon";import K7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as j7,useMemo as F1,useState as B1}from"react";import{isMobile as Y7}from"react-device-detect";import Z7 from"styled-components";import{toObjectKeys as Q7}from"@privy-io/js-sdk-core";import{jsx as qa,jsxs as D1}from"react/jsx-runtime";var U1=({...e})=>D1("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[D1("g",{clipPath:"url(#clip0_2856_1743)",children:[qa("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"}),qa("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"})]}),qa("defs",{children:qa("clipPath",{id:"clip0_2856_1743",children:qa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as za,jsx as $e,jsxs as $i}from"react/jsx-runtime";var Oc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),i=Ve(),{accountType:a,walletClientType:l}=St(),s=a?on(a):null,c=o?.login,m=F1(()=>c?.loginMethods?Q7(c.loginMethods,!0):null,[c]),{email:f,sms:u,google:v,twitter:g,discord:y,github:b,spotify:T,instagram:k,tiktok:E,linkedin:P,apple:x,wallet:I,farcaster:N,telegram:H}=m??i.loginMethods,{passkey:K}=i.loginMethods,j=[f&&"email",u&&"sms",v&&"google",g&&"twitter",y&&"discord",b&&"github",T&&"spotify",k&&"instagram",E&&"tiktok",P&&"linkedin",x&&"apple",N&&"farcaster",H&&"telegram"].filter(G=>!!G),O=j.length>0,D=F1(()=>I&&!O?"web3-first":I&&i?.appearance.loginGroupPriority||"web2-first",[I,O,i?.appearance.loginGroupPriority]),W=i?.appearance.hideDirectWeb2Inputs,[ve,Ie]=B1("default"),[Y,X]=B1(H1({accountType:a,sms:u,email:f}));j7(()=>{X(H1({accountType:a,sms:u,email:f}))},[f,u,a]);let te=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{Ie("default")},150)};n.current=te;let _e=[];l&&I?_e.push(l):s?.loginMethod&&j.includes(s.loginMethod)&&_e.push(s.loginMethod);let Te=G=>G==="email"?$e(wc,{isEditable:Y==="email",setIsEditable:()=>{X("email")}},G):G==="sms"?$e(Ac,{isEditable:Y==="sms",setIsEditable:()=>{X("sms")}},G):G==="apple"?$e(kt,{provider:"apple"},G):G==="discord"?$e(kt,{provider:"discord"},G):G==="farcaster"?$e(Ec,{},G):G==="github"?$e(kt,{provider:"github"},G):G==="google"?$e(kt,{provider:"google"},G):G==="linkedin"?$e(kt,{provider:"linkedin"},G):G==="tiktok"?$e(kt,{provider:"tiktok"},G):G==="twitter"&&(!Y7||i?.loginConfig.twitterOAuthOnMobileEnabled)?$e(kt,{provider:"twitter"},G):G==="telegram"?$e(kc,{},G):zo([G],r,e,[],i.externalWallets.walletConnect.enabled),Ke=zo(i.appearance.walletList.filter(G=>G!==l),r,e,[...i.appearance.walletList,l],i.externalWallets.walletConnect.enabled),Ge=j.filter(G=>G!==s?.loginMethod).flatMap(Te),ut=_e.flatMap(Te);D==="web3-first"&&ve==="default"?Ke.unshift(...ut):D==="web2-first"&&Ge.unshift(...ut);let Fe=ve==="default"?void 0:()=>{Ie("default")},se=j.filter(G=>G!=="email"&&G!=="sms"),Ft=X7({priority:D,email:f,sms:u,social:se}),Wr=e8({priority:D,email:f,sms:u,social:se}),Zr=t8({priority:D}),L=$e(fc,{text:Zr,onClick:()=>Ie("web3-overflow")}),rt=$e(Rc,{text:Ft,icon:Wr,onClick:()=>Ie("web2-overflow")}),Or=W?0:1;return $i(za,{children:[$e(A,{title:i.appearance.landingHeader,onClose:te,backFn:Fe}),ve==="default"&&$e(J7,{}),ve==="default"&&(typeof i.appearance.loginMessage=="string"?$e(ul,{children:i.appearance.loginMessage}):i.appearance.loginMessage),$e(pl,{style:{overflow:"hidden",padding:2},children:$i(Yt,{children:[ve==="default"&&D==="web2-first"&&$i(za,{children:[...Ge.length>4?Ge.slice(0,3):Ge,Ge.length>4&&rt,I&&L]}),ve==="default"&&D==="web3-first"&&$i(za,{children:[I&&$i(za,{children:[...Ke.length>4?Ke.slice(0,3):Ke,Ke.length>4&&L]}),Ge.length>Or&&rt,Ge.length===Or&&Ge[0]]}),ve==="web2-overflow"&&$i(za,{children:[...D==="web3-first"?Ge:Ge.slice(3)]}),...ve==="web3-overflow"?Ke:[],K&&ve==="default"&&$e(mc,{})]})}),i&&$e(Ci,{app:i}),$e(z,{})]})},J7=Z7(gc)`
2209
2284
  margin-bottom: 16px;
2210
- `,rE=({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",oE=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?qe(Z7,{}):t&&r?qe(m1,{}):t?qe(j7,{}):r?qe(Y7,{}):null,nE=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",y1=({accountType:e,sms:t,email:r})=>e==="email"&&r?"email":e==="phone"&&t||t&&!r?"sms":"email";import{jsx as g1}from"react/jsx-runtime";var v1=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?g1(Pc,{connectOnly:!0}):g1(xc,{connectOnly:!0})};import{jsx as C1}from"react/jsx-runtime";var w1=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?C1(Pc,{connectOnly:!1}):C1(xc,{connectOnly:!1})};import iE from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as aE,jsx as tn,jsxs as sE}from"react/jsx-runtime";var b1=()=>{let{app:e}=S();return sE(aE,{children:[tn(_,{},"header"),tn(oe,{}),tn(ye,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:tn(iE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),tn(Sr,{children:tn(pc,{stacked:!0})}),tn(ne,{}),tn($,{})]})};import lE from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as cE,jsx as rn,jsxs as dE}from"react/jsx-runtime";var E1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=S(),{initLoginWithSms:i}=I();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return dE(cE,{children:[rn(_,{},"header"),rn(oe,{}),rn(ye,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:rn(lE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),rn(Sr,{children:rn(qi,{stacked:!0,onSubmit:a})}),rn(ne,{}),rn($,{})]})};import{Fragment as pE,jsx as Ha,jsxs as uE}from"react/jsx-runtime";var T1=()=>{let{linkingOrConnectingHint:e}=I(),{app:t}=S(),r=e?`Link the wallet with address ${Qe(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return uE(pE,{children:[Ha(_,{},"header"),Ha(no,{title:"Link your wallet",description:r}),Ha(jt,{children:Ha(xi,{connectOnly:!1})}),Ha($,{})]})};import{jsx as S1,jsxs as mE}from"react/jsx-runtime";var _1=({style:e,...t})=>mE("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:[S1("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),S1("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 fE,jsx as on,jsxs as P1}from"react/jsx-runtime";var x1=()=>{let{closePrivyModal:e}=I(),{navigate:t}=S();return P1(fE,{children:[on(_,{},"header"),on(oe,{}),on(_1,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),on(no,{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"}}),P1(Sr,{children:[on(F,{onClick:()=>t("LANDING"),children:"Try again"}),on(Nr,{onClick:()=>e(),children:"Cancel"})]}),on(ne,{}),on($,{})]})};import QE from"@heroicons/react/24/solid/CheckBadgeIcon";import JE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import XE from"@heroicons/react/24/solid/IdentificationIcon";import e8 from"@heroicons/react/24/solid/PhoneIcon";import t8 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import B1 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as r8,useState as $i}from"react";import{useContext as hE}from"react";function Va(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=hE(Se);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as yE}from"react";function qr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=yE(Se);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import gE from"styled-components";import{jsx as A1,jsxs as CE}from"react/jsx-runtime";var k1=e=>CE(vE,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[A1("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),A1("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"})]}),vE=gE.svg`
2285
+ `,X7=({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",e8=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?$e(K7,{}):t&&r?$e(U1,{}):t?$e(z7,{}):r?$e($7,{}):null,t8=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",H1=({accountType:e,sms:t,email:r})=>e==="email"&&r?"email":e==="phone"&&t||t&&!r?"sms":"email";import{jsx as G1}from"react/jsx-runtime";var V1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?G1(Wc,{connectOnly:!0}):G1(Oc,{connectOnly:!0})};import{jsx as q1}from"react/jsx-runtime";var z1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?q1(Wc,{connectOnly:!1}):q1(Oc,{connectOnly:!1})};import r8 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as o8,jsx as an,jsxs as n8}from"react/jsx-runtime";var $1=()=>{let{app:e}=_();return n8(o8,{children:[an(A,{},"header"),an(oe,{}),an(ye,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:an(r8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),an(Pr,{children:an(vc,{stacked:!0})}),an(ne,{}),an(z,{})]})};import i8 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as a8,jsx as sn,jsxs as s8}from"react/jsx-runtime";var K1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return s8(a8,{children:[sn(A,{},"header"),sn(oe,{}),sn(ye,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:sn(i8,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),sn(Pr,{children:sn(zi,{stacked:!0,onSubmit:a})}),sn(ne,{}),sn(z,{})]})};import{Fragment as l8,jsx as $a,jsxs as c8}from"react/jsx-runtime";var j1=()=>{let{linkingOrConnectingHint:e}=M(),{app:t}=_(),r=e?`Link the wallet with address ${ct(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return c8(l8,{children:[$a(A,{},"header"),$a(ao,{title:"Link your wallet",description:r}),$a(Yt,{children:$a(Ai,{connectOnly:!1})}),$a(z,{})]})};import{jsx as Y1,jsxs as d8}from"react/jsx-runtime";var Z1=({style:e,...t})=>d8("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:[Y1("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Y1("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 p8,jsx as ln,jsxs as Q1}from"react/jsx-runtime";var J1=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return Q1(p8,{children:[ln(A,{},"header"),ln(oe,{}),ln(Z1,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),ln(ao,{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"}}),Q1(Pr,{children:[ln(B,{onClick:()=>t("LANDING"),children:"Try again"}),ln(Ur,{onClick:()=>e(),children:"Cancel"})]}),ln(ne,{}),ln(z,{})]})};import j8 from"@heroicons/react/24/solid/CheckBadgeIcon";import Y8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Z8 from"@heroicons/react/24/solid/IdentificationIcon";import Q8 from"@heroicons/react/24/solid/PhoneIcon";import J8 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import p2 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as X8,useState as Ki}from"react";import{useContext as u8}from"react";function Ka(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=u8(Se);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as m8}from"react";function $r(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=m8(Se);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import f8 from"styled-components";import{jsx as X1,jsxs as y8}from"react/jsx-runtime";var e2=e=>y8(h8,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[X1("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),X1("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"})]}),h8=f8.svg`
2211
2286
  height: 90px;
2212
2287
  width: 90px;
2213
2288
 
@@ -2218,7 +2293,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2218
2293
  > path {
2219
2294
  fill: white;
2220
2295
  }
2221
- `;import Mp from"@heroicons/react/20/solid/CheckIcon";import wE from"@heroicons/react/24/outline/ChevronRightIcon";import bE from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import EE from"@heroicons/react/24/outline/FingerPrintIcon";import TE from"@heroicons/react/24/outline/PhoneIcon";import Ip from"@heroicons/react/24/outline/TrashIcon";import SE from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as _E,jsx as xe,jsxs as tr}from"react/jsx-runtime";var R1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:m})=>{let f=t.reduce((g,w)=>({...g,[w]:!0}),{}),u=r.reduce((g,w)=>({...g,[w]:!0}),{});return tr(_E,{children:[xe(_,{backFn:e?s:void 0,onClose:l},"header"),xe(Ie,{children:xe(Ke,{children:xe(SE,{})})}),xe(de,{children:"Choose a verification method"}),t.length>0?xe(ue,{children:"To add or delete verification methods, verification is required."}):xe(ue,{children:"How would you like to verify your identity? You can change this later."}),a&&xe(ml,{style:{marginTop:"1.25rem"},children:a.message}),tr(ll,{children:[(u.totp||f.totp)&&tr(cl,{children:[xe(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?xe(mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):tr(ul,{children:[tr(pl,{children:[xe(bE,{}),"Authenticator App"]}),f.totp?tr(An,{children:[xe(Mp,{}),"Added"]}):xe(An,{children:"Recommended"})]})}),f.totp&&xe(dl,{onClick:()=>m("totp"),children:xe(Ip,{})})]},"totp"),(u.sms||f.sms)&&tr(cl,{children:[xe(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:tr(ul,{children:[tr(pl,{children:[xe(TE,{}),"SMS"]}),f.sms&&tr(An,{children:[xe(Mp,{}),"Added"]}),o&&xe(An,{children:"Disabled"})]})}),f.sms&&xe(dl,{onClick:()=>m("sms"),children:xe(Ip,{})})]},"sms"),(u.passkey||f.passkey)&&tr(cl,{children:[xe(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?xe(mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):tr(ul,{children:[tr(pl,{children:[xe(EE,{}),"Passkey"]}),f.passkey?tr(An,{children:[xe(Mp,{}),"Added"]}):xe(An,{isAccent:!0,children:xe(wE,{})})]})}),f.passkey&&xe(dl,{onClick:()=>m("passkey"),children:xe(Ip,{})})]},"passkey")]}),xe(Z,{})]})};import PE from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import xE from"@heroicons/react/24/outline/ClockIcon";import AE from"@heroicons/react/24/outline/ShieldCheckIcon";import kE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as RE,useState as Ga}from"react";import Ac from"styled-components";import{Fragment as Wp,jsx as me,jsxs as kr}from"react/jsx-runtime";var I1=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=q(),{data:n}=S(),{initLinkWithPasskey:i,linkWithPasskey:a}=I(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=qr(),[c,m]=Ga(!1),[f,u]=Ga(!1),[g,w]=Ga(!1),[y,b]=Ga(null),P=RE(()=>o?.linkedAccounts.filter(R=>R.type==="passkey")??[],[o]),A=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},T=async R=>{m(!0);try{await l(),await s({credentialIds:R}),w(!0)}catch(M){b(M)}finally{m(!1)}},x=async()=>{u(!0),b(null);try{await i();let M=(await a())?.linkedAccounts.filter(D=>D.type==="passkey").map(D=>D.credentialId)??[];await T(M)}catch(R){b(R)}finally{u(!1)}};return P.length===0||f?me(ME,{onReset:r,onClose:t,onClick:x,isCreating:f}):g?me(WE,{onClick:A,onClose:A}):y?me(Nn,{error:y,backFn:()=>b(null),onClick:()=>b(null)}):me(IE,{passkeys:P,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>T(P.map(R=>R.credentialId)),onAddPasskey:x})},ME=({onReset:e,onClose:t,onClick:r,isCreating:o})=>kr(Wp,{children:[me(_,{backFn:e,onClose:t},"header"),me(Ie,{children:kr(Yl,{children:[me(Dn,{}),me(Un,{})]})}),me(de,{children:"Set up passkey verification"}),kr(xn,{children:[kr(Zt,{children:[me(Yt,{children:me(AE,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),kr(Zt,{children:[me(Yt,{children:me(xE,{})}),"Takes seconds to set up and use"]}),kr(Zt,{children:[me(Yt,{children:me(PE,{})}),"Use your passkey to verify transactions and login to your account"]})]}),me(F,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),me(Z,{})]}),IE=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=Ga(!1),c=l?n.length:n.length>3?2:3;return kr(Wp,{children:[me(_,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&me(Ie,{children:kr(Yl,{children:[me(Dn,{}),me(Un,{})]})}),me(de,{children:"Enable your passkeys for verification"}),kr(xn,{children:[n.slice(0,c).map(m=>kr(LE,{children:[me(OE,{children:DE(m)}),kr(NE,{children:["Last used: ",m.latestVerifiedAt?.toLocaleString()]})]},m.credentialId)),!l&&n.length>3&&me(M1,{onClick:()=>s(!0),children:"View All"})]}),me(F,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&me(M1,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?me(mt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),me(Z,{})]})},WE=({onClick:e,onClose:t})=>kr(Wp,{children:[me(_,{onClose:t},"header"),me(Ie,{children:me(Ke,{status:"success",children:me(kE,{})})}),me(de,{children:"Passkey verification added"}),me(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),me(Tt,{children:me(F,{onClick:e,children:"Done"})}),me(Z,{})]}),LE=Ac.div`
2296
+ `;import Lp from"@heroicons/react/20/solid/CheckIcon";import g8 from"@heroicons/react/24/outline/ChevronRightIcon";import v8 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import C8 from"@heroicons/react/24/outline/FingerPrintIcon";import w8 from"@heroicons/react/24/outline/PhoneIcon";import Np from"@heroicons/react/24/outline/TrashIcon";import b8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as E8,jsx as xe,jsxs as rr}from"react/jsx-runtime";var t2=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:m})=>{let f=t.reduce((v,g)=>({...v,[g]:!0}),{}),u=r.reduce((v,g)=>({...v,[g]:!0}),{});return rr(E8,{children:[xe(A,{backFn:e?s:void 0,onClose:l},"header"),xe(Me,{children:xe(Ye,{children:xe(b8,{})})}),xe(de,{children:"Choose a verification method"}),t.length>0?xe(ue,{children:"To add or delete verification methods, verification is required."}):xe(ue,{children:"How would you like to verify your identity? You can change this later."}),a&&xe(vl,{style:{marginTop:"1.25rem"},children:a.message}),rr(ml,{children:[(u.totp||f.totp)&&rr(fl,{children:[xe(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?xe(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):rr(gl,{children:[rr(yl,{children:[xe(v8,{}),"Authenticator App"]}),f.totp?rr(In,{children:[xe(Lp,{}),"Added"]}):xe(In,{children:"Recommended"})]})}),f.totp&&xe(hl,{onClick:()=>m("totp"),children:xe(Np,{})})]},"totp"),(u.sms||f.sms)&&rr(fl,{children:[xe(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:rr(gl,{children:[rr(yl,{children:[xe(w8,{}),"SMS"]}),f.sms&&rr(In,{children:[xe(Lp,{}),"Added"]}),o&&xe(In,{children:"Disabled"})]})}),f.sms&&xe(hl,{onClick:()=>m("sms"),children:xe(Np,{})})]},"sms"),(u.passkey||f.passkey)&&rr(fl,{children:[xe(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?xe(nt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):rr(gl,{children:[rr(yl,{children:[xe(C8,{}),"Passkey"]}),f.passkey?rr(In,{children:[xe(Lp,{}),"Added"]}):xe(In,{isAccent:!0,children:xe(g8,{})})]})}),f.passkey&&xe(hl,{onClick:()=>m("passkey"),children:xe(Np,{})})]},"passkey")]}),xe(Z,{})]})};import T8 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import S8 from"@heroicons/react/24/outline/ClockIcon";import _8 from"@heroicons/react/24/outline/ShieldCheckIcon";import P8 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as A8,useState as ja}from"react";import Lc from"styled-components";import{Fragment as Dp,jsx as me,jsxs as Mr}from"react/jsx-runtime";var o2=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=q(),{data:n}=_(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=$r(),[c,m]=ja(!1),[f,u]=ja(!1),[v,g]=ja(!1),[y,b]=ja(null),T=A8(()=>o?.linkedAccounts.filter(x=>x.type==="passkey")??[],[o]),k=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},E=async x=>{m(!0);try{await l(),await s({credentialIds:x}),g(!0)}catch(I){b(I)}finally{m(!1)}},P=async()=>{u(!0),b(null);try{await i();let I=(await a())?.linkedAccounts.filter(N=>N.type==="passkey").map(N=>N.credentialId)??[];await E(I)}catch(x){b(x)}finally{u(!1)}};return T.length===0||f?me(x8,{onReset:r,onClose:t,onClick:P,isCreating:f}):v?me(R8,{onClick:k,onClose:k}):y?me(Fn,{error:y,backFn:()=>b(null),onClick:()=>b(null)}):me(k8,{passkeys:T,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>E(T.map(x=>x.credentialId)),onAddPasskey:P})},x8=({onReset:e,onClose:t,onClick:r,isCreating:o})=>Mr(Dp,{children:[me(A,{backFn:e,onClose:t},"header"),me(Me,{children:Mr(rc,{children:[me(Bn,{}),me(Hn,{})]})}),me(de,{children:"Set up passkey verification"}),Mr(Rn,{children:[Mr(Qt,{children:[me(Zt,{children:me(_8,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),Mr(Qt,{children:[me(Zt,{children:me(S8,{})}),"Takes seconds to set up and use"]}),Mr(Qt,{children:[me(Zt,{children:me(T8,{})}),"Use your passkey to verify transactions and login to your account"]})]}),me(B,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),me(Z,{})]}),k8=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ja(!1),c=l?n.length:n.length>3?2:3;return Mr(Dp,{children:[me(A,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&me(Me,{children:Mr(rc,{children:[me(Bn,{}),me(Hn,{})]})}),me(de,{children:"Enable your passkeys for verification"}),Mr(Rn,{children:[n.slice(0,c).map(m=>Mr(I8,{children:[me(M8,{children:O8(m)}),Mr(W8,{children:["Last used: ",m.latestVerifiedAt?.toLocaleString()]})]},m.credentialId)),!l&&n.length>3&&me(r2,{onClick:()=>s(!0),children:"View All"})]}),me(B,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&me(r2,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?me(nt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),me(Z,{})]})},R8=({onClick:e,onClose:t})=>Mr(Dp,{children:[me(A,{onClose:t},"header"),me(Me,{children:me(Ye,{status:"success",children:me(P8,{})})}),me(de,{children:"Passkey verification added"}),me(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),me(Tt,{children:me(B,{onClick:e,children:"Done"})}),me(Z,{})]}),I8=Lc.div`
2222
2297
  && {
2223
2298
  padding: 0.75rem 1rem;
2224
2299
  text-align: left;
@@ -2226,19 +2301,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
2226
2301
  border: 1px solid var(--privy-color-foreground-4);
2227
2302
  width: 100%;
2228
2303
  }
2229
- `,OE=Ac.div`
2304
+ `,M8=Lc.div`
2230
2305
  font-size: 0.875rem;
2231
2306
  line-height: 1.375rem;
2232
2307
  font-weight: 500;
2233
2308
 
2234
2309
  color: var(--privy-color-foreground-1);
2235
- `,NE=Ac.div`
2310
+ `,W8=Lc.div`
2236
2311
  font-size: 0.75rem;
2237
2312
  font-weight: 400;
2238
2313
  line-height: 1.125rem;
2239
2314
 
2240
2315
  color: var(--privy-color-foreground-2);
2241
- `,DE=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",M1=Ac.button`
2316
+ `,O8=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",r2=Lc.button`
2242
2317
  && {
2243
2318
  width: 100%;
2244
2319
  font-size: 0.875rem;
@@ -2263,7 +2338,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2263
2338
  box-shadow: none;
2264
2339
  }
2265
2340
  }
2266
- `;import $E from"@heroicons/react/24/solid/CheckCircleIcon";import O1 from"@heroicons/react/24/solid/PhoneIcon";import{useState as kc}from"react";import{useState as Lp}from"react";import{isMobile as UE}from"react-device-detect";import L1 from"styled-components";import{Fragment as zE,jsx as qa,jsxs as qE}from"react/jsx-runtime";var za=6,FE=new Array(za).fill("");function BE(e){return e.replace(/\s+/g,"")}function Op(e){return/^[0-9]{1}$/.test(e)}function W1(e){return e.length===za&&e.every(Op)}function HE(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Gn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Lp(FE),[a,l]=Lp(null),[s,c]=Lp(null),m=async w=>{w.preventDefault();let y=BE(w.currentTarget.value);if(y==="")return;let b=HE(n,Op),P=y.split(""),A=!P.every(Op),T=P.length+b>za;if(A){l("Passcode can only be numbers"),c(1);return}if(T){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let x=Number(w.currentTarget.name?.charAt(4)),R=[...y||[""]].slice(0,za-x),M=[...n.slice(0,x),...R,...n.slice(x+R.length)];i(M);let D=R.length,B=Math.min(Math.max(x+D,0),za-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),W1(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=w=>{s===1&&(l(null),c(null));let y=[...n.slice(0,w),"",...n.slice(w+1)];i(y),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),W1(y)?e(y.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return qa(zE,{children:qE(VE,{children:[qa("div",{children:n.map((w,y)=>qa("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:b=>{b.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:g,autoComplete:UE?"one-time-code":"off",disabled:t},y))}),qa("div",{children:qa(GE,{fail:!!r||!!a,children:r||a})})]})})},VE=L1.div`
2341
+ `;import V8 from"@heroicons/react/24/solid/CheckCircleIcon";import a2 from"@heroicons/react/24/solid/PhoneIcon";import{useState as Nc}from"react";import{useState as Up}from"react";import{isMobile as L8}from"react-device-detect";import i2 from"styled-components";import{Fragment as G8,jsx as Ya,jsxs as H8}from"react/jsx-runtime";var Za=6,N8=new Array(Za).fill("");function D8(e){return e.replace(/\s+/g,"")}function Fp(e){return/^[0-9]{1}$/.test(e)}function n2(e){return e.length===Za&&e.every(Fp)}function U8(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var zn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Up(N8),[a,l]=Up(null),[s,c]=Up(null),m=async g=>{g.preventDefault();let y=D8(g.currentTarget.value);if(y==="")return;let b=U8(n,Fp),T=y.split(""),k=!T.every(Fp),E=T.length+b>Za;if(k){l("Passcode can only be numbers"),c(1);return}if(E){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let P=Number(g.currentTarget.name?.charAt(4)),x=[...y||[""]].slice(0,Za-P),I=[...n.slice(0,P),...x,...n.slice(P+x.length)];i(I);let N=x.length,H=Math.min(Math.max(P+N,0),Za-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),n2(I))try{await e(I.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=g=>{s===1&&(l(null),c(null));let y=[...n.slice(0,g),"",...n.slice(g+1)];i(y),g>0&&document.querySelector(`input[name=pin-${g-1}]`)?.focus(),n2(y)?e(y.join("")):e(null)},v=o?"success":!!(r||a)?"fail":"";return Ya(G8,{children:H8(F8,{children:[Ya("div",{children:n.map((g,y)=>Ya("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:b=>{b.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:v,autoComplete:L8?"one-time-code":"off",disabled:t},y))}),Ya("div",{children:Ya(B8,{fail:!!r||!!a,children:r||a})})]})})},F8=i2.div`
2267
2342
  display: flex;
2268
2343
  flex-direction: column;
2269
2344
  width: 100%;
@@ -2331,7 +2406,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2331
2406
  transform: translate(1px, 0px);
2332
2407
  }
2333
2408
  }
2334
- `,GE=L1.div`
2409
+ `,B8=i2.div`
2335
2410
  line-height: 20px;
2336
2411
  font-size: 13px;
2337
2412
  display: flex;
@@ -2339,7 +2414,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2339
2414
  width: 100%;
2340
2415
 
2341
2416
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2342
- `;import{Fragment as Np,jsx as Ue,jsxs as qn}from"react/jsx-runtime";var N1=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=kc(""),[i,a]=kc(!1),[l,s]=kc(null),[c,m]=kc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:u}=qr(),{app:g,data:w}=S();function y(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:T}){try{await f({phoneNumber:T}),n(T),m("verify")}catch(x){s(x)}}async function P(T){try{if(!T)return;await u({phoneNumber:o,mfaCode:T}),a(!0)}catch(x){throw xl(x)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Ln(x)?new Error("The code you entered is not valid"):Wn(x)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Al(x)?new Error("Verification canceled"):new Error("Unknown error")}}function A(){c==="verify"?m("enroll"):t()}return l?Ue(Nn,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?qn(Np,{children:[Ue(_,{backFn:t,onClose:r},"header"),Ue(Ie,{children:Ue(Ke,{children:Ue(O1,{})})}),Ue(de,{children:"Set up SMS verification"}),Ue(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),qn(Tr,{children:[Ue(qi,{onSubmit:b}),qn(ih,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),Ue(Z,{})]}):i?qn(Np,{children:[Ue(_,{onClose:y},"header"),Ue(Ie,{children:Ue(Ke,{status:"success",children:Ue($E,{})})}),Ue(de,{children:"SMS verification added"}),Ue(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ue(Tt,{children:Ue(F,{onClick:y,children:"Done"})}),Ue(Z,{})]}):qn(Np,{children:[Ue(_,{backFn:A,onClose:r},"header"),Ue(Ie,{children:Ue(Ke,{children:Ue(O1,{})})}),Ue(de,{children:"Enter enrollment code"}),qn(Tr,{children:[Ue(Gn,{onChange:P}),qn(ue,{children:["To continue, enter the 6-digit code sent to ",Ue("strong",{children:t1(o)})]})]}),Ue(Z,{})]})};import YE from"@heroicons/react/24/solid/CheckCircleIcon";import ZE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as U1}from"react";import KE from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as jE}from"react/jsx-runtime";var D1=({size:e,authUrl:t})=>jE(Yo,{url:t,squareLogoElement:KE,size:e,fgColor:"#1F1F1F"});import{Fragment as Dp,jsx as Le,jsxs as $a}from"react/jsx-runtime";var F1=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=U1("enroll"),[a,l]=U1(!1),{submitEnrollmentWithTotp:s}=qr(),{data:c}=S();function m(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function u(w){try{if(!w)return;await s({mfaCode:w}),l(!0)}catch(y){throw xl(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Ln(y)?new Error("The code you entered is not valid"):Wn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Al(y)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?$a(Dp,{children:[Le(_,{backFn:r,onClose:t},"header"),Le(de,{children:"Scan QR code"}),Le(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Le(wi,{children:Le(D1,{authUrl:o.authUrl,size:200})}),$a(Tt,{children:[Le(wt,{children:Le(jo,{itemName:"secret",text:o.secret})}),Le(F,{onClick:f,children:"Continue"})]}),Le(Z,{})]}):a?$a(Dp,{children:[Le(_,{onClose:m},"header"),Le(Ie,{children:Le(Ke,{status:"success",children:Le(YE,{})})}),Le(de,{children:"Authenticator app verification added"}),Le(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Le(Tt,{children:Le(F,{onClick:m,children:"Done"})}),Le(Z,{})]}):$a(Dp,{children:[Le(_,{backFn:g,onClose:t},"header"),Le(Ie,{children:Le(Ke,{children:Le(ZE,{})})}),Le(de,{children:"Enter enrollment code"}),Le(Tr,{children:Le(Gn,{onChange:u})}),$a(ue,{children:["To continue, enter the 6-digit code generated from your ",Le("strong",{children:"authenticator app"})]}),Le(Z,{})]})};import{Fragment as Ki,jsx as Q,jsxs as yr}from"react/jsx-runtime";var H1=()=>{let{user:e,enrollInMfa:t}=q(),[r,o]=$i(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=qr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:m}=S(),{closePrivyModal:f}=I(),{promptMfa:u}=Va(),{initEnrollmentWithTotp:g}=qr(),[w,y]=$i(!1),[b,P]=$i(null),[A,T]=$i(null),x=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),P(null)},500)},{initEnrollmentWithPasskey:R,submitEnrollmentWithPasskey:M}=qr(),[D,B]=$i(!1),[K,j]=$i(null);m.current=x;let L=e?.mfaMethods.includes("sms"),N=!!e?.phone,W=e?.mfaMethods.includes("totp"),ve=e?.mfaMethods.includes("passkey"),Me=L||W||ve,Y=e?.linkedAccounts.filter(ae=>ae.type==="passkey").map(ae=>ae.credentialId)??[];r8(()=>{Me&&y(!0)},[Me]);function te(){o(null),P(null)}function ee(){y(!1)}async function _e(){B(!0);try{await R(),await M({credentialIds:Y})}catch(ae){j(ae)}finally{B(!1)}}async function Te(ae){if(await u().catch(j),ae==="totp"){P(ae),T(null),g().then(Ft=>{T(Ft)}).catch(()=>{T(null),te()});return}if(ae==="passkey"&&Y.length===1)return await _e();P(ae)}if(!s||!e||!l)return yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(k1,{})}),Q(Tr,{children:Q(mt,{})}),Q(Z,{})]});async function ze(){o(null);try{await n()}catch{o(null)}}async function Ve(){o(null);try{await i()}catch{o(null)}}async function pt(){o(null);try{await u(),await a()}catch{o(null)}}if(r==="sms")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(e8,{})})}),Q(de,{children:"Remove SMS verification?"}),yr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),Q(Tt,{children:Q(F,{warn:!0,onClick:ze,children:"Remove SMS for MFA"})}),Q(Z,{})]});if(r==="totp")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(JE,{})})}),Q(de,{children:"Remove Authenticator App verification?"}),yr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),Q(Tt,{children:Q(F,{warn:!0,onClick:Ve,children:"Remove Authenticator App for MFA"})}),Q(Z,{})]});if(r==="passkey")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(t8,{})})}),Q(de,{children:"Are you sure you want to remove passkey verification?"}),Q(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."}),Q(Tt,{children:Q(F,{warn:!0,onClick:pt,children:"Yes, remove"})}),Q(Z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Me)return yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(B1,{})})}),Q(de,{children:"Add more security"}),yr(ue,{children:[l?.name," does not have any verification methods enabled."]}),Q(Tt,{children:Q(F,{onClick:x,children:"Close"})}),Q(Z,{})]});let Fe=!Me&&!w;return Fe?yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(B1,{})})}),Q(de,{children:"Transaction Protection"}),Q(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),yr(xn,{children:[yr(Zt,{children:[Q(Yt,{children:Q(QE,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),yr(Zt,{children:[Q(Yt,{children:Q(XE,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),yr(Tt,{children:[Q(F,{onClick:()=>y(!0),children:"Continue"}),Q(Nr,{onClick:x,children:"Not now"})]}),Q(Z,{})]}):b==="sms"?Q(N1,{onComplete:x,onReset:te,onClose:x}):b==="totp"&&A?Q(F1,{onComplete:x,onClose:x,onReset:te,totpInfo:A}):b==="passkey"?Q(I1,{onComplete:x,onReset:te,onClose:x}):Q(R1,{showIntro:Fe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:N,onBackToIntro:ee,handleSelectMethod:Te,isTotpLoading:b==="totp"&&!A,isPasskeyLoading:D,error:K,onClose:x,setRemovingMfaMethod:o})};import O8 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import N8 from"@heroicons/react/24/outline/FingerPrintIcon";import D8 from"@heroicons/react/24/outline/PhoneIcon";import U8 from"@heroicons/react/24/outline/ShieldCheckIcon";import F8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import B8 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as H8,useState as Ya}from"react";import{useMemo as P8,useEffect as x8,useState as c2}from"react";import A8 from"styled-components";import{calculateTotalGasEstimate as k8,populateTransactionRequest as R8}from"@privy-io/js-sdk-core";import s2 from"styled-components";import G1 from"styled-components";import{jsx as V1,jsxs as i8}from"react/jsx-runtime";var Rc=({label:e,children:t,valueStyles:r})=>i8(o8,{children:[V1("div",{children:e}),V1(n8,{style:{...r},children:t})]}),o8=G1.div`
2417
+ `;import{Fragment as Bp,jsx as Ue,jsxs as $n}from"react/jsx-runtime";var s2=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Nc(""),[i,a]=Nc(!1),[l,s]=Nc(null),[c,m]=Nc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:u}=$r(),{app:v,data:g}=_();function y(){g?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:E}){try{await f({phoneNumber:E}),n(E),m("verify")}catch(P){s(P)}}async function T(E){try{if(!E)return;await u({phoneNumber:o,mfaCode:E}),a(!0)}catch(P){throw Ml(P)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dn(P)?new Error("The code you entered is not valid"):Nn(P)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Wl(P)?new Error("Verification canceled"):new Error("Unknown error")}}function k(){c==="verify"?m("enroll"):t()}return l?Ue(Fn,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?$n(Bp,{children:[Ue(A,{backFn:t,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(a2,{})})}),Ue(de,{children:"Set up SMS verification"}),Ue(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),$n(_r,{children:[Ue(zi,{onSubmit:b}),$n(dh,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),Ue(Z,{})]}):i?$n(Bp,{children:[Ue(A,{onClose:y},"header"),Ue(Me,{children:Ue(Ye,{status:"success",children:Ue(V8,{})})}),Ue(de,{children:"SMS verification added"}),Ue(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ue(Tt,{children:Ue(B,{onClick:y,children:"Done"})}),Ue(Z,{})]}):$n(Bp,{children:[Ue(A,{backFn:k,onClose:r},"header"),Ue(Me,{children:Ue(Ye,{children:Ue(a2,{})})}),Ue(de,{children:"Enter enrollment code"}),$n(_r,{children:[Ue(zn,{onChange:T}),$n(ue,{children:["To continue, enter the 6-digit code sent to ",Ue("strong",{children:P1(o)})]})]}),Ue(Z,{})]})};import $8 from"@heroicons/react/24/solid/CheckCircleIcon";import K8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as c2}from"react";import q8 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as z8}from"react/jsx-runtime";var l2=({size:e,authUrl:t})=>z8(Xo,{url:t,squareLogoElement:q8,size:e,fgColor:"#1F1F1F"});import{Fragment as Hp,jsx as Oe,jsxs as Qa}from"react/jsx-runtime";var d2=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=c2("enroll"),[a,l]=c2(!1),{submitEnrollmentWithTotp:s}=$r(),{data:c}=_();function m(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function u(g){try{if(!g)return;await s({mfaCode:g}),l(!0)}catch(y){throw Ml(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dn(y)?new Error("The code you entered is not valid"):Nn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Wl(y)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){n==="verify"?i("enroll"):r()}return n==="enroll"?Qa(Hp,{children:[Oe(A,{backFn:r,onClose:t},"header"),Oe(de,{children:"Scan QR code"}),Oe(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Oe(wi,{children:Oe(l2,{authUrl:o.authUrl,size:200})}),Qa(Tt,{children:[Oe(wt,{children:Oe(Jo,{itemName:"secret",text:o.secret})}),Oe(B,{onClick:f,children:"Continue"})]}),Oe(Z,{})]}):a?Qa(Hp,{children:[Oe(A,{onClose:m},"header"),Oe(Me,{children:Oe(Ye,{status:"success",children:Oe($8,{})})}),Oe(de,{children:"Authenticator app verification added"}),Oe(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Oe(Tt,{children:Oe(B,{onClick:m,children:"Done"})}),Oe(Z,{})]}):Qa(Hp,{children:[Oe(A,{backFn:v,onClose:t},"header"),Oe(Me,{children:Oe(Ye,{children:Oe(K8,{})})}),Oe(de,{children:"Enter enrollment code"}),Oe(_r,{children:Oe(zn,{onChange:u})}),Qa(ue,{children:["To continue, enter the 6-digit code generated from your ",Oe("strong",{children:"authenticator app"})]}),Oe(Z,{})]})};import{Fragment as ji,jsx as J,jsxs as gr}from"react/jsx-runtime";var u2=()=>{let{user:e,enrollInMfa:t}=q(),[r,o]=Ki(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=$r(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:m}=_(),{closePrivyModal:f}=M(),{promptMfa:u}=Ka(),{initEnrollmentWithTotp:v}=$r(),[g,y]=Ki(!1),[b,T]=Ki(null),[k,E]=Ki(null),P=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),T(null)},500)},{initEnrollmentWithPasskey:x,submitEnrollmentWithPasskey:I}=$r(),[N,H]=Ki(!1),[K,j]=Ki(null);m.current=P;let O=e?.mfaMethods.includes("sms"),D=!!e?.phone,W=e?.mfaMethods.includes("totp"),ve=e?.mfaMethods.includes("passkey"),Ie=O||W||ve,Y=e?.linkedAccounts.filter(se=>se.type==="passkey").map(se=>se.credentialId)??[];X8(()=>{Ie&&y(!0)},[Ie]);function X(){o(null),T(null)}function te(){y(!1)}async function _e(){H(!0);try{await x(),await I({credentialIds:Y})}catch(se){j(se)}finally{H(!1)}}async function Te(se){if(await u().catch(j),se==="totp"){T(se),E(null),v().then(Ft=>{E(Ft)}).catch(()=>{E(null),X()});return}if(se==="passkey"&&Y.length===1)return await _e();T(se)}if(!s||!e||!l)return gr(ji,{children:[J(A,{onClose:P},"header"),J(Me,{children:J(e2,{})}),J(_r,{children:J(nt,{})}),J(Z,{})]});async function Ke(){o(null);try{await n()}catch{o(null)}}async function Ge(){o(null);try{await i()}catch{o(null)}}async function ut(){o(null);try{await u(),await a()}catch{o(null)}}if(r==="sms")return gr(ji,{children:[J(A,{backFn:X,onClose:P},"header"),J(Me,{children:J(Ye,{children:J(Q8,{})})}),J(de,{children:"Remove SMS verification?"}),gr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ke,children:"Remove SMS for MFA"})}),J(Z,{})]});if(r==="totp")return gr(ji,{children:[J(A,{backFn:X,onClose:P},"header"),J(Me,{children:J(Ye,{children:J(Y8,{})})}),J(de,{children:"Remove Authenticator App verification?"}),gr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),J(Tt,{children:J(B,{warn:!0,onClick:Ge,children:"Remove Authenticator App for MFA"})}),J(Z,{})]});if(r==="passkey")return gr(ji,{children:[J(A,{backFn:X,onClose:P},"header"),J(Me,{children:J(Ye,{children:J(J8,{})})}),J(de,{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(Tt,{children:J(B,{warn:!0,onClick:ut,children:"Yes, remove"})}),J(Z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Ie)return gr(ji,{children:[J(A,{onClose:P},"header"),J(Me,{children:J(Ye,{children:J(p2,{})})}),J(de,{children:"Add more security"}),gr(ue,{children:[l?.name," does not have any verification methods enabled."]}),J(Tt,{children:J(B,{onClick:P,children:"Close"})}),J(Z,{})]});let Fe=!Ie&&!g;return Fe?gr(ji,{children:[J(A,{onClose:P},"header"),J(Me,{children:J(Ye,{children:J(p2,{})})}),J(de,{children:"Transaction Protection"}),J(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),gr(Rn,{children:[gr(Qt,{children:[J(Zt,{children:J(j8,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),gr(Qt,{children:[J(Zt,{children:J(Z8,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),gr(Tt,{children:[J(B,{onClick:()=>y(!0),children:"Continue"}),J(Ur,{onClick:P,children:"Not now"})]}),J(Z,{})]}):b==="sms"?J(s2,{onComplete:P,onReset:X,onClose:P}):b==="totp"&&k?J(d2,{onComplete:P,onClose:P,onReset:X,totpInfo:k}):b==="passkey"?J(o2,{onComplete:P,onReset:X,onClose:P}):J(t2,{showIntro:Fe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:D,onBackToIntro:te,handleSelectMethod:Te,isTotpLoading:b==="totp"&&!k,isPasskeyLoading:N,error:K,onClose:P,setRemovingMfaMethod:o})};import MT from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import WT from"@heroicons/react/24/outline/FingerPrintIcon";import OT from"@heroicons/react/24/outline/PhoneIcon";import LT from"@heroicons/react/24/outline/ShieldCheckIcon";import NT from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import DT from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as UT,useState as es}from"react";import{useMemo as TT,useEffect as ST,useState as O2}from"react";import _T from"styled-components";import{calculateTotalGasEstimate as PT,populateTransactionRequest as AT}from"@privy-io/js-sdk-core";import M2 from"styled-components";import f2 from"styled-components";import{jsx as m2,jsxs as rT}from"react/jsx-runtime";var Dc=({label:e,children:t,valueStyles:r})=>rT(eT,{children:[m2("div",{children:e}),m2(tT,{style:{...r},children:t})]}),eT=f2.div`
2343
2418
  display: flex;
2344
2419
  align-items: center;
2345
2420
  justify-content: space-between;
@@ -2354,7 +2429,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2354
2429
  color: var(--privy-color-foreground-2);
2355
2430
  text-align: right;
2356
2431
  }
2357
- `,n8=G1.div`
2432
+ `,tT=f2.div`
2358
2433
  font-size: 14px;
2359
2434
  line-height: 100%;
2360
2435
  display: flex;
@@ -2363,28 +2438,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2363
2438
  border-radius: var(--privy-border-radius-full);
2364
2439
  background-color: var(--privy-color-background-2);
2365
2440
  padding: 4px 8px;
2366
- `;import Ic from"styled-components";import{Fragment as c8,jsx as Mc,jsxs as q1}from"react/jsx-runtime";var z1=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ia(e),n=t?po(o,t):void 0,i=fr(o,r);return Mc($1,{children:n||i})},Up=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ia(e),n=t?po(o,t):void 0,i=fr(o,r);return Mc($1,{children:n?q1(c8,{children:[Mc(a8,{children:"USD"}),n==="<$0.01"?q1(l8,{children:[Mc(s8,{children:"<"}),"$0.01"]}):n]}):i})},$1=Ic.span`
2441
+ `;import Fc from"styled-components";import{Fragment as aT,jsx as Uc,jsxs as h2}from"react/jsx-runtime";var y2=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Oa(e),n=t?mo(o,t):void 0,i=fr(o,r);return Uc(g2,{children:n||i})},Gp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Oa(e),n=t?mo(o,t):void 0,i=fr(o,r);return Uc(g2,{children:n?h2(aT,{children:[Uc(oT,{children:"USD"}),n==="<$0.01"?h2(iT,{children:[Uc(nT,{children:"<"}),"$0.01"]}):n]}):i})},g2=Fc.span`
2367
2442
  font-size: 14px;
2368
2443
  line-height: 140%;
2369
2444
  display: flex;
2370
2445
  gap: 4px;
2371
2446
  align-items: center;
2372
- `,a8=Ic.span`
2447
+ `,oT=Fc.span`
2373
2448
  font-size: 12px;
2374
2449
  line-height: 12px;
2375
2450
  color: var(--privy-color-foreground-3);
2376
- `,s8=Ic.span`
2451
+ `,nT=Fc.span`
2377
2452
  font-size: 10px;
2378
- `,l8=Ic.span`
2453
+ `,iT=Fc.span`
2379
2454
  display: flex;
2380
2455
  align-items: center;
2381
- `;import Fp from"styled-components";import{QuantityToBigNumber as K1}from"@privy-io/js-sdk-core";import{jsx as nn,jsxs as Wc}from"react/jsx-runtime";var j1=({gas:e,tokenPrice:t,tokenSymbol:r})=>Wc(Fo,{style:{paddingBottom:"12px"},children:[Wc(Z1,{children:[nn(J1,{children:"Est. Fees"}),nn("div",{children:nn(Up,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&nn(Q1,{children:`${fr(e,r)}`})]}),Y1=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=K1(e.value||0).add(K1(t)).toHexString();return Wc(Fo,{children:[Wc(Z1,{children:[nn(J1,{children:"Total (including fees)"}),nn("div",{children:nn(Up,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&nn(Q1,{children:fr(n,o)})]})},Z1=Fp.div`
2456
+ `;import Vp from"styled-components";import{QuantityToBigNumber as v2}from"@privy-io/js-sdk-core";import{jsx as cn,jsxs as Bc}from"react/jsx-runtime";var C2=({gas:e,tokenPrice:t,tokenSymbol:r})=>Bc(Vo,{style:{paddingBottom:"12px"},children:[Bc(b2,{children:[cn(T2,{children:"Est. Fees"}),cn("div",{children:cn(Gp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&cn(E2,{children:`${fr(e,r)}`})]}),w2=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=v2(e.value||0).add(v2(t)).toHexString();return Bc(Vo,{children:[Bc(b2,{children:[cn(T2,{children:"Total (including fees)"}),cn("div",{children:cn(Gp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&cn(E2,{children:fr(n,o)})]})},b2=Vp.div`
2382
2457
  display: flex;
2383
2458
  flex-direction: row;
2384
2459
  justify-content: space-between;
2385
2460
  align-items: center;
2386
2461
  padding-top: 4px;
2387
- `,Q1=Fp.div`
2462
+ `,E2=Vp.div`
2388
2463
  display: flex;
2389
2464
  flex-direction: row;
2390
2465
  height: 12px;
@@ -2393,23 +2468,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2393
2468
  line-height: 12px;
2394
2469
  color: var(--privy-color-foreground-3);
2395
2470
  font-weight: 400;
2396
- `,J1=Fp.div`
2471
+ `,T2=Vp.div`
2397
2472
  font-size: 14px;
2398
2473
  line-height: 22.4px;
2399
2474
  font-weight: 400;
2400
- `;import d8 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as zn,useState as p8}from"react";import an from"styled-components";import{createContext as X1,useContext as HQ}from"react";var ji=X1(void 0);var Ka=X1(void 0);import{Fragment as C8,jsx as zr,jsxs as e2}from"react/jsx-runtime";var t2=({defaultValue:e,children:t})=>{let[r,o]=p8(e||null),n=i=>{o(r===i?null:i)};return zr(ji.Provider,{value:{activePanel:r,togglePanel:n},children:zr(u8,{children:t})})},r2=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=zn(ji),n=r===e;return zr(Ka.Provider,{value:{onToggle:()=>o(e),value:e},children:zr(y8,{isActive:n,"data-open":n,children:t})})},o2=({children:e})=>{let{activePanel:t}=zn(ji),{onToggle:r,value:o}=zn(Ka),n=t===o;return e2(C8,{children:[e2(m8,{onClick:r,"data-open":n,children:[zr(h8,{children:e}),zr(v8,{isactive:n,children:zr(d8,{height:"16px",width:"16px",strokeWidth:"2"})})]}),zr(f8,{})]})},n2=({children:e})=>{let{activePanel:t}=zn(ji),{value:r}=zn(Ka);return zr(g8,{"data-open":t===r,children:zr(a2,{children:e})})},i2=({children:e})=>{let{activePanel:t}=zn(ji),{value:r}=zn(Ka);return zr(a2,{children:typeof e=="function"?e({isActive:t===r}):e})},u8=an.div`
2475
+ `;import sT from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Kn,useState as lT}from"react";import dn from"styled-components";import{createContext as S2,useContext as wX}from"react";var Yi=S2(void 0);var Ja=S2(void 0);import{Fragment as yT,jsx as Kr,jsxs as _2}from"react/jsx-runtime";var P2=({defaultValue:e,children:t})=>{let[r,o]=lT(e||null),n=i=>{o(r===i?null:i)};return Kr(Yi.Provider,{value:{activePanel:r,togglePanel:n},children:Kr(cT,{children:t})})},A2=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Kn(Yi),n=r===e;return Kr(Ja.Provider,{value:{onToggle:()=>o(e),value:e},children:Kr(mT,{isActive:n,"data-open":n,children:t})})},x2=({children:e})=>{let{activePanel:t}=Kn(Yi),{onToggle:r,value:o}=Kn(Ja),n=t===o;return _2(yT,{children:[_2(dT,{onClick:r,"data-open":n,children:[Kr(uT,{children:e}),Kr(hT,{isactive:n,children:Kr(sT,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Kr(pT,{})]})},k2=({children:e})=>{let{activePanel:t}=Kn(Yi),{value:r}=Kn(Ja);return Kr(fT,{"data-open":t===r,children:Kr(I2,{children:e})})},R2=({children:e})=>{let{activePanel:t}=Kn(Yi),{value:r}=Kn(Ja);return Kr(I2,{children:typeof e=="function"?e({isActive:t===r}):e})},cT=dn.div`
2401
2476
  display: flex;
2402
2477
  flex-direction: column;
2403
2478
  width: 100%;
2404
2479
  gap: 8px;
2405
- `,m8=an.div`
2480
+ `,dT=dn.div`
2406
2481
  display: flex;
2407
2482
  justify-content: space-between;
2408
2483
  align-items: center;
2409
2484
  width: 100%;
2410
2485
  cursor: pointer;
2411
2486
  padding-bottom: 8px;
2412
- `,f8=an.div`
2487
+ `,pT=dn.div`
2413
2488
  width: 100%;
2414
2489
 
2415
2490
  && {
@@ -2417,13 +2492,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2417
2492
  border-color: var(--privy-color-foreground-4);
2418
2493
  }
2419
2494
  padding-bottom: 12px;
2420
- `,h8=an.div`
2495
+ `,uT=dn.div`
2421
2496
  font-size: 14px;
2422
2497
  font-weight: 500;
2423
2498
  line-height: 19.6px;
2424
2499
  width: 100%;
2425
2500
  padding-right: 8px;
2426
- `,y8=an.div`
2501
+ `,mT=dn.div`
2427
2502
  display: flex;
2428
2503
  flex-direction: column;
2429
2504
  width: 100%;
@@ -2435,7 +2510,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2435
2510
  border-color: var(--privy-color-foreground-4);
2436
2511
  border-radius: var(--privy-border-radius-md);
2437
2512
  }
2438
- `,g8=an.div`
2513
+ `,fT=dn.div`
2439
2514
  position: relative;
2440
2515
  overflow: hidden;
2441
2516
  transition: max-height 25ms ease-out;
@@ -2447,36 +2522,36 @@ You will need this password to access your ${e} wallet on a new device. Please k
2447
2522
  &[data-open='false'] {
2448
2523
  max-height: 0;
2449
2524
  }
2450
- `,a2=an.div`
2525
+ `,I2=dn.div`
2451
2526
  display: flex;
2452
2527
  flex-direction: column;
2453
2528
  gap: 12px;
2454
2529
  flex: 1 1 auto;
2455
2530
  min-height: 1px;
2456
- `,v8=an.div`
2531
+ `,hT=dn.div`
2457
2532
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2458
- `;import w8 from"styled-components";import{jsx as E8}from"react/jsx-runtime";var Bp=({walletAddress:e,chainId:t=wo})=>E8(b8,{href:ug(t,e),target:"_blank",children:Qe(e)}),b8=w8.a`
2533
+ `;import gT from"styled-components";import{jsx as CT}from"react/jsx-runtime";var qp=({walletAddress:e,chainId:t=Eo})=>CT(vT,{href:Cg(t,e),target:"_blank",children:ct(e)}),vT=gT.a`
2459
2534
  &:hover {
2460
2535
  text-decoration: underline;
2461
2536
  }
2462
- `;import{jsx as gr,jsxs as Hp}from"react/jsx-runtime";var Lc=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0,s=Ge();return gr(t2,{...s.render.standalone?{defaultValue:"details"}:{},children:Hp(r2,{value:"details",children:[gr(o2,{children:Hp(T8,{children:[gr("div",{children:o?.title||o?.actionDescription||"Details"}),gr(S8,{children:gr(z1,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Hp(n2,{children:[gr(Rc,{label:"From",children:gr(Bp,{walletAddress:e,chainId:r.chainId||wo})}),gr(Rc,{label:"To",children:gr(Bp,{walletAddress:t,chainId:r.chainId||wo})}),o&&o.action&&gr(Rc,{label:"Action",children:o.action}),i&&gr(j1,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),gr(i2,{children:({isActive:c})=>gr(Y1,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},T8=s2.div`
2537
+ `;import{jsx as vr,jsxs as zp}from"react/jsx-runtime";var Hc=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0,s=Ve();return vr(P2,{...s.render.standalone?{defaultValue:"details"}:{},children:zp(A2,{value:"details",children:[vr(x2,{children:zp(wT,{children:[vr("div",{children:o?.title||o?.actionDescription||"Details"}),vr(bT,{children:vr(y2,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),zp(k2,{children:[vr(Dc,{label:"From",children:vr(qp,{walletAddress:e,chainId:r.chainId||Eo})}),vr(Dc,{label:"To",children:vr(qp,{walletAddress:t,chainId:r.chainId||Eo})}),o&&o.action&&vr(Dc,{label:"Action",children:o.action}),i&&vr(C2,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),vr(R2,{children:({isActive:c})=>vr(w2,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},wT=M2.div`
2463
2538
  display: flex;
2464
2539
  flex-direction: row;
2465
2540
  justify-content: space-between;
2466
- `,S8=s2.div`
2541
+ `,bT=M2.div`
2467
2542
  flex-shrink: 0;
2468
2543
  padding-left: 8px;
2469
- `;import _8 from"styled-components";var l2=_8.img`
2544
+ `;import ET from"styled-components";var W2=ET.img`
2470
2545
  && {
2471
2546
  height: ${e=>e.size==="sm"?"65px":"140px"};
2472
2547
  width: ${e=>e.size==="sm"?"65px":"140px"};
2473
2548
  border-radius: 16px;
2474
2549
  margin-bottom: 12px;
2475
2550
  }
2476
- `;import{jsx as d2}from"react/jsx-runtime";var ja=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=Gr(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=I(),[s,c]=c2(null),[m,f]=c2(e),{tokenPrice:u}=co(m),g=l(e.chainId)||"ETH",w=P8(()=>r.find(y=>y.walletClientType==="privy"),[r]);return x8(()=>{async function y(){if(!await t()||!o||!w)return m;let P=rr(m.chainId,i,n,{appId:a}),A=await R8(w.address,m,P),{totalGasEstimate:T}=await k8(A,P);return c(T.toHexString()),A}y().then(f).catch(console.error)},[o]),w?d2(M8,{children:d2(Lc,{from:w.address,to:m.to,txn:m,gas:s??void 0,tokenPrice:u,tokenSymbol:g})}):null},M8=A8.div`
2551
+ `;import{jsx as L2}from"react/jsx-runtime";var Xa=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=zr(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=O2(null),[m,f]=O2(e),{tokenPrice:u}=uo(m),v=l(e.chainId)||"ETH",g=TT(()=>r.find(y=>y.walletClientType==="privy"),[r]);return ST(()=>{async function y(){if(!await t()||!o||!g)return m;let T=Gt(m.chainId,i,n,{appId:a}),k=await AT(g.address,m,T),{totalGasEstimate:E}=await PT(k,T);return c(E.toHexString()),k}y().then(f).catch(console.error)},[o]),g?L2(xT,{children:L2(Hc,{from:g.address,to:m.to,txn:m,gas:s??void 0,tokenPrice:u,tokenSymbol:v})}):null},xT=_T.div`
2477
2552
  width: 100%;
2478
2553
  padding: 1rem 0;
2479
- `;import I8 from"@heroicons/react/24/outline/CalendarIcon";import W8 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import L8 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as p2,jsx as At,jsxs as Yi}from"react/jsx-runtime";var u2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=I();return Yi(p2,{children:[At(_,{onClose:r},"header"),At(Je,{children:Yi("div",{children:[At(ot,{success:a,fail:!!t}),t?At(W8,{style:{width:"38px",height:"38px"}}):At(Dn,{style:{width:"38px",height:"38px"}})]})}),At(de,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Yi(xn,{children:[Yi(Zt,{children:[At(Yt,{children:At(L8,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Yi(Zt,{children:[At(Yt,{children:At(I8,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&At(Tr,{children:At(ja,{pendingTransaction:l})}),t&&Yi(p2,{children:[At(ml,{style:{marginTop:"1.25rem"},children:t.message}),At(F,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&At(va,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),At(Z,{})]})};import{Fragment as Vp,jsx as ge,jsxs as $r}from"react/jsx-runtime";var Gp=({open:e,onClose:t})=>{let{user:r}=q(),[o,n]=Ya(null),{init:i,cancel:a,submit:l}=Va(),[s,c]=Ya(!1),[m,f]=Ya(!1),[u,g]=Ya(null),[w,y]=Ya(null);H8(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?A(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let b=R=>Yd(R)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Ln(R)?(c(!1),new Error("The code you entered is not valid")):Wn(R)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(R),c(!1),new Error("Something went wrong."));async function P(R){y(null);try{if(!R||!o)return;await l(o,R),f(!0),c(!1),t()}catch(M){throw b(M)}}async function A(R){if(R==="passkey"){try{n(R);let M=await i(R);if(!M)throw new Error("something went wrong");g(M),await l(R,M),f(!0),c(!1),t()}catch(M){y(b(M))}return}try{n(R),await i(R)}catch(M){console.error(M)}}let T=()=>{n(null),y(null),a(),t()},x=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let R=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,D)=>D.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return ge(u2,{account:R,selectedMethod:o,submitSuccess:m,hasBlockingError:s,error:w,onClose:T,onBack:x,handleSubmit:()=>P(u).catch(y)})}return o?ge(V8,{submitSuccess:m,hasBlockingError:s,handleSubmitCode:P,selectedMethod:o,onClose:T,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):$r(Vp,{children:[ge(_,{onClose:T},"header"),ge(Ie,{children:ge(Ke,{children:ge(U8,{})})}),ge(de,{children:"Verify your identity"}),ge(ue,{children:"Choose a verification method"}),$r(ll,{children:[r.mfaMethods.includes("totp")&&$r(Ee,{onClick:()=>A("totp"),children:[ge(O8,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&$r(Ee,{onClick:()=>A("sms"),children:[ge(D8,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&$r(Ee,{onClick:()=>A("passkey"),children:[ge(N8,{}),"Passkey"]},"passkey")]}),ge(Z,{})]})},V8=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=S(),{pendingTransaction:l}=I();switch(e){case"sms":return $r(Vp,{children:[ge(_,{onClose:o},"header"),ge(Ie,{children:ge(Ke,{children:ge(B8,{})})}),ge(de,{children:"Enter verification code"}),$r(Tr,{children:[ge(Gn,{success:t,disabled:r,onChange:i}),$r(ue,{children:["To continue, please enter the 6-digit code sent to your ",ge("strong",{children:"mobile device"})]}),l&&ge(ja,{pendingTransaction:l})]}),n&&ge(va,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Nr,{onClick:o,children:"Not now"}),ge(Z,{})]});case"totp":return $r(Vp,{children:[ge(_,{onClose:o},"header"),ge(Ie,{children:ge(Ke,{children:ge(F8,{})})}),ge(de,{children:"Enter verification code"}),$r(Tr,{children:[ge(Gn,{success:t,disabled:r,onChange:i}),$r(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",ge("strong",{children:"authenticator app"})]}),l&&ge(ja,{pendingTransaction:l})]}),n&&ge(va,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Nr,{onClick:o,children:"Not now"}),ge(Z,{})]});default:return null}};import{useEffect as m2,useState as f2}from"react";import G8 from"styled-components";import{Fragment as z8,jsx as ho,jsxs as Oc}from"react/jsx-runtime";var h2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:m,updateWallets:f,setReadyToTrue:u,closePrivyModal:g,createAnalyticsEvent:w}=I(),[y,b]=f2(!1),[P,A]=f2(void 0),T=s()?.provider||"google",{name:x,component:R}=la(T),M=fi(),D=Ne;m2(()=>{m(T).then(j=>{b(!0),u(!0),j&&M("login","onOAuthLoginComplete",j)}).catch(j=>{if(u(!1),j?.privyErrorCode==="allowlist_rejected"){A(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new wr(j).toString()),A(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(j?.privyErrorCode==="user_does_not_exist"){A(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:L,detail:N}=Lm(j,T);A({retryable:L,detail:N,message:"Authentication failed"})}).finally(()=>{vn()})},[x,T]),m2(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let L=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},D);return()=>clearTimeout(L)}if(Gt(o,n?.embeddedWallets?.createOnLogin)){let L=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:N=>{console.error(N),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:N,provider:T,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(L)}else{let L=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),D);return f(),()=>clearTimeout(L)}}},[r,e,y,o]);let B=y?`Successfully connected with ${x}`:P?P.message:`Verifying connection to ${x}`,K="";return y?K="You\u2019re good to go!":P?K=P.detail:K="Just a few moments more",Oc(z8,{children:[ho(_,{}),ho(oe,{}),Oc(q8,{children:[ho(Je,{children:Oc("div",{children:[ho(ot,{success:y,fail:!!P}),ho(R,{style:{width:"38px",height:"38px"}})]})}),Oc(Xe,{children:[ho("h3",{children:B}),ho("p",{children:K})]}),P&&P?.retryable?ho(hi,{onClick:()=>{vn(),c(T),A(void 0)},disabled:!y&&!P?.retryable,children:"Retry"}):null]}),ho(ne,{}),ho(Z,{})]})},q8=G8.div`
2554
+ `;import kT from"@heroicons/react/24/outline/CalendarIcon";import RT from"@heroicons/react/24/outline/ExclamationTriangleIcon";import IT from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as N2,jsx as Rt,jsxs as Zi}from"react/jsx-runtime";var D2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return Zi(N2,{children:[Rt(A,{onClose:r},"header"),Rt(Je,{children:Zi("div",{children:[Rt(ot,{success:a,fail:!!t}),t?Rt(RT,{style:{width:"38px",height:"38px"}}):Rt(Bn,{style:{width:"38px",height:"38px"}})]})}),Rt(de,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Zi(Rn,{children:[Zi(Qt,{children:[Rt(Zt,{children:Rt(IT,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Zi(Qt,{children:[Rt(Zt,{children:Rt(kT,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&Rt(_r,{children:Rt(Xa,{pendingTransaction:l})}),t&&Zi(N2,{children:[Rt(vl,{style:{marginTop:"1.25rem"},children:t.message}),Rt(B,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Rt(wa,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Rt(Z,{})]})};import{Fragment as $p,jsx as ge,jsxs as jr}from"react/jsx-runtime";var Kp=({open:e,onClose:t})=>{let{user:r}=q(),[o,n]=es(null),{init:i,cancel:a,submit:l}=Ka(),[s,c]=es(!1),[m,f]=es(!1),[u,v]=es(null),[g,y]=es(null);UT(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?k(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let b=x=>tp(x)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Dn(x)?(c(!1),new Error("The code you entered is not valid")):Nn(x)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(x),c(!1),new Error("Something went wrong."));async function T(x){y(null);try{if(!x||!o)return;await l(o,x),f(!0),c(!1),t()}catch(I){throw b(I)}}async function k(x){if(x==="passkey"){try{n(x);let I=await i(x);if(!I)throw new Error("something went wrong");v(I),await l(x,I),f(!0),c(!1),t()}catch(I){y(b(I))}return}try{n(x),await i(x)}catch(I){console.error(I)}}let E=()=>{n(null),y(null),a(),t()},P=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let x=r.linkedAccounts.filter(I=>I.type==="passkey"&&I.enrolledInMfa).sort((I,N)=>N.firstVerifiedAt.valueOf()-I.firstVerifiedAt.valueOf())[0];return ge(D2,{account:x,selectedMethod:o,submitSuccess:m,hasBlockingError:s,error:g,onClose:E,onBack:P,handleSubmit:()=>T(u).catch(y)})}return o?ge(FT,{submitSuccess:m,hasBlockingError:s,handleSubmitCode:T,selectedMethod:o,onClose:E,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):jr($p,{children:[ge(A,{onClose:E},"header"),ge(Me,{children:ge(Ye,{children:ge(LT,{})})}),ge(de,{children:"Verify your identity"}),ge(ue,{children:"Choose a verification method"}),jr(ml,{children:[r.mfaMethods.includes("totp")&&jr(Ee,{onClick:()=>k("totp"),children:[ge(MT,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&jr(Ee,{onClick:()=>k("sms"),children:[ge(OT,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&jr(Ee,{onClick:()=>k("passkey"),children:[ge(WT,{}),"Passkey"]},"passkey")]}),ge(Z,{})]})},FT=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=_(),{pendingTransaction:l}=M();switch(e){case"sms":return jr($p,{children:[ge(A,{onClose:o},"header"),ge(Me,{children:ge(Ye,{children:ge(DT,{})})}),ge(de,{children:"Enter verification code"}),jr(_r,{children:[ge(zn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code sent to your ",ge("strong",{children:"mobile device"})]}),l&&ge(Xa,{pendingTransaction:l})]}),n&&ge(wa,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Ur,{onClick:o,children:"Not now"}),ge(Z,{})]});case"totp":return jr($p,{children:[ge(A,{onClose:o},"header"),ge(Me,{children:ge(Ye,{children:ge(NT,{})})}),ge(de,{children:"Enter verification code"}),jr(_r,{children:[ge(zn,{success:t,disabled:r,onChange:i}),jr(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",ge("strong",{children:"authenticator app"})]}),l&&ge(Xa,{pendingTransaction:l})]}),n&&ge(wa,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Ur,{onClick:o,children:"Not now"}),ge(Z,{})]});default:return null}};import{useEffect as U2,useState as F2}from"react";import BT from"styled-components";import{Fragment as GT,jsx as go,jsxs as Gc}from"react/jsx-runtime";var B2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:m,updateWallets:f,setReadyToTrue:u,closePrivyModal:v,createAnalyticsEvent:g}=M(),[y,b]=F2(!1),[T,k]=F2(void 0),E=s()?.provider||"google",{name:P,component:x}=ca(E),I=hi(),N=Ne;U2(()=>{m(E).then(j=>{b(!0),u(!0),j&&I("login","onOAuthLoginComplete",j)}).catch(j=>{if(u(!1),j?.privyErrorCode==="allowlist_rejected"){k(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new br(j).toString()),k(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(j?.privyErrorCode==="user_does_not_exist"){k(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:O,detail:D}=Fm(j,E);k({retryable:O,detail:D,message:"Authentication failed"})}).finally(()=>{En()})},[P,E]),U2(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let O=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},N);return()=>clearTimeout(O)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let O=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:D=>{console.error(D),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:D,provider:E,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},N);return()=>clearTimeout(O)}else{let O=setTimeout(()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0}),N);return f(),()=>clearTimeout(O)}}},[r,e,y,o]);let H=y?`Successfully connected with ${P}`:T?T.message:`Verifying connection to ${P}`,K="";return y?K="You\u2019re good to go!":T?K=T.detail:K="Just a few moments more",Gc(GT,{children:[go(A,{}),go(oe,{}),Gc(HT,{children:[go(Je,{children:Gc("div",{children:[go(ot,{success:y,fail:!!T}),go(x,{style:{width:"38px",height:"38px"}})]})}),Gc(qe,{children:[go("h3",{children:H}),go("p",{children:K})]}),T&&T?.retryable?go(Ho,{onClick:()=>{En(),c(E),k(void 0)},disabled:!y&&!T?.retryable,children:"Retry"}):null]}),go(ne,{}),go(Z,{})]})},HT=BT.div`
2480
2555
  display: flex;
2481
2556
  flex-direction: column;
2482
2557
  align-items: center;
@@ -2484,17 +2559,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2484
2559
  margin-left: 27px;
2485
2560
  margin-right: 27px;
2486
2561
  gap: 24px;
2487
- `;import{useEffect as qp,useRef as $8,useState as y2}from"react";import g2 from"styled-components";import{Fragment as j8,jsx as ko,jsxs as Nc}from"react/jsx-runtime";var v2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=S(),{loginWithPasskey:o,closePrivyModal:n}=I(),i=Ne,[a,l]=y2("loading"),[s,c]=y2(null),m=$8([]),f=b=>{m.current=[b,...m.current]};qp(()=>()=>{m.current.forEach(b=>clearTimeout(b)),m.current=[]},[]);let u=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2488
- 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(s instanceof et){if(s.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(s.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2562
+ `;import{useEffect as jp,useRef as VT,useState as H2}from"react";import G2 from"styled-components";import{Fragment as zT,jsx as Io,jsxs as Vc}from"react/jsx-runtime";var V2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=_(),{loginWithPasskey:o,closePrivyModal:n}=M(),i=Ne,[a,l]=H2("loading"),[s,c]=H2(null),m=VT([]),f=b=>{m.current=[b,...m.current]};jp(()=>()=>{m.current.forEach(b=>clearTimeout(b)),m.current=[]},[]);let u=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},v=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
2563
+ 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(s instanceof Xe){if(s.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(s.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2489
2564
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2490
- You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(a){case"loading":case"success":return ko(F,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return ko(F,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(b){c(b),l("error")}};return qp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),qp(()=>{y()},[]),Nc(j8,{children:[ko(_,{backFn:!e||t===e?void 0:r}),Nc(K8,{children:[ko(Je,{children:Nc("div",{children:[ko(ot,{success:a==="success",fail:a==="error"}),ko(Un,{style:{width:"38px",height:"38px"}})]})}),Nc(Xe,{children:[ko("h3",{children:u()}),ko("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),w()]}),ko(Z,{})]})},K8=g2.div`
2565
+ You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(a){case"loading":case"success":return Io(B,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return Io(B,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(b){c(b),l("error")}};return jp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),jp(()=>{y()},[]),Vc(zT,{children:[Io(A,{backFn:!e||t===e?void 0:r}),Vc(qT,{children:[Io(Je,{children:Vc("div",{children:[Io(ot,{success:a==="success",fail:a==="error"}),Io(Hn,{style:{width:"38px",height:"38px"}})]})}),Vc(qe,{children:[Io("h3",{children:u()}),Io("p",{style:{whiteSpace:"pre-wrap"},children:v()})]}),g()]}),Io(Z,{})]})},qT=G2.div`
2491
2566
  display: flex;
2492
2567
  flex-direction: column;
2493
2568
  align-items: center;
2494
2569
  justify-content: center;
2495
2570
  gap: 24px;
2496
2571
  width: 100%;
2497
- `,UX=g2.div`
2572
+ `,gte=G2.div`
2498
2573
  display: flex;
2499
2574
  align-items: center;
2500
2575
  justify-content: center;
@@ -2510,9 +2585,9 @@ You will have to sign up with another method first to register a passkey for you
2510
2585
  stroke: var(--privy-color-accent) !important;
2511
2586
  fill: var(--privy-color-accent) !important;
2512
2587
  }
2513
- `;import{useEffect as Z8,useState as w2}from"react";import Q8 from"styled-components";import{isMobile as Y8}from"react-device-detect";var C2=(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(!Lo()&&Y8)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as X8,jsx as Ro,jsxs as b2}from"react/jsx-runtime";var E2=()=>{let{forkSession:e,ready:t,authenticated:r}=q(),[o,n]=w2(""),[i,a]=w2(!1);Z8(()=>{t&&r&&e().then(n)},[t,r]);let l=C2(o,!i),s={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&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),b2(X8,{children:[Ro(_,{},"header"),Ro(oe,{}),Ro(no,{title:s.title,description:s.description}),b2(Sr,{children:[Ro(J8,{children:Ro(Xr,{style:{width:"72px",height:"72px"}})}),Ro(nl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Ro("p",{children:s.footnote}):null]}),Ro(ne,{}),Ro($,{})]})},J8=Q8(wt)`
2588
+ `;import{useEffect as KT,useState as z2}from"react";import jT from"styled-components";import{isMobile as $T}from"react-device-detect";var q2=(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(!No()&&$T)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as ZT,jsx as Mo,jsxs as $2}from"react/jsx-runtime";var K2=()=>{let{forkSession:e,ready:t,authenticated:r}=q(),[o,n]=z2(""),[i,a]=z2(!1);KT(()=>{t&&r&&e().then(n)},[t,r]);let l=q2(o,!i),s={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&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),$2(ZT,{children:[Mo(A,{},"header"),Mo(oe,{}),Mo(ao,{title:s.title,description:s.description}),$2(Pr,{children:[Mo(YT,{children:Mo(to,{style:{width:"72px",height:"72px"}})}),Mo(cl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Mo("p",{children:s.footnote}):null]}),Mo(ne,{}),Mo(z,{})]})},YT=jT(wt)`
2514
2589
  margin: 16px auto;
2515
- `;import eT from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as tT,useState as Dc}from"react";import Uc,{css as rT}from"styled-components";import{Fragment as sT,jsx as Ut,jsxs as $n}from"react/jsx-runtime";var T2=()=>{let[e,t]=Dc(!0),{authenticated:r,getAccessToken:o}=q(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=I(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),[m,f]=Dc(void 0),[u,g]=Dc(""),[w,y]=Dc(!1),{privyWallet:b,onCompleteNavigateTo:P,onSuccess:A,onFailure:T}=s.recoverWallet,x=(D="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),T(typeof D=="string"?new Mt(D):D)};c.current=x,tT(()=>{if(!r||!b)return x("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=D=>{D&&f(D)};return $n(sT,{children:[Ut(_,{onClose:x}),Ut(oe,{}),$n(nT,{children:[$n(oT,{children:[Ut(eT,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Ut("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($o,{children:[Ut(Li,{type:e?"password":"text",onChange:D=>R(D.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),Ut(Oi,{style:{right:"0.75rem"},children:e?Ut(Ni,{onClick:()=>t(!1)}):Ut(Di,{onClick:()=>t(!0)})})]}),!!u&&Ut(iT,{children:u})]}),$n("div",{children:[$n(uh,{children:[Ut("h4",{children:"Why is this necessary?"}),Ut("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ut(aT,{loading:w||!n,disabled:!m,onClick:async()=>{y(!0);let D=await o();if(D&&b&&m!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:b.address}}),await n?.recover({address:b.address,accessToken:D,recoveryPin:m,recoveryMethod:b.recoveryMethod}),g(""),P?l(P):i({shouldCallAuthOnSuccess:!1}),A?.(b),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}})}catch(B){oy(B)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{y(!1)}else return x("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&w,children:"Recover your account"})]})]}),Ut(ne,{}),Ut($,{})]})},oT=Uc.div`
2590
+ `;import QT from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as JT,useState as qc}from"react";import zc,{css as XT}from"styled-components";import{Fragment as n9,jsx as Ut,jsxs as jn}from"react/jsx-runtime";var j2=()=>{let[e,t]=qc(!0),{authenticated:r,getAccessToken:o}=q(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[m,f]=qc(void 0),[u,v]=qc(""),[g,y]=qc(!1),{privyWallet:b,onCompleteNavigateTo:T,onSuccess:k,onFailure:E}=s.recoverWallet,P=(N="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),E(typeof N=="string"?new Wt(N):N)};c.current=P,JT(()=>{if(!r||!b)return P("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let x=N=>{N&&f(N)};return jn(n9,{children:[Ut(A,{onClose:P}),Ut(oe,{}),jn(t9,{children:[jn(e9,{children:[Ut(QT,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Ut("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),jn("div",{children:[jn(Zo,{children:[Ut(Oi,{type:e?"password":"text",onChange:N=>x(N.target.value),disabled:g,style:{paddingRight:"2.3rem"}}),Ut(Li,{style:{right:"0.75rem"},children:e?Ut(Ni,{onClick:()=>t(!1)}):Ut(Di,{onClick:()=>t(!0)})})]}),!!u&&Ut(r9,{children:u})]}),jn("div",{children:[jn(gh,{children:[Ut("h4",{children:"Why is this necessary?"}),Ut("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ut(o9,{loading:g||!n,disabled:!m,onClick:async()=>{y(!0);let N=await o();if(N&&b&&m!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:b.address}}),await n?.recover({address:b.address,accessToken:N,recoveryPin:m,recoveryMethod:b.recoveryMethod}),v(""),T?l(T):i({shouldCallAuthOnSuccess:!1}),k?.(b),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}})}catch(H){cy(H)?v("Invalid recovery password, please try again."):v("An error has occurred, please try again.")}finally{y(!1)}else return P("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&g,children:"Recover your account"})]})]}),Ut(ne,{}),Ut(z,{})]})},e9=zc.div`
2516
2591
  display: flex;
2517
2592
  flex-direction: column;
2518
2593
  align-items: center;
@@ -2534,48 +2609,48 @@ You will have to sign up with another method first to register a passkey for you
2534
2609
  font-weight: 400;
2535
2610
  line-height: 20px;
2536
2611
  }
2537
- `,nT=Uc.div`
2612
+ `,t9=zc.div`
2538
2613
  display: flex;
2539
2614
  flex-direction: column;
2540
2615
  justify-content: space-between;
2541
- `,iT=Uc.div`
2616
+ `,r9=zc.div`
2542
2617
  line-height: 20px;
2543
2618
  height: 20px;
2544
2619
  font-size: 13px;
2545
2620
  color: var(--privy-color-error);
2546
2621
  text-align: left;
2547
2622
  margin-top: 0.5rem;
2548
- `,aT=Uc(F)`
2549
- ${e=>e.hideAnimations&&rT`
2623
+ `,o9=zc(B)`
2624
+ ${e=>e.hideAnimations&&XT`
2550
2625
  && {
2551
2626
  // Remove animations because the recoverWallet task on the iframe partially
2552
2627
  // blocks the renderer, so the animation stutters and doesn't look good
2553
2628
  transition: none;
2554
2629
  }
2555
2630
  `}
2556
- `;import{useCallback as lT,useEffect as A2,useState as zp}from"react";import{jsx as Fc,jsxs as S2}from"react/jsx-runtime";var Bc=e=>S2("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[Fc("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"}),Fc("defs",{children:S2("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[Fc("stop",{stopColor:"#3E82F4"}),Fc("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Mo,jsxs as _2}from"react/jsx-runtime";var Hc=({style:e,...t})=>_2("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[_2("g",{clipPath:"url(#clip0_2115_829)",children:[Mo("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"}),Mo("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"}),Mo("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"}),Mo("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"}),Mo("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"}),Mo("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"})]}),Mo("defs",{children:Mo("clipPath",{id:"clip0_2115_829",children:Mo("rect",{width:"16",height:"14",fill:"white"})})})]});import P2 from"styled-components";var Za=P2.div`
2631
+ `;import{useCallback as i9,useEffect as X2,useState as Yp}from"react";import{jsx as $c,jsxs as Y2}from"react/jsx-runtime";var Kc=e=>Y2("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[$c("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"}),$c("defs",{children:Y2("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[$c("stop",{stopColor:"#3E82F4"}),$c("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Wo,jsxs as Z2}from"react/jsx-runtime";var jc=({style:e,...t})=>Z2("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[Z2("g",{clipPath:"url(#clip0_2115_829)",children:[Wo("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"}),Wo("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"}),Wo("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"}),Wo("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"}),Wo("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"}),Wo("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"})]}),Wo("defs",{children:Wo("clipPath",{id:"clip0_2115_829",children:Wo("rect",{width:"16",height:"14",fill:"white"})})})]});import Q2 from"styled-components";var ts=Q2.div`
2557
2632
  display: flex;
2558
2633
  flex-direction: column;
2559
2634
  gap: 12px;
2560
2635
  padding-top: 24px;
2561
2636
  padding-bottom: 24px;
2562
- `,x2=P2.div`
2637
+ `,J2=Q2.div`
2563
2638
  padding-bottom: 24px;
2564
- `;import{Fragment as R2,jsx as sn,jsxs as Vc}from"react/jsx-runtime";var k2={"google-drive":{name:"Google Drive",component:Hc},icloud:{name:"iCloud",component:Bc}},M2=()=>{let{logout:e}=q(),{navigate:t,setModalData:r,data:o}=S(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=I(),[l,s]=zp(!1),{provider:c,action:m,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[u,g]=zp(void 0),[w,y]=zp(m==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let b=k2[c].name,P=k2[c].component,A=o?.recoverWallet?.onCompleteNavigateTo,T=new Oe(async(j="create-wallet")=>(y(!0),new Promise((L,N)=>{setTimeout(async()=>{try{let W=window.open();await n(c,j,W),s(!0),L()}catch{g({message:`${j==="recover"?"Recovery":"Back up"} with ${b} unsuccessful`,detail:m==="recover"?`Please verify that you are selecting the ${b} account associated with your backup.`:"",retryable:!0}),N()}},0)})));A2(()=>{m!=="recover"&&T.execute(f?"create-wallet":"set-recovery")},[]),A2(()=>{if(!l)return;let j=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:L=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:L,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Ne);return()=>clearTimeout(j)},[l]);let x=lT(async()=>{await T.execute("recover"),A?t(A):s(!0)},[]),R=c==="google-drive"?"Google Drive":"Apple iCloud",M=m==="recover"?"recovered":"backed up",D=m==="recover"?"Recovering":"Backing up",B=l&&`Successfully ${M} with ${R}.`||u&&u.message||`${D} with ${R}...`,K=u?u.detail:"";return Vc(R2,{children:[sn(_,{}),w?sn(R2,{children:Vc(Za,{children:[sn(ye,{title:B,icon:sn(P,{style:{width:"38px",height:"38px"}}),description:K}),u&&u?.retryable?sn(F,{onClick:()=>{vn(),g(void 0),m==="create-wallet"?T.execute("create-wallet"):x()},disabled:!l&&!u?.retryable,children:"Try again"}):null]})}):Vc(Za,{children:[sn(ye,{title:"Confirm it's really you",icon:sn(P,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${R} where your account is backed up.`}),Vc(F,{onClick:x,children:["Confirm with ",R]})]}),sn($,{})]})};import{useEffect as I2,useState as Qa}from"react";import{jsx as cT}from"react/jsx-runtime";var W2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=S(),[n,i]=Qa(""),[a,l]=Qa(!1),[s,c]=Qa(),[m,f]=Qa(null),{authenticated:u}=q(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:y}=I(),{onSuccess:b,onFailure:P,callAuthOnSuccessOnClose:A}=r.createWallet,{createWallet:T}=Ml(),[x,R]=Qa(null),M=new Oe(async()=>{try{let K=await T(s);if(!K)return;R(K),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(b(K),g({shouldCallAuthOnSuccess:A}))}catch(K){i(K.message)}});I2(()=>{m||y(3e4).then(K=>f(K))},[m]),I2(()=>{if(!u){t("LANDING"),P(new Error("User must be authenticated before creating a Privy wallet"));return}},[u]);let D=()=>{x&&x?.recoveryMethod!=="user-passcode"?(P(new Mt("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):x?(b(x),g({shouldCallAuthOnSuccess:A})):(P(new Mt("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let B=async()=>{l(!0);let K=250;return M.execute().then(()=>new Promise(j=>setTimeout(j,K))).finally(()=>l(!1))};return cT(Ol,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!m,buttonLoading:a,buttonHideAnimations:!x&&a,isResettingPassword:!1,error:n,password:s||"",onClose:D,onPasswordChange:c,onPasswordGenerate:()=>c(Ll()),onSubmit:B})};import dT from"@heroicons/react/24/outline/LockClosedIcon";import pT from"@heroicons/react/24/outline/PencilSquareIcon";import uT from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as mT}from"react";import fT from"styled-components";import{Fragment as Kp,jsx as yt,jsxs as ln}from"react/jsx-runtime";var $p=fT.div`
2639
+ `;import{Fragment as tv,jsx as pn,jsxs as Yc}from"react/jsx-runtime";var ev={"google-drive":{name:"Google Drive",component:jc},icloud:{name:"iCloud",component:Kc}},rv=()=>{let{logout:e}=q(),{navigate:t,setModalData:r,data:o}=_(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=Yp(!1),{provider:c,action:m,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[u,v]=Yp(void 0),[g,y]=Yp(m==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let b=ev[c].name,T=ev[c].component,k=o?.recoverWallet?.onCompleteNavigateTo,E=new Le(async(j="create-wallet")=>(y(!0),new Promise((O,D)=>{setTimeout(async()=>{try{let W=window.open();await n(c,j,W),s(!0),O()}catch{v({message:`${j==="recover"?"Recovery":"Back up"} with ${b} unsuccessful`,detail:m==="recover"?`Please verify that you are selecting the ${b} account associated with your backup.`:"",retryable:!0}),D()}},0)})));X2(()=>{m!=="recover"&&E.execute(f?"create-wallet":"set-recovery")},[]),X2(()=>{if(!l)return;let j=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:O=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:O,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Ne);return()=>clearTimeout(j)},[l]);let P=i9(async()=>{await E.execute("recover"),k?t(k):s(!0)},[]),x=c==="google-drive"?"Google Drive":"Apple iCloud",I=m==="recover"?"recovered":"backed up",N=m==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${I} with ${x}.`||u&&u.message||`${N} with ${x}...`,K=u?u.detail:"";return Yc(tv,{children:[pn(A,{}),g?pn(tv,{children:Yc(ts,{children:[pn(ye,{title:H,icon:pn(T,{style:{width:"38px",height:"38px"}}),description:K}),u&&u?.retryable?pn(B,{onClick:()=>{En(),v(void 0),m==="create-wallet"?E.execute("create-wallet"):P()},disabled:!l&&!u?.retryable,children:"Try again"}):null]})}):Yc(ts,{children:[pn(ye,{title:"Confirm it's really you",icon:pn(T,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${x} where your account is backed up.`}),Yc(B,{onClick:P,children:["Confirm with ",x]})]}),pn(z,{})]})};import{useEffect as ov,useState as rs}from"react";import{jsx as a9}from"react/jsx-runtime";var nv=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=rs(""),[a,l]=rs(!1),[s,c]=rs(),[m,f]=rs(null),{authenticated:u}=q(),{closePrivyModal:v,isNewUserThisSession:g,initializeWalletProxy:y}=M(),{onSuccess:b,onFailure:T,callAuthOnSuccessOnClose:k}=r.createWallet,{createWallet:E}=Nl(),[P,x]=rs(null),I=new Le(async()=>{try{let K=await E(s);if(!K)return;x(K),g?t("EMBEDDED_WALLET_CREATED_SCREEN"):(b(K),v({shouldCallAuthOnSuccess:k}))}catch(K){i(K.message)}});ov(()=>{m||y(3e4).then(K=>f(K))},[m]),ov(()=>{if(!u){t("LANDING"),T(new Error("User must be authenticated before creating a Privy wallet"));return}},[u]);let N=()=>{P&&P?.recoveryMethod!=="user-passcode"?(T(new Wt("User created a wallet but failed to set a password for it")),v({shouldCallAuthOnSuccess:!1})):P?(b(P),v({shouldCallAuthOnSuccess:k})):(T(new Wt("User wallet creation failed")),v({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let K=250;return I.execute().then(()=>new Promise(j=>setTimeout(j,K))).finally(()=>l(!1))};return a9(Bl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!m,buttonLoading:a,buttonHideAnimations:!P&&a,isResettingPassword:!1,error:n,password:s||"",onClose:N,onPasswordChange:c,onPasswordGenerate:()=>c(Fl()),onSubmit:H})};import s9 from"@heroicons/react/24/outline/LockClosedIcon";import l9 from"@heroicons/react/24/outline/PencilSquareIcon";import c9 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as d9}from"react";import p9 from"styled-components";import{Fragment as Qp,jsx as yt,jsxs as un}from"react/jsx-runtime";var Zp=p9.div`
2565
2640
  width: 24px;
2566
2641
  height: 24px;
2567
2642
  display: flex;
2568
2643
  justify-content: center;
2569
2644
  align-items: center;
2570
- `,hT={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},yT=({onClose:e})=>ln(x2,{children:[yt(ye,{title:"Why do I need to secure my account?",icon:yt(uT,{width:48}),description:ln(Kp,{children:[yt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),yt("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."})]})}),yt(F,{onClick:e,children:"Select backup method"})]}),L2=()=>{let[e,t]=mT(!1),{navigate:r,setModalData:o,data:n}=S(),{user:i}=q(),{embeddedWallets:a}=Ge(),l=he(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:m}=n.recoverySelection,f=l?.recoveryMethod!=="privy",u=f?"Update backup method":"Secure your account",g=f?ln("span",{children:["Your account is currently secured using"," ",yt("strong",{children:hT[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function w(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return ln(Kp,{children:[yt(_,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?yt(yT,{onClose:()=>t(!1)}):ln(Kp,{children:[yt(ye,{title:u,icon:yt(dT,{width:48}),description:g}),yt(Za,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return ln(Ee,{onClick:()=>w("google-drive"),children:[yt($p,{children:yt(Hc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return ln(Ee,{onClick:()=>w("icloud"),children:[yt($p,{children:yt(Bc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return ln(Ee,{onClick:()=>{let b=Zd({isCreatingWallet:s,skipSplashScreen:!0});r(b)},children:[yt($p,{children:yt(pT,{style:{width:18}})}),m?"Reset your":"Set a"," password"]},y);default:return null}})})]}),yt($,{})]})};import{getAddress as Y2}from"@ethersproject/address";import{useEffect as a9,useMemo as $c,useState as Ja}from"react";import{ProviderErrors as J2,QuantityToBigNumber as Z2}from"@privy-io/js-sdk-core";var gT={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"MOONPAY_PROMPT_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Gc({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?gT[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import O2 from"styled-components";import vT from"styled-components";var qc=vT.span`
2645
+ `,u9={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},m9=({onClose:e})=>un(J2,{children:[yt(ye,{title:"Why do I need to secure my account?",icon:yt(c9,{width:48}),description:un(Qp,{children:[yt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),yt("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."})]})}),yt(B,{onClick:e,children:"Select backup method"})]}),iv=()=>{let[e,t]=d9(!1),{navigate:r,setModalData:o,data:n}=_(),{user:i}=q(),{embeddedWallets:a}=Ve(),l=he(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:m}=n.recoverySelection,f=l?.recoveryMethod!=="privy",u=f?"Update backup method":"Secure your account",v=f?un("span",{children:["Your account is currently secured using"," ",yt("strong",{children:u9[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function g(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return un(Qp,{children:[yt(A,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?yt(m9,{onClose:()=>t(!1)}):un(Qp,{children:[yt(ye,{title:u,icon:yt(s9,{width:48}),description:v}),yt(ts,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return un(Ee,{onClick:()=>g("google-drive"),children:[yt(Zp,{children:yt(jc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return un(Ee,{onClick:()=>g("icloud"),children:[yt(Zp,{children:yt(Kc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return un(Ee,{onClick:()=>{let b=rp({isCreatingWallet:s,skipSplashScreen:!0});r(b)},children:[yt(Zp,{children:yt(l9,{style:{width:18}})}),m?"Reset your":"Set a"," password"]},y);default:return null}})})]}),yt(z,{})]})};import{getAddress as Ev}from"@ethersproject/address";import{useEffect as oS,useMemo as Xc,useState as os}from"react";import{ProviderErrors as _v,QuantityToBigNumber as Tv}from"@privy-io/js-sdk-core";var av=["FUNDING_METHOD_SELECTION_SCREEN","FUNDING_TRANSFER_FROM_WALLET_SCREEN","FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN","FUNDING_MANUAL_TRANSFER_SCREEN","MOONPAY_PROMPT_SCREEN","MOONPAY_STATUS_SCREEN"],sv={["FUNDING_METHOD_SELECTION_SCREEN"]:null,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:"external",["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:"external",["FUNDING_MANUAL_TRANSFER_SCREEN"]:"manual",["MOONPAY_PROMPT_SCREEN"]:"moonpay",["MOONPAY_STATUS_SCREEN"]:"moonpay"},f9={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"COINBASE_ONRAMP_STATUS_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Zc({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?f9[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import lv from"styled-components";import h9 from"styled-components";var Qc=h9.span`
2571
2646
  color: var(--privy-color-foreground);
2572
2647
  font-size: 1.125rem;
2573
2648
  font-weight: 600;
2574
2649
  line-height: 1.875rem; /* 166.667% */
2575
2650
  text-align: center;
2576
- `;import{Fragment as TT,jsx as He,jsxs as yo}from"react/jsx-runtime";var N2=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:i,title:a,subtitle:l,total:s,to:c,network:m,hasFunds:f,fee:u,from:g,cta:w,chain:y,isSubmitting:b,isPreparing:P,isTokenPriceLoading:A,isTokenContractInfoLoading:T,symbol:x,balance:R,onClick:M,spender:D})=>yo(TT,{children:[He(_,{onClose:o}),e&&He(ET,{children:e}),He(qc,{style:{marginTop:e?"1.5rem":0},children:a}),He(Gi,{children:l}),yo(ql,{style:{marginTop:"2rem"},children:[s&&yo(pr,{children:[He(ur,{children:"Total"}),He(mr,{$isLoading:P||A,children:s})]}),n&&n!=="transaction"&&yo(pr,{children:[He(ur,{children:"Action"}),He(mr,{children:n})]}),i?yo(pr,{children:[He(ur,{children:"Amount"}),yo(mr,{$isLoading:T,children:[bT(i)," ",x]})]}):null,D?yo(pr,{children:[He(ur,{children:"Spender"}),He(mr,{children:He(Na,{address:D,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,c&&yo(pr,{children:[He(ur,{children:"To"}),He(mr,{children:He(Na,{address:c,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),yo(pr,{children:[He(ur,{children:"Network"}),He(mr,{children:m})]}),yo(pr,{children:[He(ur,{children:"Estimated fee"}),He(mr,{$isLoading:P||A,children:u})]})]}),He(to,{}),t?He(Oa,{style:{marginTop:"2rem"},children:t.message}):r?He(Oa,{style:{marginTop:"2rem"},children:wT}):null,He(CT,{$useSmallMargins:!!(r||t),address:g,balance:R,isLoading:P||A,errMsg:!P&&!r&&!t&&!f?`Add funds on ${y?.name} to complete transaction.`:void 0}),He(ol,{style:{marginTop:"1rem"},loading:b,onClick:M,children:w}),He($,{})]}),CT=O2(oc)`
2651
+ `;import{Fragment as w9,jsx as He,jsxs as vo}from"react/jsx-runtime";var cv=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:i,title:a,subtitle:l,total:s,to:c,network:m,hasFunds:f,fee:u,from:v,cta:g,chain:y,isSubmitting:b,isPreparing:T,isTokenPriceLoading:k,isTokenContractInfoLoading:E,symbol:P,balance:x,onClick:I,spender:N})=>vo(w9,{children:[He(A,{onClose:o}),e&&He(C9,{children:e}),He(Qc,{style:{marginTop:e?"1.5rem":0},children:a}),He(qi,{children:l}),vo(Yl,{style:{marginTop:"2rem"},children:[s&&vo(pr,{children:[He(ur,{children:"Total"}),He(mr,{$isLoading:T||k,children:s})]}),n&&n!=="transaction"&&vo(pr,{children:[He(ur,{children:"Action"}),He(mr,{children:n})]}),i?vo(pr,{children:[He(ur,{children:"Amount"}),vo(mr,{$isLoading:E,children:[v9(i)," ",P]})]}):null,N?vo(pr,{children:[He(ur,{children:"Spender"}),He(mr,{children:He(Ba,{address:N,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,c&&vo(pr,{children:[He(ur,{children:"To"}),He(mr,{children:He(Ba,{address:c,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),vo(pr,{children:[He(ur,{children:"Network"}),He(mr,{children:m})]}),vo(pr,{children:[He(ur,{children:"Estimated fee"}),He(mr,{$isLoading:T||k,children:u})]})]}),He(oo,{}),t?He(Fa,{style:{marginTop:"2rem"},children:t.message}):r?He(Fa,{style:{marginTop:"2rem"},children:g9}):null,He(y9,{$useSmallMargins:!!(r||t),address:v,balance:x,isLoading:T||k,errMsg:!T&&!r&&!t&&!f?`Add funds on ${y?.name} to complete transaction.`:void 0}),He(ll,{style:{marginTop:"1rem"},loading:b,onClick:I,children:g}),He(z,{})]}),y9=lv(cc)`
2577
2652
  ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
2578
- `,wT="There was an error preparing your transaction. Your transaction request will likely fail.",bT=e=>e.toLocaleString(),ET=O2.div`
2653
+ `,g9="There was an error preparing your transaction. Your transaction request will likely fail.",v9=e=>e.toLocaleString(),C9=lv.div`
2579
2654
  display: flex;
2580
2655
  width: 100%;
2581
2656
  justify-content: center;
@@ -2585,12 +2660,12 @@ You will have to sign up with another method first to register a passkey for you
2585
2660
  object-fit: contain;
2586
2661
  border-radius: var(--privy-border-radius-sm);
2587
2662
  }
2588
- `;import{ExclamationCircleIcon as _T,ClipboardDocumentIcon as PT,ClipboardDocumentCheckIcon as xT}from"@heroicons/react/24/outline";import{useState as AT}from"react";import vr from"styled-components";import{ErrorCode as zc}from"@ethersproject/logger";var ST=new Set([zc.CALL_EXCEPTION,zc.NONCE_EXPIRED,zc.REPLACEMENT_UNDERPRICED,zc.TRANSACTION_REPLACED]),D2=e=>{let t;return e.code&&e.code!==-32e3&&ST.has(e.code)&&(t=e.transactionHash),t},U2=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 VT,jsx as kt,jsxs as Kn}from"react/jsx-runtime";var kT=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=D2(e),o=U2(e);return{errorCode:t,transactionHash:r,errorMessage:o}},RT=()=>Kn(LT,{children:[kt(NT,{}),kt(OT,{})]}),V2=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=I(),[i,a]=AT(!1),{errorCode:l,transactionHash:s,errorMessage:c}=kT(e),m=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Kn(VT,{children:[kt(_,{onClose:r}),Kn(MT,{children:[kt(RT,{}),kt(IT,{children:l}),kt(WT,{children:"Please try again."}),Kn(B2,{children:[kt(F2,{children:"Error message"}),kt(H2,{clickable:!1,children:c})]}),s&&Kn(B2,{children:[kt(F2,{children:"Transaction hash"}),Kn(UT,{children:["Copy this hash to view details about the transaction on a"," ",kt("u",{children:kt("a",{href:m,children:"block explorer"})}),"."]}),Kn(H2,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,kt(HT,{clicked:i})]})]}),kt(DT,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),kt(Z,{})]})},MT=vr.div`
2663
+ `;import{ExclamationCircleIcon as E9,ClipboardDocumentIcon as T9,ClipboardDocumentCheckIcon as S9}from"@heroicons/react/24/outline";import{useState as _9}from"react";import Cr from"styled-components";import{ErrorCode as Jc}from"@ethersproject/logger";var b9=new Set([Jc.CALL_EXCEPTION,Jc.NONCE_EXPIRED,Jc.REPLACEMENT_UNDERPRICED,Jc.TRANSACTION_REPLACED]),dv=e=>{let t;return e.code&&e.code!==-32e3&&b9.has(e.code)&&(t=e.transactionHash),t},pv=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 F9,jsx as It,jsxs as Yn}from"react/jsx-runtime";var P9=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=dv(e),o=pv(e);return{errorCode:t,transactionHash:r,errorMessage:o}},A9=()=>Yn(I9,{children:[It(W9,{}),It(M9,{})]}),hv=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=_9(!1),{errorCode:l,transactionHash:s,errorMessage:c}=P9(e),m=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Yn(F9,{children:[It(A,{onClose:r}),Yn(x9,{children:[It(A9,{}),It(k9,{children:l}),It(R9,{children:"Please try again."}),Yn(mv,{children:[It(uv,{children:"Error message"}),It(fv,{clickable:!1,children:c})]}),s&&Yn(mv,{children:[It(uv,{children:"Transaction hash"}),Yn(L9,{children:["Copy this hash to view details about the transaction on a"," ",It("u",{children:It("a",{href:m,children:"block explorer"})}),"."]}),Yn(fv,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,It(U9,{clicked:i})]})]}),It(O9,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),It(Z,{})]})},x9=Cr.div`
2589
2664
  display: flex;
2590
2665
  flex-direction: column;
2591
2666
  align-items: center;
2592
2667
  justify-content: center;
2593
- `,IT=vr.span`
2668
+ `,k9=Cr.span`
2594
2669
  color: var(--privy-color-foreground);
2595
2670
  text-align: center;
2596
2671
  font-size: 1.125rem;
@@ -2598,7 +2673,7 @@ You will have to sign up with another method first to register a passkey for you
2598
2673
  line-height: 1.25rem; /* 111.111% */
2599
2674
  text-align: center;
2600
2675
  margin: 10px;
2601
- `,WT=vr.span`
2676
+ `,R9=Cr.span`
2602
2677
  margin-top: 4px;
2603
2678
  margin-bottom: 10px;
2604
2679
  color: var(--privy-color-foreground-3);
@@ -2609,7 +2684,7 @@ You will have to sign up with another method first to register a passkey for you
2609
2684
  font-weight: 400;
2610
2685
  line-height: 20px; /* 142.857% */
2611
2686
  letter-spacing: -0.008px;
2612
- `,LT=vr.div`
2687
+ `,I9=Cr.div`
2613
2688
  position: relative;
2614
2689
  width: 60px;
2615
2690
  height: 60px;
@@ -2617,37 +2692,37 @@ You will have to sign up with another method first to register a passkey for you
2617
2692
  display: flex;
2618
2693
  justify-content: center;
2619
2694
  align-items: center;
2620
- `,OT=vr(_T)`
2695
+ `,M9=Cr(E9)`
2621
2696
  position: absolute;
2622
2697
  width: 35px;
2623
2698
  height: 35px;
2624
2699
  color: var(--privy-color-error);
2625
- `,NT=vr.div`
2700
+ `,W9=Cr.div`
2626
2701
  position: absolute;
2627
2702
  width: 60px;
2628
2703
  height: 60px;
2629
2704
  border-radius: 50%;
2630
2705
  background-color: var(--privy-color-error);
2631
2706
  opacity: 0.1;
2632
- `,DT=vr(F)`
2707
+ `,O9=Cr(B)`
2633
2708
  && {
2634
2709
  margin-top: 24px;
2635
2710
  }
2636
2711
  transition: color 350ms ease, background-color 350ms ease;
2637
- `,F2=vr.span`
2712
+ `,uv=Cr.span`
2638
2713
  width: 100%;
2639
2714
  text-align: left;
2640
2715
  font-size: 0.825rem;
2641
2716
  color: var(--privy-color-foreground);
2642
2717
  padding: 4px;
2643
- `,B2=vr.div`
2718
+ `,mv=Cr.div`
2644
2719
  width: 100%;
2645
2720
  margin: 5px;
2646
2721
  display: flex;
2647
2722
  flex-direction: column;
2648
2723
  justify-content: center;
2649
2724
  align-items: center;
2650
- `,UT=vr.text`
2725
+ `,L9=Cr.text`
2651
2726
  position: relative;
2652
2727
  width: 100%;
2653
2728
  padding: 5px;
@@ -2655,7 +2730,7 @@ You will have to sign up with another method first to register a passkey for you
2655
2730
  color: var(--privy-color-foreground-3);
2656
2731
  text-align: left;
2657
2732
  word-wrap: break-word;
2658
- `,H2=vr.span`
2733
+ `,fv=Cr.span`
2659
2734
  position: relative;
2660
2735
  width: 100%;
2661
2736
  background-color: var(--privy-color-background-2);
@@ -2673,24 +2748,24 @@ You will have to sign up with another method first to register a passkey for you
2673
2748
  &:hover {
2674
2749
  background-color: var(--privy-color-foreground-4);
2675
2750
  }`}
2676
- `,FT=vr(PT)`
2751
+ `,N9=Cr(T9)`
2677
2752
  position: absolute;
2678
2753
  top: 13px;
2679
2754
  right: 13px;
2680
2755
  width: 24px;
2681
2756
  height: 24px;
2682
- `,BT=vr(xT)`
2757
+ `,D9=Cr(S9)`
2683
2758
  position: absolute;
2684
2759
  top: 13px;
2685
2760
  right: 13px;
2686
2761
  width: 24px;
2687
2762
  height: 24px;
2688
- `,HT=({clicked:e})=>e?kt(BT,{}):kt(FT,{});import{BigNumber as jp}from"@ethersproject/bignumber";import GT from"styled-components";import{Fragment as $T,jsx as jn,jsxs as KT}from"react/jsx-runtime";var qT=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=jp.from(e.gasUsed),o=jp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=jp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},G2=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>KT($T,{children:[jn(_,{onClose:o}),jn(kn,{title:l??"Transaction complete!",description:s??"You're all set."}),jn(Lc,{tokenPrice:n,from:t.from,to:t.to,gas:qT(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),jn(to,{}),jn(zT,{loading:!1,onClick:o,children:"All Done"}),jn(ne,{}),jn($,{})]}),zT=GT(F)`
2763
+ `,U9=({clicked:e})=>e?It(D9,{}):It(N9,{});import{BigNumber as Jp}from"@ethersproject/bignumber";import B9 from"styled-components";import{Fragment as V9,jsx as Zn,jsxs as q9}from"react/jsx-runtime";var H9=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Jp.from(e.gasUsed),o=Jp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Jp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},yv=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>q9(V9,{children:[Zn(A,{onClose:o}),Zn(Mn,{title:l??"Transaction complete!",description:s??"You're all set."}),Zn(Hc,{tokenPrice:n,from:t.from,to:t.to,gas:H9(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Zn(oo,{}),Zn(G9,{loading:!1,onClick:o,children:"All Done"}),Zn(ne,{}),Zn(z,{})]}),G9=B9(B)`
2689
2764
  && {
2690
2765
  margin-top: 24px;
2691
2766
  }
2692
2767
  transition: color 350ms ease, background-color 350ms ease;
2693
- `;import{createPublicClient as jT,http as YT}from"viem";var ZT=(e,t)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/Math.pow(10,t)),q2=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],z2=async({address:e,chain:t,amount:r,rpcConfig:o,privyAppId:n})=>{if(!r)return{value:"",symbol:""};try{let i=jT({chain:t,transport:YT(id(t,o,n))}),[a,l]=await Promise.all([i.readContract({abi:q2,address:e,functionName:"symbol"}),i.readContract({abi:q2,address:e,functionName:"decimals"})]);return{value:ZT(parseFloat(r.toString()),l),symbol:a}}catch(i){return console.log(i),{value:r.toString(),symbol:""}}};import{decodeFunctionData as $2}from"viem";var K2=e=>{let t=JT(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=e9(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},QT=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],JT=e=>{try{return $2({abi:QT,data:e})}catch{return null}},XT=[{constant:!1,inputs:[{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],e9=e=>{try{return $2({abi:XT,data:e})}catch{return null}};import{BigNumber as t9}from"@ethersproject/bignumber";import{useEffect as r9,useState as o9}from"react";import{calculateTotalGasEstimate as n9,populateTransactionRequest as i9}from"@privy-io/js-sdk-core";var j2=(e,t)=>{let[r,o]=o9(null),{getAccessToken:n,user:i}=q(),{walletProxy:a}=I(),l=he(i),s=async()=>{if(!await n()||!a||!l)return null;let m=[],f=await i9(l.address,e,t).catch(b=>(m.push(b),e)),{totalGasEstimate:u,l1ExecutionFeeEstimate:g}=await n9(f,t).catch(b=>(m.push(b),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:w,hasSufficientFunds:y}=await Fi(l.address,f,u??t9.from(0),t).catch(b=>(m.push(b),{balance:null,hasSufficientFunds:!1}));return{tx:f,totalGasEstimate:u,l1ExecutionFeeEstimate:g,balance:w,hasFunds:y,errors:m}};return r9(()=>{r&&o(null),s().then(o)},[e]),r};import{jsx as Xa}from"react/jsx-runtime";var Q2=new Ct(new Er("There was an issue preparing your transaction",J2.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),X2=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=S(),{rpcConfig:n,chains:i,closePrivyModal:a,walletProxy:l}=I(),{getAccessToken:s,user:c}=q(),{wallets:m}=Gr(),f=Ge(),[u,g]=Ja(e?.sendTransaction?.transactionRequest),[w,y]=Ja(null),[b,P]=Ja(!1),[A,T]=Ja(null),[x,R]=Ja(null);if(!u||!e?.sendTransaction)return Xa(Nn,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(Q2),a({shouldCallAuthOnSuccess:!1})}});let M=$c(()=>u.from?m.find(G=>Y2(G.address)===Y2(u.from)):he(c),[u.from]),D=$c(()=>i.find(G=>Number(G.id)===Number(u.chainId)),[u.chainId]),B=D?.nativeCurrency.symbol??"ETH",{action:K,amount:j,spender:L,isErc20Ish:N}=$c(()=>K2(u.data),[u.data]);a9(()=>{u.to&&D&&N&&z2({amount:j,address:u.to,chain:D,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(y).catch(console.error)},[u.to,j,D]);let{tokenPrice:W,isTokenPriceLoading:ve}=co(u),Me=$c(()=>rr(Number(u.chainId),i,n,{appId:f.id}),[u.chainId,n]),Y=j2(u,Me),te=()=>{if(!b)return A?(e?.sendTransaction?.onSuccess(A.response),a({shouldCallAuthOnSuccess:!1})):!x&&!Y?.errors[0]?(e?.sendTransaction?.onFailure(new Ct(new Er("The user rejected the request",J2.E4001_USER_REJECTED_REQUEST.eipCode))),a({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(x??Y?.errors[0]??Q2),a({shouldCallAuthOnSuccess:!1}))};t.current=te;let ee=async()=>{P(!0);try{let G=await s();if(b||!G||!M||!l)return;let ie=await zl(G,M.address,l,Y?.tx??u,Me,e.sendTransaction?.requesterAppId),ut=await ie.wait();T({receipt:$l(ut),response:ie})}catch(G){console.warn({transaction:Y?.tx??u,error:G}),R(G)}finally{P(!1)}},_e=async()=>{if(!he(c))return;if(!f.fundingConfig||f.fundingConfig.methods.length===0||!e.funding)throw new Error("Funding wallet is not enabled");let ie=Gc({fundingMethods:f.fundingConfig?.methods});r({...e,funding:{...e?.funding,methodScreen:ie}}),o(ie)},Te=f.embeddedWallets.priceDisplay.primary==="fiat-currency",ze=Z2(Y?.tx.value??0).add(Z2(Y?.totalGasEstimate?.toBigInt()??0)).toHexString(),Ve=fr(ze,B),pt=Te&&W?po(ze,W):void 0,Fe=fr(Y?.totalGasEstimate?.toString()??0,B),ae=Te&&W?po(Y?.totalGasEstimate?.toString()??0,W):void 0,Ft=fr(Y?.balance?.toString()??0,B,void 0,!0),Rr=Te&&W?po(Y?.balance?.toString()??0,W):void 0,jr=e.sendTransaction?.uiOptions?.transactionInfo?.title||(K==="approve"?"Confirm address":`Approve ${K}`),O=e.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?Xa("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Mr=Y&&!Y.errors[0]&&!Y.hasFunds&&f.fundingConfig&&f.fundingConfig.methods.length>0,V=Mr?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return A?.receipt?Xa(G2,{txn:Y?.tx??u,onClose:te,receipt:A.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:B,l1GasEstimate:Y?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):x?Xa(V2,{transactionError:x,chainId:Y?.tx.chainId??u.chainId,onClose:te,onRetry:({resetNonce:G})=>{R(null);let ie={...Y?.tx??u};G&&(ie.nonce=void 0),g(ie)}}):Xa(N2,{isSubmitting:b,submitError:x,isPreparing:!Y,isTokenPriceLoading:ve,isTokenContractInfoLoading:!w,prepareError:Y?.errors[0],symbol:w?.symbol,chain:D,img:rt,title:jr,subtitle:O,spender:L,total:u.value?pt??Ve:void 0,fee:ae??Fe,to:u.to,network:f.chains.find(G=>G.id===u.chainId)?.name??"",from:M?.address??"",cta:V,hasFunds:Y?.hasFunds,action:K,balance:Rr??Ft,amount:w?.value??j,onClose:te,onClick:Mr?_e:ee})};import{isHexString as s9}from"@ethersproject/bytes";import{toUtf8String as l9}from"@ethersproject/strings";import{useEffect as ev,useState as es}from"react";import Zi from"styled-components";import{ProviderErrors as Yp}from"@privy-io/js-sdk-core";import{Fragment as ov,jsx as tt,jsxs as ts}from"react/jsx-runtime";var c9=e=>{if(!s9(e))return e;try{return l9(e)}catch{return e}},d9=e=>JSON.stringify(e,null,2),p9=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?tt(m9,{children:Object.entries(r).map(([o,n])=>ts("li",{children:[ts("strong",{children:[o,":"]})," ",t(n)]},o))}):tt("span",{children:String(r)});return tt("div",{children:t(e)})},u9=e=>{let{types:t,primaryType:r,...o}=e.typedData;return ts(ov,{children:[tt(rv,{children:tt(p9,{data:o})}),tt(jo,{text:d9(e.typedData),itemName:"full payload to clipboard"})," "]})},tv=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=I(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=S(),[a,l]=es(!0),[s,c]=es(""),[m,f]=es(),[u,g]=es(null),[w,y]=es(!1),b=u!==null;ev(()=>{e||o("LANDING")},[e]),ev(()=>{t(ei).then(K=>{l(!1),K||(c("An error has occurred, please try again."),f(new Ct(new Er(s,Yp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:P,data:A,confirmAndSign:T,onSuccess:x,onFailure:R,uiOptions:M}=n.signMessage,D={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=K=>{K?x(K):R(m||new Ct(new Er("The user rejected the request.",Yp.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),c(""),f(void 0)},200)};return i.current=()=>{B(u)},ts(ov,{children:[tt(_,{onClose:()=>B(u)}),tt(oe,{}),M.iconUrl&&typeof M.iconUrl=="string"?tt(y9,{children:tt(l2,{size:"sm",src:M.iconUrl,alt:"app image"})}):null,tt(qc,{children:D.title}),tt(Gi,{children:D.description}),P==="personal_sign"&&tt(rv,{children:c9(A)}),P==="eth_signTypedData_v4"&&tt(u9,{typedData:A}),tt(g9,{}),tt(f9,{fail:!0,children:s}),tt(ol,{disabled:w||b||a,loading:w,onClick:async()=>{y(!0),c("");try{let K=await T();g(K),y(!1),setTimeout(()=>{B(K)},Ne)}catch(K){console.error(K),c("An error has occurred, please try again."),f(new Ct(new Er(s,Yp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:w?"Signing...":b?ts(h9,{children:[tt(Ui,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",tt("span",{children:"Success"})]}):D.buttonText}),tt(ne,{}),tt($,{})]})},rv=Zi.div`
2768
+ `;import{createPublicClient as z9,http as $9}from"viem";var K9=(e,t)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/Math.pow(10,t)),gv=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],vv=async({address:e,chain:t,amount:r,rpcConfig:o,privyAppId:n})=>{if(!r)return{value:"",symbol:""};try{let i=z9({chain:t,transport:$9(dd(t,o,n))}),[a,l]=await Promise.all([i.readContract({abi:gv,address:e,functionName:"symbol"}),i.readContract({abi:gv,address:e,functionName:"decimals"})]);return{value:K9(parseFloat(r.toString()),l),symbol:a}}catch(i){return console.log(i),{value:r.toString(),symbol:""}}};import{decodeFunctionData as Cv}from"viem";var wv=e=>{let t=Y9(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=Q9(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},j9=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Y9=e=>{try{return Cv({abi:j9,data:e})}catch{return null}},Z9=[{constant:!1,inputs:[{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Q9=e=>{try{return Cv({abi:Z9,data:e})}catch{return null}};import{BigNumber as J9}from"@ethersproject/bignumber";import{useEffect as X9,useState as eS}from"react";import{calculateTotalGasEstimate as tS,populateTransactionRequest as rS}from"@privy-io/js-sdk-core";var bv=(e,t)=>{let[r,o]=eS(null),{getAccessToken:n,user:i}=q(),{walletProxy:a}=M(),l=he(i),s=async()=>{if(!await n()||!a||!l)return null;let m=[],f=await rS(l.address,e,t).catch(b=>(m.push(b),e)),{totalGasEstimate:u,l1ExecutionFeeEstimate:v}=await tS(f,t).catch(b=>(m.push(b),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:g,hasSufficientFunds:y}=await Fi(l.address,f,u??J9.from(0),t).catch(b=>(m.push(b),{balance:null,hasSufficientFunds:!1}));return{tx:f,totalGasEstimate:u,l1ExecutionFeeEstimate:v,balance:g,hasFunds:y,errors:m}};return X9(()=>{r&&o(null),s().then(o)},[e]),r};import{jsx as ns}from"react/jsx-runtime";var Sv=new Ct(new Tr("There was an issue preparing your transaction",_v.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),Pv=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=_(),{rpcConfig:n,chains:i,closePrivyModal:a,walletProxy:l}=M(),{getAccessToken:s,user:c}=q(),{wallets:m}=zr(),f=Ve(),[u,v]=os(e?.sendTransaction?.transactionRequest),[g,y]=os(null),[b,T]=os(!1),[k,E]=os(null),[P,x]=os(null);if(!u||!e?.sendTransaction)return ns(Fn,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(Sv),a({shouldCallAuthOnSuccess:!1})}});let I=Xc(()=>u.from?m.find(V=>Ev(V.address)===Ev(u.from)):he(c),[u.from]),N=Xc(()=>i.find(V=>Number(V.id)===Number(u.chainId)),[u.chainId]),H=N?.nativeCurrency.symbol??"ETH",{action:K,amount:j,spender:O,isErc20Ish:D}=Xc(()=>wv(u.data),[u.data]);oS(()=>{u.to&&N&&D&&vv({amount:j,address:u.to,chain:N,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(y).catch(console.error)},[u.to,j,N]);let{tokenPrice:W,isTokenPriceLoading:ve}=uo(u),Ie=Xc(()=>Gt(Number(u.chainId),i,n,{appId:f.id}),[u.chainId,n]),Y=bv(u,Ie),X=()=>{if(!b)return k?(e?.sendTransaction?.onSuccess(k.response),a({shouldCallAuthOnSuccess:!1})):!P&&!Y?.errors[0]?(e?.sendTransaction?.onFailure(new Ct(new Tr("The user rejected the request",_v.E4001_USER_REJECTED_REQUEST.eipCode))),a({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(P??Y?.errors[0]??Sv),a({shouldCallAuthOnSuccess:!1}))};t.current=X;let te=async()=>{T(!0);try{let V=await s();if(b||!V||!I||!l)return;let ie=await Zl(V,I.address,l,Y?.tx??u,Ie,e.sendTransaction?.requesterAppId),mt=await ie.wait();E({receipt:Ql(mt),response:ie})}catch(V){console.warn({transaction:Y?.tx??u,error:V}),x(V)}finally{T(!1)}},_e=async()=>{if(!he(c))return;if(!f.fundingConfig||f.fundingConfig.methods.length===0||!e.funding)throw new Error("Funding wallet is not enabled");let ie=Zc({fundingMethods:f.fundingConfig?.methods});r({...e,funding:{...e?.funding,methodScreen:ie}}),o(ie)},Te=f.embeddedWallets.priceDisplay.primary==="fiat-currency",Ke=Tv(Y?.tx.value??0).add(Tv(Y?.totalGasEstimate?.toBigInt()??0)).toHexString(),Ge=fr(Ke,H),ut=Te&&W?mo(Ke,W):void 0,Fe=fr(Y?.totalGasEstimate?.toString()??0,H),se=Te&&W?mo(Y?.totalGasEstimate?.toString()??0,W):void 0,Ft=fr(Y?.balance?.toString()??0,H,void 0,!0),Wr=Te&&W?mo(Y?.balance?.toString()??0,W):void 0,Zr=e.sendTransaction?.uiOptions?.transactionInfo?.title||(K==="approve"?"Confirm address":`Approve ${K}`),L=e.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?ns("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Or=Y&&!Y.errors[0]&&!Y.hasFunds&&f.fundingConfig&&f.fundingConfig.methods.length>0,G=Or?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return k?.receipt?ns(yv,{txn:Y?.tx??u,onClose:X,receipt:k.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:H,l1GasEstimate:Y?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):P?ns(hv,{transactionError:P,chainId:Y?.tx.chainId??u.chainId,onClose:X,onRetry:({resetNonce:V})=>{x(null);let ie={...Y?.tx??u};V&&(ie.nonce=void 0),v(ie)}}):ns(cv,{isSubmitting:b,submitError:P,isPreparing:!Y,isTokenPriceLoading:ve,isTokenContractInfoLoading:!g,prepareError:Y?.errors[0],symbol:g?.symbol,chain:N,img:rt,title:Zr,subtitle:L,spender:O,total:u.value?ut??Ge:void 0,fee:se??Fe,to:u.to,network:f.chains.find(V=>V.id===u.chainId)?.name??"",from:I?.address??"",cta:G,hasFunds:Y?.hasFunds,action:K,balance:Wr??Ft,amount:g?.value??j,onClose:X,onClick:Or?_e:te})};import{isHexString as nS}from"@ethersproject/bytes";import{toUtf8String as iS}from"@ethersproject/strings";import{useEffect as Av,useState as is}from"react";import Qi from"styled-components";import{ProviderErrors as Xp}from"@privy-io/js-sdk-core";import{Fragment as Rv,jsx as tt,jsxs as as}from"react/jsx-runtime";var aS=e=>{if(!nS(e))return e;try{return iS(e)}catch{return e}},sS=e=>JSON.stringify(e,null,2),lS=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?tt(dS,{children:Object.entries(r).map(([o,n])=>as("li",{children:[as("strong",{children:[o,":"]})," ",t(n)]},o))}):tt("span",{children:String(r)});return tt("div",{children:t(e)})},cS=e=>{let{types:t,primaryType:r,...o}=e.typedData;return as(Rv,{children:[tt(kv,{children:tt(lS,{data:o})}),tt(Jo,{text:sS(e.typedData),itemName:"full payload to clipboard"})," "]})},xv=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=is(!0),[s,c]=is(""),[m,f]=is(),[u,v]=is(null),[g,y]=is(!1),b=u!==null;Av(()=>{e||o("LANDING")},[e]),Av(()=>{t(ri).then(K=>{l(!1),K||(c("An error has occurred, please try again."),f(new Ct(new Tr(s,Xp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:T,data:k,confirmAndSign:E,onSuccess:P,onFailure:x,uiOptions:I}=n.signMessage,N={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},H=K=>{K?P(K):x(m||new Ct(new Tr("The user rejected the request.",Xp.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{v(null),c(""),f(void 0)},200)};return i.current=()=>{H(u)},as(Rv,{children:[tt(A,{onClose:()=>H(u)}),tt(oe,{}),I.iconUrl&&typeof I.iconUrl=="string"?tt(mS,{children:tt(W2,{size:"sm",src:I.iconUrl,alt:"app image"})}):null,tt(Qc,{children:N.title}),tt(qi,{children:N.description}),T==="personal_sign"&&tt(kv,{children:aS(k)}),T==="eth_signTypedData_v4"&&tt(cS,{typedData:k}),tt(fS,{}),tt(pS,{fail:!0,children:s}),tt(ll,{disabled:g||b||a,loading:g,onClick:async()=>{y(!0),c("");try{let K=await E();v(K),y(!1),setTimeout(()=>{H(K)},Ne)}catch(K){console.error(K),c("An error has occurred, please try again."),f(new Ct(new Tr(s,Xp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:g?"Signing...":b?as(uS,{children:[tt(Ui,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",tt("span",{children:"Success"})]}):N.buttonText}),tt(ne,{}),tt(z,{})]})},kv=Qi.div`
2694
2769
  margin-top: 1.5rem;
2695
2770
  background-color: var(--privy-color-background-2);
2696
2771
  border-radius: var(--privy-border-radius-md);
@@ -2709,7 +2784,7 @@ You will have to sign up with another method first to register a passkey for you
2709
2784
  display: none; /* Safari and Chrome */
2710
2785
  }
2711
2786
  }
2712
- `,m9=Zi.ul`
2787
+ `,dS=Qi.ul`
2713
2788
  margin-left: 12px !important;
2714
2789
  white-space: nowrap;
2715
2790
 
@@ -2721,7 +2796,7 @@ You will have to sign up with another method first to register a passkey for you
2721
2796
  font-weight: 500 !important;
2722
2797
  }
2723
2798
  }
2724
- `,f9=Zi.div`
2799
+ `,pS=Qi.div`
2725
2800
  line-height: 20px;
2726
2801
  height: 20px;
2727
2802
  font-size: 13px;
@@ -2731,20 +2806,20 @@ You will have to sign up with another method first to register a passkey for you
2731
2806
  width: 100%;
2732
2807
  margin-top: 16px;
2733
2808
  margin-bottom: 4px;
2734
- `,h9=Zi.span`
2809
+ `,uS=Qi.span`
2735
2810
  display: flex;
2736
2811
  align-items: center;
2737
2812
  gap: 8px;
2738
- `,y9=Zi.div`
2813
+ `,mS=Qi.div`
2739
2814
  display: flex;
2740
2815
  flex-direction: column;
2741
2816
  justify-content: center;
2742
2817
  align-items: center;
2743
2818
  width: 100%;
2744
2819
  height: 82px;
2745
- `,g9=Zi.div`
2820
+ `,fS=Qi.div`
2746
2821
  flex-grow: 1;
2747
- `;import{useEffect as nv,useState as iv}from"react";import v9 from"styled-components";import{Fragment as w9,jsx as go,jsxs as Kc}from"react/jsx-runtime";var av=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:m,setReadyToTrue:f,closePrivyModal:u,createAnalyticsEvent:g}=I(),[w,y]=iv(!1),[b,P]=iv(void 0),A=Ne;async function T(){try{await c(),y(!0),f(!0)}catch(M){if(M?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(M?.privyErrorCode==="max_accounts_reached"){console.error(new wr(M).toString()),P(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(M?.privyErrorCode==="user_does_not_exist"){P(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:D,detail:B}=fd(M);P({retryable:D,detail:B,message:"Authentication failed"})}}nv(()=>{T()},[]),nv(()=>{if(!(r&&e&&w&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(B)}if(Gt(o,n?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A);return()=>clearTimeout(B)}m();let D=setTimeout(()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A);return()=>clearTimeout(D)},[r,e,w,o]);let x=w?"Successfully connected with Telegram":b?b.message:"Verifying connection to Telegram",R="";return w?R="You\u2019re good to go!":b?R=b.detail:R="Just a few moments more",Kc(w9,{children:[go(_,{}),go(oe,{}),Kc(C9,{children:[go(Je,{children:Kc("div",{children:[go(ot,{success:w,fail:!!b}),go(bc,{style:{width:"38px",height:"38px"}})]})}),Kc(Xe,{children:[go("h3",{children:x}),go("p",{children:R})]}),b&&b?.retryable?go(hi,{onClick:()=>{s().then(async()=>T()).catch(M=>{let{retryable:D,detail:B}=fd(M);P({retryable:D,detail:B,message:"Authentication failed"})}),P(void 0)},disabled:!w&&!b?.retryable,children:"Retry"}):null]}),go(ne,{}),go(Z,{})]})},C9=v9.div`
2822
+ `;import{useEffect as Iv,useState as Mv}from"react";import hS from"styled-components";import{Fragment as gS,jsx as Co,jsxs as ed}from"react/jsx-runtime";var Wv=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:m,setReadyToTrue:f,closePrivyModal:u,createAnalyticsEvent:v}=M(),[g,y]=Mv(!1),[b,T]=Mv(void 0),k=Ne;async function E(){try{await c(),y(!0),f(!0)}catch(I){if(I?.privyErrorCode==="allowlist_rejected"){T(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(I?.privyErrorCode==="max_accounts_reached"){console.error(new br(I).toString()),T(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(I?.privyErrorCode==="user_does_not_exist"){T(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:N,detail:H}=bd(I);T({retryable:N,detail:H,message:"Authentication failed"})}}Iv(()=>{E()},[]),Iv(()=>{if(!(r&&e&&g&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(H)}if(qt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(H)}m();let N=setTimeout(()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k);return()=>clearTimeout(N)},[r,e,g,o]);let P=g?"Successfully connected with Telegram":b?b.message:"Verifying connection to Telegram",x="";return g?x="You\u2019re good to go!":b?x=b.detail:x="Just a few moments more",ed(gS,{children:[Co(A,{}),Co(oe,{}),ed(yS,{children:[Co(Je,{children:ed("div",{children:[Co(ot,{success:g,fail:!!b}),Co(xc,{style:{width:"38px",height:"38px"}})]})}),ed(qe,{children:[Co("h3",{children:P}),Co("p",{children:x})]}),b&&b?.retryable?Co(Ho,{onClick:()=>{s().then(async()=>E()).catch(I=>{let{retryable:N,detail:H}=bd(I);T({retryable:N,detail:H,message:"Authentication failed"})}),T(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),Co(ne,{}),Co(Z,{})]})},yS=hS.div`
2748
2823
  display: flex;
2749
2824
  flex-direction: column;
2750
2825
  align-items: center;
@@ -2752,9 +2827,9 @@ You will have to sign up with another method first to register a passkey for you
2752
2827
  margin-left: 27px;
2753
2828
  margin-right: 27px;
2754
2829
  gap: 24px;
2755
- `;import P9 from"@heroicons/react/24/outline/EnvelopeIcon";import b9 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as E9,useState as sv}from"react";import cv from"styled-components";import{Fragment as _9,jsx as rs,jsxs as lv}from"react/jsx-runtime";var dv=E9((e,t)=>{let[r,o]=sv(""),[n,i]=sv(!1),{authenticated:a,user:l}=q(),{initUpdateEmail:s}=I(),{navigate:c,setModalData:m,currentScreen:f}=S(),{enabled:u,token:g}=be(),w=Es(r),y=n,b=n||!w,P=async T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,T),c("AWAITING_PASSWORDLESS_CODE")}catch(x){m({errorModalData:{error:x,previousScreen:f||"LANDING"}})}i(!1)},A=()=>{u&&!g&&!a?(m({captchaModalData:{callback:T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,T)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):P(g)};return lv(_9,{children:[rs(T9,{children:lv(S9,{children:[rs(b9,{}),rs("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&A()},value:r,autoComplete:"email"}),e.stacked?null:rs(yi,{isSubmitting:y,onClick:A,disabled:b,children:"Submit"})]})}),e.stacked?rs(F,{loadingText:null,loading:y,disabled:b,onClick:A,children:"Submit"}):null]})}),T9=cv.div`
2830
+ `;import TS from"@heroicons/react/24/outline/EnvelopeIcon";import vS from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as CS,useState as Ov}from"react";import Nv from"styled-components";import{Fragment as ES,jsx as ss,jsxs as Lv}from"react/jsx-runtime";var Dv=CS((e,t)=>{let[r,o]=Ov(""),[n,i]=Ov(!1),{authenticated:a,user:l}=q(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:m,currentScreen:f}=_(),{enabled:u,token:v}=be(),g=As(r),y=n,b=n||!g,T=async E=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,E),c("AWAITING_PASSWORDLESS_CODE")}catch(P){m({errorModalData:{error:P,previousScreen:f||"LANDING"}})}i(!1)},k=()=>{u&&!v&&!a?(m({captchaModalData:{callback:E=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,E)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):T(v)};return Lv(ES,{children:[ss(wS,{children:Lv(bS,{children:[ss(vS,{}),ss("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:E=>o(E.target.value),onKeyUp:E=>{E.key==="Enter"&&k()},value:r,autoComplete:"email"}),e.stacked?null:ss(yi,{isSubmitting:y,onClick:k,disabled:b,children:"Submit"})]})}),e.stacked?ss(B,{loadingText:null,loading:y,disabled:b,onClick:k,children:"Submit"}):null]})}),wS=Nv.div`
2756
2831
  width: 100%;
2757
- `,S9=cv.label`
2832
+ `,bS=Nv.label`
2758
2833
  display: block;
2759
2834
  position: relative;
2760
2835
  width: 100%;
@@ -2812,7 +2887,7 @@ You will have to sign up with another method first to register a passkey for you
2812
2887
  && > input::placeholder {
2813
2888
  color: var(--privy-color-foreground-3);
2814
2889
  }
2815
- `;import{Fragment as x9,jsx as cn,jsxs as A9}from"react/jsx-runtime";var pv=()=>A9(x9,{children:[cn(_,{},"header"),cn(oe,{}),cn(ye,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:cn(P9,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),cn(Sr,{children:cn(dv,{stacked:!0})}),cn(ne,{}),cn($,{})]});import Qp from"styled-components";import{jsx as uv}from"react/jsx-runtime";var mv=({style:e,...t})=>uv("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:uv("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 I9,jsx as Yn,jsxs as Zp}from"react/jsx-runtime";var fv=()=>{let{navigate:e}=S();return Zp(I9,{children:[Yn(_,{}),Zp(k9,{children:[Yn(R9,{children:Yn(mv,{})}),Zp(M9,{children:[Yn("h3",{children:"Unable to sign in"}),Yn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Yn(F,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Yn($,{})]})},k9=Qp.div`
2890
+ `;import{Fragment as SS,jsx as mn,jsxs as _S}from"react/jsx-runtime";var Uv=()=>_S(SS,{children:[mn(A,{},"header"),mn(oe,{}),mn(ye,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:mn(TS,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),mn(Pr,{children:mn(Dv,{stacked:!0})}),mn(ne,{}),mn(z,{})]});import tu from"styled-components";import{jsx as Fv}from"react/jsx-runtime";var Bv=({style:e,...t})=>Fv("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:Fv("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 kS,jsx as Qn,jsxs as eu}from"react/jsx-runtime";var Hv=()=>{let{navigate:e}=_();return eu(kS,{children:[Qn(A,{}),eu(PS,{children:[Qn(AS,{children:Qn(Bv,{})}),eu(xS,{children:[Qn("h3",{children:"Unable to sign in"}),Qn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Qn(B,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Qn(z,{})]})},PS=tu.div`
2816
2891
  display: flex;
2817
2892
  flex-direction: column;
2818
2893
  align-items: center;
@@ -2821,7 +2896,7 @@ You will have to sign up with another method first to register a passkey for you
2821
2896
  width: 100%;
2822
2897
  padding-top: 8px;
2823
2898
  padding-bottom: 32px;
2824
- `,R9=Qp.div`
2899
+ `,AS=tu.div`
2825
2900
  display: flex;
2826
2901
  align-items: center;
2827
2902
  justify-content: center;
@@ -2830,11 +2905,11 @@ You will have to sign up with another method first to register a passkey for you
2830
2905
  color: var(--privy-color-error);
2831
2906
  background-color: var(--privy-color-error-light);
2832
2907
  border-radius: 50%;
2833
- `,M9=Qp.div`
2908
+ `,xS=tu.div`
2834
2909
  display: flex;
2835
2910
  flex-direction: column;
2836
2911
  gap: 8px;
2837
- `;import L9,{createGlobalStyle as O9}from"styled-components";var W9=`
2912
+ `;import IS,{createGlobalStyle as MS}from"styled-components";var RS=`
2838
2913
  *,
2839
2914
  ::before,
2840
2915
  ::after {
@@ -3064,7 +3139,7 @@ You will have to sign up with another method first to register a passkey for you
3064
3139
  [hidden] {
3065
3140
  display: none;
3066
3141
  }
3067
- `,hv=W9;var yv=O9`
3142
+ `,Gv=RS;var Vv=MS`
3068
3143
  :root {
3069
3144
  // Borders
3070
3145
  --privy-border-radius-sm: 6px;
@@ -3099,10 +3174,10 @@ You will have to sign up with another method first to register a passkey for you
3099
3174
  --privy-height-modal-full: 620px;
3100
3175
  --privy-height-modal-compact: 480px;
3101
3176
  };
3102
- `,Jp=L9.div`
3177
+ `,ru=IS.div`
3103
3178
  // css normalize only the privy application to avoid conflicts
3104
3179
  // with consuming application
3105
- ${hv}
3180
+ ${Gv}
3106
3181
 
3107
3182
  // Privy styles
3108
3183
  color: var(--privy-color-foreground-2);
@@ -3153,7 +3228,7 @@ You will have to sign up with another method first to register a passkey for you
3153
3228
  opacity: 1;
3154
3229
  }
3155
3230
  }
3156
- `;import{Dialog as gv,Transition as Xp}from"@headlessui/react";import eu from"react";import os from"styled-components";import{jsx as Qi,jsxs as B9}from"react/jsx-runtime";var vv=({children:e,open:t,onClick:r,...o})=>Qi(Xp,{show:t,as:eu.Fragment,children:B9(gv,{onClose:r,...o,as:D9,children:[Qi(Xp.Child,{as:eu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Qi(N9,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Qi(U9,{children:Qi(Xp.Child,{as:eu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Qi(gv.Panel,{as:F9,children:e})})})]})}),N9=os.div`
3231
+ `;import{Dialog as qv,Transition as ou}from"@headlessui/react";import nu from"react";import ls from"styled-components";import{jsx as Ji,jsxs as DS}from"react/jsx-runtime";var zv=({children:e,open:t,onClick:r,...o})=>Ji(ou,{show:t,as:nu.Fragment,children:DS(qv,{onClose:r,...o,as:OS,children:[Ji(ou.Child,{as:nu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ji(WS,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Ji(LS,{children:Ji(ou.Child,{as:nu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ji(qv.Panel,{as:NS,children:e})})})]})}),WS=ls.div`
3157
3232
  position: fixed;
3158
3233
  inset: 0;
3159
3234
 
@@ -3166,10 +3241,10 @@ You will have to sign up with another method first to register a passkey for you
3166
3241
  backdrop-filter: unset;
3167
3242
  -webkit-backdrop-filter: unset;
3168
3243
  }
3169
- `,D9=os.div`
3244
+ `,OS=ls.div`
3170
3245
  position: relative;
3171
3246
  z-index: 999999;
3172
- `,U9=os.div`
3247
+ `,LS=ls.div`
3173
3248
  position: fixed;
3174
3249
  inset: 0;
3175
3250
  display: flex;
@@ -3177,7 +3252,7 @@ You will have to sign up with another method first to register a passkey for you
3177
3252
  justify-content: center;
3178
3253
  width: 100vw;
3179
3254
  min-height: 100vh;
3180
- `,F9=os.div`
3255
+ `,NS=ls.div`
3181
3256
  // reset some default dialog styles
3182
3257
  padding: 0;
3183
3258
  background: transparent;
@@ -3224,13 +3299,13 @@ You will have to sign up with another method first to register a passkey for you
3224
3299
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3225
3300
  border-radius: var(--privy-border-radius-lg);
3226
3301
  }
3227
- `,Cv=os.div`
3302
+ `,$v=ls.div`
3228
3303
  display: flex;
3229
3304
  flex-direction: column;
3230
3305
  align-items: center;
3231
3306
  justify-content: center;
3232
3307
  height: 100%;
3233
- `;import{Fragment as bv,jsx as it,jsxs as Ev}from"react/jsx-runtime";var q9={["LANDING"]:w1,["CONNECT_OR_CREATE"]:v1,["AWAITING_PASSWORDLESS_CODE"]:Ch,["AWAITING_CONNECTION"]:jh,["AWAITING_CONNECT_ONLY_CONNECTION"]:Qh,["AWAITING_FARCASTER_CONNECTION"]:og,["AWAITING_FARCASTER_SIGNER"]:cg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:v2,["PHANTOM_INTERSTITIAL_SCREEN"]:E2,["LOGIN_FAILED_SCREEN"]:x1,["AWAITING_OAUTH_SCREEN"]:h2,["CROSS_APP_AUTH_SCREEN"]:ty,["ALLOWLIST_REJECTION_SCREEN"]:dh,["ACCOUNT_NOT_FOUND_SCREEN"]:rh,["USER_LIMIT_REACHED_SCREEN"]:fv,["INSTALL_PHANTOM_SCREEN"]:Yg,["LINK_EMAIL_SCREEN"]:b1,["LINK_PHONE_SCREEN"]:E1,["LINK_WALLET_SCREEN"]:T1,["LINK_PASSKEY_SCREEN"]:Cg,["UPDATE_EMAIL_SCREEN"]:pv,["CONNECT_ONLY_LANDING_SCREEN"]:Gh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Vh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:yy,["EMBEDDED_WALLET_CREATED_SCREEN"]:cy,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:sy,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:T2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:L2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:M2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:my,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:tv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:X2,["FUNDING_METHOD_SELECTION_SCREEN"]:Sg,["MOONPAY_PROMPT_SCREEN"]:Fg,["MOONPAY_STATUS_SCREEN"]:Hg,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:Gg,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:mg,["FUNDING_MANUAL_TRANSFER_SCREEN"]:Ag,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Vy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Hy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:W2,["MFA_ENROLLMENT_FLOW_SCREEN"]:H1,["CAPTCHA_SCREEN"]:Th,["ERROR_SCREEN"]:qy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:qg,["AFFIRMATIVE_CONSENT_SCREEN"]:sh,["TELEGRAM_AUTH_SCREEN"]:av},z9=["LANDING","AWAITING_CONNECTION"],Sv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=q(),{headless:n}=Ge(),{ready:i,currentScreen:a}=S(),{status:l,execute:s,reset:c,enabled:m}=be(),f=o&&a&&z9.includes(a)&&!n&&l==="ready";if(wv(()=>{f&&s()},[f]),wv(()=>{!o&&m&&c()},[o,m]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return Ev(bv,{children:[it(_,{}),it(oe,{}),it(Cv,{children:it(mt,{})}),it(ne,{}),it(Z,{})]});if(!a&&e)return it(Gp,{open:e,onClose:t});if(!a)return null;let u=q9[a];return Ev(bv,{children:[it(Dr,{if:!!e,children:it(u,{})}),it(Dr,{if:!e,children:it(Gp,{open:e,onClose:t})})]})},$9=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=V9(null),o=$f(r);return it(j9,{style:{height:o},id:"privy-modal-content",children:it("div",{ref:r,children:it(Sv,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},K9=()=>{let{closePrivyModal:e}=I(),{onUserCloseViaDialogOrKeybindRef:t}=S();return{gracefulClosePrivyModal:H9(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},tu=({open:e})=>{let{app:t}=S(),{gracefulClosePrivyModal:r}=K9(),[o,n]=G9(!1);xd({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?it(Jp,{children:it(_v,{id:"privy-modal-content",children:it(Sv,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):it(vv,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:it(Jp,{children:it($9,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},_v=Tv.div`
3308
+ `;import{Fragment as jv,jsx as at,jsxs as Yv}from"react/jsx-runtime";var HS={["LANDING"]:z1,["CONNECT_OR_CREATE"]:V1,["AWAITING_PASSWORDLESS_CODE"]:Sh,["AWAITING_CONNECTION"]:ey,["AWAITING_CONNECT_ONLY_CONNECTION"]:oy,["AWAITING_FARCASTER_CONNECTION"]:cg,["AWAITING_FARCASTER_SIGNER"]:hg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:V2,["PHANTOM_INTERSTITIAL_SCREEN"]:K2,["LOGIN_FAILED_SCREEN"]:J1,["AWAITING_OAUTH_SCREEN"]:B2,["CROSS_APP_AUTH_SCREEN"]:sy,["ALLOWLIST_REJECTION_SCREEN"]:hh,["ACCOUNT_NOT_FOUND_SCREEN"]:sh,["USER_LIMIT_REACHED_SCREEN"]:Hv,["INSTALL_PHANTOM_SCREEN"]:w1,["LINK_EMAIL_SCREEN"]:$1,["LINK_PHONE_SCREEN"]:K1,["LINK_WALLET_SCREEN"]:j1,["LINK_PASSKEY_SCREEN"]:Fg,["UPDATE_EMAIL_SCREEN"]:Uv,["CONNECT_ONLY_LANDING_SCREEN"]:Yh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:jh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Ey,["EMBEDDED_WALLET_CREATED_SCREEN"]:hy,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:my,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:j2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:iv,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:rv,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Cy,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:xv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Pv,["FUNDING_METHOD_SELECTION_SCREEN"]:Yg,["MOONPAY_PROMPT_SCREEN"]:c1,["MOONPAY_STATUS_SCREEN"]:p1,["COINBASE_ONRAMP_STATUS_SCREEN"]:Ig,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:f1,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:bg,["FUNDING_MANUAL_TRANSFER_SCREEN"]:Xg,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:jy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Ky,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:nv,["MFA_ENROLLMENT_FLOW_SCREEN"]:u2,["CAPTCHA_SCREEN"]:xh,["ERROR_SCREEN"]:Zy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:h1,["AFFIRMATIVE_CONSENT_SCREEN"]:uh,["TELEGRAM_AUTH_SCREEN"]:Wv},GS=["LANDING","AWAITING_CONNECTION"],Qv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=q(),{headless:n}=Ve(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:m}=be(),f=o&&a&&GS.includes(a)&&!n&&l==="ready";if(Kv(()=>{f&&s()},[f]),Kv(()=>{!o&&m&&c()},[o,m]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return Yv(jv,{children:[at(A,{}),at(oe,{}),at($v,{children:at(nt,{})}),at(ne,{}),at(Z,{})]});if(!a&&e)return at(Kp,{open:e,onClose:t});if(!a)return null;let u=HS[a];return Yv(jv,{children:[at(Fr,{if:!!e,children:at(u,{})}),at(Fr,{if:!e,children:at(Kp,{open:e,onClose:t})})]})},VS=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=FS(null),o=Qf(r);return at(zS,{style:{height:o},id:"privy-modal-content",children:at("div",{ref:r,children:at(Qv,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},qS=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:US(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},iu=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=qS(),[o,n]=BS(!1);Od({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?at(ru,{children:at(Jv,{id:"privy-modal-content",children:at(Qv,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):at(zv,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:at(ru,{children:at(VS,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},Jv=Zv.div`
3234
3309
  display: flex;
3235
3310
  flex-direction: column;
3236
3311
  text-align: center;
@@ -3239,7 +3314,7 @@ You will have to sign up with another method first to register a passkey for you
3239
3314
  width: 100%;
3240
3315
  background: var(--privy-color-background);
3241
3316
  padding: 0 16px;
3242
- `,j9=Tv(_v)`
3317
+ `,zS=Zv(Jv)`
3243
3318
  transition: height 150ms ease-out;
3244
3319
  overflow: hidden;
3245
3320
 
@@ -3253,4 +3328,4 @@ You will have to sign up with another method first to register a passkey for you
3253
3328
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3254
3329
  border-radius: var(--privy-border-radius-lg);
3255
3330
  }
3256
- `;import{useRef as Pv,useEffect as Y9}from"react";import{jsx as Q9}from"react/jsx-runtime";function Z9({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 xv(e){let t=Pv(null),r=Pv();return Y9(()=>{r.current?.remove(),r.current=Z9(e),t.current?.after(r.current)},[e]),Q9("div",{ref:t,hidden:!0})}import{useState as J9}from"react";import{useEffect as Av,useRef as kv}from"react";var jc=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 dn(e,t,r,o,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new We("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((u,g)=>{r.current={resolve:u,reject:g};let w=1e3*60*5;setTimeout(()=>{let y=new We("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},w)});return await e(f)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let m=new We("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(m),m}return c}import{jsx as nS}from"react/jsx-runtime";var X9=function(e){return()=>`id-${e++}`}(0);function eS(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function gt(e){return e.error!==void 0}var dt=new jc,ru=new Map,tS=(e,t)=>typeof t=="bigint"?t.toString():t,rS=(e,t)=>`${e}${JSON.stringify(t,tS)}`;function vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=rS(e,t);if(e==="privy:wallet:create"){let l=ru.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=X9();dt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{ru.delete(i)});return ru.set(i,a),a}function oS(e){switch(e.event){case"privy:iframe:ready":let t=dt.dequeue(e.event,e.id);return gt(e)?t.reject(new We(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=dt.dequeue(e.event,e.id);return gt(e)?r.reject(new We(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=dt.dequeue(e.event,e.id);return gt(e)?o.reject(new We(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=dt.dequeue(e.event,e.id);return gt(e)?n.reject(new We(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=dt.dequeue(e.event,e.id);return gt(e)?i.reject(new We(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=dt.dequeue(e.event,e.id);return gt(e)?a.reject(new We(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=dt.dequeue(e.event,e.id);return gt(e)?l.reject(new We(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=dt.dequeue(e.event,e.id);return gt(e)?s.reject(new We(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:submit-enrollment":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:unenroll":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:clear":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:init-signer":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:sign":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:solana-wallet:create":let c=dt.dequeue(e.event,e.id);return gt(e)?c.reject(new We(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let m=dt.dequeue(e.event,e.id);return gt(e)?m.reject(new We(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let f=dt.dequeue(e.event,e.id);return gt(e)?f.reject(new We(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Rv(e){let t=kv(null),r=kv(e.mfaMethods),o=fi(),[n,i]=J9(!1);return Av(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Av(()=>{if(!n)return;let a=t.current;if(!a)return;function l(u){u&&u.origin===e.origin&&eS(u.data)&&oS(u.data)}let s={create(u){return vt("privy:wallet:create",u,a,e.origin)},import(u){return vt("privy:wallet:import",u,a,e.origin)},connect(u){return vt("privy:wallet:connect",u,a,e.origin)},recover(u){return dn(g=>vt("privy:wallet:recover",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!u.recoveryMethod||u.recoveryMethod==="privy")},rpc(u){return dn(g=>vt("privy:wallet:rpc",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(u){return vt("privy:solana-wallet:create",u,a,e.origin)},connectSolana(u){return vt("privy:solana-wallet:connect",u,a,e.origin)},recoverSolana(u){return vt("privy:solana-wallet:recover",u,a,e.origin)},rpcSolana(u){return vt("privy:solana-wallet:rpc",u,a,e.origin)},setRecovery(u){return dn(g=>vt("privy:wallet:set-recovery",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(u){return dn(g=>vt("privy:mfa:verify",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(u){return dn(g=>vt("privy:mfa:init-enrollment",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(u){return dn(g=>vt("privy:mfa:submit-enrollment",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(u){return dn(g=>vt("privy:mfa:unenroll",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(u){return vt("privy:mfa:clear",u,a,e.origin)},initFarcasterSigner(u){return vt("privy:farcaster:init-signer",u,a,e.origin)},signFarcasterMessage(u){return vt("privy:farcaster:sign",u,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),m=(...u)=>{console.warn("Privy iframe failed to load: ",...u),e.onLoadFailed()},f=new AbortController;return ta(()=>vt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,m),()=>{window.removeEventListener("message",l),f.abort()}},[n]),nS("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Ts(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 we();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await Mv())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 Zc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(i=>i.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 Iv({api:e,appId:t}){let r=gn(),o=ti(),n=await ri(r);try{let{url:i}=await e.post(hs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw le(i)}}async function Wv({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(ys,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(i){let a=le(i);throw a.privyErrorCode?new C(a.message||"Invalid code during cross-app auth flow.",void 0,a.privyErrorCode):a.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 Lv({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let a=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",m)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(a),n(new C("User rejected request")))},300);function m(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(a),o(f.data),l()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new C(f.data.error)),l()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=m))}window.addEventListener("message",m)})}var Qc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let a=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(g=>g.address===t)));if(!e||!a)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 l=r.getProviderAccessToken(a.providerApp.id),s=await Zc({api:r.api,requesterAppId:n,providerAppId:a.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await i({appId:a.providerApp.id})&&(l=r.getProviderAccessToken(a.providerApp.id))}if(!l)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,ou({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 m=new URL(`${s.apiUrl}/oauth/transact`);return m.searchParams.set("token",l||""),m.searchParams.set("request",iS(o)),c.location=m.href,new Promise((u,g)=>{let y=setTimeout(()=>{A(),g(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(A(),g(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),P=T=>{T.data&&(T.data.token?.action==="set"&&T.data.token?.value!==void 0?r.storeProviderAccessToken(a.providerApp.id,T.data.token.value):T.data.token?.action==="clear"&&r.storeProviderAccessToken(a.providerApp.id,null),T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(A(),u(T.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),T.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&T.data.error&&(A(),g(T.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:T.data.error,address:t}})))};window.addEventListener("message",P);let A=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",P)}})},iS=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),ou=({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,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=n/window.screen.availWidth,l=i/window.screen.availHeight,s=(n-e)/2/a+r,c=(i-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var aS="https://cdn.apple-cloudkit.com";async function nu({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===aS&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var Ov=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 Nv}from"react/jsx-runtime";var vo;function mS(e){return typeof e=="string"&&e.length===25}function we(){if(!vo){let e=J.get(un);return Promise.resolve(e||null)}return vo.getAccessToken()}var Dv,Fm=(e,t,r)=>Dv(e,t,r),Uv,Bm=(e,t)=>Uv(e,t),Fv,Hm=(e,t)=>Fv(e,t),Bv,Vm=()=>Bv(),Hv,Mv=()=>Hv(),fS=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;J.put(na,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},hS=({config:e,...t})=>{if(!mS(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");vo||(vo=new ha({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(Of,{client:vo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Cr(yS,{...t,client:vo})})},yS=e=>{let t=e.client,[r,o]=at(!1),[n,i]=at(!1),[a,l]=at(!1),[s,c]=at(null),[m,f]=at([]),[u,g]=at(null),w=Ji(m),[y,b]=at(!1),[P,A]=at(null),[T,x]=at(!1),[R,M]=at({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[D,B]=at({status:"initial"}),[K,j]=at(null),[L,N]=at(null),W=Ge(),ve=Xs(),[Me,Y]=at(!0),[te,ee]=at({}),[_e,Te]=at(null),[ze,Ve]=at(null),[pt,Fe]=at(!1),[ae,Ft]=at(!1),Rr=Ji(null),jr=Ji(null),O=Ji(Kf),[rt,Mr]=at(!1);t.onStoreToken=d=>{d&&U(O,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(O,"accessToken","onAccessTokenRemoved")};let V=Ji(null),G=Ji(null),ie=d=>{A(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},ut=d=>{W.embeddedWallets.createOnLogin!=="off"&&Y(!0),ie(d)};Kr(()=>{let d=bn(s);if(!d||!L)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Do,id:"io.privy.solana.wallet"},getProvider:async()=>new Yc(L,d.address)};g(p)},[L,s]),Kr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=he(s),p=$s(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!L){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(L,d.address,W.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(L,p.address,W.defaultChain,e.appId)},[L,s]),Kr(()=>{L&&ze?.(L)},[L]),Kr(()=>{(async()=>{if(!W.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:h}=W.customAuth;if(!(!n||h))try{let v=await p();if(!v&&a){await Zn.logout();return}if(!v||a)return;t.startAuthFlow(new Jn(v));let{user:k,isNewUser:H}=await t.authenticate();if(!k){await Zn.logout();return}c(k||null),b(H||!1),l(!0),Ft(!0)}catch(v){console.warn(v),a&&await Zn.logout()}})()},[W.customAuth?.enabled,W.customAuth?.getCustomAccessToken,W.customAuth?.isLoading,n,a]),Kr(()=>{ae&&L&&s&&Gt(s,W.embeddedWallets.createOnLogin)&&(Ft(!1),su(s,ei).catch(console.error))},[ae&&L&&s]),Kr(()=>{async function d(){let p=Xi(),h=ns();fS();let v=sS();t.initializeConnectorManager({walletConnectCloudProjectId:W.walletConnectCloudProjectId,rpcConfig:W.rpcConfig,chains:W.chains,defaultChain:W.defaultChain,store:v,walletList:W.appearance.walletList,shouldEnforceDefaultChainOnConnect:W.shouldEnforceDefaultChainOnConnect,externalWalletConfig:W.externalWallets,appName:W.name??"Privy"});let k;t.connectors?.on("connectorInitialized",()=>{k&&clearTimeout(k);let Ce=t.connectors.walletConnectors.length,re=t.connectors.walletConnectors.reduce((Ye,Pe)=>Ye+(Pe.initialized?1:0),0);re===Ce?Mr(!0):k=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:re,expected:Ce}),Mr(!0)},1500)}),t.connectors?.initialize().then(()=>{jv()});let H=await t.getAuthenticatedUser(),z=!!H;if(W.customAuth?.enabled||(l(!!H),H&&U(O,"login","onComplete",H,!1,!0,null,null),c(H)),p){G.current=z?"link":"login";return}if(h&&!z){G.current="login",ut("TELEGRAM_AUTH_SCREEN");return}se.setReadyToTrue(!!H)}!n&&ve&&d()},[t,_e,n,ve]),Kr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){Fe(!0);return}let p=!!m.find(h=>h.walletClientType==="privy");Fe(p)},[n,s,m]);let Xi=()=>{let d=ca();if(d.inProgress&&d.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(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function h(v){return v.startsWith(p)}return d.inProgress&&h(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Zr(d)),ut("AWAITING_OAUTH_SCREEN"),!0)},ns=()=>{let d=Nm();if(!d||!W.loginMethods.telegram||!W.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new oi;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},Kv=async(d,p,h,v)=>{let k=await t.connectors?.createWalletConnector(d,p)||null;Jc(k,p,h,v)};async function Jc(d,p,h,v){if(d)M({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new ce("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,h);d instanceof Lr&&p&&await d.resetConnection(p),M({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Jc(d,p,h,v)});try{let k=await d.connect({showPrompt:!0});if(W.shouldEnforceDefaultChainOnConnect&&!W.chains.find(H=>H.id===Number(k?.chainId.replace("eip155:","")))&&!(k?.connectorType==="wallet_connect_v2"&&k?.walletClientType==="metamask")){M(H=>({...H,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await k?.switchChain(W.defaultChain.id),k&&(k.chainId=Xn(pn(W.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${W.defaultChain.id}`)}}return M(H=>({...H,status:"connected",connectedWallet:k,connectError:null,connectRetry:E})),k&&U(O,"connectWallet","onSuccess",k),v?.(k,h)}catch(k){return k instanceof et?(console.warn(k.cause?k.cause:k.message),U(O,"connectWallet","onError",k.privyErrorCode||"generic_connect_wallet_error")):(console.warn(k),U(O,"connectWallet","onError","unknown_connect_wallet_error")),M(H=>({...H,status:"disconnected",connectedWallet:null,connectError:k})),v?.(null,h)}}let is=async(d,p)=>{if(d===null)return;let h=new bo(d,t,p);t.startAuthFlow(h)},jv=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!Lo()&&ut("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");ie("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),Kv(p,h,void 0,is)};Kr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let st=d=>{if(!a)throw U(O,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new C("User must be authenticated before linking an account.")},au=()=>{st("siwe"),V.current="siwe",G.current="link",ie("LINK_WALLET_SCREEN")},Yv=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},Zv=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(M(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),W.captchaEnabled&&!a){let h={callback:v=>is(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:h}),ut("CAPTCHA_SCREEN")}else await is(d),ut("AWAITING_CONNECTION")},Qv=async(d,p)=>{let{signedUrl:h,externalTransactionId:v}=await Dg(t,d,p??{},W.appearance.palette,W.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:h,externalTransactionId:v}},as=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:Yv(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");Zv(h)},fund:async v=>{await se.fundWallet(h.address,v)},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(h.address);c(v)}}))||[];return Ks(d,p)?d:p})};Kr(()=>{as()},[s?.linkedAccounts,a,n]),Kr(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");as(),t.connectors.on("walletsUpdated",as)}},[n]);let Jv=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Io(d.suggestedAddress);j(p)}ie(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Kr(()=>{if(!m[0])return;let d=m[0],p=w.current.find(v=>v.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&h){let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}w.current=m},[m]);let su=async(d,p)=>{if(he(d))throw U(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,k]=await Promise.all([se.initializeWalletProxy(p),we()]);if(!v&&W.customAuth?.enabled)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!k||W.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((H,z)=>{Y(!0),ee({createWallet:{onSuccess:re=>{U(O,"createWallet","onSuccess",re),H(re)},onFailure:re=>{U(O,"createWallet","onError","unknown_embedded_wallet_error"),z(re)},callAuthOnSuccessOnClose:!1}}),ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:k});let H=await se.refreshUser(),z=he(H);if(!z)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(O,"createWallet","onSuccess",z),z}},Xv=d=>{if(!W.chains.map(p=>p.id).includes(d))throw new ce(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},lu=(d,p,h)=>new Promise(async(v,k)=>{let{requesterAppId:H}=p||{};if(!a||!s){U(O,"sendTransaction","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=d.from,Ce=z?s?.linkedAccounts.find(Ze=>Ze.type==="wallet"&&Ze.walletClientType==="privy"&&Io(Ze.address)===Io(z)):he(s);if(!Ce){U(O,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}Y(!0);let re=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ye=d.chainId?Number(d.chainId):re.chainId;Xv(Ye);let Pe=Object.assign({},d,{chainId:Ye}),Ht=async()=>{let Ze=await we();if(!Ze||!L){U(O,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await se.recoverEmbeddedEthereumWallet()){U(O,"sendTransaction","onError","unknown_connect_wallet_error"),k(new Error("Unable to connect to wallet"));return}let Qn=rr(Pe.chainId,W.chains,W.rpcConfig,{appId:e.appId}),Yr=await uS(Ce.address,Pe,Qn);if(W.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:r3}=await pS(Yr,Qn),{hasSufficientFunds:o3}=await Fi(Ce.address,Yr,r3,Qn);if(!o3)throw new Ct(new Er("Wallet has insufficient funds for this transaction.",dS.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let mu=await zl(Ze,Ce.address,L,Yr,Qn,H);U(O,"sendTransaction","onSuccess",mu),v(mu)}catch(ls){U(O,"sendTransaction","onError","transaction_failure"),k(ls)}};if(W.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ht();else{let Ze={transactionRequest:Pe,onSuccess:Yr=>{U(O,"sendTransaction","onSuccess",Yr),v(Yr)},onFailure:Yr=>{U(O,"sendTransaction","onError","transaction_failure"),k(Yr)},uiOptions:p||{},fundWalletConfig:h,requesterAppId:H},ls={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Yr=>{U(O,"sendTransaction","onError","unknown_connect_wallet_error"),k(Yr)}},Qn=pu({address:Ce.address,fundWalletConfig:h,chainIdOverride:Pe.chainId,comingFromSendTransactionScreen:!0});ee({connectWallet:ls,sendTransaction:Ze,funding:Qn}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function cu(){return new Promise(async(d,p)=>{let h=await we();if(!h||!L)throw new Error("Must have valid access token to enroll in MFA");try{await L.verifyMfa({accessToken:h}),d()}catch(v){p(v)}})}let du=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,h)=>h.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],Bt=d=>{let p=s?.linkedAccounts.filter(k=>k.type===d).length??0,{displayName:h,loginMethod:v}=Xo(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw U(O,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:v}),new C(`User already has an account of type ${h} linked.`)},e3=()=>{if(!W.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.")},pu=({address:d,fundWalletConfig:p,methodScreen:h,chainIdOverride:v=null,comingFromSendTransactionScreen:k=!1})=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)return;let H=ic(p)&&p.amount?p.amount:W.fundingConfig.defaultRecommendedAmount,z=ic(p)&&p.chain?p.chain.id:Bi(W.fundingConfig.defaultRecommendedCurrency.chain),Ce=ic(p)&&p.chain?p.chain:W.chains.find(re=>re.id===z);if(v&&W.chains.find(re=>re.id===v)&&(Ce=W.chains.find(re=>re.id===v)),!Ce)throw new C("Funding chain is not in PrivyProvider chains list");return{address:d,amount:H,chain:Ce,methodScreen:h,comingFromSendTransactionScreen:k,...Ng(p)?{moonpayConfigOverride:p.config}:{}}};async function uu({legacySetWalletPasswordFlow:d=!1}){A(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw U(O,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=he(s);if(!h||!L)throw U(O,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(bn(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await cu()}catch(k){throw U(O,p,"onError","missing_or_invalid_mfa"),k}return new Promise((k,H)=>{Y(!0);let z={onSuccess:Pe=>{U(O,p,"onSuccess","user-passcode",Pe),k(Pe)},onFailure:Pe=>{U(O,p,"onError","user_exited_set_password_flow"),H(Pe)},callAuthOnSuccessOnClose:!1},Ce=h.recoveryMethod==="user-passcode",Ye={onCompleteNavigateTo:kl({walletAction:"update",availableRecoveryMethods:W.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:Ce}),shouldForceMFA:!1,onFailure:Pe=>{U(O,p,"onError","unknown_connect_wallet_error"),H(Pe)}};ee({setWalletPassword:z,createWallet:z,connectWallet:Ye,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Ce}}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function ss({appId:d}){st(`privy:${d}`),V.current=`privy:${d}`,G.current="link";let p=window.open(void 0,void 0,ou({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(h,v)=>{let{name:k,logoUrl:H}=await Zc({api:t.api,providerAppId:d,requesterAppId:W.id});ee({crossAppAuth:{appId:d,name:k,logoUrl:H,popup:p,onSuccess:h,onError:v}}),ut("CROSS_APP_AUTH_SCREEN")})}let Zn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Jv,importWallet:async({privateKey:d})=>{st("siwe");let[p,h]=await Promise.all([se.initializeWalletProxy(15e3),we()]);if(p&&h){await p.import({privateKey:d,accessToken:h});let v=await se.refreshUser(),k=$s(v);if(!k)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(O,"createWallet","onSuccess",k),k}else throw new C("User is not authenticated")},linkWallet:au,linkCrossAppAccount:ss,linkEmail:()=>{st("email"),Bt("email"),V.current="email",G.current="link",ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{st("sms"),Bt("phone"),V.current="sms",G.current="link",ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{st("google"),Bt("google_oauth"),G.current="link",await se.initLoginWithOAuth("google")},linkTwitter:async()=>{st("twitter"),Bt("twitter_oauth"),G.current="link",await se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{st("discord"),Bt("discord_oauth"),G.current="link",await se.initLoginWithOAuth("discord")},linkGithub:async()=>{st("github"),Bt("github_oauth"),G.current="link",await se.initLoginWithOAuth("github")},linkSpotify:async()=>{st("spotify"),Bt("spotify_oauth"),G.current="link",await se.initLoginWithOAuth("spotify")},linkInstagram:async()=>{st("instagram"),Bt("instagram_oauth"),G.current="link",await se.initLoginWithOAuth("instagram")},linkTiktok:async()=>{st("tiktok"),Bt("tiktok_oauth"),G.current="link",await se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{st("linkedin"),Bt("linkedin_oauth"),G.current="link",await se.initLoginWithOAuth("linkedin")},linkApple:async()=>{st("apple"),Bt("apple_oauth"),G.current="link",await se.initLoginWithOAuth("apple")},linkPasskey:async()=>{st("passkey"),Bt("passkey"),await se.initLinkWithPasskey(),ie("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{st("telegram"),Bt("telegram"),e3(),G.current="link",V.current="telegram",await se.initLoginWithTelegram(),ie("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{st("farcaster"),Bt("farcaster"),await se.initLoginWithFarcaster(),G.current="link",V.current="farcaster",ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(st("email"),!s?.email)throw new C("User does not have an email linked to their account.");G.current="link",V.current="email",ie("UPDATE_EMAIL_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let h=await new Promise(v=>{Te(k=>v.bind(k))});if(Te(null),h){console.warn(p);return}}if(a){console.warn(p);return}G.current="login",ee({login:d}),ut("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(m[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}ut("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),A(null),await t.logout(),s&&L)try{await L.clearMfa({userId:s.id})}catch{}c(null),l(!1),U(O,"logout","onSuccess"),G.current=null,V.current=null,o(!1),J.del(ia)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new $e;let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new $e:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new iu(new Qr(new $e));let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new iu(new Qr(new $e)):new iu(new Qr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new No(new $e);let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new No(new $e):new No(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===d)?.providerApp;if(!p)throw new C("Invalid subject");t.storeProviderAccessToken(p.id,null);let h=await t.unlinkOAuth(`privy:${p.id}`,d);return c(h),h},setActiveWallet:async d=>{let p=m.find(v=>Io(v.address)===Io(d)),h=s?.linkedAccounts.find(v=>v.type==="wallet"&&Io(v.address)===Io(d));if(!p||!await p.isConnected())j(d),au();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return su(s,15e3)},setWalletRecovery:async()=>uu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>uu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,h)=>new Promise(async(v,k)=>{let{requesterAppId:H}=p||{};if(!a||!s){U(O,"signMessage","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=h?s?.linkedAccounts.find(re=>re.type==="wallet"&&re.walletClientType==="privy"&&Io(re.address)===Io(h)):he(s);if(!z){U(O,"signMessage","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(O,"signMessage","onError","invalid_message"),k(new Error("Message must be a non-empty string"));return}Y(!0);let Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!L||!re)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:z.address,requesterAppId:H}});let{response:Pe}=await L.rpc({accessToken:re,address:z.address,requesterAppId:H,request:{method:"personal_sign",params:[d,z.address]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:z.address,requesterAppId:H}}),Ht};if(W.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();U(O,"signMessage","onSuccess",re),v(re)}catch(re){U(O,"signMessage","onError","unable_to_sign"),k(re??new Ct("Unable to sign message"))}}else{let Pe={method:"personal_sign",data:d,confirmAndSign:Ce,onSuccess:Ze=>{U(O,"signMessage","onSuccess",Ze),v(Ze)},onFailure:Ze=>{U(O,"signMessage","onError","unable_to_sign"),k(Ze)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ze=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),k(Ze)},address:z.address};ee({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,v)=>{let{requesterAppId:k}=p||{};if(!a||!s){U(O,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let H=he(s);if(!H){U(O,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Y(!0);let z=ra(d),Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!L||!re)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:H.address,requesterAppId:k}});let{response:Pe}=await L.rpc({accessToken:re,address:H.address,requesterAppId:k,request:{method:"eth_signTypedData_v4",params:[H.address,z]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:H.address,requesterAppId:k}}),Ht};if(W.embeddedWallets.noPromptOnSignature||(W.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();U(O,"signTypedData","onSuccess",re),h(re)}catch(re){U(O,"signTypedData","onError","unable_to_sign"),v(re??new Ct("Unable to sign message"))}}else{let Pe={method:"eth_signTypedData_v4",data:z,confirmAndSign:Ce,onSuccess:Ze=>{U(O,"signTypedData","onSuccess",Ze),h(Ze)},onFailure:Ze=>{U(O,"signTypedData","onError","unable_to_sign"),v(Ze)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ze=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),v(Ze)}};ee({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let k=await(await lu(d,p,h)).wait();return $l(k)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!he(s)){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ee(te),!await we()||!L){p(new Error("Must have valid access token to enroll in MFA"));return}if(!L){p(new Error("Must have a Privy wallet before exporting"));return}let H={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:H,connectWallet:v}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:cu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new C("Invalid MFA code");Rr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((H,z)=>{jr.current={resolve:H,reject:z}});break;case"passkey":if(typeof p=="string")throw new C("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),k=Ov(v);Rr.current?.resolve({mfaMethod:d,mfaCode:k,relyingParty:window.origin}),await new Promise((H,z)=>{jr.current={resolve:H,reject:z}});break;default:throw Rr.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${d}`)}},cancel(){Rr.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){se.closePrivyModal(),p();return}W.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."),ee({mfaEnrollmentFlow:{mfaMethods:W.mfa.methods,onSuccess:p,onFailure:h}}),ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await we();if(!d||!L)throw new Error("Must have valid access token to enroll in MFA");let p=await L.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await L.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await we(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await L.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}ee({farcasterSigner:v}),ie("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await we(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(k=>Uint8Array.from(k.match(/.{1,2}/g).map(H=>parseInt(H,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await we(),h=s?.linkedAccounts.find(z=>z.type==="wallet"&&z.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let k=await import("@simplewebauthn/browser"),H=await L.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:k.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(k.base64URLStringToBuffer(H.signature))},isHeadlessOAuthLoading:T,loginWithCode(d){return se.loginWithCode(d)},initLoginWithEmail(d){return se.initLoginWithEmail(d)},initLoginWithSms(d){return se.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return se.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return se.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return se.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return se.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k}){return st("siwe"),se.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k})},signMessageWithCrossAppWallet(d,{address:p}){return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"personal_sign",params:[d,p]},reconnect:ss})},signTypedDataWithCrossAppWallet(d,{address:p}){let h=ra(d);return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_signTypedData_v4",params:[p,h]},reconnect:ss})},sendTransactionWithCrossAppWallet(d,{address:p}){return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:ss})},isModalOpen:r,mfaMethods:W.mfa.methods};Dv=Zn.signMessage,Uv=Zn.signTypedData,Fv=async(...d)=>{let p=await lu(...d);return W.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let se=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:K,pendingTransaction:null,walletConnectionStatus:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:W.rpcConfig,chains:W.chains,appId:e.appId,showFiatPrices:W.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>W.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(L)return L;let p=new Promise(k=>{Ve(()=>H=>k(H))}),h=new Promise(k=>setTimeout(()=>k(null),d)),v=await Promise.race([p,h]);return Ve(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;p&&V.current&&(h=du(s)),G.current==="login"?d.shouldCallAuthOnSuccess&&p&&V.current?(U(O,"login","onComplete",s,y,!1,V.current,h??null),e.onSuccess?.(s,y)):U(O,"login","onError","exited_auth_flow"):G.current==="link"&&h&&(d.isSuccess&&p&&V.current?U(O,"linkAccount","onSuccess",s,V.current,h):V.current&&U(O,"linkAccount","onError","exited_link_flow",{linkMethod:V.current})),j(null),G.current=null,V.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ie,connectWallet:Jc,initLoginWithWallet:async(d,p)=>{V.current="siwe",is(d,p)},loginWithWallet:async()=>{if(!n)throw new Co;if(!(t.authFlow instanceof bo))throw new C("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),V.current="siwe"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="siwe"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new oa(d);t.startAuthFlow(p);try{V.current="farcaster",await p.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 Co;if(!(t.authFlow instanceof oa))throw new C("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),V.current="farcaster"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="farcaster"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let h=`privy:${d}`;V.current=h;let{url:v,stateCode:k,codeVerifier:H}=await Iv({api:t.api,appId:d});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new C("No authorization URL returned for cross-app auth.");try{let z=await Lv({url:v,popup:p,provider:h}),Ce=z.stateCode,re=z.authorizationCode;if(Ce!==k)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:k??"",returnedStateCode:Ce??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ye=await Wv({api:vo.api,appId:d,codeVerifier:H,stateCode:Ce,authorizationCode:re});Ye&&t.storeProviderAccessToken(d,Ye);let Pe=await se.refreshUser();if(!Pe)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),Pe}catch(z){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:z.toString(),provider:h}}),z}},async initLoginWithOAuth(d,p){if(V.current=d,rd()){if(d==="google"&&_i(window.navigator.userAgent)){ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),J.del(hn);let h=new Zr({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(d==="twitter"&&cS&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(d){if(!n)throw new Co;V.current="telegram";let p=new oi(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((h,v)=>{if(!W.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:W.loginConfig.telegramAuthConfiguration.botId,request_access:!0},k=>k?h(k):v(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof oi))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),V.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();d=h.user,p=h.isNewUser,V.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(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,h){let v,k;function H(z){if(!z)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new C("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:z,codeVerifier:Ce,stateCode:re}=await Qd({api:vo.api,provider:d});H(z);let Ye,Pe;try{let Ht=await nu({url:z,popup:h,provider:d});if(Ye=Ht.stateCode,Pe=Ht.authorizationCode,Ye!==re)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:re??"",returnedStateCode:Ye??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Ht){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ht.toString(),provider:d}}),new C("Recovery OAuth failed")}[v,k]=await Promise.all([we(),ny({api:vo.api,provider:d,codeVerifier:Ce,stateCode:Ye,authorizationCode:Pe})]);break}case"icloud":{let{url:z}=await Qd({api:vo.api,provider:d});H(z);let{ckWebAuthToken:Ce}=await nu({url:z,popup:h,provider:d});k=Ce,v=await we();break}}if(!L)throw new C("Cannot connect to wallet proxy");if(!v)throw new C("Unable to authorize user");switch(p){case"recover":let z=te.recoverWallet?.privyWallet?.address;if(!z)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:z,recoveryMethod:d}}),await L.recover({address:z,accessToken:v,recoveryAccessToken:k,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:z,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await L.create({accessToken:v,recoveryAccessToken:k,recoveryMethod:d});let Ce=await se.refreshUser(),re=he(Ce);if(!re)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:re.address}}),U(O,"createWallet","onSuccess",re);break;case"set-recovery":let Ye=he(s);if(!Ye)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:d}}),await L.setRecovery({address:Ye.address,accessToken:v,recoveryAccessToken:k,recoveryMethod:d});let Pe=he(await se.refreshUser());if(!Pe)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:Ye.address,recoveryMethod:d}}),U(O,"setWalletRecovery","onSuccess",d,Pe);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Zr))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=J.get(mn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,k,H;if(a)try{let z=await t.link();v=z.user,H=z.oAuthTokens,V.current=d}catch(z){throw U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:d}),z}else try{let z=await t.authenticate();v=z.user,k=z.isNewUser,H=z.oAuthTokens,V.current=d}catch(z){throw G.current==="login"?U(O,"login","onError",z.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:d}),z}return c(v),b(k||!1),l(!0),H&&v&&U(O,"oAuthAuthorization","onOAuthTokenGrant",H,{user:v}),H},async initLoginWithPasskey(d){let p=new Cn(d);t.startAuthFlow(p),G.current="login";try{V.current="passkey",await p.initAuthenticationFlow()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new Co;if(!(t.authFlow instanceof Cn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d,p;try{V.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Cn(d);t.startAuthFlow(p),G.current="link",V.current="passkey";try{await p.initLinkFlow()}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new Co;if(!(t.authFlow instanceof Cn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d;try{V.current="passkey",{user:d}=await t.link()}catch(p){throw U(O,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(rd()){if(d==="google"&&_i(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 Zr({provider:d,headless:!0});p&&h.addCaptchaToken(p);let v=await t.startAuthFlow(h).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){x(!0),t.startAuthFlow(new Zr(d));let p=J.get(mn),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),x(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,k;if(a)try{({user:v}=await t.link()),V.current=d.provider}catch(H){throw U(O,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),H}else try{({user:v,isNewUser:k}=await t.authenticate()),V.current=d.provider}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:d.provider}),H}return c(v),b(k||!1),l(!0),x(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let h=new Wo(d,p);t.startAuthFlow(h);try{V.current="email",await h.sendCodeEmail()}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:"email"}),v}},initUpdateEmail:async(d,p,h)=>{let v=new vs(d,p,h);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{B({status:"sending-code"});let h=new wn(d,p);t.startAuthFlow(h);try{V.current="sms",await h.sendSmsCode(),B({status:"awaiting-code-input"})}catch(v){throw B({status:"error",error:v}),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:"sms"}),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(B({status:"submitting-code"}),!n){let v=new Co;throw B({status:"error",error:v}),v}if(t.authFlow instanceof Wo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof wn)t.authFlow.meta.smsCode=d.trim();else{let v=new C("Must initialize a passwordless code flow first");throw B({status:"error",error:v}),v}await we();let p,h;if(G.current==="link")try{({user:p}=await t.link())}catch(v){throw B({status:"error",error:v}),U(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:V.current}),v}else try{({user:p,isNewUser:h}=await t.authenticate())}catch(v){throw B({status:"error",error:v}),U(O,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),b(h||!1),l(!0),B({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:h})=>{G.current="link",V.current="siwe";let v=await t.generateSiweNonce({address:d,captchaToken:h}),k=p.replace("eip155:","");return zs({address:d,chainId:k,nonce:v})},linkWithSiwe:async({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k})=>{let H;try{if(G.current!=="link"||V.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");H=await t.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k});let z=du(H);z&&U(O,"linkAccount","onSuccess",H,"siwe",z)}catch(z){throw U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),G.current=null,V.current=null,z}c(H||s||null),G.current=null,V.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:L,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let h=he(s)||$s(s),v=await we();if(!v||!L||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await L.connect({accessToken:v,address:h.address}),d(!0)}catch(k){if(In(k)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await L.recover({address:h.address,accessToken:v,recoveryMethod:h.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(In(k)&&h.recoveryMethod!=="privy"){ee({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let H=Rl(h.recoveryMethod);ie(H)}else p(k)}}),embeddedSolanaWallet:u,createEmbeddedSolanaWallet:async()=>{Y(!0);let d=await we(),p=bn(s),h=he(s);if(!s||!d)throw new C("User must be logged in to create a Solana wallet");if(p)throw new C("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await se.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 se.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:d,ethereumAddress:h?.address});let k=await se.refreshUser(),H=bn(k);if(!H)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:H.address}}),H}catch(k){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",k)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let h=bn(s),v=await we();if(!v||!L||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await L.connectSolana({accessToken:v,publicKey:h.address}),d(!0)}catch(k){In(k)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await L.recoverSolana({publicKey:h.address,accessToken:v})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0)):p(k)}}),getMoonpaySignedUrl:Qv,setReadyToTrue:d=>{i(!0),_e?.(d)},updateWallets:()=>as(),fundWallet:async(d,p)=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let h=Gc({fundingMethods:W.fundingConfig.methods});ee({funding:pu({address:d,fundWalletConfig:p,methodScreen:h})}),ie(h)},requestFarcasterSignerStatus:async d=>{let p=await we(),h=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}return v}}))();Bv=se.recoverEmbeddedEthereumWallet,Hv=se.recoverEmbeddedSolanaWallet;let t3=lS(()=>({wallets:m,ready:pt&&rt}),[m,pt,rt]);return Cr(Se.Provider,{value:Zn,children:Cr(Pd.Provider,{value:O,children:Cr(fp.Provider,{value:t3,children:Cr(qf,{...W,children:Nv(_d.Provider,{value:se,children:[Cr(Fh,{children:Nv(Df,{data:te,setModalData:ee,setInitialScreen:A,initialScreen:P,authenticated:a,open:r,children:[e.children,!W.headless&&W.captchaEnabled&&n&&!a&&Cr(Sd,{delayedExecution:!1}),Cr(yv,{theme:{...W.appearance.palette||{}}}),!W.render.standalone&&Cr(tu,{open:r})]})}),Me&&ve?Cr(Rv,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Rr,mfaSubmitPromise:jr,onLoad:N,onLoadFailed:()=>null}):null,W.loginMethods.telegram&&W.loginConfig.telegramAuthConfiguration&&Cr(Dr,{if:!0,children:Cr(xv,{scriptHost:e.apiUrl||xs,botUsername:W.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as gS}from"react";function vS(e){let{login:t}=gS(Se);return ke("login",e),{login:t}}import{useContext as CS}from"react";function wS(e){let{logout:t}=CS(Se);return ke("logout",e),{logout:t}}import{useCallback as Vv,useEffect as bS}from"react";function ES(){let e=be(),t=Xs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=q(),l=Vv(async c=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=Vv(async()=>{let c=ca();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;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(m){throw m}finally{vn()}},[o]);return bS(()=>{let c=ca();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Gv}from"react";var TS=()=>{let e=be(),{initLoginWithEmail:t,loginWithCode:r}=q(),o=Gv(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=Gv(async({code:i})=>{if(e.enabled&&e.status==="error")throw new nr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as qv}from"react";var SS=()=>{let e=be(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=q(),n=qv(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=qv(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useCallback as zv}from"react";var _S=()=>{let e=be(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=zv(async({address:i,chainId:a})=>{if(!i||!a)throw new Error("wallet address and chainId required to generate nonce");return t({address:i,chainId:a}).then(l=>l)},[t]),n=zv(async({signature:i,message:a,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r({message:a,signature:i,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as PS}from"react";function xS(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkTelegram:g,linkFarcaster:w}=PS(Se);return ke("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkFarcaster:w,linkTelegram:g}}import{useContext as AS}from"react";function kS(e){let{connectWallet:t}=AS(Se);return ke("connectWallet",e),{connectWallet:t}}import{useContext as RS}from"react";function MS(e){let{createWallet:t}=RS(Se);return ke("createWallet",e),{createWallet:t}}var IS=()=>{let{fundWallet:e}=q();return{fundWallet:e}};var WS=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=I();return{createWallet:t,wallets:e?[e]:[]}};var LS=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as OS}from"react";function NS(e){let{sendTransaction:t}=OS(Se);return ke("sendTransaction",e),{sendTransaction:t}}import{useContext as DS}from"react";function US(e){let{setWalletPassword:t}=DS(Se);return ke("setWalletPassword",e),{setWalletPassword:t}}import{useContext as FS}from"react";function BS(e){let{setWalletRecovery:t}=FS(Se);return ke("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as HS}from"react";function VS(e){let{signMessage:t}=HS(Se);return ke("signMessage",e),{signMessage:t}}import{useContext as GS}from"react";function qS(e){let{signTypedData:t}=GS(Se);return ke("signTypedData",e),{signTypedData:t}}import{useContext as zS}from"react";var $S=()=>{let{isModalOpen:e}=zS(Se);return{isOpen:e}};import{useContext as KS}from"react";function jS(e){let{getAccessToken:t}=KS(Se);return ke("accessToken",e),{getAccessToken:t}}function YS(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=I(),n=fi();return ke("oAuthAuthorization",e),{reauthorize:i=>ZS(t,r,o,n,i.provider)}}var ZS=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(a=>a.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var QS=$v;function $v(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function JS(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function XS(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Qr as AsExternalProvider,Sd as Captcha,fa as ConnectorManager,tu as LoginModal,ha as PrivyClient,hS as PrivyProvider,$e as PrivyProxyProvider,ua as SUPPORTED_CHAINS,sd as VERSION,zt as WalletConnector,JS as addRpcUrlOverrideToChain,Yd as errorIndicatesMaxMfaRetries,Wn as errorIndicatesMfaTimeout,Ln as errorIndicatesMfaVerificationFailed,we as getAccessToken,XS as getEmbeddedConnectedWallet,kS as useConnectWallet,MS as useCreateWallet,LS as useCrossAppAccounts,QS as useExperimentalFarcasterSigner,$v as useFarcasterSigner,IS as useFundWallet,xS as useLinkAccount,_S as useLinkWithSiwe,vS as useLogin,TS as useLoginWithEmail,ES as useLoginWithOAuth,SS as useLoginWithSms,wS as useLogout,Va as useMfa,qr as useMfaEnrollment,$S as useModalStatus,YS as useOAuthTokens,q as usePrivy,xd as useRegisterMfaListener,NS as useSendTransaction,US as useSetWalletPassword,BS as useSetWalletRecovery,VS as useSignMessage,qS as useSignTypedData,WS as useSolanaWallets,jS as useToken,Gr as useWallets};
3331
+ `;import{useRef as Xv,useEffect as $S}from"react";import{jsx as jS}from"react/jsx-runtime";function KS({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 eC(e){let t=Xv(null),r=Xv();return $S(()=>{r.current?.remove(),r.current=KS(e),t.current?.after(r.current)},[e]),jS("div",{ref:t,hidden:!0})}import{useState as YS}from"react";import{useEffect as tC,useRef as rC}from"react";var td=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 fn(e,t,r,o,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new We("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((u,v)=>{r.current={resolve:u,reject:v};let g=1e3*60*5;setTimeout(()=>{let y=new We("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),v(y)},g)});return await e(f)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let m=new We("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(m),m}return c}import{jsx as t_}from"react/jsx-runtime";var ZS=function(e){return()=>`id-${e++}`}(0);function QS(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function gt(e){return e.error!==void 0}var pt=new td,au=new Map,JS=(e,t)=>typeof t=="bigint"?t.toString():t,XS=(e,t)=>`${e}${JSON.stringify(t,JS)}`;function vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=XS(e,t);if(e==="privy:wallet:create"){let l=au.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=ZS();pt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{au.delete(i)});return au.set(i,a),a}function e_(e){switch(e.event){case"privy:iframe:ready":let t=pt.dequeue(e.event,e.id);return gt(e)?t.reject(new We(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=pt.dequeue(e.event,e.id);return gt(e)?r.reject(new We(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=pt.dequeue(e.event,e.id);return gt(e)?o.reject(new We(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=pt.dequeue(e.event,e.id);return gt(e)?n.reject(new We(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=pt.dequeue(e.event,e.id);return gt(e)?i.reject(new We(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=pt.dequeue(e.event,e.id);return gt(e)?a.reject(new We(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=pt.dequeue(e.event,e.id);return gt(e)?l.reject(new We(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=pt.dequeue(e.event,e.id);return gt(e)?s.reject(new We(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:submit-enrollment":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:unenroll":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:clear":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:init-signer":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:sign":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:solana-wallet:create":let c=pt.dequeue(e.event,e.id);return gt(e)?c.reject(new We(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let m=pt.dequeue(e.event,e.id);return gt(e)?m.reject(new We(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let f=pt.dequeue(e.event,e.id);return gt(e)?f.reject(new We(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let u=pt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function oC(e){let t=rC(null),r=rC(e.mfaMethods),o=hi(),[n,i]=YS(!1);return tC(()=>{r.current=e.mfaMethods},[e.mfaMethods]),tC(()=>{if(!n)return;let a=t.current;if(!a)return;function l(u){u&&u.origin===e.origin&&QS(u.data)&&e_(u.data)}let s={create(u){return vt("privy:wallet:create",u,a,e.origin)},import(u){return vt("privy:wallet:import",u,a,e.origin)},connect(u){return vt("privy:wallet:connect",u,a,e.origin)},recover(u){return fn(v=>vt("privy:wallet:recover",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!u.recoveryMethod||u.recoveryMethod==="privy")},rpc(u){return fn(v=>vt("privy:wallet:rpc",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(u){return vt("privy:solana-wallet:create",u,a,e.origin)},connectSolana(u){return vt("privy:solana-wallet:connect",u,a,e.origin)},recoverSolana(u){return vt("privy:solana-wallet:recover",u,a,e.origin)},rpcSolana(u){return vt("privy:solana-wallet:rpc",u,a,e.origin)},setRecovery(u){return fn(v=>vt("privy:wallet:set-recovery",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(u){return fn(v=>vt("privy:mfa:verify",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(u){return fn(v=>vt("privy:mfa:init-enrollment",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(u){return fn(v=>vt("privy:mfa:submit-enrollment",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(u){return fn(v=>vt("privy:mfa:unenroll",{...u,...v},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(u){return vt("privy:mfa:clear",u,a,e.origin)},initFarcasterSigner(u){return vt("privy:farcaster:init-signer",u,a,e.origin)},signFarcasterMessage(u){return vt("privy:farcaster:sign",u,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),m=(...u)=>{console.warn("Privy iframe failed to load: ",...u),e.onLoadFailed()},f=new AbortController;return ra(()=>vt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,m),()=>{window.removeEventListener("message",l),f.abort()}},[n]),t_("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:xs(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var rd=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 we();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await nC())throw new w("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 iC({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let a=setTimeout(()=>{n(new w("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",m)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(a),n(new w("User rejected request")))},300);function m(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(a),o(f.data),l()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new w(f.data.error)),l()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=m))}window.addEventListener("message",m)})}var r_="https://cdn.apple-cloudkit.com";async function su({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===r_&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var aC=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 wr,jsxs as sC}from"react/jsx-runtime";var wo;function c_(e){return typeof e=="string"&&e.length===25}function we(){if(!wo){let e=Q.get(yn);return Promise.resolve(e||null)}return wo.getAccessToken()}var lC,qm=(e,t,r)=>lC(e,t,r),cC,zm=(e,t)=>cC(e,t),dC,$m=(e,t)=>dC(e,t),pC,Km=()=>pC(),uC,nC=()=>uC(),d_=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(ia,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},p_=({config:e,...t})=>{if(!c_(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");wo||(wo=new ya({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."),wr(Bf,{client:wo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:wr(u_,{...t,client:wo})})},u_=e=>{let t=e.client,[r,o]=st(!1),[n,i]=st(!1),[a,l]=st(!1),[s,c]=st(null),[m,f]=st([]),[u,v]=st(null),g=Xi(m),[y,b]=st(!1),[T,k]=st(null),[E,P]=st(!1),[x,I]=st({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:S}),[N,H]=st({status:"initial"}),[K,j]=st(null),[O,D]=st(null),W=Ve(),ve=nl(),[Ie,Y]=st(!0),[X,te]=st({}),[_e,Te]=st(null),[Ke,Ge]=st(null),[ut,Fe]=st(!1),[se,Ft]=st(!1),Wr=Xi(null),Zr=Xi(null),L=Xi(Jf),[rt,Or]=st(!1);t.onStoreToken=d=>{d&&F(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),F(L,"accessToken","onAccessTokenRemoved")};let G=Xi(null),V=Xi(null),ie=d=>{k(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},mt=d=>{W.embeddedWallets.createOnLogin!=="off"&&Y(!0),ie(d)};Yr(()=>{let d=_n(s);if(!d||!O)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Fo,id:"io.privy.solana.wallet"},getProvider:async()=>new rd(O,d.address)};v(p)},[O,s]),Yr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=he(s),p=Qs(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!O){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(O,d.address,W.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(O,p.address,W.defaultChain,e.appId)},[O,s]),Yr(()=>{O&&Ke?.(O)},[O]),Yr(()=>{(async()=>{if(!W.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:h}=W.customAuth;if(!(!n||h))try{let C=await p();if(!C&&a){await Jn.logout();return}if(!C||a)return;t.startAuthFlow(new ei(C));let{user:R,isNewUser:U}=await t.authenticate();if(!R){await Jn.logout();return}c(R||null),b(U||!1),l(!0),Ft(!0)}catch(C){console.warn(C),a&&await Jn.logout()}})()},[W.customAuth?.enabled,W.customAuth?.getCustomAccessToken,W.customAuth?.isLoading,n,a]),Yr(()=>{se&&O&&s&&qt(s,W.embeddedWallets.createOnLogin)&&(Ft(!1),du(s,ri).catch(console.error))},[se&&O&&s]),Yr(()=>{async function d(){let p=ea(),h=cs();d_();let C=o_();t.initializeConnectorManager({walletConnectCloudProjectId:W.walletConnectCloudProjectId,rpcConfig:W.rpcConfig,chains:W.chains,defaultChain:W.defaultChain,store:C,walletList:W.appearance.walletList,shouldEnforceDefaultChainOnConnect:W.shouldEnforceDefaultChainOnConnect,externalWalletConfig:W.externalWallets,appName:W.name??"Privy"});let R;t.connectors?.on("connectorInitialized",()=>{R&&clearTimeout(R);let Ce=t.connectors.walletConnectors.length,re=t.connectors.walletConnectors.reduce((Ze,Pe)=>Ze+(Pe.initialized?1:0),0);re===Ce?Or(!0):R=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:re,expected:Ce}),Or(!0)},1500)}),t.connectors?.initialize().then(()=>{CC()});let U=await t.getAuthenticatedUser(),$=!!U;if(W.customAuth?.enabled||(l(!!U),U&&F(L,"login","onComplete",U,!1,!0,null,null),c(U)),p){V.current=$?"link":"login";return}if(h&&!$){V.current="login",mt("TELEGRAM_AUTH_SCREEN");return}ae.setReadyToTrue(!!U)}!n&&ve&&d()},[t,_e,n,ve]),Yr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){Fe(!0);return}let p=!!m.find(h=>h.walletClientType==="privy");Fe(p)},[n,s,m]);let ea=()=>{let d=da();if(d.inProgress&&d.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(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function h(C){return C.startsWith(p)}return d.inProgress&&h(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Jr(d)),mt("AWAITING_OAUTH_SCREEN"),!0)},cs=()=>{let d=Hm();if(!d||!W.loginMethods.telegram||!W.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new ii;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},vC=async(d,p,h,C)=>{let R=await t.connectors?.createWalletConnector(d,p)||null;od(R,p,h,C)};async function od(d,p,h,C){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:S});else return I({status:"disconnected",connectedWallet:null,connectError:new ce("Unable to connect to wallet."),connector:null,connectRetry:S}),C?.(null,h);d instanceof Dr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>od(d,p,h,C)});try{let R=await d.connect({showPrompt:!0});if(W.shouldEnforceDefaultChainOnConnect&&!W.chains.find(U=>U.id===Number(R?.chainId.replace("eip155:","")))&&!(R?.connectorType==="wallet_connect_v2"&&R?.walletClientType==="metamask")){I(U=>({...U,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:S}));try{await R?.switchChain(W.defaultChain.id),R&&(R.chainId=ti(hn(W.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${W.defaultChain.id}`)}}return I(U=>({...U,status:"connected",connectedWallet:R,connectError:null,connectRetry:S})),R&&F(L,"connectWallet","onSuccess",R),C?.(R,h)}catch(R){return R instanceof Xe?(console.warn(R.cause?R.cause:R.message),F(L,"connectWallet","onError",R.privyErrorCode||"generic_connect_wallet_error")):(console.warn(R),F(L,"connectWallet","onError","unknown_connect_wallet_error")),I(U=>({...U,status:"disconnected",connectedWallet:null,connectError:R})),C?.(null,h)}}let ds=async(d,p)=>{if(d===null)return;let h=new To(d,t,p);t.startAuthFlow(h)},CC=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!No()&&mt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");ie("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),vC(p,h,void 0,ds)};Yr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let lt=d=>{if(!a)throw F(L,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new w("User must be authenticated before linking an account.")},cu=()=>{lt("siwe"),G.current="siwe",V.current="link",ie("LINK_WALLET_SCREEN")},wC=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},bC=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:S})),W.captchaEnabled&&!a){let h={callback:C=>ds(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};te({captchaModalData:h}),mt("CAPTCHA_SCREEN")}else await ds(d),mt("AWAITING_CONNECTION")},EC=async(d,p)=>{let{signedUrl:h,externalTransactionId:C}=await s1(t,d,p??{},W.appearance.palette,W.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:h,externalTransactionId:C}},ps=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:wC(h),loginOrLink:async()=>{if(!await h.isConnected())throw new w("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");bC(h)},fund:async C=>{await ae.fundWallet(h.address,C)},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(h.address);c(C)}}))||[];return Js(d,p)?d:p})};Yr(()=>{ps()},[s?.linkedAccounts,a,n]),Yr(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");ps(),t.connectors.on("walletsUpdated",ps)}},[n]);let TC=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Oo(d.suggestedAddress);j(p)}ie(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Yr(()=>{if(!m[0])return;let d=m[0],p=g.current.find(C=>C.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&h){let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(C)}g.current=m},[m]);let du=async(d,p)=>{if(he(d))throw F(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,R]=await Promise.all([ae.initializeWalletProxy(p),we()]);if(!C&&W.customAuth?.enabled)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!R||W.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((U,$)=>{Y(!0),te({createWallet:{onSuccess:re=>{F(L,"createWallet","onSuccess",re),U(re)},onFailure:re=>{F(L,"createWallet","onError","unknown_embedded_wallet_error"),$(re)},callAuthOnSuccessOnClose:!1}}),ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:R});let U=await ae.refreshUser(),$=he(U);if(!$)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(L,"createWallet","onSuccess",$),$}},SC=d=>{if(!W.chains.map(p=>p.id).includes(d))throw new ce(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},pu=(d,p,h)=>new Promise(async(C,R)=>{let{requesterAppId:U}=p||{};if(!a||!s){F(L,"sendTransaction","onError","must_be_authenticated"),R(new Error("User must be authenticated before signing with a Privy wallet"));return}let $=d.from,Ce=$?s?.linkedAccounts.find(Qe=>Qe.type==="wallet"&&Qe.walletClientType==="privy"&&Oo(Qe.address)===Oo($)):he(s);if(!Ce){F(L,"sendTransaction","onError","embedded_wallet_not_found"),R(new Error("Must have a Privy wallet before signing"));return}Y(!0);let re=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):re.chainId;SC(Ze);let Pe=Object.assign({},d,{chainId:Ze}),Ht=async()=>{let Qe=await we();if(!Qe||!O){F(L,"sendTransaction","onError","embedded_wallet_not_found"),R(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ae.recoverEmbeddedEthereumWallet()){F(L,"sendTransaction","onError","unknown_connect_wallet_error"),R(new Error("Unable to connect to wallet"));return}let Xn=Gt(Pe.chainId,W.chains,W.rpcConfig,{appId:e.appId}),Qr=await l_(Ce.address,Pe,Xn);if(W.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:AC}=await s_(Qr,Xn),{hasSufficientFunds:xC}=await Fi(Ce.address,Qr,AC,Xn);if(!xC)throw new Ct(new Tr("Wallet has insufficient funds for this transaction.",a_.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let yu=await Zl(Qe,Ce.address,O,Qr,Xn,U);F(L,"sendTransaction","onSuccess",yu),C(yu)}catch(ms){F(L,"sendTransaction","onError","transaction_failure"),R(ms)}};if(W.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ht();else{let Qe={transactionRequest:Pe,onSuccess:Qr=>{F(L,"sendTransaction","onSuccess",Qr),C(Qr)},onFailure:Qr=>{F(L,"sendTransaction","onError","transaction_failure"),R(Qr)},uiOptions:p||{},fundWalletConfig:h,requesterAppId:U},ms={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{F(L,"sendTransaction","onError","unknown_connect_wallet_error"),R(Qr)}},Xn=fu({address:Ce.address,fundWalletConfig:h,chainIdOverride:Pe.chainId,comingFromSendTransactionScreen:!0});te({connectWallet:ms,sendTransaction:Qe,funding:Xn}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function uu(){return new Promise(async(d,p)=>{let h=await we();if(!h||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:h}),d()}catch(C){p(C)}})}let mu=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,h)=>h.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],Bt=d=>{let p=s?.linkedAccounts.filter(R=>R.type===d).length??0,{displayName:h,loginMethod:C}=on(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:C}),new w(`User already has an account of type ${h} linked.`)},_C=()=>{if(!W.loginConfig.telegramAuthConfiguration?.linkEnabled)throw F(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new w("User can't link an account because Telegram linking is disabled.")},fu=({address:d,fundWalletConfig:p,methodScreen:h,chainIdOverride:C=null,comingFromSendTransactionScreen:R=!1})=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)return;let U=uc(p)&&p.amount?p.amount:W.fundingConfig.defaultRecommendedAmount,$=uc(p)&&p.chain?p.chain.id:Bi(W.fundingConfig.defaultRecommendedCurrency.chain),Ce=uc(p)&&p.chain?p.chain:W.chains.find(re=>re.id===$);if(C&&W.chains.find(re=>re.id===C)&&(Ce=W.chains.find(re=>re.id===C)),!Ce)throw new w("Funding chain is not in PrivyProvider chains list");return{address:d,amount:U,chain:Ce,methodScreen:h,comingFromSendTransactionScreen:R,...a1(p)?{moonpayConfigOverride:p.config}:{}}};async function hu({legacySetWalletPasswordFlow:d=!1}){k(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw F(L,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=he(s);if(!h||!O)throw F(L,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(_n(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await uu()}catch(R){throw F(L,p,"onError","missing_or_invalid_mfa"),R}return new Promise((R,U)=>{Y(!0);let $={onSuccess:Pe=>{F(L,p,"onSuccess","user-passcode",Pe),R(Pe)},onFailure:Pe=>{F(L,p,"onError","user_exited_set_password_flow"),U(Pe)},callAuthOnSuccessOnClose:!1},Ce=h.recoveryMethod==="user-passcode",Ze={onCompleteNavigateTo:Ol({walletAction:"update",availableRecoveryMethods:W.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:Ce}),shouldForceMFA:!1,onFailure:Pe=>{F(L,p,"onError","unknown_connect_wallet_error"),U(Pe)}};te({setWalletPassword:$,createWallet:$,connectWallet:Ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Ce}}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function us({appId:d}){lt(`privy:${d}`),G.current=`privy:${d}`,V.current="link";let p=window.open(void 0,void 0,Na({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(h,C)=>{let{name:R,logoUrl:U}=await ec({api:t.api,providerAppId:d,requesterAppId:W.id});te({crossAppAuth:{appId:d,name:R,logoUrl:U,popup:p,onSuccess:h,onError:C}}),mt("CROSS_APP_AUTH_SCREEN")})}let Jn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:TC,importWallet:async({privateKey:d})=>{lt("siwe");let[p,h]=await Promise.all([ae.initializeWalletProxy(15e3),we()]);if(p&&h){await p.import({privateKey:d,accessToken:h});let C=await ae.refreshUser(),R=Qs(C);if(!R)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return F(L,"createWallet","onSuccess",R),R}else throw new w("User is not authenticated")},linkWallet:cu,linkCrossAppAccount:us,linkEmail:()=>{lt("email"),Bt("email"),G.current="email",V.current="link",ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{lt("sms"),Bt("phone"),G.current="sms",V.current="link",ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{lt("google"),Bt("google_oauth"),V.current="link",await ae.initLoginWithOAuth("google")},linkTwitter:async()=>{lt("twitter"),Bt("twitter_oauth"),V.current="link",await ae.initLoginWithOAuth("twitter")},linkDiscord:async()=>{lt("discord"),Bt("discord_oauth"),V.current="link",await ae.initLoginWithOAuth("discord")},linkGithub:async()=>{lt("github"),Bt("github_oauth"),V.current="link",await ae.initLoginWithOAuth("github")},linkSpotify:async()=>{lt("spotify"),Bt("spotify_oauth"),V.current="link",await ae.initLoginWithOAuth("spotify")},linkInstagram:async()=>{lt("instagram"),Bt("instagram_oauth"),V.current="link",await ae.initLoginWithOAuth("instagram")},linkTiktok:async()=>{lt("tiktok"),Bt("tiktok_oauth"),V.current="link",await ae.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{lt("linkedin"),Bt("linkedin_oauth"),V.current="link",await ae.initLoginWithOAuth("linkedin")},linkApple:async()=>{lt("apple"),Bt("apple_oauth"),V.current="link",await ae.initLoginWithOAuth("apple")},linkPasskey:async()=>{lt("passkey"),Bt("passkey"),await ae.initLinkWithPasskey(),ie("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{lt("telegram"),Bt("telegram"),_C(),V.current="link",G.current="telegram",await ae.initLoginWithTelegram(),ie("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{lt("farcaster"),Bt("farcaster"),await ae.initLoginWithFarcaster(),V.current="link",G.current="farcaster",ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(lt("email"),!s?.email)throw new w("User does not have an email linked to their account.");V.current="link",G.current="email",ie("UPDATE_EMAIL_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let h=await new Promise(C=>{Te(R=>C.bind(R))});if(Te(null),h){console.warn(p);return}}if(a){console.warn(p);return}V.current="login",te({login:d}),mt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(m[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}mt("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),k(null),await t.logout(),s&&O)try{await O.clearMfa({userId:s.id})}catch{}c(null),l(!1),F(L,"logout","onSuccess"),V.current=null,G.current=null,o(!1),Q.del(aa)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new je;let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new je:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new lu(new Xr(new je));let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new lu(new Xr(new je)):new lu(new Xr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Uo(new je);let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new Uo(new je):new Uo(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(C=>C.type==="cross_app"&&C.subject===d)?.providerApp;if(!p)throw new w("Invalid subject");t.storeProviderAccessToken(p.id,null);let h=await t.unlinkOAuth(`privy:${p.id}`,d);return c(h),h},setActiveWallet:async d=>{let p=m.find(C=>Oo(C.address)===Oo(d)),h=s?.linkedAccounts.find(C=>C.type==="wallet"&&Oo(C.address)===Oo(d));if(!p||!await p.isConnected())j(d),cu();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return du(s,15e3)},setWalletRecovery:async()=>hu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>hu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,h)=>new Promise(async(C,R)=>{let{requesterAppId:U}=p||{};if(!a||!s){F(L,"signMessage","onError","must_be_authenticated"),R(new Error("User must be authenticated before signing with a Privy wallet"));return}let $=h?s?.linkedAccounts.find(re=>re.type==="wallet"&&re.walletClientType==="privy"&&Oo(re.address)===Oo(h)):he(s);if(!$){F(L,"signMessage","onError","embedded_wallet_not_found"),R(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(L,"signMessage","onError","invalid_message"),R(new Error("Message must be a non-empty string"));return}Y(!0);let Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!O||!re)throw new Error("Unable to connect to wallet");if(!await ae.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:$.address,requesterAppId:U}});let{response:Pe}=await O.rpc({accessToken:re,address:$.address,requesterAppId:U,request:{method:"personal_sign",params:[d,$.address]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:$.address,requesterAppId:U}}),Ht};if(W.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();F(L,"signMessage","onSuccess",re),C(re)}catch(re){F(L,"signMessage","onError","unable_to_sign"),R(re??new Ct("Unable to sign message"))}}else{let Pe={method:"personal_sign",data:d,confirmAndSign:Ce,onSuccess:Qe=>{F(L,"signMessage","onSuccess",Qe),C(Qe)},onFailure:Qe=>{F(L,"signMessage","onError","unable_to_sign"),R(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),R(Qe)},address:$.address};te({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,C)=>{let{requesterAppId:R}=p||{};if(!a||!s){F(L,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let U=he(s);if(!U){F(L,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}Y(!0);let $=oa(d),Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!O||!re)throw new Error("Unable to connect to wallet");if(!await ae.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:U.address,requesterAppId:R}});let{response:Pe}=await O.rpc({accessToken:re,address:U.address,requesterAppId:R,request:{method:"eth_signTypedData_v4",params:[U.address,$]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:U.address,requesterAppId:R}}),Ht};if(W.embeddedWallets.noPromptOnSignature||(W.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();F(L,"signTypedData","onSuccess",re),h(re)}catch(re){F(L,"signTypedData","onError","unable_to_sign"),C(re??new Ct("Unable to sign message"))}}else{let Pe={method:"eth_signTypedData_v4",data:$,confirmAndSign:Ce,onSuccess:Qe=>{F(L,"signTypedData","onSuccess",Qe),h(Qe)},onFailure:Qe=>{F(L,"signTypedData","onError","unable_to_sign"),C(Qe)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(L,"signMessage","onError","unknown_connect_wallet_error"),C(Qe)}};te({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let R=await(await pu(d,p,h)).wait();return Ql(R)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!he(s)){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(te(X),!await we()||!O){p(new Error("Must have valid access token to enroll in MFA"));return}if(!O){p(new Error("Must have a Privy wallet before exporting"));return}let U={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};te({keyExport:U,connectWallet:C}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:uu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new w("Invalid MFA code");Wr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((U,$)=>{Zr.current={resolve:U,reject:$}});break;case"passkey":if(typeof p=="string")throw new w("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),R=aC(C);Wr.current?.resolve({mfaMethod:d,mfaCode:R,relyingParty:window.origin}),await new Promise((U,$)=>{Zr.current={resolve:U,reject:$}});break;default:throw Wr.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){Wr.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){ae.closePrivyModal(),p();return}W.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."),te({mfaEnrollmentFlow:{mfaMethods:W.mfa.methods,onSuccess:p,onFailure:h}}),ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await we();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");let p=await O.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await we();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await we();if(!p||!O)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await O.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await O.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await we(),p=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ae.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let C=await O.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let R=await t.getAuthenticatedUser();c(R||s||null)}te({farcasterSigner:C}),ie("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await we(),p=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ae.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(R=>Uint8Array.from(R.match(/.{1,2}/g).map(U=>parseInt(U,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await we(),h=s?.linkedAccounts.find($=>$.type==="wallet"&&$.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ae.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let R=await import("@simplewebauthn/browser"),U=await O.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:R.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(R.base64URLStringToBuffer(U.signature))},isHeadlessOAuthLoading:E,loginWithCode(d){return ae.loginWithCode(d)},initLoginWithEmail(d){return ae.initLoginWithEmail(d)},initLoginWithSms(d){return ae.initLoginWithSms(d)},otpState:N,fundWallet(d,p){return ae.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return ae.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return ae.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return ae.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:C,connectorType:R}){return lt("siwe"),ae.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:C,connectorType:R})},signMessageWithCrossAppWallet(d,{address:p}){return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"personal_sign",params:[d,p]},reconnect:us})},signTypedDataWithCrossAppWallet(d,{address:p}){let h=oa(d);return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_signTypedData_v4",params:[p,h]},reconnect:us})},sendTransactionWithCrossAppWallet(d,{address:p}){return tc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:us})},isModalOpen:r,mfaMethods:W.mfa.methods};lC=Jn.signMessage,cC=Jn.signTypedData,dC=async(...d)=>{let p=await pu(...d);return W.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let ae=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:K,pendingTransaction:null,walletConnectionStatus:x,connectors:t.connectors?.walletConnectors??[],rpcConfig:W.rpcConfig,chains:W.chains,appId:e.appId,showFiatPrices:W.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>W.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(R=>{Ge(()=>U=>R(U))}),h=new Promise(R=>setTimeout(()=>R(null),d)),C=await Promise.race([p,h]);return Ge(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:async(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;if(p&&G.current&&(h=mu(s)),V.current==="login"?d.shouldCallAuthOnSuccess&&p&&G.current?(F(L,"login","onComplete",s,y,!1,G.current,h??null),e.onSuccess?.(s,y)):F(L,"login","onError","exited_auth_flow"):V.current==="link"&&h&&(d.isSuccess&&p&&G.current?F(L,"linkAccount","onSuccess",s,G.current,h):G.current&&F(L,"linkAccount","onError","exited_link_flow",{linkMethod:G.current})),T&&av.includes(T)&&X.funding){let C=sv[T]??null,R=Gt(X.funding.chain.id,W.chains,W.rpcConfig,{appId:e.appId}),U;try{U=(await R.getBalance(X.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}F(L,"fundWallet","onUserExited",{address:X.funding.address,chain:X.funding.chain,fundingMethod:C,balance:U})}j(null),V.current=null,G.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ie,connectWallet:od,initLoginWithWallet:async(d,p)=>{G.current="siwe",ds(d,p)},loginWithWallet:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof To))throw new w("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="siwe"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="siwe"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new na(d);t.startAuthFlow(p);try{G.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),h}},loginWithFarcaster:async()=>{if(!n)throw new bo;if(!(t.authFlow instanceof na))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),G.current="farcaster"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),G.current="farcaster"}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let h=`privy:${d}`;G.current=h;let{url:C,stateCode:R,codeVerifier:U}=await Eg({api:t.api,appId:d});if(!C)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new w("No authorization URL returned for cross-app auth.");try{let $=await iC({url:C,popup:p,provider:h}),Ce=$.stateCode,re=$.authorizationCode;if(Ce!==R)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:R??"",returnedStateCode:Ce??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ze=await Tg({api:wo.api,appId:d,codeVerifier:U,stateCode:Ce,authorizationCode:re});Ze&&t.storeProviderAccessToken(d,Ze);let Pe=await ae.refreshUser();if(!Pe)throw new w("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),Pe}catch($){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:$.toString(),provider:h}}),$}},async initLoginWithOAuth(d,p){if(G.current=d,sd()){if(d==="google"&&_i(window.navigator.userAgent)){mt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{mt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),Q.del(Cn);let h=new Jr({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&(d==="twitter"&&i_&&(C.url=C.url.replace("x.com","twitter.com")),window.location.assign(C.url))},async initLoginWithTelegram(d){if(!n)throw new bo;G.current="telegram";let p=new ii(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((h,C)=>{if(!W.loginConfig.telegramAuthConfiguration)return C(new w("Telegram Auth configuration is not loaded"));if(!window.Telegram)return C(new w("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:W.loginConfig.telegramAuthConfiguration.botId,request_access:!0},R=>R?h(R):C(new w("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof ii))throw new w("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),G.current="telegram"}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}else try{let h=await t.authenticate();d=h.user,p=h.isNewUser,G.current="telegram"}catch(h){throw V.current==="login"?F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}c(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,h){let C,R;function U($){if(!$)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new w("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:$,codeVerifier:Ce,stateCode:re}=await op({api:wo.api,provider:d});U($);let Ze,Pe;try{let Ht=await su({url:$,popup:h,provider:d});if(Ze=Ht.stateCode,Pe=Ht.authorizationCode,Ze!==re)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:re??"",returnedStateCode:Ze??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Ht){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ht.toString(),provider:d}}),new w("Recovery OAuth failed")}[C,R]=await Promise.all([we(),dy({api:wo.api,provider:d,codeVerifier:Ce,stateCode:Ze,authorizationCode:Pe})]);break}case"icloud":{let{url:$}=await op({api:wo.api,provider:d});U($);let{ckWebAuthToken:Ce}=await su({url:$,popup:h,provider:d});R=Ce,C=await we();break}}if(!O)throw new w("Cannot connect to wallet proxy");if(!C)throw new w("Unable to authorize user");switch(p){case"recover":let $=X.recoverWallet?.privyWallet?.address;if(!$)throw new w("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:$,recoveryMethod:d}}),await O.recover({address:$,accessToken:C,recoveryAccessToken:R,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:$,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await O.create({accessToken:C,recoveryAccessToken:R,recoveryMethod:d});let Ce=await ae.refreshUser(),re=he(Ce);if(!re)throw F(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:re.address}}),F(L,"createWallet","onSuccess",re);break;case"set-recovery":let Ze=he(s);if(!Ze)throw F(L,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await O.setRecovery({address:Ze.address,accessToken:C,recoveryAccessToken:R,recoveryMethod:d});let Pe=he(await ae.refreshUser());if(!Pe)throw F(L,"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:d}}),F(L,"setWalletRecovery","onSuccess",d,Pe);break;default:throw new w("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Jr))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=Q.get(gn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let C,R,U;if(a)try{let $=await t.link();C=$.user,U=$.oAuthTokens,G.current=d}catch($){throw F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:d}),$}else try{let $=await t.authenticate();C=$.user,R=$.isNewUser,U=$.oAuthTokens,G.current=d}catch($){throw V.current==="login"?F(L,"login","onError",$.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:d}),$}return c(C),b(R||!1),l(!0),U&&C&&F(L,"oAuthAuthorization","onOAuthTokenGrant",U,{user:C}),U},async initLoginWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),V.current="login";try{G.current="passkey",await p.initAuthenticationFlow()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Tn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d,p;try{G.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw F(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),V.current="link",G.current="passkey";try{await p.initLinkFlow()}catch(h){throw F(L,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new bo;if(!(t.authFlow instanceof Tn))throw new w("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new w("Must init login with Passkey flow first.");let d;try{G.current="passkey",{user:d}=await t.link()}catch(p){throw F(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(sd()){if(d==="google"&&_i(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 Jr({provider:d,headless:!0});p&&h.addCaptchaToken(p);let C=await t.startAuthFlow(h).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){P(!0),t.startAuthFlow(new Jr(d));let p=Q.get(gn),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),P(!1),new w("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let C,R;if(a)try{({user:C}=await t.link()),G.current=d.provider}catch(U){throw F(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),U}else try{({user:C,isNewUser:R}=await t.authenticate()),G.current=d.provider}catch(U){throw V.current==="login"?F(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),U}return c(C),b(R||!1),l(!0),P(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let h=new Lo(d,p);t.startAuthFlow(h);try{G.current="email",await h.sendCodeEmail()}catch(C){throw V.current==="login"?F(L,"login","onError",C.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),C}},initUpdateEmail:async(d,p,h)=>{let C=new Ts(d,p,h);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{H({status:"sending-code"});let h=new Sn(d,p);t.startAuthFlow(h);try{G.current="sms",await h.sendSmsCode(),H({status:"awaiting-code-input"})}catch(C){throw H({status:"error",error:C}),V.current==="login"?F(L,"login","onError",C.privyErrorCode||"unknown_auth_error"):V.current==="link"&&F(L,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(H({status:"submitting-code"}),!n){let C=new bo;throw H({status:"error",error:C}),C}if(t.authFlow instanceof Lo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Sn)t.authFlow.meta.smsCode=d.trim();else{let C=new w("Must initialize a passwordless code flow first");throw H({status:"error",error:C}),C}await we();let p,h;if(V.current==="link")try{({user:p}=await t.link())}catch(C){throw H({status:"error",error:C}),F(L,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account",{linkMethod:G.current}),C}else try{({user:p,isNewUser:h}=await t.authenticate())}catch(C){throw H({status:"error",error:C}),F(L,"login","onError",C.privyErrorCode||"unknown_auth_error"),C}c(p||s||null),b(h||!1),l(!0),H({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:h})=>{V.current="link",G.current="siwe";let C=await t.generateSiweNonce({address:d,captchaToken:h}),R=p.replace("eip155:","");return Zs({address:d,chainId:R,nonce:C})},linkWithSiwe:async({message:d,signature:p,chainId:h,walletClientType:C,connectorType:R})=>{let U;try{if(V.current!=="link"||G.current!=="siwe")throw new w("Must ensure no other auth flow is in progress other than the SIWE signature flow.");U=await t.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:C,connectorType:R}),U=await ae.refreshUser()??U;let $=mu(U);$&&F(L,"linkAccount","onSuccess",U,"siwe",$)}catch($){throw F(L,"linkAccount","onError",$.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),V.current=null,G.current=null,$}c(U||s||null),V.current=null,G.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:O,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let h=he(s)||Qs(s),C=await we();if(!C||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connect({accessToken:C,address:h.address}),d(!0)}catch(R){if(Ln(R)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recover({address:h.address,accessToken:C,recoveryMethod:h.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(Ln(R)&&h.recoveryMethod!=="privy"){te({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let U=Ll(h.recoveryMethod);ie(U)}else p(R)}}),embeddedSolanaWallet:u,createEmbeddedSolanaWallet:async()=>{Y(!0);let d=await we(),p=_n(s),h=he(s);if(!s||!d)throw new w("User must be logged in to create a Solana wallet");if(p)throw new w("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await ae.recoverEmbeddedEthereumWallet();else throw new w("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let C=await ae.initializeWalletProxy(15e3);if(!C)throw new w("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await C.createSolana({accessToken:d,ethereumAddress:h?.address});let R=await ae.refreshUser(),U=_n(R);if(!U)throw new w("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:U.address}}),U}catch(R){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new w("Failed to create Solana embedded wallet with error ",R)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let h=_n(s),C=await we();if(!C||!O||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await O.connectSolana({accessToken:C,publicKey:h.address}),d(!0)}catch(R){Ln(R)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await O.recoverSolana({publicKey:h.address,accessToken:C})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0)):p(R)}}),getMoonpaySignedUrl:EC,initCoinbaseOnRamp:t.initCoinbaseOnRamp.bind(t),getCoinbaseOnRampStatus:t.getCoinbaseOnRampStatus.bind(t),setReadyToTrue:d=>{i(!0),_e?.(d)},updateWallets:()=>ps(),fundWallet:async(d,p)=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let h=Zc({fundingMethods:W.fundingConfig.methods});te({funding:fu({address:d,fundWalletConfig:p,methodScreen:h})}),ie(h)},requestFarcasterSignerStatus:async d=>{let p=await we(),h=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let C=await t.requestFarcasterSignerStatus(d);if(C.status==="approved"){let R=await t.getAuthenticatedUser();c(R||s||null)}return C}}))();pC=ae.recoverEmbeddedEthereumWallet,uC=ae.recoverEmbeddedSolanaWallet;let PC=n_(()=>({wallets:m,ready:ut&&rt}),[m,ut,rt]);return wr(Se.Provider,{value:Jn,children:wr(Wd.Provider,{value:L,children:wr(wp.Provider,{value:PC,children:wr(Yf,{...W,children:sC(Md.Provider,{value:ae,children:[wr(zh,{children:sC(Gf,{data:X,setModalData:te,setInitialScreen:k,initialScreen:T,authenticated:a,open:r,children:[e.children,!W.headless&&W.captchaEnabled&&n&&!a&&wr(Id,{delayedExecution:!1}),wr(Vv,{theme:{...W.appearance.palette||{}}}),!W.render.standalone&&wr(iu,{open:r})]})}),Ie&&ve?wr(oC,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Wr,mfaSubmitPromise:Zr,onLoad:D,onLoadFailed:()=>null}):null,W.loginMethods.telegram&&W.loginConfig.telegramAuthConfiguration&&wr(Fr,{if:!0,children:wr(eC,{scriptHost:e.apiUrl||Ms,botUsername:W.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as m_}from"react";function f_(e){let{login:t}=m_(Se);return Ae("login",e),{login:t}}import{useContext as h_}from"react";function y_(e){let{logout:t}=h_(Se);return Ae("logout",e),{logout:t}}import{useCallback as mC,useEffect as g_}from"react";function v_(){let e=be(),t=nl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=q(),l=mC(async c=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=mC(async()=>{let c=da();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;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(m){throw m}finally{En()}},[o]);return g_(()=>{let c=da();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as fC}from"react";var C_=()=>{let e=be(),{initLoginWithEmail:t,loginWithCode:r}=q(),o=fC(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=fC(async({code:i})=>{if(e.enabled&&e.status==="error")throw new nr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as hC}from"react";var w_=()=>{let e=be(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=q(),n=hC(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=hC(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useCallback as yC}from"react";var b_=()=>{let e=be(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=yC(async({address:i,chainId:a})=>{if(!i||!a)throw new Error("wallet address and chainId required to generate nonce");return t({address:i,chainId:a}).then(l=>l)},[t]),n=yC(async({signature:i,message:a,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r({message:a,signature:i,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as E_}from"react";function T_(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkTelegram:v,linkFarcaster:g}=E_(Se);return Ae("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkFarcaster:g,linkTelegram:v}}import{useContext as S_}from"react";function __(e){let{connectWallet:t}=S_(Se);return Ae("connectWallet",e),{connectWallet:t}}import{useContext as P_}from"react";function A_(e){let{createWallet:t}=P_(Se);return Ae("createWallet",e),{createWallet:t}}var x_=e=>{Ae("fundWallet",e);let{fundWallet:t}=q();return{fundWallet:t}};var k_=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=M();return{createWallet:t,wallets:e?[e]:[]}};var R_=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as I_}from"react";function M_(e){let{sendTransaction:t}=I_(Se);return Ae("sendTransaction",e),{sendTransaction:t}}import{useContext as W_}from"react";function O_(e){let{setWalletPassword:t}=W_(Se);return Ae("setWalletPassword",e),{setWalletPassword:t}}import{useContext as L_}from"react";function N_(e){let{setWalletRecovery:t}=L_(Se);return Ae("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as D_}from"react";function U_(e){let{signMessage:t}=D_(Se);return Ae("signMessage",e),{signMessage:t}}import{useContext as F_}from"react";function B_(e){let{signTypedData:t}=F_(Se);return Ae("signTypedData",e),{signTypedData:t}}import{useContext as H_}from"react";var G_=()=>{let{isModalOpen:e}=H_(Se);return{isOpen:e}};import{useContext as V_}from"react";function q_(e){let{getAccessToken:t}=V_(Se);return Ae("accessToken",e),{getAccessToken:t}}function z_(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=M(),n=hi();return Ae("oAuthAuthorization",e),{reauthorize:i=>$_(t,r,o,n,i.provider)}}var $_=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new w("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(a=>a.type.includes(n)))throw new w(`OAuth account of type ${n} not linked to the account.`);await r(n)};var K_=gC;function gC(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function j_(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function Y_(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Xr as AsExternalProvider,Id as Captcha,ha as ConnectorManager,iu as LoginModal,ya as PrivyClient,p_ as PrivyProvider,je as PrivyProxyProvider,ma as SUPPORTED_CHAINS,ud as VERSION,$t as WalletConnector,j_ as addRpcUrlOverrideToChain,tp as errorIndicatesMaxMfaRetries,Nn as errorIndicatesMfaTimeout,Dn as errorIndicatesMfaVerificationFailed,we as getAccessToken,Y_ as getEmbeddedConnectedWallet,__ as useConnectWallet,A_ as useCreateWallet,R_ as useCrossAppAccounts,K_ as useExperimentalFarcasterSigner,gC as useFarcasterSigner,x_ as useFundWallet,T_ as useLinkAccount,b_ as useLinkWithSiwe,f_ as useLogin,C_ as useLoginWithEmail,v_ as useLoginWithOAuth,w_ as useLoginWithSms,y_ as useLogout,Ka as useMfa,$r as useMfaEnrollment,G_ as useModalStatus,z_ as useOAuthTokens,q as usePrivy,Od as useRegisterMfaListener,M_ as useSendTransaction,O_ as useSetWalletPassword,N_ as useSetWalletRecovery,U_ as useSignMessage,B_ as useSignTypedData,k_ as useSolanaWallets,q_ as useToken,zr as useWallets};