@privy-io/react-auth 1.65.0 → 1.65.1-beta-20240516231023

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 fc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var gp=(e,t,r)=>(fc(e,t,"read from private field"),r?r.call(e):t.get(e)),Wa=(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)},hc=(e,t,r,o)=>(fc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var vp=(e,t,r)=>(fc(e,t,"access private method"),r);import{getAddress as dc}from"@ethersproject/address";import{Web3Provider as mp}from"@ethersproject/providers";import{createStore as Ub}from"mipd";import{useEffect as Or,useMemo as Fb,useRef as _i,useState as $e}from"react";import{FetchError as l2}from"ofetch";var Ge=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}]`:""}`}},wr=class extends Ge{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},E=class extends Ge{constructor(r,o,n){super(r,o,n);this.type="client_error"}},La=class extends E{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var te=class extends Ge{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ie=e=>{if(e instanceof Ge)return e;if(!(e instanceof l2))return ut(e);if(!e.response)return new wr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new wr(t||"ApiError",e.response.status,r||o,e,n)},ut=e=>e instanceof Ge?e:e instanceof Error?new E(e.message,e):new E(`Internal error: ${e}`);var Nr=class extends E{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},bt=class extends E{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Oa=class extends E{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var sr=class extends E{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 Na="/api/v1/sessions",Da="/api/v1/sessions/logout",Cp="/api/v1/sessions/fork",Ua="/api/v1/sessions/fork/recover",wp="/api/v1/siwe/init",bp="/api/v1/siwe/authenticate",Ep="/api/v1/siwe/link",Pp="/api/v1/siwe/unlink",Tp="/api/v1/farcaster/init",Sp="/api/v1/farcaster/authenticate",_p="/api/v1/farcaster/link",xp="/api/v1/farcaster/status",Ap="/api/v1/farcaster/unlink",kp="/api/v1/passwordless/init",Rp="/api/v1/passwordless/authenticate",Ip="/api/v1/passwordless/link",Mp="/api/v1/passwordless/unlink",Wp="/api/v1/passwordless/update",Lp="/api/v1/passwordless_sms/init",Op="/api/v1/passwordless_sms/link",Np="/api/v1/passwordless_sms/unlink",Dp="/api/v1/passwordless_sms/authenticate",Up="/api/v1/oauth/init",Fp="/api/v1/oauth/authenticate",Bp="/api/v1/oauth/link",Hp="/api/v1/oauth/unlink",Gp="/api/v1/recovery/oauth/init",Vp="/api/v1/recovery/oauth/authenticate",zp="/api/v1/passkeys/link/init",qp="/api/v1/passkeys/authenticate/init",$p="/api/v1/passkeys/link",Kp="/api/v1/passkeys/authenticate",jp="/api/v1/passkeys/unlink";var Yp="/api/v1/mfa/passwordless_sms/init",Zp="/api/v1/mfa/passkeys/init",Jp="/api/v1/users/me/accept_terms",Fa="/api/v1/analytics_events",Qp="/api/v1/plugins/moonpay_on_ramp/sign",Xp="/api/v1/custom_jwt_account/authenticate",eu="/api/v1/telegram/authenticate";var Sn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let t=await this.api.post(Xp,{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 ie(t)}}async link(){throw new Error("Unimplemented")}};var go=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Rp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Ip,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ie(t)}}async sendCodeEmail(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new E("Email must be set when initialzing authentication.");try{return await this.api.post(kp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ie(o)}}},Ba=class extends go{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new E("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Wp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ie(r)}}};import{isMobile as p2,isIOS as u2}from"react-device-detect";var yc=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)}},Ha=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 gc(){try{let e="privy:__session_storage__test",t="blobby",r=new Ha;return r.put(e,t),r.del(e),!0}catch{return!1}}function c2(){return typeof window<"u"&&window.localStorage?new Ha:new yc}var Z=c2();import{StaticJsonRpcProvider as xi}from"@ethersproject/providers";function tu(){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 Ga=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 vc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ga(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!vc(r))return!1}return!0},vo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ru=()=>{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 ou=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Va=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,}))$/),nu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Co=(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}`},Cc=e=>new Promise(t=>setTimeout(t,e));function iu(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 au=(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(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Cc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},za=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var su=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),zo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function lu(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of tu()){let u=Ga(c);if(!l.some(f=>f.info.name===u)){if(vc(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(f=>f.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function _n(e){return`eip155:${String(Number(e))}`}var qa=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new te(`No RPC url found for ${e}`);return a},cu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new te(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},to=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new xi(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new xi(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new xi({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new xi(i.rpcUrls.public.http[0]):a=new xi(i.rpcUrls.default?.http[0]),!a)throw new te(`No RPC url found for ${e}`);return a},$a=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 Ka=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ja))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ja={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 d2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function du(e,t){let r=d2(t);if(r.deepLink)return hu(r.deepLink,e);if(r.universalLink)return yu(r.universalLink,e);throw new E(`Unsupported wallet ${t.id}`)}var pu="WALLETCONNECT_DEEPLINK_CHOICE";function uu(){try{localStorage.removeItem(pu)}catch{}}function mu({href:e,name:t}){try{localStorage.setItem(pu,JSON.stringify({href:e,name:t}))}catch{}}function fu(e){return e.startsWith("http://")||e.startsWith("https://")}function hu(e,t){if(fu(e))return yu(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 yu(e,t){if(!fu(e))return hu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ya(e,t){window.open(e,t,"noreferrer noopener")}var De=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Ai=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new De(this._startChannelOnce.bind(this)),this.pollForReady=new De(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");try{let t=await this.api.post(Sp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new E("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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{return await this.api.post(_p,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ie(t)}}async _startChannelOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=await this.api.post(Tp,{token:this.captchaToken});p2&&!u2&&t.connect_uri&&Ya(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new E("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");let t=await this.api.get(xp,{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 gu="1.65.0";var vu="34357d3c125c2bcf2ce2bc3309d98715",Za="https://auth.privy.io",Cu=2e4,We=1400,wu=2500,wc=gu;var qo="privy:token",bc="privy-token",Ja="privy:refresh_token",Ec="privy-refresh-token",Qa="privy-session",ki="privy:session_transfer_token",f2="privy:wallet",Ri="privy:caid",$o="privy:state_code",Ko="privy:code_verifier",jo="privy:headless_oauth",Xa=e=>`${f2}:${e}`,Pc="privy:connectors",Tc="privy:connections";var Yo=12e4,ro=1,Sc="0x1",xn=3e4,bu="https://api.moonpay.com/v1",Eu="https://api.moonpay.com/v1",Pu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Tu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Su="0x420000000000000000000000000000000000000F",_u=["function getL1Fee(bytes memory _data) external view returns (uint256)"];import{base64url as ku}from"jose";async function xu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Au(e){return crypto.getRandomValues(new Uint8Array(e))}var h2="S256",y2="S256";function Ii(){return ku.encode(Au(36))}function es(){return Ii()}async function ts(e,t=h2){if(t==y2){let r=await xu(e);return ku.encode(r)}else return e}function Ru(){let e=Z.get(Ko);if(!e)throw new E("Authentication error.");return e}function rs(){return!!Z.get(jo)}var Dr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:rs();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 E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=Ru();try{let r=await this.api.post(Fp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),this.meta.headless&&Z.del(jo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=ie(r);throw o.privyErrorCode?new E(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=Z.get(Ko);if(!t)throw new E("Authentication error.");try{let r=await this.api.post(Bp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),r}catch(r){throw ie(r)}}async getAuthorizationUrl(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.provider)throw new E("Provider must be set when initializing OAuth authentication.");let t=Ii();Z.put(Ko,t);let r=es();Z.put($o,r);let o=await ts(t);this.meta.headless&&Z.put(jo,!0);try{return await this.api.post(Up,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ie(n)}}};function _c(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Iu,jsxs as g2}from"react/jsx-runtime";var os=({style:e,...t})=>g2("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:[Iu("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"}),Iu("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 Mi,jsxs as v2}from"react/jsx-runtime";var ns=({style:e,...t})=>v2("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:[Mi("g",{clipPath:"url(#clip0)",children:Mi("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"})}),Mi("defs",{children:Mi("clipPath",{id:"clip0",children:Mi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Mu}from"react/jsx-runtime";var is=({style:e,...t})=>Mu("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:Mu("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{jsx as as,jsxs as C2}from"react/jsx-runtime";var ss=({style:e,...t})=>C2("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:[as("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"}),as("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"}),as("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"}),as("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 lr,jsxs as ls}from"react/jsx-runtime";function cs(e){return ls("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:[ls("defs",{children:[ls("linearGradient",{id:"b",children:[lr("stop",{offset:"0",stopColor:"#3771c8"}),lr("stop",{stopColor:"#3771c8",offset:".128"}),lr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),ls("linearGradient",{id:"a",children:[lr("stop",{offset:"0",stopColor:"#fd5"}),lr("stop",{offset:".1",stopColor:"#fd5"}),lr("stop",{offset:".5",stopColor:"#ff543e"}),lr("stop",{offset:"1",stopColor:"#c837ab"})]}),lr("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"}),lr("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"})]}),lr("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)"}),lr("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)"}),lr("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 ds}from"react/jsx-runtime";function ps({style:e,...t}){return ds("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:ds("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:ds("g",{transform:"scale(5.12,5.12)",children:ds("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 Wu,jsxs as w2}from"react/jsx-runtime";function us(e){return w2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Wu("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"}),Wu("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 xc,jsxs as b2}from"react/jsx-runtime";function ms(e){return b2("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:[xc("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"}),xc("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"}),xc("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 Lu}from"react/jsx-runtime";var fs=({style:e,...t})=>Lu("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:Lu("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 E2={google:{name:"Google",component:ss},discord:{name:"Discord",component:ns},github:{name:"Github",component:is},linkedin:{name:"LinkedIn",component:ps},twitter:{name:"Twitter",component:fs},spotify:{name:"Spotify",component:us},instagram:{name:"Instagram",component:cs},tiktok:{name:"Tiktok",component:ms},apple:{name:"Apple",component:os}},Wi=e=>E2[e];function Ou(e,t){let r={detail:"",retryable:!1},o=_c(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=Wi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Wi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Li(){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");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:rs(),popupFlow:window.opener!==null}}function Zo(){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"),Z.del($o),window.history.replaceState({},"",e)}var Jo=class{constructor(t){this.initAuthenticateOnce=new De(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new De(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new E("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new E("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 E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("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(Kp,{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 E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ie(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("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($p,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ie(r)}}async _initAuthenticateOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(qp,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(zp,{})}_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 Qo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ var fc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var gp=(e,t,r)=>(fc(e,t,"read from private field"),r?r.call(e):t.get(e)),Wa=(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)},hc=(e,t,r,o)=>(fc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var vp=(e,t,r)=>(fc(e,t,"access private method"),r);import{getAddress as dc}from"@ethersproject/address";import{Web3Provider as mp}from"@ethersproject/providers";import{createStore as Ub}from"mipd";import{useEffect as Or,useMemo as Fb,useRef as _i,useState as $e}from"react";import{FetchError as l2}from"ofetch";var Ge=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}]`:""}`}},wr=class extends Ge{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},E=class extends Ge{constructor(r,o,n){super(r,o,n);this.type="client_error"}},La=class extends E{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var te=class extends Ge{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ie=e=>{if(e instanceof Ge)return e;if(!(e instanceof l2))return ut(e);if(!e.response)return new wr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new wr(t||"ApiError",e.response.status,r||o,e,n)},ut=e=>e instanceof Ge?e:e instanceof Error?new E(e.message,e):new E(`Internal error: ${e}`);var Nr=class extends E{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},bt=class extends E{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Oa=class extends E{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var sr=class extends E{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 Na="/api/v1/sessions",Da="/api/v1/sessions/logout",Cp="/api/v1/sessions/fork",Ua="/api/v1/sessions/fork/recover",wp="/api/v1/siwe/init",bp="/api/v1/siwe/authenticate",Ep="/api/v1/siwe/link",Tp="/api/v1/siwe/unlink",Pp="/api/v1/farcaster/init",Sp="/api/v1/farcaster/authenticate",_p="/api/v1/farcaster/link",xp="/api/v1/farcaster/status",Ap="/api/v1/farcaster/unlink",kp="/api/v1/passwordless/init",Rp="/api/v1/passwordless/authenticate",Ip="/api/v1/passwordless/link",Mp="/api/v1/passwordless/unlink",Wp="/api/v1/passwordless/update",Lp="/api/v1/passwordless_sms/init",Op="/api/v1/passwordless_sms/link",Np="/api/v1/passwordless_sms/unlink",Dp="/api/v1/passwordless_sms/authenticate",Up="/api/v1/oauth/init",Fp="/api/v1/oauth/authenticate",Bp="/api/v1/oauth/link",Hp="/api/v1/oauth/unlink",Gp="/api/v1/recovery/oauth/init",Vp="/api/v1/recovery/oauth/authenticate",zp="/api/v1/passkeys/link/init",qp="/api/v1/passkeys/authenticate/init",$p="/api/v1/passkeys/link",Kp="/api/v1/passkeys/authenticate",jp="/api/v1/passkeys/unlink";var Yp="/api/v1/mfa/passwordless_sms/init",Zp="/api/v1/mfa/passkeys/init",Jp="/api/v1/users/me/accept_terms",Fa="/api/v1/analytics_events",Qp="/api/v1/plugins/moonpay_on_ramp/sign",Xp="/api/v1/custom_jwt_account/authenticate",eu="/api/v1/telegram/authenticate";var Sn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let t=await this.api.post(Xp,{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 ie(t)}}async link(){throw new Error("Unimplemented")}};var go=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Rp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Ip,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ie(t)}}async sendCodeEmail(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new E("Email must be set when initialzing authentication.");try{return await this.api.post(kp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ie(o)}}},Ba=class extends go{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new E("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Wp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ie(r)}}};import{isMobile as p2,isIOS as u2}from"react-device-detect";var yc=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)}},Ha=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 gc(){try{let e="privy:__session_storage__test",t="blobby",r=new Ha;return r.put(e,t),r.del(e),!0}catch{return!1}}function c2(){return typeof window<"u"&&window.localStorage?new Ha:new yc}var Z=c2();import{StaticJsonRpcProvider as xi}from"@ethersproject/providers";function tu(){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 Ga=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 vc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ga(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!vc(r))return!1}return!0},vo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ru=()=>{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 ou=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Va=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,}))$/),nu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Co=(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}`},Cc=e=>new Promise(t=>setTimeout(t,e));function iu(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 au=(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(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Cc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},za=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var su=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),zo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function lu(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of tu()){let u=Ga(c);if(!l.some(f=>f.info.name===u)){if(vc(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(f=>f.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function _n(e){return`eip155:${String(Number(e))}`}var qa=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new te(`No RPC url found for ${e}`);return a},cu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new te(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},to=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new te(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new xi(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new xi(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new xi({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new xi(i.rpcUrls.public.http[0]):a=new xi(i.rpcUrls.default?.http[0]),!a)throw new te(`No RPC url found for ${e}`);return a},$a=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 Ka=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ja))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ja={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 d2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function du(e,t){let r=d2(t);if(r.deepLink)return hu(r.deepLink,e);if(r.universalLink)return yu(r.universalLink,e);throw new E(`Unsupported wallet ${t.id}`)}var pu="WALLETCONNECT_DEEPLINK_CHOICE";function uu(){try{localStorage.removeItem(pu)}catch{}}function mu({href:e,name:t}){try{localStorage.setItem(pu,JSON.stringify({href:e,name:t}))}catch{}}function fu(e){return e.startsWith("http://")||e.startsWith("https://")}function hu(e,t){if(fu(e))return yu(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 yu(e,t){if(!fu(e))return hu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ya(e,t){window.open(e,t,"noreferrer noopener")}var De=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Ai=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new De(this._startChannelOnce.bind(this)),this.pollForReady=new De(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");try{let t=await this.api.post(Sp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new E("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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{return await this.api.post(_p,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ie(t)}}async _startChannelOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=await this.api.post(Pp,{token:this.captchaToken});p2&&!u2&&t.connect_uri&&Ya(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new E("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");let t=await this.api.get(xp,{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 gu="1.65.1-beta-20240516231023";var vu="34357d3c125c2bcf2ce2bc3309d98715",Za="https://auth.privy.io",Cu=2e4,We=1400,wu=2500,wc=gu;var qo="privy:token",bc="privy-token",Ja="privy:refresh_token",Ec="privy-refresh-token",Qa="privy-session",ki="privy:session_transfer_token",f2="privy:wallet",Ri="privy:caid",$o="privy:state_code",Ko="privy:code_verifier",jo="privy:headless_oauth",Xa=e=>`${f2}:${e}`,Tc="privy:connectors",Pc="privy:connections";var Yo=12e4,ro=1,Sc="0x1",xn=3e4,bu="https://api.moonpay.com/v1",Eu="https://api.moonpay.com/v1",Tu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Pu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Su="0x420000000000000000000000000000000000000F",_u=["function getL1Fee(bytes memory _data) external view returns (uint256)"];import{base64url as ku}from"jose";async function xu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Au(e){return crypto.getRandomValues(new Uint8Array(e))}var h2="S256",y2="S256";function Ii(){return ku.encode(Au(36))}function es(){return Ii()}async function ts(e,t=h2){if(t==y2){let r=await xu(e);return ku.encode(r)}else return e}function Ru(){let e=Z.get(Ko);if(!e)throw new E("Authentication error.");return e}function rs(){return!!Z.get(jo)}var Dr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:rs();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 E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=Ru();try{let r=await this.api.post(Fp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),this.meta.headless&&Z.del(jo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=ie(r);throw o.privyErrorCode?new E(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=Z.get(Ko);if(!t)throw new E("Authentication error.");try{let r=await this.api.post(Bp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(Ko),r}catch(r){throw ie(r)}}async getAuthorizationUrl(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.provider)throw new E("Provider must be set when initializing OAuth authentication.");let t=Ii();Z.put(Ko,t);let r=es();Z.put($o,r);let o=await ts(t);this.meta.headless&&Z.put(jo,!0);try{return await this.api.post(Up,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ie(n)}}};function _c(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Iu,jsxs as g2}from"react/jsx-runtime";var os=({style:e,...t})=>g2("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:[Iu("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"}),Iu("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 Mi,jsxs as v2}from"react/jsx-runtime";var ns=({style:e,...t})=>v2("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:[Mi("g",{clipPath:"url(#clip0)",children:Mi("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"})}),Mi("defs",{children:Mi("clipPath",{id:"clip0",children:Mi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Mu}from"react/jsx-runtime";var is=({style:e,...t})=>Mu("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:Mu("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{jsx as as,jsxs as C2}from"react/jsx-runtime";var ss=({style:e,...t})=>C2("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:[as("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"}),as("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"}),as("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"}),as("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 lr,jsxs as ls}from"react/jsx-runtime";function cs(e){return ls("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:[ls("defs",{children:[ls("linearGradient",{id:"b",children:[lr("stop",{offset:"0",stopColor:"#3771c8"}),lr("stop",{stopColor:"#3771c8",offset:".128"}),lr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),ls("linearGradient",{id:"a",children:[lr("stop",{offset:"0",stopColor:"#fd5"}),lr("stop",{offset:".1",stopColor:"#fd5"}),lr("stop",{offset:".5",stopColor:"#ff543e"}),lr("stop",{offset:"1",stopColor:"#c837ab"})]}),lr("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"}),lr("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"})]}),lr("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)"}),lr("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)"}),lr("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 ds}from"react/jsx-runtime";function ps({style:e,...t}){return ds("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:ds("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:ds("g",{transform:"scale(5.12,5.12)",children:ds("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 Wu,jsxs as w2}from"react/jsx-runtime";function us(e){return w2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Wu("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"}),Wu("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 xc,jsxs as b2}from"react/jsx-runtime";function ms(e){return b2("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:[xc("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"}),xc("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"}),xc("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 Lu}from"react/jsx-runtime";var fs=({style:e,...t})=>Lu("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:Lu("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 E2={google:{name:"Google",component:ss},discord:{name:"Discord",component:ns},github:{name:"Github",component:is},linkedin:{name:"LinkedIn",component:ps},twitter:{name:"Twitter",component:fs},spotify:{name:"Spotify",component:us},instagram:{name:"Instagram",component:cs},tiktok:{name:"Tiktok",component:ms},apple:{name:"Apple",component:os}},Wi=e=>E2[e];function Ou(e,t){let r={detail:"",retryable:!1},o=_c(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=Wi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Wi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Li(){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");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:rs(),popupFlow:window.opener!==null}}function Zo(){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"),Z.del($o),window.history.replaceState({},"",e)}var Jo=class{constructor(t){this.initAuthenticateOnce=new De(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new De(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new E("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new E("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 E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("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(Kp,{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 E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ie(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("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($p,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ie(r)}}async _initAuthenticateOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(qp,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(zp,{})}_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 Qo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
2
2
  ${r}
3
3
 
4
4
  ${l}
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${a}
10
10
  Issued At: ${i}
11
11
  Resources:
12
- - https://privy.io`;this.getNonceOnce=new De(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(bp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Ep,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ie(t)}}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new E("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(wp,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var Xo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Dp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Op,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ie(t)}}async sendSmsCode(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Lp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ie(o)}}};var Oi=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let t=await this.api.post(eu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ie(t)}}async link(){throw new Error("Unimplemented")}};function Ac(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}import{v4 as f3}from"uuid";function K(e){return e?new Date(e*1e3):null}function P2(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,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at),chainType:"ethereum",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"email":let i={address:r.address,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let f={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(f);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(h);break;case"tiktok_oauth":let y={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let v={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(v);break;case"apple_oauth":let g={subject:r.subject,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(g);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)});break;case"farcaster":let S={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:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(S);break;case"passkey":let b={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(b);break;case"telegram":let w={type:r.type,telegramUserId:r.telegramUserId,firstName:r.firstName,username:r.username,verifiedAt:K(r.first_verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(w);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Gt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var _e=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,T2=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),kt=(e,t)=>t==="all-users"&&!_e(e)||t==="users-without-wallets"&&!T2(e)?.length;function cr(e){if(!e)return null;let t=P2(e.linked_accounts),r=Gt(t,"wallet"),o=Gt(t,"email"),n=Gt(t,"phone"),i=Gt(t,"google_oauth"),a=Gt(t,"twitter_oauth"),l=Gt(t,"discord_oauth"),s=Gt(t,"github_oauth"),c=Gt(t,"spotify_oauth"),u=Gt(t,"instagram_oauth"),f=Gt(t,"tiktok_oauth"),h=Gt(t,"linkedin_oauth"),y=Gt(t,"apple_oauth"),v=Gt(t,"farcaster"),g=e.mfa_methods.map(({type:b,verified_at:w})=>({type:b,verifiedAt:K(w)}));return{id:e.id,createdAt:K(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},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:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:y&&{subject:y.subject,email:y.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},mfaMethods:g.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Em}from"@ethersproject/address";import{isHexString as l3}from"@ethersproject/bytes";import c3 from"eventemitter3";import L2 from"@coinbase/wallet-sdk";import{jsx as Nu,jsxs as S2}from"react/jsx-runtime";var hs=({style:e,...t})=>S2("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:[Nu("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Nu("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 Fr}from"@ethersproject/address";import{Web3Provider as Gu}from"@ethersproject/providers";import{default as M2}from"eventemitter3";import I2 from"eventemitter3";var _2=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Du=e=>_2.includes(e);import{ErrorCode as x2}from"@ethersproject/logger";var An=class extends te{constructor(){super("Wallet timeout");this.type="wallet_error"}},kn=class extends te{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof te)return e;if(e?.code&&e?.reason){let t=new Ue(e);return e.code===x2.ACTION_REJECTED&&(t.details=it.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ue(e):new te("Unknown connector error",e)},Vt=class extends Ge{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ue=class extends Vt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(it).find(i=>i.eipCode===o.code);this.details=n||it.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=it.E32002_CONNECTION_ALREADY_PENDING:this.details=it.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=it.E32002_WALLET_LOCKED))}},A2={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}},k2={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},R2={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},it={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...R2,...k2},oo={...A2,...it};var Le=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 An,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||Yo,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 te(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw br(r)})}},wo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ys=class extends I2{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=to(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Rn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new wo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await xe()||!this.address)throw new wo("Disconnected",4900);return(await Bu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new wo(`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 wo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=to(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];return await Uu(o)}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 Fu($a(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:zo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}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 zo(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(Du(r.method)){let o=await xe();if(await Hu(),!o||!this.address)throw new wo("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 wo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await xe();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}}},Ur=class extends Le{constructor(r){super(r,r.rpcTimeoutDuration)}},bo=class extends Le{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 W2=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Rt=class extends M2{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=_n(r),this.walletClientType==="privy"&&Z.put(Xa(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=Rn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>Fr(a.address)===Fr(r));return{address:Fr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new te("Wallet is not currently connected.");let l=this.wallets.find(h=>Fr(h.address)===Fr(r))?.chainId;if(!l)throw new te("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===_n(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new te(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(h){if(W2(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new te(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return new Gu(new Ur(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return new bo(this.proxyProvider)},sign:async a=>{if(!await i())throw new te("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Fr(n),a=[],l;if(this.walletClientType==="privy"){let c=Z.get(Xa(i));this.chains.find(u=>u.id===Number(c))||(Z.del(Xa(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 this.proxyProvider.request({method:"eth_chainId"});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 ${Sc}`,c),l=Sc}let s=_n(l);if(!a.find(c=>Fr(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(Fr(n),s,c))}gs(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=>Fr(n)===Fr(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 Gu(new Ur(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 In={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 O2=(e,t)=>{let o=qa(1,[In],{},t);return e.makeWeb3Provider(o,1)},vs,Cs=class extends Rt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;vs||(vs=new L2({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(O2(vs,i))}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(){vs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:hs,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 te("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as Vu}from"react/jsx-runtime";var ws=({...e})=>Vu("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Vu("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 bs=class extends Rt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,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:[zo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ws,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as zu}from"react/jsx-runtime";var Mn=({style:e,...t})=>zu("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:zu("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 zt,jsxs as N2}from"react/jsx-runtime";var Wn=({style:e,...t})=>N2("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:[zt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),zt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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 qu,jsxs as D2}from"react/jsx-runtime";var Br=({style:e,...t})=>D2("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:[qu("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),qu("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 On=class extends Rt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Le(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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},Ln,Nn=class extends Rt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Wa(this,Ln,void 0);this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?hc(this,Ln,{name:"MetaMask",icon:Wn,id:"io.metamask"}):a==="phantom"&&hc(this,Ln,{name:"Phantom",icon:Br,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 gp(this,Ln)??{name:"Browser Extension",icon:Mn,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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};Ln=new WeakMap;import{getAddress as yT}from"@ethersproject/address";import{Web3Provider as vT}from"@ethersproject/providers";import{isMobile as U2}from"react-device-detect";var Es=class extends On{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{U2||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 te("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Ps=class extends Rt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Le(void 0,Yo);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 Ts=class extends Ps{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Br,id:"phantom"}}};import{EthereumProvider as n3,OPTIONAL_EVENTS as i3,OPTIONAL_METHODS as a3}from"@walletconnect/ethereum-provider";import{isMobile as s3}from"react-device-detect";import{createContext as Z2,useContext as J2,useEffect as Mc,useRef as Q2,useState as X2}from"react";import{jsx as F2}from"react/jsx-runtime";function Ss({src:e,...t}){return F2("img",{src:e,...t,style:{display:"none"}})}import{useContext as ym,useEffect as hm,useMemo as $2,useState as K2}from"react";import{createContext as j2}from"react";var qt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:vu,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var $u=({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 B2=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),Ku=e=>B2.has(e),ju=(e,t,r)=>r.indexOf(e)===t,Yu=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ku).filter(ju):e?e.filter(Ku).filter(ju):qt.appearance.walletList;var _s={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 xs={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var As={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 Zu={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 Ju={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 ks={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 Rs={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Is={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 Qu={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 Xu={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 em={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 tm={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 rm={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 om={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 nm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var im={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 am={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 sm={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 Ms={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 Ws={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Ls={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 Ni={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 Di={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var lm={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 cm={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 dm={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 Os={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 Ns={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 Ds={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 Ui=[_s,xs,As,nm,dm,In,Ms,Ws,Ls,Ni,Di,Xu,em,tm,rm,ks,Rs,Is,Qu,am,sm,Zu,Ju,Os,Ds,Ns,im,lm,om,cm],VS=new Set(Ui.map(e=>e.id));import en from"tinycolor2";var pm="#FFFFFF",H2="#000000",G2=pm,V2="#1E1E1D";function z2(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 no(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return en({...e.toHsl(),l:r})}function um({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=pm,blackHex:a=H2}){let l;switch(e){case"light":l=G2;break;case"dark":l=V2;break;default:l=e;break}let s=en(l),c=en(t),u=en(r),f=en(o),h=en(n),y=z2(s.getLuminance()),v=no(s,y==="light"?-.04:.11),g=no(s,y==="light"?-.88:.87),S=no(s,y==="light"?-.77:.75),b=no(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),w=no(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),I=no(c,.15),A=no(c,-.06),O=no(h,.3),R=en(c.getLuminance()>.5?a:i),k=no(u,-.16);return{colorScheme:y,background:s.toHslString(),background2:v.toHslString(),foreground:g.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:w.toHslString(),accent:c.toHslString(),accentLight:I.toHslString(),accentDark:A.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:k.toHslString(),error:h.toHslString(),errorLight:O.toHslString(),warn:f.toHslString()}}function kc(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,u,f,h,y,v,g,S,b,w;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"),u=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),y=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("github"),v=t.loginMethods.includes("linkedin"),S=t.loginMethods.includes("apple"),b=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,g=e.githubOAuth,h=e.spotifyOAuth,y=e.instagramOAuth,f=e.tiktokOAuth,v=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth,w=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let I=[n,i].filter(Boolean),A=[s,c,u,g,h,y,f,v,S,b,w].filter(Boolean),O=[l].filter(Boolean);if(I.length+A.length+O.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&O.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&A.length+I.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let k=Yu({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=$u({input:t?.loginMethodsAndOrder}),q=t?.intl?.defaultCountry??"US",{chains:j,defaultChain:W}=q2({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),$=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ue,ce=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?D?ue=t?.embeddedWallets?.noPromptOnSignature??!0:ue=t?.embeddedWallets?.noPromptOnSignature??ce:ue=ce,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ue!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:de,...ve}=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??qt.appearance.landingHeader,palette:um({backgroundTheme:t?.appearance?.theme??qt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??qt.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:k},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:u,github:g,spotify:h,instagram:y,tiktok:f,linkedin:v,apple:S,farcaster:b,telegram:w},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??qt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??qt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??qt.rpcConfig.rpcTimeouts},chains:j,defaultChain:W,intl:{defaultCountry:q},shouldEnforceDefaultChainOnConnect:$,captchaEnabled:e.captchaEnabled??qt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof de=="boolean"?{requireUserOwnedRecoveryOnCreate:de}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ve,noPromptOnSignature:ue},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:D?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??qt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??qt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??qt._render.inParentNodeId}}}function mm(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,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function q2({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:Ui.find(u=>u.id===s.id)??s)}else n=Ui.concat(e??[]);let i=t?n[0]:In,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 fm=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 Y2}from"react/jsx-runtime";var gm={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:""},Rc=kc(gm,void 0,!1),Ic=j2({appConfig:Rc,isServerConfigLoaded:!1}),vm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=K2(null),a=$2(()=>kc(n??gm,o,!!n),[n,o]);return hm(()=>{if(!n)return;let l=mm(o,t),s=fm(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]),hm(()=>{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)}})()},[]),Y2(Ic.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},dr=()=>{let{appConfig:e}=ym(Ic);return e},Us=()=>{let{isServerConfigLoaded:e}=ym(Ic);return e};var P=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as t3,jsxs as r3}from"react/jsx-runtime";var Cm=Z2({ready:!1,app:Rc,currentScreen:null,lastScreen:null,navigate:P,navigateBack:P,resetNavigation:P,setModalData:P,onUserCloseViaDialogOrKeybindRef:void 0}),e3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],wm=e=>{let t=dr(),r=e.authenticated,[o,n]=X2(e.initialScreen);Mc(()=>{!r&&!e3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=Q2(null);Mc(()=>{e.open||(i.current=null)},[e.open]),Mc(()=>{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 r3(Cm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&t3(Ss,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>J2(Cm);import{jsx as Dn,jsxs as o3}from"react/jsx-runtime";var Fi=({style:e,...t})=>{let{app:r}=_();return o3("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:[Dn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Dn("g",{clipPath:"url(#clip0_1765_9946)",children:Dn("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"})}),Dn("defs",{children:Dn("clipPath",{id:"clip0_1765_9946",children:Dn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Hr=class extends Rt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ja[s],this.walletClientType=s)}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=Ka(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:Wn,id:"io.metamask"}:{name:su(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Fi,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=ja[r],this.walletClientType=r,this.redirectUri=void 0,uu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new kn)};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 te("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Rn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(br(a));return}o(new te("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=qa(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 n3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:i3,optionalMethods:a3,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),s3&&this.walletEntry){let{redirect:l,href:s}=du(a,this.walletEntry);mu({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ya(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=Ka(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 Wc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>l3(o)).map(o=>Em(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Rn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Yo:Yo,Bi=class extends c3{constructor(r,o,n,i,a,l,s,c,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 Le: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.privyAppName=u,this.storedConnections=bm()}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;Z.get(Pc)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(Pc));let r=lu(this.store,this.walletList).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"),!vo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),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 ys(r,o,this.rpcConfig,this.chains,i,n.id),s=new bs(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=bm(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Hr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Es(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Cs(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new Ts(this.defaultChain):new Hr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,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()}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Z.put(Tc,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=Em(r),this.emit("walletsUpdated")}};function gs(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",bm=()=>{let e=Z.get(Tc);return e&&Array.isArray(e)&&e.map(o=>d3(o)).every(Boolean)?e:[]};import{ofetch as p3}from"ofetch";var u3=[Na,Ua,Da,Fa],Fs=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=wc,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=p3.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:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=u3.includes(n.toString());if(!a.has("authorization")){let s=await this.client.getAccessToken({disableAutoRefresh:l});s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new La}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ie(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ie(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ie(o)}}};var Pm=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 tn from"js-cookie";function Tm(e){return e instanceof go?"email":e instanceof Xo?"sms":e instanceof Qo?"siwe":e instanceof Sn?"custom_auth":e instanceof Dr?e.meta.provider:null}import*as Sm from"jose";var Gr=class{static parse(t){try{return new Gr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Sm.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 m3=30,Bs=class{constructor(){this.authenticateOnce=new De(async t=>this._authenticate(t)),this.linkOnce=new De(async t=>this._link(t)),this.refreshOnce=new De(this._refresh.bind(this)),this.destroyOnce=new De(this._destroy.bind(this)),this.forkSessionOnce=new De(this._forkSession.bind(this))}get token(){try{let t=Z.get(qo);return typeof t=="string"?new Gr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get(Ja);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=tn.get(Qa);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"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Gr.parse(this.token);return t!==null&&!t.isExpired(m3)}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()}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,l=Tm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:cr(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),ut(r)}}async _link(t){try{let r=await t.link();return cr(r)}catch(r){throw console.warn("Error linking account"),ut(r)}}async _refresh(){if(!this.api)throw new E("Session has no API instance");if(!this.client)throw new E("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;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(Na,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ua,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),cr(n.user)}catch(n){if(n instanceof wr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ut(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(Da,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new E("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Cp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw ut(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Z.get(qo);if(Z.put(qo,t),!this.client?.useServerCookies){let o=Gr.parse(t)?.expiration;tn.set(bc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Z.del(qo),tn.remove(bc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Z.put(Ja,t),this.client?.useServerCookies||(tn.set(Qa,"t",{sameSite:"Strict",secure:!0,expires:30}),tn.set(Ec,t,{sameSite:"Strict",secure:!0,expires:30}))):(Z.del(Ja),tn.remove(Ec),tn.remove(Qa))}clearForkedToken(){Z.del(ki)}};var Lc,Hs,_m,Hi=class{constructor(t){Wa(this,Hs);this.apiUrl=t.apiUrl||Za,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Cu,this.appId=t.appId,this.clientAnalyticsId=vp(this,Hs,_m).call(this),Lc||(Lc=new Bs),this.session=Lc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Bi(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Fs(this.appId,this,{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 E("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new E("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Yp,{action:"verify"})}catch(t){throw ie(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Zp,{});return Pm(t.options)}catch(t){throw ie(t)}}async unlinkEmail(t){try{let r=await this.api.post(Mp,{address:t});return cr(r)}catch(r){throw ut(r)}}async acceptTerms(){try{let t=await this.api.post(Jp,{});return cr(t)}catch(t){throw ut(t)}}async unlinkPhone(t){try{let r=await this.api.post(Np,{phoneNumber:t});return cr(r)}catch(r){throw ut(r)}}async unlinkWallet(t){try{let r=await this.api.post(Pp,{address:t});return cr(r)}catch(r){throw ut(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Hp,{provider:t,subject:r});return cr(o)}catch(o){throw ut(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ap,{fid:t});return cr(r)}catch(r){throw ut(r)}}async unlinkPasskey(t){try{let r=await this.api.post(jp,{credential_id:t});return cr(r)}catch(r){throw ut(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(Fa,{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(Qp,t)}catch(r){throw ut(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Gr.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}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw ut(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()}};Hs=new WeakSet,_m=function(){if(typeof window>"u")return null;try{let r=Z.get(Ri);if(typeof r=="string"&&r.length>0)return r}catch{}let t=f3();try{return Z.put(Ri,t),t}catch{return t}};import{Turnstile as w3}from"@marsidev/react-turnstile";import{useEffect as b3,useMemo as E3}from"react";import{useMemo as h3,useRef as y3,useContext as g3,useState as Oc,createContext as v3}from"react";import{jsx as C3}from"react/jsx-runtime";var xm=v3({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:P,setError:P,setExecuting:P,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:P,reset:P,execute:P}),Er=class extends Ge{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Am=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=y3(null),[i,a]=Oc(),[l,s]=Oc(),[c,u]=Oc(!1),f=h3(()=>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 C3(xm.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await iu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Er("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>g3(xm);import{jsx as km}from"react/jsx-runtime";var Nc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=fe(),[,s]=E3(()=>r?.split("t:")||[],[r]);if(b3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return km("div",{className:"hidden h-0 w-0",children:km(w3,{...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 wb,useEffect as Bg,useRef as bb,useState as Eb}from"react";import Pb from"react-dom";import{createContext as P3,useContext as T3}from"react";var Dc=P3({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:P,initializeWalletProxy:P,getAuthMeta:P,getAuthFlow:P,closePrivyModal:P,openPrivyModal:P,connectWallet:P,initLoginWithWallet:P,loginWithWallet:P,initLoginWithFarcaster:P,loginWithFarcaster:P,loginWithCode:P,initLoginWithEmail:P,initLoginWithSms:P,initUpdateEmail:P,resendEmailCode:P,resendSmsCode:P,initLoginWithHeadlessOAuth:P,loginWithHeadlessOAuth:P,initLoginWithOAuth:P,recoveryOAuthFlow:P,loginWithOAuth:P,initLoginWithPasskey:P,loginWithPasskey:P,initLinkWithPasskey:P,linkWithPasskey:P,refreshUser:P,walletProxy:null,createAnalyticsEvent:P,acceptTerms:P,getUsdTokenPrice:P,recoverEmbeddedWallet:P,getFiatOnRampConfig:P,updateWallets:P,fundWallet:P,setReadyToTrue:P,requestFarcasterSignerStatus:P,initLoginWithTelegram:P,loginWithTelegram:P}),M=()=>T3(Dc);import{createContext as S3,useContext as _3}from"react";var ye=S3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:P,login:P,connectOrCreateWallet:P,linkEmail:P,linkPhone:P,linkFarcaster:P,linkWallet:P,linkGoogle:P,linkTwitter:P,linkDiscord:P,linkGithub:P,linkSpotify:P,linkInstagram:P,linkTiktok:P,linkLinkedIn:P,linkApple:P,linkPasskey:P,updateEmail:P,logout:P,getAccessToken:P,getEthereumProvider:P,getEthersProvider:P,getWeb3jsProvider:P,unlinkEmail:P,unlinkPhone:P,unlinkWallet:P,unlinkGoogle:P,unlinkTwitter:P,unlinkDiscord:P,unlinkGithub:P,unlinkSpotify:P,unlinkInstagram:P,unlinkTiktok:P,unlinkLinkedIn:P,unlinkApple:P,unlinkFarcaster:P,unlinkPasskey:P,setActiveWallet:P,forkSession:P,createWallet:P,signMessage:P,signTypedData:P,enrollInMfa:P,initEnrollmentWithSms:P,initEnrollmentWithTotp:P,initEnrollmentWithPasskey:P,promptMfa:P,init:P,submitEnrollmentWithSms:P,submitEnrollmentWithTotp:P,submitEnrollmentWithPasskey:P,unenroll:P,submit:P,cancel:P,sendTransaction:P,exportWallet:P,setWalletPassword:P,requestFarcasterSignerFromWarpcast:P,getFarcasterSignerPublicKey:P,signFarcasterMessage:P,initLoginWithEmail:P,initLoginWithSms:P,otpState:{status:"initial"},loginWithCode:P,fundWallet:P,initLoginWithHeadlessOAuth:P,loginWithHeadlessOAuth:P,isHeadlessOAuthLoading:!1,isModalOpen:!1}),F=()=>_3(ye);import{useEffect as x3,useState as A3}from"react";var Rm=e=>{let[t,r]=A3("auto");return x3(()=>{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 k3,useContext as R3,useEffect as I3}from"react";var Im={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Uc=k3(void 0),Mm=()=>R3(Uc);function Fe(e,t){if(!t)return;let o=Mm().current[e];return I3(()=>{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 Gs(){let e=Mm();return(t,r,...o)=>U(e,t,r,...o)}function Fc(e){Fe("configureMfa",e)}import Bm from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Z3 from"@heroicons/react/24/solid/DocumentCheckIcon";import J3 from"styled-components";import rn,{css as Vc}from"styled-components";import Hc from"styled-components";import{Fragment as W3,jsx as Bc,jsxs as L3}from"react/jsx-runtime";var Xe=({success:e,fail:t})=>L3(W3,{children:[Bc(et,{className:e?"success":t?"fail":""}),Bc(Gc,{className:e?"success":t?"fail":""})]}),et=Hc.span`
12
+ - https://privy.io`;this.getNonceOnce=new De(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(bp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Ep,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ie(t)}}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new E("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(wp,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var Xo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Dp,{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 ie(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Op,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ie(t)}}async sendSmsCode(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Lp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ie(o)}}};var Oi=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let t=await this.api.post(eu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ie(t)}}async link(){throw new Error("Unimplemented")}};function Ac(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}import{v4 as f3}from"uuid";function K(e){return e?new Date(e*1e3):null}function T2(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,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at),chainType:"ethereum",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"email":let i={address:r.address,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let f={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(f);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(h);break;case"tiktok_oauth":let y={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let v={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(v);break;case"apple_oauth":let g={subject:r.subject,email:r.email,type:r.type,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(g);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)});break;case"farcaster":let S={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:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(S);break;case"passkey":let b={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:K(r.verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(b);break;case"telegram":let w={type:r.type,telegramUserId:r.telegramUserId,firstName:r.firstName,username:r.username,verifiedAt:K(r.first_verified_at),firstVerifiedAt:K(r.first_verified_at),latestVerifiedAt:K(r.latest_verified_at)};t.push(w);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Gt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var _e=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,P2=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),kt=(e,t)=>t==="all-users"&&!_e(e)||t==="users-without-wallets"&&!P2(e)?.length;function cr(e){if(!e)return null;let t=T2(e.linked_accounts),r=Gt(t,"wallet"),o=Gt(t,"email"),n=Gt(t,"phone"),i=Gt(t,"google_oauth"),a=Gt(t,"twitter_oauth"),l=Gt(t,"discord_oauth"),s=Gt(t,"github_oauth"),c=Gt(t,"spotify_oauth"),u=Gt(t,"instagram_oauth"),f=Gt(t,"tiktok_oauth"),h=Gt(t,"linkedin_oauth"),y=Gt(t,"apple_oauth"),v=Gt(t,"farcaster"),g=e.mfa_methods.map(({type:b,verified_at:w})=>({type:b,verifiedAt:K(w)}));return{id:e.id,createdAt:K(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},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:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:y&&{subject:y.subject,email:y.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},mfaMethods:g.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Em}from"@ethersproject/address";import{isHexString as l3}from"@ethersproject/bytes";import c3 from"eventemitter3";import L2 from"@coinbase/wallet-sdk";import{jsx as Nu,jsxs as S2}from"react/jsx-runtime";var hs=({style:e,...t})=>S2("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:[Nu("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Nu("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 Fr}from"@ethersproject/address";import{Web3Provider as Gu}from"@ethersproject/providers";import{default as M2}from"eventemitter3";import I2 from"eventemitter3";var _2=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Du=e=>_2.includes(e);import{ErrorCode as x2}from"@ethersproject/logger";var An=class extends te{constructor(){super("Wallet timeout");this.type="wallet_error"}},kn=class extends te{constructor(){super("User rejected connection");this.type="wallet_error"}},br=e=>{if(e instanceof te)return e;if(e?.code&&e?.reason){let t=new Ue(e);return e.code===x2.ACTION_REJECTED&&(t.details=it.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ue(e):new te("Unknown connector error",e)},Vt=class extends Ge{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ue=class extends Vt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(it).find(i=>i.eipCode===o.code);this.details=n||it.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=it.E32002_CONNECTION_ALREADY_PENDING:this.details=it.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=it.E32002_WALLET_LOCKED))}},A2={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}},k2={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},R2={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},it={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...R2,...k2},oo={...A2,...it};var Le=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 An,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||Yo,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 te(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw br(r)})}},wo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ys=class extends I2{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=to(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Rn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new wo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await xe()||!this.address)throw new wo("Disconnected",4900);return(await Bu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new wo(`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 wo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=to(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];return await Uu(o)}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 Fu($a(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:zo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}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 zo(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(Du(r.method)){let o=await xe();if(await Hu(),!o||!this.address)throw new wo("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 wo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await xe();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}}},Ur=class extends Le{constructor(r){super(r,r.rpcTimeoutDuration)}},bo=class extends Le{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 W2=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Rt=class extends M2{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=_n(r),this.walletClientType==="privy"&&Z.put(Xa(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=Rn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>Fr(a.address)===Fr(r));return{address:Fr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new te("Wallet is not currently connected.");let l=this.wallets.find(h=>Fr(h.address)===Fr(r))?.chainId;if(!l)throw new te("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===_n(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new te(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(h){if(W2(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new te(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return new Gu(new Ur(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new te("Wallet is not currently connected.");return new bo(this.proxyProvider)},sign:async a=>{if(!await i())throw new te("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Fr(n),a=[],l;if(this.walletClientType==="privy"){let c=Z.get(Xa(i));this.chains.find(u=>u.id===Number(c))||(Z.del(Xa(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 this.proxyProvider.request({method:"eth_chainId"});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 ${Sc}`,c),l=Sc}let s=_n(l);if(!a.find(c=>Fr(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(Fr(n),s,c))}gs(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=>Fr(n)===Fr(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 Gu(new Ur(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 In={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 O2=(e,t)=>{let o=qa(1,[In],{},t);return e.makeWeb3Provider(o,1)},vs,Cs=class extends Rt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;vs||(vs=new L2({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(O2(vs,i))}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(){vs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:hs,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 te("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};import{jsx as Vu}from"react/jsx-runtime";var ws=({...e})=>Vu("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Vu("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 bs=class extends Rt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,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:[zo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ws,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as zu}from"react/jsx-runtime";var Mn=({style:e,...t})=>zu("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:zu("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 zt,jsxs as N2}from"react/jsx-runtime";var Wn=({style:e,...t})=>N2("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:[zt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),zt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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"}),zt("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 qu,jsxs as D2}from"react/jsx-runtime";var Br=({style:e,...t})=>D2("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:[qu("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),qu("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 On=class extends Rt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Le(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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}},Ln,Nn=class extends Rt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Wa(this,Ln,void 0);this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?hc(this,Ln,{name:"MetaMask",icon:Wn,id:"io.metamask"}):a==="phantom"&&hc(this,Ln,{name:"Phantom",icon:Br,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 gp(this,Ln)??{name:"Browser Extension",icon:Mn,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 te("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw br(r)}}};Ln=new WeakMap;import{getAddress as yP}from"@ethersproject/address";import{Web3Provider as vP}from"@ethersproject/providers";import{isMobile as U2}from"react-device-detect";var Es=class extends On{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{U2||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 te("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw br(t)}}};var Ts=class extends Rt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Le(void 0,Yo);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 Ps=class extends Ts{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Br,id:"phantom"}}};import{EthereumProvider as n3,OPTIONAL_EVENTS as i3,OPTIONAL_METHODS as a3}from"@walletconnect/ethereum-provider";import{isMobile as s3}from"react-device-detect";import{createContext as Z2,useContext as J2,useEffect as Mc,useRef as Q2,useState as X2}from"react";import{jsx as F2}from"react/jsx-runtime";function Ss({src:e,...t}){return F2("img",{src:e,...t,style:{display:"none"}})}import{useContext as ym,useEffect as hm,useMemo as $2,useState as K2}from"react";import{createContext as j2}from"react";var qt={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:vu,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var $u=({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 B2=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),Ku=e=>B2.has(e),ju=(e,t,r)=>r.indexOf(e)===t,Yu=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ku).filter(ju):e?e.filter(Ku).filter(ju):qt.appearance.walletList;var _s={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 xs={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var As={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 Zu={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 Ju={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 ks={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 Rs={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Is={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 Qu={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 Xu={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 em={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 tm={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 rm={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 om={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 nm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var im={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 am={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 sm={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 Ms={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 Ws={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Ls={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 Ni={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 Di={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var lm={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 cm={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 dm={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 Os={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 Ns={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 Ds={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 Ui=[_s,xs,As,nm,dm,In,Ms,Ws,Ls,Ni,Di,Xu,em,tm,rm,ks,Rs,Is,Qu,am,sm,Zu,Ju,Os,Ds,Ns,im,lm,om,cm],VS=new Set(Ui.map(e=>e.id));import en from"tinycolor2";var pm="#FFFFFF",H2="#000000",G2=pm,V2="#1E1E1D";function z2(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 no(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return en({...e.toHsl(),l:r})}function um({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=pm,blackHex:a=H2}){let l;switch(e){case"light":l=G2;break;case"dark":l=V2;break;default:l=e;break}let s=en(l),c=en(t),u=en(r),f=en(o),h=en(n),y=z2(s.getLuminance()),v=no(s,y==="light"?-.04:.11),g=no(s,y==="light"?-.88:.87),S=no(s,y==="light"?-.77:.75),b=no(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),w=no(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),I=no(c,.15),A=no(c,-.06),O=no(h,.3),R=en(c.getLuminance()>.5?a:i),k=no(u,-.16);return{colorScheme:y,background:s.toHslString(),background2:v.toHslString(),foreground:g.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:w.toHslString(),accent:c.toHslString(),accentLight:I.toHslString(),accentDark:A.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:k.toHslString(),error:h.toHslString(),errorLight:O.toHslString(),warn:f.toHslString()}}function kc(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,u,f,h,y,v,g,S,b,w;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"),u=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),y=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("github"),v=t.loginMethods.includes("linkedin"),S=t.loginMethods.includes("apple"),b=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,g=e.githubOAuth,h=e.spotifyOAuth,y=e.instagramOAuth,f=e.tiktokOAuth,v=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth,w=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let I=[n,i].filter(Boolean),A=[s,c,u,g,h,y,f,v,S,b,w].filter(Boolean),O=[l].filter(Boolean);if(I.length+A.length+O.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&O.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&A.length+I.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let k=Yu({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=$u({input:t?.loginMethodsAndOrder}),q=t?.intl?.defaultCountry??"US",{chains:j,defaultChain:W}=q2({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),$=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ue,ce=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?D?ue=t?.embeddedWallets?.noPromptOnSignature??!0:ue=t?.embeddedWallets?.noPromptOnSignature??ce:ue=ce,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ue!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:de,...ve}=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??qt.appearance.landingHeader,palette:um({backgroundTheme:t?.appearance?.theme??qt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??qt.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:k},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:u,github:g,spotify:h,instagram:y,tiktok:f,linkedin:v,apple:S,farcaster:b,telegram:w},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??qt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??qt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??qt.rpcConfig.rpcTimeouts},chains:j,defaultChain:W,intl:{defaultCountry:q},shouldEnforceDefaultChainOnConnect:$,captchaEnabled:e.captchaEnabled??qt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof de=="boolean"?{requireUserOwnedRecoveryOnCreate:de}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ve,noPromptOnSignature:ue},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:D?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??qt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??qt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??qt._render.inParentNodeId}}}function mm(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,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function q2({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:Ui.find(u=>u.id===s.id)??s)}else n=Ui.concat(e??[]);let i=t?n[0]:In,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 fm=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 Y2}from"react/jsx-runtime";var gm={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:""},Rc=kc(gm,void 0,!1),Ic=j2({appConfig:Rc,isServerConfigLoaded:!1}),vm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=K2(null),a=$2(()=>kc(n??gm,o,!!n),[n,o]);return hm(()=>{if(!n)return;let l=mm(o,t),s=fm(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]),hm(()=>{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)}})()},[]),Y2(Ic.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},dr=()=>{let{appConfig:e}=ym(Ic);return e},Us=()=>{let{isServerConfigLoaded:e}=ym(Ic);return e};var T=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as t3,jsxs as r3}from"react/jsx-runtime";var Cm=Z2({ready:!1,app:Rc,currentScreen:null,lastScreen:null,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,onUserCloseViaDialogOrKeybindRef:void 0}),e3=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],wm=e=>{let t=dr(),r=e.authenticated,[o,n]=X2(e.initialScreen);Mc(()=>{!r&&!e3.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=Q2(null);Mc(()=>{e.open||(i.current=null)},[e.open]),Mc(()=>{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 r3(Cm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&t3(Ss,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>J2(Cm);import{jsx as Dn,jsxs as o3}from"react/jsx-runtime";var Fi=({style:e,...t})=>{let{app:r}=_();return o3("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:[Dn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Dn("g",{clipPath:"url(#clip0_1765_9946)",children:Dn("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"})}),Dn("defs",{children:Dn("clipPath",{id:"clip0_1765_9946",children:Dn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Hr=class extends Rt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ja[s],this.walletClientType=s)}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=Ka(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:Wn,id:"io.metamask"}:{name:su(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Fi,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=ja[r],this.walletClientType=r,this.redirectUri=void 0,uu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new kn)};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 te("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Rn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(br(a));return}o(new te("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=qa(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 n3.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:i3,optionalMethods:a3,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),s3&&this.walletEntry){let{redirect:l,href:s}=du(a,this.walletEntry);mu({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ya(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=Ka(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 Wc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>l3(o)).map(o=>Em(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Rn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Yo:Yo,Bi=class extends c3{constructor(r,o,n,i,a,l,s,c,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 Le: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.privyAppName=u,this.storedConnections=bm()}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;Z.get(Tc)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(Tc));let r=lu(this.store,this.walletList).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"),!vo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),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 ys(r,o,this.rpcConfig,this.chains,i,n.id),s=new bs(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=bm(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Hr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Es(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Nn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new On(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Cs(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new Ps(this.defaultChain):new Hr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,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()}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Z.put(Pc,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=Em(r),this.emit("walletsUpdated")}};function gs(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",bm=()=>{let e=Z.get(Pc);return e&&Array.isArray(e)&&e.map(o=>d3(o)).every(Boolean)?e:[]};import{ofetch as p3}from"ofetch";var u3=[Na,Ua,Da,Fa],Fs=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=wc,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=p3.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:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=u3.includes(n.toString());if(!a.has("authorization")){let s=await this.client.getAccessToken({disableAutoRefresh:l});s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new La}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ie(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ie(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ie(o)}}};var Tm=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 tn from"js-cookie";function Pm(e){return e instanceof go?"email":e instanceof Xo?"sms":e instanceof Qo?"siwe":e instanceof Sn?"custom_auth":e instanceof Dr?e.meta.provider:null}import*as Sm from"jose";var Gr=class{static parse(t){try{return new Gr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Sm.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 m3=30,Bs=class{constructor(){this.authenticateOnce=new De(async t=>this._authenticate(t)),this.linkOnce=new De(async t=>this._link(t)),this.refreshOnce=new De(this._refresh.bind(this)),this.destroyOnce=new De(this._destroy.bind(this)),this.forkSessionOnce=new De(this._forkSession.bind(this))}get token(){try{let t=Z.get(qo);return typeof t=="string"?new Gr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get(Ja);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=tn.get(Qa);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"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Gr.parse(this.token);return t!==null&&!t.isExpired(m3)}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()}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,l=Pm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:cr(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),ut(r)}}async _link(t){try{let r=await t.link();return cr(r)}catch(r){throw console.warn("Error linking account"),ut(r)}}async _refresh(){if(!this.api)throw new E("Session has no API instance");if(!this.client)throw new E("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;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(Na,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ua,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),cr(n.user)}catch(n){if(n instanceof wr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ut(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(Da,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new E("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Cp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw ut(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Z.get(qo);if(Z.put(qo,t),!this.client?.useServerCookies){let o=Gr.parse(t)?.expiration;tn.set(bc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Z.del(qo),tn.remove(bc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Z.put(Ja,t),this.client?.useServerCookies||(tn.set(Qa,"t",{sameSite:"Strict",secure:!0,expires:30}),tn.set(Ec,t,{sameSite:"Strict",secure:!0,expires:30}))):(Z.del(Ja),tn.remove(Ec),tn.remove(Qa))}clearForkedToken(){Z.del(ki)}};var Lc,Hs,_m,Hi=class{constructor(t){Wa(this,Hs);this.apiUrl=t.apiUrl||Za,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Cu,this.appId=t.appId,this.clientAnalyticsId=vp(this,Hs,_m).call(this),Lc||(Lc=new Bs),this.session=Lc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Bi(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Fs(this.appId,this,{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 E("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new E("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Yp,{action:"verify"})}catch(t){throw ie(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Zp,{});return Tm(t.options)}catch(t){throw ie(t)}}async unlinkEmail(t){try{let r=await this.api.post(Mp,{address:t});return cr(r)}catch(r){throw ut(r)}}async acceptTerms(){try{let t=await this.api.post(Jp,{});return cr(t)}catch(t){throw ut(t)}}async unlinkPhone(t){try{let r=await this.api.post(Np,{phoneNumber:t});return cr(r)}catch(r){throw ut(r)}}async unlinkWallet(t){try{let r=await this.api.post(Tp,{address:t});return cr(r)}catch(r){throw ut(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Hp,{provider:t,subject:r});return cr(o)}catch(o){throw ut(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ap,{fid:t});return cr(r)}catch(r){throw ut(r)}}async unlinkPasskey(t){try{let r=await this.api.post(jp,{credential_id:t});return cr(r)}catch(r){throw ut(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(Fa,{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(Qp,t)}catch(r){throw ut(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Gr.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}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw ut(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()}};Hs=new WeakSet,_m=function(){if(typeof window>"u")return null;try{let r=Z.get(Ri);if(typeof r=="string"&&r.length>0)return r}catch{}let t=f3();try{return Z.put(Ri,t),t}catch{return t}};import{Turnstile as w3}from"@marsidev/react-turnstile";import{useEffect as b3,useMemo as E3}from"react";import{useMemo as h3,useRef as y3,useContext as g3,useState as Oc,createContext as v3}from"react";import{jsx as C3}from"react/jsx-runtime";var xm=v3({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:T,setError:T,setExecuting:T,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:T,reset:T,execute:T}),Er=class extends Ge{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Am=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=y3(null),[i,a]=Oc(),[l,s]=Oc(),[c,u]=Oc(!1),f=h3(()=>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 C3(xm.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await iu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Er("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>g3(xm);import{jsx as km}from"react/jsx-runtime";var Nc=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=fe(),[,s]=E3(()=>r?.split("t:")||[],[r]);if(b3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return km("div",{className:"hidden h-0 w-0",children:km(w3,{...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 wb,useEffect as Bg,useRef as bb,useState as Eb}from"react";import Tb from"react-dom";import{createContext as T3,useContext as P3}from"react";var Dc=T3({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:T,initializeWalletProxy:T,getAuthMeta:T,getAuthFlow:T,closePrivyModal:T,openPrivyModal:T,connectWallet:T,initLoginWithWallet:T,loginWithWallet:T,initLoginWithFarcaster:T,loginWithFarcaster:T,loginWithCode:T,initLoginWithEmail:T,initLoginWithSms:T,initUpdateEmail:T,resendEmailCode:T,resendSmsCode:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,initLoginWithOAuth:T,recoveryOAuthFlow:T,loginWithOAuth:T,initLoginWithPasskey:T,loginWithPasskey:T,initLinkWithPasskey:T,linkWithPasskey:T,refreshUser:T,walletProxy:null,createAnalyticsEvent:T,acceptTerms:T,getUsdTokenPrice:T,recoverEmbeddedWallet:T,getFiatOnRampConfig:T,updateWallets:T,fundWallet:T,setReadyToTrue:T,requestFarcasterSignerStatus:T,initLoginWithTelegram:T,loginWithTelegram:T}),M=()=>P3(Dc);import{createContext as S3,useContext as _3}from"react";var ye=S3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:T,login:T,connectOrCreateWallet:T,linkEmail:T,linkPhone:T,linkFarcaster:T,linkWallet:T,linkGoogle:T,linkTwitter:T,linkDiscord:T,linkGithub:T,linkSpotify:T,linkInstagram:T,linkTiktok:T,linkLinkedIn:T,linkApple:T,linkPasskey:T,updateEmail:T,logout:T,getAccessToken:T,getEthereumProvider:T,getEthersProvider:T,getWeb3jsProvider:T,unlinkEmail:T,unlinkPhone:T,unlinkWallet:T,unlinkGoogle:T,unlinkTwitter:T,unlinkDiscord:T,unlinkGithub:T,unlinkSpotify:T,unlinkInstagram:T,unlinkTiktok:T,unlinkLinkedIn:T,unlinkApple:T,unlinkFarcaster:T,unlinkPasskey:T,setActiveWallet:T,forkSession:T,createWallet:T,signMessage:T,signTypedData:T,enrollInMfa:T,initEnrollmentWithSms:T,initEnrollmentWithTotp:T,initEnrollmentWithPasskey:T,promptMfa:T,init:T,submitEnrollmentWithSms:T,submitEnrollmentWithTotp:T,submitEnrollmentWithPasskey:T,unenroll:T,submit:T,cancel:T,sendTransaction:T,exportWallet:T,setWalletPassword:T,requestFarcasterSignerFromWarpcast:T,getFarcasterSignerPublicKey:T,signFarcasterMessage:T,initLoginWithEmail:T,initLoginWithSms:T,otpState:{status:"initial"},loginWithCode:T,fundWallet:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,isHeadlessOAuthLoading:!1,isModalOpen:!1}),F=()=>_3(ye);import{useEffect as x3,useState as A3}from"react";var Rm=e=>{let[t,r]=A3("auto");return x3(()=>{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 k3,useContext as R3,useEffect as I3}from"react";var Im={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Uc=k3(void 0),Mm=()=>R3(Uc);function Fe(e,t){if(!t)return;let o=Mm().current[e];return I3(()=>{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 Gs(){let e=Mm();return(t,r,...o)=>U(e,t,r,...o)}function Fc(e){Fe("configureMfa",e)}import Bm from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Z3 from"@heroicons/react/24/solid/DocumentCheckIcon";import J3 from"styled-components";import rn,{css as Vc}from"styled-components";import Hc from"styled-components";import{Fragment as W3,jsx as Bc,jsxs as L3}from"react/jsx-runtime";var Xe=({success:e,fail:t})=>L3(W3,{children:[Bc(et,{className:e?"success":t?"fail":""}),Bc(Gc,{className:e?"success":t?"fail":""})]}),et=Hc.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -136,7 +136,7 @@ Resources:
136
136
  opacity: 1;
137
137
  animation: fadein 200ms ease;
138
138
  }
139
- `,Pr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>pr(O3,{disabled:t||r,...n,children:t?qs("span",{children:[pr(io,{}),o?pr("span",{children:o}):null]}):e}),O3=rn(Vs)`
139
+ `,Tr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>pr(O3,{disabled:t||r,...n,children:t?qs("span",{children:[pr(io,{}),o?pr("span",{children:o}):null]}):e}),O3=rn(Vs)`
140
140
  && {
141
141
  border-width: 1px;
142
142
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -277,7 +277,7 @@ Resources:
277
277
  @media all and (display-mode: standalone) {
278
278
  padding-bottom: 30px;
279
279
  }
280
- `;import U3 from"@heroicons/react/24/outline/ArrowLeftIcon";import F3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import B3 from"@heroicons/react/24/outline/XMarkIcon";import Hn from"styled-components";import{jsx as It,jsxs as Nm}from"react/jsx-runtime";var H3=({backFn:e})=>It("div",{children:It(qc,{onClick:e,children:It(U3,{height:"16px",width:"16px",strokeWidth:2})})}),G3=({infoFn:e})=>It("div",{children:It(z3,{"aria-label":"info",onClick:e,children:It(F3,{height:"22px",width:"22px",strokeWidth:2})})}),V3=e=>It("div",{children:It(qc,{"aria-label":"close modal",onClick:e.onClose,children:It(B3,{height:"16px",width:"16px",strokeWidth:2})})});var T=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),{app:a}=_();return Nm(q3,{children:[Nm($3,{children:[e&&It(H3,{backFn:e}),t&&It(G3,{infoFn:t})]}),o&&It(j3,{id:"privy-dialog-title",children:o}),It(K3,{children:a?.render.inDialog&&n&&It(V3,{onClose:r||(()=>i())})})]})},qc=Hn.button`
280
+ `;import U3 from"@heroicons/react/24/outline/ArrowLeftIcon";import F3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import B3 from"@heroicons/react/24/outline/XMarkIcon";import Hn from"styled-components";import{jsx as It,jsxs as Nm}from"react/jsx-runtime";var H3=({backFn:e})=>It("div",{children:It(qc,{onClick:e,children:It(U3,{height:"16px",width:"16px",strokeWidth:2})})}),G3=({infoFn:e})=>It("div",{children:It(z3,{"aria-label":"info",onClick:e,children:It(F3,{height:"22px",width:"22px",strokeWidth:2})})}),V3=e=>It("div",{children:It(qc,{"aria-label":"close modal",onClick:e.onClose,children:It(B3,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),{app:a}=_();return Nm(q3,{children:[Nm($3,{children:[e&&It(H3,{backFn:e}),t&&It(G3,{infoFn:t})]}),o&&It(j3,{id:"privy-dialog-title",children:o}),It(K3,{children:a?.render.inDialog&&n&&It(V3,{onClose:r||(()=>i())})})]})},qc=Hn.button`
281
281
  && {
282
282
  cursor: pointer;
283
283
  display: flex;
@@ -336,7 +336,7 @@ Resources:
336
336
  flex-direction: column;
337
337
  justify-content: flex-end;
338
338
  flex-grow: 1;
339
- `,Tr=on.div`
339
+ `,Pr=on.div`
340
340
  display: flex;
341
341
  flex-direction: column;
342
342
  gap: 12px;
@@ -351,7 +351,7 @@ Resources:
351
351
  &::-webkit-scrollbar {
352
352
  display: none;
353
353
  }
354
- `,Dm=on(Tr)`
354
+ `,Dm=on(Pr)`
355
355
  ${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;"}}
356
356
 
357
357
  background-repeat: no-repeat;
@@ -401,7 +401,7 @@ Resources:
401
401
  `,Sr=on.div`
402
402
  width: 100%;
403
403
  ${e=>e.if?"display: none;":""}
404
- `;import tt from"styled-components";var Pe=tt.div`
404
+ `;import tt from"styled-components";var Te=tt.div`
405
405
  display: flex;
406
406
  flex-direction: column;
407
407
  align-items: center;
@@ -570,7 +570,7 @@ Resources:
570
570
  }
571
571
  `,Xs=tt.div`
572
572
  color: var(--privy-color-error);
573
- `;import{Fragment as e0,jsx as Vr,jsxs as Vi}from"react/jsx-runtime";var Hm=()=>{let{user:e,logout:t}=F(),{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 u=async f=>{f.preventDefault(),await a(),e&&kt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Vr(Q3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},Q3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Vi(e0,{children:[Vr(T,{closeable:!1}),Vr(Z3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Vr(ae,{style:{marginTop:24},children:"One last step"}),Vr(se,{children:"By signing up, you agree to our terms and privacy policy."}),Vi(Tr,{style:{marginTop:24},children:[e&&Vi($c,{target:"_blank",href:e,children:["View Terms ",Vr(Bm,{style:{marginLeft:"auto"}})]}),t&&Vi($c,{target:"_blank",href:t,children:["View Privacy Policy ",Vr(Bm,{style:{marginLeft:"auto"}})]})]}),Vi(X3,{style:{marginTop:24},children:[Vr(Pr,{onClick:o,children:"No thanks"}),Vr(L,{onClick:r,children:"Accept"})]}),Vr(V,{protectedByPrivy:!0})]}),X3=J3.div`
573
+ `;import{Fragment as e0,jsx as Vr,jsxs as Vi}from"react/jsx-runtime";var Hm=()=>{let{user:e,logout:t}=F(),{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 u=async f=>{f.preventDefault(),await a(),e&&kt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Vr(Q3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},Q3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Vi(e0,{children:[Vr(P,{closeable:!1}),Vr(Z3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Vr(ae,{style:{marginTop:24},children:"One last step"}),Vr(se,{children:"By signing up, you agree to our terms and privacy policy."}),Vi(Pr,{style:{marginTop:24},children:[e&&Vi($c,{target:"_blank",href:e,children:["View Terms ",Vr(Bm,{style:{marginLeft:"auto"}})]}),t&&Vi($c,{target:"_blank",href:t,children:["View Privacy Policy ",Vr(Bm,{style:{marginLeft:"auto"}})]})]}),Vi(X3,{style:{marginTop:24},children:[Vr(Tr,{onClick:o,children:"No thanks"}),Vr(L,{onClick:r,children:"Accept"})]}),Vr(V,{protectedByPrivy:!0})]}),X3=J3.div`
574
574
  display: flex;
575
575
  gap: 10px;
576
576
  `;import Vm from"styled-components";import t0 from"styled-components";var el=t0.span`
@@ -611,7 +611,7 @@ Resources:
611
611
  left: -19px;
612
612
  top: -19px;
613
613
  }
614
- `,rt=o0;import{jsx as Gm}from"react/jsx-runtime";var tl=({style:e,...t})=>Gm("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:Gm("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 Kc,jsx as zr,jsxs as rl}from"react/jsx-runtime";var zm=()=>{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 rl(Kc,{children:[zr(T,{}),rl(n0,{children:[zr(rt,{children:rl("div",{children:[zr(el,{}),zr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),rl(i0,{children:[typeof r=="string"?zr("h3",{children:r}):zr(Kc,{children:r}),typeof o=="string"?zr("p",{children:o}):zr(Kc,{children:o})]}),t?.allowlistConfig.errorCtaLink?zr(L,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):zr(L,{onClick:()=>{e("LANDING")},children:n})]})]})},n0=Vm.div`
614
+ `,rt=o0;import{jsx as Gm}from"react/jsx-runtime";var tl=({style:e,...t})=>Gm("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:Gm("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 Kc,jsx as zr,jsxs as rl}from"react/jsx-runtime";var zm=()=>{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 rl(Kc,{children:[zr(P,{}),rl(n0,{children:[zr(rt,{children:rl("div",{children:[zr(el,{}),zr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),rl(i0,{children:[typeof r=="string"?zr("h3",{children:r}):zr(Kc,{children:r}),typeof o=="string"?zr("p",{children:o}):zr(Kc,{children:o})]}),t?.allowlistConfig.errorCtaLink?zr(L,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):zr(L,{onClick:()=>{e("LANDING")},children:n})]})]})},n0=Vm.div`
615
615
  display: flex;
616
616
  flex-direction: column;
617
617
  align-items: center;
@@ -699,7 +699,7 @@ Resources:
699
699
  border-width: 2px !important;
700
700
  `;import Yc from"styled-components";import{Fragment as s0,jsx as zi,jsxs as Zm}from"react/jsx-runtime";var qi=({title:e,description:t,children:r,...o})=>zi(Ym,{...o,children:Zm(s0,{children:[zi("h3",{children:e}),typeof t=="string"?zi("p",{children:t}):t,r]})}),qr=Yc(qi)`
701
701
  margin-bottom: 24px;
702
- `,Te=({title:e,description:t,icon:r,children:o,...n})=>Zm(a0,{...n,children:[r||null,zi("h3",{children:e}),typeof t=="string"?zi("p",{children:t}):t,o]}),Ym=Yc.div`
702
+ `,Pe=({title:e,description:t,icon:r,children:o,...n})=>Zm(a0,{...n,children:[r||null,zi("h3",{children:e}),typeof t=="string"?zi("p",{children:t}):t,o]}),Ym=Yc.div`
703
703
  display: flex;
704
704
  flex-direction: column;
705
705
  justify-content: flex-start;
@@ -727,7 +727,7 @@ Resources:
727
727
  h3 {
728
728
  margin-bottom: 24px;
729
729
  }
730
- `;import{Fragment as Zc,jsx as ft,jsxs as Po}from"react/jsx-runtime";var Jc=6,Qm=new Array(Jc).fill(""),p0=1400;var ef=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=M(),{authenticated:h,logout:y,user:v}=F(),[g,S]=ol(Qm),[b,w]=ol(!1),[I,A]=ol(null),[O,R]=ol(null);n.current=()=>null;let k=s()?.email?0:1,H=e?.render.inDialog?We:0,q=e?.render.inDialog?H-500:0;Jm(()=>{if(h&&b&&v){if(e?.legal.requireUsersAcceptTerms&&!v.hasAcceptedTerms){let ce=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},q);return()=>clearTimeout(ce)}if(kt(v,e?.embeddedWallets?.createOnLogin)){let ce=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:de=>{console.error(de),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:de,screen:"AwaitingPasswordlessCodeScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},q);return()=>clearTimeout(ce)}else{u();let ce=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(ce)}}},[h,b,v]),Jm(()=>{if(I&&O===0){let ue=setTimeout(()=>{S(Qm),A(null),document.querySelector("input[name=code-0]")?.focus()},p0);return()=>clearTimeout(ue)}},[I]);let j=ue=>{ue.preventDefault();let ce=ue.currentTarget.value.replace(" ","");if(ce==="")return;if(isNaN(Number(ce))){A("Code should be numeric"),R(1);return}A(null),R(null);let de=Number(ue.currentTarget.name?.charAt(5)),ve=[...ce||[""]].slice(0,Jc-de),ee=[...g.slice(0,de),...ve,...g.slice(de+ve.length)];S(ee);let Ct=ve.length,Ke=Math.min(Math.max(de+Ct,0),Jc-1);isNaN(Number(ue.currentTarget.value))||document.querySelector(`input[name=code-${Ke}]`)?.focus(),ee.every(xt=>xt&&!isNaN(+xt))&&(document.querySelector(`input[name=code-${Ke}]`)?.blur(),c(ee.join("")).then(()=>w(!0)).catch(Qe=>{if(Qe?.status===422)A("Invalid or expired verification code");else if(Qe instanceof wr&&Qe.privyErrorCode==="cannot_link_more_of_type")A(Qe.message);else if(Qe instanceof wr&&Qe.privyErrorCode==="max_accounts_reached"){console.error(new sr(Qe).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else A("Issue verifying code");R(0)}))},W=ue=>{O===1&&(A(null),R(null));let ce=[...g.slice(0,ue),"",...g.slice(ue+1)];S(ce),ue>0&&document.querySelector(`input[name=code-${ue-1}]`)?.focus()},$=k==0?ft(l0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ft(c0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),D=k==0?Po("p",{children:["Please check ",ft(Xm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Po("p",{children:["Please check ",ft(Xm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Po(Zc,{children:[ft(T,{backFn:()=>r()},"header"),Po(u0,{children:[ft(Te,{title:"Enter confirmation code",description:D,icon:$}),Po(qm,{children:[Po(m0,{children:[ft(f0,{fail:!!I,success:b,children:ft("span",{children:I||(b?"Success!":"")})}),ft("div",{children:g.map((ue,ce)=>ft("input",{name:`code-${ce}`,type:"text",value:g[ce],onChange:j,onKeyUp:de=>{de.key==="Backspace"&&W(ce)},inputMode:"numeric",autoFocus:ce===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:d0?"one-time-code":"off"},ce))})]}),ft(h0,{children:k==0?Po(Zc,{children:[ft("span",{children:"Didn't get an email?"}),ft("button",{onClick:a,children:"Resend code"})]}):Po(Zc,{children:[ft("span",{children:"Didn't get a message?"}),ft("button",{onClick:l,children:"Resend code"})]})})]})]}),ft(V,{protectedByPrivy:!0})]})},u0=$i.div`
730
+ `;import{Fragment as Zc,jsx as ft,jsxs as To}from"react/jsx-runtime";var Jc=6,Qm=new Array(Jc).fill(""),p0=1400;var ef=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=M(),{authenticated:h,logout:y,user:v}=F(),[g,S]=ol(Qm),[b,w]=ol(!1),[I,A]=ol(null),[O,R]=ol(null);n.current=()=>null;let k=s()?.email?0:1,H=e?.render.inDialog?We:0,q=e?.render.inDialog?H-500:0;Jm(()=>{if(h&&b&&v){if(e?.legal.requireUsersAcceptTerms&&!v.hasAcceptedTerms){let ce=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},q);return()=>clearTimeout(ce)}if(kt(v,e?.embeddedWallets?.createOnLogin)){let ce=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:de=>{console.error(de),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:de,screen:"AwaitingPasswordlessCodeScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},q);return()=>clearTimeout(ce)}else{u();let ce=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(ce)}}},[h,b,v]),Jm(()=>{if(I&&O===0){let ue=setTimeout(()=>{S(Qm),A(null),document.querySelector("input[name=code-0]")?.focus()},p0);return()=>clearTimeout(ue)}},[I]);let j=ue=>{ue.preventDefault();let ce=ue.currentTarget.value.replace(" ","");if(ce==="")return;if(isNaN(Number(ce))){A("Code should be numeric"),R(1);return}A(null),R(null);let de=Number(ue.currentTarget.name?.charAt(5)),ve=[...ce||[""]].slice(0,Jc-de),ee=[...g.slice(0,de),...ve,...g.slice(de+ve.length)];S(ee);let Ct=ve.length,Ke=Math.min(Math.max(de+Ct,0),Jc-1);isNaN(Number(ue.currentTarget.value))||document.querySelector(`input[name=code-${Ke}]`)?.focus(),ee.every(xt=>xt&&!isNaN(+xt))&&(document.querySelector(`input[name=code-${Ke}]`)?.blur(),c(ee.join("")).then(()=>w(!0)).catch(Qe=>{if(Qe?.status===422)A("Invalid or expired verification code");else if(Qe instanceof wr&&Qe.privyErrorCode==="cannot_link_more_of_type")A(Qe.message);else if(Qe instanceof wr&&Qe.privyErrorCode==="max_accounts_reached"){console.error(new sr(Qe).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else A("Issue verifying code");R(0)}))},W=ue=>{O===1&&(A(null),R(null));let ce=[...g.slice(0,ue),"",...g.slice(ue+1)];S(ce),ue>0&&document.querySelector(`input[name=code-${ue-1}]`)?.focus()},$=k==0?ft(l0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ft(c0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),D=k==0?To("p",{children:["Please check ",ft(Xm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):To("p",{children:["Please check ",ft(Xm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return To(Zc,{children:[ft(P,{backFn:()=>r()},"header"),To(u0,{children:[ft(Pe,{title:"Enter confirmation code",description:D,icon:$}),To(qm,{children:[To(m0,{children:[ft(f0,{fail:!!I,success:b,children:ft("span",{children:I||(b?"Success!":"")})}),ft("div",{children:g.map((ue,ce)=>ft("input",{name:`code-${ce}`,type:"text",value:g[ce],onChange:j,onKeyUp:de=>{de.key==="Backspace"&&W(ce)},inputMode:"numeric",autoFocus:ce===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:d0?"one-time-code":"off"},ce))})]}),ft(h0,{children:k==0?To(Zc,{children:[ft("span",{children:"Didn't get an email?"}),ft("button",{onClick:a,children:"Resend code"})]}):To(Zc,{children:[ft("span",{children:"Didn't get a message?"}),ft("button",{onClick:l,children:"Resend code"})]})})]})]}),ft(V,{protectedByPrivy:!0})]})},u0=$i.div`
731
731
  display: flex;
732
732
  flex-direction: column;
733
733
  align-items: flex-start;
@@ -816,7 +816,7 @@ Resources:
816
816
  `,Xm=$i.span`
817
817
  font-weight: 500;
818
818
  word-break: break-all;
819
- `;import w0 from"@heroicons/react/24/solid/CheckCircleIcon";import b0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Qc,useRef as E0,useState as zn}from"react";import P0 from"styled-components";import y0 from"styled-components";import{Fragment as C0,jsx as Vn,jsxs as v0}from"react/jsx-runtime";var tf=({icon:e})=>{let t=e;return Vn(C0,{children:Vn(g0,{children:v0("div",{children:[Vn(Xe,{}),typeof t=="string"?Vn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Vn(t,{style:{width:"38px",height:"38px"}}):Vn("span",{})]})})})},g0=y0.div`
819
+ `;import w0 from"@heroicons/react/24/solid/CheckCircleIcon";import b0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Qc,useRef as E0,useState as zn}from"react";import T0 from"styled-components";import y0 from"styled-components";import{Fragment as C0,jsx as Vn,jsxs as v0}from"react/jsx-runtime";var tf=({icon:e})=>{let t=e;return Vn(C0,{children:Vn(g0,{children:v0("div",{children:[Vn(Xe,{}),typeof t=="string"?Vn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Vn(t,{style:{width:"38px",height:"38px"}}):Vn("span",{})]})})})},g0=y0.div`
820
820
  display: flex;
821
821
  flex-direction: column;
822
822
  justify-content: center;
@@ -839,7 +839,7 @@ Resources:
839
839
  left: -19px;
840
840
  top: -19px;
841
841
  }
842
- `;import{Fragment as S0,jsx as xr,jsxs as Xc}from"react/jsx-runtime";var of=500,rf=of*2,nf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=fe(),f=E0([]),h=$=>{f.current=[$,...f.current]},[y,v]=zn(!0);Qc(()=>{let $=setTimeout(v,rf,!1);return h($),()=>{f.current.forEach(D=>clearTimeout(D)),f.current=[]}},[]);let[g,S]=zn(""),[b,w]=zn("Checking that you are a human..."),[I,A]=zn(xr(L,{onClick:()=>{},disabled:!0,children:"Continue"})),[O,R]=zn(!1),[k,H]=zn(3),q=r?.captchaModalData,j=async $=>{try{await q?.callback($),q?.onSuccessNavigateTo&&n(q?.onSuccessNavigateTo,!1)}catch(D){if(D instanceof Er)return;{let ue={error:D,previousScreen:e||"LANDING"};i({errorModalData:ue}),n(q?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Qc(()=>{if(a==="success"){let $=setTimeout(async()=>{let D=await s();!D||q?.userIntentRequired||j(D)},rf);h($)}else if(a==="ready"){let $=setTimeout(()=>{a==="ready"&&u()},of);h($)}},[a]),Qc(()=>{if(!y)switch(a){case"success":S("Success!"),w("CAPTCHA passed successfully."),A(xr(L,{onClick:()=>{R(!0),j(l)},disabled:!q?.userIntentRequired,loading:O,children:q?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),w("Checking that you are a human..."),A(xr(L,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),k<=0?(w("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(w("You did not pass CAPTCHA. Please try again."),A(xr(L,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[a,y,O]);let W=async()=>{if(k<=0)return;H(D=>D-1),c(),u();let $=await s();!$||q?.userIntentRequired||j($)};return Xc(S0,{children:[xr(T,{backFn:!e||t===e?void 0:o}),Xc(T0,{children:[a==="success"?xr(w0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?xr(b0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(tf,{}),Xc(qe,{children:[g?xr("h3",{children:g}):null,xr("p",{children:b})]}),I]}),xr(G,{})]})},T0=P0.div`
842
+ `;import{Fragment as S0,jsx as xr,jsxs as Xc}from"react/jsx-runtime";var of=500,rf=of*2,nf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=fe(),f=E0([]),h=$=>{f.current=[$,...f.current]},[y,v]=zn(!0);Qc(()=>{let $=setTimeout(v,rf,!1);return h($),()=>{f.current.forEach(D=>clearTimeout(D)),f.current=[]}},[]);let[g,S]=zn(""),[b,w]=zn("Checking that you are a human..."),[I,A]=zn(xr(L,{onClick:()=>{},disabled:!0,children:"Continue"})),[O,R]=zn(!1),[k,H]=zn(3),q=r?.captchaModalData,j=async $=>{try{await q?.callback($),q?.onSuccessNavigateTo&&n(q?.onSuccessNavigateTo,!1)}catch(D){if(D instanceof Er)return;{let ue={error:D,previousScreen:e||"LANDING"};i({errorModalData:ue}),n(q?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Qc(()=>{if(a==="success"){let $=setTimeout(async()=>{let D=await s();!D||q?.userIntentRequired||j(D)},rf);h($)}else if(a==="ready"){let $=setTimeout(()=>{a==="ready"&&u()},of);h($)}},[a]),Qc(()=>{if(!y)switch(a){case"success":S("Success!"),w("CAPTCHA passed successfully."),A(xr(L,{onClick:()=>{R(!0),j(l)},disabled:!q?.userIntentRequired,loading:O,children:q?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),w("Checking that you are a human..."),A(xr(L,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),k<=0?(w("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(w("You did not pass CAPTCHA. Please try again."),A(xr(L,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[a,y,O]);let W=async()=>{if(k<=0)return;H(D=>D-1),c(),u();let $=await s();!$||q?.userIntentRequired||j($)};return Xc(S0,{children:[xr(P,{backFn:!e||t===e?void 0:o}),Xc(P0,{children:[a==="success"?xr(w0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?xr(b0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):xr(tf,{}),Xc(qe,{children:[g?xr("h3",{children:g}):null,xr("p",{children:b})]}),I]}),xr(G,{})]})},P0=T0.div`
843
843
  display: flex;
844
844
  flex-direction: column;
845
845
  align-items: center;
@@ -868,16 +868,16 @@ Resources:
868
868
  display: none;
869
869
  }
870
870
  }
871
- `;import{Fragment as U0,jsx as Kn,jsxs as F0}from"react/jsx-runtime";var L0=["coinbase_wallet"],O0=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],N0=["cryptocom"],D0=["phantom"],jn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=_(),o=Yi(r.appearance.walletList,t,e,r.appearance.walletList);return F0(U0,{children:[...o]})},Yi=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:f})=>f==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(f));for(let u of c){let{walletClientType:f,walletBranding:h}=u;(f==="unknown"?i:n).push(Kn(sn,{connectOnly:r,provider:f,logo:h.icon,displayName:h.name,connector:u},`${s}-${f}`))}}else if(D0.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else if(O0.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else if(L0.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else N0.includes(s)?l&&a.push(Kn(sn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(Kn(sn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as B0,jsx as Zi,jsxs as H0}from"react/jsx-runtime";var hf=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return H0(B0,{children:[Zi(T,{},"header"),Zi(qr,{title:"Connect your wallet",description:t}),Zi(Tr,{children:Zi(jn,{connectOnly:!0})}),Zi(V,{protectedByPrivy:!0})]})};import $0 from"styled-components";import z0 from"styled-components";import G0 from"react";import{jsx as V0}from"react/jsx-runtime";var yf=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?V0("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?G0.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 gf}from"react/jsx-runtime";var Yn=e=>{let{app:t}=_();return t?.appearance.logo?gf(q0,{...e,children:gf(yf,{})}):null},q0=z0.div`
871
+ `;import{Fragment as U0,jsx as Kn,jsxs as F0}from"react/jsx-runtime";var L0=["coinbase_wallet"],O0=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],N0=["cryptocom"],D0=["phantom"],jn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=_(),o=Yi(r.appearance.walletList,t,e,r.appearance.walletList);return F0(U0,{children:[...o]})},Yi=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:f})=>f==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(f));for(let u of c){let{walletClientType:f,walletBranding:h}=u;(f==="unknown"?i:n).push(Kn(sn,{connectOnly:r,provider:f,logo:h.icon,displayName:h.name,connector:u},`${s}-${f}`))}}else if(D0.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else if(O0.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else if(L0.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(Kn(sn,{connectOnly:r,provider:s,connector:c},s))}else N0.includes(s)?l&&a.push(Kn(sn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(Kn(sn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as B0,jsx as Zi,jsxs as H0}from"react/jsx-runtime";var hf=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return H0(B0,{children:[Zi(P,{},"header"),Zi(qr,{title:"Connect your wallet",description:t}),Zi(Pr,{children:Zi(jn,{connectOnly:!0})}),Zi(V,{protectedByPrivy:!0})]})};import $0 from"styled-components";import z0 from"styled-components";import G0 from"react";import{jsx as V0}from"react/jsx-runtime";var yf=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?V0("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?G0.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 gf}from"react/jsx-runtime";var Yn=e=>{let{app:t}=_();return t?.appearance.logo?gf(q0,{...e,children:gf(yf,{})}):null},q0=z0.div`
872
872
  display: flex;
873
873
  flex-direction: column;
874
874
  align-items: center;
875
875
  padding: 24px 0;
876
876
  flex-grow: 1;
877
877
  justify-content: center;
878
- `;import{Fragment as j0,jsx as Zn,jsxs as Y0}from"react/jsx-runtime";var vf=()=>{let{app:e}=_();return Y0(j0,{children:[Zn(T,{},"header"),Zn(K0,{}),Zn(Tr,{children:Zn(jn,{connectOnly:!0})}),e&&Zn(Bn,{app:e,alwaysShowImplicitConsent:!0}),Zn(V,{protectedByPrivy:!0})]})},K0=$0(Yn)`
878
+ `;import{Fragment as j0,jsx as Zn,jsxs as Y0}from"react/jsx-runtime";var vf=()=>{let{app:e}=_();return Y0(j0,{children:[Zn(P,{},"header"),Zn(K0,{}),Zn(Pr,{children:Zn(jn,{connectOnly:!0})}),e&&Zn(Bn,{app:e,alwaysShowImplicitConsent:!0}),Zn(V,{protectedByPrivy:!0})]})},K0=$0(Yn)`
879
879
  margin-bottom: 16px;
880
- `;import{useEffect as Sf,useState as _f}from"react";import{isMobile as ov}from"react-device-detect";import nv from"styled-components";import{useEffect as ed,useState as ln}from"react";import{isMobile as nl}from"react-device-detect";import Ef from"styled-components";import{useEffect as Cf,useRef as Z0}from"react";var J0=(e,t)=>{let r=Z0(()=>{});Cf(()=>{r.current=e}),Cf(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},wf=J0;import{useState as Q0,useEffect as X0,useCallback as ev}from"react";function bf(){let[e,t]=Q0(!1),r=ev(()=>{document.hidden&&t(!0)},[]);return X0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Tf,jsx as at,jsxs as Ji}from"react/jsx-runtime";var td=2,rd=e=>e?.privyErrorCode==="linked_to_another_user"?oo.ERROR_USER_EXISTS:e instanceof Ue&&!e.details.default?e.details:e instanceof An?oo.ERROR_TIMED_OUT:e instanceof kn?oo.ERROR_USER_REJECTED_CONNECTION:oo.ERROR_WALLET_CONNECTION,Pf=()=>{let[e,t]=ln(!1),[r,o]=ln(!1),[n,i]=ln(void 0),{authenticated:a,logout:l}=F(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:h,setModalData:y}=_(),{getAuthFlow:v,walletConnectionStatus:g,closePrivyModal:S,initLoginWithWallet:b,loginWithWallet:w,updateWallets:I,createAnalyticsEvent:A}=M(),{walletConnectors:O}=F(),[R,k]=ln(0),{user:H}=F(),[q]=ln(H?.linkedAccounts.length||0),[j,W]=ln(""),[$,D]=ln(!1),{hasTabbedAway:ue}=bf(),{enabled:ce,token:de}=fe(),ve=nl&&g?.connector?.connectorType==="wallet_connect_v2"||nl&&g?.connector?.connectorType==="coinbase_wallet"||nl&&g?.connector?.connectorType==="injected"&&g?.connector?.walletClientType==="phantom",ee=g?.status==="connected",Ct=g?.status==="switching_to_supported_chain";ed(()=>{let Ce=v();if(ee&&!Ce&&(ce&&!de&&!a?(y({captchaModalData:{callback:J=>b(g.connectedWallet,J).then(()=>{D(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):b(g.connectedWallet,de).then(()=>{D(!0)})),Ce&&ve&&ee&&!Ce.preparedMessage){Ce.buildSiweMessage();return}!Ce||ve||!ee||r||(async()=>{o(!0),i(void 0);try{g?.connector?.connectorType==="wallet_connect_v2"&&g?.connector?.walletClientType==="metamask"&&await Cc(2500),await xt()}catch(J){console.warn("Auto-prompted signature failed",J)}finally{o(!1)}})()},[R,ee,$]),ed(()=>{if(H&&e){let Ce=s?.render.inDialog?We:0,J=s?.render.inDialog?Ce-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let we=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(we)}if(kt(H,s?.embeddedWallets?.createOnLogin)){let we=setTimeout(()=>{y({createWallet:{onSuccess:()=>{},onFailure:Ne=>{console.error(Ne),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ne,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(we)}I();let Q=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),We);return()=>clearTimeout(Q)}},[H,e]);let Ke=Ce=>{if(Ce?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Ce?.privyErrorCode==="max_accounts_reached"){console.error(new sr(Ce).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(rd(Ce))};async function xt(){try{if(await w(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Ce){Ke(Ce)}finally{o(!1)}}ed(()=>{g?.connectError&&Ke(g?.connectError)},[g]),wf(()=>{let Ce=Qe==="wallet_connect_v2"&&g?.connector instanceof Hr?g.connector.redirectUri:void 0;Ce&&W(Ce)},g?.connector instanceof Hr&&!j?500:null);let Qe=g?.connector?.connectorType||"injected",nr=g?.connector?.walletClientType||"unknown",ke=Kr[nr]?.displayName||g?.connector?.walletBranding.name||"Browser Extension",Ve=Kr[nr]?.logo||g?.connector?.walletBranding.icon||(Ce=>at(Mn,{...Ce})),ir=ke==="Browser Extension"?ke.toLowerCase():ke,At;e?At=`Successfully connected with ${ir}`:n?At=n.message:Ct?At="Switching networks":ee?At=r&&ve?"Signing":"Sign to verify":At=`Waiting for ${ir}`;let He="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Ce=H?.linkedAccounts.length||0;q===Ce?He="Wallet was already linked.":He="You\u2019re good to go!"}else R>=td&&n?He="Unable to connect wallet":n?He=n.detail:Ct?He="Switch your wallet to the requested network.":ee&&ve?He="Sign the message in your wallet to verify it belongs to you.":nr==="metamask"&&nl?He="Click continue to open and connect MetaMask.":nr==="metamask"?He="For the best experience, connect only one wallet at a time.":Qe==="wallet_connect"?He="Open your mobile wallet app to continue":Qe==="coinbase_wallet"&&(ru()||(Wc(H)?He="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":He="Open the Coinbase app on your phone to continue."));let N=O?.walletConnectors?.find(Ce=>Ce.walletClientType==="coinbase_wallet"),Ho=nr==="coinbase_wallet"&&(Wc(H)||n===oo.ERROR_USER_EXISTS);return Ji(Tf,{children:[at(T,{backFn:!f||h===f?void 0:u}),Ji(tv,{children:[at(od,{walletLogo:Ve,success:e,fail:!!n}),Ji(qe,{children:[at("h3",{children:At}),at("p",{children:He}),!ee&&j&&!ue?Ji("p",{children:["Still here?"," ",at("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Ho?at(L,{onClick:()=>N&&N?.disconnect(),disabled:e,children:"Use a different wallet"}):n==oo.ERROR_USER_EXISTS&&h!==f?at(L,{onClick:u,children:"Use a different wallet"}):ee&&!e&&ve?at(L,{onClick:()=>{o(!0),xt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<td?at(L,{onClick:()=>{k(R+1),i(void 0),ee?(o(!0),xt()):g?.connectRetry()},disabled:!e&&(!n?.retryable||R>=td),children:"Retry"}):!e&&!n?at(L,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),at(G,{})]})},tv=Ef.div`
880
+ `;import{useEffect as Sf,useState as _f}from"react";import{isMobile as ov}from"react-device-detect";import nv from"styled-components";import{useEffect as ed,useState as ln}from"react";import{isMobile as nl}from"react-device-detect";import Ef from"styled-components";import{useEffect as Cf,useRef as Z0}from"react";var J0=(e,t)=>{let r=Z0(()=>{});Cf(()=>{r.current=e}),Cf(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},wf=J0;import{useState as Q0,useEffect as X0,useCallback as ev}from"react";function bf(){let[e,t]=Q0(!1),r=ev(()=>{document.hidden&&t(!0)},[]);return X0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Pf,jsx as at,jsxs as Ji}from"react/jsx-runtime";var td=2,rd=e=>e?.privyErrorCode==="linked_to_another_user"?oo.ERROR_USER_EXISTS:e instanceof Ue&&!e.details.default?e.details:e instanceof An?oo.ERROR_TIMED_OUT:e instanceof kn?oo.ERROR_USER_REJECTED_CONNECTION:oo.ERROR_WALLET_CONNECTION,Tf=()=>{let[e,t]=ln(!1),[r,o]=ln(!1),[n,i]=ln(void 0),{authenticated:a,logout:l}=F(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:h,setModalData:y}=_(),{getAuthFlow:v,walletConnectionStatus:g,closePrivyModal:S,initLoginWithWallet:b,loginWithWallet:w,updateWallets:I,createAnalyticsEvent:A}=M(),{walletConnectors:O}=F(),[R,k]=ln(0),{user:H}=F(),[q]=ln(H?.linkedAccounts.length||0),[j,W]=ln(""),[$,D]=ln(!1),{hasTabbedAway:ue}=bf(),{enabled:ce,token:de}=fe(),ve=nl&&g?.connector?.connectorType==="wallet_connect_v2"||nl&&g?.connector?.connectorType==="coinbase_wallet"||nl&&g?.connector?.connectorType==="injected"&&g?.connector?.walletClientType==="phantom",ee=g?.status==="connected",Ct=g?.status==="switching_to_supported_chain";ed(()=>{let Ce=v();if(ee&&!Ce&&(ce&&!de&&!a?(y({captchaModalData:{callback:J=>b(g.connectedWallet,J).then(()=>{D(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):b(g.connectedWallet,de).then(()=>{D(!0)})),Ce&&ve&&ee&&!Ce.preparedMessage){Ce.buildSiweMessage();return}!Ce||ve||!ee||r||(async()=>{o(!0),i(void 0);try{g?.connector?.connectorType==="wallet_connect_v2"&&g?.connector?.walletClientType==="metamask"&&await Cc(2500),await xt()}catch(J){console.warn("Auto-prompted signature failed",J)}finally{o(!1)}})()},[R,ee,$]),ed(()=>{if(H&&e){let Ce=s?.render.inDialog?We:0,J=s?.render.inDialog?Ce-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let we=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(we)}if(kt(H,s?.embeddedWallets?.createOnLogin)){let we=setTimeout(()=>{y({createWallet:{onSuccess:()=>{},onFailure:Ne=>{console.error(Ne),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ne,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(we)}I();let Q=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),We);return()=>clearTimeout(Q)}},[H,e]);let Ke=Ce=>{if(Ce?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Ce?.privyErrorCode==="max_accounts_reached"){console.error(new sr(Ce).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(rd(Ce))};async function xt(){try{if(await w(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Ce){Ke(Ce)}finally{o(!1)}}ed(()=>{g?.connectError&&Ke(g?.connectError)},[g]),wf(()=>{let Ce=Qe==="wallet_connect_v2"&&g?.connector instanceof Hr?g.connector.redirectUri:void 0;Ce&&W(Ce)},g?.connector instanceof Hr&&!j?500:null);let Qe=g?.connector?.connectorType||"injected",nr=g?.connector?.walletClientType||"unknown",ke=Kr[nr]?.displayName||g?.connector?.walletBranding.name||"Browser Extension",Ve=Kr[nr]?.logo||g?.connector?.walletBranding.icon||(Ce=>at(Mn,{...Ce})),ir=ke==="Browser Extension"?ke.toLowerCase():ke,At;e?At=`Successfully connected with ${ir}`:n?At=n.message:Ct?At="Switching networks":ee?At=r&&ve?"Signing":"Sign to verify":At=`Waiting for ${ir}`;let He="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Ce=H?.linkedAccounts.length||0;q===Ce?He="Wallet was already linked.":He="You\u2019re good to go!"}else R>=td&&n?He="Unable to connect wallet":n?He=n.detail:Ct?He="Switch your wallet to the requested network.":ee&&ve?He="Sign the message in your wallet to verify it belongs to you.":nr==="metamask"&&nl?He="Click continue to open and connect MetaMask.":nr==="metamask"?He="For the best experience, connect only one wallet at a time.":Qe==="wallet_connect"?He="Open your mobile wallet app to continue":Qe==="coinbase_wallet"&&(ru()||(Wc(H)?He="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":He="Open the Coinbase app on your phone to continue."));let N=O?.walletConnectors?.find(Ce=>Ce.walletClientType==="coinbase_wallet"),Ho=nr==="coinbase_wallet"&&(Wc(H)||n===oo.ERROR_USER_EXISTS);return Ji(Pf,{children:[at(P,{backFn:!f||h===f?void 0:u}),Ji(tv,{children:[at(od,{walletLogo:Ve,success:e,fail:!!n}),Ji(qe,{children:[at("h3",{children:At}),at("p",{children:He}),!ee&&j&&!ue?Ji("p",{children:["Still here?"," ",at("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Ho?at(L,{onClick:()=>N&&N?.disconnect(),disabled:e,children:"Use a different wallet"}):n==oo.ERROR_USER_EXISTS&&h!==f?at(L,{onClick:u,children:"Use a different wallet"}):ee&&!e&&ve?at(L,{onClick:()=>{o(!0),xt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<td?at(L,{onClick:()=>{k(R+1),i(void 0),ee?(o(!0),xt()):g?.connectRetry()},disabled:!e&&(!n?.retryable||R>=td),children:"Retry"}):!e&&!n?at(L,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),at(G,{})]})},tv=Ef.div`
881
881
  display: flex;
882
882
  flex-direction: column;
883
883
  align-items: center;
@@ -907,7 +907,7 @@ Resources:
907
907
  left: -19px;
908
908
  top: -19px;
909
909
  }
910
- `,od=e=>{let t=e.walletLogo;return at(Tf,{children:at(rv,{children:Ji("div",{children:[at(Xe,{success:e.success,fail:e.fail}),typeof t=="string"?at("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):at(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as av,jsx as ao,jsxs as nd}from"react/jsx-runtime";var il=2,xf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=_f(void 0),[l,s]=_f(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Sf(()=>{if(c){let I=setTimeout(n,We);return()=>clearTimeout(I)}},[c]);let f=I=>{a(rd(I))};Sf(()=>{o?.connectError&&f(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",y=o?.connector?.walletClientType||"unknown",v=Kr[y]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",g=Kr[y]?.logo||o?.connector?.walletBranding.icon||(I=>ao(Mn,{...I})),S=v==="Browser Extension"?v.toLowerCase():v,b;c?b=`Successfully connected with ${S}`:i?b=i.message:u?b="Switching networks":b=`Waiting for ${S}`;let w="Don\u2019t see your wallet? Check your other browser windows.";return c?w="You\u2019re good to go!":l>=il&&i?w="Unable to connect wallet":i?w=i.detail:u?w="Switch your wallet to the requested network.":y==="metamask"&&ov?w="Click to continue to open and connect MetaMask.":y==="metamask"?w="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?w="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(w="Open the Coinbase app on your phone to continue."),nd(av,{children:[ao(T,{backFn:r===t?void 0:e}),nd(iv,{children:[ao(od,{walletLogo:g,success:c,fail:!!i}),nd(qe,{children:[ao("h3",{children:b}),ao("p",{children:w})]}),i==oo.ERROR_USER_EXISTS?ao(L,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<il?ao(L,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=il),children:"Retry"}):!c&&i&&l>=il?ao(L,{onClick:e,children:"Use a different wallet"}):null]}),ao(G,{})]})},iv=nv.div`
910
+ `,od=e=>{let t=e.walletLogo;return at(Pf,{children:at(rv,{children:Ji("div",{children:[at(Xe,{success:e.success,fail:e.fail}),typeof t=="string"?at("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):at(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as av,jsx as ao,jsxs as nd}from"react/jsx-runtime";var il=2,xf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=_f(void 0),[l,s]=_f(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Sf(()=>{if(c){let I=setTimeout(n,We);return()=>clearTimeout(I)}},[c]);let f=I=>{a(rd(I))};Sf(()=>{o?.connectError&&f(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",y=o?.connector?.walletClientType||"unknown",v=Kr[y]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",g=Kr[y]?.logo||o?.connector?.walletBranding.icon||(I=>ao(Mn,{...I})),S=v==="Browser Extension"?v.toLowerCase():v,b;c?b=`Successfully connected with ${S}`:i?b=i.message:u?b="Switching networks":b=`Waiting for ${S}`;let w="Don\u2019t see your wallet? Check your other browser windows.";return c?w="You\u2019re good to go!":l>=il&&i?w="Unable to connect wallet":i?w=i.detail:u?w="Switch your wallet to the requested network.":y==="metamask"&&ov?w="Click to continue to open and connect MetaMask.":y==="metamask"?w="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?w="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(w="Open the Coinbase app on your phone to continue."),nd(av,{children:[ao(P,{backFn:r===t?void 0:e}),nd(iv,{children:[ao(od,{walletLogo:g,success:c,fail:!!i}),nd(qe,{children:[ao("h3",{children:b}),ao("p",{children:w})]}),i==oo.ERROR_USER_EXISTS?ao(L,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<il?ao(L,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=il),children:"Retry"}):!c&&i&&l>=il?ao(L,{onClick:e,children:"Use a different wallet"}):null]}),ao(G,{})]})},iv=nv.div`
911
911
  display: flex;
912
912
  flex-direction: column;
913
913
  align-items: center;
@@ -970,20 +970,20 @@ Resources:
970
970
  transform: rotate(360deg);
971
971
  }
972
972
  }
973
- `;var Af=["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 Be=class extends Error{constructor(r,o){super(o);this.type=r}};function Qn(e){let t=e.type;return typeof t=="string"&&Af.includes(t)}function uv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Xn(e){return Qn(e)&&e.type==="wallet_not_on_device"}function kf(e){return Qn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function cn(e){return!!(Qn(e)&&e.type==="mfa_timeout")}function dn(e){return!!(Qn(e)&&e.type==="missing_or_invalid_mfa")}function ad(e){return!!(Qn(e)&&e.type==="mfa_verification_max_attempts_reached")}function sl(e){return!!(Qn(e)&&e.message.includes("code 429"))}function ll(e){return!!(uv(e)&&e.message==="MFA canceled")}function Rf(e,t){return t.length>1?"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN":e==="create"?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function cl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function If({api:e,provider:t}){let r=Ii(),o=es(),n=await ts(r);try{return{url:(await e.post(Gp,{redirect_to:window.location.href,code_challenge:n,state_code:o,provider:t})).url,codeVerifier:r,stateCode:o}}catch(i){throw ie(i)}}async function Mf({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new E("User denied confirmation during OAuth flow");try{return(await e.post(Vp,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=ie(i);throw a.privyErrorCode?new E(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as Lf,jsx as ei,jsxs as sd}from"react/jsx-runtime";var Wf=1,Of=()=>{let{authenticated:e,user:t,getAccessToken:r}=F(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=hv(()=>Date.now(),[]),[f,h]=yv(!1),{onCompleteNavigateTo:y,onFailure:v,shouldForceMFA:g}=l?.connectWallet,S=w=>{f||(h(!0),v(typeof w=="string"?new Error(w):w))};fv(()=>{let w=_e(t),I;return!e||!w?S("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let O=await r();if(!O)return S("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:O,address:w.address}),g&&await i.verifyMfa({accessToken:O});let R=(Date.now()-u)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<Wf?I=setTimeout(()=>{a(y)},(Wf-R)*1e3):a(y)}catch(R){if(Xn(R)&&w.recoveryMethod==="privy"){let k=await r();if(!k)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:w.address}}),(await i?.recover({address:w.address,accessToken:k}))?.address||S(new Error("Unable to recover wallet")),y?a(y):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:w.address}}),a(y)}catch{S("An error has occurred, please try again.")}}else if(Xn(R)){s({...l,recoverWallet:{privyWallet:w,onCompleteNavigateTo:y,onFailure:v},recoveryOAuthStatus:{provider:"google-drive",action:"recover",isInAccountCreateFlow:!1}});let k=cl(w.recoveryMethod);a(k)}else S(R)}})(),()=>clearTimeout(I)):void 0},[e,t,i]);let b=()=>{S("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=b,sd(Lf,{children:[ei(T,{onClose:b}),f?sd(Lf,{children:[sd(_r,{children:[ei(mv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ei(Te,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),ei(L,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):ei(Jn,{}),ei(vv,{})]})},vv=gv.div`
973
+ `;var Af=["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 Be=class extends Error{constructor(r,o){super(o);this.type=r}};function Qn(e){let t=e.type;return typeof t=="string"&&Af.includes(t)}function uv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Xn(e){return Qn(e)&&e.type==="wallet_not_on_device"}function kf(e){return Qn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function cn(e){return!!(Qn(e)&&e.type==="mfa_timeout")}function dn(e){return!!(Qn(e)&&e.type==="missing_or_invalid_mfa")}function ad(e){return!!(Qn(e)&&e.type==="mfa_verification_max_attempts_reached")}function sl(e){return!!(Qn(e)&&e.message.includes("code 429"))}function ll(e){return!!(uv(e)&&e.message==="MFA canceled")}function Rf(e,t){return t.length>1?"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN":e==="create"?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function cl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function If({api:e,provider:t}){let r=Ii(),o=es(),n=await ts(r);try{return{url:(await e.post(Gp,{redirect_to:window.location.href,code_challenge:n,state_code:o,provider:t})).url,codeVerifier:r,stateCode:o}}catch(i){throw ie(i)}}async function Mf({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new E("User denied confirmation during OAuth flow");try{return(await e.post(Vp,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=ie(i);throw a.privyErrorCode?new E(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as Lf,jsx as ei,jsxs as sd}from"react/jsx-runtime";var Wf=1,Of=()=>{let{authenticated:e,user:t,getAccessToken:r}=F(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=hv(()=>Date.now(),[]),[f,h]=yv(!1),{onCompleteNavigateTo:y,onFailure:v,shouldForceMFA:g}=l?.connectWallet,S=w=>{f||(h(!0),v(typeof w=="string"?new Error(w):w))};fv(()=>{let w=_e(t),I;return!e||!w?S("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let O=await r();if(!O)return S("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:O,address:w.address}),g&&await i.verifyMfa({accessToken:O});let R=(Date.now()-u)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<Wf?I=setTimeout(()=>{a(y)},(Wf-R)*1e3):a(y)}catch(R){if(Xn(R)&&w.recoveryMethod==="privy"){let k=await r();if(!k)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:w.address}}),(await i?.recover({address:w.address,accessToken:k}))?.address||S(new Error("Unable to recover wallet")),y?a(y):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:w.address}}),a(y)}catch{S("An error has occurred, please try again.")}}else if(Xn(R)){s({...l,recoverWallet:{privyWallet:w,onCompleteNavigateTo:y,onFailure:v},recoveryOAuthStatus:{provider:"google-drive",action:"recover",isInAccountCreateFlow:!1}});let k=cl(w.recoveryMethod);a(k)}else S(R)}})(),()=>clearTimeout(I)):void 0},[e,t,i]);let b=()=>{S("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=b,sd(Lf,{children:[ei(P,{onClose:b}),f?sd(Lf,{children:[sd(_r,{children:[ei(mv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ei(Pe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),ei(L,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):ei(Jn,{}),ei(vv,{})]})},vv=gv.div`
974
974
  height: 44px;
975
- `;import Cv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as wv}from"react";import{Fragment as bv,jsx as ti,jsxs as Nf}from"react/jsx-runtime";var Df=()=>{let{user:e}=F(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=_e(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return wv(()=>{let f=setTimeout(u,wu);return()=>clearTimeout(f)},[]),a.current=u,Nf(bv,{children:[ti(T,{onClose:u}),ti(X,{}),Nf(_r,{children:[ti(Cv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),ti(Te,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),ti(re,{}),ti(V,{protectedByPrivy:!0})]})};import Ev from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Pv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Bf,useRef as Tv,useState as ld}from"react";import To from"styled-components";import{Fragment as Wv,jsx as Ze,jsxs as Rr}from"react/jsx-runtime";var Hf=()=>{let[e,t]=ld(null),{authenticated:r,user:o,getAccessToken:n}=F(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=_e(o)?.address,{onFailure:f,onSuccess:h,origin:y,appId:v}=s.keyExport,g=b=>{i({shouldCallAuthOnSuccess:!1}),f(typeof b=="string"?new Error(b):b)},S=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return Bf(()=>{let b=_e(o);if(!r||!b)return g("User must be authenticated before exporting their wallet");n().then(t,g)},[r,o]),c.current=S,Rr(Wv,{children:[Ze(T,{onClose:S}),Rr(xv,{children:[Rr(Te,{icon:Ze(Pv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Rr(Iv,{children:[Ze(_v,{style:{marginRight:6}}),Co(u)]}),Ze("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Rr(Av,{children:[Rr(Uf,{children:[Ze(Ff,{children:"1"}),Rr("span",{children:[Ze("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."]})]}),Rr(Uf,{children:[Ze(Ff,{children:"2"}),Ze("span",{children:"Copy this key into your other wallet"})]})]}),Ze("div",{style:{width:"100%"},children:e&&Ze(Sv,{origin:y,appId:v,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Rr(Mv,{children:[Rr("div",{children:[Ze(Ev,{viewBox:"0 0 20 18"}),Ze("h4",{children:"Warning"})]}),Ze("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Ze(V,{protectedByPrivy:!0})]})};function Sv(e){let[t,r]=ld(e.dimensions.width),[o,n]=ld(void 0),i=Tv(null);return Bf(()=>{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")})},[]),Ze("div",{ref:i,children:t&&Rr(kv,{children:[Ze("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:za(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Ze(Rv,{children:"Loading..."})]})})}function _v(e){return Ze("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Ze("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 xv=To.div`
975
+ `;import Cv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as wv}from"react";import{Fragment as bv,jsx as ti,jsxs as Nf}from"react/jsx-runtime";var Df=()=>{let{user:e}=F(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=_e(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return wv(()=>{let f=setTimeout(u,wu);return()=>clearTimeout(f)},[]),a.current=u,Nf(bv,{children:[ti(P,{onClose:u}),ti(X,{}),Nf(_r,{children:[ti(Cv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),ti(Pe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),ti(re,{}),ti(V,{protectedByPrivy:!0})]})};import Ev from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Tv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Bf,useRef as Pv,useState as ld}from"react";import Po from"styled-components";import{Fragment as Wv,jsx as Ze,jsxs as Rr}from"react/jsx-runtime";var Hf=()=>{let[e,t]=ld(null),{authenticated:r,user:o,getAccessToken:n}=F(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=_e(o)?.address,{onFailure:f,onSuccess:h,origin:y,appId:v}=s.keyExport,g=b=>{i({shouldCallAuthOnSuccess:!1}),f(typeof b=="string"?new Error(b):b)},S=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return Bf(()=>{let b=_e(o);if(!r||!b)return g("User must be authenticated before exporting their wallet");n().then(t,g)},[r,o]),c.current=S,Rr(Wv,{children:[Ze(P,{onClose:S}),Rr(xv,{children:[Rr(Pe,{icon:Ze(Tv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Rr(Iv,{children:[Ze(_v,{style:{marginRight:6}}),Co(u)]}),Ze("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Rr(Av,{children:[Rr(Uf,{children:[Ze(Ff,{children:"1"}),Rr("span",{children:[Ze("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."]})]}),Rr(Uf,{children:[Ze(Ff,{children:"2"}),Ze("span",{children:"Copy this key into your other wallet"})]})]}),Ze("div",{style:{width:"100%"},children:e&&Ze(Sv,{origin:y,appId:v,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Rr(Mv,{children:[Rr("div",{children:[Ze(Ev,{viewBox:"0 0 20 18"}),Ze("h4",{children:"Warning"})]}),Ze("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Ze(V,{protectedByPrivy:!0})]})};function Sv(e){let[t,r]=ld(e.dimensions.width),[o,n]=ld(void 0),i=Pv(null);return Bf(()=>{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")})},[]),Ze("div",{ref:i,children:t&&Rr(kv,{children:[Ze("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:za(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Ze(Rv,{children:"Loading..."})]})})}function _v(e){return Ze("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Ze("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 xv=Po.div`
976
976
  display: flex;
977
977
  flex-direction: column;
978
978
  text-align: left;
979
- `,Av=To.div`
979
+ `,Av=Po.div`
980
980
  display: flex;
981
981
  flex-direction: column;
982
982
  gap: 24px;
983
983
  padding-bottom: 16px;
984
984
  margin-left: 11px;
985
985
  border-left: 1px solid var(--privy-color-foreground-4) !important;
986
- `,Uf=To.div`
986
+ `,Uf=Po.div`
987
987
  display: flex;
988
988
  align-items: top;
989
989
  gap: 8px;
@@ -992,7 +992,7 @@ Resources:
992
992
  color: var(--privy-color-accent);
993
993
  text-decoration: underline;
994
994
  }
995
- `,Ff=To.div`
995
+ `,Ff=Po.div`
996
996
  display: flex;
997
997
  align-items: center;
998
998
  justify-content: center;
@@ -1006,11 +1006,11 @@ Resources:
1006
1006
  border-radius: 100%;
1007
1007
  background: var(--privy-color-background);
1008
1008
  color: var(--privy-color-accent);
1009
- `,kv=To.div`
1009
+ `,kv=Po.div`
1010
1010
  overflow: visible;
1011
1011
  position: relative;
1012
1012
  height: 44px;
1013
- `,Rv=To.div`
1013
+ `,Rv=Po.div`
1014
1014
  position: absolute;
1015
1015
  display: flex;
1016
1016
  align-items: center;
@@ -1022,7 +1022,7 @@ Resources:
1022
1022
  border-radius: var(--privy-border-radius-md);
1023
1023
  background-color: var(--privy-color-background-2);
1024
1024
  color: var(--privy-color-foreground-3);
1025
- `,Iv=To.div`
1025
+ `,Iv=Po.div`
1026
1026
  display: flex;
1027
1027
  align-items: center;
1028
1028
  padding-top: 1px;
@@ -1035,7 +1035,7 @@ Resources:
1035
1035
  font-size: 12px;
1036
1036
  font-weight: 500;
1037
1037
  margin: auto;
1038
- `,Mv=To.div`
1038
+ `,Mv=Po.div`
1039
1039
  border: 1px solid var(--privy-color-background-2) !important;
1040
1040
  border-radius: var(--privy-border-radius-md);
1041
1041
  padding: 16px;
@@ -1057,7 +1057,7 @@ Resources:
1057
1057
  color: var(--privy-color-error);
1058
1058
  }
1059
1059
  }
1060
- `;import Nv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Dv,useState as Gf}from"react";import Uv from"styled-components";import{useCallback as Lv,useRef as Ov}from"react";function dl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=Ov(!1);return{createWallet:Lv(async i=>{let a=await xe();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(xn);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((y,v)=>{setTimeout(()=>{v(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 h=_e(f);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as Bv,jsx as ri,jsxs as Vf}from"react/jsx-runtime";var zf=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),[i,a]=Gf(""),{embeddedWallets:l}=dr(),{authenticated:s}=F(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:h}=o.createWallet,y=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:v}=dl(),[g,S]=Gf(null),b=new De(async()=>{try{let I=await v();if(!I)return;S(I),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(I){a(I.message)}});Dv(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(y){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let I=Rf("create",l.userOwnedRecoveryOptions);return r(I)}b.execute()},[y,s]);let w=()=>{g?(u(g),c({shouldCallAuthOnSuccess:h})):(f(new bt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Vf(Bv,{children:[ri(T,{closeable:!1}),Vf(_r,{children:[ri(Nv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ri(Te,{title:"Something went wrong",description:i})]}),ri(L,{onClick:w,children:"Close"}),ri(Fv,{})]}):ri(Jn,{})},Fv=Uv.div`
1060
+ `;import Nv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Dv,useState as Gf}from"react";import Uv from"styled-components";import{useCallback as Lv,useRef as Ov}from"react";function dl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=Ov(!1);return{createWallet:Lv(async i=>{let a=await xe();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(xn);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((y,v)=>{setTimeout(()=>{v(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 h=_e(f);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as Bv,jsx as ri,jsxs as Vf}from"react/jsx-runtime";var zf=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),[i,a]=Gf(""),{embeddedWallets:l}=dr(),{authenticated:s}=F(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:h}=o.createWallet,y=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:v}=dl(),[g,S]=Gf(null),b=new De(async()=>{try{let I=await v();if(!I)return;S(I),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(I){a(I.message)}});Dv(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(y){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let I=Rf("create",l.userOwnedRecoveryOptions);return r(I)}b.execute()},[y,s]);let w=()=>{g?(u(g),c({shouldCallAuthOnSuccess:h})):(f(new bt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Vf(Bv,{children:[ri(P,{closeable:!1}),Vf(_r,{children:[ri(Nv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ri(Pe,{title:"Something went wrong",description:i})]}),ri(L,{onClick:w,children:"Close"}),ri(Fv,{})]}):ri(Jn,{})},Fv=Uv.div`
1061
1061
  height: 44px;
1062
1062
  `;import{useEffect as W4,useState as hl}from"react";import{useCallback as hd,useEffect as M4}from"react";import qv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as $v,useState as pd}from"react";import Hv from"@heroicons/react/24/outline/ArrowPathIcon";import Gv from"@heroicons/react/24/outline/EyeIcon";import Vv from"@heroicons/react/24/outline/EyeSlashIcon";import ht,{css as cd}from"styled-components";var zv=cd`
1063
1063
  font-size: 14px;
@@ -1238,7 +1238,7 @@ Resources:
1238
1238
  transition: all 0.1s ease-out;
1239
1239
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1240
1240
  }
1241
- `;import{Fragment as Kv,jsx as Yt,jsxs as ul}from"react/jsx-runtime";var Yf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=pd(!0),[l,s]=pd(!1),[c,u]=pd(""),f=r===c;return $v(()=>{c&&!l&&s(!0)},[c]),ul(Kv,{children:[Yt(T,{title:"Confirm Password",closeable:!1,backFn:n}),Yt(X,{}),ul(So,{children:[ul(Ao,{children:[Yt(qv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Yt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),Yt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),ul(xo,{children:[Yt(oi,{value:c,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),Yt(ni,{style:{right:"0.75rem"},children:i?Yt(ii,{onClick:()=>a(!1)}):Yt(ai,{onClick:()=>a(!0)})})]}),Yt(pl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),Yt(_o,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),Yt(re,{}),Yt(V,{protectedByPrivy:!0})]})};import Jv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Qv}from"react";import Xv from"styled-components";import ta from"styled-components";import{jsx as ea,jsxs as Zv}from"react/jsx-runtime";var Zf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ea("label",{children:Zv(jv,{className:e,children:[ea(Qf,{checked:t,...o}),ea(Yv,{color:r,checked:t,children:ea(Jf,{viewBox:"0 0 24 24",children:ea("polyline",{points:"20 6 9 17 4 12"})})})]})});var SW=ta.label`
1241
+ `;import{Fragment as Kv,jsx as Yt,jsxs as ul}from"react/jsx-runtime";var Yf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=pd(!0),[l,s]=pd(!1),[c,u]=pd(""),f=r===c;return $v(()=>{c&&!l&&s(!0)},[c]),ul(Kv,{children:[Yt(P,{title:"Confirm Password",closeable:!1,backFn:n}),Yt(X,{}),ul(So,{children:[ul(Ao,{children:[Yt(qv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Yt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),Yt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),ul(xo,{children:[Yt(oi,{value:c,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),Yt(ni,{style:{right:"0.75rem"},children:i?Yt(ii,{onClick:()=>a(!1)}):Yt(ai,{onClick:()=>a(!0)})})]}),Yt(pl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),Yt(_o,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),Yt(re,{}),Yt(V,{protectedByPrivy:!0})]})};import Jv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Qv}from"react";import Xv from"styled-components";import ta from"styled-components";import{jsx as ea,jsxs as Zv}from"react/jsx-runtime";var Zf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ea("label",{children:Zv(jv,{className:e,children:[ea(Qf,{checked:t,...o}),ea(Yv,{color:r,checked:t,children:ea(Jf,{viewBox:"0 0 24 24",children:ea("polyline",{points:"20 6 9 17 4 12"})})})]})});var SW=ta.label`
1242
1242
  && {
1243
1243
  cursor: pointer;
1244
1244
  display: flex;
@@ -1290,21 +1290,21 @@ Resources:
1290
1290
  ${Jf} {
1291
1291
  visibility: ${e=>e.checked?"visible":"hidden"};
1292
1292
  }
1293
- `;import{Fragment as Xf,jsx as fr,jsxs as ra}from"react/jsx-runtime";var eh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=Qv(!1);return ra(Xf,{children:[fr(T,{title:"Confirm Password",closeable:!1,backFn:o}),fr(X,{}),ra(So,{children:[ra(Ao,{children:[fr(Jv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),fr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),fr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),fr(Qi,{children:ra(Xi,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[fr(Zf,{color:"var(--privy-color-error)",checked:i}),fr(Xf,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ra(e4,{children:[n.initiatedBy==="user"&&fr(Pr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),fr(_o,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),fr(re,{}),fr(V,{protectedByPrivy:!0})]})},e4=Xv.div`
1293
+ `;import{Fragment as Xf,jsx as fr,jsxs as ra}from"react/jsx-runtime";var eh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=Qv(!1);return ra(Xf,{children:[fr(P,{title:"Confirm Password",closeable:!1,backFn:o}),fr(X,{}),ra(So,{children:[ra(Ao,{children:[fr(Jv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),fr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),fr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),fr(Qi,{children:ra(Xi,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[fr(Zf,{color:"var(--privy-color-error)",checked:i}),fr(Xf,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ra(e4,{children:[n.initiatedBy==="user"&&fr(Tr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),fr(_o,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),fr(re,{}),fr(V,{protectedByPrivy:!0})]})},e4=Xv.div`
1294
1294
  display: flex;
1295
1295
  gap: 10px;
1296
- `;import y4 from"@heroicons/react/24/outline/KeyIcon";import sh from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as lh,useMemo as ud,useEffect as g4}from"react";import ch from"styled-components";import t4 from"fast-password-entropy";import*as th from"secure-password-utilities";import{DEFAULT_WORDLIST as r4}from"secure-password-utilities/wordlists";var o4=95,n4=8,i4=3,a4=.3,s4=/[a-z]/,l4=/[A-Z]/,c4=/[0-9]/,d4="a-zA-Z0-9",rh="!@#$%^&*()\\-_+.",oh=`${d4}${rh}`,p4=new RegExp(`[${rh}]`),u4=new RegExp(`[${oh}]`),nh=new RegExp(`^[${oh}]{6,}$`),ih=(e="")=>{let t=e.split("").filter(r=>!u4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ml=()=>th.generatePassphrase(4,r4);function m4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function f4(e){if(e.length<n4)return 0;let t=0;s4.test(e)&&(t+=1),l4.test(e)&&(t+=1),c4.test(e)&&(t+=1),p4.test(e)&&(t+=1);let r=t/i4;return Math.max(0,Math.min(1,r))}function h4(e=""){let t=f4(e),r=t4(e)/o4;return(t*a4+r)/2}function ah(e=""){let t=h4(e);return{value:t,label:m4(t)}}import{Fragment as w4,jsx as st,jsxs as so}from"react/jsx-runtime";var dh=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=lh(!1),[f,h]=lh(!1);g4(()=>{r&&!f&&h(!0)},[r]);let y=ud(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":nh.test(r||"")?null:`Invalid characters used ( ${ih(r).join(" ")} )`:null,[r,f]),v=ud(()=>y?{value:0,label:"Weak"}:ah(r),[r,y]),g=ud(()=>!!(!r?.length||y),[y,r]);return so(w4,{children:[st(T,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),st(X,{}),so(So,{children:[so(Ao,{children:[st(y4,{height:48,width:48,stroke:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),so(xo,{children:[st(oi,{value:r,onChange:S=>l(S.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),so(ni,{style:{width:"3.5rem"},children:[c?st(ii,{onClick:()=>u(!1)}):st(ai,{onClick:()=>u(!0)}),st(Kf,{onClick:s})]})]}),st(jf,{value:v.value===0?.01:v.value,label:v.label}),st(pl,{error:!!y,children:y||`Password Strength: ${f?v.label:"--"}`}),so(C4,{children:[st(v4,{children:so(Qi,{children:[so(Xi,{children:[st(sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),so(Xi,{children:[st(sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),st(_o,{onClick:n,loading:t,disabled:g,hideAnimations:e,children:"Continue"})]})]}),st(re,{}),st(V,{protectedByPrivy:!0})]})},v4=ch(Qi)`
1296
+ `;import y4 from"@heroicons/react/24/outline/KeyIcon";import sh from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as lh,useMemo as ud,useEffect as g4}from"react";import ch from"styled-components";import t4 from"fast-password-entropy";import*as th from"secure-password-utilities";import{DEFAULT_WORDLIST as r4}from"secure-password-utilities/wordlists";var o4=95,n4=8,i4=3,a4=.3,s4=/[a-z]/,l4=/[A-Z]/,c4=/[0-9]/,d4="a-zA-Z0-9",rh="!@#$%^&*()\\-_+.",oh=`${d4}${rh}`,p4=new RegExp(`[${rh}]`),u4=new RegExp(`[${oh}]`),nh=new RegExp(`^[${oh}]{6,}$`),ih=(e="")=>{let t=e.split("").filter(r=>!u4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ml=()=>th.generatePassphrase(4,r4);function m4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function f4(e){if(e.length<n4)return 0;let t=0;s4.test(e)&&(t+=1),l4.test(e)&&(t+=1),c4.test(e)&&(t+=1),p4.test(e)&&(t+=1);let r=t/i4;return Math.max(0,Math.min(1,r))}function h4(e=""){let t=f4(e),r=t4(e)/o4;return(t*a4+r)/2}function ah(e=""){let t=h4(e);return{value:t,label:m4(t)}}import{Fragment as w4,jsx as st,jsxs as so}from"react/jsx-runtime";var dh=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=lh(!1),[f,h]=lh(!1);g4(()=>{r&&!f&&h(!0)},[r]);let y=ud(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":nh.test(r||"")?null:`Invalid characters used ( ${ih(r).join(" ")} )`:null,[r,f]),v=ud(()=>y?{value:0,label:"Weak"}:ah(r),[r,y]),g=ud(()=>!!(!r?.length||y),[y,r]);return so(w4,{children:[st(P,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),st(X,{}),so(So,{children:[so(Ao,{children:[st(y4,{height:48,width:48,stroke:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),so(xo,{children:[st(oi,{value:r,onChange:S=>l(S.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),so(ni,{style:{width:"3.5rem"},children:[c?st(ii,{onClick:()=>u(!1)}):st(ai,{onClick:()=>u(!0)}),st(Kf,{onClick:s})]})]}),st(jf,{value:v.value===0?.01:v.value,label:v.label}),st(pl,{error:!!y,children:y||`Password Strength: ${f?v.label:"--"}`}),so(C4,{children:[st(v4,{children:so(Qi,{children:[so(Xi,{children:[st(sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),so(Xi,{children:[st(sh,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),st(_o,{onClick:n,loading:t,disabled:g,hideAnimations:e,children:"Continue"})]})]}),st(re,{}),st(V,{protectedByPrivy:!0})]})},v4=ch(Qi)`
1297
1297
  flex: 1;
1298
1298
  padding-top: 1rem;
1299
1299
  `,C4=ch.div`
1300
1300
  display: flex;
1301
1301
  flex-direction: column;
1302
1302
  height: 100%;
1303
- `;import b4 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import E4 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import P4 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import T4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as S4,useCallback as ph}from"react";import{Fragment as md,jsx as Lt,jsxs as pn}from"react/jsx-runtime";var uh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=S4(!1),s=ph(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=ph(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([_4(r,o)],{type:"text/plain"}),y=URL.createObjectURL(h);u.href=y,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(y)},5e3)},[o]);return pn(md,{children:[Lt(T,{backFn:i,title:"Save Password",closeable:!1}),Lt(X,{}),pn(So,{children:[pn(Ao,{children:[Lt(T4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Lt(xo,{centered:!0,children:Lt($f,{children:o})}),pn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Lt(dd,{onClick:s,children:a?pn(md,{children:[Lt(E4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):pn(md,{children:[Lt(P4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),pn(dd,{onClick:c,children:[Lt(b4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Lt(_o,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Lt(re,{}),Lt(V,{protectedByPrivy:!0})]})},_4=(e,t)=>`Your wallet recovery password for ${e} is
1303
+ `;import b4 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import E4 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import T4 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import P4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as S4,useCallback as ph}from"react";import{Fragment as md,jsx as Lt,jsxs as pn}from"react/jsx-runtime";var uh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=S4(!1),s=ph(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=ph(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([_4(r,o)],{type:"text/plain"}),y=URL.createObjectURL(h);u.href=y,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(y)},5e3)},[o]);return pn(md,{children:[Lt(P,{backFn:i,title:"Save Password",closeable:!1}),Lt(X,{}),pn(So,{children:[pn(Ao,{children:[Lt(P4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Lt(xo,{centered:!0,children:Lt($f,{children:o})}),pn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Lt(dd,{onClick:s,children:a?pn(md,{children:[Lt(E4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):pn(md,{children:[Lt(T4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),pn(dd,{onClick:c,children:[Lt(b4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Lt(_o,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Lt(re,{}),Lt(V,{protectedByPrivy:!0})]})},_4=(e,t)=>`Your wallet recovery password for ${e} is
1304
1304
 
1305
1305
  ${t}
1306
1306
 
1307
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import x4 from"@heroicons/react/24/solid/CheckCircleIcon";import A4 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as k4,jsx as lo,jsxs as fd}from"react/jsx-runtime";var mh=({error:e,onClose:t})=>fd(k4,{children:[lo(T,{closeable:!1}),lo(X,{}),e?fd(_r,{children:[lo(A4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),lo(Te,{title:"Something went wrong",description:e})]}):fd(_r,{children:[lo(x4,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),lo(Te,{title:"Success"})]}),lo(L,{onClick:t,children:"Close"}),lo(re,{}),lo(V,{protectedByPrivy:!0})]});import{useReducer as R4}from"react";var I4=(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}},fh=()=>{let[e,t]=R4(I4,"creating");return{send:t,state:e}};import{jsx as oa}from"react/jsx-runtime";var fl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=_(),{send:n,state:i}=fh(),a=hd(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);M4(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),We)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=hd(()=>{n("back")},[n]),s=hd(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?oa(dh,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?oa(uh,{...t,onSubmit:a,onBack:l}):i==="confirming"?oa(Yf,{...t,onSubmit:a,onBack:l}):i==="finalizing"?oa(eh,{...t,onSubmit:a,onBack:l}):i==="done"?oa(mh,{...t,onSubmit:a}):null};import{jsx as L4}from"react/jsx-runtime";var hh=()=>{let[e,t]=hl(null),[r,o]=hl(!1),[n,i]=hl(null),[a,l]=hl(""),{authenticated:s,getAccessToken:c,user:u}=F(),{walletProxy:f,refreshUser:h,closePrivyModal:y,createAnalyticsEvent:v}=M(),{app:g,navigate:S,data:b,onUserCloseViaDialogOrKeybindRef:w}=_(),{onSuccess:I,onFailure:A}=b.createWallet,O=_e(u),R=e?.recoveryMethod==="user-passcode";W4(()=>{s||(S("LANDING"),A(new Oa("User must be authenticated before setting a password on a Privy wallet")))},[s]);let k=()=>{if(n){A(n),y({shouldCallAuthOnSuccess:!1});return}if(!R){A(new bt("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}I(e),y({shouldCallAuthOnSuccess:!1})};w.current=k;let H=async()=>{let j=await c();if(j&&O?.address&&a&&f)try{if(v({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:O.address}}),!(await f.setRecoveryPassword({accessToken:j,address:O.address,recoveryPassword:a})).address){i(new bt("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"error setting password"}});return}let $=await h(),D=_e($);if(!D){i(new bt("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"wallet disconnected"}});return}t(D),v({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:O.address}})}catch(W){console.warn(W),i(W instanceof Error?W:new Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:W}})}},q=async()=>{R?(I(e),y({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await H(),o(!1))};return L4(fl,{appName:g?.name||"privy",config:{initiatedBy:"user",onCancel:k},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(ml()),onPasswordChange:l,onSubmit:q,onClose:k})};import O4 from"@heroicons/react/24/outline/UserCircleIcon";import N4 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as D4,jsx as co,jsxs as yl}from"react/jsx-runtime";var yh=()=>{let{user:e}=F(),{closePrivyModal:t,createAnalyticsEvent:r}=M(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new bt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,yl(D4,{children:[co(T,{onClose:c}),co(X,{}),yl(_r,{children:[yl(Km,{children:[co(O4,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),co(jm,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:co(N4,{width:"12px",height:"12px",fill:"white"})})]}),yl(Te,{title:"Secure Your Account",children:["Please set a password to secure your account.",co("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),co(L,{onClick:()=>{let f=_e(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:f?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),co(re,{}),co(V,{protectedByPrivy:!0})]})};import U4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import F4 from"@heroicons/react/24/outline/PhoneIcon";import gh from"styled-components";import{Fragment as V4,jsx as hr,jsxs as gl}from"react/jsx-runtime";var B4=e=>{let t=hr(U4,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof E)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Be&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:hr(F4,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ge)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:hr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:hr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:hr("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};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof wr&&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}}},vh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_();return hr(na,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},na=({error:e,backFn:t,onClick:r})=>{let{reset:o}=fe(),n=B4(e),i=()=>{e instanceof Ge&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return gl(V4,{children:[hr(T,{backFn:t}),gl(H4,{children:[hr(rt,{children:gl("div",{children:[hr(el,{color:"var(--privy-color-error)"}),n.icon]})}),gl(G4,{children:[hr("h3",{children:n.title}),hr("p",{children:n.detail})]}),hr(L,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},H4=gh.div`
1307
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import x4 from"@heroicons/react/24/solid/CheckCircleIcon";import A4 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as k4,jsx as lo,jsxs as fd}from"react/jsx-runtime";var mh=({error:e,onClose:t})=>fd(k4,{children:[lo(P,{closeable:!1}),lo(X,{}),e?fd(_r,{children:[lo(A4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),lo(Pe,{title:"Something went wrong",description:e})]}):fd(_r,{children:[lo(x4,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),lo(Pe,{title:"Success"})]}),lo(L,{onClick:t,children:"Close"}),lo(re,{}),lo(V,{protectedByPrivy:!0})]});import{useReducer as R4}from"react";var I4=(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}},fh=()=>{let[e,t]=R4(I4,"creating");return{send:t,state:e}};import{jsx as oa}from"react/jsx-runtime";var fl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=_(),{send:n,state:i}=fh(),a=hd(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);M4(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),We)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=hd(()=>{n("back")},[n]),s=hd(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?oa(dh,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?oa(uh,{...t,onSubmit:a,onBack:l}):i==="confirming"?oa(Yf,{...t,onSubmit:a,onBack:l}):i==="finalizing"?oa(eh,{...t,onSubmit:a,onBack:l}):i==="done"?oa(mh,{...t,onSubmit:a}):null};import{jsx as L4}from"react/jsx-runtime";var hh=()=>{let[e,t]=hl(null),[r,o]=hl(!1),[n,i]=hl(null),[a,l]=hl(""),{authenticated:s,getAccessToken:c,user:u}=F(),{walletProxy:f,refreshUser:h,closePrivyModal:y,createAnalyticsEvent:v}=M(),{app:g,navigate:S,data:b,onUserCloseViaDialogOrKeybindRef:w}=_(),{onSuccess:I,onFailure:A}=b.createWallet,O=_e(u),R=e?.recoveryMethod==="user-passcode";W4(()=>{s||(S("LANDING"),A(new Oa("User must be authenticated before setting a password on a Privy wallet")))},[s]);let k=()=>{if(n){A(n),y({shouldCallAuthOnSuccess:!1});return}if(!R){A(new bt("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}I(e),y({shouldCallAuthOnSuccess:!1})};w.current=k;let H=async()=>{let j=await c();if(j&&O?.address&&a&&f)try{if(v({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:O.address}}),!(await f.setRecoveryPassword({accessToken:j,address:O.address,recoveryPassword:a})).address){i(new bt("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"error setting password"}});return}let $=await h(),D=_e($);if(!D){i(new bt("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"wallet disconnected"}});return}t(D),v({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:O.address}})}catch(W){console.warn(W),i(W instanceof Error?W:new Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:W}})}},q=async()=>{R?(I(e),y({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await H(),o(!1))};return L4(fl,{appName:g?.name||"privy",config:{initiatedBy:"user",onCancel:k},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(ml()),onPasswordChange:l,onSubmit:q,onClose:k})};import O4 from"@heroicons/react/24/outline/UserCircleIcon";import N4 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as D4,jsx as co,jsxs as yl}from"react/jsx-runtime";var yh=()=>{let{user:e}=F(),{closePrivyModal:t,createAnalyticsEvent:r}=M(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new bt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,yl(D4,{children:[co(P,{onClose:c}),co(X,{}),yl(_r,{children:[yl(Km,{children:[co(O4,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),co(jm,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:co(N4,{width:"12px",height:"12px",fill:"white"})})]}),yl(Pe,{title:"Secure Your Account",children:["Please set a password to secure your account.",co("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),co(L,{onClick:()=>{let f=_e(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:f?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),co(re,{}),co(V,{protectedByPrivy:!0})]})};import U4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import F4 from"@heroicons/react/24/outline/PhoneIcon";import gh from"styled-components";import{Fragment as V4,jsx as hr,jsxs as gl}from"react/jsx-runtime";var B4=e=>{let t=hr(U4,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof E)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Be&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:hr(F4,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ge)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:hr(tl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:hr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:hr("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 wr&&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}}},vh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_();return hr(na,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},na=({error:e,backFn:t,onClick:r})=>{let{reset:o}=fe(),n=B4(e),i=()=>{e instanceof Ge&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return gl(V4,{children:[hr(P,{backFn:t}),gl(H4,{children:[hr(rt,{children:gl("div",{children:[hr(el,{color:"var(--privy-color-error)"}),n.icon]})}),gl(G4,{children:[hr("h3",{children:n.title}),hr("p",{children:n.detail})]}),hr(L,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},H4=gh.div`
1308
1308
  display: flex;
1309
1309
  flex-direction: column;
1310
1310
  align-items: center;
@@ -1392,7 +1392,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1392
1392
  width: 14px;
1393
1393
  height: 14px;
1394
1394
  }
1395
- `;import Q4 from"qrcode";import X4 from"react";import eC from"styled-components";import{jsx as Eh}from"react/jsx-runtime";var Ph=()=>Eh("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:Eh("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ia,jsx as Pt,jsxs as Sh}from"react/jsx-runtime";var Zt=7,gd=(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},tC=e=>{let t=Q4.create(e,{errorCorrectionLevel:"high"}).modules,r=nu(Array.from(t.data),t.size);return r=gd(r,0,0,Zt,Zt),r=gd(r,r.length-Zt,0,Zt,Zt),r=gd(r,0,r.length-Zt,Zt,Zt),r},rC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Pt(ia,{children:[0,1,2].map(i=>Pt("circle",{r:r*(Zt-i*2)/2,cx:e+r*Zt/2,cy:t+r*Zt/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),oC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Zt)*e,0],[0,(t-Zt)*e]];return Pt(ia,{children:n.map(([i,a])=>Pt(rC,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},nC=({matrix:e,cellSize:t,color:r})=>Pt(ia,{children:e.map((o,n)=>o.map((i,a)=>i?Pt("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):Pt(X4.Fragment,{},`circle-${n}-${a}`)))}),Th=(e,t)=>e-e%t,iC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return Pt(ia,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return Sh(ia,{children:[Pt("rect",{x:Th(c,t),y:Th(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Pt(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},aC=e=>{let t=e.outputSize,r=tC(e.url),o=t/r.length;return Sh("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Pt(nC,{matrix:r,cellSize:o,color:e.fgColor}),Pt(oC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Pt(iC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},sC=eC.div`
1395
+ `;import Q4 from"qrcode";import X4 from"react";import eC from"styled-components";import{jsx as Eh}from"react/jsx-runtime";var Th=()=>Eh("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:Eh("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ia,jsx as Tt,jsxs as Sh}from"react/jsx-runtime";var Zt=7,gd=(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},tC=e=>{let t=Q4.create(e,{errorCorrectionLevel:"high"}).modules,r=nu(Array.from(t.data),t.size);return r=gd(r,0,0,Zt,Zt),r=gd(r,r.length-Zt,0,Zt,Zt),r=gd(r,0,r.length-Zt,Zt,Zt),r},rC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Tt(ia,{children:[0,1,2].map(i=>Tt("circle",{r:r*(Zt-i*2)/2,cx:e+r*Zt/2,cy:t+r*Zt/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),oC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Zt)*e,0],[0,(t-Zt)*e]];return Tt(ia,{children:n.map(([i,a])=>Tt(rC,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},nC=({matrix:e,cellSize:t,color:r})=>Tt(ia,{children:e.map((o,n)=>o.map((i,a)=>i?Tt("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):Tt(X4.Fragment,{},`circle-${n}-${a}`)))}),Ph=(e,t)=>e-e%t,iC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return Tt(ia,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return Sh(ia,{children:[Tt("rect",{x:Ph(c,t),y:Ph(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Tt(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},aC=e=>{let t=e.outputSize,r=tC(e.url),o=t/r.length;return Sh("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Tt(nC,{matrix:r,cellSize:o,color:e.fgColor}),Tt(oC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Tt(iC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},sC=eC.div`
1396
1396
  display: flex;
1397
1397
  justify-content: center;
1398
1398
  align-items: center;
@@ -1407,7 +1407,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1407
1407
  border-color: ${e=>e.fgColor};
1408
1408
  border-radius: var(--privy-border-radius-md);
1409
1409
  }
1410
- `,si=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return Pt(sC,{size:o,bgColor:t,fgColor:r,children:Pt(aC,{url:e.url,logo:{element:e.squareLogoElement??Ph},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as wl,jsxs as lC}from"react/jsx-runtime";var jr=({style:e,...t})=>lC("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:[wl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),wl("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"}),wl("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"}),wl("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 bl,jsx as ge,jsxs as Yr}from"react/jsx-runtime";var Ah="#8a63d2",Ih=1e3,pC=Ih*2,uC=Ih*120,Mh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:h}=M(),[y,v]=vd(void 0),[g,S]=vd(!1),[b,w]=vd(!1),I=cC([]),A=s?.render.inDialog?We:0,O=c(),R=O?.meta.connectUri;return _h(()=>{let k=Date.now(),H=setInterval(async()=>{let q=await O.pollForReady.execute(),j=Date.now()-k;if(q){clearInterval(H),S(!0);try{await u(),w(!0)}catch(W){let $={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new sr(W).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?$.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?($.retryable=!0,$.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&($.detail="Too many requests. Please wait before trying again.");v($)}}else j>uC&&(clearInterval(H),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},pC);return()=>{clearInterval(H),I.current.forEach(q=>clearTimeout(q))}},[]),_h(()=>{if(r&&e&&b&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(H)}b&&(kt(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):I.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[b,r,e,o]),xh||g?Yr(bl,{children:[ge(T,{backFn:n?a:void 0,onClose:f},"header"),ge(X,{}),dC?ge(bl,{children:Yr(mC,{children:[ge(rt,{children:Yr("div",{children:[ge(Xe,{success:b,fail:!!y}),ge(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[ge(ae,{children:y?y.message:"Sign in with Farcaster"}),ge(se,{children:y?y.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),R&&ge(L,{onClick:k=>{k.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):ge(bl,{children:Yr(kh,{children:[ge(rt,{children:Yr("div",{children:[ge(Xe,{success:b,fail:!!y}),ge(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[ge(ae,{children:y?y.message:"Signing in with Farcaster"}),ge(se,{children:y?y.detail:"This should only take a moment"}),ge(Et,{children:R&&xh&&ge(Cl,{text:"Take me to Warpcast",url:R,color:Ah})})]})]})}),ge(G,{})]}):Yr(bl,{children:[ge(T,{backFn:n?a:void 0,onClose:f},"header"),ge(X,{}),ge(kh,{children:Yr("div",{children:[ge(ae,{children:"Sign in with Farcaster"}),ge(se,{children:"Scan with your phone's camera to continue."}),ge(Gn,{children:R?ge(si,{url:R,size:275,squareLogoElement:jr}):ge(et,{})}),Yr(Et,{children:[ge(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),R&&ge(ko,{text:R,itemName:"link",color:Ah})]})]})}),ge(G,{})]})},kh=Rh.div`
1410
+ `,si=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return Tt(sC,{size:o,bgColor:t,fgColor:r,children:Tt(aC,{url:e.url,logo:{element:e.squareLogoElement??Th},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as wl,jsxs as lC}from"react/jsx-runtime";var jr=({style:e,...t})=>lC("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:[wl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),wl("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"}),wl("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"}),wl("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 bl,jsx as ge,jsxs as Yr}from"react/jsx-runtime";var Ah="#8a63d2",Ih=1e3,pC=Ih*2,uC=Ih*120,Mh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:h}=M(),[y,v]=vd(void 0),[g,S]=vd(!1),[b,w]=vd(!1),I=cC([]),A=s?.render.inDialog?We:0,O=c(),R=O?.meta.connectUri;return _h(()=>{let k=Date.now(),H=setInterval(async()=>{let q=await O.pollForReady.execute(),j=Date.now()-k;if(q){clearInterval(H),S(!0);try{await u(),w(!0)}catch(W){let $={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new sr(W).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?$.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?($.retryable=!0,$.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&($.detail="Too many requests. Please wait before trying again.");v($)}}else j>uC&&(clearInterval(H),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},pC);return()=>{clearInterval(H),I.current.forEach(q=>clearTimeout(q))}},[]),_h(()=>{if(r&&e&&b&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(H)}b&&(kt(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):I.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[b,r,e,o]),xh||g?Yr(bl,{children:[ge(P,{backFn:n?a:void 0,onClose:f},"header"),ge(X,{}),dC?ge(bl,{children:Yr(mC,{children:[ge(rt,{children:Yr("div",{children:[ge(Xe,{success:b,fail:!!y}),ge(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[ge(ae,{children:y?y.message:"Sign in with Farcaster"}),ge(se,{children:y?y.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),R&&ge(L,{onClick:k=>{k.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):ge(bl,{children:Yr(kh,{children:[ge(rt,{children:Yr("div",{children:[ge(Xe,{success:b,fail:!!y}),ge(jr,{style:{width:"38px",height:"38px"}})]})}),Yr(qe,{children:[ge(ae,{children:y?y.message:"Signing in with Farcaster"}),ge(se,{children:y?y.detail:"This should only take a moment"}),ge(Et,{children:R&&xh&&ge(Cl,{text:"Take me to Warpcast",url:R,color:Ah})})]})]})}),ge(G,{})]}):Yr(bl,{children:[ge(P,{backFn:n?a:void 0,onClose:f},"header"),ge(X,{}),ge(kh,{children:Yr("div",{children:[ge(ae,{children:"Sign in with Farcaster"}),ge(se,{children:"Scan with your phone's camera to continue."}),ge(Gn,{children:R?ge(si,{url:R,size:275,squareLogoElement:jr}):ge(et,{})}),Yr(Et,{children:[ge(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),R&&ge(ko,{text:R,itemName:"link",color:Ah})]})]})}),ge(G,{})]})},kh=Rh.div`
1411
1411
  display: flex;
1412
1412
  flex-direction: column;
1413
1413
  align-items: center;
@@ -1422,7 +1422,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1422
1422
  justify-content: center;
1423
1423
  gap: 24px;
1424
1424
  width: 100%;
1425
- `;import{useEffect as fC,useRef as hC,useState as Cd}from"react";import{isIOS as yC,isMobile as Wh}from"react-device-detect";import Nh from"styled-components";import{Fragment as El,jsx as be,jsxs as Ir}from"react/jsx-runtime";var Lh="#8a63d2",Dh=1e3,gC=Dh*2,vC=Dh*300,Uh=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=Cd(void 0),[s,c]=Cd(!1),[u,f]=Cd(!1),h=hC([]),y=o?.render.inDialog?We:0,v=r?.farcasterSigner;fC(()=>{let S=Date.now(),b=setInterval(async()=>{if(!v?.public_key){clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}v.status==="approved"&&(clearInterval(b),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y)));let w=await n(v?.public_key),I=Date.now()-S;w.status==="approved"?(clearInterval(b),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y))):I>vC?(clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):w.status==="revoked"&&(clearInterval(b),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},gC);return()=>{clearInterval(b),h.current.forEach(w=>clearTimeout(w))}},[]);let g=v?.status==="pending_approval"?v.signer_approval_url:void 0;return Wh||s?Ir(El,{children:[be(T,{backFn:e?t:void 0,onClose:i},"header"),be(X,{}),yC?be(El,{children:Ir(CC,{children:[be(rt,{children:Ir("div",{children:[be(Xe,{success:u,fail:!!a}),be(jr,{style:{width:"38px",height:"38px"}})]})}),Ir(qe,{children:[be(ae,{children:a?a.message:"Add a signer to Farcaster"}),be(se,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),g&&be(L,{onClick:S=>{S.preventDefault(),window.location.href=g},children:"Open Warpcast app"})]})}):be(El,{children:Ir(Oh,{children:[be(rt,{children:Ir("div",{children:[be(Xe,{success:u,fail:!!a}),be(jr,{style:{width:"38px",height:"38px"}})]})}),Ir(qe,{children:[be(ae,{children:a?a.message:"Requesting signer from Farcaster"}),be(se,{children:a?a.detail:"This should only take a moment"}),be(Et,{children:g&&Wh&&be(Cl,{text:"Take me to Warpcast",url:g,color:Lh})})]})]})}),be(G,{})]}):Ir(El,{children:[be(T,{backFn:e?t:void 0,onClose:i},"header"),be(X,{}),be(Oh,{children:Ir("div",{children:[be(ae,{children:"Add a signer to Farcaster"}),Ir(se,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),be(Gn,{children:v?.status==="pending_approval"?be(si,{url:v.signer_approval_url,size:275,squareLogoElement:jr}):be(et,{})}),Ir(Et,{children:[be(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),v?.status==="pending_approval"&&be(ko,{text:v.signer_approval_url,itemName:"link",color:Lh})]})]})}),be(G,{})]})},Oh=Nh.div`
1425
+ `;import{useEffect as fC,useRef as hC,useState as Cd}from"react";import{isIOS as yC,isMobile as Wh}from"react-device-detect";import Nh from"styled-components";import{Fragment as El,jsx as be,jsxs as Ir}from"react/jsx-runtime";var Lh="#8a63d2",Dh=1e3,gC=Dh*2,vC=Dh*300,Uh=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=Cd(void 0),[s,c]=Cd(!1),[u,f]=Cd(!1),h=hC([]),y=o?.render.inDialog?We:0,v=r?.farcasterSigner;fC(()=>{let S=Date.now(),b=setInterval(async()=>{if(!v?.public_key){clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}v.status==="approved"&&(clearInterval(b),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y)));let w=await n(v?.public_key),I=Date.now()-S;w.status==="approved"?(clearInterval(b),c(!1),f(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y))):I>vC?(clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):w.status==="revoked"&&(clearInterval(b),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},gC);return()=>{clearInterval(b),h.current.forEach(w=>clearTimeout(w))}},[]);let g=v?.status==="pending_approval"?v.signer_approval_url:void 0;return Wh||s?Ir(El,{children:[be(P,{backFn:e?t:void 0,onClose:i},"header"),be(X,{}),yC?be(El,{children:Ir(CC,{children:[be(rt,{children:Ir("div",{children:[be(Xe,{success:u,fail:!!a}),be(jr,{style:{width:"38px",height:"38px"}})]})}),Ir(qe,{children:[be(ae,{children:a?a.message:"Add a signer to Farcaster"}),be(se,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),g&&be(L,{onClick:S=>{S.preventDefault(),window.location.href=g},children:"Open Warpcast app"})]})}):be(El,{children:Ir(Oh,{children:[be(rt,{children:Ir("div",{children:[be(Xe,{success:u,fail:!!a}),be(jr,{style:{width:"38px",height:"38px"}})]})}),Ir(qe,{children:[be(ae,{children:a?a.message:"Requesting signer from Farcaster"}),be(se,{children:a?a.detail:"This should only take a moment"}),be(Et,{children:g&&Wh&&be(Cl,{text:"Take me to Warpcast",url:g,color:Lh})})]})]})}),be(G,{})]}):Ir(El,{children:[be(P,{backFn:e?t:void 0,onClose:i},"header"),be(X,{}),be(Oh,{children:Ir("div",{children:[be(ae,{children:"Add a signer to Farcaster"}),Ir(se,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),be(Gn,{children:v?.status==="pending_approval"?be(si,{url:v.signer_approval_url,size:275,squareLogoElement:jr}):be(et,{})}),Ir(Et,{children:[be(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),v?.status==="pending_approval"&&be(ko,{text:v.signer_approval_url,itemName:"link",color:Lh})]})]})}),be(G,{})]})},Oh=Nh.div`
1426
1426
  display: flex;
1427
1427
  flex-direction: column;
1428
1428
  align-items: center;
@@ -1437,7 +1437,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1437
1437
  justify-content: center;
1438
1438
  gap: 24px;
1439
1439
  width: 100%;
1440
- `;import bC from"@heroicons/react/24/outline/ClockIcon";import EC from"@heroicons/react/24/outline/EyeSlashIcon";import PC from"@heroicons/react/24/outline/LinkIcon";import Zr from"styled-components";import{jsx as wd,jsxs as wC}from"react/jsx-runtime";var Pl=({size:e=61,...t})=>wd("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:wC("g",{id:"moonpay_symbol_wht 2",children:[wd("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),wd("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as Fh,jsx as Tt,jsxs as un}from"react/jsx-runtime";var bd=({title:e,desc:t,icon:r})=>un(kC,{children:[Tt(IC,{children:r}),un(RC,{children:[Tt(xC,{children:e}),Tt(AC,{children:t})]})]}),Bh=({app:e,signedUrl:t,onContinue:r})=>un(Fh,{children:[un(SC,{children:[Tt(Pl,{size:"3.75rem"}),un(_C,{children:[e?.name," uses ",Tt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),un(MC,{children:[Tt(bd,{icon:Tt(PC,{width:"1rem"}),title:"Purchase assets to fund your account",desc:un(Fh,{children:["Connect a payment method (",Tt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Tt(bd,{icon:Tt(bC,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Tt(bd,{icon:Tt(EC,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Tt(WC,{className:"mobile-only"})]}),Tt(TC,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Tt(zs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),TC=Zr.span`
1440
+ `;import bC from"@heroicons/react/24/outline/ClockIcon";import EC from"@heroicons/react/24/outline/EyeSlashIcon";import TC from"@heroicons/react/24/outline/LinkIcon";import Zr from"styled-components";import{jsx as wd,jsxs as wC}from"react/jsx-runtime";var Tl=({size:e=61,...t})=>wd("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:wC("g",{id:"moonpay_symbol_wht 2",children:[wd("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),wd("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as Fh,jsx as Pt,jsxs as un}from"react/jsx-runtime";var bd=({title:e,desc:t,icon:r})=>un(kC,{children:[Pt(IC,{children:r}),un(RC,{children:[Pt(xC,{children:e}),Pt(AC,{children:t})]})]}),Bh=({app:e,signedUrl:t,onContinue:r})=>un(Fh,{children:[un(SC,{children:[Pt(Tl,{size:"3.75rem"}),un(_C,{children:[e?.name," uses ",Pt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),un(MC,{children:[Pt(bd,{icon:Pt(TC,{width:"1rem"}),title:"Purchase assets to fund your account",desc:un(Fh,{children:["Connect a payment method (",Pt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Pt(bd,{icon:Pt(bC,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Pt(bd,{icon:Pt(EC,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Pt(WC,{className:"mobile-only"})]}),Pt(PC,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Pt(zs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),PC=Zr.span`
1441
1441
  display: inline-block;
1442
1442
  color: var(--privy-color-foreground-3);
1443
1443
  text-align: center;
@@ -1493,7 +1493,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1493
1493
  margin: 0 0.5rem;
1494
1494
  `,WC=Zr.div`
1495
1495
  margin: 30px 0;
1496
- `;import{ofetch as LC}from"ofetch";import{useEffect as OC,useRef as NC,useState as DC}from"react";var Tl="moonpay",Hh="sdk_fiat_on_ramp_completed_with_status";async function Gh(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 UC(e,t){let r=t?Eu:bu,o=t?Tu:Pu;return LC(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Vh(e,t=!1){let[r,o]=DC(null),{createAnalyticsEvent:n}=M(),i=NC(0);return OC(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await UC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Hh,payload:{status:s,provider:Tl,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:Hh,payload:{status:"serviceFailure",provider:Tl}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as FC,jsx as Ed,jsxs as BC}from"react/jsx-runtime";var zh=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:BC(FC,{children:[Ed(T,{title:"Fund account"},"header"),Ed(Bh,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Tl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Ed(V,{protectedByPrivy:!0})]})};import HC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import GC from"@heroicons/react/24/solid/CheckCircleIcon";import VC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as zC}from"react";import qh from"styled-components";import{Fragment as Pd,jsx as St,jsxs as mn}from"react/jsx-runtime";var $h=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Vh(o||null,e.fiatOnRamp.useSandbox);return mn(Pd,{children:[St(T,{title:"Fund account"},"header"),St($C,{status:n,onClickCta:r}),St(V,{protectedByPrivy:!0})]})},qC=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:mn(Pd,{children:[mn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",St("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),St("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:""}}},$C=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=zC(()=>qC(e),[e]);return mn(Pd,{children:[mn(JC,{children:[St(YC,{status:e}),mn(qe,{children:[St("h3",{children:r}),St(ZC,{children:o})]})]}),n&&St(L,{onClick:t,children:n})]})},KC=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)",jC=e=>{switch(e){case"serviceFailure":case"failed":return VC;case"completed":return GC;case"waitingAuthorization":return()=>St(HC,{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}},YC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return mn("div",{style:{position:"relative"},children:[St(et,{color:o,style:{position:"absolute"}}),St(Gc,{color:o}),St(Pl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=jC(e),r=KC(e);return St("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&St(t,{width:"4rem",height:"4rem",color:r})})},ZC=qh.p`
1496
+ `;import{ofetch as LC}from"ofetch";import{useEffect as OC,useRef as NC,useState as DC}from"react";var Pl="moonpay",Hh="sdk_fiat_on_ramp_completed_with_status";async function Gh(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 UC(e,t){let r=t?Eu:bu,o=t?Pu:Tu;return LC(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Vh(e,t=!1){let[r,o]=DC(null),{createAnalyticsEvent:n}=M(),i=NC(0);return OC(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await UC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Hh,payload:{status:s,provider:Pl,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:Hh,payload:{status:"serviceFailure",provider:Pl}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as FC,jsx as Ed,jsxs as BC}from"react/jsx-runtime";var zh=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:BC(FC,{children:[Ed(P,{title:"Fund account"},"header"),Ed(Bh,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Pl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),Ed(V,{protectedByPrivy:!0})]})};import HC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import GC from"@heroicons/react/24/solid/CheckCircleIcon";import VC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as zC}from"react";import qh from"styled-components";import{Fragment as Td,jsx as St,jsxs as mn}from"react/jsx-runtime";var $h=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Vh(o||null,e.fiatOnRamp.useSandbox);return mn(Td,{children:[St(P,{title:"Fund account"},"header"),St($C,{status:n,onClickCta:r}),St(V,{protectedByPrivy:!0})]})},qC=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:mn(Td,{children:[mn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",St("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),St("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:""}}},$C=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=zC(()=>qC(e),[e]);return mn(Td,{children:[mn(JC,{children:[St(YC,{status:e}),mn(qe,{children:[St("h3",{children:r}),St(ZC,{children:o})]})]}),n&&St(L,{onClick:t,children:n})]})},KC=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)",jC=e=>{switch(e){case"serviceFailure":case"failed":return VC;case"completed":return GC;case"waitingAuthorization":return()=>St(HC,{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}},YC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return mn("div",{style:{position:"relative"},children:[St(et,{color:o,style:{position:"absolute"}}),St(Gc,{color:o}),St(Tl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=jC(e),r=KC(e);return St("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&St(t,{width:"4rem",height:"4rem",color:r})})},ZC=qh.p`
1497
1497
  font-size: 1rem;
1498
1498
  color: var(--privy-color-foreground-3);
1499
1499
  margin-bottom: 1rem;
@@ -1508,7 +1508,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1508
1508
  margin-left: 1.75rem;
1509
1509
  margin-right: 1.75rem;
1510
1510
  padding: 2rem 0;
1511
- `;import QC from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import XC from"styled-components";import{Fragment as t5,jsx as Ro,jsxs as r5}from"react/jsx-runtime";var Kh=()=>{let{closePrivyModal:e}=M();return r5(t5,{children:[Ro(T,{},"header"),Ro(e5,{children:Ro(QC,{style:{width:32,height:32}})}),Ro(qr,{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"}}),Ro(mr,{children:Ro(L,{onClick:()=>e(),children:"Close"})}),Ro(re,{}),Ro(V,{protectedByPrivy:!0})]})},e5=XC.div`
1511
+ `;import QC from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import XC from"styled-components";import{Fragment as t5,jsx as Ro,jsxs as r5}from"react/jsx-runtime";var Kh=()=>{let{closePrivyModal:e}=M();return r5(t5,{children:[Ro(P,{},"header"),Ro(e5,{children:Ro(QC,{style:{width:32,height:32}})}),Ro(qr,{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"}}),Ro(mr,{children:Ro(L,{onClick:()=>e(),children:"Close"})}),Ro(re,{}),Ro(V,{protectedByPrivy:!0})]})},e5=XC.div`
1512
1512
  border-radius: 50%;
1513
1513
  height: 68px;
1514
1514
  width: 68px;
@@ -1518,18 +1518,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1518
1518
  background-color: var(--privy-color-accent);
1519
1519
  color: white;
1520
1520
  margin: 0 auto 24px auto;
1521
- `;import*as Jh from"react-device-detect";import a5 from"styled-components";import Td from"styled-components";import{jsx as jh}from"react/jsx-runtime";var Yh=({style:e,...t})=>jh("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:jh("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 n5,jsxs as i5}from"react/jsx-runtime";var Zh=Td.div`
1521
+ `;import*as Jh from"react-device-detect";import a5 from"styled-components";import Pd from"styled-components";import{jsx as jh}from"react/jsx-runtime";var Yh=({style:e,...t})=>jh("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:jh("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 n5,jsxs as i5}from"react/jsx-runtime";var Zh=Pd.div`
1522
1522
  display: flex;
1523
1523
  flex-direction: column;
1524
1524
  justify-content: flex-start;
1525
1525
  gap: 4px;
1526
- `,Sd=Td.div`
1526
+ `,Sd=Pd.div`
1527
1527
  &&& {
1528
1528
  margin-left: 7px; /* TODO: This is a total hack */
1529
1529
  border-left: 2px solid var(--privy-color-foreground-4);
1530
1530
  height: 12px;
1531
1531
  }
1532
- `,Sl=({children:e})=>i5(o5,{children:[n5(Yh,{style:{width:"16px",height:"16px"}}),e]}),o5=Td.div`
1532
+ `,Sl=({children:e})=>i5(o5,{children:[n5(Yh,{style:{width:"16px",height:"16px"}}),e]}),o5=Pd.div`
1533
1533
  display: flex;
1534
1534
  justify-content: flex-start;
1535
1535
  justify-items: center;
@@ -1547,7 +1547,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1547
1547
  margin-bottom: auto;
1548
1548
  }
1549
1549
  }
1550
- `;import{Fragment as c5,jsx as lt,jsxs as aa}from"react/jsx-runtime";var s5=()=>aa(l5,{children:[lt(qi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),lt(Et,{children:lt(Br,{style:{width:"152px",height:"152px"}})}),aa(Zh,{children:[lt(Sl,{children:aa("div",{children:[lt("span",{children:"Install the "}),lt("a",{href:Jh.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"})]})}),lt(Sd,{}),lt(Sl,{children:"Set up your first wallet"}),lt(Sd,{}),lt(Sl,{children:"Store your recovery phrase in a safe place!"})]}),lt(Un,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Qh=()=>{let{navigateBack:e}=_();return aa(c5,{children:[lt(T,{backFn:e},"header"),lt(X,{}),lt(s5,{}),lt(re,{}),aa(G,{children:[lt("span",{children:"Still not sure? "}),lt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},l5=a5(Et)`
1550
+ `;import{Fragment as c5,jsx as lt,jsxs as aa}from"react/jsx-runtime";var s5=()=>aa(l5,{children:[lt(qi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),lt(Et,{children:lt(Br,{style:{width:"152px",height:"152px"}})}),aa(Zh,{children:[lt(Sl,{children:aa("div",{children:[lt("span",{children:"Install the "}),lt("a",{href:Jh.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"})]})}),lt(Sd,{}),lt(Sl,{children:"Set up your first wallet"}),lt(Sd,{}),lt(Sl,{children:"Store your recovery phrase in a safe place!"})]}),lt(Un,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Qh=()=>{let{navigateBack:e}=_();return aa(c5,{children:[lt(P,{backFn:e},"header"),lt(X,{}),lt(s5,{}),lt(re,{}),aa(G,{children:[lt("span",{children:"Still not sure? "}),lt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},l5=a5(Et)`
1551
1551
  gap: 30px;
1552
1552
 
1553
1553
  > :first-child > svg {
@@ -1616,7 +1616,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1616
1616
  && > input::placeholder {
1617
1617
  color: var(--privy-color-foreground-3);
1618
1618
  }
1619
- `;import{Fragment as g5,jsx as xl,jsxs as ry}from"react/jsx-runtime";var Al=({isEditable:e,setIsEditable:t})=>{let r=y5(null);return ry(g5,{children:[xl(Sr,{if:!e,children:xl(_l,{ref:r})}),xl(Sr,{if:e,children:ry(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[xl(h5,{})," Continue with Email"]})})]})};import{useState as v5}from"react";import{jsx as _d,jsxs as C5}from"react/jsx-runtime";var kl=()=>{let[e,t]=v5(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=fe(),{initLoginWithFarcaster:l}=M();return C5(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[_d(jr,{})," Farcaster",e&&_d("span",{children:_d(io,{})})]})};import w5,{css as b5}from"styled-components";import{jsx as T5}from"react/jsx-runtime";var Rl=()=>{let{enabled:e,token:t}=fe(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=M();return T5(P5,{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"})},E5=b5`
1619
+ `;import{Fragment as g5,jsx as xl,jsxs as ry}from"react/jsx-runtime";var Al=({isEditable:e,setIsEditable:t})=>{let r=y5(null);return ry(g5,{children:[xl(Sr,{if:!e,children:xl(_l,{ref:r})}),xl(Sr,{if:e,children:ry(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[xl(h5,{})," Continue with Email"]})})]})};import{useState as v5}from"react";import{jsx as _d,jsxs as C5}from"react/jsx-runtime";var kl=()=>{let[e,t]=v5(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=fe(),{initLoginWithFarcaster:l}=M();return C5(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[_d(jr,{})," Farcaster",e&&_d("span",{children:_d(io,{})})]})};import w5,{css as b5}from"styled-components";import{jsx as P5}from"react/jsx-runtime";var Rl=()=>{let{enabled:e,token:t}=fe(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=M();return P5(T5,{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"})},E5=b5`
1620
1620
  && {
1621
1621
  width: 100%;
1622
1622
  font-size: 0.875rem;
@@ -1641,7 +1641,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1641
1641
  box-shadow: none;
1642
1642
  }
1643
1643
  }
1644
- `,P5=w5.button`
1644
+ `,T5=w5.button`
1645
1645
  ${E5}
1646
1646
  `;import D5 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as U5}from"react";import{forwardRef as W5,useState as xd}from"react";import ly from"styled-components";import S5 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as _5,AsYouType as x5,getCountries as A5,getCountryCallingCode as Il,getExampleNumber as k5}from"libphonenumber-js/min";import{jsx as M5,jsxs as I5}from"react/jsx-runtime";var la=(e,t)=>_5(String(e),t),Ml=(e,t)=>`+${Il(t)} ${e}`,oy=e=>`*${e.replaceAll("-","").slice(-4)}`,ny=e=>new x5(e),R5=A5().map(e=>({code:e,callCode:Il(e)})),iy=e=>{let t=k5(e,S5)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},ay=({value:e,onChange:t})=>M5("select",{value:e,onChange:t,children:R5.map(r=>I5("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as N5,jsx as ca,jsxs as sy}from"react/jsx-runtime";var li=W5((e,t)=>{let{app:r}=_(),[o,n]=xd(""),[i,a]=xd(r?.intl.defaultCountry??"US"),l=la(o,i),s=ny(i),c=iy(i),u=Il(i),f=!l,[h,y]=xd(!1),v=u.length,g=w=>{let I=w.target.value;a(I),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Ml(o,I),countryCode:I,isValid:la(o,i)})},S=w=>{try{let I=w.replace(/\D/g,""),A=o.replace(/\D/g,""),O=I===A?w:s.input(w);n(O),e.onChange&&e.onChange({rawPhoneNumber:O,qualifiedPhoneNumber:Ml(w,i),countryCode:i,isValid:la(w,i)})}catch(I){console.error("Error processing phone number:",I)}},b=()=>{y(!0);let w=Ml(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:w,countryCode:i,isValid:la(o,i)}).finally(()=>y(!1))};return sy(N5,{children:[ca(L5,{children:sy(O5,{callingCodeLength:v,stacked:e.stacked,children:[ca(ay,{value:i,onChange:g}),ca("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:w=>{S(w.target.value)},onKeyUp:w=>{w.key==="Enter"&&b()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?ca(Fn,{isSubmitting:h,onClick:b,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?ca(L,{loading:h,loadingText:null,onClick:b,disabled:f,children:"Submit"}):null]})}),L5=ly.div`
1647
1647
  width: 100%;
@@ -1732,11 +1732,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1732
1732
  && > input::placeholder {
1733
1733
  color: var(--privy-color-foreground-3);
1734
1734
  }
1735
- `;import{Fragment as F5,jsx as Wl,jsxs as cy}from"react/jsx-runtime";var Ll=({isEditable:e,setIsEditable:t})=>{let r=U5(null),{authenticated:o}=F(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=fe();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(f,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return cy(F5,{children:[Wl(Sr,{if:!e,children:Wl(li,{ref:r,onSubmit:u})}),Wl(Sr,{if:e,children:cy(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Wl(D5,{})," Continue with SMS"]})})]})};import{useState as B5}from"react";import{jsx as po,jsxs as G5}from"react/jsx-runtime";var H5={apple:{logo:po(os,{}),displayName:"Apple"},discord:{logo:po(ns,{}),displayName:"Discord"},github:{logo:po(is,{}),displayName:"GitHub"},google:{logo:po(ss,{}),displayName:"Google"},linkedin:{logo:po(ps,{}),displayName:"LinkedIn"},spotify:{logo:po(us,{}),displayName:"Spotify"},instagram:{logo:po(cs,{}),displayName:"Instagram"},twitter:{logo:po(fs,{}),displayName:"Twitter"},tiktok:{logo:po(ms,{}),displayName:"TikTok"}},ot=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[i,a]=B5(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=H5[e];return G5(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>l(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import{useState as V5}from"react";import{jsx as Io,jsxs as dy}from"react/jsx-runtime";function Ol(e){return dy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[Io("defs",{children:dy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[Io("stop",{offset:"0",stopColor:"#1d93d2"}),Io("stop",{offset:"1",stopColor:"#38b0e3"})]})}),Io("title",{children:"Telegram_logo"}),Io("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),Io("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"}),Io("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"}),Io("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 z5,jsxs as q5}from"react/jsx-runtime";var Nl=()=>{let{enabled:e,token:t}=fe(),{navigate:r,setModalData:o}=_(),[n,i]=V5(!1),{initLoginWithTelegram:a}=M();async function l(c){try{await a(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),i(!1)}}async function s(){if(i(!0),e&&!t){o({captchaModalData:{callback:l,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await l()}return q5(Ee,{onClick:s,disabled:n,children:[z5(Ol,{})," Telegram"]})};import $5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as py,jsxs as K5}from"react/jsx-runtime";var Dl=({onClick:e,text:t,icon:r})=>K5(Ee,{onClick:e,children:[r,py($s,{children:t}),py($5,{})]});import{Fragment as Ad,jsx as Je,jsxs as Fl}from"react/jsx-runtime";var Bl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{appearance:{palette:{colorScheme:i}}}=dr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,f]=uy("default"),[h,y]=uy("email");Y5(()=>{let k=s.indexOf("sms"),H=s.indexOf("email");k>-1&&k<H&&y("sms")},[a,l]);let v=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=v;let g=k=>k==="email"?Je(Al,{isEditable:h==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?Je(Ll,{isEditable:h==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?Je(ot,{provider:"apple"},k):k==="discord"?Je(ot,{provider:"discord"},k):k==="farcaster"?Je(kl,{},k):k==="github"?Je(ot,{provider:"github"},k):k==="google"?Je(ot,{provider:"google"},k):k==="linkedin"?Je(ot,{provider:"linkedin"},k):k==="tiktok"?Je(ot,{provider:"tiktok"},k):k==="twitter"&&(!Z5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Je(ot,{provider:"twitter"},k):k==="telegram"?Je(Nl,{},k):Yi([k],r,e,s),S=a.map(g).flat(),b=l.map(g).flat(),w=[...S,...b],I=Q5({primary:S.length,overflow:b.length}),[A,O]=ou(w,I),R=u==="default"?void 0:()=>{f("default")};return Fl(Ad,{children:[Je(T,{title:o.appearance.landingHeader,onClose:v,backFn:R}),u==="default"&&Je(X5,{}),Je(Ks,{style:{overflow:"hidden"},children:Fl(Dm,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Fl(Ad,{children:[...A,O.length>0&&Je(Dl,{text:"More options",icon:Je(j5,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&Fl(Ad,{children:[...O]}),c&&u==="default"&&Je(Rl,{})]})}),o&&Je(Bn,{app:o}),Je(V,{protectedByPrivy:!0})]})},Ul=5,Q5=({primary:e,overflow:t})=>e<Ul?e:e===Ul&&t===0?Ul:Ul-1,X5=J5(Yn)`
1735
+ `;import{Fragment as F5,jsx as Wl,jsxs as cy}from"react/jsx-runtime";var Ll=({isEditable:e,setIsEditable:t})=>{let r=U5(null),{authenticated:o}=F(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=fe();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(f,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return cy(F5,{children:[Wl(Sr,{if:!e,children:Wl(li,{ref:r,onSubmit:u})}),Wl(Sr,{if:e,children:cy(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Wl(D5,{})," Continue with SMS"]})})]})};import{useState as B5}from"react";import{jsx as po,jsxs as G5}from"react/jsx-runtime";var H5={apple:{logo:po(os,{}),displayName:"Apple"},discord:{logo:po(ns,{}),displayName:"Discord"},github:{logo:po(is,{}),displayName:"GitHub"},google:{logo:po(ss,{}),displayName:"Google"},linkedin:{logo:po(ps,{}),displayName:"LinkedIn"},spotify:{logo:po(us,{}),displayName:"Spotify"},instagram:{logo:po(cs,{}),displayName:"Instagram"},twitter:{logo:po(fs,{}),displayName:"Twitter"},tiktok:{logo:po(ms,{}),displayName:"TikTok"}},ot=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[i,a]=B5(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=H5[e];return G5(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>l(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import{useState as V5}from"react";import{jsx as Io,jsxs as dy}from"react/jsx-runtime";function Ol(e){return dy("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[Io("defs",{children:dy("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[Io("stop",{offset:"0",stopColor:"#1d93d2"}),Io("stop",{offset:"1",stopColor:"#38b0e3"})]})}),Io("title",{children:"Telegram_logo"}),Io("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),Io("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"}),Io("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"}),Io("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 z5,jsxs as q5}from"react/jsx-runtime";var Nl=()=>{let{enabled:e,token:t}=fe(),{navigate:r,setModalData:o}=_(),[n,i]=V5(!1),{initLoginWithTelegram:a}=M();async function l(c){try{await a(c),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),i(!1)}}async function s(){if(i(!0),e&&!t){o({captchaModalData:{callback:l,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await l()}return q5(Ee,{onClick:s,disabled:n,children:[z5(Ol,{})," Telegram"]})};import $5 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as py,jsxs as K5}from"react/jsx-runtime";var Dl=({onClick:e,text:t,icon:r})=>K5(Ee,{onClick:e,children:[r,py($s,{children:t}),py($5,{})]});import{Fragment as Ad,jsx as Je,jsxs as Fl}from"react/jsx-runtime";var Bl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{appearance:{palette:{colorScheme:i}}}=dr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,f]=uy("default"),[h,y]=uy("email");Y5(()=>{let k=s.indexOf("sms"),H=s.indexOf("email");k>-1&&k<H&&y("sms")},[a,l]);let v=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=v;let g=k=>k==="email"?Je(Al,{isEditable:h==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?Je(Ll,{isEditable:h==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?Je(ot,{provider:"apple"},k):k==="discord"?Je(ot,{provider:"discord"},k):k==="farcaster"?Je(kl,{},k):k==="github"?Je(ot,{provider:"github"},k):k==="google"?Je(ot,{provider:"google"},k):k==="linkedin"?Je(ot,{provider:"linkedin"},k):k==="tiktok"?Je(ot,{provider:"tiktok"},k):k==="twitter"&&(!Z5||o?.loginConfig.twitterOAuthOnMobileEnabled)?Je(ot,{provider:"twitter"},k):k==="telegram"?Je(Nl,{},k):Yi([k],r,e,s),S=a.map(g).flat(),b=l.map(g).flat(),w=[...S,...b],I=Q5({primary:S.length,overflow:b.length}),[A,O]=ou(w,I),R=u==="default"?void 0:()=>{f("default")};return Fl(Ad,{children:[Je(P,{title:o.appearance.landingHeader,onClose:v,backFn:R}),u==="default"&&Je(X5,{}),Je(Ks,{style:{overflow:"hidden"},children:Fl(Dm,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Fl(Ad,{children:[...A,O.length>0&&Je(Dl,{text:"More options",icon:Je(j5,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&Fl(Ad,{children:[...O]}),c&&u==="default"&&Je(Rl,{})]})}),o&&Je(Bn,{app:o}),Je(V,{protectedByPrivy:!0})]})},Ul=5,Q5=({primary:e,overflow:t})=>e<Ul?e:e===Ul&&t===0?Ul:Ul-1,X5=J5(Yn)`
1736
1736
  margin-bottom: 16px;
1737
- `;import ow from"@heroicons/react/24/outline/EnvelopeIcon";import nw from"@heroicons/react/24/outline/PhoneIcon";import iw from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as aw,useState as yy}from"react";import{isMobile as sw}from"react-device-detect";import lw from"styled-components";import{jsx as da,jsxs as my}from"react/jsx-runtime";var fy=({...e})=>my("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[my("g",{clipPath:"url(#clip0_2856_1743)",children:[da("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"}),da("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"})]}),da("defs",{children:da("clipPath",{id:"clip0_2856_1743",children:da("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import ew from"@heroicons/react/24/outline/ChevronRightIcon";import tw from"@heroicons/react/24/outline/WalletIcon";import{jsx as kd,jsxs as rw}from"react/jsx-runtime";var hy=({onClick:e,text:t})=>rw(Ee,{onClick:e,children:[kd(tw,{}),kd($s,{children:t}),kd(ew,{})]});import{Fragment as pa,jsx as Ie,jsxs as ci}from"react/jsx-runtime";var Hl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,instagram:h,tiktok:y,linkedin:v,apple:g,wallet:S,farcaster:b,passkey:w,telegram:I}=o?.loginMethods??{},A=o?.appearance.loginGroupPriority||"web2-first",O=o?.appearance.hideDirectWeb2Inputs,[R,k]=yy("default"),[H,q]=yy(i?"email":"sms");aw(()=>{q(i?"email":"sms")},[i]);let j=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{k("default")},150)};n.current=j;let W=[i&&Ie(Al,{isEditable:H==="email",setIsEditable:()=>{q("email")}}),a&&Ie(Ll,{isEditable:H==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),$=[l&&Ie(ot,{provider:"google"}),s&&(!sw||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Ie(ot,{provider:"twitter"}),c&&Ie(ot,{provider:"discord"}),u&&Ie(ot,{provider:"github"}),f&&Ie(ot,{provider:"spotify"}),h&&Ie(ot,{provider:"instagram"}),y&&Ie(ot,{provider:"tiktok"}),v&&Ie(ot,{provider:"linkedin"}),g&&Ie(ot,{provider:"apple"}),b&&Ie(kl,{}),I&&Ie(Nl,{})].filter(Boolean),D=Yi(o.appearance.walletList,r,e,o.appearance.walletList),ue=R==="default"?void 0:()=>{k("default")},ce=dw({priority:A,email:i,sms:a,social:$}),de=pw({priority:A,email:i,sms:a,social:$}),ve=uw({priority:A,email:i,sms:a,social:$}),ee=Ie(hy,{text:ve,onClick:()=>k("web3-overflow")}),Ct=Ie(Dl,{text:ce,icon:de,onClick:()=>k("web2-overflow")}),Ke=O?0:1;return ci(pa,{children:[Ie(T,{title:o.appearance.landingHeader,onClose:j,backFn:ue}),R==="default"&&Ie(cw,{}),Ie(Ks,{style:{overflow:"hidden",padding:2},children:ci(Tr,{children:[R==="default"&&A==="web2-first"&&ci(pa,{children:[...W,...$.length+W.length>4?$.slice(0,3-W.length):$,W.length+$.length>4&&Ct,S&&ee]}),R==="default"&&A==="web3-first"&&ci(pa,{children:[S&&ci(pa,{children:[...D.length>4?D.slice(0,3):D,D.length>4&&ee]}),W.length+$.length>Ke&&Ct,W.length+$.length===Ke&&W.length?W[0]:null,W.length+$.length===Ke&&$.length?$[0]:null]}),R==="web2-overflow"&&ci(pa,{children:[...A==="web3-first"?W:[],...$]}),...R==="web3-overflow"?D:[],w&&R==="default"&&Ie(Rl,{})]})}),o&&Ie(Bn,{app:o}),Ie(V,{protectedByPrivy:!0})]})},cw=lw(Yn)`
1737
+ `;import ow from"@heroicons/react/24/outline/EnvelopeIcon";import nw from"@heroicons/react/24/outline/PhoneIcon";import iw from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as aw,useState as yy}from"react";import{isMobile as sw}from"react-device-detect";import lw from"styled-components";import{jsx as da,jsxs as my}from"react/jsx-runtime";var fy=({...e})=>my("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[my("g",{clipPath:"url(#clip0_2856_1743)",children:[da("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"}),da("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"})]}),da("defs",{children:da("clipPath",{id:"clip0_2856_1743",children:da("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import ew from"@heroicons/react/24/outline/ChevronRightIcon";import tw from"@heroicons/react/24/outline/WalletIcon";import{jsx as kd,jsxs as rw}from"react/jsx-runtime";var hy=({onClick:e,text:t})=>rw(Ee,{onClick:e,children:[kd(tw,{}),kd($s,{children:t}),kd(ew,{})]});import{Fragment as pa,jsx as Ie,jsxs as ci}from"react/jsx-runtime";var Hl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,instagram:h,tiktok:y,linkedin:v,apple:g,wallet:S,farcaster:b,passkey:w,telegram:I}=o?.loginMethods??{},A=o?.appearance.loginGroupPriority||"web2-first",O=o?.appearance.hideDirectWeb2Inputs,[R,k]=yy("default"),[H,q]=yy(i?"email":"sms");aw(()=>{q(i?"email":"sms")},[i]);let j=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{k("default")},150)};n.current=j;let W=[i&&Ie(Al,{isEditable:H==="email",setIsEditable:()=>{q("email")}}),a&&Ie(Ll,{isEditable:H==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),$=[l&&Ie(ot,{provider:"google"}),s&&(!sw||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Ie(ot,{provider:"twitter"}),c&&Ie(ot,{provider:"discord"}),u&&Ie(ot,{provider:"github"}),f&&Ie(ot,{provider:"spotify"}),h&&Ie(ot,{provider:"instagram"}),y&&Ie(ot,{provider:"tiktok"}),v&&Ie(ot,{provider:"linkedin"}),g&&Ie(ot,{provider:"apple"}),b&&Ie(kl,{}),I&&Ie(Nl,{})].filter(Boolean),D=Yi(o.appearance.walletList,r,e,o.appearance.walletList),ue=R==="default"?void 0:()=>{k("default")},ce=dw({priority:A,email:i,sms:a,social:$}),de=pw({priority:A,email:i,sms:a,social:$}),ve=uw({priority:A,email:i,sms:a,social:$}),ee=Ie(hy,{text:ve,onClick:()=>k("web3-overflow")}),Ct=Ie(Dl,{text:ce,icon:de,onClick:()=>k("web2-overflow")}),Ke=O?0:1;return ci(pa,{children:[Ie(P,{title:o.appearance.landingHeader,onClose:j,backFn:ue}),R==="default"&&Ie(cw,{}),Ie(Ks,{style:{overflow:"hidden",padding:2},children:ci(Pr,{children:[R==="default"&&A==="web2-first"&&ci(pa,{children:[...W,...$.length+W.length>4?$.slice(0,3-W.length):$,W.length+$.length>4&&Ct,S&&ee]}),R==="default"&&A==="web3-first"&&ci(pa,{children:[S&&ci(pa,{children:[...D.length>4?D.slice(0,3):D,D.length>4&&ee]}),W.length+$.length>Ke&&Ct,W.length+$.length===Ke&&W.length?W[0]:null,W.length+$.length===Ke&&$.length?$[0]:null]}),R==="web2-overflow"&&ci(pa,{children:[...A==="web3-first"?W:[],...$]}),...R==="web3-overflow"?D:[],w&&R==="default"&&Ie(Rl,{})]})}),o&&Ie(Bn,{app:o}),Ie(V,{protectedByPrivy:!0})]})},cw=lw(Yn)`
1738
1738
  margin-bottom: 16px;
1739
- `,dw=({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",pw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ie(iw,{}):t&&r?Ie(fy,{}):t?Ie(ow,{}):r?Ie(nw,{}):null,uw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as gy}from"react/jsx-runtime";var vy=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?gy(Bl,{connectOnly:!0}):gy(Hl,{connectOnly:!0})};import{jsx as Cy}from"react/jsx-runtime";var wy=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Cy(Bl,{connectOnly:!1}):Cy(Hl,{connectOnly:!1})};import mw from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as fw,jsx as Mo,jsxs as hw}from"react/jsx-runtime";var by=()=>{let{app:e}=_();return hw(fw,{children:[Mo(T,{},"header"),Mo(X,{}),Mo(Te,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Mo(mw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Mo(mr,{children:Mo(_l,{stacked:!0})}),Mo(re,{}),Mo(V,{protectedByPrivy:!0})]})};import yw from"@heroicons/react/24/outline/ClockIcon";import gw from"@heroicons/react/24/outline/TrashIcon";import vw from"@heroicons/react/24/solid/CheckBadgeIcon";import Cw from"@heroicons/react/24/solid/CheckCircleIcon";import ww from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as bw,useState as ua}from"react";import yr,{css as _y}from"styled-components";import{jsx as Ey}from"react/jsx-runtime";var fn=({style:e,...t})=>Ey("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:Ey("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 Me,jsxs as Py}from"react/jsx-runtime";var hn=({style:e,...t})=>Py("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:[Py("g",{clipPath:"url(#clip0_113_33841)",children:[Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"})]}),Me("defs",{children:Me("clipPath",{id:"clip0_113_33841",children:Me("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Rd,jsx as le,jsxs as Ot}from"react/jsx-runtime";var Ty=({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(u=>u.concat([c])),await r(c),i(u=>u.filter(f=>f!==c))};return Ot("div",{children:[le(Aw,{children:"Your passkeys"}),Ot(Ay,{children:[e.slice(0,a).map(c=>Ot(Iw,{children:[Ot("div",{children:[le(kw,{children:l(c)}),Ot(Rw,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),le(Ww,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?le(io,{}):le(gw,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&le(Sw,{onClick:o,children:"View all"})]})]})},Ew=()=>Ot(Ay,{children:[Ot(Wt,{children:[le(Mt,{children:le(vw,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Ot(Wt,{children:[le(Mt,{children:le(ww,{})}),"More secure than a password."]}),Ot(Wt,{children:[le(Mt,{children:le(yw,{})}),"Takes seconds to set up and use."]})]}),xy=()=>{let{user:e,unlinkPasskey:t}=F(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[i,a]=ua(!1),[l,s]=ua(""),[c,u]=ua(!1),[f,h]=ua(!1);bw(()=>{n.length===0&&h(!1)},[n.length]);let y=()=>{a(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof Ge){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},v=async g=>(a(!0),await t(g).then(()=>u(!0)).catch(S=>{if(S instanceof Ge&&S.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?Ot(Rd,{children:[le(T,{onClose:()=>o()},"header"),le(Pe,{children:le(Oe,{status:"success",children:le(Cw,{})})}),le(Sy,{children:"Passkey added"}),le(_w,{children:"From now on, you can use your passkey to log in."}),le(mt,{children:le(L,{onClick:()=>o(),children:"Done"})}),le(G,{})]}):f?Ot(Rd,{children:[le(T,{backFn:()=>h(!1),onClose:()=>o()},"header"),le(Ty,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),le(G,{})]}):Ot(Rd,{children:[le(T,{onClose:()=>o()},"header"),le(Pe,{children:Ot(Gl,{children:[le(fn,{}),le(hn,{})]})}),le(Sy,{children:"Secure your account with a passkey"}),le(xw,{}),n.length===0?le(Ew,{}):le(Ty,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),Ot(mt,{style:{marginTop:"12px"},children:[l&&le(Pw,{fail:!0,children:l}),le(L,{onClick:y,loading:i,children:"Add new passkey"})]}),le(G,{})]})},Gl=yr.div`
1739
+ `,dw=({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",pw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ie(iw,{}):t&&r?Ie(fy,{}):t?Ie(ow,{}):r?Ie(nw,{}):null,uw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as gy}from"react/jsx-runtime";var vy=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?gy(Bl,{connectOnly:!0}):gy(Hl,{connectOnly:!0})};import{jsx as Cy}from"react/jsx-runtime";var wy=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Cy(Bl,{connectOnly:!1}):Cy(Hl,{connectOnly:!1})};import mw from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as fw,jsx as Mo,jsxs as hw}from"react/jsx-runtime";var by=()=>{let{app:e}=_();return hw(fw,{children:[Mo(P,{},"header"),Mo(X,{}),Mo(Pe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Mo(mw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Mo(mr,{children:Mo(_l,{stacked:!0})}),Mo(re,{}),Mo(V,{protectedByPrivy:!0})]})};import yw from"@heroicons/react/24/outline/ClockIcon";import gw from"@heroicons/react/24/outline/TrashIcon";import vw from"@heroicons/react/24/solid/CheckBadgeIcon";import Cw from"@heroicons/react/24/solid/CheckCircleIcon";import ww from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as bw,useState as ua}from"react";import yr,{css as _y}from"styled-components";import{jsx as Ey}from"react/jsx-runtime";var fn=({style:e,...t})=>Ey("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:Ey("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 Me,jsxs as Ty}from"react/jsx-runtime";var hn=({style:e,...t})=>Ty("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:[Ty("g",{clipPath:"url(#clip0_113_33841)",children:[Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"}),Me("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"})]}),Me("defs",{children:Me("clipPath",{id:"clip0_113_33841",children:Me("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Rd,jsx as le,jsxs as Ot}from"react/jsx-runtime";var Py=({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(u=>u.concat([c])),await r(c),i(u=>u.filter(f=>f!==c))};return Ot("div",{children:[le(Aw,{children:"Your passkeys"}),Ot(Ay,{children:[e.slice(0,a).map(c=>Ot(Iw,{children:[Ot("div",{children:[le(kw,{children:l(c)}),Ot(Rw,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),le(Ww,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?le(io,{}):le(gw,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&le(Sw,{onClick:o,children:"View all"})]})]})},Ew=()=>Ot(Ay,{children:[Ot(Wt,{children:[le(Mt,{children:le(vw,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Ot(Wt,{children:[le(Mt,{children:le(ww,{})}),"More secure than a password."]}),Ot(Wt,{children:[le(Mt,{children:le(yw,{})}),"Takes seconds to set up and use."]})]}),xy=()=>{let{user:e,unlinkPasskey:t}=F(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[i,a]=ua(!1),[l,s]=ua(""),[c,u]=ua(!1),[f,h]=ua(!1);bw(()=>{n.length===0&&h(!1)},[n.length]);let y=()=>{a(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof Ge){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},v=async g=>(a(!0),await t(g).then(()=>u(!0)).catch(S=>{if(S instanceof Ge&&S.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?Ot(Rd,{children:[le(P,{onClose:()=>o()},"header"),le(Te,{children:le(Oe,{status:"success",children:le(Cw,{})})}),le(Sy,{children:"Passkey added"}),le(_w,{children:"From now on, you can use your passkey to log in."}),le(mt,{children:le(L,{onClick:()=>o(),children:"Done"})}),le(G,{})]}):f?Ot(Rd,{children:[le(P,{backFn:()=>h(!1),onClose:()=>o()},"header"),le(Py,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),le(G,{})]}):Ot(Rd,{children:[le(P,{onClose:()=>o()},"header"),le(Te,{children:Ot(Gl,{children:[le(fn,{}),le(hn,{})]})}),le(Sy,{children:"Secure your account with a passkey"}),le(xw,{}),n.length===0?le(Ew,{}):le(Py,{passkeys:n,expanded:f,onUnlink:v,onExpand:()=>h(!0)}),Ot(mt,{style:{marginTop:"12px"},children:[l&&le(Tw,{fail:!0,children:l}),le(L,{onClick:y,loading:i,children:"Add new passkey"})]}),le(G,{})]})},Gl=yr.div`
1740
1740
  display: flex;
1741
1741
  align-items: center;
1742
1742
  justify-content: center;
@@ -1752,7 +1752,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1752
1752
  stroke: var(--privy-color-accent) !important;
1753
1753
  fill: var(--privy-color-accent) !important;
1754
1754
  }
1755
- `,Pw=yr.div`
1755
+ `,Tw=yr.div`
1756
1756
  line-height: 20px;
1757
1757
  height: 20px;
1758
1758
  font-size: 13px;
@@ -1760,7 +1760,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1760
1760
  display: flex;
1761
1761
  justify-content: flex-beginngin;
1762
1762
  width: 100%;
1763
- `,Tw=_y`
1763
+ `,Pw=_y`
1764
1764
  && {
1765
1765
  width: 100%;
1766
1766
  font-size: 0.875rem;
@@ -1786,7 +1786,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1786
1786
  }
1787
1787
  }
1788
1788
  `,Sw=yr.button`
1789
- ${Tw}
1789
+ ${Pw}
1790
1790
  `,Ay=yr.div`
1791
1791
  display: flex;
1792
1792
  flex-direction: column;
@@ -1857,7 +1857,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1857
1857
  }
1858
1858
  `,Ww=yr.button`
1859
1859
  ${Mw}
1860
- `;import Lw from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as Ow,jsx as Wo,jsxs as Nw}from"react/jsx-runtime";var ky=()=>{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 Nw(Ow,{children:[Wo(T,{},"header"),Wo(X,{}),Wo(Te,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Wo(Lw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Wo(mr,{children:Wo(li,{stacked:!0,onSubmit:a})}),Wo(re,{}),Wo(V,{protectedByPrivy:!0})]})};import{Fragment as Dw,jsx as ma,jsxs as Uw}from"react/jsx-runtime";var Ry=()=>{let{linkingHint:e}=M(),{app:t}=_(),r=e?`Select the wallet with ${Co(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Uw(Dw,{children:[ma(T,{},"header"),ma(qr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),ma(Tr,{children:ma(jn,{connectOnly:!1})}),ma(V,{protectedByPrivy:!0})]})};import{jsx as Iy,jsxs as Fw}from"react/jsx-runtime";var My=({style:e,...t})=>Fw("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:[Iy("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Iy("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 Bw,jsx as Lo,jsxs as Wy}from"react/jsx-runtime";var Ly=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return Wy(Bw,{children:[Lo(T,{},"header"),Lo(X,{}),Lo(My,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Lo(qr,{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"}}),Wy(mr,{children:[Lo(L,{onClick:()=>t("LANDING"),children:"Try again"}),Lo(Pr,{onClick:()=>e(),children:"Cancel"})]}),Lo(re,{}),Lo(V,{protectedByPrivy:!0})]})};import A6 from"@heroicons/react/24/solid/CheckBadgeIcon";import k6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import R6 from"@heroicons/react/24/solid/IdentificationIcon";import I6 from"@heroicons/react/24/solid/PhoneIcon";import M6 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Zy from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as W6,useState as mi}from"react";import{useContext as Hw}from"react";function fa(){let{promptMfa:e,init:t,submit:r,cancel:o}=Hw(ye);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as Gw}from"react";function Mr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=Gw(ye);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 Vw from"styled-components";import{jsx as Oy,jsxs as qw}from"react/jsx-runtime";var Ny=e=>qw(zw,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Oy("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Oy("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"})]}),zw=Vw.svg`
1860
+ `;import Lw from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as Ow,jsx as Wo,jsxs as Nw}from"react/jsx-runtime";var ky=()=>{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 Nw(Ow,{children:[Wo(P,{},"header"),Wo(X,{}),Wo(Pe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Wo(Lw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Wo(mr,{children:Wo(li,{stacked:!0,onSubmit:a})}),Wo(re,{}),Wo(V,{protectedByPrivy:!0})]})};import{Fragment as Dw,jsx as ma,jsxs as Uw}from"react/jsx-runtime";var Ry=()=>{let{linkingHint:e}=M(),{app:t}=_(),r=e?`Select the wallet with ${Co(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Uw(Dw,{children:[ma(P,{},"header"),ma(qr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),ma(Pr,{children:ma(jn,{connectOnly:!1})}),ma(V,{protectedByPrivy:!0})]})};import{jsx as Iy,jsxs as Fw}from"react/jsx-runtime";var My=({style:e,...t})=>Fw("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:[Iy("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Iy("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 Bw,jsx as Lo,jsxs as Wy}from"react/jsx-runtime";var Ly=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return Wy(Bw,{children:[Lo(P,{},"header"),Lo(X,{}),Lo(My,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Lo(qr,{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"}}),Wy(mr,{children:[Lo(L,{onClick:()=>t("LANDING"),children:"Try again"}),Lo(Tr,{onClick:()=>e(),children:"Cancel"})]}),Lo(re,{}),Lo(V,{protectedByPrivy:!0})]})};import A6 from"@heroicons/react/24/solid/CheckBadgeIcon";import k6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import R6 from"@heroicons/react/24/solid/IdentificationIcon";import I6 from"@heroicons/react/24/solid/PhoneIcon";import M6 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Zy from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as W6,useState as mi}from"react";import{useContext as Hw}from"react";function fa(){let{promptMfa:e,init:t,submit:r,cancel:o}=Hw(ye);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as Gw}from"react";function Mr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=Gw(ye);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 Vw from"styled-components";import{jsx as Oy,jsxs as qw}from"react/jsx-runtime";var Ny=e=>qw(zw,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Oy("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Oy("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"})]}),zw=Vw.svg`
1861
1861
  height: 90px;
1862
1862
  width: 90px;
1863
1863
 
@@ -1868,7 +1868,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1868
1868
  > path {
1869
1869
  fill: white;
1870
1870
  }
1871
- `;import Id from"@heroicons/react/20/solid/CheckIcon";import $w from"@heroicons/react/24/outline/ChevronRightIcon";import Kw from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import jw from"@heroicons/react/24/outline/FingerPrintIcon";import Yw from"@heroicons/react/24/outline/PhoneIcon";import Md from"@heroicons/react/24/outline/TrashIcon";import Zw from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as Jw,jsx as he,jsxs as Nt}from"react/jsx-runtime";var Dy=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let f=t.reduce((y,v)=>({...y,[v]:!0}),{}),h=r.reduce((y,v)=>({...y,[v]:!0}),{});return Nt(Jw,{children:[he(T,{backFn:e?s:void 0,onClose:l},"header"),he(Pe,{children:he(Oe,{children:he(Zw,{})})}),he(ae,{children:"Choose a verification method"}),t.length>0?he(se,{children:"To add or delete verification methods, verification is required."}):he(se,{children:"How would you like to verify your identity? You can change this later."}),a&&he(Xs,{style:{marginTop:"1.25rem"},children:a.message}),Nt(js,{children:[(h.totp||f.totp)&&Nt(Ys,{children:[he(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?he(et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Nt(Qs,{children:[Nt(Js,{children:[he(Kw,{}),"Authenticator App"]}),f.totp?Nt(an,{children:[he(Id,{}),"Added"]}):he(an,{children:"Recommended"})]})}),f.totp&&he(Zs,{onClick:()=>u("totp"),children:he(Md,{})})]},"totp"),(h.sms||f.sms)&&Nt(Ys,{children:[he(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:Nt(Qs,{children:[Nt(Js,{children:[he(Yw,{}),"SMS"]}),f.sms&&Nt(an,{children:[he(Id,{}),"Added"]}),o&&he(an,{children:"Disabled"})]})}),f.sms&&he(Zs,{onClick:()=>u("sms"),children:he(Md,{})})]},"sms"),(h.passkey||f.passkey)&&Nt(Ys,{children:[he(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?he(et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Nt(Qs,{children:[Nt(Js,{children:[he(jw,{}),"Passkey"]}),f.passkey?Nt(an,{children:[he(Id,{}),"Added"]}):he(an,{isAccent:!0,children:he($w,{})})]})}),f.passkey&&he(Zs,{onClick:()=>u("passkey"),children:he(Md,{})})]},"passkey")]}),he(G,{})]})};import Qw from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Xw from"@heroicons/react/24/outline/ClockIcon";import e6 from"@heroicons/react/24/outline/ShieldCheckIcon";import t6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as r6,useState as ha}from"react";import Vl from"styled-components";import{Fragment as Wd,jsx as ne,jsxs as gr}from"react/jsx-runtime";var Fy=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=F(),{data:n}=_(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Mr(),[c,u]=ha(!1),[f,h]=ha(!1),[y,v]=ha(!1),[g,S]=ha(null),b=r6(()=>o?.linkedAccounts.filter(O=>O.type==="passkey")??[],[o]),w=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},I=async O=>{u(!0);try{await l(),await s({credentialIds:O}),v(!0)}catch(R){S(R)}finally{u(!1)}},A=async()=>{h(!0),S(null);try{await i();let R=(await a())?.linkedAccounts.filter(k=>k.type==="passkey").map(k=>k.credentialId)??[];await I(R)}catch(O){S(O)}finally{h(!1)}};return b.length===0||f?ne(o6,{onReset:r,onClose:t,onClick:A,isCreating:f}):y?ne(i6,{onClick:w,onClose:w}):g?ne(na,{error:g,backFn:()=>S(null),onClick:()=>S(null)}):ne(n6,{passkeys:b,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>I(b.map(O=>O.credentialId)),onAddPasskey:A})},o6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>gr(Wd,{children:[ne(T,{backFn:e,onClose:t},"header"),ne(Pe,{children:gr(Gl,{children:[ne(fn,{}),ne(hn,{})]})}),ne(ae,{children:"Set up paskey verification"}),gr(nn,{children:[gr(Wt,{children:[ne(Mt,{children:ne(e6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),gr(Wt,{children:[ne(Mt,{children:ne(Xw,{})}),"Takes seconds to set up and use"]}),gr(Wt,{children:[ne(Mt,{children:ne(Qw,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ne(L,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ne(G,{})]}),n6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ha(!1),c=l?n.length:n.length>3?2:3;return gr(Wd,{children:[ne(T,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&ne(Pe,{children:gr(Gl,{children:[ne(fn,{}),ne(hn,{})]})}),ne(ae,{children:"Enable your passkeys for verification"}),gr(nn,{children:[n.slice(0,c).map(u=>gr(a6,{children:[ne(s6,{children:c6(u)}),gr(l6,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&ne(Uy,{onClick:()=>s(!0),children:"View All"})]}),ne(L,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&ne(Uy,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?ne(et,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ne(G,{})]})},i6=({onClick:e,onClose:t})=>gr(Wd,{children:[ne(T,{onClose:t},"header"),ne(Pe,{children:ne(Oe,{status:"success",children:ne(t6,{})})}),ne(ae,{children:"Passkey verification added"}),ne(se,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ne(mt,{children:ne(L,{onClick:e,children:"Done"})}),ne(G,{})]}),a6=Vl.div`
1871
+ `;import Id from"@heroicons/react/20/solid/CheckIcon";import $w from"@heroicons/react/24/outline/ChevronRightIcon";import Kw from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import jw from"@heroicons/react/24/outline/FingerPrintIcon";import Yw from"@heroicons/react/24/outline/PhoneIcon";import Md from"@heroicons/react/24/outline/TrashIcon";import Zw from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as Jw,jsx as he,jsxs as Nt}from"react/jsx-runtime";var Dy=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let f=t.reduce((y,v)=>({...y,[v]:!0}),{}),h=r.reduce((y,v)=>({...y,[v]:!0}),{});return Nt(Jw,{children:[he(P,{backFn:e?s:void 0,onClose:l},"header"),he(Te,{children:he(Oe,{children:he(Zw,{})})}),he(ae,{children:"Choose a verification method"}),t.length>0?he(se,{children:"To add or delete verification methods, verification is required."}):he(se,{children:"How would you like to verify your identity? You can change this later."}),a&&he(Xs,{style:{marginTop:"1.25rem"},children:a.message}),Nt(js,{children:[(h.totp||f.totp)&&Nt(Ys,{children:[he(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?he(et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Nt(Qs,{children:[Nt(Js,{children:[he(Kw,{}),"Authenticator App"]}),f.totp?Nt(an,{children:[he(Id,{}),"Added"]}):he(an,{children:"Recommended"})]})}),f.totp&&he(Zs,{onClick:()=>u("totp"),children:he(Md,{})})]},"totp"),(h.sms||f.sms)&&Nt(Ys,{children:[he(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:Nt(Qs,{children:[Nt(Js,{children:[he(Yw,{}),"SMS"]}),f.sms&&Nt(an,{children:[he(Id,{}),"Added"]}),o&&he(an,{children:"Disabled"})]})}),f.sms&&he(Zs,{onClick:()=>u("sms"),children:he(Md,{})})]},"sms"),(h.passkey||f.passkey)&&Nt(Ys,{children:[he(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?he(et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Nt(Qs,{children:[Nt(Js,{children:[he(jw,{}),"Passkey"]}),f.passkey?Nt(an,{children:[he(Id,{}),"Added"]}):he(an,{isAccent:!0,children:he($w,{})})]})}),f.passkey&&he(Zs,{onClick:()=>u("passkey"),children:he(Md,{})})]},"passkey")]}),he(G,{})]})};import Qw from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Xw from"@heroicons/react/24/outline/ClockIcon";import e6 from"@heroicons/react/24/outline/ShieldCheckIcon";import t6 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as r6,useState as ha}from"react";import Vl from"styled-components";import{Fragment as Wd,jsx as ne,jsxs as gr}from"react/jsx-runtime";var Fy=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=F(),{data:n}=_(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Mr(),[c,u]=ha(!1),[f,h]=ha(!1),[y,v]=ha(!1),[g,S]=ha(null),b=r6(()=>o?.linkedAccounts.filter(O=>O.type==="passkey")??[],[o]),w=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},I=async O=>{u(!0);try{await l(),await s({credentialIds:O}),v(!0)}catch(R){S(R)}finally{u(!1)}},A=async()=>{h(!0),S(null);try{await i();let R=(await a())?.linkedAccounts.filter(k=>k.type==="passkey").map(k=>k.credentialId)??[];await I(R)}catch(O){S(O)}finally{h(!1)}};return b.length===0||f?ne(o6,{onReset:r,onClose:t,onClick:A,isCreating:f}):y?ne(i6,{onClick:w,onClose:w}):g?ne(na,{error:g,backFn:()=>S(null),onClick:()=>S(null)}):ne(n6,{passkeys:b,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>I(b.map(O=>O.credentialId)),onAddPasskey:A})},o6=({onReset:e,onClose:t,onClick:r,isCreating:o})=>gr(Wd,{children:[ne(P,{backFn:e,onClose:t},"header"),ne(Te,{children:gr(Gl,{children:[ne(fn,{}),ne(hn,{})]})}),ne(ae,{children:"Set up paskey verification"}),gr(nn,{children:[gr(Wt,{children:[ne(Mt,{children:ne(e6,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),gr(Wt,{children:[ne(Mt,{children:ne(Xw,{})}),"Takes seconds to set up and use"]}),gr(Wt,{children:[ne(Mt,{children:ne(Qw,{})}),"Use your passkey to verify transactions and login to your account"]})]}),ne(L,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),ne(G,{})]}),n6=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ha(!1),c=l?n.length:n.length>3?2:3;return gr(Wd,{children:[ne(P,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&ne(Te,{children:gr(Gl,{children:[ne(fn,{}),ne(hn,{})]})}),ne(ae,{children:"Enable your passkeys for verification"}),gr(nn,{children:[n.slice(0,c).map(u=>gr(a6,{children:[ne(s6,{children:c6(u)}),gr(l6,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&ne(Uy,{onClick:()=>s(!0),children:"View All"})]}),ne(L,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&ne(Uy,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?ne(et,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),ne(G,{})]})},i6=({onClick:e,onClose:t})=>gr(Wd,{children:[ne(P,{onClose:t},"header"),ne(Te,{children:ne(Oe,{status:"success",children:ne(t6,{})})}),ne(ae,{children:"Passkey verification added"}),ne(se,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),ne(mt,{children:ne(L,{onClick:e,children:"Done"})}),ne(G,{})]}),a6=Vl.div`
1872
1872
  && {
1873
1873
  padding: 0.75rem 1rem;
1874
1874
  text-align: left;
@@ -1913,7 +1913,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1913
1913
  box-shadow: none;
1914
1914
  }
1915
1915
  }
1916
- `;import P6 from"@heroicons/react/24/solid/CheckCircleIcon";import qy from"@heroicons/react/24/solid/PhoneIcon";import{useState as zl}from"react";import{useState as Nd}from"react";import{isMobile as h6}from"react-device-detect";import zy from"styled-components";import{Dialog as By,Transition as Ld}from"@headlessui/react";import Od from"react";import pi from"styled-components";import{jsx as di,jsxs as f6}from"react/jsx-runtime";var Hy=({children:e,open:t,onClick:r,...o})=>di(Ld,{show:t,as:Od.Fragment,children:f6(By,{onClose:r,...o,as:p6,children:[di(Ld.Child,{as:Od.Fragment,enterFrom:"entering",leaveTo:"leaving",children:di(d6,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),di(u6,{children:di(Ld.Child,{as:Od.Fragment,enterFrom:"entering",leaveTo:"leaving",children:di(By.Panel,{as:m6,children:e})})})]})}),ui=pi.div`
1916
+ `;import T6 from"@heroicons/react/24/solid/CheckCircleIcon";import qy from"@heroicons/react/24/solid/PhoneIcon";import{useState as zl}from"react";import{useState as Nd}from"react";import{isMobile as h6}from"react-device-detect";import zy from"styled-components";import{Dialog as By,Transition as Ld}from"@headlessui/react";import Od from"react";import pi from"styled-components";import{jsx as di,jsxs as f6}from"react/jsx-runtime";var Hy=({children:e,open:t,onClick:r,...o})=>di(Ld,{show:t,as:Od.Fragment,children:f6(By,{onClose:r,...o,as:p6,children:[di(Ld.Child,{as:Od.Fragment,enterFrom:"entering",leaveTo:"leaving",children:di(d6,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),di(u6,{children:di(Ld.Child,{as:Od.Fragment,enterFrom:"entering",leaveTo:"leaving",children:di(By.Panel,{as:m6,children:e})})})]})}),ui=pi.div`
1917
1917
  display: flex;
1918
1918
  flex-direction: column;
1919
1919
  text-align: center;
@@ -2092,7 +2092,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2092
2092
  width: 100%;
2093
2093
 
2094
2094
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2095
- `;import{Fragment as Ud,jsx as Ae,jsxs as gn}from"react/jsx-runtime";var $y=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=zl(""),[i,a]=zl(!1),[l,s]=zl(null),[c,u]=zl("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:h}=Mr(),{app:y,data:v}=_();function g(){v?.mfaEnrollmentFlow?.onSuccess(),e()}async function S({qualifiedPhoneNumber:I}){try{await f({phoneNumber:I}),n(I),u("verify")}catch(A){s(A)}}async function b(I){try{if(!I)return;await h({phoneNumber:o,mfaCode:I}),a(!0)}catch(A){throw sl(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(A)?new Error("The code you entered is not valid"):cn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(A)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){c==="verify"?u("enroll"):t()}return l?Ae(na,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?gn(Ud,{children:[Ae(T,{backFn:t,onClose:r},"header"),Ae(Pe,{children:Ae(Oe,{children:Ae(qy,{})})}),Ae(ae,{children:"Set up SMS verification"}),Ae(se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),gn(ur,{children:[Ae(li,{onSubmit:S}),gn(Fm,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),Ae(G,{})]}):i?gn(Ud,{children:[Ae(T,{onClose:g},"header"),Ae(Pe,{children:Ae(Oe,{status:"success",children:Ae(P6,{})})}),Ae(ae,{children:"SMS verification added"}),Ae(se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ae(mt,{children:Ae(L,{onClick:g,children:"Done"})}),Ae(G,{})]}):gn(Ud,{children:[Ae(T,{backFn:w,onClose:r},"header"),Ae(Pe,{children:Ae(Oe,{children:Ae(qy,{})})}),Ae(ae,{children:"Enter enrollment code"}),gn(ur,{children:[Ae(yn,{onChange:b}),gn(se,{children:["To continue, enter the 6-digit code sent to ",Ae("strong",{children:oy(o)})]})]}),Ae(G,{})]})};import _6 from"@heroicons/react/24/solid/CheckCircleIcon";import x6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as jy}from"react";import T6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as S6}from"react/jsx-runtime";var Ky=({size:e,authUrl:t})=>S6(si,{url:t,squareLogoElement:T6,size:e,fgColor:"#1F1F1F"});import{Fragment as Fd,jsx as Se,jsxs as va}from"react/jsx-runtime";var Yy=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=jy("enroll"),[a,l]=jy(!1),{submitEnrollmentWithTotp:s}=Mr(),{data:c}=_();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function h(v){try{if(!v)return;await s({mfaCode:v}),l(!0)}catch(g){throw sl(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(g)?new Error("The code you entered is not valid"):cn(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(g)?new Error("Verification canceled"):new Error("Unknown error")}}function y(){n==="verify"?i("enroll"):r()}return n==="enroll"?va(Fd,{children:[Se(T,{backFn:r,onClose:t},"header"),Se(ae,{children:"Scan QR code"}),Se(se,{children:"Open your authenticator app and scan the QR code to continue."}),Se(Gn,{children:Se(Ky,{authUrl:o.authUrl,size:200})}),va(mt,{children:[Se(Et,{children:Se(ko,{itemName:"secret",text:o.secret})}),Se(L,{onClick:f,children:"Continue"})]}),Se(G,{})]}):a?va(Fd,{children:[Se(T,{onClose:u},"header"),Se(Pe,{children:Se(Oe,{status:"success",children:Se(_6,{})})}),Se(ae,{children:"Authenticator app verification added"}),Se(se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Se(mt,{children:Se(L,{onClick:u,children:"Done"})}),Se(G,{})]}):va(Fd,{children:[Se(T,{backFn:y,onClose:t},"header"),Se(Pe,{children:Se(Oe,{children:Se(x6,{})})}),Se(ae,{children:"Enter enrollment code"}),Se(ur,{children:Se(yn,{onChange:h})}),va(se,{children:["To continue, enter the 6-digit code generated from your ",Se("strong",{children:"authenticator app"})]}),Se(G,{})]})};import{Fragment as fi,jsx as z,jsxs as Jt}from"react/jsx-runtime";var Jy=()=>{let{user:e,enrollInMfa:t}=F(),[r,o]=mi(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Mr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=_(),{closePrivyModal:f}=M(),{promptMfa:h}=fa(),{initEnrollmentWithTotp:y}=Mr(),[v,g]=mi(!1),[S,b]=mi(null),[w,I]=mi(null),A=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),b(null)},500)},{initEnrollmentWithPasskey:O,submitEnrollmentWithPasskey:R}=Mr(),[k,H]=mi(!1),[q,j]=mi(null);u.current=A;let W=e?.mfaMethods.includes("sms"),$=!!e?.phone,D=e?.mfaMethods.includes("totp"),ue=e?.mfaMethods.includes("passkey"),ce=W||D||ue,de=e?.linkedAccounts.filter(Ve=>Ve.type==="passkey").map(Ve=>Ve.credentialId)??[];W6(()=>{ce&&g(!0)},[ce]);function ve(){o(null),b(null)}function ee(){g(!1)}async function Ct(){H(!0);try{await O(),await R({credentialIds:de})}catch(Ve){j(Ve)}finally{H(!1)}}async function Ke(Ve){if(await h().catch(j),Ve==="totp"){b(Ve),I(null),y().then(ir=>{I(ir)}).catch(()=>{I(null),ve()});return}if(Ve==="passkey"&&de.length===1)return await Ct();b(Ve)}if(!s||!e||!l)return Jt(fi,{children:[z(T,{onClose:A},"header"),z(Pe,{children:z(Ny,{})}),z(ur,{children:z(et,{})}),z(G,{})]});async function xt(){o(null);try{await n()}catch{o(null)}}async function Qe(){o(null);try{await i()}catch{o(null)}}async function nr(){o(null);try{await h(),await a()}catch{o(null)}}if(r==="sms")return Jt(fi,{children:[z(T,{backFn:ve,onClose:A},"header"),z(Pe,{children:z(Oe,{children:z(I6,{})})}),z(ae,{children:"Remove SMS verification?"}),Jt(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(mt,{children:z(L,{warn:!0,onClick:xt,children:"Remove SMS for MFA"})}),z(G,{})]});if(r==="totp")return Jt(fi,{children:[z(T,{backFn:ve,onClose:A},"header"),z(Pe,{children:z(Oe,{children:z(k6,{})})}),z(ae,{children:"Remove Authenticator App verification?"}),Jt(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(mt,{children:z(L,{warn:!0,onClick:Qe,children:"Remove Authenticator App for MFA"})}),z(G,{})]});if(r==="passkey")return Jt(fi,{children:[z(T,{backFn:ve,onClose:A},"header"),z(Pe,{children:z(Oe,{children:z(M6,{})})}),z(ae,{children:"Are you sure you want to remove passkey verification?"}),z(se,{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."}),z(mt,{children:z(L,{warn:!0,onClick:nr,children:"Yes, remove"})}),z(G,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!ce)return Jt(fi,{children:[z(T,{onClose:A},"header"),z(Pe,{children:z(Oe,{children:z(Zy,{})})}),z(ae,{children:"Add more security"}),Jt(se,{children:[l?.name," does not have any verification methods enabled."]}),z(mt,{children:z(L,{onClick:A,children:"Close"})}),z(G,{})]});let ke=!ce&&!v;return ke?Jt(fi,{children:[z(T,{onClose:A},"header"),z(Pe,{children:z(Oe,{children:z(Zy,{})})}),z(ae,{children:"Transaction Protection"}),z(se,{children:"Set up transaction protection to add an extra layer of security to your account"}),Jt(nn,{children:[Jt(Wt,{children:[z(Mt,{children:z(A6,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),Jt(Wt,{children:[z(Mt,{children:z(R6,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),Jt(mt,{children:[z(L,{onClick:()=>g(!0),children:"Continue"}),z(Pr,{onClick:A,children:"Not now"})]}),z(G,{})]}):S==="sms"?z($y,{onComplete:A,onReset:ve,onClose:A}):S==="totp"&&w?z(Yy,{onComplete:A,onClose:A,onReset:ve,totpInfo:w}):S==="passkey"?z(Fy,{onComplete:A,onReset:ve,onClose:A}):z(Dy,{showIntro:ke,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:$,onBackToIntro:ee,handleSelectMethod:Ke,isTotpLoading:S==="totp"&&!w,isPasskeyLoading:k,error:q,onClose:A,setRemovingMfaMethod:o})};import M7 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import W7 from"@heroicons/react/24/outline/FingerPrintIcon";import L7 from"@heroicons/react/24/outline/PhoneIcon";import O7 from"@heroicons/react/24/outline/ShieldCheckIcon";import N7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import D7 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as U7,useState as xa}from"react";import{useMemo as S7,useEffect as _7,useState as U1}from"react";import x7 from"styled-components";import C1 from"styled-components";import Xy from"styled-components";import{jsx as Qy,jsxs as N6}from"react/jsx-runtime";var ql=({label:e,children:t,valueStyles:r})=>N6(L6,{children:[Qy("div",{children:e}),Qy(O6,{style:{...r},children:t})]}),L6=Xy.div`
2095
+ `;import{Fragment as Ud,jsx as Ae,jsxs as gn}from"react/jsx-runtime";var $y=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=zl(""),[i,a]=zl(!1),[l,s]=zl(null),[c,u]=zl("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:h}=Mr(),{app:y,data:v}=_();function g(){v?.mfaEnrollmentFlow?.onSuccess(),e()}async function S({qualifiedPhoneNumber:I}){try{await f({phoneNumber:I}),n(I),u("verify")}catch(A){s(A)}}async function b(I){try{if(!I)return;await h({phoneNumber:o,mfaCode:I}),a(!0)}catch(A){throw sl(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(A)?new Error("The code you entered is not valid"):cn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(A)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){c==="verify"?u("enroll"):t()}return l?Ae(na,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?gn(Ud,{children:[Ae(P,{backFn:t,onClose:r},"header"),Ae(Te,{children:Ae(Oe,{children:Ae(qy,{})})}),Ae(ae,{children:"Set up SMS verification"}),Ae(se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),gn(ur,{children:[Ae(li,{onSubmit:S}),gn(Fm,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),Ae(G,{})]}):i?gn(Ud,{children:[Ae(P,{onClose:g},"header"),Ae(Te,{children:Ae(Oe,{status:"success",children:Ae(T6,{})})}),Ae(ae,{children:"SMS verification added"}),Ae(se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ae(mt,{children:Ae(L,{onClick:g,children:"Done"})}),Ae(G,{})]}):gn(Ud,{children:[Ae(P,{backFn:w,onClose:r},"header"),Ae(Te,{children:Ae(Oe,{children:Ae(qy,{})})}),Ae(ae,{children:"Enter enrollment code"}),gn(ur,{children:[Ae(yn,{onChange:b}),gn(se,{children:["To continue, enter the 6-digit code sent to ",Ae("strong",{children:oy(o)})]})]}),Ae(G,{})]})};import _6 from"@heroicons/react/24/solid/CheckCircleIcon";import x6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as jy}from"react";import P6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as S6}from"react/jsx-runtime";var Ky=({size:e,authUrl:t})=>S6(si,{url:t,squareLogoElement:P6,size:e,fgColor:"#1F1F1F"});import{Fragment as Fd,jsx as Se,jsxs as va}from"react/jsx-runtime";var Yy=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=jy("enroll"),[a,l]=jy(!1),{submitEnrollmentWithTotp:s}=Mr(),{data:c}=_();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function h(v){try{if(!v)return;await s({mfaCode:v}),l(!0)}catch(g){throw sl(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(g)?new Error("The code you entered is not valid"):cn(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ll(g)?new Error("Verification canceled"):new Error("Unknown error")}}function y(){n==="verify"?i("enroll"):r()}return n==="enroll"?va(Fd,{children:[Se(P,{backFn:r,onClose:t},"header"),Se(ae,{children:"Scan QR code"}),Se(se,{children:"Open your authenticator app and scan the QR code to continue."}),Se(Gn,{children:Se(Ky,{authUrl:o.authUrl,size:200})}),va(mt,{children:[Se(Et,{children:Se(ko,{itemName:"secret",text:o.secret})}),Se(L,{onClick:f,children:"Continue"})]}),Se(G,{})]}):a?va(Fd,{children:[Se(P,{onClose:u},"header"),Se(Te,{children:Se(Oe,{status:"success",children:Se(_6,{})})}),Se(ae,{children:"Authenticator app verification added"}),Se(se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Se(mt,{children:Se(L,{onClick:u,children:"Done"})}),Se(G,{})]}):va(Fd,{children:[Se(P,{backFn:y,onClose:t},"header"),Se(Te,{children:Se(Oe,{children:Se(x6,{})})}),Se(ae,{children:"Enter enrollment code"}),Se(ur,{children:Se(yn,{onChange:h})}),va(se,{children:["To continue, enter the 6-digit code generated from your ",Se("strong",{children:"authenticator app"})]}),Se(G,{})]})};import{Fragment as fi,jsx as z,jsxs as Jt}from"react/jsx-runtime";var Jy=()=>{let{user:e,enrollInMfa:t}=F(),[r,o]=mi(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Mr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=_(),{closePrivyModal:f}=M(),{promptMfa:h}=fa(),{initEnrollmentWithTotp:y}=Mr(),[v,g]=mi(!1),[S,b]=mi(null),[w,I]=mi(null),A=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),b(null)},500)},{initEnrollmentWithPasskey:O,submitEnrollmentWithPasskey:R}=Mr(),[k,H]=mi(!1),[q,j]=mi(null);u.current=A;let W=e?.mfaMethods.includes("sms"),$=!!e?.phone,D=e?.mfaMethods.includes("totp"),ue=e?.mfaMethods.includes("passkey"),ce=W||D||ue,de=e?.linkedAccounts.filter(Ve=>Ve.type==="passkey").map(Ve=>Ve.credentialId)??[];W6(()=>{ce&&g(!0)},[ce]);function ve(){o(null),b(null)}function ee(){g(!1)}async function Ct(){H(!0);try{await O(),await R({credentialIds:de})}catch(Ve){j(Ve)}finally{H(!1)}}async function Ke(Ve){if(await h().catch(j),Ve==="totp"){b(Ve),I(null),y().then(ir=>{I(ir)}).catch(()=>{I(null),ve()});return}if(Ve==="passkey"&&de.length===1)return await Ct();b(Ve)}if(!s||!e||!l)return Jt(fi,{children:[z(P,{onClose:A},"header"),z(Te,{children:z(Ny,{})}),z(ur,{children:z(et,{})}),z(G,{})]});async function xt(){o(null);try{await n()}catch{o(null)}}async function Qe(){o(null);try{await i()}catch{o(null)}}async function nr(){o(null);try{await h(),await a()}catch{o(null)}}if(r==="sms")return Jt(fi,{children:[z(P,{backFn:ve,onClose:A},"header"),z(Te,{children:z(Oe,{children:z(I6,{})})}),z(ae,{children:"Remove SMS verification?"}),Jt(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(mt,{children:z(L,{warn:!0,onClick:xt,children:"Remove SMS for MFA"})}),z(G,{})]});if(r==="totp")return Jt(fi,{children:[z(P,{backFn:ve,onClose:A},"header"),z(Te,{children:z(Oe,{children:z(k6,{})})}),z(ae,{children:"Remove Authenticator App verification?"}),Jt(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(mt,{children:z(L,{warn:!0,onClick:Qe,children:"Remove Authenticator App for MFA"})}),z(G,{})]});if(r==="passkey")return Jt(fi,{children:[z(P,{backFn:ve,onClose:A},"header"),z(Te,{children:z(Oe,{children:z(M6,{})})}),z(ae,{children:"Are you sure you want to remove passkey verification?"}),z(se,{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."}),z(mt,{children:z(L,{warn:!0,onClick:nr,children:"Yes, remove"})}),z(G,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!ce)return Jt(fi,{children:[z(P,{onClose:A},"header"),z(Te,{children:z(Oe,{children:z(Zy,{})})}),z(ae,{children:"Add more security"}),Jt(se,{children:[l?.name," does not have any verification methods enabled."]}),z(mt,{children:z(L,{onClick:A,children:"Close"})}),z(G,{})]});let ke=!ce&&!v;return ke?Jt(fi,{children:[z(P,{onClose:A},"header"),z(Te,{children:z(Oe,{children:z(Zy,{})})}),z(ae,{children:"Transaction Protection"}),z(se,{children:"Set up transaction protection to add an extra layer of security to your account"}),Jt(nn,{children:[Jt(Wt,{children:[z(Mt,{children:z(A6,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),Jt(Wt,{children:[z(Mt,{children:z(R6,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),Jt(mt,{children:[z(L,{onClick:()=>g(!0),children:"Continue"}),z(Tr,{onClick:A,children:"Not now"})]}),z(G,{})]}):S==="sms"?z($y,{onComplete:A,onReset:ve,onClose:A}):S==="totp"&&w?z(Yy,{onComplete:A,onClose:A,onReset:ve,totpInfo:w}):S==="passkey"?z(Fy,{onComplete:A,onReset:ve,onClose:A}):z(Dy,{showIntro:ke,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:$,onBackToIntro:ee,handleSelectMethod:Ke,isTotpLoading:S==="totp"&&!w,isPasskeyLoading:k,error:q,onClose:A,setRemovingMfaMethod:o})};import M7 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import W7 from"@heroicons/react/24/outline/FingerPrintIcon";import L7 from"@heroicons/react/24/outline/PhoneIcon";import O7 from"@heroicons/react/24/outline/ShieldCheckIcon";import N7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import D7 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as U7,useState as xa}from"react";import{useMemo as S7,useEffect as _7,useState as U1}from"react";import x7 from"styled-components";import C1 from"styled-components";import Xy from"styled-components";import{jsx as Qy,jsxs as N6}from"react/jsx-runtime";var ql=({label:e,children:t,valueStyles:r})=>N6(L6,{children:[Qy("div",{children:e}),Qy(O6,{style:{...r},children:t})]}),L6=Xy.div`
2096
2096
  display: flex;
2097
2097
  align-items: center;
2098
2098
  justify-content: space-between;
@@ -2288,7 +2288,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2288
2288
  background-color: var(--privy-color-background-2);
2289
2289
  padding: 5px 8px;
2290
2290
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2291
- `;import Yl from"styled-components";import{Fragment as P1,jsx as Pa,jsxs as T1}from"react/jsx-runtime";var S1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?Ca(n,o):void 0,a=Jr(n,r);return T1(u7,{children:[i?T1(P1,{children:[Pa(E1,{children:i}),Pa(m7,{children:a})]}):Pa(P1,{children:Pa(E1,{children:a})}),Pa(f7,{children:e})]})},u7=Yl.div`
2291
+ `;import Yl from"styled-components";import{Fragment as T1,jsx as Ta,jsxs as P1}from"react/jsx-runtime";var S1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?Ca(n,o):void 0,a=Jr(n,r);return P1(u7,{children:[i?P1(T1,{children:[Ta(E1,{children:i}),Ta(m7,{children:a})]}):Ta(T1,{children:Ta(E1,{children:a})}),Ta(f7,{children:e})]})},u7=Yl.div`
2292
2292
  display: flex;
2293
2293
  flex-direction: column;
2294
2294
  align-items: center;
@@ -2313,10 +2313,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
2313
2313
  overflow: hidden;
2314
2314
  max-width: 275px;
2315
2315
  text-overflow: ellipsis;
2316
- `;import{VoidSigner as w7}from"@ethersproject/abstract-signer";import{EtherscanProvider as _q}from"@ethersproject/providers";import{BigNumber as k1}from"@ethersproject/bignumber";import{BigNumber as gi}from"@ethersproject/bignumber";import{Contract as h7}from"@ethersproject/contracts";import{serialize as y7}from"@ethersproject/transactions";var vi=e=>[ks.id,Rs.id,Is.id,Ms.id,Ws.id,Ls.id,Os.id,Ds.id,Ns.id].includes(e),_1=async(e,t)=>{if(!vi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=gi.from(r).mul(gi.from(126)).div(gi.from(100)).add(gi.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Ta(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function x1(e,t){if(!e.chainId||e.chainId&&!vi(e.chainId))return gi.from(0);let r=gi.from(0);try{let o=new h7(Su,_u,t),n=A1(e),i=y7(n);r=await o.getL1Fee(i)}catch{}return r}async function R1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var I1=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Ci(e,t){if(!e.gasLimit)throw new Ue("gasLimit was not successfully set for transaction.");let r=yt(e.gasLimit),o=k1.from(0);if(e.type==2)if(e.maxFeePerGas)o=yt(e.maxFeePerGas);else throw new Ue("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=yt(e.gasPrice);else throw new Ue("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=k1.from(0);if(e.chainId&&vi(e.chainId))try{i=await x1(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as jd}from"@ethersproject/bignumber";var Yd=e=>[_s.id,xs.id,As.id].includes(e),M1=async(e,t)=>{if(!Yd(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(jd.from(120)).div(jd.from(100));e.maxFeePerGas=Ta(o),e.maxPriorityFeePerGas=Ta(jd.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Zd=e=>[56,97].includes(e),W1=async(e,t)=>{if(!Zd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as L1}from"@ethersproject/units";import{ofetch as g7}from"ofetch";var Jd={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var Xd=e=>[Ni.id,Di.id,Jd.id].includes(e),Qd=e=>({maxPriorityFee:L1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:L1(e.maxFee.toFixed(9),"gwei").toHexString()}),v7=e=>({safeLow:Qd(e.safeLow),standard:Qd(e.standard),fast:Qd(e.fast)}),C7=async e=>{let t="";switch(e){case Ni.id:t="https://gasstation.polygon.technology/v2";break;case Di.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Jd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return v7(await g7(t))};async function O1(e){if(!Xd(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await C7(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function Ta(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function A1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=yt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=yt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=yt(e.gasPrice)),e.value!==void 0&&(t.value=yt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=yt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=yt(e.maxPriorityFeePerGas)),t}async function wi(e,t,r){if(t.chainId=Number(t.chainId),N1(t),t.from||(t.from=e),!t.nonce){let o=new w7(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await R1(t,r)),typeof t.type=="string"&&D1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),Xd(t.chainId)?t=await O1(t):Yd(t.chainId)?t=await M1(t,r):vi(t.chainId)?t=await _1(t,r):Zd(t.chainId)?t=await W1(t,r):t=await I1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function Zl(e,t,r,o,n){o=Object.assign({chainId:ro},o),N1(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function Jl(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(yt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function N1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!b7(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 b7(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&D1(e);return t||r||o}function D1(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 ep,useEffect as E7}from"react";var Xl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=ep(!0),[a,l]=ep(void 0),[s,c]=ep(void 0);return E7(()=>{let u=e.chainId||ro,f=o.find(y=>y.id===Number(u));if(!f)throw new te(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let y=await r(f);y?c(y):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(y){l(y)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as P7,useContext as T7}from"react";var tp=P7(null);function Sa(){let e=T7(tp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as F1}from"react/jsx-runtime";var _a=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:r}=Sa(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=U1(null),[u,f]=U1(e),{tokenPrice:h}=Xl(u),y=l(e.chainId)||"ETH",v=S7(()=>r.find(g=>g.walletClientType==="privy"),[r]);return _7(()=>{async function g(){if(!await t()||!o||!v)return u;let b=to(u.chainId,i,n,{appId:a}),w=await wi(v.address,u,b),{totalGasEstimate:I}=await Ci(w,b);return c(I.toHexString()),w}g().then(f).catch(console.error)},[o]),v?F1(A7,{children:F1(yi,{from:v.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:y})}):null},A7=x7.div`
2316
+ `;import{VoidSigner as w7}from"@ethersproject/abstract-signer";import{EtherscanProvider as _q}from"@ethersproject/providers";import{BigNumber as k1}from"@ethersproject/bignumber";import{BigNumber as gi}from"@ethersproject/bignumber";import{Contract as h7}from"@ethersproject/contracts";import{serialize as y7}from"@ethersproject/transactions";var vi=e=>[ks.id,Rs.id,Is.id,Ms.id,Ws.id,Ls.id,Os.id,Ds.id,Ns.id].includes(e),_1=async(e,t)=>{if(!vi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=gi.from(r).mul(gi.from(126)).div(gi.from(100)).add(gi.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Pa(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function x1(e,t){if(!e.chainId||e.chainId&&!vi(e.chainId))return gi.from(0);let r=gi.from(0);try{let o=new h7(Su,_u,t),n=A1(e),i=y7(n);r=await o.getL1Fee(i)}catch{}return r}async function R1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var I1=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Ci(e,t){if(!e.gasLimit)throw new Ue("gasLimit was not successfully set for transaction.");let r=yt(e.gasLimit),o=k1.from(0);if(e.type==2)if(e.maxFeePerGas)o=yt(e.maxFeePerGas);else throw new Ue("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=yt(e.gasPrice);else throw new Ue("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=k1.from(0);if(e.chainId&&vi(e.chainId))try{i=await x1(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as jd}from"@ethersproject/bignumber";var Yd=e=>[_s.id,xs.id,As.id].includes(e),M1=async(e,t)=>{if(!Yd(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(jd.from(120)).div(jd.from(100));e.maxFeePerGas=Pa(o),e.maxPriorityFeePerGas=Pa(jd.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Zd=e=>[56,97].includes(e),W1=async(e,t)=>{if(!Zd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as L1}from"@ethersproject/units";import{ofetch as g7}from"ofetch";var Jd={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var Xd=e=>[Ni.id,Di.id,Jd.id].includes(e),Qd=e=>({maxPriorityFee:L1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:L1(e.maxFee.toFixed(9),"gwei").toHexString()}),v7=e=>({safeLow:Qd(e.safeLow),standard:Qd(e.standard),fast:Qd(e.fast)}),C7=async e=>{let t="";switch(e){case Ni.id:t="https://gasstation.polygon.technology/v2";break;case Di.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Jd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return v7(await g7(t))};async function O1(e){if(!Xd(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await C7(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function Pa(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function A1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=yt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=yt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=yt(e.gasPrice)),e.value!==void 0&&(t.value=yt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=yt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=yt(e.maxPriorityFeePerGas)),t}async function wi(e,t,r){if(t.chainId=Number(t.chainId),N1(t),t.from||(t.from=e),!t.nonce){let o=new w7(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await R1(t,r)),typeof t.type=="string"&&D1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),Xd(t.chainId)?t=await O1(t):Yd(t.chainId)?t=await M1(t,r):vi(t.chainId)?t=await _1(t,r):Zd(t.chainId)?t=await W1(t,r):t=await I1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function Zl(e,t,r,o,n){o=Object.assign({chainId:ro},o),N1(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function Jl(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(yt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function N1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!b7(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 b7(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&D1(e);return t||r||o}function D1(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 ep,useEffect as E7}from"react";var Xl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=ep(!0),[a,l]=ep(void 0),[s,c]=ep(void 0);return E7(()=>{let u=e.chainId||ro,f=o.find(y=>y.id===Number(u));if(!f)throw new te(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let y=await r(f);y?c(y):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(y){l(y)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as T7,useContext as P7}from"react";var tp=T7(null);function Sa(){let e=P7(tp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as F1}from"react/jsx-runtime";var _a=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:r}=Sa(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=U1(null),[u,f]=U1(e),{tokenPrice:h}=Xl(u),y=l(e.chainId)||"ETH",v=S7(()=>r.find(g=>g.walletClientType==="privy"),[r]);return _7(()=>{async function g(){if(!await t()||!o||!v)return u;let b=to(u.chainId,i,n,{appId:a}),w=await wi(v.address,u,b),{totalGasEstimate:I}=await Ci(w,b);return c(I.toHexString()),w}g().then(f).catch(console.error)},[o]),v?F1(A7,{children:F1(yi,{from:v.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:y})}):null},A7=x7.div`
2317
2317
  width: 100%;
2318
2318
  padding: 1rem 0;
2319
- `;import k7 from"@heroicons/react/24/outline/CalendarIcon";import R7 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import I7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as B1,jsx as gt,jsxs as bi}from"react/jsx-runtime";var H1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return bi(B1,{children:[gt(T,{onClose:r},"header"),gt(rt,{children:bi("div",{children:[gt(Xe,{success:a,fail:!!t}),t?gt(R7,{style:{width:"38px",height:"38px"}}):gt(fn,{style:{width:"38px",height:"38px"}})]})}),gt(ae,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),bi(nn,{children:[bi(Wt,{children:[gt(Mt,{children:gt(I7,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),bi(Wt,{children:[gt(Mt,{children:gt(k7,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&gt(ur,{children:gt(_a,{pendingTransaction:l})}),t&&bi(B1,{children:[gt(Xs,{style:{marginTop:"1.25rem"},children:t.message}),gt(L,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&gt(Gi,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),gt(G,{})]})};import{Fragment as rp,jsx as pe,jsxs as Lr}from"react/jsx-runtime";var op=({open:e,onClose:t})=>{let{user:r}=F(),[o,n]=xa(null),{init:i,cancel:a,submit:l}=fa(),[s,c]=xa(!1),[u,f]=xa(!1),[h,y]=xa(null),[v,g]=xa(null);U7(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?w(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let S=O=>ad(O)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):dn(O)?(c(!1),new Error("The code you entered is not valid")):cn(O)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(O),c(!1),new Error("Something went wrong."));async function b(O){g(null);try{if(!O||!o)return;await l(o,O),f(!0),c(!1),t()}catch(R){throw S(R)}}async function w(O){if(O==="passkey"){try{n(O);let R=await i(O);if(!R)throw new Error("something went wrong");y(R),await l(O,R),f(!0),c(!1),t()}catch(R){g(S(R))}return}try{n(O),await i(O)}catch(R){console.error(R)}}let I=()=>{n(null),g(null),a(),t()},A=()=>{n(null),g(null)};if(!e||!r)return null;if(o==="passkey"){let O=r.linkedAccounts.filter(R=>R.type==="passkey"&&R.enrolledInMfa).sort((R,k)=>k.firstVerifiedAt.valueOf()-R.firstVerifiedAt.valueOf())[0];return pe(H1,{account:O,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:v,onClose:I,onBack:A,handleSubmit:()=>b(h).catch(g)})}return o?pe(F7,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:b,selectedMethod:o,onClose:I,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Lr(rp,{children:[pe(T,{onClose:I},"header"),pe(Pe,{children:pe(Oe,{children:pe(O7,{})})}),pe(ae,{children:"Verify your identity"}),pe(se,{children:"Choose a verification method"}),Lr(js,{children:[r.mfaMethods.includes("totp")&&Lr(Ee,{onClick:()=>w("totp"),children:[pe(M7,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Lr(Ee,{onClick:()=>w("sms"),children:[pe(L7,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Lr(Ee,{onClick:()=>w("passkey"),children:[pe(W7,{}),"Passkey"]},"passkey")]}),pe(G,{})]})},F7=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=_(),{pendingTransaction:l}=M();switch(e){case"sms":return Lr(rp,{children:[pe(T,{onClose:o},"header"),pe(Pe,{children:pe(Oe,{children:pe(D7,{})})}),pe(ae,{children:"Enter verification code"}),Lr(ur,{children:[pe(yn,{success:t,disabled:r,onChange:i}),Lr(se,{children:["To continue, please enter the 6-digit code sent to your ",pe("strong",{children:"mobile device"})]}),l&&pe(_a,{pendingTransaction:l})]}),n&&pe(Gi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(Pr,{onClick:o,children:"Not now"}),pe(G,{})]});case"totp":return Lr(rp,{children:[pe(T,{onClose:o},"header"),pe(Pe,{children:pe(Oe,{children:pe(N7,{})})}),pe(ae,{children:"Enter verification code"}),Lr(ur,{children:[pe(yn,{success:t,disabled:r,onChange:i}),Lr(se,{children:["To continue, please enter the 6-digit code generated from your"," ",pe("strong",{children:"authenticator app"})]}),l&&pe(_a,{pendingTransaction:l})]}),n&&pe(Gi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(Pr,{onClick:o,children:"Not now"}),pe(G,{})]});default:return null}};import{useEffect as G1,useState as V1}from"react";import B7 from"styled-components";import{Fragment as G7,jsx as Qr,jsxs as ec}from"react/jsx-runtime";var z1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:h,closePrivyModal:y,createAnalyticsEvent:v}=M(),[g,S]=V1(!1),[b,w]=V1(void 0),I=s()?.provider||"google",{name:A,component:O}=Wi(I),R=Gs(),k=n?.render.inDialog?We:0;G1(()=>{u(I).then(j=>{S(!0),h(!0),j&&R("login","onOAuthLoginComplete",j)}).catch(j=>{if(j?.privyErrorCode==="allowlist_rejected"){w(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new sr(j).toString()),w(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:W,detail:$}=Ou(j,I);w({retryable:W,detail:$,message:"Authentication failed"}),h(!1)}).finally(()=>{Zo()})},[A,I]),G1(()=>{if(r&&e&&g&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(W)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:$,provider:I,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(W)}else{let W=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k);return f(),()=>clearTimeout(W)}}},[r,e,g,o]);let H=g?`Successfully connected with ${A}`:b?b.message:`Verifying connection to ${A}`,q="";return g?q="You\u2019re good to go!":b?q=b.detail:q="Just a few moments more",ec(G7,{children:[Qr(T,{}),Qr(X,{}),ec(H7,{children:[Qr(rt,{children:ec("div",{children:[Qr(Xe,{success:g,fail:!!b}),Qr(O,{style:{width:"38px",height:"38px"}})]})}),ec(qe,{children:[Qr("h3",{children:H}),Qr("p",{children:q})]}),b&&b?.retryable?Qr(Un,{onClick:()=>{Zo(),c(I),w(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),Qr(re,{}),Qr(G,{})]})},H7=B7.div`
2319
+ `;import k7 from"@heroicons/react/24/outline/CalendarIcon";import R7 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import I7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as B1,jsx as gt,jsxs as bi}from"react/jsx-runtime";var H1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return bi(B1,{children:[gt(P,{onClose:r},"header"),gt(rt,{children:bi("div",{children:[gt(Xe,{success:a,fail:!!t}),t?gt(R7,{style:{width:"38px",height:"38px"}}):gt(fn,{style:{width:"38px",height:"38px"}})]})}),gt(ae,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),bi(nn,{children:[bi(Wt,{children:[gt(Mt,{children:gt(I7,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),bi(Wt,{children:[gt(Mt,{children:gt(k7,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&gt(ur,{children:gt(_a,{pendingTransaction:l})}),t&&bi(B1,{children:[gt(Xs,{style:{marginTop:"1.25rem"},children:t.message}),gt(L,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&gt(Gi,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),gt(G,{})]})};import{Fragment as rp,jsx as pe,jsxs as Lr}from"react/jsx-runtime";var op=({open:e,onClose:t})=>{let{user:r}=F(),[o,n]=xa(null),{init:i,cancel:a,submit:l}=fa(),[s,c]=xa(!1),[u,f]=xa(!1),[h,y]=xa(null),[v,g]=xa(null);U7(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?w(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let S=O=>ad(O)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):dn(O)?(c(!1),new Error("The code you entered is not valid")):cn(O)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(O),c(!1),new Error("Something went wrong."));async function b(O){g(null);try{if(!O||!o)return;await l(o,O),f(!0),c(!1),t()}catch(R){throw S(R)}}async function w(O){if(O==="passkey"){try{n(O);let R=await i(O);if(!R)throw new Error("something went wrong");y(R),await l(O,R),f(!0),c(!1),t()}catch(R){g(S(R))}return}try{n(O),await i(O)}catch(R){console.error(R)}}let I=()=>{n(null),g(null),a(),t()},A=()=>{n(null),g(null)};if(!e||!r)return null;if(o==="passkey"){let O=r.linkedAccounts.filter(R=>R.type==="passkey"&&R.enrolledInMfa).sort((R,k)=>k.firstVerifiedAt.valueOf()-R.firstVerifiedAt.valueOf())[0];return pe(H1,{account:O,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:v,onClose:I,onBack:A,handleSubmit:()=>b(h).catch(g)})}return o?pe(F7,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:b,selectedMethod:o,onClose:I,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Lr(rp,{children:[pe(P,{onClose:I},"header"),pe(Te,{children:pe(Oe,{children:pe(O7,{})})}),pe(ae,{children:"Verify your identity"}),pe(se,{children:"Choose a verification method"}),Lr(js,{children:[r.mfaMethods.includes("totp")&&Lr(Ee,{onClick:()=>w("totp"),children:[pe(M7,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Lr(Ee,{onClick:()=>w("sms"),children:[pe(L7,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&Lr(Ee,{onClick:()=>w("passkey"),children:[pe(W7,{}),"Passkey"]},"passkey")]}),pe(G,{})]})},F7=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=_(),{pendingTransaction:l}=M();switch(e){case"sms":return Lr(rp,{children:[pe(P,{onClose:o},"header"),pe(Te,{children:pe(Oe,{children:pe(D7,{})})}),pe(ae,{children:"Enter verification code"}),Lr(ur,{children:[pe(yn,{success:t,disabled:r,onChange:i}),Lr(se,{children:["To continue, please enter the 6-digit code sent to your ",pe("strong",{children:"mobile device"})]}),l&&pe(_a,{pendingTransaction:l})]}),n&&pe(Gi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(Tr,{onClick:o,children:"Not now"}),pe(G,{})]});case"totp":return Lr(rp,{children:[pe(P,{onClose:o},"header"),pe(Te,{children:pe(Oe,{children:pe(N7,{})})}),pe(ae,{children:"Enter verification code"}),Lr(ur,{children:[pe(yn,{success:t,disabled:r,onChange:i}),Lr(se,{children:["To continue, please enter the 6-digit code generated from your"," ",pe("strong",{children:"authenticator app"})]}),l&&pe(_a,{pendingTransaction:l})]}),n&&pe(Gi,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(Tr,{onClick:o,children:"Not now"}),pe(G,{})]});default:return null}};import{useEffect as G1,useState as V1}from"react";import B7 from"styled-components";import{Fragment as G7,jsx as Qr,jsxs as ec}from"react/jsx-runtime";var z1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:h,closePrivyModal:y,createAnalyticsEvent:v}=M(),[g,S]=V1(!1),[b,w]=V1(void 0),I=s()?.provider||"google",{name:A,component:O}=Wi(I),R=Gs(),k=n?.render.inDialog?We:0;G1(()=>{u(I).then(j=>{S(!0),h(!0),j&&R("login","onOAuthLoginComplete",j)}).catch(j=>{if(j?.privyErrorCode==="allowlist_rejected"){w(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new sr(j).toString()),w(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:W,detail:$}=Ou(j,I);w({retryable:W,detail:$,message:"Authentication failed"}),h(!1)}).finally(()=>{Zo()})},[A,I]),G1(()=>{if(r&&e&&g&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(W)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:$,provider:I,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(W)}else{let W=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),k);return f(),()=>clearTimeout(W)}}},[r,e,g,o]);let H=g?`Successfully connected with ${A}`:b?b.message:`Verifying connection to ${A}`,q="";return g?q="You\u2019re good to go!":b?q=b.detail:q="Just a few moments more",ec(G7,{children:[Qr(P,{}),Qr(X,{}),ec(H7,{children:[Qr(rt,{children:ec("div",{children:[Qr(Xe,{success:g,fail:!!b}),Qr(O,{style:{width:"38px",height:"38px"}})]})}),ec(qe,{children:[Qr("h3",{children:H}),Qr("p",{children:q})]}),b&&b?.retryable?Qr(Un,{onClick:()=>{Zo(),c(I),w(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),Qr(re,{}),Qr(G,{})]})},H7=B7.div`
2320
2320
  display: flex;
2321
2321
  flex-direction: column;
2322
2322
  align-items: center;
@@ -2327,7 +2327,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2327
2327
  `;import{useEffect as np,useRef as V7,useState as q1}from"react";import $1 from"styled-components";import{Fragment as q7,jsx as uo,jsxs as tc}from"react/jsx-runtime";var K1=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=_(),{loginWithPasskey:n,closePrivyModal:i}=M(),a=e?.render.inDialog?We:0,[l,s]=q1("loading"),[c,u]=q1(null),f=V7([]),h=b=>{f.current=[b,...f.current]};np(()=>()=>{f.current.forEach(b=>clearTimeout(b)),f.current=[]},[]);let y=()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},v=()=>{switch(l){case"loading":return`Please follow prompts to verify your passkey.
2328
2328
  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(c instanceof Ge){if(c.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(c.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2329
2329
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2330
- You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(l){case"loading":case"success":return uo(L,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return uo(L,{onClick:S,disabled:!1,children:"Retry"})}},S=async()=>{s("loading");try{await n(),s("success")}catch(b){u(b),s("error")}};return np(()=>{l==="success"&&h(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),np(()=>{S()},[]),tc(q7,{children:[uo(T,{backFn:!t||r===t?void 0:o}),tc(z7,{children:[uo(rt,{children:tc("div",{children:[uo(Xe,{success:l==="success",fail:l==="error"}),uo(hn,{style:{width:"38px",height:"38px"}})]})}),tc(qe,{children:[uo("h3",{children:y()}),uo("p",{style:{whiteSpace:"pre-wrap"},children:v()})]}),g()]}),uo(G,{})]})},z7=$1.div`
2330
+ You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(l){case"loading":case"success":return uo(L,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return uo(L,{onClick:S,disabled:!1,children:"Retry"})}},S=async()=>{s("loading");try{await n(),s("success")}catch(b){u(b),s("error")}};return np(()=>{l==="success"&&h(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),np(()=>{S()},[]),tc(q7,{children:[uo(P,{backFn:!t||r===t?void 0:o}),tc(z7,{children:[uo(rt,{children:tc("div",{children:[uo(Xe,{success:l==="success",fail:l==="error"}),uo(hn,{style:{width:"38px",height:"38px"}})]})}),tc(qe,{children:[uo("h3",{children:y()}),uo("p",{style:{whiteSpace:"pre-wrap"},children:v()})]}),g()]}),uo(G,{})]})},z7=$1.div`
2331
2331
  display: flex;
2332
2332
  flex-direction: column;
2333
2333
  align-items: center;
@@ -2350,9 +2350,9 @@ You will have to sign up with another method first to register a passkey for you
2350
2350
  stroke: var(--privy-color-accent) !important;
2351
2351
  fill: var(--privy-color-accent) !important;
2352
2352
  }
2353
- `;import{useEffect as K7,useState as Y1}from"react";import j7 from"styled-components";import{isMobile as $7}from"react-device-detect";var j1=(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(!vo()&&$7)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Z7,jsx as mo,jsxs as Z1}from"react/jsx-runtime";var J1=()=>{let{forkSession:e,ready:t,authenticated:r}=F(),[o,n]=Y1(""),[i,a]=Y1(!1);K7(()=>{t&&r&&e().then(n)},[t,r]);let l=j1(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."),Z1(Z7,{children:[mo(T,{},"header"),mo(X,{}),mo(qr,{title:s.title,description:s.description}),Z1(mr,{children:[mo(Y7,{children:mo(Br,{style:{width:"72px",height:"72px"}})}),mo(zs,{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(re,{}),mo(V,{protectedByPrivy:!0})]})},Y7=j7(Et)`
2353
+ `;import{useEffect as K7,useState as Y1}from"react";import j7 from"styled-components";import{isMobile as $7}from"react-device-detect";var j1=(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(!vo()&&$7)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Z7,jsx as mo,jsxs as Z1}from"react/jsx-runtime";var J1=()=>{let{forkSession:e,ready:t,authenticated:r}=F(),[o,n]=Y1(""),[i,a]=Y1(!1);K7(()=>{t&&r&&e().then(n)},[t,r]);let l=j1(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."),Z1(Z7,{children:[mo(P,{},"header"),mo(X,{}),mo(qr,{title:s.title,description:s.description}),Z1(mr,{children:[mo(Y7,{children:mo(Br,{style:{width:"72px",height:"72px"}})}),mo(zs,{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(re,{}),mo(V,{protectedByPrivy:!0})]})},Y7=j7(Et)`
2354
2354
  margin: 16px auto;
2355
- `;import J7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Q7,useState as rc}from"react";import oc,{css as X7}from"styled-components";import{Fragment as n8,jsx as _t,jsxs as Cn}from"react/jsx-runtime";var Q1=()=>{let[e,t]=rc(!0),{authenticated:r,getAccessToken:o}=F(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,f]=rc(void 0),[h,y]=rc(""),[v,g]=rc(!1),{privyWallet:S,onCompleteNavigateTo:b,onSuccess:w,onFailure:I}=s.recoverWallet,A=(k="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),I(typeof k=="string"?new bt(k):k)};c.current=A,Q7(()=>{if(!r||!S)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let O=k=>{k&&f(k)};return Cn(n8,{children:[_t(T,{onClose:A}),_t(X,{}),Cn(t8,{children:[Cn(e8,{children:[_t(J7,{height:48,width:48,stroke:"var(--privy-color-accent)"}),_t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),_t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Cn("div",{children:[Cn(xo,{children:[_t(oi,{type:e?"password":"text",onChange:k=>O(k.target.value),disabled:v,style:{paddingRight:"2.3rem"}}),_t(ni,{style:{right:"0.75rem"},children:e?_t(ii,{onClick:()=>t(!1)}):_t(ai,{onClick:()=>t(!0)})})]}),!!h&&_t(r8,{children:h})]}),Cn("div",{children:[Cn($m,{children:[_t("h4",{children:"Why is this necessary?"}),_t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),_t(o8,{loading:v||!n,disabled:!u,onClick:async()=>{g(!0);let k=await o();if(k&&S&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:S.address}}),await n?.recover({address:S.address,accessToken:k,recoveryPin:u}),y(""),b?l(b):i({shouldCallAuthOnSuccess:!1}),w?.(S),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}})}catch(H){kf(H)?y("Invalid recovery password, please try again."):y("An error has occurred, please try again.")}finally{g(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&v,children:"Recover your account"})]})]}),_t(re,{}),_t(V,{protectedByPrivy:!0})]})},e8=oc.div`
2355
+ `;import J7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Q7,useState as rc}from"react";import oc,{css as X7}from"styled-components";import{Fragment as n8,jsx as _t,jsxs as Cn}from"react/jsx-runtime";var Q1=()=>{let[e,t]=rc(!0),{authenticated:r,getAccessToken:o}=F(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,f]=rc(void 0),[h,y]=rc(""),[v,g]=rc(!1),{privyWallet:S,onCompleteNavigateTo:b,onSuccess:w,onFailure:I}=s.recoverWallet,A=(k="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),I(typeof k=="string"?new bt(k):k)};c.current=A,Q7(()=>{if(!r||!S)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let O=k=>{k&&f(k)};return Cn(n8,{children:[_t(P,{onClose:A}),_t(X,{}),Cn(t8,{children:[Cn(e8,{children:[_t(J7,{height:48,width:48,stroke:"var(--privy-color-accent)"}),_t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),_t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Cn("div",{children:[Cn(xo,{children:[_t(oi,{type:e?"password":"text",onChange:k=>O(k.target.value),disabled:v,style:{paddingRight:"2.3rem"}}),_t(ni,{style:{right:"0.75rem"},children:e?_t(ii,{onClick:()=>t(!1)}):_t(ai,{onClick:()=>t(!0)})})]}),!!h&&_t(r8,{children:h})]}),Cn("div",{children:[Cn($m,{children:[_t("h4",{children:"Why is this necessary?"}),_t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),_t(o8,{loading:v||!n,disabled:!u,onClick:async()=>{g(!0);let k=await o();if(k&&S&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:S.address}}),await n?.recover({address:S.address,accessToken:k,recoveryPin:u}),y(""),b?l(b):i({shouldCallAuthOnSuccess:!1}),w?.(S),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}})}catch(H){kf(H)?y("Invalid recovery password, please try again."):y("An error has occurred, please try again.")}finally{g(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&v,children:"Recover your account"})]})]}),_t(re,{}),_t(V,{protectedByPrivy:!0})]})},e8=oc.div`
2356
2356
  display: flex;
2357
2357
  flex-direction: column;
2358
2358
  align-items: center;
@@ -2401,8 +2401,8 @@ You will have to sign up with another method first to register a passkey for you
2401
2401
  padding-bottom: 24px;
2402
2402
  `,tg=eg.div`
2403
2403
  padding-bottom: 24px;
2404
- `;import{Fragment as ng,jsx as ho,jsxs as ap}from"react/jsx-runtime";var og={"google-drive":{name:"Google Drive",component:nc}},ig=()=>{let{logout:e}=F(),{navigate:t,setModalData:r,data:o}=_(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=ip(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[h,y]=ip(void 0),[v,g]=ip(u==="create-wallet"),S=og[c].name,b=og[c].component,w=o?.recoverWallet?.onCompleteNavigateTo,I=new De(async(k="create-wallet")=>(g(!0),new Promise((H,q)=>{setTimeout(async()=>{try{let j=window.open();await n(c,k,j),s(!0),H()}catch{y({message:`${k==="recover"?"Recovery":"Back up"} with ${S} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${S} account associated with your backup.`:"Something went wrong.",retryable:!0}),q()}},0)})));rg(()=>{u==="create-wallet"&&I.execute("create-wallet")},[]),rg(()=>{if(!l)return;let k=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:H=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},We);return()=>clearTimeout(k)},[l]);let A=i8(async()=>{await I.execute("recover"),w?t(w):s(!0)},[]),O=l?"Success!":h?h.message:`Verifying connection to ${S}`,R="";return h?R=h.detail:l?R=`Successfully ${u==="recover"?"recovered":"backed up"} with Google.`:R=`${u==="recover"?"Recovering":"Backing up"} with Google...`,ap(ng,{children:[ho(T,{}),v?ho(ng,{children:ap(Aa,{children:[ho(Te,{title:O,icon:ho(b,{style:{width:"38px",height:"38px"}}),description:R}),h&&h?.retryable?ho(L,{onClick:()=>{Zo(),y(void 0),u==="create-wallet"?I.execute("create-wallet"):A()},disabled:!l&&!h?.retryable,children:"Try again"}):null]})}):ap(Aa,{children:[ho(Te,{title:"Confirm it's really you",icon:ho(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to Google Drive where your account is
2405
- backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protectedByPrivy:!0})]})};import{useEffect as ag,useState as ka}from"react";import{jsx as a8}from"react/jsx-runtime";var sg=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=ka(""),[a,l]=ka(!1),[s,c]=ka(),[u,f]=ka(null),{authenticated:h}=F(),{closePrivyModal:y,isNewUserThisSession:v,initializeWalletProxy:g}=M(),{onSuccess:S,onFailure:b,callAuthOnSuccessOnClose:w}=r.createWallet,{createWallet:I}=dl(),[A,O]=ka(null),R=new De(async()=>{try{let q=await I(s);if(!q)return;O(q),v?t("EMBEDDED_WALLET_CREATED_SCREEN"):(S(q),y({shouldCallAuthOnSuccess:w}))}catch(q){i(q.message)}});ag(()=>{u||g(3e4).then(q=>f(q))},[u]),ag(()=>{if(!h){t("LANDING"),b(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let k=()=>{A&&A?.recoveryMethod!=="user-passcode"?(b(new bt("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):A?(S(A),y({shouldCallAuthOnSuccess:w})):(b(new bt("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let q=250;return R.execute().then(()=>new Promise(j=>setTimeout(j,q))).finally(()=>l(!1))};return a8(fl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!A&&a,error:n,password:s||"",onClose:k,onPasswordChange:c,onPasswordGenerate:()=>c(ml()),onSubmit:H})};import s8 from"@heroicons/react/24/outline/LockClosedIcon";import l8 from"@heroicons/react/24/outline/PencilSquareIcon";import c8 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as d8}from"react";import{Fragment as sp,jsx as Xt,jsxs as Ei}from"react/jsx-runtime";var p8=({onClose:e})=>Ei(tg,{children:[Xt(Te,{title:"Why do I need to secure my account?",icon:Xt(c8,{width:48}),description:Ei(sp,{children:[Xt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),Xt("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."})]})}),Xt(L,{onClick:e,children:"Select backup method"})]}),lg=()=>{let{navigate:e,setModalData:t,data:r}=_(),{user:o}=F(),{embeddedWallets:n}=dr(),a=_e(o)===null,[l,s]=d8(!1);return Ei(sp,{children:[Xt(T,{backFn:l?()=>s(!1):void 0,infoFn:l?void 0:()=>s(!0)},"header"),l?Xt(p8,{onClose:()=>s(!1)}):Ei(sp,{children:[Xt(Te,{title:"Secure your account",icon:Xt(s8,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),Xt(Aa,{children:n.userOwnedRecoveryOptions.map(c=>{switch(c){case"google-drive":return Ei(Ee,{onClick:async()=>{t({recoveryOAuthStatus:{provider:"google-drive",action:a?"create-wallet":"set-recovery",isInAccountCreateFlow:r?.recoverySelection?.isInAccountCreateFlow??!1}}),e("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")},children:[Xt(nc,{style:{width:18}})," Back up to Google Drive"]},c);case"user-passcode":return Ei(Ee,{onClick:()=>{e(a?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[Xt(l8,{style:{width:18}})," Set a password"]},c);default:return null}})})]}),Xt(V,{protectedByPrivy:!0})]})};import{BigNumber as gg}from"@ethersproject/bignumber";import{useMemo as vg,useEffect as Cg,useState as tr}from"react";import Ti from"styled-components";function cg(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as m8,ClipboardDocumentIcon as f8,ClipboardDocumentCheckIcon as h8}from"@heroicons/react/24/outline";import{useState as y8}from"react";import er from"styled-components";import{ErrorCode as ic}from"@ethersproject/logger";var u8=new Set([ic.CALL_EXCEPTION,ic.NONCE_EXPIRED,ic.REPLACEMENT_UNDERPRICED,ic.TRANSACTION_REPLACED]),dg=e=>{let t;return e.code&&e.code!==-32e3&&u8.has(e.code)&&(t=e.transactionHash),t},pg=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 R8,jsx as vt,jsxs as wn}from"react/jsx-runtime";var g8=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=dg(e),o=pg(e);return{errorCode:t,transactionHash:r,errorMessage:o}},v8=()=>wn(E8,{children:[vt(T8,{}),vt(P8,{})]}),hg=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=y8(!1),{errorCode:l,transactionHash:s,errorMessage:c}=g8(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return wn(R8,{children:[vt(T,{onClose:r}),wn(C8,{children:[vt(v8,{}),vt(w8,{children:l}),vt(b8,{children:"Please try again."}),wn(mg,{children:[vt(ug,{children:"Error message"}),vt(fg,{clickable:!1,children:c})]}),s&&wn(mg,{children:[vt(ug,{children:"Transaction hash"}),wn(_8,{children:["Copy this hash to view details about the transaction on a"," ",vt("u",{children:vt("a",{href:u,children:"block explorer"})}),"."]}),wn(fg,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,vt(k8,{clicked:i})]})]}),vt(S8,{onClick:o,children:"Retry transaction"})]}),vt(G,{})]})},C8=er.div`
2404
+ `;import{Fragment as ng,jsx as ho,jsxs as ap}from"react/jsx-runtime";var og={"google-drive":{name:"Google Drive",component:nc}},ig=()=>{let{logout:e}=F(),{navigate:t,setModalData:r,data:o}=_(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=ip(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[h,y]=ip(void 0),[v,g]=ip(u==="create-wallet"),S=og[c].name,b=og[c].component,w=o?.recoverWallet?.onCompleteNavigateTo,I=new De(async(k="create-wallet")=>(g(!0),new Promise((H,q)=>{setTimeout(async()=>{try{let j=window.open();await n(c,k,j),s(!0),H()}catch{y({message:`${k==="recover"?"Recovery":"Back up"} with ${S} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${S} account associated with your backup.`:"Something went wrong.",retryable:!0}),q()}},0)})));rg(()=>{u==="create-wallet"&&I.execute("create-wallet")},[]),rg(()=>{if(!l)return;let k=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:H=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},We);return()=>clearTimeout(k)},[l]);let A=i8(async()=>{await I.execute("recover"),w?t(w):s(!0)},[]),O=l?"Success!":h?h.message:`Verifying connection to ${S}`,R="";return h?R=h.detail:l?R=`Successfully ${u==="recover"?"recovered":"backed up"} with Google.`:R=`${u==="recover"?"Recovering":"Backing up"} with Google...`,ap(ng,{children:[ho(P,{}),v?ho(ng,{children:ap(Aa,{children:[ho(Pe,{title:O,icon:ho(b,{style:{width:"38px",height:"38px"}}),description:R}),h&&h?.retryable?ho(L,{onClick:()=>{Zo(),y(void 0),u==="create-wallet"?I.execute("create-wallet"):A()},disabled:!l&&!h?.retryable,children:"Try again"}):null]})}):ap(Aa,{children:[ho(Pe,{title:"Confirm it's really you",icon:ho(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to Google Drive where your account is
2405
+ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protectedByPrivy:!0})]})};import{useEffect as ag,useState as ka}from"react";import{jsx as a8}from"react/jsx-runtime";var sg=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=ka(""),[a,l]=ka(!1),[s,c]=ka(),[u,f]=ka(null),{authenticated:h}=F(),{closePrivyModal:y,isNewUserThisSession:v,initializeWalletProxy:g}=M(),{onSuccess:S,onFailure:b,callAuthOnSuccessOnClose:w}=r.createWallet,{createWallet:I}=dl(),[A,O]=ka(null),R=new De(async()=>{try{let q=await I(s);if(!q)return;O(q),v?t("EMBEDDED_WALLET_CREATED_SCREEN"):(S(q),y({shouldCallAuthOnSuccess:w}))}catch(q){i(q.message)}});ag(()=>{u||g(3e4).then(q=>f(q))},[u]),ag(()=>{if(!h){t("LANDING"),b(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let k=()=>{A&&A?.recoveryMethod!=="user-passcode"?(b(new bt("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):A?(S(A),y({shouldCallAuthOnSuccess:w})):(b(new bt("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let q=250;return R.execute().then(()=>new Promise(j=>setTimeout(j,q))).finally(()=>l(!1))};return a8(fl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!A&&a,error:n,password:s||"",onClose:k,onPasswordChange:c,onPasswordGenerate:()=>c(ml()),onSubmit:H})};import s8 from"@heroicons/react/24/outline/LockClosedIcon";import l8 from"@heroicons/react/24/outline/PencilSquareIcon";import c8 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as d8}from"react";import{Fragment as sp,jsx as Xt,jsxs as Ei}from"react/jsx-runtime";var p8=({onClose:e})=>Ei(tg,{children:[Xt(Pe,{title:"Why do I need to secure my account?",icon:Xt(c8,{width:48}),description:Ei(sp,{children:[Xt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),Xt("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."})]})}),Xt(L,{onClick:e,children:"Select backup method"})]}),lg=()=>{let{navigate:e,setModalData:t,data:r}=_(),{user:o}=F(),{embeddedWallets:n}=dr(),a=_e(o)===null,[l,s]=d8(!1);return Ei(sp,{children:[Xt(P,{backFn:l?()=>s(!1):void 0,infoFn:l?void 0:()=>s(!0)},"header"),l?Xt(p8,{onClose:()=>s(!1)}):Ei(sp,{children:[Xt(Pe,{title:"Secure your account",icon:Xt(s8,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),Xt(Aa,{children:n.userOwnedRecoveryOptions.map(c=>{switch(c){case"google-drive":return Ei(Ee,{onClick:async()=>{t({recoveryOAuthStatus:{provider:"google-drive",action:a?"create-wallet":"set-recovery",isInAccountCreateFlow:r?.recoverySelection?.isInAccountCreateFlow??!1}}),e("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")},children:[Xt(nc,{style:{width:18}})," Back up to Google Drive"]},c);case"user-passcode":return Ei(Ee,{onClick:()=>{e(a?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[Xt(l8,{style:{width:18}})," Set a password"]},c);default:return null}})})]}),Xt(V,{protectedByPrivy:!0})]})};import{BigNumber as gg}from"@ethersproject/bignumber";import{useMemo as vg,useEffect as Cg,useState as tr}from"react";import Pi from"styled-components";function cg(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as m8,ClipboardDocumentIcon as f8,ClipboardDocumentCheckIcon as h8}from"@heroicons/react/24/outline";import{useState as y8}from"react";import er from"styled-components";import{ErrorCode as ic}from"@ethersproject/logger";var u8=new Set([ic.CALL_EXCEPTION,ic.NONCE_EXPIRED,ic.REPLACEMENT_UNDERPRICED,ic.TRANSACTION_REPLACED]),dg=e=>{let t;return e.code&&e.code!==-32e3&&u8.has(e.code)&&(t=e.transactionHash),t},pg=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 R8,jsx as vt,jsxs as wn}from"react/jsx-runtime";var g8=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=dg(e),o=pg(e);return{errorCode:t,transactionHash:r,errorMessage:o}},v8=()=>wn(E8,{children:[vt(P8,{}),vt(T8,{})]}),hg=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=y8(!1),{errorCode:l,transactionHash:s,errorMessage:c}=g8(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return wn(R8,{children:[vt(P,{onClose:r}),wn(C8,{children:[vt(v8,{}),vt(w8,{children:l}),vt(b8,{children:"Please try again."}),wn(mg,{children:[vt(ug,{children:"Error message"}),vt(fg,{clickable:!1,children:c})]}),s&&wn(mg,{children:[vt(ug,{children:"Transaction hash"}),wn(_8,{children:["Copy this hash to view details about the transaction on a"," ",vt("u",{children:vt("a",{href:u,children:"block explorer"})}),"."]}),wn(fg,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,vt(k8,{clicked:i})]})]}),vt(S8,{onClick:o,children:"Retry transaction"})]}),vt(G,{})]})},C8=er.div`
2406
2406
  display: flex;
2407
2407
  flex-direction: column;
2408
2408
  align-items: center;
@@ -2434,12 +2434,12 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
2434
2434
  display: flex;
2435
2435
  justify-content: center;
2436
2436
  align-items: center;
2437
- `,P8=er(m8)`
2437
+ `,T8=er(m8)`
2438
2438
  position: absolute;
2439
2439
  width: 35px;
2440
2440
  height: 35px;
2441
2441
  color: var(--privy-color-error);
2442
- `,T8=er.div`
2442
+ `,P8=er.div`
2443
2443
  position: absolute;
2444
2444
  width: 60px;
2445
2445
  height: 60px;
@@ -2502,41 +2502,41 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
2502
2502
  right: 13px;
2503
2503
  width: 24px;
2504
2504
  height: 24px;
2505
- `,k8=({clicked:e})=>e?vt(A8,{}):vt(x8,{});import{BigNumber as lp}from"@ethersproject/bignumber";import I8 from"styled-components";import{Fragment as L8,jsx as Ra,jsxs as O8}from"react/jsx-runtime";var M8=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=lp.from(e.gasUsed),o=lp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=lp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},yg=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>O8(L8,{children:[Ra(T,{onClose:o}),Ra(qi,{title:l??"Transaction complete!",description:s??"You're all set."}),Ra(yi,{tokenPrice:n,from:t.from,to:t.to,gas:M8(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ra(W8,{loading:!1,onClick:o,children:"All Done"}),Ra(G,{})]}),W8=I8(L)`
2505
+ `,k8=({clicked:e})=>e?vt(A8,{}):vt(x8,{});import{BigNumber as lp}from"@ethersproject/bignumber";import I8 from"styled-components";import{Fragment as L8,jsx as Ra,jsxs as O8}from"react/jsx-runtime";var M8=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=lp.from(e.gasUsed),o=lp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=lp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},yg=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>O8(L8,{children:[Ra(P,{onClose:o}),Ra(qi,{title:l??"Transaction complete!",description:s??"You're all set."}),Ra(yi,{tokenPrice:n,from:t.from,to:t.to,gas:M8(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ra(W8,{loading:!1,onClick:o,children:"All Done"}),Ra(G,{})]}),W8=I8(L)`
2506
2506
  && {
2507
2507
  margin-top: 24px;
2508
2508
  }
2509
2509
  transition: color 350ms ease, background-color 350ms ease;
2510
- `;import{Fragment as cp,jsx as ct,jsxs as Pi}from"react/jsx-runtime";var N8=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return ct(qd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return ct(qd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return ct(cp,{children:ct(S1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},bg=()=>{let{authenticated:e,getAccessToken:t}=F(),{wallets:r}=Sa(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:f,data:h,onUserCloseViaDialogOrKeybindRef:y,setModalData:v}=_(),{transactionRequest:g,onSuccess:S,onFailure:b,uiOptions:w,fundWalletConfig:I}=h.sendTransaction,[A,O]=tr(null),[R,k]=tr(null),[H,q]=tr(""),[j,W]=tr(),[$,D]=tr(),[ue,ce]=tr(!1),de=()=>{q(""),W(void 0),D(void 0)},ve=(pt,Ut,Cr)=>{q(pt),W(new Ue(new Vt(Ut??pt,Cr??it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ee,Ct]=tr(!1),[Ke,xt]=tr(!0),[Qe,nr]=tr(null),[ke,Ve]=tr(g),{tokenPrice:ir,isTokenPriceLoading:At}=Xl(ke),He=s(g.chainId)||"ETH",[N,Ho]=tr(null),[Ce,J]=tr(null),[Q,we]=tr(!0);Cg(()=>{e||(f("LANDING"),b(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Ne=vg(()=>r.find(pt=>pt.walletClientType==="privy"),[r]),pc=async()=>{if(!Ne)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:pt,externalTransactionId:Ut}=await i(Ne.address,{config:I?.config||{}});v({fiatOnRampPrompt:{signedUrl:pt},fiatOnRampStatus:{externalTransactionId:Ut}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},En=vg(()=>to(ke.chainId,l,a,{appId:c}),[ke.chainId,a]);async function Pn(){let pt=ke;if(!await t()||!o||!Ne)return;try{pt=await wi(Ne.address,ke,En),Ve(pt)}catch(eo){console.error(eo),ve("There was an error preparing your transaction. Your transaction request will likely fail.",eo.reason)}let Cr=gg.from(0),Vo=gg.from(0);try{({totalGasEstimate:Cr,l1ExecutionFeeEstimate:Vo}=await Ci(pt,En)),Ho(Cr.toHexString()),J(Vo.toHexString())}catch{Ho(null)}try{let{balance:eo,hasSufficientFunds:Ma}=await Jl(Ne.address,pt,Cr,En);nr(eo.toHexString()),Ma||(xt(!1),ve("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ce(!0))}catch(eo){console.warn(`Failed to fetch wallet balance with error: ${eo}`)}we(!1)}Cg(()=>{Pn()},[o]);let Go=cg(ke),uc=Go==="SEND"?`Send ${He}`:"Review transaction",je={modalTitle:w.header||w.modalTitle||uc,buttonText:w.buttonText||"Submit"},yo=()=>{ee||(R?S(R):b(j||new Ue(new Vt("The user rejected the request",it.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return y.current=yo,ir===void 0&&At||Q?Pi(cp,{children:[w.transactionInfo?.contractInfo?.imgUrl&&ct(Ss,{src:w.transactionInfo?.contractInfo?.imgUrl}),ct(T,{title:je.modalTitle,onClose:yo}),ct(wg,{children:ct(Jn,{})})]}):A!==null?ct(yg,{txn:ke,onClose:yo,receipt:A,transactionInfo:w.transactionInfo,tokenPrice:ir,tokenSymbol:He,l1GasEstimate:Ce,receiptHeader:w.successHeader,receiptDescription:w.successDescription}):$?ct(hg,{transactionError:$,chainId:ke.chainId,onClose:yo,onRetry:()=>{de(),Pn()}}):Pi(cp,{children:[ct(T,{title:je.modalTitle,onClose:yo}),Pi(wg,{children:[Pi(B8,{children:[ct(N8,{txn:ke,txnFamily:Go,uiOptions:w,tokenSymbol:He,tokenPrice:ir}),Ne?ct(yi,{from:Ne.address,to:ke.to,txn:ke,transactionInfo:w.transactionInfo,gas:N||void 0,tokenPrice:ir,tokenSymbol:He}):null]}),Pi(H8,{children:[ct(D8,{children:H}),ct(b1,{txn:ke,address:Ne?.address??"",hasFunds:Ke,balance:Qe}),Pi(U8,{children:[ue&&ct(L,{onClick:pc,children:"Add Funds"}),ct(F8,{disabled:ee||!Ke,loading:!o||ee,loadingText:ee?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Ct(!0);let pt=await t();if(pt&&!ee&&Ne)try{let Ut=await Zl(pt,Ne.address,o,ke,En);k(Ut);let Cr=await Ut.wait();O(Ql(Cr)),de()}catch(Ut){console.warn({transaction:ke,error:Ut}),D(Ut),W(new Ue(new Vt(Ut.reason??"Error processing transaction",it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Ct(!1)}},children:je.buttonText})]})]})]})]})},wg=Ti.div`
2510
+ `;import{Fragment as cp,jsx as ct,jsxs as Ti}from"react/jsx-runtime";var N8=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return ct(qd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return ct(qd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return ct(cp,{children:ct(S1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},bg=()=>{let{authenticated:e,getAccessToken:t}=F(),{wallets:r}=Sa(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:f,data:h,onUserCloseViaDialogOrKeybindRef:y,setModalData:v}=_(),{transactionRequest:g,onSuccess:S,onFailure:b,uiOptions:w,fundWalletConfig:I}=h.sendTransaction,[A,O]=tr(null),[R,k]=tr(null),[H,q]=tr(""),[j,W]=tr(),[$,D]=tr(),[ue,ce]=tr(!1),de=()=>{q(""),W(void 0),D(void 0)},ve=(pt,Ut,Cr)=>{q(pt),W(new Ue(new Vt(Ut??pt,Cr??it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ee,Ct]=tr(!1),[Ke,xt]=tr(!0),[Qe,nr]=tr(null),[ke,Ve]=tr(g),{tokenPrice:ir,isTokenPriceLoading:At}=Xl(ke),He=s(g.chainId)||"ETH",[N,Ho]=tr(null),[Ce,J]=tr(null),[Q,we]=tr(!0);Cg(()=>{e||(f("LANDING"),b(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Ne=vg(()=>r.find(pt=>pt.walletClientType==="privy"),[r]),pc=async()=>{if(!Ne)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:pt,externalTransactionId:Ut}=await i(Ne.address,{config:I?.config||{}});v({fiatOnRampPrompt:{signedUrl:pt},fiatOnRampStatus:{externalTransactionId:Ut}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},En=vg(()=>to(ke.chainId,l,a,{appId:c}),[ke.chainId,a]);async function Tn(){let pt=ke;if(!await t()||!o||!Ne)return;try{pt=await wi(Ne.address,ke,En),Ve(pt)}catch(eo){console.error(eo),ve("There was an error preparing your transaction. Your transaction request will likely fail.",eo.reason)}let Cr=gg.from(0),Vo=gg.from(0);try{({totalGasEstimate:Cr,l1ExecutionFeeEstimate:Vo}=await Ci(pt,En)),Ho(Cr.toHexString()),J(Vo.toHexString())}catch{Ho(null)}try{let{balance:eo,hasSufficientFunds:Ma}=await Jl(Ne.address,pt,Cr,En);nr(eo.toHexString()),Ma||(xt(!1),ve("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ce(!0))}catch(eo){console.warn(`Failed to fetch wallet balance with error: ${eo}`)}we(!1)}Cg(()=>{Tn()},[o]);let Go=cg(ke),uc=Go==="SEND"?`Send ${He}`:"Review transaction",je={modalTitle:w.header||w.modalTitle||uc,buttonText:w.buttonText||"Submit"},yo=()=>{ee||(R?S(R):b(j||new Ue(new Vt("The user rejected the request",it.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return y.current=yo,ir===void 0&&At||Q?Ti(cp,{children:[w.transactionInfo?.contractInfo?.imgUrl&&ct(Ss,{src:w.transactionInfo?.contractInfo?.imgUrl}),ct(P,{title:je.modalTitle,onClose:yo}),ct(wg,{children:ct(Jn,{})})]}):A!==null?ct(yg,{txn:ke,onClose:yo,receipt:A,transactionInfo:w.transactionInfo,tokenPrice:ir,tokenSymbol:He,l1GasEstimate:Ce,receiptHeader:w.successHeader,receiptDescription:w.successDescription}):$?ct(hg,{transactionError:$,chainId:ke.chainId,onClose:yo,onRetry:()=>{de(),Tn()}}):Ti(cp,{children:[ct(P,{title:je.modalTitle,onClose:yo}),Ti(wg,{children:[Ti(B8,{children:[ct(N8,{txn:ke,txnFamily:Go,uiOptions:w,tokenSymbol:He,tokenPrice:ir}),Ne?ct(yi,{from:Ne.address,to:ke.to,txn:ke,transactionInfo:w.transactionInfo,gas:N||void 0,tokenPrice:ir,tokenSymbol:He}):null]}),Ti(H8,{children:[ct(D8,{children:H}),ct(b1,{txn:ke,address:Ne?.address??"",hasFunds:Ke,balance:Qe}),Ti(U8,{children:[ue&&ct(L,{onClick:pc,children:"Add Funds"}),ct(F8,{disabled:ee||!Ke,loading:!o||ee,loadingText:ee?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Ct(!0);let pt=await t();if(pt&&!ee&&Ne)try{let Ut=await Zl(pt,Ne.address,o,ke,En);k(Ut);let Cr=await Ut.wait();O(Ql(Cr)),de()}catch(Ut){console.warn({transaction:ke,error:Ut}),D(Ut),W(new Ue(new Vt(Ut.reason??"Error processing transaction",it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Ct(!1)}},children:je.buttonText})]})]})]})]})},wg=Pi.div`
2511
2511
  display: flex;
2512
2512
  flex-direction: column;
2513
2513
  justify-content: space-between;
2514
2514
  flex-grow: 1;
2515
2515
  padding-bottom: 16px;
2516
- `,D8=Ti.div`
2516
+ `,D8=Pi.div`
2517
2517
  font-size: 13px;
2518
2518
  color: var(--privy-color-error);
2519
2519
  width: 100%;
2520
2520
  margin-top: 16px;
2521
- `,U8=Ti.div`
2521
+ `,U8=Pi.div`
2522
2522
  display: flex;
2523
2523
  direction: row;
2524
2524
  justify-content: space-between;
2525
2525
  align-items: center;
2526
2526
  gap: 8px;
2527
- `,F8=Ti(L)`
2527
+ `,F8=Pi(L)`
2528
2528
  transition: color 350ms ease, background-color 350ms ease;
2529
- `,B8=Ti.div`
2529
+ `,B8=Pi.div`
2530
2530
  height: 100%;
2531
2531
  display: flex;
2532
2532
  flex-direction: column;
2533
2533
  justify-content: space-evenly;
2534
2534
  flex-grow: 1;
2535
- `,H8=Ti.div`
2535
+ `,H8=Pi.div`
2536
2536
  display: flex;
2537
2537
  flex-direction: column;
2538
2538
  gap: 8px;
2539
- `;import{isHexString as G8}from"@ethersproject/bytes";import{toUtf8String as V8}from"@ethersproject/strings";import{useEffect as Eg,useState as ac}from"react";import Do,{css as z8}from"styled-components";import{Fragment as Sg,jsx as nt,jsxs as Si}from"react/jsx-runtime";var q8=e=>{if(!G8(e))return e;try{return V8(e)}catch{return e}},$8=e=>JSON.stringify(e,null,2),K8=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?nt(Q8,{children:Object.entries(r).map(([o,n])=>Si("li",{children:[Si("strong",{children:[o,":"]})," ",t(n)]},o))}):nt("span",{children:String(r)});return nt("div",{children:t(e)})},j8=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Si(Sg,{children:[nt(Tg,{children:nt(K8,{data:o})}),nt(ko,{text:$8(e.typedData),itemName:"full payload to clipboard"})," "]})},Pg=()=>{let{authenticated:e}=F(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=ac(!0),[s,c]=ac(""),[u,f]=ac(),[h,y]=ac(null),v=h!==null;Eg(()=>{e||o("LANDING")},[e]),Eg(()=>{t(xn).then(k=>{l(!1),k||(c("An error has occurred, please try again."),f(new Ue(new Vt(s,it.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:g,data:S,confirmAndSign:b,onSuccess:w,onFailure:I,uiOptions:A}=n.signMessage,O={title:A.title||"Sign message",description:A.description||"Signing this message will not cost you any fees.",buttonText:A.buttonText||"Sign and continue"},R=k=>{k?w(k):I(u||new Ue(new Vt("The user rejected the request.",it.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),y(null),c(""),f(void 0)};return i.current=()=>{R(h)},Si(Sg,{children:[nt(T,{onClose:()=>R(h)}),nt(X,{}),Si(Y8,{children:[nt(Z8,{children:O.title}),nt(J8,{children:O.description}),g==="personal_sign"&&nt(Tg,{children:q8(S)}),g==="eth_signTypedData_v4"&&nt(j8,{typedData:S}),nt(X8,{fail:!0,children:s}),nt(tb,{success:v,loading:a,disabled:v,onClick:async()=>{try{let k=await b();y(k),c(""),setTimeout(()=>{R(k)},We)}catch{c("An error has occurred, please try again."),f(new Ue(new Vt(s,it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:v?Si(eb,{children:[nt(vl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",nt("span",{children:"Success"})]}):O.buttonText})]}),nt(re,{}),nt(V,{protectedByPrivy:!0})]})},Y8=Do.div`
2539
+ `;import{isHexString as G8}from"@ethersproject/bytes";import{toUtf8String as V8}from"@ethersproject/strings";import{useEffect as Eg,useState as ac}from"react";import Do,{css as z8}from"styled-components";import{Fragment as Sg,jsx as nt,jsxs as Si}from"react/jsx-runtime";var q8=e=>{if(!G8(e))return e;try{return V8(e)}catch{return e}},$8=e=>JSON.stringify(e,null,2),K8=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?nt(Q8,{children:Object.entries(r).map(([o,n])=>Si("li",{children:[Si("strong",{children:[o,":"]})," ",t(n)]},o))}):nt("span",{children:String(r)});return nt("div",{children:t(e)})},j8=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Si(Sg,{children:[nt(Pg,{children:nt(K8,{data:o})}),nt(ko,{text:$8(e.typedData),itemName:"full payload to clipboard"})," "]})},Tg=()=>{let{authenticated:e}=F(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=ac(!0),[s,c]=ac(""),[u,f]=ac(),[h,y]=ac(null),v=h!==null;Eg(()=>{e||o("LANDING")},[e]),Eg(()=>{t(xn).then(k=>{l(!1),k||(c("An error has occurred, please try again."),f(new Ue(new Vt(s,it.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:g,data:S,confirmAndSign:b,onSuccess:w,onFailure:I,uiOptions:A}=n.signMessage,O={title:A.title||"Sign message",description:A.description||"Signing this message will not cost you any fees.",buttonText:A.buttonText||"Sign and continue"},R=k=>{k?w(k):I(u||new Ue(new Vt("The user rejected the request.",it.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),y(null),c(""),f(void 0)};return i.current=()=>{R(h)},Si(Sg,{children:[nt(P,{onClose:()=>R(h)}),nt(X,{}),Si(Y8,{children:[nt(Z8,{children:O.title}),nt(J8,{children:O.description}),g==="personal_sign"&&nt(Pg,{children:q8(S)}),g==="eth_signTypedData_v4"&&nt(j8,{typedData:S}),nt(X8,{fail:!0,children:s}),nt(tb,{success:v,loading:a,disabled:v,onClick:async()=>{try{let k=await b();y(k),c(""),setTimeout(()=>{R(k)},We)}catch{c("An error has occurred, please try again."),f(new Ue(new Vt(s,it.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:v?Si(eb,{children:[nt(vl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",nt("span",{children:"Success"})]}):O.buttonText})]}),nt(re,{}),nt(V,{protectedByPrivy:!0})]})},Y8=Do.div`
2540
2540
  display: flex;
2541
2541
  flex-direction: column;
2542
2542
  align-items: center;
@@ -2558,7 +2558,7 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
2558
2558
  font-weight: 400;
2559
2559
  line-height: 20px; /* 142.857% */
2560
2560
  letter-spacing: -0.008px;
2561
- `,Tg=Do.div`
2561
+ `,Pg=Do.div`
2562
2562
  margin-top: 1.5rem;
2563
2563
  background-color: var(--privy-color-background-2);
2564
2564
  border-radius: var(--privy-border-radius-md);
@@ -2612,7 +2612,7 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
2612
2612
  color: #ffffff;
2613
2613
  }
2614
2614
  `}
2615
- `;import{useEffect as _g,useState as xg}from"react";import rb from"styled-components";import{Fragment as nb,jsx as Xr,jsxs as sc}from"react/jsx-runtime";var Ag=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:h,createAnalyticsEvent:y}=M(),[v,g]=xg(!1),[S,b]=xg(void 0),w=n?.render.inDialog?We:0;async function I(){try{await c(),g(!0),f(!0)}catch(R){if(R?.privyErrorCode==="allowlist_rejected"){b(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(R?.privyErrorCode==="max_accounts_reached"){console.error(new sr(R).toString()),b(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:k,detail:H}=Ac(R);b({retryable:k,detail:H,message:"Authentication failed"})}}_g(()=>{I()},[]),_g(()=>{if(!(r&&e&&v&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},w);return()=>clearTimeout(H)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},w);return()=>clearTimeout(H)}u();let k=setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),w);return()=>clearTimeout(k)},[r,e,v,o]);let A=v?"Successfully connected with Telegram":S?S.message:"Verifying connection to Telegram",O="";return v?O="You\u2019re good to go!":S?O=S.detail:O="Just a few moments more",sc(nb,{children:[Xr(T,{}),Xr(X,{}),sc(ob,{children:[Xr(rt,{children:sc("div",{children:[Xr(Xe,{success:v,fail:!!S}),Xr(Ol,{style:{width:"38px",height:"38px"}})]})}),sc(qe,{children:[Xr("h3",{children:A}),Xr("p",{children:O})]}),S&&S?.retryable?Xr(Un,{onClick:()=>{s().then(async()=>I()).catch(R=>{let{retryable:k,detail:H}=Ac(R);b({retryable:k,detail:H,message:"Authentication failed"})}),b(void 0)},disabled:!v&&!S?.retryable,children:"Retry"}):null]}),Xr(re,{}),Xr(G,{})]})},ob=rb.div`
2615
+ `;import{useEffect as _g,useState as xg}from"react";import rb from"styled-components";import{Fragment as nb,jsx as Xr,jsxs as sc}from"react/jsx-runtime";var Ag=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:h,createAnalyticsEvent:y}=M(),[v,g]=xg(!1),[S,b]=xg(void 0),w=n?.render.inDialog?We:0;async function I(){try{await c(),g(!0),f(!0)}catch(R){if(R?.privyErrorCode==="allowlist_rejected"){b(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(R?.privyErrorCode==="max_accounts_reached"){console.error(new sr(R).toString()),b(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:k,detail:H}=Ac(R);b({retryable:k,detail:H,message:"Authentication failed"})}}_g(()=>{I()},[]),_g(()=>{if(!(r&&e&&v&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},w);return()=>clearTimeout(H)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},w);return()=>clearTimeout(H)}u();let k=setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),w);return()=>clearTimeout(k)},[r,e,v,o]);let A=v?"Successfully connected with Telegram":S?S.message:"Verifying connection to Telegram",O="";return v?O="You\u2019re good to go!":S?O=S.detail:O="Just a few moments more",sc(nb,{children:[Xr(P,{}),Xr(X,{}),sc(ob,{children:[Xr(rt,{children:sc("div",{children:[Xr(Xe,{success:v,fail:!!S}),Xr(Ol,{style:{width:"38px",height:"38px"}})]})}),sc(qe,{children:[Xr("h3",{children:A}),Xr("p",{children:O})]}),S&&S?.retryable?Xr(Un,{onClick:()=>{s().then(async()=>I()).catch(R=>{let{retryable:k,detail:H}=Ac(R);b({retryable:k,detail:H,message:"Authentication failed"})}),b(void 0)},disabled:!v&&!S?.retryable,children:"Retry"}):null]}),Xr(re,{}),Xr(G,{})]})},ob=rb.div`
2616
2616
  display: flex;
2617
2617
  flex-direction: column;
2618
2618
  align-items: center;
@@ -2680,7 +2680,7 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
2680
2680
  && > input::placeholder {
2681
2681
  color: var(--privy-color-foreground-3);
2682
2682
  }
2683
- `;import{Fragment as pb,jsx as Uo,jsxs as ub}from"react/jsx-runtime";var Wg=()=>ub(pb,{children:[Uo(T,{},"header"),Uo(X,{}),Uo(Te,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Uo(db,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Uo(mr,{children:Uo(Mg,{stacked:!0})}),Uo(re,{}),Uo(V,{protectedByPrivy:!0})]});import pp from"styled-components";import{jsx as Lg}from"react/jsx-runtime";var Og=({style:e,...t})=>Lg("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:Lg("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 yb,jsx as bn,jsxs as dp}from"react/jsx-runtime";var Ng=()=>{let{navigate:e}=_();return dp(yb,{children:[bn(T,{}),dp(mb,{children:[bn(fb,{children:bn(Og,{})}),dp(hb,{children:[bn("h3",{children:"Unable to sign in"}),bn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),bn(L,{onClick:()=>{e("LANDING")},children:"Go back"})]}),bn(V,{protectedByPrivy:!0})]})},mb=pp.div`
2683
+ `;import{Fragment as pb,jsx as Uo,jsxs as ub}from"react/jsx-runtime";var Wg=()=>ub(pb,{children:[Uo(P,{},"header"),Uo(X,{}),Uo(Pe,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Uo(db,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Uo(mr,{children:Uo(Mg,{stacked:!0})}),Uo(re,{}),Uo(V,{protectedByPrivy:!0})]});import pp from"styled-components";import{jsx as Lg}from"react/jsx-runtime";var Og=({style:e,...t})=>Lg("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:Lg("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 yb,jsx as bn,jsxs as dp}from"react/jsx-runtime";var Ng=()=>{let{navigate:e}=_();return dp(yb,{children:[bn(P,{}),dp(mb,{children:[bn(fb,{children:bn(Og,{})}),dp(hb,{children:[bn("h3",{children:"Unable to sign in"}),bn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),bn(L,{onClick:()=>{e("LANDING")},children:"Go back"})]}),bn(V,{protectedByPrivy:!0})]})},mb=pp.div`
2684
2684
  display: flex;
2685
2685
  flex-direction: column;
2686
2686
  align-items: center;
@@ -3027,4 +3027,4 @@ backed up.`}),ho(L,{onClick:A,children:"Confirm with Google"})]}),ho(V,{protecte
3027
3027
  opacity: 1;
3028
3028
  }
3029
3029
  }
3030
- `;import{jsx as dt,jsxs as Hg}from"react/jsx-runtime";var Tb={["LANDING"]:wy,["CONNECT_OR_CREATE"]:vy,["AWAITING_PASSWORDLESS_CODE"]:ef,["AWAITING_CONNECTION"]:Pf,["AWAITING_CONNECT_ONLY_CONNECTION"]:xf,["AWAITING_FARCASTER_CONNECTION"]:Mh,["AWAITING_FARCASTER_SIGNER"]:Uh,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:K1,["PHANTOM_INTERSTITIAL_SCREEN"]:J1,["LOGIN_FAILED_SCREEN"]:Ly,["AWAITING_OAUTH_SCREEN"]:z1,["ALLOWLIST_REJECTION_SCREEN"]:zm,["USER_LIMIT_REACHED_SCREEN"]:Ng,["INSTALL_PHANTOM_SCREEN"]:Qh,["LINK_EMAIL_SCREEN"]:by,["LINK_PHONE_SCREEN"]:ky,["LINK_WALLET_SCREEN"]:Ry,["LINK_PASSKEY_SCREEN"]:xy,["UPDATE_EMAIL_SCREEN"]:Wg,["CONNECT_ONLY_LANDING_SCREEN"]:vf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:hf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:zf,["EMBEDDED_WALLET_CREATED_SCREEN"]:Df,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Of,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:Q1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:lg,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:ig,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Hf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Pg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:bg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:zh,["FIAT_ON_RAMP_STATUS_SCREEN"]:$h,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:yh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:hh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:sg,["MFA_ENROLLMENT_FLOW_SCREEN"]:Jy,["CAPTCHA_SCREEN"]:nf,["ERROR_SCREEN"]:vh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Kh,["AFFIRMATIVE_CONSENT_SCREEN"]:Hm,["TELEGRAM_AUTH_SCREEN"]:Ag},Sb=["LANDING","AWAITING_CONNECTION"],_b=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=F(),{headless:n}=dr(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=fe(),f=bb(null),h=Rm(f),y=o&&a&&Sb.includes(a)&&!n&&l==="ready";if(Bg(()=>{y&&s()},[y]),Bg(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Hg(ui,{id:"privy-modal-content",children:[dt(T,{}),dt(X,{}),dt(Gy,{children:dt(et,{})}),dt(re,{}),dt(G,{})]});if(!a&&e)return dt(ui,{style:{height:h},id:"privy-modal-conent",children:dt("div",{ref:f,children:dt(op,{open:e,onClose:t})})});if(!a)return null;let v=Tb[a];return dt(ui,{style:{height:h},id:"privy-modal-content",children:Hg("div",{ref:f,children:[dt(Sr,{if:!!e,children:dt(v,{})}),dt(Sr,{if:!e,children:dt(op,{open:e,onClose:t})})]})})},xb=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:wb(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Gg=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=xb(),[o,n]=Eb(!1);Fc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=dt(Fg,{children:dt(_b,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?dt(Hy,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Pb.createPortal(l,s)}return l};import{useRef as Vg,useEffect as Ab}from"react";import{jsx as Rb}from"react/jsx-runtime";function kb({botUsername:e}){let t=document.createElement("script");return t.async=!0,t.src="https://telegram.org/js/telegram-widget.js?22",t.setAttribute("data-telegram-login",e),t.setAttribute("data-request-access","write"),t.setAttribute("data-lang","en"),t}function zg(e){let t=Vg(null),r=Vg();return Ab(()=>{r.current?.remove(),r.current=kb(e),t.current?.after(r.current)},[e]),Rb("div",{ref:t,hidden:!0})}import{useState as Ib}from"react";import{useEffect as qg,useRef as $g}from"react";var lc=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:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Fo(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Be("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((h,y)=>{r.current={resolve:h,reject:y};let v=1e3*60*5;setTimeout(()=>{let g=new Be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),y(g)},v)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),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 u=new Be("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as Db}from"react/jsx-runtime";var Mb=function(e){return()=>`id-${e++}`}(0);function Wb(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function rr(e){return e.error!==void 0}var Dt=new lc,up=new Map,Lb=(e,t)=>typeof t=="bigint"?t.toString():t,Ob=(e,t)=>`${e}${JSON.stringify(t,Lb)}`;function or(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=Ob(e,t);if(e==="privy:wallet:create"){let l=up.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=Mb();Dt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{up.delete(i)});return up.set(i,a),a}function Nb(e){switch(e.event){case"privy:iframe:ready":let t=Dt.dequeue(e.event,e.id);return rr(e)?t.reject(new Be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Dt.dequeue(e.event,e.id);return rr(e)?r.reject(new Be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Dt.dequeue(e.event,e.id);return rr(e)?o.reject(new Be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Dt.dequeue(e.event,e.id);return rr(e)?n.reject(new Be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Dt.dequeue(e.event,e.id);return rr(e)?i.reject(new Be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Dt.dequeue(e.event,e.id);return rr(e)?a.reject(new Be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Dt.dequeue(e.event,e.id);return rr(e)?l.reject(new Be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Kg(e){let t=$g(null),r=$g(e.mfaMethods),o=Gs(),[n,i]=Ib(!1);return qg(()=>{r.current=e.mfaMethods},[e.mfaMethods]),qg(()=>{if(!n)return;let a=t.current;if(!a)return;function l(h){h&&h.origin===e.origin&&Wb(h.data)&&Nb(h.data)}let s={create(h){return or("privy:wallet:create",h,a,e.origin)},connect(h){return or("privy:wallet:connect",h,a,e.origin)},recover(h){return Fo(y=>or("privy:wallet:recover",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return Fo(y=>or("privy:wallet:rpc",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return Fo(y=>or("privy:wallet:set-recovery-password",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Fo(y=>or("privy:mfa:verify",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Fo(y=>or("privy:mfa:init-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return Fo(y=>or("privy:mfa:submit-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return Fo(y=>or("privy:mfa:unenroll",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return or("privy:mfa:clear",h,a,e.origin)},initFarcasterSigner(h){return or("privy:farcaster:init-signer",h,a,e.origin)},signFarcasterMessage(h){return or("privy:farcaster:sign",h,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},f=new AbortController;return au(()=>or("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),Db("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:za(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function cc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function jg({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var Yg=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 vr,jsxs as Zg}from"react/jsx-runtime";var Bo;function Bb(e){return typeof e=="string"&&e.length===25}function xe(){if(!Bo){let e=Z.get(qo);return Promise.resolve(e||null)}return Bo.getAccessToken()}var Jg,Uu=(e,t)=>Jg(e,t),Qg,Fu=(e,t)=>Qg(e,t),Xg,Bu=(e,t)=>Xg(e,t),e2,Hu=()=>e2(),Hb=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(ki,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},Gb=({config:e,...t})=>{if(!Bb(t.appId))throw new E("Cannot initialize the Privy provider with an invalid Privy app ID");Bo||(Bo=new Hi({appId:t.appId,apiUrl:t.apiUrl||Za}));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."),vr(vm,{client:Bo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:vr(Vb,{...t,client:Bo})})},Vb=e=>{let t=e.client,[r,o]=$e(!1),[n,i]=$e(!1),[a,l]=$e(!1),[s,c]=$e(null),[u,f]=$e([]),h=_i(u),[y,v]=$e(!1),[g,S]=$e(null),[b,w]=$e(!1),[I,A]=$e({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:P}),[O,R]=$e({status:"initial"}),[k,H]=$e(null),[q,j]=$e(null),[W,$]=$e(null),D=dr(),ue=Us(),[ce,de]=$e(!0),[ve,ee]=$e({}),[Ct,Ke]=$e(null),[xt,Qe]=$e(null),[nr,ke]=$e(!1),[Ve,ir]=$e(!1),At=_i(null),He=_i(null),N=_i(Im),[Ho,Ce]=$e(!1);t.onStoreToken=d=>{d&&U(N,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(N,"accessToken","onAccessTokenRemoved")};let J=_i(null),Q=_i(null),we=d=>{S(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},Ne=d=>{D.embeddedWallets.createOnLogin!=="off"&&de(!0),we(d)};Or(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Or(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!W){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(W,d.address,D.defaultChain,e.appId)},[W,s]),Or(()=>{W&&xt?.(W)},[W]),Or(()=>{(async()=>{if(!D.customAuth?.enabled)return;de(!0);let{getCustomAccessToken:p,isLoading:m}=D.customAuth;if(!(!n||m))try{let C=await p();if(!C&&a){await Tn.logout();return}if(!C||a)return;t.startAuthFlow(new Sn(C));let{user:x,isNewUser:B}=await t.authenticate();if(!x){await Tn.logout();return}c(x||null),v(B||!1),l(!0),ir(!0)}catch(C){console.warn(C),a&&await Tn.logout()}})()},[D.customAuth?.enabled,D.customAuth?.getCustomAccessToken,D.customAuth?.isLoading,n,a]),Or(()=>{Ve&&W&&s&&kt(s,D.embeddedWallets.createOnLogin)&&(ir(!1),Ma(s,xn).catch(console.error))},[Ve&&W&&s]),Or(()=>{async function d(){let p=pc();Hb();let m=Ub();H(m),t.initializeConnectorManager({walletConnectCloudProjectId:D.walletConnectCloudProjectId,rpcConfig:D.rpcConfig,chains:D.chains,defaultChain:D.defaultChain,store:m,walletList:D.appearance.walletList,shouldEnforceDefaultChainOnConnect:D.shouldEnforceDefaultChainOnConnect,appName:D.name??"Privy"});let C;t.connectors?.on("connectorInitialized",()=>{C&&clearTimeout(C);let B=t.connectors.walletConnectors.length,Y=t.connectors.walletConnectors.reduce((ze,Ye)=>ze+(Ye.initialized?1:0),0);Y===B?Ce(!0):C=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:Y,expected:B}),Ce(!0)},1500)}),t.connectors?.initialize().then(()=>{uc()});let x=await t.getAuthenticatedUser();D.customAuth?.enabled||(l(!!x),x&&U(N,"login","onComplete",x,!1,!0,null,null),c(x)),p||me.setReadyToTrue(!!x),p&&(x?Q.current="link":Q.current="login")}!n&&ue&&d()},[t,Ct,n,ue]),Or(()=>{if(!n)return;if(!s){ke(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){ke(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");ke(p)},[n,s,u]);let pc=()=>{let d=Li();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}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Dr(d)),Ne("AWAITING_OAUTH_SCREEN"),!0)},En=async(d,p,m,C)=>{let x=await t.connectors?.createWalletConnector(d,p)||null;Pn(x,p,m,C)};async function Pn(d,p,m,C){if(d)A({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:P});else return A({status:"disconnected",connectedWallet:null,connectError:new te("Unable to connect to wallet."),connector:null,connectRetry:P}),C?.(null,m);d instanceof Hr&&p&&await d.resetConnection(p),A({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Pn(d,p,m,C)});try{let x=await d.connect({showPrompt:!0});if(D.shouldEnforceDefaultChainOnConnect&&!D.chains.find(B=>B.id===Number(x?.chainId))&&!(x?.connectorType==="wallet_connect_v2"&&x?.walletClientType==="metamask")){A(B=>({...B,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:P}));try{await x?.switchChain(D.defaultChain.id),x&&(x.chainId=_n(zo(D.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${D.defaultChain.id}`)}}return A(B=>({...B,status:"connected",connectedWallet:x,connectError:null,connectRetry:P})),x&&!Q.current&&U(N,"connectWallet","onSuccess",x),C?.(x,m)}catch(x){return x instanceof Ge?(console.warn(x.cause?x.cause:x.message),Q.current||U(N,"connectWallet","onError",x.privyErrorCode||"generic_connect_wallet_error")):(console.warn(x),Q.current||U(N,"connectWallet","onError","unknown_connect_wallet_error")),A(B=>({...B,status:"disconnected",connectedWallet:null,connectError:x})),C?.(null,m)}}let Go=async(d,p)=>{if(d===null)return;let m=new Qo(d,p);t.startAuthFlow(m)},uc=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!vo()&&Ne("LOGIN_FAILED_SCREEN"),!t.connectors)throw new E("Connector not initialized");we("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),En(p,m,void 0,Go)};Or(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let je=()=>{if(!a)throw U(N,"linkAccount","onError","must_be_authenticated"),new E("User must be authenticated before linking an account.")},yo=()=>{je(),J.current="siwe",Q.current="link",we("LINK_WALLET_SCREEN")},pt=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},Ut=async d=>{if(!t.connectors)throw new E("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(A(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:P})),D.captchaEnabled&&!a){let m={callback:C=>Go(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),Ne("CAPTCHA_SCREEN")}else await Go(d),Ne("AWAITING_CONNECTION")},Cr=async(d,p)=>{if(!D.fiatOnRamp.enabled)throw new E("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:C}=await Gh(t,d,p?.config??{},D.appearance.palette,D.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:C}}else throw new E("Unsupported fund provider. Currently supported option is `moonpay`.")},Vo=()=>{f(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:pt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new E("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new E("Cannot link or login with embedded wallet");Ut(m)},fund:async C=>{let{signedUrl:x,externalTransactionId:B}=await Cr(m.address,C);ee({fiatOnRampPrompt:{signedUrl:x},fiatOnRampStatus:{externalTransactionId:B}}),we("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new E("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new E("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(m.address);c(C)}}))||[];return gs(d,p)?d:p})};Or(()=>{Vo()},[s?.linkedAccounts,a,n]),Or(()=>{if(n){if(!t.connectors)throw new E("Connector not initialized");Vo(),t.connectors.on("walletsUpdated",Vo)}},[n]);let eo=()=>{we(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let d=u[0],p=h.current.find(C=>C.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&m){let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(C)}h.current=u},[u]);let Ma=async(d,p)=>{if(_e(d))throw U(N,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,x]=await Promise.all([me.initializeWalletProxy(p),xe()]);if(!C&&D.customAuth?.enabled)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!x||D.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((B,Y)=>{de(!0),ee({createWallet:{onSuccess:Ye=>{U(N,"createWallet","onSuccess",Ye),B(Ye)},onFailure:Ye=>{U(N,"createWallet","onError","unknown_embedded_wallet_error"),Y(Ye)},callAuthOnSuccessOnClose:!1}}),we("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:x});let B=await me.refreshUser(),Y=_e(B);if(!Y)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(N,"createWallet","onSuccess",Y),Y}},n2=d=>{if(!D.chains.map(p=>p.id).includes(d))throw new te(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},fp=(d,p,m)=>new Promise(async(C,x)=>{if(!a||!s){U(N,"sendTransaction","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=_e(s);if(!B){U(N,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}de(!0);let Y=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ze=d.chainId?Number(d.chainId):Y.chainId;n2(ze);let Ye=Object.assign({},d,{chainId:ze}),ar=async()=>{let Re=await xe();if(!Re||!W){U(N,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await me.recoverEmbeddedWallet()){U(N,"sendTransaction","onError","unknown_connect_wallet_error"),x(new Error("Unable to connect to wallet"));return}let wt=to(Ye.chainId,D.chains,D.rpcConfig,{appId:e.appId}),mc=await wi(B.address,Ye,wt);if(D.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:a2}=await Ci(mc,wt),{hasSufficientFunds:s2}=await Jl(B.address,mc,a2,wt);if(!s2)throw new Ue(new Vt("Wallet has insufficient funds for this transaction.",it.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let yp=await Zl(Re,B.address,W,mc,wt);U(N,"sendTransaction","onSuccess",yp),C(yp)}catch(Bt){U(N,"sendTransaction","onError","transaction_failure"),x(Bt)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),ar();else{let Re={transactionRequest:Ye,onSuccess:wt=>{U(N,"sendTransaction","onSuccess",wt),C(wt)},onFailure:wt=>{U(N,"sendTransaction","onError","transaction_failure"),x(wt)},uiOptions:p||{},fundWalletConfig:m},Bt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wt=>{U(N,"sendTransaction","onError","unknown_connect_wallet_error"),x(wt)}};ee({connectWallet:Bt,sendTransaction:Re}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function hp(){return new Promise(async(d,p)=>{let m=await xe();if(!m||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:m}),d()}catch(C){p(C)}})}let Ft=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)},Tn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:eo,linkWallet:yo,linkEmail:()=>{je(),Ft("email"),J.current="email",Q.current="link",we("LINK_EMAIL_SCREEN")},linkPhone:()=>{je(),Ft("phone"),J.current="sms",Q.current="link",we("LINK_PHONE_SCREEN")},linkGoogle:async()=>{je(),Ft("google"),Q.current="link",await me.initLoginWithOAuth("google")},linkTwitter:async()=>{je(),Ft("twitter"),Q.current="link",await me.initLoginWithOAuth("twitter")},linkDiscord:async()=>{je(),Ft("discord"),Q.current="link",await me.initLoginWithOAuth("discord")},linkGithub:async()=>{je(),Ft("github"),Q.current="link",await me.initLoginWithOAuth("github")},linkSpotify:async()=>{je(),Ft("spotify"),Q.current="link",await me.initLoginWithOAuth("spotify")},linkInstagram:async()=>{je(),Ft("instagram"),Q.current="link",await me.initLoginWithOAuth("instagram")},linkTiktok:async()=>{je(),Ft("tiktok"),Q.current="link",await me.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{je(),Ft("linkedin"),Q.current="link",await me.initLoginWithOAuth("linkedin")},linkApple:async()=>{je(),Ft("apple"),Q.current="link",await me.initLoginWithOAuth("apple")},linkPasskey:async()=>{je(),Ft("passkey"),await me.initLinkWithPasskey(),we("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{je(),Ft("farcaster"),await me.initLoginWithFarcaster(),Q.current="link",J.current="farcaster",we("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(je(),!s?.email)throw new E("User does not have an email linked to their account.");Q.current="link",J.current="email",we("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{Ke(C=>m.bind(C))});if(Ke(null),p){console.warn(d);return}}if(a){console.warn(d);return}Q.current="login",Ne("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Ke(()=>d)}),Ke(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Ne("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&W)try{await W.clearMfa({userId:s.id})}catch{}c(null),l(!1),S(null),U(N,"logout","onSuccess"),Q.current=null,J.current=null,o(!1),Z.del(Ri)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Le;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new Le:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new mp(new Ur(new Le));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new mp(new Ur(new Le)):new mp(new Ur(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new bo(new Le);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new bo(new Le):new bo(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},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(C=>dc(C.address)===dc(d)),m=s?.linkedAccounts.find(C=>C.type==="wallet"&&dc(C.address)===dc(d));if(!p||!await p.isConnected())j(d),yo();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(N,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ma(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw U(N,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=_e(s);if(!d||!W)throw U(N,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw U(N,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await hp()}catch(p){throw U(N,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,m)=>{de(!0);let C={onSuccess:B=>{U(N,"setWalletPassword","onSuccess",B),p(B)},onFailure:B=>{U(N,"setWalletPassword","onError","user_exited_set_password_flow"),m(B)},callAuthOnSuccessOnClose:!1},x={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:B=>{U(N,"setWalletPassword","onError","unknown_connect_wallet_error"),m(B)}};ee({setWalletPassword:C,connectWallet:x}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,C)=>{if(!a||!s){U(N,"signMessage","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=_e(s);if(!x){U(N,"signMessage","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(N,"signMessage","onError","invalid_message"),C(new Error("Message must be a non-empty string"));return}de(!0);let B=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Y=await xe();if(!W||!Y)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:x.address}});let{response:Ye}=await W.rpc({accessToken:Y,address:x.address,request:{method:"personal_sign",params:[d,x.address]}}),ar=Ye.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:x.address}}),ar};if(D.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Y=await B();U(N,"signMessage","onSuccess",Y),m(Y)}catch(Y){U(N,"signMessage","onError","unable_to_sign"),C(Y??new Ue("Unable to sign message"))}}else{let Ye={method:"personal_sign",data:d,confirmAndSign:B,onSuccess:Re=>{U(N,"signMessage","onSuccess",Re),m(Re)},onFailure:Re=>{U(N,"signMessage","onError","unable_to_sign"),C(Re)},uiOptions:p||{}},ar={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Re=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),C(Re)}};ee({signMessage:Ye,connectWallet:ar}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,C)=>{if(!a||!s){U(N,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=_e(s);if(!x){U(N,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}de(!0);let B=$a(d),Y=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ze=await xe();if(!W||!ze)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:x.address}});let{response:ar}=await W.rpc({accessToken:ze,address:x.address,request:{method:"eth_signTypedData_v4",params:[x.address,B]}}),Re=ar.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:x.address}}),Re};if(D.embeddedWallets.noPromptOnSignature||(D.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ze=await Y();U(N,"signTypedData","onSuccess",ze),m(ze)}catch(ze){U(N,"signTypedData","onError","unable_to_sign"),C(ze??new Ue("Unable to sign message"))}}else{let ar={method:"eth_signTypedData_v4",data:B,confirmAndSign:Y,onSuccess:Bt=>{U(N,"signTypedData","onSuccess",Bt),m(Bt)},onFailure:Bt=>{U(N,"signTypedData","onError","unable_to_sign"),C(Bt)},uiOptions:p||{}},Re={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Bt=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),C(Bt)}};ee({signMessage:ar,connectWallet:Re}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let x=await(await fp(d,p,m)).wait();return Ql(x)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!_e(s)){p(new Error("Must have a Privy wallet before exporting"));return}de(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ee(ve),!await xe()||!W){p(new Error("Must have valid access token to enroll in MFA"));return}if(!W){p(new Error("Must have a Privy wallet before exporting"));return}let B={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:B,connectWallet:C}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:hp,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 E("Invalid MFA code");At.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((B,Y)=>{He.current={resolve:B,reject:Y}});break;case"passkey":if(typeof p=="string")throw new E("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),x=Yg(C);At.current?.resolve({mfaMethod:d,mfaCode:x,relyingParty:window.origin}),await new Promise((B,Y)=>{He.current={resolve:B,reject:Y}});break;default:throw At.current?.reject(new E("Unsupported MFA method")),new E(`Unsupported MFA method: ${d}`)}},cancel(){At.current?.reject(new E("MFA canceled"))},async initEnrollmentWithSms(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){me.closePrivyModal(),p();return}D.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:D.mfa.methods,onSuccess:p,onFailure:m}}),we("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await xe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await xe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}ee({farcasterSigner:C}),we("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await xe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())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(x=>Uint8Array.from(x.match(/.{1,2}/g).map(B=>parseInt(B,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await xe(),m=s?.linkedAccounts.find(Y=>Y.type==="wallet"&&Y.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 me.recoverEmbeddedWallet())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 x=await import("@simplewebauthn/browser"),B=await W.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:x.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(x.base64URLStringToBuffer(B.signature))},isHeadlessOAuthLoading:b,loginWithCode(d){return me.loginWithCode(d)},initLoginWithEmail(d){return me.initLoginWithEmail(d)},initLoginWithSms(d){return me.initLoginWithSms(d)},otpState:O,fundWallet(d,p){return me.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return me.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return me.loginWithHeadlessOAuth(d)},isModalOpen:r};Jg=Tn.signMessage,Qg=Tn.signTypedData,Xg=async(...d)=>{let p=await fp(...d);return D.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let me=(()=>({isNewUserThisSession:y,linkingHint:q,pendingTransaction:null,walletConnectionStatus:I,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:D.rpcConfig,chains:D.chains,appId:e.appId,showFiatPrices:D.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>D.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(W)return W;let p=new Promise(x=>{Qe(()=>B=>x(B))}),m=new Promise(x=>setTimeout(()=>x(null),d)),C=await Promise.race([p,m]);return Qe(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,m;p&&J.current&&(m=s?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,x)=>x.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),Q.current==="login"&&J.current?d.shouldCallAuthOnSuccess&&p?(U(N,"login","onComplete",s,y,!1,J.current,m??null),e.onSuccess?.(s,y)):U(N,"login","onError","exited_auth_flow"):Q.current==="link"&&J.current&&m&&(d.isSuccess&&p?U(N,"linkAccount","onSuccess",s,J.current,m):U(N,"linkAccount","onError","exited_link_flow")),j(null),Q.current=null,J.current=null,v(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:we,connectWallet:Pn,initLoginWithWallet:async(d,p)=>{J.current="siwe",Go(d,p)},loginWithWallet:async()=>{if(!n)throw new Nr;if(!(t.authFlow instanceof Qo))throw new E("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),J.current="siwe"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),v(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Ai(d);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Nr;if(!(t.authFlow instanceof Ai))throw new E("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),J.current="farcaster"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),v(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(J.current=d,gc()){if(d==="google"&&cc(window.navigator.userAgent)){Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Z.del(jo);let m=new Dr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},async initLoginWithTelegram(d){if(!n)throw new Nr;J.current="telegram";let p=new Oi(d);t.startAuthFlow(p),t.authFlow.meta.telegramAuthResult=await new Promise((m,C)=>{if(!D.loginConfig.telegramAuthConfiguration)return C("Telegram Auth configuration is not loaded");if(!window.Telegram)return C("Telegram was not initialized");window.Telegram.Login.auth({bot_id:D.loginConfig.telegramAuthConfiguration.botId,request_access:!0},x=>x?m(x):C("Telegram auth failed or was canceled by the client"))})},async loginWithTelegram(){if(!n)throw new Nr;if(!(t.authFlow instanceof Oi))throw new E("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{d=await t.link(),J.current="telegram"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,J.current="telegram"}catch(m){throw Q.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),v(p||!1),l(!0)},async recoveryOAuthFlow(d,p,m){let{url:C,codeVerifier:x,stateCode:B}=await If({api:Bo.api,provider:d});if(!C)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new E("Recovery OAuth failed");let Y,ze;try{let Re=await jg({url:C,popup:m});if(Y=Re.stateCode,ze=Re.authorizationCode,Y!==B)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:B??"",returnedStateCode:Y??""}}),new E("Unexpected auth flow. This may be a phishing attempt.")}catch(Re){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Re.toString(),provider:d}}),new E("Recovery OAuth failed")}let[Ye,ar]=await Promise.all([xe(),Mf({api:Bo.api,provider:d,codeVerifier:x,stateCode:Y,authorizationCode:ze})]);if(!W)throw new E("Cannot connect to wallet proxy");switch(p){case"recover":let Re=ve.recoverWallet?.privyWallet?.address;if(!Re)throw new E("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:Re,recoveryMethod:d}}),await W.recover({address:Re,accessToken:Ye,recoveryAccessToken:ar,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:Re,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:Ye,recoveryAccessToken:ar,recoveryMethod:d});let Bt=await me.refreshUser(),wt=_e(Bt);if(!wt)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:wt.address}}),U(N,"createWallet","onSuccess",wt);break;default:throw new E("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Dr))throw new E("Must initialize OAuth flow before calling loginWithOAuth");let p=Z.get($o),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new E("Unexpected auth flow. This may be a phishing attempt.");let C,x,B;if(a)try{C=await t.link(),J.current=d}catch(Y){throw U(N,"linkAccount","onError",Y.privyErrorCode||"failed_to_link_account"),Y}else try{let Y=await t.authenticate();C=Y.user,x=Y.isNewUser,B=Y.oAuthProviderTokens,J.current=d}catch(Y){throw Q.current==="login"?U(N,"login","onError",Y.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",Y.privyErrorCode||"failed_to_link_account"),Y}return c(C),v(x||!1),l(!0),B},async initLoginWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),Q.current="login";try{J.current="passkey",await p.initAuthenticationFlow()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new Nr;if(!(t.authFlow instanceof Jo))throw new E("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d,p;try{J.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),v(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),Q.current="link",J.current="passkey";try{await p.initLinkFlow()}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new Nr;if(!(t.authFlow instanceof Jo))throw new E("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d;try{J.current="passkey",d=await t.link()}catch(p){throw U(N,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(gc()){if(d==="google"&&cc(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 m=new Dr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let C=await t.startAuthFlow(m).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){w(!0),t.startAuthFlow(new Dr(d));let p=Z.get($o),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),w(!1),new E("Unexpected auth flow. This may be a phishing attempt.");let C,x;if(a)try{C=await t.link(),J.current=d.provider}catch(B){throw U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:C,isNewUser:x}=await t.authenticate()),J.current=d.provider}catch(B){throw Q.current==="login"?U(N,"login","onError",B.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return c(C),v(x||!1),l(!0),w(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let m=new go(d,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(C){throw Q.current==="login"?U(N,"login","onError",C.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,m)=>{let C=new Ba(d,p,m);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{R({status:"sending-code"});let m=new Xo(d,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(C){throw R({status:"error",error:C}),Q.current==="login"?U(N,"login","onError",C.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(R({status:"submitting-code"}),!n){let x=new Nr;throw R({status:"error",error:x}),x}if(t.authFlow instanceof go)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Xo)t.authFlow.meta.smsCode=d.trim();else{let x=new E("Must initialize a passwordless code flow first");throw R({status:"error",error:x}),x}let p=await xe(),m,C;if(p&&t.sessionHasActiveToken())try{m=await t.link()}catch(x){throw R({status:"error",error:x}),U(N,"linkAccount","onError",x.privyErrorCode||"failed_to_link_account"),x}else try{({user:m,isNewUser:C}=await t.authenticate())}catch(x){throw R({status:"error",error:x}),U(N,"login","onError",x.privyErrorCode||"unknown_auth_error"),x}c(m||s||null),v(C||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:W,createAnalyticsEvent:({eventName:d,payload:p,timestamp:m})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:m}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy"),C=await xe();if(!C||!W||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}de(!0);try{await W.connect({accessToken:C,address:m.address}),d(!0)}catch(x){if(Xn(x)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await W.recover({address:m.address,accessToken:C})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if(Xn(x)){ee({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let B=cl(m.recoveryMethod);we(B)}else p(x)}}),getFiatOnRampConfig:Cr,setReadyToTrue:d=>{i(!0),Ct?.(d)},updateWallets:()=>Vo(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:C}=await Cr(d,p);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:C}}),we("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await xe(),m=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 x=await t.getAuthenticatedUser();c(x||s||null)}return C}}))();e2=me.recoverEmbeddedWallet;let i2=Fb(()=>({wallets:u,ready:nr&&Ho}),[u,nr,Ho]);return vr(ye.Provider,{value:Tn,children:vr(Uc.Provider,{value:N,children:vr(tp.Provider,{value:i2,children:Zg(Am,{...D,children:[e.children,Zg(Dc.Provider,{value:me,children:[!D.headless&&D.captchaEnabled&&n&&!a&&vr(Nc,{delayedExecution:!1}),vr(Ug,{theme:{...D.appearance.palette||{}}}),vr(wm,{data:ve,setModalData:ee,setInitialScreen:S,initialScreen:g,authenticated:a,open:r,children:vr(Gg,{open:r})}),ce&&ue?vr(Kg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:At,mfaSubmitPromise:He,onLoad:$,onLoadFailed:()=>null}):null,D.loginMethods.telegram&&D.loginConfig.telegramAuthConfiguration&&vr(Sr,{if:!0,children:vr(zg,{botUsername:D.loginConfig.telegramAuthConfiguration.botName})})]})]})})})})};import{useContext as zb}from"react";function qb(e){let{login:t}=zb(ye);return Fe("login",e),{login:t}}import{useContext as $b}from"react";function Kb(e){let{logout:t}=$b(ye);return Fe("logout",e),{logout:t}}import{useCallback as t2,useEffect as jb}from"react";function Yb(){let e=fe(),t=Us(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=F(),l=t2(async c=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=t2(async()=>{let c=Li();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(u){throw u}finally{Zo()}},[o]);return jb(()=>{let c=Li();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as r2}from"react";var Zb=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=F(),o=r2(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=r2(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Er(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as o2}from"react";var Jb=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=F(),n=o2(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=o2(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as Qb}from"react";function Xb(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkFarcaster:y}=Qb(ye);return Fe("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkFarcaster:y}}import{useContext as eE}from"react";function tE(e){let{connectWallet:t}=eE(ye);return Fe("connectWallet",e),{connectWallet:t}}import{useContext as rE}from"react";function oE(e){let{createWallet:t}=rE(ye);return Fe("createWallet",e),{createWallet:t}}var nE=()=>{let{fundWallet:e}=F();return{fundWallet:e}};import{useContext as iE}from"react";function aE(e){let{sendTransaction:t}=iE(ye);return Fe("sendTransaction",e),{sendTransaction:t}}import{useContext as sE}from"react";function lE(e){let{setWalletPassword:t}=sE(ye);return Fe("setWalletPassword",e),{setWalletPassword:t}}import{useContext as cE}from"react";function dE(e){let{signMessage:t}=cE(ye);return Fe("signMessage",e),{signMessage:t}}import{useContext as pE}from"react";function uE(e){let{signTypedData:t}=pE(ye);return Fe("signTypedData",e),{signTypedData:t}}import{useContext as mE}from"react";var fE=()=>{let{isModalOpen:e}=mE(ye);return{isOpen:e}};import{useContext as hE}from"react";function yE(e){let{getAccessToken:t}=hE(ye);return Fe("accessToken",e),{getAccessToken:t}}function gE(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function vE(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Ur as AsExternalProvider,Nc as Captcha,Bi as ConnectorManager,Hi as PrivyClient,Gb as PrivyProvider,Le as PrivyProxyProvider,Ui as SUPPORTED_CHAINS,wc as VERSION,Rt as WalletConnector,vE as addRpcUrlOverrideToChain,ad as errorIndicatesMaxMfaRetries,cn as errorIndicatesMfaTimeout,dn as errorIndicatesMfaVerificationFailed,xe as getAccessToken,tE as useConnectWallet,oE as useCreateWallet,gE as useExperimentalFarcasterSigner,nE as useFundWallet,Xb as useLinkAccount,qb as useLogin,Zb as useLoginWithEmail,Yb as useLoginWithOAuth,Jb as useLoginWithSms,Kb as useLogout,fa as useMfa,Mr as useMfaEnrollment,fE as useModalStatus,F as usePrivy,Fc as useRegisterMfaListener,aE as useSendTransaction,lE as useSetWalletPassword,dE as useSignMessage,uE as useSignTypedData,yE as useToken,Sa as useWallets};
3030
+ `;import{jsx as dt,jsxs as Hg}from"react/jsx-runtime";var Pb={["LANDING"]:wy,["CONNECT_OR_CREATE"]:vy,["AWAITING_PASSWORDLESS_CODE"]:ef,["AWAITING_CONNECTION"]:Tf,["AWAITING_CONNECT_ONLY_CONNECTION"]:xf,["AWAITING_FARCASTER_CONNECTION"]:Mh,["AWAITING_FARCASTER_SIGNER"]:Uh,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:K1,["PHANTOM_INTERSTITIAL_SCREEN"]:J1,["LOGIN_FAILED_SCREEN"]:Ly,["AWAITING_OAUTH_SCREEN"]:z1,["ALLOWLIST_REJECTION_SCREEN"]:zm,["USER_LIMIT_REACHED_SCREEN"]:Ng,["INSTALL_PHANTOM_SCREEN"]:Qh,["LINK_EMAIL_SCREEN"]:by,["LINK_PHONE_SCREEN"]:ky,["LINK_WALLET_SCREEN"]:Ry,["LINK_PASSKEY_SCREEN"]:xy,["UPDATE_EMAIL_SCREEN"]:Wg,["CONNECT_ONLY_LANDING_SCREEN"]:vf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:hf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:zf,["EMBEDDED_WALLET_CREATED_SCREEN"]:Df,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Of,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:Q1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:lg,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:ig,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Hf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Tg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:bg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:zh,["FIAT_ON_RAMP_STATUS_SCREEN"]:$h,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:yh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:hh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:sg,["MFA_ENROLLMENT_FLOW_SCREEN"]:Jy,["CAPTCHA_SCREEN"]:nf,["ERROR_SCREEN"]:vh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Kh,["AFFIRMATIVE_CONSENT_SCREEN"]:Hm,["TELEGRAM_AUTH_SCREEN"]:Ag},Sb=["LANDING","AWAITING_CONNECTION"],_b=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=F(),{headless:n}=dr(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=fe(),f=bb(null),h=Rm(f),y=o&&a&&Sb.includes(a)&&!n&&l==="ready";if(Bg(()=>{y&&s()},[y]),Bg(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Hg(ui,{id:"privy-modal-content",children:[dt(P,{}),dt(X,{}),dt(Gy,{children:dt(et,{})}),dt(re,{}),dt(G,{})]});if(!a&&e)return dt(ui,{style:{height:h},id:"privy-modal-conent",children:dt("div",{ref:f,children:dt(op,{open:e,onClose:t})})});if(!a)return null;let v=Pb[a];return dt(ui,{style:{height:h},id:"privy-modal-content",children:Hg("div",{ref:f,children:[dt(Sr,{if:!!e,children:dt(v,{})}),dt(Sr,{if:!e,children:dt(op,{open:e,onClose:t})})]})})},xb=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:wb(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Gg=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=xb(),[o,n]=Eb(!1);Fc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=dt(Fg,{children:dt(_b,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?dt(Hy,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Tb.createPortal(l,s)}return l};import{useRef as Vg,useEffect as Ab}from"react";import{jsx as Rb}from"react/jsx-runtime";function kb({botUsername:e}){let t=document.createElement("script");return t.async=!0,t.src="https://telegram.org/js/telegram-widget.js?22",t.setAttribute("data-telegram-login",e),t.setAttribute("data-request-access","write"),t.setAttribute("data-lang","en"),t}function zg(e){let t=Vg(null),r=Vg();return Ab(()=>{r.current?.remove(),r.current=kb(e),t.current?.after(r.current)},[e]),Rb("div",{ref:t,hidden:!0})}import{useState as Ib}from"react";import{useEffect as qg,useRef as $g}from"react";var lc=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:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Fo(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Be("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((h,y)=>{r.current={resolve:h,reject:y};let v=1e3*60*5;setTimeout(()=>{let g=new Be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),y(g)},v)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),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 u=new Be("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as Db}from"react/jsx-runtime";var Mb=function(e){return()=>`id-${e++}`}(0);function Wb(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function rr(e){return e.error!==void 0}var Dt=new lc,up=new Map,Lb=(e,t)=>typeof t=="bigint"?t.toString():t,Ob=(e,t)=>`${e}${JSON.stringify(t,Lb)}`;function or(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=Ob(e,t);if(e==="privy:wallet:create"){let l=up.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=Mb();Dt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{up.delete(i)});return up.set(i,a),a}function Nb(e){switch(e.event){case"privy:iframe:ready":let t=Dt.dequeue(e.event,e.id);return rr(e)?t.reject(new Be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Dt.dequeue(e.event,e.id);return rr(e)?r.reject(new Be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Dt.dequeue(e.event,e.id);return rr(e)?o.reject(new Be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Dt.dequeue(e.event,e.id);return rr(e)?n.reject(new Be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Dt.dequeue(e.event,e.id);return rr(e)?i.reject(new Be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Dt.dequeue(e.event,e.id);return rr(e)?a.reject(new Be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Dt.dequeue(e.event,e.id);return rr(e)?l.reject(new Be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=Dt.dequeue(e.event,e.id);return rr(e)?s.reject(new Be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Kg(e){let t=$g(null),r=$g(e.mfaMethods),o=Gs(),[n,i]=Ib(!1);return qg(()=>{r.current=e.mfaMethods},[e.mfaMethods]),qg(()=>{if(!n)return;let a=t.current;if(!a)return;function l(h){h&&h.origin===e.origin&&Wb(h.data)&&Nb(h.data)}let s={create(h){return or("privy:wallet:create",h,a,e.origin)},connect(h){return or("privy:wallet:connect",h,a,e.origin)},recover(h){return Fo(y=>or("privy:wallet:recover",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return Fo(y=>or("privy:wallet:rpc",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return Fo(y=>or("privy:wallet:set-recovery-password",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Fo(y=>or("privy:mfa:verify",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Fo(y=>or("privy:mfa:init-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return Fo(y=>or("privy:mfa:submit-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return Fo(y=>or("privy:mfa:unenroll",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return or("privy:mfa:clear",h,a,e.origin)},initFarcasterSigner(h){return or("privy:farcaster:init-signer",h,a,e.origin)},signFarcasterMessage(h){return or("privy:farcaster:sign",h,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},f=new AbortController;return au(()=>or("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),Db("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:za(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function cc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function jg({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var Yg=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 vr,jsxs as Zg}from"react/jsx-runtime";var Bo;function Bb(e){return typeof e=="string"&&e.length===25}function xe(){if(!Bo){let e=Z.get(qo);return Promise.resolve(e||null)}return Bo.getAccessToken()}var Jg,Uu=(e,t)=>Jg(e,t),Qg,Fu=(e,t)=>Qg(e,t),Xg,Bu=(e,t)=>Xg(e,t),e2,Hu=()=>e2(),Hb=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(ki,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},Gb=({config:e,...t})=>{if(!Bb(t.appId))throw new E("Cannot initialize the Privy provider with an invalid Privy app ID");Bo||(Bo=new Hi({appId:t.appId,apiUrl:t.apiUrl||Za}));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."),vr(vm,{client:Bo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:vr(Vb,{...t,client:Bo})})},Vb=e=>{let t=e.client,[r,o]=$e(!1),[n,i]=$e(!1),[a,l]=$e(!1),[s,c]=$e(null),[u,f]=$e([]),h=_i(u),[y,v]=$e(!1),[g,S]=$e(null),[b,w]=$e(!1),[I,A]=$e({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:T}),[O,R]=$e({status:"initial"}),[k,H]=$e(null),[q,j]=$e(null),[W,$]=$e(null),D=dr(),ue=Us(),[ce,de]=$e(!0),[ve,ee]=$e({}),[Ct,Ke]=$e(null),[xt,Qe]=$e(null),[nr,ke]=$e(!1),[Ve,ir]=$e(!1),At=_i(null),He=_i(null),N=_i(Im),[Ho,Ce]=$e(!1);t.onStoreToken=d=>{d&&U(N,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(N,"accessToken","onAccessTokenRemoved")};let J=_i(null),Q=_i(null),we=d=>{S(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},Ne=d=>{D.embeddedWallets.createOnLogin!=="off"&&de(!0),we(d)};Or(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Or(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!W){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(W,d.address,D.defaultChain,e.appId)},[W,s]),Or(()=>{W&&xt?.(W)},[W]),Or(()=>{(async()=>{if(!D.customAuth?.enabled)return;de(!0);let{getCustomAccessToken:p,isLoading:m}=D.customAuth;if(!(!n||m))try{let C=await p();if(!C&&a){await Pn.logout();return}if(!C||a)return;t.startAuthFlow(new Sn(C));let{user:x,isNewUser:B}=await t.authenticate();if(!x){await Pn.logout();return}c(x||null),v(B||!1),l(!0),ir(!0)}catch(C){console.warn(C),a&&await Pn.logout()}})()},[D.customAuth?.enabled,D.customAuth?.getCustomAccessToken,D.customAuth?.isLoading,n,a]),Or(()=>{Ve&&W&&s&&kt(s,D.embeddedWallets.createOnLogin)&&(ir(!1),Ma(s,xn).catch(console.error))},[Ve&&W&&s]),Or(()=>{async function d(){let p=pc();Hb();let m=Ub();H(m),t.initializeConnectorManager({walletConnectCloudProjectId:D.walletConnectCloudProjectId,rpcConfig:D.rpcConfig,chains:D.chains,defaultChain:D.defaultChain,store:m,walletList:D.appearance.walletList,shouldEnforceDefaultChainOnConnect:D.shouldEnforceDefaultChainOnConnect,appName:D.name??"Privy"});let C;t.connectors?.on("connectorInitialized",()=>{C&&clearTimeout(C);let B=t.connectors.walletConnectors.length,Y=t.connectors.walletConnectors.reduce((ze,Ye)=>ze+(Ye.initialized?1:0),0);Y===B?Ce(!0):C=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:Y,expected:B}),Ce(!0)},1500)}),t.connectors?.initialize().then(()=>{uc()});let x=await t.getAuthenticatedUser();D.customAuth?.enabled||(l(!!x),x&&U(N,"login","onComplete",x,!1,!0,null,null),c(x)),p||me.setReadyToTrue(!!x),p&&(x?Q.current="link":Q.current="login")}!n&&ue&&d()},[t,Ct,n,ue]),Or(()=>{if(!n)return;if(!s){ke(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){ke(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");ke(p)},[n,s,u]);let pc=()=>{let d=Li();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}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new Dr(d)),Ne("AWAITING_OAUTH_SCREEN"),!0)},En=async(d,p,m,C)=>{let x=await t.connectors?.createWalletConnector(d,p)||null;Tn(x,p,m,C)};async function Tn(d,p,m,C){if(d)A({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:T});else return A({status:"disconnected",connectedWallet:null,connectError:new te("Unable to connect to wallet."),connector:null,connectRetry:T}),C?.(null,m);d instanceof Hr&&p&&await d.resetConnection(p),A({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Tn(d,p,m,C)});try{let x=await d.connect({showPrompt:!0});if(D.shouldEnforceDefaultChainOnConnect&&!D.chains.find(B=>B.id===Number(x?.chainId))&&!(x?.connectorType==="wallet_connect_v2"&&x?.walletClientType==="metamask")){A(B=>({...B,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:T}));try{await x?.switchChain(D.defaultChain.id),x&&(x.chainId=_n(zo(D.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${D.defaultChain.id}`)}}return A(B=>({...B,status:"connected",connectedWallet:x,connectError:null,connectRetry:T})),x&&!Q.current&&U(N,"connectWallet","onSuccess",x),C?.(x,m)}catch(x){return x instanceof Ge?(console.warn(x.cause?x.cause:x.message),Q.current||U(N,"connectWallet","onError",x.privyErrorCode||"generic_connect_wallet_error")):(console.warn(x),Q.current||U(N,"connectWallet","onError","unknown_connect_wallet_error")),A(B=>({...B,status:"disconnected",connectedWallet:null,connectError:x})),C?.(null,m)}}let Go=async(d,p)=>{if(d===null)return;let m=new Qo(d,p);t.startAuthFlow(m)},uc=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!vo()&&Ne("LOGIN_FAILED_SCREEN"),!t.connectors)throw new E("Connector not initialized");we("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),En(p,m,void 0,Go)};Or(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let je=()=>{if(!a)throw U(N,"linkAccount","onError","must_be_authenticated"),new E("User must be authenticated before linking an account.")},yo=()=>{je(),J.current="siwe",Q.current="link",we("LINK_WALLET_SCREEN")},pt=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},Ut=async d=>{if(!t.connectors)throw new E("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(A(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:T})),D.captchaEnabled&&!a){let m={callback:C=>Go(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),Ne("CAPTCHA_SCREEN")}else await Go(d),Ne("AWAITING_CONNECTION")},Cr=async(d,p)=>{if(!D.fiatOnRamp.enabled)throw new E("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:C}=await Gh(t,d,p?.config??{},D.appearance.palette,D.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:C}}else throw new E("Unsupported fund provider. Currently supported option is `moonpay`.")},Vo=()=>{f(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:pt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new E("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new E("Cannot link or login with embedded wallet");Ut(m)},fund:async C=>{let{signedUrl:x,externalTransactionId:B}=await Cr(m.address,C);ee({fiatOnRampPrompt:{signedUrl:x},fiatOnRampStatus:{externalTransactionId:B}}),we("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new E("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new E("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(m.address);c(C)}}))||[];return gs(d,p)?d:p})};Or(()=>{Vo()},[s?.linkedAccounts,a,n]),Or(()=>{if(n){if(!t.connectors)throw new E("Connector not initialized");Vo(),t.connectors.on("walletsUpdated",Vo)}},[n]);let eo=()=>{we(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let d=u[0],p=h.current.find(C=>C.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):m=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&m){let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(C)}h.current=u},[u]);let Ma=async(d,p)=>{if(_e(d))throw U(N,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,x]=await Promise.all([me.initializeWalletProxy(p),xe()]);if(!C&&D.customAuth?.enabled)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!x||D.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((B,Y)=>{de(!0),ee({createWallet:{onSuccess:Ye=>{U(N,"createWallet","onSuccess",Ye),B(Ye)},onFailure:Ye=>{U(N,"createWallet","onError","unknown_embedded_wallet_error"),Y(Ye)},callAuthOnSuccessOnClose:!1}}),we("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:x});let B=await me.refreshUser(),Y=_e(B);if(!Y)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(N,"createWallet","onSuccess",Y),Y}},n2=d=>{if(!D.chains.map(p=>p.id).includes(d))throw new te(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},fp=(d,p,m)=>new Promise(async(C,x)=>{if(!a||!s){U(N,"sendTransaction","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=_e(s);if(!B){U(N,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}de(!0);let Y=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ze=d.chainId?Number(d.chainId):Y.chainId;n2(ze);let Ye=Object.assign({},d,{chainId:ze}),ar=async()=>{let Re=await xe();if(!Re||!W){U(N,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await me.recoverEmbeddedWallet()){U(N,"sendTransaction","onError","unknown_connect_wallet_error"),x(new Error("Unable to connect to wallet"));return}let wt=to(Ye.chainId,D.chains,D.rpcConfig,{appId:e.appId}),mc=await wi(B.address,Ye,wt);if(D.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:a2}=await Ci(mc,wt),{hasSufficientFunds:s2}=await Jl(B.address,mc,a2,wt);if(!s2)throw new Ue(new Vt("Wallet has insufficient funds for this transaction.",it.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let yp=await Zl(Re,B.address,W,mc,wt);U(N,"sendTransaction","onSuccess",yp),C(yp)}catch(Bt){U(N,"sendTransaction","onError","transaction_failure"),x(Bt)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),ar();else{let Re={transactionRequest:Ye,onSuccess:wt=>{U(N,"sendTransaction","onSuccess",wt),C(wt)},onFailure:wt=>{U(N,"sendTransaction","onError","transaction_failure"),x(wt)},uiOptions:p||{},fundWalletConfig:m},Bt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wt=>{U(N,"sendTransaction","onError","unknown_connect_wallet_error"),x(wt)}};ee({connectWallet:Bt,sendTransaction:Re}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function hp(){return new Promise(async(d,p)=>{let m=await xe();if(!m||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:m}),d()}catch(C){p(C)}})}let Ft=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)},Pn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:eo,linkWallet:yo,linkEmail:()=>{je(),Ft("email"),J.current="email",Q.current="link",we("LINK_EMAIL_SCREEN")},linkPhone:()=>{je(),Ft("phone"),J.current="sms",Q.current="link",we("LINK_PHONE_SCREEN")},linkGoogle:async()=>{je(),Ft("google"),Q.current="link",await me.initLoginWithOAuth("google")},linkTwitter:async()=>{je(),Ft("twitter"),Q.current="link",await me.initLoginWithOAuth("twitter")},linkDiscord:async()=>{je(),Ft("discord"),Q.current="link",await me.initLoginWithOAuth("discord")},linkGithub:async()=>{je(),Ft("github"),Q.current="link",await me.initLoginWithOAuth("github")},linkSpotify:async()=>{je(),Ft("spotify"),Q.current="link",await me.initLoginWithOAuth("spotify")},linkInstagram:async()=>{je(),Ft("instagram"),Q.current="link",await me.initLoginWithOAuth("instagram")},linkTiktok:async()=>{je(),Ft("tiktok"),Q.current="link",await me.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{je(),Ft("linkedin"),Q.current="link",await me.initLoginWithOAuth("linkedin")},linkApple:async()=>{je(),Ft("apple"),Q.current="link",await me.initLoginWithOAuth("apple")},linkPasskey:async()=>{je(),Ft("passkey"),await me.initLinkWithPasskey(),we("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{je(),Ft("farcaster"),await me.initLoginWithFarcaster(),Q.current="link",J.current="farcaster",we("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(je(),!s?.email)throw new E("User does not have an email linked to their account.");Q.current="link",J.current="email",we("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{Ke(C=>m.bind(C))});if(Ke(null),p){console.warn(d);return}}if(a){console.warn(d);return}Q.current="login",Ne("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Ke(()=>d)}),Ke(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Ne("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&W)try{await W.clearMfa({userId:s.id})}catch{}c(null),l(!1),S(null),U(N,"logout","onSuccess"),Q.current=null,J.current=null,o(!1),Z.del(Ri)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Le;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new Le:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new mp(new Ur(new Le));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new mp(new Ur(new Le)):new mp(new Ur(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new bo(new Le);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(C=>C.address===d?.address));return!d||!p?new bo(new Le):new bo(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},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(C=>dc(C.address)===dc(d)),m=s?.linkedAccounts.find(C=>C.type==="wallet"&&dc(C.address)===dc(d));if(!p||!await p.isConnected())j(d),yo();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(N,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ma(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw U(N,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=_e(s);if(!d||!W)throw U(N,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw U(N,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await hp()}catch(p){throw U(N,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,m)=>{de(!0);let C={onSuccess:B=>{U(N,"setWalletPassword","onSuccess",B),p(B)},onFailure:B=>{U(N,"setWalletPassword","onError","user_exited_set_password_flow"),m(B)},callAuthOnSuccessOnClose:!1},x={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:B=>{U(N,"setWalletPassword","onError","unknown_connect_wallet_error"),m(B)}};ee({setWalletPassword:C,connectWallet:x}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,C)=>{if(!a||!s){U(N,"signMessage","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=_e(s);if(!x){U(N,"signMessage","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(N,"signMessage","onError","invalid_message"),C(new Error("Message must be a non-empty string"));return}de(!0);let B=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Y=await xe();if(!W||!Y)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:x.address}});let{response:Ye}=await W.rpc({accessToken:Y,address:x.address,request:{method:"personal_sign",params:[d,x.address]}}),ar=Ye.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:x.address}}),ar};if(D.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Y=await B();U(N,"signMessage","onSuccess",Y),m(Y)}catch(Y){U(N,"signMessage","onError","unable_to_sign"),C(Y??new Ue("Unable to sign message"))}}else{let Ye={method:"personal_sign",data:d,confirmAndSign:B,onSuccess:Re=>{U(N,"signMessage","onSuccess",Re),m(Re)},onFailure:Re=>{U(N,"signMessage","onError","unable_to_sign"),C(Re)},uiOptions:p||{}},ar={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Re=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),C(Re)}};ee({signMessage:Ye,connectWallet:ar}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,C)=>{if(!a||!s){U(N,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=_e(s);if(!x){U(N,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}de(!0);let B=$a(d),Y=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ze=await xe();if(!W||!ze)throw new Error("Unable to connect to wallet");if(!await me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:x.address}});let{response:ar}=await W.rpc({accessToken:ze,address:x.address,request:{method:"eth_signTypedData_v4",params:[x.address,B]}}),Re=ar.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:x.address}}),Re};if(D.embeddedWallets.noPromptOnSignature||(D.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ze=await Y();U(N,"signTypedData","onSuccess",ze),m(ze)}catch(ze){U(N,"signTypedData","onError","unable_to_sign"),C(ze??new Ue("Unable to sign message"))}}else{let ar={method:"eth_signTypedData_v4",data:B,confirmAndSign:Y,onSuccess:Bt=>{U(N,"signTypedData","onSuccess",Bt),m(Bt)},onFailure:Bt=>{U(N,"signTypedData","onError","unable_to_sign"),C(Bt)},uiOptions:p||{}},Re={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Bt=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),C(Bt)}};ee({signMessage:ar,connectWallet:Re}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let x=await(await fp(d,p,m)).wait();return Ql(x)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!_e(s)){p(new Error("Must have a Privy wallet before exporting"));return}de(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ee(ve),!await xe()||!W){p(new Error("Must have valid access token to enroll in MFA"));return}if(!W){p(new Error("Must have a Privy wallet before exporting"));return}let B={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:B,connectWallet:C}),we("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:hp,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 E("Invalid MFA code");At.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((B,Y)=>{He.current={resolve:B,reject:Y}});break;case"passkey":if(typeof p=="string")throw new E("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),x=Yg(C);At.current?.resolve({mfaMethod:d,mfaCode:x,relyingParty:window.origin}),await new Promise((B,Y)=>{He.current={resolve:B,reject:Y}});break;default:throw At.current?.reject(new E("Unsupported MFA method")),new E(`Unsupported MFA method: ${d}`)}},cancel(){At.current?.reject(new E("MFA canceled"))},async initEnrollmentWithSms(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){me.closePrivyModal(),p();return}D.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:D.mfa.methods,onSuccess:p,onFailure:m}}),we("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await xe();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await xe();if(!p||!W)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await xe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}ee({farcasterSigner:C}),we("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await xe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!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 me.recoverEmbeddedWallet())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(x=>Uint8Array.from(x.match(/.{1,2}/g).map(B=>parseInt(B,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await xe(),m=s?.linkedAccounts.find(Y=>Y.type==="wallet"&&Y.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 me.recoverEmbeddedWallet())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 x=await import("@simplewebauthn/browser"),B=await W.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:x.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(x.base64URLStringToBuffer(B.signature))},isHeadlessOAuthLoading:b,loginWithCode(d){return me.loginWithCode(d)},initLoginWithEmail(d){return me.initLoginWithEmail(d)},initLoginWithSms(d){return me.initLoginWithSms(d)},otpState:O,fundWallet(d,p){return me.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return me.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return me.loginWithHeadlessOAuth(d)},isModalOpen:r};Jg=Pn.signMessage,Qg=Pn.signTypedData,Xg=async(...d)=>{let p=await fp(...d);return D.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let me=(()=>({isNewUserThisSession:y,linkingHint:q,pendingTransaction:null,walletConnectionStatus:I,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:D.rpcConfig,chains:D.chains,appId:e.appId,showFiatPrices:D.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>D.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(W)return W;let p=new Promise(x=>{Qe(()=>B=>x(B))}),m=new Promise(x=>setTimeout(()=>x(null),d)),C=await Promise.race([p,m]);return Qe(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,m;p&&J.current&&(m=s?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,x)=>x.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),Q.current==="login"&&J.current?d.shouldCallAuthOnSuccess&&p?(U(N,"login","onComplete",s,y,!1,J.current,m??null),e.onSuccess?.(s,y)):U(N,"login","onError","exited_auth_flow"):Q.current==="link"&&J.current&&m&&(d.isSuccess&&p?U(N,"linkAccount","onSuccess",s,J.current,m):U(N,"linkAccount","onError","exited_link_flow")),j(null),Q.current=null,J.current=null,v(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:we,connectWallet:Tn,initLoginWithWallet:async(d,p)=>{J.current="siwe",Go(d,p)},loginWithWallet:async()=>{if(!n)throw new Nr;if(!(t.authFlow instanceof Qo))throw new E("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),J.current="siwe"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),v(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Ai(d);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Nr;if(!(t.authFlow instanceof Ai))throw new E("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),J.current="farcaster"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),v(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(J.current=d,gc()){if(d==="google"&&cc(window.navigator.userAgent)){Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Ne("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Z.del(jo);let m=new Dr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},async initLoginWithTelegram(d){if(!n)throw new Nr;J.current="telegram";let p=new Oi(d);t.startAuthFlow(p),t.authFlow.meta.telegramAuthResult=await new Promise((m,C)=>{if(!D.loginConfig.telegramAuthConfiguration)return C("Telegram Auth configuration is not loaded");if(!window.Telegram)return C("Telegram was not initialized");window.Telegram.Login.auth({bot_id:D.loginConfig.telegramAuthConfiguration.botId,request_access:!0},x=>x?m(x):C("Telegram auth failed or was canceled by the client"))})},async loginWithTelegram(){if(!n)throw new Nr;if(!(t.authFlow instanceof Oi))throw new E("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{d=await t.link(),J.current="telegram"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,J.current="telegram"}catch(m){throw Q.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),v(p||!1),l(!0)},async recoveryOAuthFlow(d,p,m){let{url:C,codeVerifier:x,stateCode:B}=await If({api:Bo.api,provider:d});if(!C)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new E("Recovery OAuth failed");let Y,ze;try{let Re=await jg({url:C,popup:m});if(Y=Re.stateCode,ze=Re.authorizationCode,Y!==B)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:B??"",returnedStateCode:Y??""}}),new E("Unexpected auth flow. This may be a phishing attempt.")}catch(Re){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Re.toString(),provider:d}}),new E("Recovery OAuth failed")}let[Ye,ar]=await Promise.all([xe(),Mf({api:Bo.api,provider:d,codeVerifier:x,stateCode:Y,authorizationCode:ze})]);if(!W)throw new E("Cannot connect to wallet proxy");switch(p){case"recover":let Re=ve.recoverWallet?.privyWallet?.address;if(!Re)throw new E("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:Re,recoveryMethod:d}}),await W.recover({address:Re,accessToken:Ye,recoveryAccessToken:ar,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:Re,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:Ye,recoveryAccessToken:ar,recoveryMethod:d});let Bt=await me.refreshUser(),wt=_e(Bt);if(!wt)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:wt.address}}),U(N,"createWallet","onSuccess",wt);break;default:throw new E("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Dr))throw new E("Must initialize OAuth flow before calling loginWithOAuth");let p=Z.get($o),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new E("Unexpected auth flow. This may be a phishing attempt.");let C,x,B;if(a)try{C=await t.link(),J.current=d}catch(Y){throw U(N,"linkAccount","onError",Y.privyErrorCode||"failed_to_link_account"),Y}else try{let Y=await t.authenticate();C=Y.user,x=Y.isNewUser,B=Y.oAuthProviderTokens,J.current=d}catch(Y){throw Q.current==="login"?U(N,"login","onError",Y.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",Y.privyErrorCode||"failed_to_link_account"),Y}return c(C),v(x||!1),l(!0),B},async initLoginWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),Q.current="login";try{J.current="passkey",await p.initAuthenticationFlow()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new Nr;if(!(t.authFlow instanceof Jo))throw new E("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d,p;try{J.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),v(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Jo(d);t.startAuthFlow(p),Q.current="link",J.current="passkey";try{await p.initLinkFlow()}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new Nr;if(!(t.authFlow instanceof Jo))throw new E("Must initialize Passkey flow first.");if(J.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d;try{J.current="passkey",d=await t.link()}catch(p){throw U(N,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(gc()){if(d==="google"&&cc(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 m=new Dr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let C=await t.startAuthFlow(m).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){w(!0),t.startAuthFlow(new Dr(d));let p=Z.get($o),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),w(!1),new E("Unexpected auth flow. This may be a phishing attempt.");let C,x;if(a)try{C=await t.link(),J.current=d.provider}catch(B){throw U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:C,isNewUser:x}=await t.authenticate()),J.current=d.provider}catch(B){throw Q.current==="login"?U(N,"login","onError",B.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return c(C),v(x||!1),l(!0),w(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let m=new go(d,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(C){throw Q.current==="login"?U(N,"login","onError",C.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,m)=>{let C=new Ba(d,p,m);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{R({status:"sending-code"});let m=new Xo(d,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(C){throw R({status:"error",error:C}),Q.current==="login"?U(N,"login","onError",C.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&U(N,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(R({status:"submitting-code"}),!n){let x=new Nr;throw R({status:"error",error:x}),x}if(t.authFlow instanceof go)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Xo)t.authFlow.meta.smsCode=d.trim();else{let x=new E("Must initialize a passwordless code flow first");throw R({status:"error",error:x}),x}let p=await xe(),m,C;if(p&&t.sessionHasActiveToken())try{m=await t.link()}catch(x){throw R({status:"error",error:x}),U(N,"linkAccount","onError",x.privyErrorCode||"failed_to_link_account"),x}else try{({user:m,isNewUser:C}=await t.authenticate())}catch(x){throw R({status:"error",error:x}),U(N,"login","onError",x.privyErrorCode||"unknown_auth_error"),x}c(m||s||null),v(C||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:W,createAnalyticsEvent:({eventName:d,payload:p,timestamp:m})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:m}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy"),C=await xe();if(!C||!W||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}de(!0);try{await W.connect({accessToken:C,address:m.address}),d(!0)}catch(x){if(Xn(x)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await W.recover({address:m.address,accessToken:C})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if(Xn(x)){ee({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let B=cl(m.recoveryMethod);we(B)}else p(x)}}),getFiatOnRampConfig:Cr,setReadyToTrue:d=>{i(!0),Ct?.(d)},updateWallets:()=>Vo(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:C}=await Cr(d,p);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:C}}),we("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await xe(),m=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!m)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 x=await t.getAuthenticatedUser();c(x||s||null)}return C}}))();e2=me.recoverEmbeddedWallet;let i2=Fb(()=>({wallets:u,ready:nr&&Ho}),[u,nr,Ho]);return vr(ye.Provider,{value:Pn,children:vr(Uc.Provider,{value:N,children:vr(tp.Provider,{value:i2,children:Zg(Am,{...D,children:[e.children,Zg(Dc.Provider,{value:me,children:[!D.headless&&D.captchaEnabled&&n&&!a&&vr(Nc,{delayedExecution:!1}),vr(Ug,{theme:{...D.appearance.palette||{}}}),vr(wm,{data:ve,setModalData:ee,setInitialScreen:S,initialScreen:g,authenticated:a,open:r,children:vr(Gg,{open:r})}),ce&&ue?vr(Kg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:At,mfaSubmitPromise:He,onLoad:$,onLoadFailed:()=>null}):null,D.loginMethods.telegram&&D.loginConfig.telegramAuthConfiguration&&vr(Sr,{if:!0,children:vr(zg,{botUsername:D.loginConfig.telegramAuthConfiguration.botName})})]})]})})})})};import{useContext as zb}from"react";function qb(e){let{login:t}=zb(ye);return Fe("login",e),{login:t}}import{useContext as $b}from"react";function Kb(e){let{logout:t}=$b(ye);return Fe("logout",e),{logout:t}}import{useCallback as t2,useEffect as jb}from"react";function Yb(){let e=fe(),t=Us(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=F(),l=t2(async c=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=t2(async()=>{let c=Li();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(u){throw u}finally{Zo()}},[o]);return jb(()=>{let c=Li();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as r2}from"react";var Zb=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=F(),o=r2(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=r2(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Er(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as o2}from"react";var Jb=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=F(),n=o2(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=o2(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Er(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as Qb}from"react";function Xb(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkFarcaster:y}=Qb(ye);return Fe("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:h,linkFarcaster:y}}import{useContext as eE}from"react";function tE(e){let{connectWallet:t}=eE(ye);return Fe("connectWallet",e),{connectWallet:t}}import{useContext as rE}from"react";function oE(e){let{createWallet:t}=rE(ye);return Fe("createWallet",e),{createWallet:t}}var nE=()=>{let{fundWallet:e}=F();return{fundWallet:e}};import{useContext as iE}from"react";function aE(e){let{sendTransaction:t}=iE(ye);return Fe("sendTransaction",e),{sendTransaction:t}}import{useContext as sE}from"react";function lE(e){let{setWalletPassword:t}=sE(ye);return Fe("setWalletPassword",e),{setWalletPassword:t}}import{useContext as cE}from"react";function dE(e){let{signMessage:t}=cE(ye);return Fe("signMessage",e),{signMessage:t}}import{useContext as pE}from"react";function uE(e){let{signTypedData:t}=pE(ye);return Fe("signTypedData",e),{signTypedData:t}}import{useContext as mE}from"react";var fE=()=>{let{isModalOpen:e}=mE(ye);return{isOpen:e}};import{useContext as hE}from"react";function yE(e){let{getAccessToken:t}=hE(ye);return Fe("accessToken",e),{getAccessToken:t}}function gE(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function vE(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Ur as AsExternalProvider,Nc as Captcha,Bi as ConnectorManager,Hi as PrivyClient,Gb as PrivyProvider,Le as PrivyProxyProvider,Ui as SUPPORTED_CHAINS,wc as VERSION,Rt as WalletConnector,vE as addRpcUrlOverrideToChain,ad as errorIndicatesMaxMfaRetries,cn as errorIndicatesMfaTimeout,dn as errorIndicatesMfaVerificationFailed,xe as getAccessToken,tE as useConnectWallet,oE as useCreateWallet,gE as useExperimentalFarcasterSigner,nE as useFundWallet,Xb as useLinkAccount,qb as useLogin,Zb as useLoginWithEmail,Yb as useLoginWithOAuth,Jb as useLoginWithSms,Kb as useLogout,fa as useMfa,Mr as useMfaEnrollment,fE as useModalStatus,F as usePrivy,Fc as useRegisterMfaListener,aE as useSendTransaction,lE as useSetWalletPassword,dE as useSignMessage,uE as useSignTypedData,yE as useToken,Sa as useWallets};