@privy-io/react-auth 1.66.0 → 1.66.1-beta-20240523195529

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.
Files changed (3) hide show
  1. package/dist/esm/index.js +266 -266
  2. package/dist/index.js +270 -270
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var h0=Object.create;var _s=Object.defineProperty;var y0=Object.getOwnPropertyDescriptor;var g0=Object.getOwnPropertyNames;var v0=Object.getPrototypeOf,C0=Object.prototype.hasOwnProperty;var w0=(e,t)=>{for(var r in t)_s(e,r,{get:t[r],enumerable:!0})},Zp=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of g0(t))!C0.call(e,n)&&n!==r&&_s(e,n,{get:()=>t[n],enumerable:!(o=y0(t,n))||o.enumerable});return e};var h=(e,t,r)=>(r=e!=null?h0(v0(e)):{},Zp(t||!e||!e.__esModule?_s(r,"default",{value:e,enumerable:!0}):r,e)),b0=e=>Zp(_s({},"__esModule",{value:!0}),e);var id=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Jp=(e,t,r)=>(id(e,t,"read from private field"),r?r.call(e):t.get(e)),xs=(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)},ad=(e,t,r,o)=>(id(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Qp=(e,t,r)=>(id(e,t,"access private method"),r);var R5={};w0(R5,{AsExternalProvider:()=>to,Captcha:()=>Ll,ConnectorManager:()=>Ii,PrivyClient:()=>Mi,PrivyProvider:()=>N3,PrivyProxyProvider:()=>Ze,SUPPORTED_CHAINS:()=>Ai,VERSION:()=>qs,WalletConnector:()=>Xt,addRpcUrlOverrideToChain:()=>d0,errorIndicatesMaxMfaRetries:()=>tc,errorIndicatesMfaTimeout:()=>gn,errorIndicatesMfaVerificationFailed:()=>vn,getAccessToken:()=>ke,useConnectWallet:()=>K3,useCreateWallet:()=>Y3,useExperimentalFarcasterSigner:()=>c0,useFundWallet:()=>Z3,useLinkAccount:()=>q3,useLogin:()=>U3,useLoginWithEmail:()=>G3,useLoginWithOAuth:()=>H3,useLoginWithSms:()=>V3,useLogout:()=>B3,useMfa:()=>ca,useMfaEnrollment:()=>Yr,useModalStatus:()=>a0,usePrivy:()=>H,useRegisterMfaListener:()=>Fl,useSendTransaction:()=>Q3,useSetWalletPassword:()=>e0,useSignMessage:()=>r0,useSignTypedData:()=>n0,useToken:()=>l0,useWallets:()=>va});module.exports=b0(R5);var Ps=require("@ethersproject/address"),td=require("@ethersproject/providers"),I3=require("mipd"),le=require("react");var Xp=require("ofetch"),ct=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}]`:""}`}},Xr=class extends ct{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},P=class extends ct{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ks=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var de=class extends ct{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},he=e=>{if(e instanceof ct)return e;if(!(e instanceof Xp.FetchError))return Nt(e);if(!e.response)return new Xr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Xr(t||"ApiError",e.response.status,r||o,e,n)},Nt=e=>e instanceof ct?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var vo=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Qt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},As=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ur=class extends P{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 Rs="/api/v1/sessions",Is="/api/v1/sessions/logout",eu="/api/v1/sessions/fork",Ms="/api/v1/sessions/fork/recover",tu="/api/v1/siwe/init",ru="/api/v1/siwe/authenticate",ou="/api/v1/siwe/link",nu="/api/v1/siwe/unlink",iu="/api/v1/farcaster/init",au="/api/v1/farcaster/authenticate",su="/api/v1/farcaster/link",lu="/api/v1/farcaster/status",cu="/api/v1/farcaster/unlink",du="/api/v1/passwordless/init",pu="/api/v1/passwordless/authenticate",uu="/api/v1/passwordless/link",mu="/api/v1/passwordless/unlink",fu="/api/v1/passwordless/update",hu="/api/v1/passwordless_sms/init",yu="/api/v1/passwordless_sms/link",gu="/api/v1/passwordless_sms/unlink",vu="/api/v1/passwordless_sms/authenticate",Cu="/api/v1/oauth/init",wu="/api/v1/oauth/authenticate",bu="/api/v1/oauth/link",Eu="/api/v1/oauth/unlink",Pu="/api/v1/recovery/oauth/init",Tu="/api/v1/recovery/oauth/init_icloud",Su="/api/v1/recovery/oauth/authenticate",_u="/api/v1/passkeys/link/init",xu="/api/v1/passkeys/authenticate/init",ku="/api/v1/passkeys/link",Au="/api/v1/passkeys/authenticate",Ru="/api/v1/passkeys/unlink",Iu="/api/v1/telegram/authenticate",Mu="/api/v1/telegram/link",Wu="/api/v1/telegram/unlink";var Lu="/api/v1/mfa/passwordless_sms/init",Ou="/api/v1/mfa/passkeys/init",Nu="/api/v1/users/me/accept_terms",Ws="/api/v1/analytics_events",Du="/api/v1/plugins/moonpay_on_ramp/sign",Uu="/api/v1/custom_jwt_account/authenticate";var fi=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(Uu,{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 he(t)}}async link(){throw new Error("Unimplemented")}};var sn=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(pu,{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 he(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(uu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw he(t)}}async sendCodeEmail(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new P("Email must be set when initialzing authentication.");try{return await this.api.post(du,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw he(o)}}},Ls=class extends sn{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new P("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(fu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw he(r)}}};var zs=require("react-device-detect");var sd=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)}},Os=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 ld(){try{let e="privy:__session_storage__test",t="blobby",r=new Os;return r.put(e,t),r.del(e),!0}catch{return!1}}function E0(){return typeof window<"u"&&window.localStorage?new Os:new sd}var ne=E0();var hi=require("@ethersproject/providers");function Fu(){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 Ns=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 cd=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ns(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!cd(r))return!1}return!0},ln=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Bu=()=>{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 Hu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Ds=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,}))$/),Gu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},cn=(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}`},dd=e=>new Promise(t=>setTimeout(t,e));function Vu(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 zu=(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 dd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Us=(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 qu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Dn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function $u(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 Fu()){let u=Ns(c);if(!l.some(f=>f.info.name===u)){if(cd(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 yi(e){return`eip155:${String(Number(e))}`}var Fs=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`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 de(`No RPC url found for ${e}`);return a},Ku=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new de(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Uo=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new hi.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new hi.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new hi.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new hi.StaticJsonRpcProvider(i.rpcUrls.public.http[0]):a=new hi.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new de(`No RPC url found for ${e}`);return a},Bs=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 Hs=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Gs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Gs={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 P0(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function ju(e,t){let r=P0(t);if(r.deepLink)return Xu(r.deepLink,e);if(r.universalLink)return em(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var Yu="WALLETCONNECT_DEEPLINK_CHOICE";function Zu(){try{localStorage.removeItem(Yu)}catch{}}function Ju({href:e,name:t}){try{localStorage.setItem(Yu,JSON.stringify({href:e,name:t}))}catch{}}function Qu(e){return e.startsWith("http://")||e.startsWith("https://")}function Xu(e,t){if(Qu(e))return em(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 em(e,t){if(!Qu(e))return Xu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Vs(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 Pa=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");try{let t=await this.api.post(au,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new P("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 he(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(su,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw he(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(iu,{token:this.captchaToken});zs.isMobile&&!zs.isIOS&&t.connect_uri&&Vs(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new P("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");let t=await this.api.get(lu,{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 tm="1.66.0";var rm="34357d3c125c2bcf2ce2bc3309d98715",Ta="https://auth.privy.io",om=2e4,Xe=1400,nm=2500,qs=tm;var Un="privy:token",pd="privy-token",$s="privy:refresh_token",ud="privy-refresh-token",Ks="privy-session",Sa="privy:session_transfer_token",S0="privy:wallet",_a="privy:caid",Fn="privy:state_code",Bn="privy:code_verifier",Hn="privy:headless_oauth",js=e=>`${S0}:${e}`,md="privy:connectors",fd="privy:connections";var Gn=12e4,Fo=1,hd="0x1",gi=3e4,im="https://api.moonpay.com/v1",am="https://api.moonpay.com/v1",sm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",lm="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",cm="0x420000000000000000000000000000000000000F",dm=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var yd=require("jose");async function pm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function um(e){return crypto.getRandomValues(new Uint8Array(e))}var _0="S256",x0="S256";function xa(){return yd.base64url.encode(um(36))}function Ys(){return xa()}async function Zs(e,t=_0){if(t==x0){let r=await pm(e);return yd.base64url.encode(r)}else return e}function mm(){let e=ne.get(Bn);if(!e)throw new P("Authentication error.");return e}function Js(){return!!ne.get(Hn)}var Co=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Js();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 P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=mm();try{let r=await this.api.post(wu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ne.del(Bn),this.meta.headless&&ne.del(Hn),{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=he(r);throw o.privyErrorCode?new P(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=ne.get(Bn);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(bu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ne.del(Bn),r}catch(r){throw he(r)}}async getAuthorizationUrl(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.provider)throw new P("Provider must be set when initializing OAuth authentication.");let t=xa();ne.put(Bn,t);let r=Ys();ne.put(Fn,r);let o=await Zs(t);this.meta.headless&&ne.put(Hn,!0);try{return await this.api.post(Cu,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw he(n)}}};function gd(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ka=require("react/jsx-runtime"),Qs=({style:e,...t})=>(0,ka.jsxs)("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:[(0,ka.jsx)("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"}),(0,ka.jsx)("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"})]});var dn=require("react/jsx-runtime"),Xs=({style:e,...t})=>(0,dn.jsxs)("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:[(0,dn.jsx)("g",{clipPath:"url(#clip0)",children:(0,dn.jsx)("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"})}),(0,dn.jsx)("defs",{children:(0,dn.jsx)("clipPath",{id:"clip0",children:(0,dn.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var vd=require("react/jsx-runtime"),el=({style:e,...t})=>(0,vd.jsx)("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:(0,vd.jsx)("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"})});var Vn=require("react/jsx-runtime"),tl=({style:e,...t})=>(0,Vn.jsxs)("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:[(0,Vn.jsx)("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"}),(0,Vn.jsx)("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"}),(0,Vn.jsx)("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"}),(0,Vn.jsx)("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"})]});var Tt=require("react/jsx-runtime");function rl(e){return(0,Tt.jsxs)("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:[(0,Tt.jsxs)("defs",{children:[(0,Tt.jsxs)("linearGradient",{id:"b",children:[(0,Tt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,Tt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,Tt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,Tt.jsxs)("linearGradient",{id:"a",children:[(0,Tt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,Tt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,Tt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,Tt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,Tt.jsx)("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"}),(0,Tt.jsx)("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"})]}),(0,Tt.jsx)("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)"}),(0,Tt.jsx)("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)"}),(0,Tt.jsx)("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"})]})}var Aa=require("react/jsx-runtime");function ol({style:e,...t}){return(0,Aa.jsx)("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:(0,Aa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Aa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Aa.jsx)("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"})})})})}var Ra=require("react/jsx-runtime");function nl(e){return(0,Ra.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,Ra.jsx)("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"}),(0,Ra.jsx)("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"})]})}var vi=require("react/jsx-runtime");function il(e){return(0,vi.jsxs)("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:[(0,vi.jsx)("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"}),(0,vi.jsx)("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"}),(0,vi.jsx)("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"})]})}var Cd=require("react/jsx-runtime"),al=({style:e,...t})=>(0,Cd.jsx)("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:(0,Cd.jsx)("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 k0={google:{name:"Google",component:tl},discord:{name:"Discord",component:Xs},github:{name:"Github",component:el},linkedin:{name:"LinkedIn",component:ol},twitter:{name:"Twitter",component:al},spotify:{name:"Spotify",component:nl},instagram:{name:"Instagram",component:rl},tiktok:{name:"Tiktok",component:il},apple:{name:"Apple",component:Qs}},Ia=e=>k0[e];function fm(e,t){let r={detail:"",retryable:!1},o=gd(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=Ia(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Ia(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ma(){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:Js(),popupFlow:window.opener!==null}}function zn(){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"),ne.del(Fn),window.history.replaceState({},"",e)}var qn=class{constructor(t){this.initAuthenticateOnce=new ot(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new ot(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new P("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new P("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 P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("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(Au,{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 P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):he(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("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(ku,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):he(r)}}async _initAuthenticateOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(xu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(_u,{})}_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 $n=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ "use strict";var f0=Object.create;var _s=Object.defineProperty;var h0=Object.getOwnPropertyDescriptor;var y0=Object.getOwnPropertyNames;var g0=Object.getPrototypeOf,v0=Object.prototype.hasOwnProperty;var C0=(e,t)=>{for(var r in t)_s(e,r,{get:t[r],enumerable:!0})},Yp=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y0(t))!v0.call(e,n)&&n!==r&&_s(e,n,{get:()=>t[n],enumerable:!(o=h0(t,n))||o.enumerable});return e};var h=(e,t,r)=>(r=e!=null?f0(g0(e)):{},Yp(t||!e||!e.__esModule?_s(r,"default",{value:e,enumerable:!0}):r,e)),w0=e=>Yp(_s({},"__esModule",{value:!0}),e);var id=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Zp=(e,t,r)=>(id(e,t,"read from private field"),r?r.call(e):t.get(e)),xs=(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)},ad=(e,t,r,o)=>(id(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Jp=(e,t,r)=>(id(e,t,"access private method"),r);var A5={};C0(A5,{AsExternalProvider:()=>to,Captcha:()=>Ll,ConnectorManager:()=>Ai,PrivyClient:()=>Ii,PrivyProvider:()=>O3,PrivyProxyProvider:()=>Je,SUPPORTED_CHAINS:()=>xi,VERSION:()=>qs,WalletConnector:()=>Xt,addRpcUrlOverrideToChain:()=>c0,errorIndicatesMaxMfaRetries:()=>tc,errorIndicatesMfaTimeout:()=>yn,errorIndicatesMfaVerificationFailed:()=>gn,getAccessToken:()=>Ae,useConnectWallet:()=>$3,useCreateWallet:()=>j3,useExperimentalFarcasterSigner:()=>l0,useFundWallet:()=>Y3,useLinkAccount:()=>z3,useLogin:()=>D3,useLoginWithEmail:()=>H3,useLoginWithOAuth:()=>B3,useLoginWithSms:()=>G3,useLogout:()=>F3,useMfa:()=>la,useMfaEnrollment:()=>Yr,useModalStatus:()=>i0,usePrivy:()=>H,useRegisterMfaListener:()=>Fl,useSendTransaction:()=>J3,useSetWalletPassword:()=>X3,useSignMessage:()=>t0,useSignTypedData:()=>o0,useToken:()=>s0,useWallets:()=>ga});module.exports=w0(A5);var Ps=require("@ethersproject/address"),td=require("@ethersproject/providers"),R3=require("mipd"),le=require("react");var Qp=require("ofetch"),dt=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}]`:""}`}},Xr=class extends dt{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},T=class extends dt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ks=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var de=class extends dt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},he=e=>{if(e instanceof dt)return e;if(!(e instanceof Qp.FetchError))return Nt(e);if(!e.response)return new Xr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Xr(t||"ApiError",e.response.status,r||o,e,n)},Nt=e=>e instanceof dt?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var vo=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Qt=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},As=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ur=class extends T{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 Rs="/api/v1/sessions",Is="/api/v1/sessions/logout",Xp="/api/v1/sessions/fork",Ms="/api/v1/sessions/fork/recover",eu="/api/v1/siwe/init",tu="/api/v1/siwe/authenticate",ru="/api/v1/siwe/link",ou="/api/v1/siwe/unlink",nu="/api/v1/farcaster/init",iu="/api/v1/farcaster/authenticate",au="/api/v1/farcaster/link",su="/api/v1/farcaster/status",lu="/api/v1/farcaster/unlink",cu="/api/v1/passwordless/init",du="/api/v1/passwordless/authenticate",pu="/api/v1/passwordless/link",uu="/api/v1/passwordless/unlink",mu="/api/v1/passwordless/update",fu="/api/v1/passwordless_sms/init",hu="/api/v1/passwordless_sms/link",yu="/api/v1/passwordless_sms/unlink",gu="/api/v1/passwordless_sms/authenticate",vu="/api/v1/oauth/init",Cu="/api/v1/oauth/authenticate",wu="/api/v1/oauth/link",bu="/api/v1/oauth/unlink",Eu="/api/v1/recovery/oauth/init",Pu="/api/v1/recovery/oauth/init_icloud",Tu="/api/v1/recovery/oauth/authenticate",Su="/api/v1/passkeys/link/init",_u="/api/v1/passkeys/authenticate/init",xu="/api/v1/passkeys/link",ku="/api/v1/passkeys/authenticate",Au="/api/v1/passkeys/unlink",Ru="/api/v1/telegram/authenticate",Iu="/api/v1/telegram/link",Mu="/api/v1/telegram/unlink";var Wu="/api/v1/mfa/passwordless_sms/init",Lu="/api/v1/mfa/passkeys/init",Ou="/api/v1/users/me/accept_terms",Ws="/api/v1/analytics_events",Nu="/api/v1/plugins/moonpay_on_ramp/sign",Du="/api/v1/custom_jwt_account/authenticate";var mi=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(Du,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw he(t)}}async link(){throw new Error("Unimplemented")}};var sn=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(du,{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 he(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(pu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw he(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(cu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw he(o)}}},Ls=class extends sn{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(mu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw he(r)}}};var zs=require("react-device-detect");var sd=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)}},Os=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 ld(){try{let e="privy:__session_storage__test",t="blobby",r=new Os;return r.put(e,t),r.del(e),!0}catch{return!1}}function b0(){return typeof window<"u"&&window.localStorage?new Os:new sd}var ne=b0();var fi=require("@ethersproject/providers");function Uu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ns=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 cd=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ns(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!cd(r))return!1}return!0},ln=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fu=()=>{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 Bu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Ds=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Hu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},cn=(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}`},dd=e=>new Promise(t=>setTimeout(t,e));function Gu(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 Vu=(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 dd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Us=(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 zu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Nn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function qu(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 Uu()){let u=Ns(c);if(!l.some(f=>f.info.name===u)){if(cd(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 hi(e){return`eip155:${String(Number(e))}`}var Fs=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`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 de(`No RPC url found for ${e}`);return a},$u=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new de(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Uo=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new fi.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new fi.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new fi.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new fi.StaticJsonRpcProvider(i.rpcUrls.public.http[0]):a=new fi.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new de(`No RPC url found for ${e}`);return a},Bs=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 Hs=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Gs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Gs={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 E0(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Ku(e,t){let r=E0(t);if(r.deepLink)return Qu(r.deepLink,e);if(r.universalLink)return Xu(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var ju="WALLETCONNECT_DEEPLINK_CHOICE";function Yu(){try{localStorage.removeItem(ju)}catch{}}function Zu({href:e,name:t}){try{localStorage.setItem(ju,JSON.stringify({href:e,name:t}))}catch{}}function Ju(e){return e.startsWith("http://")||e.startsWith("https://")}function Qu(e,t){if(Ju(e))return Xu(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 Xu(e,t){if(!Ju(e))return Qu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Vs(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 Ea=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(iu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("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 he(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(au,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw he(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(nu,{token:this.captchaToken});zs.isMobile&&!zs.isIOS&&t.connect_uri&&Vs(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(su,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var em="1.66.1-beta-20240523195529";var tm="34357d3c125c2bcf2ce2bc3309d98715",Pa="https://auth.privy.io",rm=2e4,Xe=1400,om=2500,qs=em;var Dn="privy:token",pd="privy-token",$s="privy:refresh_token";var Ks="privy-session",Ta="privy:session_transfer_token",T0="privy:wallet",Sa="privy:caid",Un="privy:state_code",Fn="privy:code_verifier",Bn="privy:headless_oauth",js=e=>`${T0}:${e}`,ud="privy:connectors",md="privy:connections";var Hn=12e4,Fo=1,fd="0x1",yi=3e4,nm="https://api.moonpay.com/v1",im="https://api.moonpay.com/v1",am="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",sm="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",lm="0x420000000000000000000000000000000000000F",cm=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var hd=require("jose");async function dm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function pm(e){return crypto.getRandomValues(new Uint8Array(e))}var S0="S256",_0="S256";function _a(){return hd.base64url.encode(pm(36))}function Ys(){return _a()}async function Zs(e,t=S0){if(t==_0){let r=await dm(e);return hd.base64url.encode(r)}else return e}function um(){let e=ne.get(Fn);if(!e)throw new T("Authentication error.");return e}function Js(){return!!ne.get(Bn)}var Co=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Js();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 T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=um();try{let r=await this.api.post(Cu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ne.del(Fn),this.meta.headless&&ne.del(Bn),{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=he(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=ne.get(Fn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(wu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ne.del(Fn),r}catch(r){throw he(r)}}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=_a();ne.put(Fn,t);let r=Ys();ne.put(Un,r);let o=await Zs(t);this.meta.headless&&ne.put(Bn,!0);try{return await this.api.post(vu,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw he(n)}}};function yd(e){return e.charAt(0).toUpperCase()+e.slice(1)}var xa=require("react/jsx-runtime"),Qs=({style:e,...t})=>(0,xa.jsxs)("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:[(0,xa.jsx)("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"}),(0,xa.jsx)("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"})]});var dn=require("react/jsx-runtime"),Xs=({style:e,...t})=>(0,dn.jsxs)("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:[(0,dn.jsx)("g",{clipPath:"url(#clip0)",children:(0,dn.jsx)("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"})}),(0,dn.jsx)("defs",{children:(0,dn.jsx)("clipPath",{id:"clip0",children:(0,dn.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var gd=require("react/jsx-runtime"),el=({style:e,...t})=>(0,gd.jsx)("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:(0,gd.jsx)("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"})});var Gn=require("react/jsx-runtime"),tl=({style:e,...t})=>(0,Gn.jsxs)("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:[(0,Gn.jsx)("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"}),(0,Gn.jsx)("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"}),(0,Gn.jsx)("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"}),(0,Gn.jsx)("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"})]});var Tt=require("react/jsx-runtime");function rl(e){return(0,Tt.jsxs)("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:[(0,Tt.jsxs)("defs",{children:[(0,Tt.jsxs)("linearGradient",{id:"b",children:[(0,Tt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,Tt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,Tt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,Tt.jsxs)("linearGradient",{id:"a",children:[(0,Tt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,Tt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,Tt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,Tt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,Tt.jsx)("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"}),(0,Tt.jsx)("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"})]}),(0,Tt.jsx)("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)"}),(0,Tt.jsx)("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)"}),(0,Tt.jsx)("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"})]})}var ka=require("react/jsx-runtime");function ol({style:e,...t}){return(0,ka.jsx)("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:(0,ka.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,ka.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,ka.jsx)("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"})})})})}var Aa=require("react/jsx-runtime");function nl(e){return(0,Aa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,Aa.jsx)("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"}),(0,Aa.jsx)("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"})]})}var gi=require("react/jsx-runtime");function il(e){return(0,gi.jsxs)("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:[(0,gi.jsx)("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"}),(0,gi.jsx)("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"}),(0,gi.jsx)("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"})]})}var vd=require("react/jsx-runtime"),al=({style:e,...t})=>(0,vd.jsx)("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:(0,vd.jsx)("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 x0={google:{name:"Google",component:tl},discord:{name:"Discord",component:Xs},github:{name:"Github",component:el},linkedin:{name:"LinkedIn",component:ol},twitter:{name:"Twitter",component:al},spotify:{name:"Spotify",component:nl},instagram:{name:"Instagram",component:rl},tiktok:{name:"Tiktok",component:il},apple:{name:"Apple",component:Qs}},Ra=e=>x0[e];function mm(e,t){let r={detail:"",retryable:!1},o=yd(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=Ra(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Ra(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ia(){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:Js(),popupFlow:window.opener!==null}}function Vn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),ne.del(Un),window.history.replaceState({},"",e)}var zn=class{constructor(t){this.initAuthenticateOnce=new ot(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new ot(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("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 T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("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(ku,{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 T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):he(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("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(xu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):he(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(_u,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Su,{})}_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 qn=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 ot(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 P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(ru,{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 he(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(ou,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw he(t)}}async sign(){if(!this.api)throw new P("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new P("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 P("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(tu,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new P("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 Kn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(vu,{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 he(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(yu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw he(t)}}async sendSmsCode(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new P("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(hu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw he(o)}}};var Wa=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(Iu,{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 he(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(Mu,{telegram_auth_result:this.meta.telegramAuthResult})}catch(t){throw he(t)}}};function wd(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}var cf=require("uuid");function X(e){return e?new Date(e*1e3):null}function A0(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:"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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let C={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(C);break;case"apple_oauth":let v={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let x={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(x);break;case"passkey":let S={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(S);break;case"telegram":let b={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:X(r.first_verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(b);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function lr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Ue=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported)||null,Ci=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported)||null,R0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),cr=(e,t)=>t==="all-users"&&!Ue(e)||t==="users-without-wallets"&&!R0(e)?.length;function Sr(e){if(!e)return null;let t=A0(e.linked_accounts),r=lr(t,"wallet"),o=lr(t,"email"),n=lr(t,"phone"),i=lr(t,"google_oauth"),a=lr(t,"twitter_oauth"),l=lr(t,"discord_oauth"),s=lr(t,"github_oauth"),c=lr(t,"spotify_oauth"),u=lr(t,"instagram_oauth"),f=lr(t,"tiktok_oauth"),y=lr(t,"linkedin_oauth"),g=lr(t,"apple_oauth"),C=lr(t,"farcaster"),v=lr(t,"telegram"),x=e.mfa_methods.map(({type:b,verified_at:R})=>({type:b,verifiedAt:X(R)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:g&&{subject:g.subject,email:g.email},farcaster:C&&{fid:C.fid,ownerAddress:C.ownerAddress,displayName:C.displayName,username:C.username,bio:C.bio,pfp:C.pfp,url:C.url,signerPublicKey:C.signerPublicKey},telegram:v&&{telegramUserId:v.telegramUserId,firstName:v.firstName,lastName:v.lastName,username:v.username,photoUrl:v.photoUrl},mfaMethods:x.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var kd=require("@ethersproject/address"),rf=require("@ethersproject/bytes"),of=h(require("eventemitter3"));var Pm=h(require("@coinbase/wallet-sdk"));var La=require("react/jsx-runtime"),sl=({style:e,...t})=>(0,La.jsxs)("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:[(0,La.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,La.jsx)("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"})]});var ro=require("@ethersproject/address"),bd=require("@ethersproject/providers"),Em=h(require("eventemitter3"));var gm=h(require("eventemitter3"));var I0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],hm=e=>I0.includes(e);var ym=require("@ethersproject/logger");var wi=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},bi=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},eo=e=>{if(e instanceof de)return e;if(e?.code&&e?.reason){let t=new nt(e);return e.code===ym.ErrorCode.ACTION_REJECTED&&(t.details=Dt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new nt(e):new de("Unknown connector error",e)},_r=class extends ct{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},nt=class extends _r{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Dt).find(i=>i.eipCode===o.code);this.details=n||Dt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Dt.E32002_CONNECTION_ALREADY_PENDING:this.details=Dt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Dt.E32002_WALLET_LOCKED))}},M0={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}},W0={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}},L0={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}},Dt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...L0,...W0},Bo={...M0,...Dt};var Ze=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 wi,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||Gn,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 de(`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 eo(r)})}},pn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Oa=class extends gm.default{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=Uo(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Ei(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new pn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ke()||!this.address)throw new pn("Disconnected",4900);return(await wm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new pn(`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 pn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Uo(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 vm(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 Cm(Bs(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:Dn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(i){throw console.warn(`Gas estimation failed with error: ${i} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Dn(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(hm(r.method)){let o=await ke();if(await bm(),!o||!this.address)throw new pn("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 pn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ke();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}}},to=class extends Ze{constructor(r){super(r,r.rpcTimeoutDuration)}},un=class extends Ze{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 O0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Xt=class extends Em.default{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=yi(r),this.walletClientType==="privy"&&ne.put(js(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=Ei(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>(0,ro.getAddress)(l.address)===(0,ro.getAddress)(r));return{address:(0,ro.getAddress)(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new de("Wallet is not currently connected.");let s=this.wallets.find(g=>(0,ro.getAddress)(g.address)===(0,ro.getAddress)(r))?.chainId;if(!s)throw new de("Unable to determine current chainId.");let c,u;if(typeof l=="number"?(c=`0x${l.toString(16)}`,u=l):(c=l,u=Number(l)),s===yi(c))return;let f=this.chains.find(g=>g.id===u);if(!f)throw new de(`Unsupported chainId: ${l}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await y()}catch(g){if(O0(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),y();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new de(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return new bd.Web3Provider(new to(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return new un(this.proxyProvider)},sign:async l=>{if(!await a())throw new de("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await 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=(0,ro.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=ne.get(js(i));this.chains.find(u=>u.id===Number(c))||(ne.del(js(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 ${hd}`,c),l=hd}let s=yi(l);if(!a.find(c=>(0,ro.getAddress)(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((0,ro.getAddress)(n),s,c,this.connectorType==="embedded_imported"))}ll(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=>(0,ro.getAddress)(n)===(0,ro.getAddress)(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 bd.Web3Provider(new to(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 Pi={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 N0=(e,t)=>{let o=Fs(1,[Pi],{},t);return e.makeWeb3Provider(o,1)},cl,dl=class extends Xt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;cl||(cl=new Pm.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(N0(cl,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(){cl.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:sl,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 de("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}};var Ed=require("react/jsx-runtime"),pl=({...e})=>(0,Ed.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Ed.jsx)("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 Na=class extends Xt{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Dn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:pl,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var Pd=require("react/jsx-runtime"),Ti=({style:e,...t})=>(0,Pd.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,Pd.jsx)("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"})});var zt=require("react/jsx-runtime"),Si=({style:e,...t})=>(0,zt.jsxs)("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:[(0,zt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,zt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"}),(0,zt.jsx)("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"})]});var Da=require("react/jsx-runtime"),wo=({style:e,...t})=>(0,Da.jsxs)("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:[(0,Da.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Da.jsx)("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 xi=class extends Xt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Ze(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 de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}},_i,ki=class extends Xt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";xs(this,_i,void 0);this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?ad(this,_i,{name:"MetaMask",icon:Si,id:"io.metamask"}):a==="phantom"&&ad(this,_i,{name:"Phantom",icon:wo,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 Jp(this,_i)??{name:"Browser Extension",icon:Ti,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 de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}};_i=new WeakMap;var D0=require("@ethersproject/address"),U0=require("@ethersproject/providers"),Tm=require("react-device-detect");var ul=class extends xi{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{Tm.isMobile||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 de("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw eo(t)}}};var ml=class extends Xt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Ze(void 0,Gn);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 fl=class extends ml{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:wo,id:"phantom"}}};var Ri=require("@walletconnect/ethereum-provider"),tf=require("react-device-detect");var Fr=require("react");var Sm=require("react/jsx-runtime");function hl({src:e,...t}){return(0,Sm.jsx)("img",{src:e,...t,style:{display:"none"}})}var bo=require("react"),Ym=require("react");var xr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:rm,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var _m=({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 F0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),xm=e=>F0.has(e),km=(e,t,r)=>r.indexOf(e)===t,Am=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(xm).filter(km):e?e.filter(xm).filter(km):xr.appearance.walletList;var yl={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 gl={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 vl={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 Rm={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 Im={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 Cl={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 wl={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 bl={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 Mm={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 Wm={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 Lm={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 Om={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 Nm={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 Dm={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 Um={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 Fm={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 Bm={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 Hm={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 El={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 Pl={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 Tl={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 Ua={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 Fa={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 Gm={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 Vm={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 zm={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 Sl={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 _l={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 xl={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 Ai=[yl,gl,vl,Um,zm,Pi,El,Pl,Tl,Ua,Fa,Wm,Lm,Om,Nm,Cl,wl,bl,Mm,Bm,Hm,Rm,Im,Sl,xl,_l,Fm,Gm,Dm,Vm],S8=new Set(Ai.map(e=>e.id));var mn=h(require("tinycolor2")),qm="#FFFFFF",B0="#000000",H0=qm,G0="#1E1E1D";function V0(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 Ho(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,mn.default)({...e.toHsl(),l:r})}function $m({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=qm,blackHex:a=B0}){let l;switch(e){case"light":l=H0;break;case"dark":l=G0;break;default:l=e;break}let s=(0,mn.default)(l),c=(0,mn.default)(t),u=(0,mn.default)(r),f=(0,mn.default)(o),y=(0,mn.default)(n),g=V0(s.getLuminance()),C=Ho(s,g==="light"?-.04:.11),v=Ho(s,g==="light"?-.88:.87),x=Ho(s,g==="light"?-.77:.75),S=Ho(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=Ho(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Ho(c,.15),A=Ho(c,-.06),O=Ho(y,.3),M=(0,mn.default)(c.getLuminance()>.5?a:i),I=Ho(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:C.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:S.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:R.toHslString(),accentDark:A.toHslString(),foregroundAccent:M.toHslString(),success:u.toHslString(),successDark:I.toHslString(),error:y.toHslString(),errorLight:O.toHslString(),warn:f.toHslString()}}function Td(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,u,f,y,g,C,v,x,S,b;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"),y=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),v=t.loginMethods.includes("github"),C=t.loginMethods.includes("linkedin"),x=t.loginMethods.includes("apple"),S=t.loginMethods.includes("farcaster"),b=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,v=e.githubOAuth,y=e.spotifyOAuth,g=e.instagramOAuth,f=e.tiktokOAuth,C=e.linkedinOAuth,x=e.appleOAuth,S=e.farcasterAuth,b=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let R=[n,i].filter(Boolean),A=[s,c,u,v,y,g,f,C,x,S,b].filter(Boolean),O=[l].filter(Boolean);if(R.length+A.length+O.length===0)throw new Error("You must enable at least one login method");let M=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;M&&O.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&A.length+R.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let I=Am({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),V=_m({input:t?.loginMethodsAndOrder}),Z=t?.intl?.defaultCountry??"US",{chains:ee,defaultChain:L}=z0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),Y=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,be,ve=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?D?be=t?.embeddedWallets?.noPromptOnSignature??!0:be=t?.embeddedWallets?.noPromptOnSignature??ve:be=ve,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&be!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Ce,...Le}=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??xr.appearance.landingHeader,palette:$m({backgroundTheme:t?.appearance?.theme??xr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??xr.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:I},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:u,github:v,spotify:y,instagram:g,tiktok:f,linkedin:C,apple:x,farcaster:S,telegram:b},loginMethodsAndOrder:V,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??xr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??xr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??xr.rpcConfig.rpcTimeouts},chains:ee,defaultChain:L,intl:{defaultCountry:Z},shouldEnforceDefaultChainOnConnect:Y,captchaEnabled:e.captchaEnabled??xr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof Ce=="boolean"?{requireUserOwnedRecoveryOnCreate:Ce}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Le,noPromptOnSignature:be},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??xr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??xr._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??xr._render.inParentNodeId}}}function Km(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 z0({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:Ai.find(u=>u.id===s.id)??s)}else n=Ai.concat(e??[]);let i=t?n[0]:Pi,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 jm=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)};var Qm=require("react/jsx-runtime"),Zm={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Sd=Td(Zm,void 0,!1),_d=(0,Ym.createContext)({appConfig:Sd,isServerConfigLoaded:!1}),Jm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,bo.useState)(null),a=(0,bo.useMemo)(()=>Td(n??Zm,o,!!n),[n,o]);return(0,bo.useEffect)(()=>{if(!n)return;let l=Km(o,t),s=jm(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]),(0,bo.useEffect)(()=>{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)}})()},[]),(0,Qm.jsx)(_d.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},dr=()=>{let{appConfig:e}=(0,bo.useContext)(_d);return e},kl=()=>{let{isServerConfigLoaded:e}=(0,bo.useContext)(_d);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Al=require("react/jsx-runtime"),Xm=(0,Fr.createContext)({ready:!1,app:Sd,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),q0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],ef=e=>{let t=dr(),r=e.authenticated,[o,n]=(0,Fr.useState)(e.initialScreen);(0,Fr.useEffect)(()=>{!r&&!q0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,Fr.useRef)(null);(0,Fr.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,Fr.useEffect)(()=>{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(0,Al.jsxs)(Xm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Al.jsx)(hl,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},k=()=>(0,Fr.useContext)(Xm);var Go=require("react/jsx-runtime"),Ba=({style:e,...t})=>{let{app:r}=k();return(0,Go.jsxs)("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:[(0,Go.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Go.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Go.jsx)("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"})}),(0,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Go.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Eo=class extends Xt{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 Ze(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Gs[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=Hs(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:Si,id:"io.metamask"}:{name:qu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Ba,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=Gs[r],this.walletClientType=r,this.redirectUri=void 0,Zu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new bi)};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 de("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Hs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Ei(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(eo(a));return}o(new de("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=Fs(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 Ri.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Ri.OPTIONAL_EVENTS,optionalMethods:Ri.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),tf.isMobile&&this.walletEntry){let{redirect:l,href:s}=ju(a,this.walletEntry);Ju({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Vs(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=Hs(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 Ad=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,rf.isHexString)(o)).map(o=>(0,kd.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Ei=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Gn:Gn,Ii=class extends of.default{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 Ze: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=xd()}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;ne.get(md)&&(ne.getKeys().forEach(o=>{o.startsWith("walletconnect")&&ne.del(o)}),ne.del(md));let r=$u(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"),!ln()&&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 Oa(r,o,this.rpcConfig,this.chains,i,n.id),s=new Na(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new Oa(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new Na(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=xd(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=xd(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Eo&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ul(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new ki(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new ki(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new ki(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new xi(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new dl(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new fl(this.defaultChain):new Eo(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}));ne.put(fd,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=(0,kd.getAddress)(r),this.emit("walletsUpdated")}};function ll(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 $0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",xd=()=>{let e=ne.get(fd);return e&&Array.isArray(e)&&e.map(o=>$0(o)).every(Boolean)?e:[]};var nf=require("ofetch");var K0=[Rs,Ms,Is,Ws],Rl=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=qs,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=nf.ofetch.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=K0.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 ks}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw he(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw he(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw he(o)}}};var af=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});var fn=h(require("js-cookie"));function sf(e){return e instanceof sn?"email":e instanceof Kn?"sms":e instanceof $n?"siwe":e instanceof fi?"custom_auth":e instanceof Co?e.meta.provider:null}var lf=h(require("jose")),Po=class{static parse(t){try{return new Po(t)}catch{return null}}constructor(t){this.value=t,this._decoded=lf.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 j0=30,Il=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=ne.get(Un);return typeof t=="string"?new Po(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ne.get($s);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ne.get(Sa);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=fn.default.get(Ks);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=Po.parse(this.token);return t!==null&&!t.isExpired(j0)}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=sf(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:Sr(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),Nt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_provider_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,scopes:o.scopes}:void 0;return{user:Sr(r),oAuthProviderTokens:n}}catch(r){throw console.warn("Error linking account"),Nt(r)}}async _refresh(){if(!this.api)throw new P("Session has no API instance");if(!this.client)throw new P("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(Rs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ms,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Sr(n.user)}catch(n){if(n instanceof Xr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Nt(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(Is,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new P("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(eu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw Nt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=ne.get(Un);if(ne.put(Un,t),!this.client?.useServerCookies){let o=Po.parse(t)?.expiration;fn.default.set(pd,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else ne.del(Un),fn.default.remove(pd),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(ne.put($s,t),this.client?.useServerCookies||(fn.default.set(Ks,"t",{sameSite:"Strict",secure:!0,expires:30}),fn.default.set(ud,t,{sameSite:"Strict",secure:!0,expires:30}))):(ne.del($s),fn.default.remove(ud),fn.default.remove(Ks))}clearForkedToken(){ne.del(Sa)}};var Rd,Ml,df,Mi=class{constructor(t){xs(this,Ml);this.apiUrl=t.apiUrl||Ta,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||om,this.appId=t.appId,this.clientAnalyticsId=Qp(this,Ml,df).call(this),Rd||(Rd=new Il),this.session=Rd,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 Ii(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Rl(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 P("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new P("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(Lu,{action:"verify"})}catch(t){throw he(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Ou,{});return af(t.options)}catch(t){throw he(t)}}async unlinkEmail(t){try{let r=await this.api.post(mu,{address:t});return Sr(r)}catch(r){throw Nt(r)}}async acceptTerms(){try{let t=await this.api.post(Nu,{});return Sr(t)}catch(t){throw Nt(t)}}async unlinkPhone(t){try{let r=await this.api.post(gu,{phoneNumber:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkWallet(t){try{let r=await this.api.post(nu,{address:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Eu,{provider:t,subject:r});return Sr(o)}catch(o){throw Nt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(cu,{fid:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Wu,{telegram_user_id:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Ru,{credential_id:t});return Sr(r)}catch(r){throw Nt(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(Ws,{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(Du,t)}catch(r){throw Nt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Po.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 Nt(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()}};Ml=new WeakSet,df=function(){if(typeof window>"u")return null;try{let r=ne.get(_a);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,cf.v4)();try{return ne.put(_a,t),t}catch{return t}};var ff=require("@marsidev/react-turnstile"),Wl=require("react");var Br=require("react");var mf=require("react/jsx-runtime"),pf=(0,Br.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),oo=class extends ct{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},uf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,Br.useRef)(null),[i,a]=(0,Br.useState)(),[l,s]=(0,Br.useState)(),[c,u]=(0,Br.useState)(!1),f=(0,Br.useMemo)(()=>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(0,mf.jsx)(pf.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 Vu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new oo("Captcha failed",null,"captcha_timeout")}}},children:e})},Pe=()=>(0,Br.useContext)(pf);var Id=require("react/jsx-runtime"),Ll=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Pe(),[,s]=(0,Wl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Wl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Id.jsx)("div",{className:"hidden h-0 w-0",children:(0,Id.jsx)(ff.Turnstile,{...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")}}})})};var on=require("react"),P3=h(require("react-dom"));var Ol=require("react");var Md=(0,Ol.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E}),W=()=>(0,Ol.useContext)(Md);var Nl=require("react");var Ae=(0,Nl.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>(0,Nl.useContext)(Ae);var Dl=require("react"),hf=e=>{let[t,r]=(0,Dl.useState)("auto");return(0,Dl.useEffect)(()=>{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};var Wi=require("react"),yf={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:[]}},Wd=(0,Wi.createContext)(void 0),gf=()=>(0,Wi.useContext)(Wd);function it(e,t){if(!t)return;let o=gf().current[e];return(0,Wi.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function F(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Ul(){let e=gf();return(t,r,...o)=>F(e,t,r,...o)}function Fl(e){it("configureMfa",e)}var Fd=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Sf=h(require("@heroicons/react/24/solid/DocumentCheckIcon")),_f=h(require("styled-components"));var Hr=h(require("styled-components"));var Bl=h(require("styled-components")),hn=require("react/jsx-runtime"),St=({success:e,fail:t})=>(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(_t,{className:e?"success":t?"fail":""}),(0,hn.jsx)(Ld,{className:e?"success":t?"fail":""})]}),_t=Bl.default.span`
12
+ - https://privy.io`;this.getNonceOnce=new ot(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 T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(tu,{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 he(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(ru,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw he(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("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 T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(eu,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("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 $n=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(gu,{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 he(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(hu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw he(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(fu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw he(o)}}};var Ma=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(Ru,{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 he(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Iu,{telegram_auth_result:this.meta.telegramAuthResult})}catch(t){throw he(t)}}};function Cd(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}var lf=require("uuid");function X(e){return e?new Date(e*1e3):null}function k0(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:"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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(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:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let C={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(C);break;case"apple_oauth":let v={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let x={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(x);break;case"passkey":let S={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(S);break;case"telegram":let b={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:X(r.first_verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(b);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function lr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Fe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported)||null,Wa=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported)||null,A0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),cr=(e,t)=>t==="all-users"&&!Fe(e)||t==="users-without-wallets"&&!A0(e)?.length;function Sr(e){if(!e)return null;let t=k0(e.linked_accounts),r=lr(t,"wallet"),o=lr(t,"email"),n=lr(t,"phone"),i=lr(t,"google_oauth"),a=lr(t,"twitter_oauth"),l=lr(t,"discord_oauth"),s=lr(t,"github_oauth"),c=lr(t,"spotify_oauth"),u=lr(t,"instagram_oauth"),f=lr(t,"tiktok_oauth"),y=lr(t,"linkedin_oauth"),g=lr(t,"apple_oauth"),C=lr(t,"farcaster"),v=lr(t,"telegram"),x=e.mfa_methods.map(({type:b,verified_at:R})=>({type:b,verifiedAt:X(R)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:g&&{subject:g.subject,email:g.email},farcaster:C&&{fid:C.fid,ownerAddress:C.ownerAddress,displayName:C.displayName,username:C.username,bio:C.bio,pfp:C.pfp,url:C.url,signerPublicKey:C.signerPublicKey},telegram:v&&{telegramUserId:v.telegramUserId,firstName:v.firstName,lastName:v.lastName,username:v.username,photoUrl:v.photoUrl},mfaMethods:x.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var xd=require("@ethersproject/address"),tf=require("@ethersproject/bytes"),rf=h(require("eventemitter3"));var Em=h(require("@coinbase/wallet-sdk"));var La=require("react/jsx-runtime"),sl=({style:e,...t})=>(0,La.jsxs)("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:[(0,La.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,La.jsx)("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"})]});var ro=require("@ethersproject/address"),wd=require("@ethersproject/providers"),bm=h(require("eventemitter3"));var ym=h(require("eventemitter3"));var R0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fm=e=>R0.includes(e);var hm=require("@ethersproject/logger");var vi=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},Ci=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},eo=e=>{if(e instanceof de)return e;if(e?.code&&e?.reason){let t=new nt(e);return e.code===hm.ErrorCode.ACTION_REJECTED&&(t.details=Dt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new nt(e):new de("Unknown connector error",e)},_r=class extends dt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},nt=class extends _r{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Dt).find(i=>i.eipCode===o.code);this.details=n||Dt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Dt.E32002_CONNECTION_ALREADY_PENDING:this.details=Dt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Dt.E32002_WALLET_LOCKED))}},I0={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}},M0={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}},W0={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}},Dt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...W0,...M0},Bo={...I0,...Dt};var Je=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new vi,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||Hn,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 de(`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 eo(r)})}},pn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Oa=class extends ym.default{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=Uo(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=wi(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new pn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ae()||!this.address)throw new pn("Disconnected",4900);return(await Cm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new pn(`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 pn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Uo(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await gm(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await vm(Bs(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:Nn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(i){throw console.warn(`Gas estimation failed with error: ${i} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Nn(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(fm(r.method)){let o=await Ae();if(await wm(),!o||!this.address)throw new pn("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 pn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ae();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}}},to=class extends Je{constructor(r){super(r,r.rpcTimeoutDuration)}},un=class extends Je{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var L0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Xt=class extends bm.default{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=hi(r),this.walletClientType==="privy"&&ne.put(js(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=wi(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>(0,ro.getAddress)(l.address)===(0,ro.getAddress)(r));return{address:(0,ro.getAddress)(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new de("Wallet is not currently connected.");let s=this.wallets.find(g=>(0,ro.getAddress)(g.address)===(0,ro.getAddress)(r))?.chainId;if(!s)throw new de("Unable to determine current chainId.");let c,u;if(typeof l=="number"?(c=`0x${l.toString(16)}`,u=l):(c=l,u=Number(l)),s===hi(c))return;let f=this.chains.find(g=>g.id===u);if(!f)throw new de(`Unsupported chainId: ${l}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await y()}catch(g){if(L0(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),y();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new de(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return new wd.Web3Provider(new to(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new de("Wallet is not currently connected.");return new un(this.proxyProvider)},sign:async l=>{if(!await a())throw new de("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await 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=(0,ro.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=ne.get(js(i));this.chains.find(u=>u.id===Number(c))||(ne.del(js(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 ${fd}`,c),l=fd}let s=hi(l);if(!a.find(c=>(0,ro.getAddress)(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((0,ro.getAddress)(n),s,c,this.connectorType==="embedded_imported"))}ll(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=>(0,ro.getAddress)(n)===(0,ro.getAddress)(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 wd.Web3Provider(new to(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 bi={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 O0=(e,t)=>{let o=Fs(1,[bi],{},t);return e.makeWeb3Provider(o,1)},cl,dl=class extends Xt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;cl||(cl=new Em.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(O0(cl,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(){cl.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:sl,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 de("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}};var bd=require("react/jsx-runtime"),pl=({...e})=>(0,bd.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,bd.jsx)("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 Na=class extends Xt{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Nn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:pl,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var Ed=require("react/jsx-runtime"),Ei=({style:e,...t})=>(0,Ed.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,Ed.jsx)("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"})});var Vt=require("react/jsx-runtime"),Pi=({style:e,...t})=>(0,Vt.jsxs)("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:[(0,Vt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,Vt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"}),(0,Vt.jsx)("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"})]});var Da=require("react/jsx-runtime"),wo=({style:e,...t})=>(0,Da.jsxs)("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:[(0,Da.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Da.jsx)("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 Si=class extends Xt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}},Ti,_i=class extends Xt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";xs(this,Ti,void 0);this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?ad(this,Ti,{name:"MetaMask",icon:Pi,id:"io.metamask"}):a==="phantom"&&ad(this,Ti,{name:"Phantom",icon:wo,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 Zp(this,Ti)??{name:"Browser Extension",icon:Ei,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 de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw eo(r)}}};Ti=new WeakMap;var N0=require("@ethersproject/address"),D0=require("@ethersproject/providers"),Pm=require("react-device-detect");var ul=class extends Si{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{Pm.isMobile||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 de("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw eo(t)}}};var ml=class extends Xt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Je(void 0,Hn);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 fl=class extends ml{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:wo,id:"phantom"}}};var ki=require("@walletconnect/ethereum-provider"),ef=require("react-device-detect");var Fr=require("react");var Tm=require("react/jsx-runtime");function hl({src:e,...t}){return(0,Tm.jsx)("img",{src:e,...t,style:{display:"none"}})}var bo=require("react"),jm=require("react");var xr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:tm,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Sm=({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 U0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),_m=e=>U0.has(e),xm=(e,t,r)=>r.indexOf(e)===t,km=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(_m).filter(xm):e?e.filter(_m).filter(xm):xr.appearance.walletList;var yl={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 gl={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 vl={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 Am={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 Rm={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 Cl={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 wl={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 bl={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 Im={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 Mm={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var Wm={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var Lm={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 Om={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 Nm={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 Dm={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 Um={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 Fm={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 Bm={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 El={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 Pl={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 Tl={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 Ua={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 Fa={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 Hm={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 Gm={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 Vm={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 Sl={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 _l={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 xl={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 xi=[yl,gl,vl,Dm,Vm,bi,El,Pl,Tl,Ua,Fa,Mm,Wm,Lm,Om,Cl,wl,bl,Im,Fm,Bm,Am,Rm,Sl,xl,_l,Um,Hm,Nm,Gm],T8=new Set(xi.map(e=>e.id));var mn=h(require("tinycolor2")),zm="#FFFFFF",F0="#000000",B0=zm,H0="#1E1E1D";function G0(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 Ho(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,mn.default)({...e.toHsl(),l:r})}function qm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=zm,blackHex:a=F0}){let l;switch(e){case"light":l=B0;break;case"dark":l=H0;break;default:l=e;break}let s=(0,mn.default)(l),c=(0,mn.default)(t),u=(0,mn.default)(r),f=(0,mn.default)(o),y=(0,mn.default)(n),g=G0(s.getLuminance()),C=Ho(s,g==="light"?-.04:.11),v=Ho(s,g==="light"?-.88:.87),x=Ho(s,g==="light"?-.77:.75),S=Ho(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=Ho(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Ho(c,.15),A=Ho(c,-.06),O=Ho(y,.3),M=(0,mn.default)(c.getLuminance()>.5?a:i),I=Ho(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:C.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:S.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:R.toHslString(),accentDark:A.toHslString(),foregroundAccent:M.toHslString(),success:u.toHslString(),successDark:I.toHslString(),error:y.toHslString(),errorLight:O.toHslString(),warn:f.toHslString()}}function Pd(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,u,f,y,g,C,v,x,S,b;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"),y=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),v=t.loginMethods.includes("github"),C=t.loginMethods.includes("linkedin"),x=t.loginMethods.includes("apple"),S=t.loginMethods.includes("farcaster"),b=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,v=e.githubOAuth,y=e.spotifyOAuth,g=e.instagramOAuth,f=e.tiktokOAuth,C=e.linkedinOAuth,x=e.appleOAuth,S=e.farcasterAuth,b=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let R=[n,i].filter(Boolean),A=[s,c,u,v,y,g,f,C,x,S,b].filter(Boolean),O=[l].filter(Boolean);if(R.length+A.length+O.length===0)throw new Error("You must enable at least one login method");let M=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;M&&O.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&A.length+R.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let I=km({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),V=Sm({input:t?.loginMethodsAndOrder}),Y=t?.intl?.defaultCountry??"US",{chains:ee,defaultChain:L}=V0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),j=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,be,ve=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?D?be=t?.embeddedWallets?.noPromptOnSignature??!0:be=t?.embeddedWallets?.noPromptOnSignature??ve:be=ve,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&be!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Ce,...Oe}=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??xr.appearance.landingHeader,palette:qm({backgroundTheme:t?.appearance?.theme??xr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??xr.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:I},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:u,github:v,spotify:y,instagram:g,tiktok:f,linkedin:C,apple:x,farcaster:S,telegram:b},loginMethodsAndOrder:V,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??xr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??xr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??xr.rpcConfig.rpcTimeouts},chains:ee,defaultChain:L,intl:{defaultCountry:Y},shouldEnforceDefaultChainOnConnect:j,captchaEnabled:e.captchaEnabled??xr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof Ce=="boolean"?{requireUserOwnedRecoveryOnCreate:Ce}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Oe,noPromptOnSignature:be},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??xr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??xr._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??xr._render.inParentNodeId}}}function $m(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 V0({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:xi.find(u=>u.id===s.id)??s)}else n=xi.concat(e??[]);let i=t?n[0]:bi,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 Km=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)};var Jm=require("react/jsx-runtime"),Ym={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:""},Td=Pd(Ym,void 0,!1),Sd=(0,jm.createContext)({appConfig:Td,isServerConfigLoaded:!1}),Zm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,bo.useState)(null),a=(0,bo.useMemo)(()=>Pd(n??Ym,o,!!n),[n,o]);return(0,bo.useEffect)(()=>{if(!n)return;let l=$m(o,t),s=Km(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]),(0,bo.useEffect)(()=>{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)}})()},[]),(0,Jm.jsx)(Sd.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},dr=()=>{let{appConfig:e}=(0,bo.useContext)(Sd);return e},kl=()=>{let{isServerConfigLoaded:e}=(0,bo.useContext)(Sd);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Al=require("react/jsx-runtime"),Qm=(0,Fr.createContext)({ready:!1,app:Td,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),z0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Xm=e=>{let t=dr(),r=e.authenticated,[o,n]=(0,Fr.useState)(e.initialScreen);(0,Fr.useEffect)(()=>{!r&&!z0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,Fr.useRef)(null);(0,Fr.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,Fr.useEffect)(()=>{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(0,Al.jsxs)(Qm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Al.jsx)(hl,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},k=()=>(0,Fr.useContext)(Qm);var Go=require("react/jsx-runtime"),Ba=({style:e,...t})=>{let{app:r}=k();return(0,Go.jsxs)("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:[(0,Go.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Go.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Go.jsx)("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"})}),(0,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Go.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Eo=class extends Xt{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 Je(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Gs[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=Hs(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:Pi,id:"io.metamask"}:{name:zu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Ba,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=Gs[r],this.walletClientType=r,this.redirectUri=void 0,Yu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Ci)};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 de("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Hs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=wi(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(eo(a));return}o(new de("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=Fs(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 ki.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:ki.OPTIONAL_EVENTS,optionalMethods:ki.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),ef.isMobile&&this.walletEntry){let{redirect:l,href:s}=Ku(a,this.walletEntry);Zu({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Vs(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=Hs(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 kd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,tf.isHexString)(o)).map(o=>(0,xd.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},wi=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Hn:Hn,Ai=class extends rf.default{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 Je:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.privyAppName=u,this.storedConnections=_d()}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;ne.get(ud)&&(ne.getKeys().forEach(o=>{o.startsWith("walletconnect")&&ne.del(o)}),ne.del(ud));let r=qu(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"),!ln()&&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 Oa(r,o,this.rpcConfig,this.chains,i,n.id),s=new Na(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new Oa(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new Na(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=_d(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=_d(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Eo&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ul(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new _i(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new _i(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new _i(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Si(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new dl(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new fl(this.defaultChain):new Eo(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}));ne.put(md,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=(0,xd.getAddress)(r),this.emit("walletsUpdated")}};function ll(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 q0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",_d=()=>{let e=ne.get(md);return e&&Array.isArray(e)&&e.map(o=>q0(o)).every(Boolean)?e:[]};var of=require("ofetch");var $0=[Rs,Ms,Is,Ws],Rl=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=qs,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=of.ofetch.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=$0.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 ks}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw he(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw he(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw he(o)}}};var nf=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});var Ri=h(require("js-cookie"));function af(e){return e instanceof sn?"email":e instanceof $n?"sms":e instanceof qn?"siwe":e instanceof mi?"custom_auth":e instanceof Co?e.meta.provider:null}var sf=h(require("jose")),Po=class{static parse(t){try{return new Po(t)}catch{return null}}constructor(t){this.value=t,this._decoded=sf.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 K0=30,Il=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=ne.get(Dn);return typeof t=="string"?new Po(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ne.get($s);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ne.get(Ta);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Ri.default.get(Ks);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=Po.parse(this.token);return t!==null&&!t.isExpired(K0)}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=af(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:Sr(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),Nt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_provider_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,scopes:o.scopes}:void 0;return{user:Sr(r),oAuthProviderTokens:n}}catch(r){throw console.warn("Error linking account"),Nt(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("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(Rs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ms,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Sr(n.user)}catch(n){if(n instanceof Xr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Nt(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(Is,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Xp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw Nt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=ne.get(Dn);if(ne.put(Dn,t),!this.client?.useServerCookies){let o=Po.parse(t)?.expiration;Ri.default.set(pd,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else ne.del(Dn),Ri.default.remove(pd),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(ne.put($s,t),this.client?.useServerCookies||Ri.default.set(Ks,"t",{sameSite:"Strict",secure:!0,expires:30})):(ne.del($s),Ri.default.remove(Ks))}clearForkedToken(){ne.del(Ta)}};var Ad,Ml,cf,Ii=class{constructor(t){xs(this,Ml);this.apiUrl=t.apiUrl||Pa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||rm,this.appId=t.appId,this.clientAnalyticsId=Jp(this,Ml,cf).call(this),Ad||(Ad=new Il),this.session=Ad,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 Ai(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Rl(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 T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("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(Wu,{action:"verify"})}catch(t){throw he(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Lu,{});return nf(t.options)}catch(t){throw he(t)}}async unlinkEmail(t){try{let r=await this.api.post(uu,{address:t});return Sr(r)}catch(r){throw Nt(r)}}async acceptTerms(){try{let t=await this.api.post(Ou,{});return Sr(t)}catch(t){throw Nt(t)}}async unlinkPhone(t){try{let r=await this.api.post(yu,{phoneNumber:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkWallet(t){try{let r=await this.api.post(ou,{address:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(bu,{provider:t,subject:r});return Sr(o)}catch(o){throw Nt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(lu,{fid:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Mu,{telegram_user_id:t});return Sr(r)}catch(r){throw Nt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Au,{credential_id:t});return Sr(r)}catch(r){throw Nt(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(Ws,{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(Nu,t)}catch(r){throw Nt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Po.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 Nt(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()}};Ml=new WeakSet,cf=function(){if(typeof window>"u")return null;try{let r=ne.get(Sa);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,lf.v4)();try{return ne.put(Sa,t),t}catch{return t}};var mf=require("@marsidev/react-turnstile"),Wl=require("react");var Br=require("react");var uf=require("react/jsx-runtime"),df=(0,Br.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),oo=class extends dt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},pf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,Br.useRef)(null),[i,a]=(0,Br.useState)(),[l,s]=(0,Br.useState)(),[c,u]=(0,Br.useState)(!1),f=(0,Br.useMemo)(()=>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(0,uf.jsx)(df.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 Gu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new oo("Captcha failed",null,"captcha_timeout")}}},children:e})},Te=()=>(0,Br.useContext)(df);var Rd=require("react/jsx-runtime"),Ll=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Te(),[,s]=(0,Wl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Wl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Rd.jsx)("div",{className:"hidden h-0 w-0",children:(0,Rd.jsx)(mf.Turnstile,{...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")}}})})};var on=require("react"),E3=h(require("react-dom"));var Ol=require("react");var Id=(0,Ol.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E}),W=()=>(0,Ol.useContext)(Id);var Nl=require("react");var Re=(0,Nl.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>(0,Nl.useContext)(Re);var Dl=require("react"),ff=e=>{let[t,r]=(0,Dl.useState)("auto");return(0,Dl.useEffect)(()=>{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};var Mi=require("react"),hf={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:[]}},Md=(0,Mi.createContext)(void 0),yf=()=>(0,Mi.useContext)(Md);function it(e,t){if(!t)return;let o=yf().current[e];return(0,Mi.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function F(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Ul(){let e=yf();return(t,r,...o)=>F(e,t,r,...o)}function Fl(e){it("configureMfa",e)}var Ud=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Tf=h(require("@heroicons/react/24/solid/DocumentCheckIcon")),Sf=h(require("styled-components"));var Hr=h(require("styled-components"));var Bl=h(require("styled-components")),fn=require("react/jsx-runtime"),St=({success:e,fail:t})=>(0,fn.jsxs)(fn.Fragment,{children:[(0,fn.jsx)(_t,{className:e?"success":t?"fail":""}),(0,fn.jsx)(Wd,{className:e?"success":t?"fail":""})]}),_t=Bl.default.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -42,13 +42,13 @@ Resources:
42
42
  border-color: var(--privy-color-error);
43
43
  border-bottom-color: var(--privy-color-error);
44
44
  }
45
- `,Ld=(0,Bl.default)(_t)`
45
+ `,Wd=(0,Bl.default)(_t)`
46
46
  && {
47
47
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,Vo=e=>(0,hn.jsx)(Y0,{color:e.color||"var(--privy-color-foreground-3)"}),Y0=(0,Bl.default)(_t)`
51
+ `,Vo=e=>(0,fn.jsx)(j0,{color:e.color||"var(--privy-color-foreground-3)"}),j0=(0,Bl.default)(_t)`
52
52
  && {
53
53
  height: 0.9rem;
54
54
  width: 0.9rem;
@@ -85,13 +85,13 @@ Resources:
85
85
  color: var(--privy-color-foreground-3);
86
86
  cursor: not-allowed;
87
87
  }
88
- `,N=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(vf,{disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),u9=(0,Hr.default)(N)`
88
+ `,N=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(gf,{disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),p9=(0,Hr.default)(N)`
89
89
  ${e=>e.hideAnimations&&Hr.css`
90
90
  && {
91
91
  transition: none;
92
92
  }
93
93
  `}
94
- `,Gl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(vf,{as:"a",disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),vf=(0,Hr.default)(Hl)`
94
+ `,Gl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(gf,{as:"a",disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),gf=(0,Hr.default)(Hl)`
95
95
  position: relative;
96
96
 
97
97
  && {
@@ -136,7 +136,7 @@ Resources:
136
136
  opacity: 1;
137
137
  animation: fadein 200ms ease;
138
138
  }
139
- `,no=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(Z0,{disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),Z0=(0,Hr.default)(Hl)`
139
+ `,no=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,xt.jsx)(Y0,{disabled:t||r,...n,children:t?(0,xt.jsxs)("span",{children:[(0,xt.jsx)(Vo,{}),o?(0,xt.jsx)("span",{children:o}):null]}):e}),Y0=(0,Hr.default)(Hl)`
140
140
  && {
141
141
  border-width: 1px;
142
142
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -165,7 +165,7 @@ Resources:
165
165
  opacity: 1;
166
166
  animation: fadein 200ms ease;
167
167
  }
168
- `,Li=Hr.default.button`
168
+ `,Wi=Hr.default.button`
169
169
  && {
170
170
  padding: 12px 16px;
171
171
  font-weight: 500;
@@ -196,10 +196,10 @@ Resources:
196
196
  cursor: not-allowed;
197
197
  }
198
198
  }
199
- `,m9=Hr.default.div`
199
+ `,u9=Hr.default.div`
200
200
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
201
201
  height: 44px;
202
- `,Oi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,xt.jsxs)(J0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,xt.jsx)("span",{children:e}),(0,xt.jsx)("span",{children:(0,xt.jsx)(Vo,{})})]}),J0=Hr.default.button`
202
+ `,Li=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,xt.jsxs)(Z0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,xt.jsx)("span",{children:e}),(0,xt.jsx)("span",{children:(0,xt.jsx)(Vo,{})})]}),Z0=Hr.default.button`
203
203
  && {
204
204
  color: var(--privy-color-accent);
205
205
  font-size: 16px;
@@ -241,7 +241,7 @@ Resources:
241
241
  cursor: not-allowed;
242
242
  }
243
243
  }
244
- `;var Nd=h(require("styled-components"));var pr=require("react/jsx-runtime"),Od=Nd.default.div`
244
+ `;var Od=h(require("styled-components"));var pr=require("react/jsx-runtime"),Ld=Od.default.div`
245
245
  margin-top: 16px;
246
246
  font-size: 13px;
247
247
  text-align: center;
@@ -250,7 +250,7 @@ Resources:
250
250
  && > a {
251
251
  color: var(--privy-color-accent);
252
252
  }
253
- `;function Ni(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,pr.jsx)(Od,{});if(!r&&!t)return(0,pr.jsx)(Od,{});let n=!!(t&&r);return(0,pr.jsxs)(Od,{children:["By logging in I agree to the"," ",r&&(0,pr.jsx)("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,pr.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=({protectedByPrivy:e})=>(0,pr.jsx)(z,{children:e?(0,pr.jsxs)(pr.Fragment,{children:[(0,pr.jsx)(pl,{className:"hide-on-mobile"}),(0,pr.jsx)("span",{className:"hide-on-mobile",children:(0,pr.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),z=Nd.default.div`
253
+ `;function Oi(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,pr.jsx)(Ld,{});if(!r&&!t)return(0,pr.jsx)(Ld,{});let n=!!(t&&r);return(0,pr.jsxs)(Ld,{children:["By logging in I agree to the"," ",r&&(0,pr.jsx)("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,pr.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var q=({protectedByPrivy:e})=>(0,pr.jsx)(z,{children:e?(0,pr.jsxs)(pr.Fragment,{children:[(0,pr.jsx)(pl,{className:"hide-on-mobile"}),(0,pr.jsx)("span",{className:"hide-on-mobile",children:(0,pr.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),z=Od.default.div`
254
254
  display: flex;
255
255
  align-items: center;
256
256
  justify-content: center;
@@ -277,7 +277,7 @@ Resources:
277
277
  @media all and (display-mode: standalone) {
278
278
  padding-bottom: 30px;
279
279
  }
280
- `;var Cf=h(require("@heroicons/react/24/outline/ArrowLeftIcon")),wf=h(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),bf=h(require("@heroicons/react/24/outline/XMarkIcon")),jn=h(require("styled-components"));var kt=require("react/jsx-runtime"),Q0=({backFn:e})=>(0,kt.jsx)("div",{children:(0,kt.jsx)(Dd,{onClick:e,children:(0,kt.jsx)(Cf.default,{height:"16px",width:"16px",strokeWidth:2})})}),X0=({infoFn:e})=>(0,kt.jsx)("div",{children:(0,kt.jsx)(tv,{"aria-label":"info",onClick:e,children:(0,kt.jsx)(wf.default,{height:"22px",width:"22px",strokeWidth:2})})}),ev=e=>(0,kt.jsx)("div",{children:(0,kt.jsx)(Dd,{"aria-label":"close modal",onClick:e.onClose,children:(0,kt.jsx)(bf.default,{height:"16px",width:"16px",strokeWidth:2})})});var _=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=W(),{app:a}=k();return(0,kt.jsxs)(rv,{children:[(0,kt.jsxs)(ov,{children:[e&&(0,kt.jsx)(Q0,{backFn:e}),t&&(0,kt.jsx)(X0,{infoFn:t})]}),o&&(0,kt.jsx)(iv,{id:"privy-dialog-title",children:o}),(0,kt.jsx)(nv,{children:a?.render.inDialog&&n&&(0,kt.jsx)(ev,{onClose:r||(()=>i())})})]})},Dd=jn.default.button`
280
+ `;var vf=h(require("@heroicons/react/24/outline/ArrowLeftIcon")),Cf=h(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),wf=h(require("@heroicons/react/24/outline/XMarkIcon")),Kn=h(require("styled-components"));var kt=require("react/jsx-runtime"),J0=({backFn:e})=>(0,kt.jsx)("div",{children:(0,kt.jsx)(Nd,{onClick:e,children:(0,kt.jsx)(vf.default,{height:"16px",width:"16px",strokeWidth:2})})}),Q0=({infoFn:e})=>(0,kt.jsx)("div",{children:(0,kt.jsx)(ev,{"aria-label":"info",onClick:e,children:(0,kt.jsx)(Cf.default,{height:"22px",width:"22px",strokeWidth:2})})}),X0=e=>(0,kt.jsx)("div",{children:(0,kt.jsx)(Nd,{"aria-label":"close modal",onClick:e.onClose,children:(0,kt.jsx)(wf.default,{height:"16px",width:"16px",strokeWidth:2})})});var _=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=W(),{app:a}=k();return(0,kt.jsxs)(tv,{children:[(0,kt.jsxs)(rv,{children:[e&&(0,kt.jsx)(J0,{backFn:e}),t&&(0,kt.jsx)(Q0,{infoFn:t})]}),o&&(0,kt.jsx)(nv,{id:"privy-dialog-title",children:o}),(0,kt.jsx)(ov,{children:a?.render.inDialog&&n&&(0,kt.jsx)(X0,{onClose:r||(()=>i())})})]})},Nd=Kn.default.button`
281
281
  && {
282
282
  cursor: pointer;
283
283
  display: flex;
@@ -296,11 +296,11 @@ Resources:
296
296
  opacity: 1;
297
297
  }
298
298
  }
299
- `,tv=(0,jn.default)(Dd)`
299
+ `,ev=(0,Kn.default)(Nd)`
300
300
  && {
301
301
  background-color: transparent;
302
302
  }
303
- `,rv=jn.default.div`
303
+ `,tv=Kn.default.div`
304
304
  padding: 16px 0;
305
305
  display: flex;
306
306
  align-items: center;
@@ -312,16 +312,16 @@ Resources:
312
312
  font-weight: 600;
313
313
  color: var(--privy-color-foreground);
314
314
  }
315
- `,ov=jn.default.div`
315
+ `,rv=Kn.default.div`
316
316
  flex: 1;
317
317
  align-items: center;
318
318
  display: flex;
319
319
  gap: 8px;
320
- `,nv=jn.default.div`
320
+ `,ov=Kn.default.div`
321
321
  flex: 1;
322
322
  display: flex;
323
323
  justify-content: flex-end;
324
- `,iv=jn.default.div`
324
+ `,nv=Kn.default.div`
325
325
  overflow: hidden;
326
326
  white-space: nowrap;
327
327
  max-width: 100%;
@@ -351,13 +351,13 @@ Resources:
351
351
  &::-webkit-scrollbar {
352
352
  display: none;
353
353
  }
354
- `,Ef=(0,To.default)(io)`
354
+ `,bf=(0,To.default)(io)`
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;
358
358
  background-size: 100% 32px, 100% 16px;
359
359
  background-attachment: local, scroll;
360
- `,Pf=To.css`
360
+ `,Ef=To.css`
361
361
  && {
362
362
  width: 100%;
363
363
  font-size: 16px;
@@ -394,14 +394,14 @@ Resources:
394
394
  max-width: 24px;
395
395
  }
396
396
  }
397
- `,Ne=To.default.button`
398
- ${Pf}
399
- `,Ud=To.default.a`
400
- ${Pf}
397
+ `,De=To.default.button`
398
+ ${Ef}
399
+ `,Dd=To.default.a`
400
+ ${Ef}
401
401
  `,ao=To.default.div`
402
402
  width: 100%;
403
403
  ${e=>e.if?"display: none;":""}
404
- `;var wt=h(require("styled-components")),Fe=wt.default.div`
404
+ `;var bt=h(require("styled-components")),Be=bt.default.div`
405
405
  display: flex;
406
406
  flex-direction: column;
407
407
  align-items: center;
@@ -409,17 +409,17 @@ Resources:
409
409
  @media (max-width: 440px) {
410
410
  padding: 10px 10px 20px;
411
411
  }
412
- `,ye=wt.default.div`
412
+ `,ye=bt.default.div`
413
413
  font-size: 18px;
414
414
  line-height: 30px;
415
415
  text-align: center;
416
416
  font-weight: 600;
417
417
  margin-bottom: 10px;
418
- `,ge=wt.default.div`
418
+ `,ge=bt.default.div`
419
419
  font-size: 0.875rem;
420
420
 
421
421
  text-align: center;
422
- `,Gr=wt.default.div`
422
+ `,Gr=bt.default.div`
423
423
  display: flex;
424
424
  flex-direction: column;
425
425
  align-items: center;
@@ -429,7 +429,7 @@ Resources:
429
429
  @media (max-width: 440px) {
430
430
  padding: 10px 10px 20px;
431
431
  }
432
- `,Yn=wt.default.div`
432
+ `,jn=bt.default.div`
433
433
  display: flex;
434
434
  flex-direction: column;
435
435
  align-items: stretch;
@@ -437,7 +437,7 @@ Resources:
437
437
  padding: 1rem 0rem 0rem;
438
438
  flex-grow: 1;
439
439
  width: 100%;
440
- `,ur=wt.default.div`
440
+ `,ur=bt.default.div`
441
441
  width: 25px;
442
442
  display: flex;
443
443
  align-items: center;
@@ -449,19 +449,19 @@ Resources:
449
449
  width: 25px !important;
450
450
  color: var(--privy-color-accent);
451
451
  }
452
- `,mr=wt.default.div`
452
+ `,mr=bt.default.div`
453
453
  display: flex;
454
454
  align-items: center;
455
455
  gap: 10px;
456
456
  font-size: 0.875rem;
457
457
  line-height: 1rem;
458
458
  text-align: left;
459
- `,qt=wt.default.div`
459
+ `,zt=bt.default.div`
460
460
  display: flex;
461
461
  flex-direction: column;
462
462
  gap: 10px;
463
463
  padding-top: 20px;
464
- `,ql=wt.default.div`
464
+ `,ql=bt.default.div`
465
465
  display: flex;
466
466
  flex-direction: column;
467
467
  align-items: stretch;
@@ -469,11 +469,11 @@ Resources:
469
469
  padding: 1rem 0rem 0rem;
470
470
  flex-grow: 1;
471
471
  width: 100%;
472
- `,$l=wt.default.div`
472
+ `,$l=bt.default.div`
473
473
  display: flex;
474
474
  gap: 5px;
475
475
  width: 100%;
476
- `,Kl=wt.default.button`
476
+ `,Kl=bt.default.button`
477
477
  && {
478
478
  background-color: transparent;
479
479
  color: var(--privy-color-foreground-3);
@@ -491,7 +491,7 @@ Resources:
491
491
  &&:hover {
492
492
  color: var(--privy-color-error);
493
493
  }
494
- `,jl=wt.default.div`
494
+ `,jl=bt.default.div`
495
495
  display: flex;
496
496
  align-items: center;
497
497
  gap: 0.5rem;
@@ -501,7 +501,7 @@ Resources:
501
501
  height: 20px !important;
502
502
  width: 20px !important;
503
503
  }
504
- `,Zn=wt.default.div`
504
+ `,Yn=bt.default.div`
505
505
  display: flex;
506
506
  align-items: center;
507
507
  gap: 6px;
@@ -515,15 +515,15 @@ Resources:
515
515
  display: flex !important;
516
516
  align-items: flex-end;
517
517
  }
518
- `,Yl=wt.default.div`
518
+ `,Yl=bt.default.div`
519
519
  width: 100%;
520
520
  display: flex;
521
521
  justify-content: space-between;
522
- `,Tf=wt.default.p`
522
+ `,Pf=bt.default.p`
523
523
  text-align: left;
524
524
  width: 100%;
525
525
  color: var(--privy-color-foreground-3) !important;
526
- `,Ha=wt.default.button`
526
+ `,Ha=bt.default.button`
527
527
  display: flex;
528
528
  flex-direction: row;
529
529
  align-items: center;
@@ -553,7 +553,7 @@ Resources:
553
553
  &:hover {
554
554
  text-decoration: underline;
555
555
  }
556
- `,et=wt.default.div`
556
+ `,et=bt.default.div`
557
557
  display: flex;
558
558
  align-items: center;
559
559
  justify-content: center;
@@ -568,12 +568,12 @@ Resources:
568
568
  width: auto !important;
569
569
  color: white;
570
570
  }
571
- `,Zl=wt.default.div`
571
+ `,Zl=bt.default.div`
572
572
  color: var(--privy-color-error);
573
- `;var bt=require("react/jsx-runtime"),xf=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=k(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=W(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&cr(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:y=>{console.error(y),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:y,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,bt.jsx)(av,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},av=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,bt.jsxs)(bt.Fragment,{children:[(0,bt.jsx)(_,{closeable:!1}),(0,bt.jsx)(Sf.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,bt.jsx)(ye,{style:{marginTop:24},children:"One last step"}),(0,bt.jsx)(ge,{children:"By signing up, you agree to our terms and privacy policy."}),(0,bt.jsxs)(io,{style:{marginTop:24},children:[e&&(0,bt.jsxs)(Ud,{target:"_blank",href:e,children:["View Terms ",(0,bt.jsx)(Fd.default,{style:{marginLeft:"auto"}})]}),t&&(0,bt.jsxs)(Ud,{target:"_blank",href:t,children:["View Privacy Policy ",(0,bt.jsx)(Fd.default,{style:{marginLeft:"auto"}})]})]}),(0,bt.jsxs)(sv,{style:{marginTop:24},children:[(0,bt.jsx)(no,{onClick:o,children:"No thanks"}),(0,bt.jsx)(N,{onClick:r,children:"Accept"})]}),(0,bt.jsx)($,{protectedByPrivy:!0})]}),sv=_f.default.div`
573
+ `;var Et=require("react/jsx-runtime"),_f=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=k(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=W(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&cr(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:y=>{console.error(y),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:y,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,Et.jsx)(iv,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},iv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,Et.jsxs)(Et.Fragment,{children:[(0,Et.jsx)(_,{closeable:!1}),(0,Et.jsx)(Tf.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,Et.jsx)(ye,{style:{marginTop:24},children:"One last step"}),(0,Et.jsx)(ge,{children:"By signing up, you agree to our terms and privacy policy."}),(0,Et.jsxs)(io,{style:{marginTop:24},children:[e&&(0,Et.jsxs)(Dd,{target:"_blank",href:e,children:["View Terms ",(0,Et.jsx)(Ud.default,{style:{marginLeft:"auto"}})]}),t&&(0,Et.jsxs)(Dd,{target:"_blank",href:t,children:["View Privacy Policy ",(0,Et.jsx)(Ud.default,{style:{marginLeft:"auto"}})]})]}),(0,Et.jsxs)(av,{style:{marginTop:24},children:[(0,Et.jsx)(no,{onClick:o,children:"No thanks"}),(0,Et.jsx)(N,{onClick:r,children:"Accept"})]}),(0,Et.jsx)(q,{protectedByPrivy:!0})]}),av=Sf.default.div`
574
574
  display: flex;
575
575
  gap: 10px;
576
- `;var Hd=h(require("styled-components"));var kf=h(require("styled-components")),Jl=kf.default.span`
576
+ `;var Bd=h(require("styled-components"));var xf=h(require("styled-components")),Jl=xf.default.span`
577
577
  && {
578
578
  width: 82px;
579
579
  height: 82px;
@@ -588,7 +588,7 @@ Resources:
588
588
  transition: border-color 800ms;
589
589
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
590
590
  }
591
- `;var Af=h(require("styled-components")),lv=Af.default.div`
591
+ `;var kf=h(require("styled-components")),sv=kf.default.div`
592
592
  display: flex;
593
593
  flex-direction: column;
594
594
  justify-content: center;
@@ -611,7 +611,7 @@ Resources:
611
611
  left: -19px;
612
612
  top: -19px;
613
613
  }
614
- `,At=lv;var Bd=require("react/jsx-runtime"),Ql=({style:e,...t})=>(0,Bd.jsx)("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:(0,Bd.jsx)("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"})});var ht=require("react/jsx-runtime"),Rf=()=>{let{navigate:e,app:t}=k(),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(0,ht.jsxs)(ht.Fragment,{children:[(0,ht.jsx)(_,{}),(0,ht.jsxs)(cv,{children:[(0,ht.jsx)(At,{children:(0,ht.jsxs)("div",{children:[(0,ht.jsx)(Jl,{}),(0,ht.jsx)(Ql,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,ht.jsxs)(dv,{children:[typeof r=="string"?(0,ht.jsx)("h3",{children:r}):(0,ht.jsx)(ht.Fragment,{children:r}),typeof o=="string"?(0,ht.jsx)("p",{children:o}):(0,ht.jsx)(ht.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,ht.jsx)(N,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,ht.jsx)(N,{onClick:()=>{e("LANDING")},children:n})]})]})},cv=Hd.default.div`
614
+ `,At=sv;var Fd=require("react/jsx-runtime"),Ql=({style:e,...t})=>(0,Fd.jsx)("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:(0,Fd.jsx)("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"})});var yt=require("react/jsx-runtime"),Af=()=>{let{navigate:e,app:t}=k(),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(0,yt.jsxs)(yt.Fragment,{children:[(0,yt.jsx)(_,{}),(0,yt.jsxs)(lv,{children:[(0,yt.jsx)(At,{children:(0,yt.jsxs)("div",{children:[(0,yt.jsx)(Jl,{}),(0,yt.jsx)(Ql,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,yt.jsxs)(cv,{children:[typeof r=="string"?(0,yt.jsx)("h3",{children:r}):(0,yt.jsx)(yt.Fragment,{children:r}),typeof o=="string"?(0,yt.jsx)("p",{children:o}):(0,yt.jsx)(yt.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,yt.jsx)(N,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,yt.jsx)(N,{onClick:()=>{e("LANDING")},children:n})]})]})},lv=Bd.default.div`
615
615
  display: flex;
616
616
  flex-direction: column;
617
617
  align-items: center;
@@ -619,11 +619,11 @@ Resources:
619
619
  gap: 24px;
620
620
  width: 100%;
621
621
  padding-bottom: 16px;
622
- `,dv=Hd.default.div`
622
+ `,cv=Bd.default.div`
623
623
  display: flex;
624
624
  flex-direction: column;
625
625
  gap: 8px;
626
- `;var Uf=h(require("@heroicons/react/24/outline/EnvelopeIcon")),Ff=h(require("@heroicons/react/24/outline/PhoneIcon")),yn=require("react"),Bf=require("react-device-detect"),Ui=h(require("styled-components"));var fr=h(require("styled-components")),Vr=fr.default.div`
626
+ `;var Df=h(require("@heroicons/react/24/outline/EnvelopeIcon")),Uf=h(require("@heroicons/react/24/outline/PhoneIcon")),hn=require("react"),Ff=require("react-device-detect"),Di=h(require("styled-components"));var fr=h(require("styled-components")),Vr=fr.default.div`
627
627
  display: flex;
628
628
  flex-direction: column;
629
629
  align-items: flex-start;
@@ -638,29 +638,29 @@ Resources:
638
638
  justify-content: center;
639
639
  flex-grow: 1;
640
640
  width: 100%;
641
- `,If=fr.default.div`
641
+ `,Rf=fr.default.div`
642
642
  display: flex;
643
643
  flex-direction: column;
644
644
  align-items: center;
645
645
  width: 100%;
646
- `,Di=(0,fr.default)(er)`
646
+ `,Ni=(0,fr.default)(er)`
647
647
  padding: 20px 0;
648
648
  `,so=(0,fr.default)(er)`
649
649
  gap: 16px;
650
- `,Gd=fr.default.div`
650
+ `,Hd=fr.default.div`
651
651
  display: flex;
652
652
  flex-direction: column;
653
653
  width: 100%;
654
- `,yt=fr.default.div`
654
+ `,gt=fr.default.div`
655
655
  display: flex;
656
656
  flex-direction: column;
657
657
  gap: 8px;
658
- `,G9=fr.default.div`
658
+ `,H9=fr.default.div`
659
659
  display: flex;
660
660
  flex-direction: column;
661
661
  justify-content: space-between;
662
662
  height: 100%;
663
- `,Mf=fr.default.div`
663
+ `,If=fr.default.div`
664
664
  display: flex;
665
665
  flex-direction: column;
666
666
  justify-content: flex-start;
@@ -687,9 +687,9 @@ Resources:
687
687
  height: 16px;
688
688
  `,me=fr.default.div`
689
689
  height: 12px;
690
- `,Wf=fr.default.div`
690
+ `,Mf=fr.default.div`
691
691
  position: relative;
692
- `,Lf=fr.default.div`
692
+ `,Wf=fr.default.div`
693
693
  background-color: var(--privy-color-accent);
694
694
  display: flex;
695
695
  justify-content: center;
@@ -697,9 +697,9 @@ Resources:
697
697
  border-radius: 50%;
698
698
  border-color: white;
699
699
  border-width: 2px !important;
700
- `;var Xl=h(require("styled-components")),lo=require("react/jsx-runtime"),Ga=({title:e,description:t,children:r,...o})=>(0,lo.jsx)(Of,{...o,children:(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)("h3",{children:e}),typeof t=="string"?(0,lo.jsx)("p",{children:t}):t,r]})}),So=(0,Xl.default)(Ga)`
700
+ `;var Xl=h(require("styled-components")),lo=require("react/jsx-runtime"),Ga=({title:e,description:t,children:r,...o})=>(0,lo.jsx)(Lf,{...o,children:(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)("h3",{children:e}),typeof t=="string"?(0,lo.jsx)("p",{children:t}):t,r]})}),So=(0,Xl.default)(Ga)`
701
701
  margin-bottom: 24px;
702
- `,Be=({title:e,description:t,icon:r,children:o,...n})=>(0,lo.jsxs)(pv,{...n,children:[r||null,(0,lo.jsx)("h3",{children:e}),t&&typeof t=="string"?(0,lo.jsx)("p",{children:t}):t,o]}),Of=Xl.default.div`
702
+ `,He=({title:e,description:t,icon:r,children:o,...n})=>(0,lo.jsxs)(dv,{...n,children:[r||null,(0,lo.jsx)("h3",{children:e}),t&&typeof t=="string"?(0,lo.jsx)("p",{children:t}):t,o]}),Lf=Xl.default.div`
703
703
  display: flex;
704
704
  flex-direction: column;
705
705
  justify-content: flex-start;
@@ -719,7 +719,7 @@ Resources:
719
719
  color: var(--privy-color-foreground-2);
720
720
  font-size: 14px;
721
721
  }
722
- `,pv=(0,Xl.default)(Of)`
722
+ `,dv=(0,Xl.default)(Lf)`
723
723
  align-items: center;
724
724
  text-align: center;
725
725
  gap: 16px;
@@ -727,7 +727,7 @@ Resources:
727
727
  h3 {
728
728
  margin-bottom: 24px;
729
729
  }
730
- `;var Te=require("react/jsx-runtime"),Vd=6,Nf=new Array(Vd).fill(""),uv=1400;var Hf=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=W(),{authenticated:y,logout:g,user:C}=H(),[v,x]=(0,yn.useState)(Nf),[S,b]=(0,yn.useState)(!1),[R,A]=(0,yn.useState)(null),[O,M]=(0,yn.useState)(null);n.current=()=>null;let I=s()?.email?0:1,V=e?.render.inDialog?Xe:0,Z=e?.render.inDialog?V-500:0;(0,yn.useEffect)(()=>{if(y&&S&&C){if(e?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let ve=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},Z);return()=>clearTimeout(ve)}if(cr(C,e?.embeddedWallets?.createOnLogin)){let ve=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Ce=>{console.error(Ce),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ce,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},Z);return()=>clearTimeout(ve)}else{u();let ve=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),V);return()=>clearTimeout(ve)}}},[y,S,C]),(0,yn.useEffect)(()=>{if(R&&O===0){let be=setTimeout(()=>{x(Nf),A(null),document.querySelector("input[name=code-0]")?.focus()},uv);return()=>clearTimeout(be)}},[R]);let ee=be=>{be.preventDefault();let ve=be.currentTarget.value.replace(" ","");if(ve==="")return;if(isNaN(Number(ve))){A("Code should be numeric"),M(1);return}A(null),M(null);let Ce=Number(be.currentTarget.name?.charAt(5)),Le=[...ve||[""]].slice(0,Vd-Ce),ce=[...v.slice(0,Ce),...Le,...v.slice(Ce+Le.length)];x(ce);let Jt=Le.length,Ct=Math.min(Math.max(Ce+Jt,0),Vd-1);isNaN(Number(be.currentTarget.value))||document.querySelector(`input[name=code-${Ct}]`)?.focus(),ce.every(nr=>nr&&!isNaN(+nr))&&(document.querySelector(`input[name=code-${Ct}]`)?.blur(),c(ce.join("")).then(()=>b(!0)).catch(Et=>{if(Et?.status===422)A("Invalid or expired verification code");else if(Et instanceof Xr&&Et.privyErrorCode==="cannot_link_more_of_type")A(Et.message);else if(Et instanceof Xr&&Et.privyErrorCode==="max_accounts_reached"){console.error(new Ur(Et).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else A("Issue verifying code");M(0)}))},L=be=>{O===1&&(A(null),M(null));let ve=[...v.slice(0,be),"",...v.slice(be+1)];x(ve),be>0&&document.querySelector(`input[name=code-${be-1}]`)?.focus()},Y=I==0?(0,Te.jsx)(Uf.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,Te.jsx)(Ff.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),D=I==0?(0,Te.jsxs)("p",{children:["Please check ",(0,Te.jsx)(Df,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,Te.jsxs)("p",{children:["Please check ",(0,Te.jsx)(Df,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(_,{backFn:()=>r()},"header"),(0,Te.jsxs)(mv,{children:[(0,Te.jsx)(Be,{title:"Enter confirmation code",description:D,icon:Y}),(0,Te.jsxs)(If,{children:[(0,Te.jsxs)(fv,{children:[(0,Te.jsx)(hv,{fail:!!R,success:S,children:(0,Te.jsx)("span",{children:R||(S?"Success!":"")})}),(0,Te.jsx)("div",{children:v.map((be,ve)=>(0,Te.jsx)("input",{name:`code-${ve}`,type:"text",value:v[ve],onChange:ee,onKeyUp:Ce=>{Ce.key==="Backspace"&&L(ve)},inputMode:"numeric",autoFocus:ve===0,pattern:"[0-9]",className:`${S?"success":""} ${R?"fail":""}`,autoComplete:Bf.isMobile?"one-time-code":"off"},ve))})]}),(0,Te.jsx)(yv,{children:I==0?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("span",{children:"Didn't get an email?"}),(0,Te.jsx)("button",{onClick:a,children:"Resend code"})]}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("span",{children:"Didn't get a message?"}),(0,Te.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,Te.jsx)($,{protectedByPrivy:!0})]})},mv=Ui.default.div`
730
+ `;var Se=require("react/jsx-runtime"),Gd=6,Of=new Array(Gd).fill(""),pv=1400;var Bf=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=W(),{authenticated:y,logout:g,user:C}=H(),[v,x]=(0,hn.useState)(Of),[S,b]=(0,hn.useState)(!1),[R,A]=(0,hn.useState)(null),[O,M]=(0,hn.useState)(null);n.current=()=>null;let I=s()?.email?0:1,V=e?.render.inDialog?Xe:0,Y=e?.render.inDialog?V-500:0;(0,hn.useEffect)(()=>{if(y&&S&&C){if(e?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let ve=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},Y);return()=>clearTimeout(ve)}if(cr(C,e?.embeddedWallets?.createOnLogin)){let ve=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Ce=>{console.error(Ce),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Ce,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},Y);return()=>clearTimeout(ve)}else{u();let ve=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),V);return()=>clearTimeout(ve)}}},[y,S,C]),(0,hn.useEffect)(()=>{if(R&&O===0){let be=setTimeout(()=>{x(Of),A(null),document.querySelector("input[name=code-0]")?.focus()},pv);return()=>clearTimeout(be)}},[R]);let ee=be=>{be.preventDefault();let ve=be.currentTarget.value.replace(" ","");if(ve==="")return;if(isNaN(Number(ve))){A("Code should be numeric"),M(1);return}A(null),M(null);let Ce=Number(be.currentTarget.name?.charAt(5)),Oe=[...ve||[""]].slice(0,Gd-Ce),ce=[...v.slice(0,Ce),...Oe,...v.slice(Ce+Oe.length)];x(ce);let Zt=Oe.length,wt=Math.min(Math.max(Ce+Zt,0),Gd-1);isNaN(Number(be.currentTarget.value))||document.querySelector(`input[name=code-${wt}]`)?.focus(),ce.every(nr=>nr&&!isNaN(+nr))&&(document.querySelector(`input[name=code-${wt}]`)?.blur(),c(ce.join("")).then(()=>b(!0)).catch(Pt=>{if(Pt?.status===422)A("Invalid or expired verification code");else if(Pt instanceof Xr&&Pt.privyErrorCode==="cannot_link_more_of_type")A(Pt.message);else if(Pt instanceof Xr&&Pt.privyErrorCode==="max_accounts_reached"){console.error(new Ur(Pt).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else A("Issue verifying code");M(0)}))},L=be=>{O===1&&(A(null),M(null));let ve=[...v.slice(0,be),"",...v.slice(be+1)];x(ve),be>0&&document.querySelector(`input[name=code-${be-1}]`)?.focus()},j=I==0?(0,Se.jsx)(Df.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,Se.jsx)(Uf.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),D=I==0?(0,Se.jsxs)("p",{children:["Please check ",(0,Se.jsx)(Nf,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,Se.jsxs)("p",{children:["Please check ",(0,Se.jsx)(Nf,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(_,{backFn:()=>r()},"header"),(0,Se.jsxs)(uv,{children:[(0,Se.jsx)(He,{title:"Enter confirmation code",description:D,icon:j}),(0,Se.jsxs)(Rf,{children:[(0,Se.jsxs)(mv,{children:[(0,Se.jsx)(fv,{fail:!!R,success:S,children:(0,Se.jsx)("span",{children:R||(S?"Success!":"")})}),(0,Se.jsx)("div",{children:v.map((be,ve)=>(0,Se.jsx)("input",{name:`code-${ve}`,type:"text",value:v[ve],onChange:ee,onKeyUp:Ce=>{Ce.key==="Backspace"&&L(ve)},inputMode:"numeric",autoFocus:ve===0,pattern:"[0-9]",className:`${S?"success":""} ${R?"fail":""}`,autoComplete:Ff.isMobile?"one-time-code":"off"},ve))})]}),(0,Se.jsx)(hv,{children:I==0?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("span",{children:"Didn't get an email?"}),(0,Se.jsx)("button",{onClick:a,children:"Resend code"})]}):(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("span",{children:"Didn't get a message?"}),(0,Se.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,Se.jsx)(q,{protectedByPrivy:!0})]})},uv=Di.default.div`
731
731
  display: flex;
732
732
  flex-direction: column;
733
733
  align-items: flex-start;
@@ -735,7 +735,7 @@ Resources:
735
735
  margin: auto;
736
736
  gap: 16px;
737
737
  flex-grow: 1;
738
- `,fv=Ui.default.div`
738
+ `,mv=Di.default.div`
739
739
  display: flex;
740
740
  flex-direction: column;
741
741
  width: 100%;
@@ -791,7 +791,7 @@ Resources:
791
791
  transform: translate(1px, 0px);
792
792
  }
793
793
  }
794
- `,hv=Ui.default.div`
794
+ `,fv=Di.default.div`
795
795
  line-height: 20px;
796
796
  height: 20px;
797
797
  font-size: 13px;
@@ -799,7 +799,7 @@ Resources:
799
799
  display: flex;
800
800
  justify-content: flex-end;
801
801
  width: 100%;
802
- `,yv=Ui.default.div`
802
+ `,hv=Di.default.div`
803
803
  font-size: 13px;
804
804
  color: var(--privy-color-foreground-3);
805
805
  display: flex;
@@ -813,10 +813,10 @@ Resources:
813
813
  > button {
814
814
  text-decoration: underline;
815
815
  }
816
- `,Df=Ui.default.span`
816
+ `,Nf=Di.default.span`
817
817
  font-weight: 500;
818
818
  word-break: break-all;
819
- `;var qf=h(require("@heroicons/react/24/solid/CheckCircleIcon")),$f=h(require("@heroicons/react/24/solid/XCircleIcon")),kr=require("react"),Kf=h(require("styled-components"));var Gf=h(require("styled-components"));var co=require("react/jsx-runtime"),Vf=({icon:e})=>{let t=e;return(0,co.jsx)(co.Fragment,{children:(0,co.jsx)(gv,{children:(0,co.jsxs)("div",{children:[(0,co.jsx)(St,{}),typeof t=="string"?(0,co.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,co.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,co.jsx)("span",{})]})})})},gv=Gf.default.div`
819
+ `;var zf=h(require("@heroicons/react/24/solid/CheckCircleIcon")),qf=h(require("@heroicons/react/24/solid/XCircleIcon")),kr=require("react"),$f=h(require("styled-components"));var Hf=h(require("styled-components"));var co=require("react/jsx-runtime"),Gf=({icon:e})=>{let t=e;return(0,co.jsx)(co.Fragment,{children:(0,co.jsx)(yv,{children:(0,co.jsxs)("div",{children:[(0,co.jsx)(St,{}),typeof t=="string"?(0,co.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,co.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,co.jsx)("span",{})]})})})},yv=Hf.default.div`
820
820
  display: flex;
821
821
  flex-direction: column;
822
822
  justify-content: center;
@@ -839,14 +839,14 @@ Resources:
839
839
  left: -19px;
840
840
  top: -19px;
841
841
  }
842
- `;var Rt=require("react/jsx-runtime"),jf=500,zf=jf*2,Yf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=k(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Pe(),f=(0,kr.useRef)([]),y=Y=>{f.current=[Y,...f.current]},[g,C]=(0,kr.useState)(!0);(0,kr.useEffect)(()=>{let Y=setTimeout(C,zf,!1);return y(Y),()=>{f.current.forEach(D=>clearTimeout(D)),f.current=[]}},[]);let[v,x]=(0,kr.useState)(""),[S,b]=(0,kr.useState)("Checking that you are a human..."),[R,A]=(0,kr.useState)((0,Rt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"})),[O,M]=(0,kr.useState)(!1),[I,V]=(0,kr.useState)(3),Z=r?.captchaModalData,ee=async Y=>{try{await Z?.callback(Y),Z?.onSuccessNavigateTo&&n(Z?.onSuccessNavigateTo,!1)}catch(D){if(D instanceof oo)return;{let be={error:D,previousScreen:e||"LANDING"};i({errorModalData:be}),n(Z?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,kr.useEffect)(()=>{if(a==="success"){let Y=setTimeout(async()=>{let D=await s();!D||Z?.userIntentRequired||ee(D)},zf);y(Y)}else if(a==="ready"){let Y=setTimeout(()=>{a==="ready"&&u()},jf);y(Y)}},[a]),(0,kr.useEffect)(()=>{if(!g)switch(a){case"success":x("Success!"),b("CAPTCHA passed successfully."),A((0,Rt.jsx)(N,{onClick:()=>{M(!0),ee(l)},disabled:!Z?.userIntentRequired,loading:O,children:Z?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),b("Checking that you are a human..."),A((0,Rt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),I<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(b("You did not pass CAPTCHA. Please try again."),A((0,Rt.jsx)(N,{onClick:L,children:"Retry"})));break;case"ready":default:break}},[a,g,O]);let L=async()=>{if(I<=0)return;V(D=>D-1),c(),u();let Y=await s();!Y||Z?.userIntentRequired||ee(Y)};return(0,Rt.jsxs)(Rt.Fragment,{children:[(0,Rt.jsx)(_,{backFn:!e||t===e?void 0:o}),(0,Rt.jsxs)(vv,{children:[a==="success"?(0,Rt.jsx)(qf.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?(0,Rt.jsx)($f.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Rt.jsx)(Vf,{}),(0,Rt.jsxs)(yt,{children:[v?(0,Rt.jsx)("h3",{children:v}):null,(0,Rt.jsx)("p",{children:S})]}),R]}),(0,Rt.jsx)(z,{})]})},vv=Kf.default.div`
842
+ `;var Rt=require("react/jsx-runtime"),Kf=500,Vf=Kf*2,jf=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=k(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Te(),f=(0,kr.useRef)([]),y=j=>{f.current=[j,...f.current]},[g,C]=(0,kr.useState)(!0);(0,kr.useEffect)(()=>{let j=setTimeout(C,Vf,!1);return y(j),()=>{f.current.forEach(D=>clearTimeout(D)),f.current=[]}},[]);let[v,x]=(0,kr.useState)(""),[S,b]=(0,kr.useState)("Checking that you are a human..."),[R,A]=(0,kr.useState)((0,Rt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"})),[O,M]=(0,kr.useState)(!1),[I,V]=(0,kr.useState)(3),Y=r?.captchaModalData,ee=async j=>{try{await Y?.callback(j),Y?.onSuccessNavigateTo&&n(Y?.onSuccessNavigateTo,!1)}catch(D){if(D instanceof oo)return;{let be={error:D,previousScreen:e||"LANDING"};i({errorModalData:be}),n(Y?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,kr.useEffect)(()=>{if(a==="success"){let j=setTimeout(async()=>{let D=await s();!D||Y?.userIntentRequired||ee(D)},Vf);y(j)}else if(a==="ready"){let j=setTimeout(()=>{a==="ready"&&u()},Kf);y(j)}},[a]),(0,kr.useEffect)(()=>{if(!g)switch(a){case"success":x("Success!"),b("CAPTCHA passed successfully."),A((0,Rt.jsx)(N,{onClick:()=>{M(!0),ee(l)},disabled:!Y?.userIntentRequired,loading:O,children:Y?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),b("Checking that you are a human..."),A((0,Rt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),I<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(b("You did not pass CAPTCHA. Please try again."),A((0,Rt.jsx)(N,{onClick:L,children:"Retry"})));break;case"ready":default:break}},[a,g,O]);let L=async()=>{if(I<=0)return;V(D=>D-1),c(),u();let j=await s();!j||Y?.userIntentRequired||ee(j)};return(0,Rt.jsxs)(Rt.Fragment,{children:[(0,Rt.jsx)(_,{backFn:!e||t===e?void 0:o}),(0,Rt.jsxs)(gv,{children:[a==="success"?(0,Rt.jsx)(zf.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?(0,Rt.jsx)(qf.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Rt.jsx)(Gf,{}),(0,Rt.jsxs)(gt,{children:[v?(0,Rt.jsx)("h3",{children:v}):null,(0,Rt.jsx)("p",{children:S})]}),R]}),(0,Rt.jsx)(z,{})]})},gv=$f.default.div`
843
843
  display: flex;
844
844
  flex-direction: column;
845
845
  align-items: center;
846
846
  justify-content: center;
847
847
  gap: 24px;
848
848
  width: 100%;
849
- `;var rh=h(require("@heroicons/react/24/outline/WalletIcon")),oh=require("react-device-detect"),nh=h(require("styled-components"));var tr=require("react/jsx-runtime"),Zf=({...e})=>(0,tr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,tr.jsx)("defs",{children:(0,tr.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,tr.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,tr.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,tr.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,tr.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,tr.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,tr.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,tr.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,tr.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,tr.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,tr.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var It=require("react/jsx-runtime"),Jf=({style:e,...t})=>(0,It.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,It.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,It.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,It.jsxs)("defs",{children:[(0,It.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,It.jsx)("stop",{stopColor:"#002D72"}),(0,It.jsx)("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),(0,It.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,It.jsx)("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),(0,It.jsx)("stop",{offset:"1",stopColor:"#002D72"})]})]})]});var dt=require("react/jsx-runtime"),Qf=e=>(0,dt.jsxs)("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,dt.jsx)("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),(0,dt.jsx)("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),(0,dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),(0,dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),(0,dt.jsx)("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),(0,dt.jsxs)("defs",{children:[(0,dt.jsxs)("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[(0,dt.jsx)("stop",{stopColor:"white"}),(0,dt.jsx)("stop",{offset:"1",stopColor:"white"})]}),(0,dt.jsxs)("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[(0,dt.jsx)("stop",{stopColor:"#8697FF"}),(0,dt.jsx)("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),(0,dt.jsxs)("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[(0,dt.jsx)("stop",{stopColor:"#8697FF"}),(0,dt.jsx)("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),(0,dt.jsxs)("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[(0,dt.jsx)("stop",{stopColor:"white"}),(0,dt.jsx)("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});var J=require("react/jsx-runtime"),Xf=({style:e,...t})=>(0,J.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,J.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,J.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,J.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,J.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,J.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,J.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,J.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,J.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,J.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,J.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,J.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,J.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,J.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,J.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,J.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,J.jsxs)("defs",{children:[(0,J.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,J.jsx)("stop",{stopColor:"#174299"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,J.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,J.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,J.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,J.jsx)("stop",{stopColor:"#FF4000"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,J.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,J.jsx)("stop",{stopColor:"#8754C9"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,J.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,J.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,J.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,J.jsx)("stop",{stopColor:"#FFF700"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,J.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,J.jsx)("stop",{stopColor:"#FFF700"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,J.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,J.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,J.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,J.jsx)("stop",{stopColor:"#00AAFF"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,J.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,J.jsx)("stop",{stopColor:"#00AAFF"}),(0,J.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,J.jsx)("clipPath",{id:"clip0_5_32",children:(0,J.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,J.jsx)("clipPath",{id:"clip1_5_32",children:(0,J.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var hr=require("react/jsx-runtime"),eh=({style:e,...t})=>(0,hr.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,hr.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,hr.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,hr.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var zo=require("react/jsx-runtime"),th=({style:e,...t})=>(0,zo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,zo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,zo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,zo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,zo.jsx)("defs",{children:(0,zo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,zo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var qo=require("react/jsx-runtime"),_o={coinbase_wallet:{logo:sl,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Si,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:wo,displayName:"Phantom"},rainbow:{logo:Xf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Ba,displayName:"WalletConnect"},zerion:{logo:th,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Zf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Jf,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:eh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Qf,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},Jn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=k(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{ln()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(oh.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,qo.jsxs)(Ev,{onClick:s,children:[(0,qo.jsx)(bv,{icon:wv(e,n.connectorType)??r,name:n.walletClientType}),(0,qo.jsx)("span",{children:Cv(e,n.connectorType)||t||n.walletClientType}),(0,qo.jsx)("span",{id:"connect-text",children:"Connect"})]})},Cv=(e,t)=>{if(_o[e]?.displayName)return _o[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},wv=(e,t)=>{if(_o[e]?.logo)return _o[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Ba},bv=({icon:e,name:t})=>typeof e=="string"?(0,qo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,qo.jsx)(rh.default,{}):e?(0,qo.jsx)(e,{}):null,Ev=(0,nh.default)(Ne)`
849
+ `;var th=h(require("@heroicons/react/24/outline/WalletIcon")),rh=require("react-device-detect"),oh=h(require("styled-components"));var tr=require("react/jsx-runtime"),Yf=({...e})=>(0,tr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,tr.jsx)("defs",{children:(0,tr.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,tr.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,tr.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,tr.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,tr.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,tr.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,tr.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,tr.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,tr.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,tr.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,tr.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var It=require("react/jsx-runtime"),Zf=({style:e,...t})=>(0,It.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,It.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,It.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,It.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,It.jsxs)("defs",{children:[(0,It.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,It.jsx)("stop",{stopColor:"#002D72"}),(0,It.jsx)("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),(0,It.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,It.jsx)("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),(0,It.jsx)("stop",{offset:"1",stopColor:"#002D72"})]})]})]});var pt=require("react/jsx-runtime"),Jf=e=>(0,pt.jsxs)("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,pt.jsx)("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),(0,pt.jsx)("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),(0,pt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),(0,pt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),(0,pt.jsx)("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),(0,pt.jsxs)("defs",{children:[(0,pt.jsxs)("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[(0,pt.jsx)("stop",{stopColor:"white"}),(0,pt.jsx)("stop",{offset:"1",stopColor:"white"})]}),(0,pt.jsxs)("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[(0,pt.jsx)("stop",{stopColor:"#8697FF"}),(0,pt.jsx)("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),(0,pt.jsxs)("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[(0,pt.jsx)("stop",{stopColor:"#8697FF"}),(0,pt.jsx)("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),(0,pt.jsxs)("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[(0,pt.jsx)("stop",{stopColor:"white"}),(0,pt.jsx)("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});var Z=require("react/jsx-runtime"),Qf=({style:e,...t})=>(0,Z.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Z.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,Z.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,Z.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,Z.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,Z.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,Z.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,Z.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,Z.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,Z.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,Z.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,Z.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,Z.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,Z.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,Z.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,Z.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,Z.jsxs)("defs",{children:[(0,Z.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,Z.jsx)("stop",{stopColor:"#174299"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,Z.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,Z.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Z.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Z.jsx)("stop",{stopColor:"#FF4000"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Z.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,Z.jsx)("stop",{stopColor:"#8754C9"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,Z.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,Z.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Z.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Z.jsx)("stop",{stopColor:"#FFF700"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Z.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,Z.jsx)("stop",{stopColor:"#FFF700"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Z.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,Z.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Z.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,Z.jsx)("stop",{stopColor:"#00AAFF"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Z.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,Z.jsx)("stop",{stopColor:"#00AAFF"}),(0,Z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Z.jsx)("clipPath",{id:"clip0_5_32",children:(0,Z.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,Z.jsx)("clipPath",{id:"clip1_5_32",children:(0,Z.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var hr=require("react/jsx-runtime"),Xf=({style:e,...t})=>(0,hr.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,hr.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,hr.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,hr.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,hr.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var zo=require("react/jsx-runtime"),eh=({style:e,...t})=>(0,zo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,zo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,zo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,zo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,zo.jsx)("defs",{children:(0,zo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,zo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var qo=require("react/jsx-runtime"),_o={coinbase_wallet:{logo:sl,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Pi,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:wo,displayName:"Phantom"},rainbow:{logo:Qf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Ba,displayName:"WalletConnect"},zerion:{logo:eh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Yf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Zf,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Xf,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Jf,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},Zn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=k(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{ln()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(rh.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,qo.jsxs)(bv,{onClick:s,children:[(0,qo.jsx)(wv,{icon:Cv(e,n.connectorType)??r,name:n.walletClientType}),(0,qo.jsx)("span",{children:vv(e,n.connectorType)||t||n.walletClientType}),(0,qo.jsx)("span",{id:"connect-text",children:"Connect"})]})},vv=(e,t)=>{if(_o[e]?.displayName)return _o[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Cv=(e,t)=>{if(_o[e]?.logo)return _o[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Ba},wv=({icon:e,name:t})=>typeof e=="string"?(0,qo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,qo.jsx)(th.default,{}):e?(0,qo.jsx)(e,{}):null,bv=(0,oh.default)(De)`
850
850
  /* Show "Connect" on hover */
851
851
  > #connect-text {
852
852
  font-weight: 500;
@@ -868,23 +868,23 @@ Resources:
868
868
  display: none;
869
869
  }
870
870
  }
871
- `;var po=require("react/jsx-runtime"),Pv=["coinbase_wallet"],Tv=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],Sv=["cryptocom"],_v=["phantom"],Fi=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=k(),o=Va(r.appearance.walletList,t,e,r.appearance.walletList);return(0,po.jsxs)(po.Fragment,{children:[...o]})},Va=(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:y}=u;(f==="unknown"?i:n).push((0,po.jsx)(Jn,{connectOnly:r,provider:f,logo:y.icon,displayName:y.name,connector:u},`${s}-${f}`))}}else if(_v.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push((0,po.jsx)(Jn,{connectOnly:r,provider:s,connector:c},s))}else if(Tv.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push((0,po.jsx)(Jn,{connectOnly:r,provider:s,connector:c},s))}else if(Pv.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push((0,po.jsx)(Jn,{connectOnly:r,provider:s,connector:c},s))}else Sv.includes(s)?l&&a.push((0,po.jsx)(Jn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push((0,po.jsx)(Jn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};var xo=require("react/jsx-runtime"),ih=()=>{let{app:e}=k(),t=`Connect a wallet to ${e?.name}`;return(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)(_,{},"header"),(0,xo.jsx)(So,{title:"Connect your wallet",description:t}),(0,xo.jsx)(io,{children:(0,xo.jsx)(Fi,{connectOnly:!0})}),(0,xo.jsx)($,{protectedByPrivy:!0})]})};var dh=h(require("styled-components"));var ch=h(require("styled-components"));var ah=h(require("react"));var lh=require("react/jsx-runtime"),sh=()=>{let{app:e}=k(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,lh.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?ah.default.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};var zd=require("react/jsx-runtime"),Bi=e=>{let{app:t}=k();return t?.appearance.logo?(0,zd.jsx)(xv,{...e,children:(0,zd.jsx)(sh,{})}):null},xv=ch.default.div`
871
+ `;var po=require("react/jsx-runtime"),Ev=["coinbase_wallet"],Pv=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],Tv=["cryptocom"],Sv=["phantom"],Ui=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=k(),o=Va(r.appearance.walletList,t,e,r.appearance.walletList);return(0,po.jsxs)(po.Fragment,{children:[...o]})},Va=(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:y}=u;(f==="unknown"?i:n).push((0,po.jsx)(Zn,{connectOnly:r,provider:f,logo:y.icon,displayName:y.name,connector:u},`${s}-${f}`))}}else if(Sv.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push((0,po.jsx)(Zn,{connectOnly:r,provider:s,connector:c},s))}else if(Pv.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push((0,po.jsx)(Zn,{connectOnly:r,provider:s,connector:c},s))}else if(Ev.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push((0,po.jsx)(Zn,{connectOnly:r,provider:s,connector:c},s))}else Tv.includes(s)?l&&a.push((0,po.jsx)(Zn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push((0,po.jsx)(Zn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};var xo=require("react/jsx-runtime"),nh=()=>{let{app:e}=k(),t=`Connect a wallet to ${e?.name}`;return(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)(_,{},"header"),(0,xo.jsx)(So,{title:"Connect your wallet",description:t}),(0,xo.jsx)(io,{children:(0,xo.jsx)(Ui,{connectOnly:!0})}),(0,xo.jsx)(q,{protectedByPrivy:!0})]})};var ch=h(require("styled-components"));var lh=h(require("styled-components"));var ih=h(require("react"));var sh=require("react/jsx-runtime"),ah=()=>{let{app:e}=k(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,sh.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?ih.default.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};var Vd=require("react/jsx-runtime"),Fi=e=>{let{app:t}=k();return t?.appearance.logo?(0,Vd.jsx)(_v,{...e,children:(0,Vd.jsx)(ah,{})}):null},_v=lh.default.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
- `;var uo=require("react/jsx-runtime"),ph=()=>{let{app:e}=k();return(0,uo.jsxs)(uo.Fragment,{children:[(0,uo.jsx)(_,{},"header"),(0,uo.jsx)(kv,{}),(0,uo.jsx)(io,{children:(0,uo.jsx)(Fi,{connectOnly:!0})}),e&&(0,uo.jsx)(Ni,{app:e,alwaysShowImplicitConsent:!0}),(0,uo.jsx)($,{protectedByPrivy:!0})]})},kv=(0,dh.default)(Bi)`
878
+ `;var uo=require("react/jsx-runtime"),dh=()=>{let{app:e}=k();return(0,uo.jsxs)(uo.Fragment,{children:[(0,uo.jsx)(_,{},"header"),(0,uo.jsx)(xv,{}),(0,uo.jsx)(io,{children:(0,uo.jsx)(Ui,{connectOnly:!0})}),e&&(0,uo.jsx)(Oi,{app:e,alwaysShowImplicitConsent:!0}),(0,uo.jsx)(q,{protectedByPrivy:!0})]})},xv=(0,ch.default)(Fi)`
879
879
  margin-bottom: 16px;
880
- `;var Gi=require("react"),hh=require("react-device-detect"),yh=h(require("styled-components"));var zr=require("react"),qa=require("react-device-detect"),$d=h(require("styled-components"));var za=require("react"),Av=(e,t)=>{let r=(0,za.useRef)(()=>{});(0,za.useEffect)(()=>{r.current=e}),(0,za.useEffect)(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},uh=Av;var Hi=require("react");function mh(){let[e,t]=(0,Hi.useState)(!1),r=(0,Hi.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Hi.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var He=require("react/jsx-runtime"),qd=2,Kd=e=>e?.privyErrorCode==="linked_to_another_user"?Bo.ERROR_USER_EXISTS:e instanceof nt&&!e.details.default?e.details:e instanceof wi?Bo.ERROR_TIMED_OUT:e instanceof bi?Bo.ERROR_USER_REJECTED_CONNECTION:Bo.ERROR_WALLET_CONNECTION,fh=()=>{let[e,t]=(0,zr.useState)(!1),[r,o]=(0,zr.useState)(!1),[n,i]=(0,zr.useState)(void 0),{authenticated:a,logout:l}=H(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:y,setModalData:g}=k(),{getAuthFlow:C,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:S,loginWithWallet:b,updateWallets:R,createAnalyticsEvent:A}=W(),{walletConnectors:O}=H(),[M,I]=(0,zr.useState)(0),{user:V}=H(),[Z]=(0,zr.useState)(V?.linkedAccounts.length||0),[ee,L]=(0,zr.useState)(""),[Y,D]=(0,zr.useState)(!1),{hasTabbedAway:be}=mh(),{enabled:ve,token:Ce}=Pe(),Le=qa.isMobile&&v?.connector?.connectorType==="wallet_connect_v2"||qa.isMobile&&v?.connector?.connectorType==="coinbase_wallet"||qa.isMobile&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",ce=v?.status==="connected",Jt=v?.status==="switching_to_supported_chain";(0,zr.useEffect)(()=>{let Oe=C();if(ce&&!Oe&&(ve&&!Ce&&!a?(g({captchaModalData:{callback:ie=>S(v.connectedWallet,ie).then(()=>{D(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):S(v.connectedWallet,Ce).then(()=>{D(!0)})),Oe&&Le&&ce&&!Oe.preparedMessage){Oe.buildSiweMessage();return}!Oe||Le||!ce||r||(async()=>{o(!0),i(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await dd(2500),await nr()}catch(ie){console.warn("Auto-prompted signature failed",ie)}finally{o(!1)}})()},[M,ce,Y]),(0,zr.useEffect)(()=>{if(V&&e){let Oe=s?.render.inDialog?Xe:0,ie=s?.render.inDialog?Oe-500:0;if(s?.legal.requireUsersAcceptTerms&&!V.hasAcceptedTerms){let xe=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ie);return()=>clearTimeout(xe)}if(cr(V,s?.embeddedWallets?.createOnLogin)){let xe=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:rt=>{console.error(rt),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:rt,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ie);return()=>clearTimeout(xe)}R();let ae=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Xe);return()=>clearTimeout(ae)}},[V,e]);let Ct=Oe=>{if(Oe?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Oe?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(Oe).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(Kd(Oe))};async function nr(){try{if(await b(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Oe){Ct(Oe)}finally{o(!1)}}(0,zr.useEffect)(()=>{v?.connectError&&Ct(v?.connectError)},[v]),uh(()=>{let Oe=Et==="wallet_connect_v2"&&v?.connector instanceof Eo?v.connector.redirectUri:void 0;Oe&&L(Oe)},v?.connector instanceof Eo&&!ee?500:null);let Et=v?.connector?.connectorType||"injected",Nr=v?.connector?.walletClientType||"unknown",je=_o[Nr]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",ft=_o[Nr]?.logo||v?.connector?.walletBranding.icon||(Oe=>(0,He.jsx)(Ti,{...Oe})),Dr=je==="Browser Extension"?je.toLowerCase():je,ir;e?ir=`Successfully connected with ${Dr}`:n?ir=n.message:Jt?ir="Switching networks":ce?ir=r&&Le?"Signing":"Sign to verify":ir=`Waiting for ${Dr}`;let st="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Oe=V?.linkedAccounts.length||0;Z===Oe?st="Wallet was already linked.":st="You\u2019re good to go!"}else M>=qd&&n?st="Unable to connect wallet":n?st=n.detail:Jt?st="Switch your wallet to the requested network.":ce&&Le?st="Sign the message in your wallet to verify it belongs to you.":Nr==="metamask"&&qa.isMobile?st="Click continue to open and connect MetaMask.":Nr==="metamask"?st="For the best experience, connect only one wallet at a time.":Et==="wallet_connect"?st="Open your mobile wallet app to continue":Et==="coinbase_wallet"&&(Bu()||(Ad(V)?st="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":st="Open the Coinbase app on your phone to continue."));let U=O?.walletConnectors?.find(Oe=>Oe.walletClientType==="coinbase_wallet"),Ln=Nr==="coinbase_wallet"&&(Ad(V)||n===Bo.ERROR_USER_EXISTS);return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(_,{backFn:!f||y===f?void 0:u}),(0,He.jsxs)(Rv,{children:[(0,He.jsx)(jd,{walletLogo:ft,success:e,fail:!!n}),(0,He.jsxs)(yt,{children:[(0,He.jsx)("h3",{children:ir}),(0,He.jsx)("p",{children:st}),!ce&&ee&&!be?(0,He.jsxs)("p",{children:["Still here?"," ",(0,He.jsx)("a",{href:ee,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Ln?(0,He.jsx)(N,{onClick:()=>U&&U?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Bo.ERROR_USER_EXISTS&&y!==f?(0,He.jsx)(N,{onClick:u,children:"Use a different wallet"}):ce&&!e&&Le?(0,He.jsx)(N,{onClick:()=>{o(!0),nr()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&M<qd?(0,He.jsx)(N,{onClick:()=>{I(M+1),i(void 0),ce?(o(!0),nr()):v?.connectRetry()},disabled:!e&&(!n?.retryable||M>=qd),children:"Retry"}):!e&&!n?(0,He.jsx)(N,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,He.jsx)(z,{})]})},Rv=$d.default.div`
880
+ `;var Hi=require("react"),fh=require("react-device-detect"),hh=h(require("styled-components"));var zr=require("react"),qa=require("react-device-detect"),qd=h(require("styled-components"));var za=require("react"),kv=(e,t)=>{let r=(0,za.useRef)(()=>{});(0,za.useEffect)(()=>{r.current=e}),(0,za.useEffect)(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},ph=kv;var Bi=require("react");function uh(){let[e,t]=(0,Bi.useState)(!1),r=(0,Bi.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Bi.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ge=require("react/jsx-runtime"),zd=2,$d=e=>e?.privyErrorCode==="linked_to_another_user"?Bo.ERROR_USER_EXISTS:e instanceof nt&&!e.details.default?e.details:e instanceof vi?Bo.ERROR_TIMED_OUT:e instanceof Ci?Bo.ERROR_USER_REJECTED_CONNECTION:Bo.ERROR_WALLET_CONNECTION,mh=()=>{let[e,t]=(0,zr.useState)(!1),[r,o]=(0,zr.useState)(!1),[n,i]=(0,zr.useState)(void 0),{authenticated:a,logout:l}=H(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:y,setModalData:g}=k(),{getAuthFlow:C,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:S,loginWithWallet:b,updateWallets:R,createAnalyticsEvent:A}=W(),{walletConnectors:O}=H(),[M,I]=(0,zr.useState)(0),{user:V}=H(),[Y]=(0,zr.useState)(V?.linkedAccounts.length||0),[ee,L]=(0,zr.useState)(""),[j,D]=(0,zr.useState)(!1),{hasTabbedAway:be}=uh(),{enabled:ve,token:Ce}=Te(),Oe=qa.isMobile&&v?.connector?.connectorType==="wallet_connect_v2"||qa.isMobile&&v?.connector?.connectorType==="coinbase_wallet"||qa.isMobile&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",ce=v?.status==="connected",Zt=v?.status==="switching_to_supported_chain";(0,zr.useEffect)(()=>{let Ne=C();if(ce&&!Ne&&(ve&&!Ce&&!a?(g({captchaModalData:{callback:ie=>S(v.connectedWallet,ie).then(()=>{D(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):S(v.connectedWallet,Ce).then(()=>{D(!0)})),Ne&&Oe&&ce&&!Ne.preparedMessage){Ne.buildSiweMessage();return}!Ne||Oe||!ce||r||(async()=>{o(!0),i(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await dd(2500),await nr()}catch(ie){console.warn("Auto-prompted signature failed",ie)}finally{o(!1)}})()},[M,ce,j]),(0,zr.useEffect)(()=>{if(V&&e){let Ne=s?.render.inDialog?Xe:0,ie=s?.render.inDialog?Ne-500:0;if(s?.legal.requireUsersAcceptTerms&&!V.hasAcceptedTerms){let ke=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ie);return()=>clearTimeout(ke)}if(cr(V,s?.embeddedWallets?.createOnLogin)){let ke=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:rt=>{console.error(rt),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:rt,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ie);return()=>clearTimeout(ke)}R();let ae=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Xe);return()=>clearTimeout(ae)}},[V,e]);let wt=Ne=>{if(Ne?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Ne?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(Ne).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i($d(Ne))};async function nr(){try{if(await b(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Ne){wt(Ne)}finally{o(!1)}}(0,zr.useEffect)(()=>{v?.connectError&&wt(v?.connectError)},[v]),ph(()=>{let Ne=Pt==="wallet_connect_v2"&&v?.connector instanceof Eo?v.connector.redirectUri:void 0;Ne&&L(Ne)},v?.connector instanceof Eo&&!ee?500:null);let Pt=v?.connector?.connectorType||"injected",Nr=v?.connector?.walletClientType||"unknown",Ye=_o[Nr]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",ht=_o[Nr]?.logo||v?.connector?.walletBranding.icon||(Ne=>(0,Ge.jsx)(Ei,{...Ne})),Dr=Ye==="Browser Extension"?Ye.toLowerCase():Ye,ir;e?ir=`Successfully connected with ${Dr}`:n?ir=n.message:Zt?ir="Switching networks":ce?ir=r&&Oe?"Signing":"Sign to verify":ir=`Waiting for ${Dr}`;let st="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Ne=V?.linkedAccounts.length||0;Y===Ne?st="Wallet was already linked.":st="You\u2019re good to go!"}else M>=zd&&n?st="Unable to connect wallet":n?st=n.detail:Zt?st="Switch your wallet to the requested network.":ce&&Oe?st="Sign the message in your wallet to verify it belongs to you.":Nr==="metamask"&&qa.isMobile?st="Click continue to open and connect MetaMask.":Nr==="metamask"?st="For the best experience, connect only one wallet at a time.":Pt==="wallet_connect"?st="Open your mobile wallet app to continue":Pt==="coinbase_wallet"&&(Fu()||(kd(V)?st="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":st="Open the Coinbase app on your phone to continue."));let U=O?.walletConnectors?.find(Ne=>Ne.walletClientType==="coinbase_wallet"),Wn=Nr==="coinbase_wallet"&&(kd(V)||n===Bo.ERROR_USER_EXISTS);return(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(_,{backFn:!f||y===f?void 0:u}),(0,Ge.jsxs)(Av,{children:[(0,Ge.jsx)(Kd,{walletLogo:ht,success:e,fail:!!n}),(0,Ge.jsxs)(gt,{children:[(0,Ge.jsx)("h3",{children:ir}),(0,Ge.jsx)("p",{children:st}),!ce&&ee&&!be?(0,Ge.jsxs)("p",{children:["Still here?"," ",(0,Ge.jsx)("a",{href:ee,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Wn?(0,Ge.jsx)(N,{onClick:()=>U&&U?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Bo.ERROR_USER_EXISTS&&y!==f?(0,Ge.jsx)(N,{onClick:u,children:"Use a different wallet"}):ce&&!e&&Oe?(0,Ge.jsx)(N,{onClick:()=>{o(!0),nr()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&M<zd?(0,Ge.jsx)(N,{onClick:()=>{I(M+1),i(void 0),ce?(o(!0),nr()):v?.connectRetry()},disabled:!e&&(!n?.retryable||M>=zd),children:"Retry"}):!e&&!n?(0,Ge.jsx)(N,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,Ge.jsx)(z,{})]})},Av=qd.default.div`
881
881
  display: flex;
882
882
  flex-direction: column;
883
883
  align-items: center;
884
884
  justify-content: center;
885
885
  gap: 24px;
886
886
  width: 100%;
887
- `,Iv=$d.default.div`
887
+ `,Rv=qd.default.div`
888
888
  display: flex;
889
889
  flex-direction: column;
890
890
  justify-content: center;
@@ -907,14 +907,14 @@ Resources:
907
907
  left: -19px;
908
908
  top: -19px;
909
909
  }
910
- `,jd=e=>{let t=e.walletLogo;return(0,He.jsx)(He.Fragment,{children:(0,He.jsx)(Iv,{children:(0,He.jsxs)("div",{children:[(0,He.jsx)(St,{success:e.success,fail:e.fail}),typeof t=="string"?(0,He.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,He.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var $t=require("react/jsx-runtime"),ec=2,gh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=k(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[i,a]=(0,Gi.useState)(void 0),[l,s]=(0,Gi.useState)(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Gi.useEffect)(()=>{if(c){let R=setTimeout(n,Xe);return()=>clearTimeout(R)}},[c]);let f=R=>{a(Kd(R))};(0,Gi.useEffect)(()=>{o?.connectError&&f(o?.connectError)},[o]);let y=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",C=_o[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=_o[g]?.logo||o?.connector?.walletBranding.icon||(R=>(0,$t.jsx)(Ti,{...R})),x=C==="Browser Extension"?C.toLowerCase():C,S;c?S=`Successfully connected with ${x}`:i?S=i.message:u?S="Switching networks":S=`Waiting for ${x}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":l>=ec&&i?b="Unable to connect wallet":i?b=i.detail:u?b="Switch your wallet to the requested network.":g==="metamask"&&hh.isMobile?b="Click to continue to open and connect MetaMask.":g==="metamask"?b="For the best experience, connect only one wallet at a time.":y==="wallet_connect_v2"?b="Open your mobile wallet app to continue":y==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(_,{backFn:r===t?void 0:e}),(0,$t.jsxs)(Mv,{children:[(0,$t.jsx)(jd,{walletLogo:v,success:c,fail:!!i}),(0,$t.jsxs)(yt,{children:[(0,$t.jsx)("h3",{children:S}),(0,$t.jsx)("p",{children:b})]}),i==Bo.ERROR_USER_EXISTS?(0,$t.jsx)(N,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<ec?(0,$t.jsx)(N,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=ec),children:"Retry"}):!c&&i&&l>=ec?(0,$t.jsx)(N,{onClick:e,children:"Use a different wallet"}):null]}),(0,$t.jsx)(z,{})]})},Mv=yh.default.div`
910
+ `,Kd=e=>{let t=e.walletLogo;return(0,Ge.jsx)(Ge.Fragment,{children:(0,Ge.jsx)(Rv,{children:(0,Ge.jsxs)("div",{children:[(0,Ge.jsx)(St,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ge.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ge.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var qt=require("react/jsx-runtime"),ec=2,yh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=k(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[i,a]=(0,Hi.useState)(void 0),[l,s]=(0,Hi.useState)(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Hi.useEffect)(()=>{if(c){let R=setTimeout(n,Xe);return()=>clearTimeout(R)}},[c]);let f=R=>{a($d(R))};(0,Hi.useEffect)(()=>{o?.connectError&&f(o?.connectError)},[o]);let y=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",C=_o[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=_o[g]?.logo||o?.connector?.walletBranding.icon||(R=>(0,qt.jsx)(Ei,{...R})),x=C==="Browser Extension"?C.toLowerCase():C,S;c?S=`Successfully connected with ${x}`:i?S=i.message:u?S="Switching networks":S=`Waiting for ${x}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":l>=ec&&i?b="Unable to connect wallet":i?b=i.detail:u?b="Switch your wallet to the requested network.":g==="metamask"&&fh.isMobile?b="Click to continue to open and connect MetaMask.":g==="metamask"?b="For the best experience, connect only one wallet at a time.":y==="wallet_connect_v2"?b="Open your mobile wallet app to continue":y==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)(_,{backFn:r===t?void 0:e}),(0,qt.jsxs)(Iv,{children:[(0,qt.jsx)(Kd,{walletLogo:v,success:c,fail:!!i}),(0,qt.jsxs)(gt,{children:[(0,qt.jsx)("h3",{children:S}),(0,qt.jsx)("p",{children:b})]}),i==Bo.ERROR_USER_EXISTS?(0,qt.jsx)(N,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<ec?(0,qt.jsx)(N,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=ec),children:"Retry"}):!c&&i&&l>=ec?(0,qt.jsx)(N,{onClick:e,children:"Use a different wallet"}):null]}),(0,qt.jsx)(z,{})]})},Iv=hh.default.div`
911
911
  display: flex;
912
912
  flex-direction: column;
913
913
  align-items: center;
914
914
  justify-content: center;
915
915
  gap: 24px;
916
916
  width: 100%;
917
- `;var Ph=h(require("@heroicons/react/24/solid/XCircleIcon")),Ki=require("react"),Th=h(require("styled-components"));var $a=h(require("styled-components")),Vi=require("react/jsx-runtime"),zi=()=>(0,Vi.jsx)(Wv,{children:(0,Vi.jsxs)(Lv,{children:[(0,Vi.jsx)(Ov,{}),(0,Vi.jsx)(Nv,{})]})}),Wv=$a.default.div`
917
+ `;var Eh=h(require("@heroicons/react/24/solid/XCircleIcon")),$i=require("react"),Ph=h(require("styled-components"));var $a=h(require("styled-components")),Gi=require("react/jsx-runtime"),Vi=()=>(0,Gi.jsx)(Mv,{children:(0,Gi.jsxs)(Wv,{children:[(0,Gi.jsx)(Lv,{}),(0,Gi.jsx)(Ov,{})]})}),Mv=$a.default.div`
918
918
  display: flex;
919
919
  justify-content: center;
920
920
  align-items: center;
@@ -926,14 +926,14 @@ Resources:
926
926
  @media all and (display-mode: standalone) {
927
927
  margin-bottom: 30px;
928
928
  }
929
- `,Lv=$a.default.div`
929
+ `,Wv=$a.default.div`
930
930
  position: relative;
931
931
  height: 140px;
932
932
  width: 140px;
933
933
 
934
934
  opacity: 1;
935
935
  animation: fadein 200ms ease;
936
- `,Ov=$a.default.div`
936
+ `,Lv=$a.default.div`
937
937
  position: absolute;
938
938
  top: 0;
939
939
  right: 0;
@@ -946,7 +946,7 @@ Resources:
946
946
  border: 4px solid var(--privy-color-accent-light);
947
947
  border-radius: 50%;
948
948
  }
949
- `,Nv=$a.default.div`
949
+ `,Ov=$a.default.div`
950
950
  position: absolute;
951
951
  top: 0;
952
952
  right: 0;
@@ -970,20 +970,20 @@ Resources:
970
970
  transform: rotate(360deg);
971
971
  }
972
972
  }
973
- `;var vh=["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 tt=class extends Error{constructor(r,o){super(o);this.type=r}};function qi(e){let t=e.type;return typeof t=="string"&&vh.includes(t)}function Dv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function $i(e){return qi(e)&&e.type==="wallet_not_on_device"}function Ch(e){return qi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function gn(e){return!!(qi(e)&&e.type==="mfa_timeout")}function vn(e){return!!(qi(e)&&e.type==="missing_or_invalid_mfa")}function tc(e){return!!(qi(e)&&e.type==="mfa_verification_max_attempts_reached")}function rc(e){return!!(qi(e)&&e.message.includes("code 429"))}function oc(e){return!!(Dv(e)&&e.message==="MFA canceled")}function wh(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 nc(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function Yd({api:e,provider:t}){let r=xa(),o=Ys(),n=await Zs(r);try{return t==="icloud"?{url:(await e.post(Tu,{client_type:"web"})).url}:{url:(await e.post(Pu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw he(i)}}async function bh({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new P("User denied confirmation during OAuth flow");try{return(await e.post(Su,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=he(i);throw a.privyErrorCode?new P(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}var yr=require("react/jsx-runtime"),Eh=1,Sh=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=W(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=k(),u=(0,Ki.useMemo)(()=>Date.now(),[]),[f,y]=(0,Ki.useState)(!1),{onCompleteNavigateTo:g,onFailure:C,shouldForceMFA:v}=l?.connectWallet,x=b=>{f||(y(!0),C(typeof b=="string"?new Error(b):b))};(0,Ki.useEffect)(()=>{let b=Ue(t)||Ci(t),R;return!e||!b?x("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let O=await r();if(!O)return x("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:O,address:b.address}),v&&await i.verifyMfa({accessToken:O});let M=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&M<Eh?R=setTimeout(()=>{a(g)},(Eh-M)*1e3):a(g)}catch(M){if($i(M)&&b.recoveryMethod==="privy"){let I=await r();if(!I)return x("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:b.address}}),(await i?.recover({address:b.address,accessToken:I}))?.address||x(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}}),a(g)}catch{x("An error has occurred, please try again.")}}else if($i(M)&&b.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:g,onFailure:C},recoveryOAuthStatus:{provider:b.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let I=nc(b.recoveryMethod);a(I)}else x(M)}})(),()=>clearTimeout(R)):void 0},[e,t,i]);let S=()=>{x("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=S,(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsx)(_,{onClose:S}),f?(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsxs)(so,{children:[(0,yr.jsx)(Ph.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,yr.jsx)(Be,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,yr.jsx)(N,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,yr.jsx)(zi,{}),(0,yr.jsx)(Uv,{})]})},Uv=Th.default.div`
973
+ `;var gh=["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 tt=class extends Error{constructor(r,o){super(o);this.type=r}};function zi(e){let t=e.type;return typeof t=="string"&&gh.includes(t)}function Nv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function qi(e){return zi(e)&&e.type==="wallet_not_on_device"}function vh(e){return zi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function yn(e){return!!(zi(e)&&e.type==="mfa_timeout")}function gn(e){return!!(zi(e)&&e.type==="missing_or_invalid_mfa")}function tc(e){return!!(zi(e)&&e.type==="mfa_verification_max_attempts_reached")}function rc(e){return!!(zi(e)&&e.message.includes("code 429"))}function oc(e){return!!(Nv(e)&&e.message==="MFA canceled")}function Ch(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 nc(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function jd({api:e,provider:t}){let r=_a(),o=Ys(),n=await Zs(r);try{return t==="icloud"?{url:(await e.post(Pu,{client_type:"web"})).url}:{url:(await e.post(Eu,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw he(i)}}async function wh({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new T("User denied confirmation during OAuth flow");try{return(await e.post(Tu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=he(i);throw a.privyErrorCode?new T(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}var yr=require("react/jsx-runtime"),bh=1,Th=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=W(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=k(),u=(0,$i.useMemo)(()=>Date.now(),[]),[f,y]=(0,$i.useState)(!1),{onCompleteNavigateTo:g,onFailure:C,shouldForceMFA:v}=l?.connectWallet,x=b=>{f||(y(!0),C(typeof b=="string"?new Error(b):b))};(0,$i.useEffect)(()=>{let b=Fe(t)||Wa(t),R;return!e||!b?x("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let O=await r();if(!O)return x("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:O,address:b.address}),v&&await i.verifyMfa({accessToken:O});let M=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&M<bh?R=setTimeout(()=>{a(g)},(bh-M)*1e3):a(g)}catch(M){if(qi(M)&&b.recoveryMethod==="privy"){let I=await r();if(!I)return x("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:b.address}}),(await i?.recover({address:b.address,accessToken:I}))?.address||x(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}}),a(g)}catch{x("An error has occurred, please try again.")}}else if(qi(M)&&b.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:g,onFailure:C},recoveryOAuthStatus:{provider:b.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let I=nc(b.recoveryMethod);a(I)}else x(M)}})(),()=>clearTimeout(R)):void 0},[e,t,i]);let S=()=>{x("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=S,(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsx)(_,{onClose:S}),f?(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsxs)(so,{children:[(0,yr.jsx)(Eh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,yr.jsx)(He,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,yr.jsx)(N,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,yr.jsx)(Vi,{}),(0,yr.jsx)(Dv,{})]})},Dv=Ph.default.div`
974
974
  height: 44px;
975
- `;var _h=h(require("@heroicons/react/24/solid/CheckCircleIcon")),xh=require("react");var qr=require("react/jsx-runtime"),kh=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=k(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=Ue(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return(0,xh.useEffect)(()=>{let f=setTimeout(u,nm);return()=>clearTimeout(f)},[]),a.current=u,(0,qr.jsxs)(qr.Fragment,{children:[(0,qr.jsx)(_,{onClose:u}),(0,qr.jsx)(se,{}),(0,qr.jsxs)(so,{children:[(0,qr.jsx)(_h.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,qr.jsx)(Be,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,qr.jsx)(me,{}),(0,qr.jsx)($,{protectedByPrivy:!0})]})};var Ih=h(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),Mh=h(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),$o=require("react"),Ko=h(require("styled-components"));var we=require("react/jsx-runtime"),Wh=()=>{let[e,t]=(0,$o.useState)(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=k(),u=Ue(o)?.address,{onFailure:f,onSuccess:y,origin:g,appId:C}=s.keyExport,v=S=>{i({shouldCallAuthOnSuccess:!1}),f(typeof S=="string"?new Error(S):S)},x=()=>{i({shouldCallAuthOnSuccess:!1}),y(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return(0,$o.useEffect)(()=>{let S=Ue(o);if(!r||!S)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=x,(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(_,{onClose:x}),(0,we.jsxs)(Hv,{children:[(0,we.jsxs)(Be,{icon:(0,we.jsx)(Mh.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,we.jsxs)(qv,{children:[(0,we.jsx)(Bv,{style:{marginRight:6}}),cn(u)]}),(0,we.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,we.jsxs)(Gv,{children:[(0,we.jsxs)(Ah,{children:[(0,we.jsx)(Rh,{children:"1"}),(0,we.jsxs)("span",{children:[(0,we.jsx)("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."]})]}),(0,we.jsxs)(Ah,{children:[(0,we.jsx)(Rh,{children:"2"}),(0,we.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,we.jsx)("div",{style:{width:"100%"},children:e&&(0,we.jsx)(Fv,{origin:g,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,we.jsxs)($v,{children:[(0,we.jsxs)("div",{children:[(0,we.jsx)(Ih.default,{viewBox:"0 0 20 18"}),(0,we.jsx)("h4",{children:"Warning"})]}),(0,we.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,we.jsx)($,{protectedByPrivy:!0})]})};function Fv(e){let[t,r]=(0,$o.useState)(e.dimensions.width),[o,n]=(0,$o.useState)(void 0),i=(0,$o.useRef)(null);return(0,$o.useEffect)(()=>{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")})},[]),(0,we.jsx)("div",{ref:i,children:t&&(0,we.jsxs)(Vv,{children:[(0,we.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Us(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,we.jsx)(zv,{children:"Loading..."})]})})}function Bv(e){return(0,we.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,we.jsx)("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 Hv=Ko.default.div`
975
+ `;var Sh=h(require("@heroicons/react/24/solid/CheckCircleIcon")),_h=require("react");var qr=require("react/jsx-runtime"),xh=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=k(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=Fe(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return(0,_h.useEffect)(()=>{let f=setTimeout(u,om);return()=>clearTimeout(f)},[]),a.current=u,(0,qr.jsxs)(qr.Fragment,{children:[(0,qr.jsx)(_,{onClose:u}),(0,qr.jsx)(se,{}),(0,qr.jsxs)(so,{children:[(0,qr.jsx)(Sh.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,qr.jsx)(He,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,qr.jsx)(me,{}),(0,qr.jsx)(q,{protectedByPrivy:!0})]})};var Rh=h(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),Ih=h(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),$o=require("react"),Ko=h(require("styled-components"));var we=require("react/jsx-runtime"),Mh=()=>{let[e,t]=(0,$o.useState)(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=k(),u=Fe(o)?.address,{onFailure:f,onSuccess:y,origin:g,appId:C}=s.keyExport,v=S=>{i({shouldCallAuthOnSuccess:!1}),f(typeof S=="string"?new Error(S):S)},x=()=>{i({shouldCallAuthOnSuccess:!1}),y(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return(0,$o.useEffect)(()=>{let S=Fe(o);if(!r||!S)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=x,(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(_,{onClose:x}),(0,we.jsxs)(Bv,{children:[(0,we.jsxs)(He,{icon:(0,we.jsx)(Ih.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,we.jsxs)(zv,{children:[(0,we.jsx)(Fv,{style:{marginRight:6}}),cn(u)]}),(0,we.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,we.jsxs)(Hv,{children:[(0,we.jsxs)(kh,{children:[(0,we.jsx)(Ah,{children:"1"}),(0,we.jsxs)("span",{children:[(0,we.jsx)("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."]})]}),(0,we.jsxs)(kh,{children:[(0,we.jsx)(Ah,{children:"2"}),(0,we.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,we.jsx)("div",{style:{width:"100%"},children:e&&(0,we.jsx)(Uv,{origin:g,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,we.jsxs)(qv,{children:[(0,we.jsxs)("div",{children:[(0,we.jsx)(Rh.default,{viewBox:"0 0 20 18"}),(0,we.jsx)("h4",{children:"Warning"})]}),(0,we.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,we.jsx)(q,{protectedByPrivy:!0})]})};function Uv(e){let[t,r]=(0,$o.useState)(e.dimensions.width),[o,n]=(0,$o.useState)(void 0),i=(0,$o.useRef)(null);return(0,$o.useEffect)(()=>{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")})},[]),(0,we.jsx)("div",{ref:i,children:t&&(0,we.jsxs)(Gv,{children:[(0,we.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Us(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,we.jsx)(Vv,{children:"Loading..."})]})})}function Fv(e){return(0,we.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,we.jsx)("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 Bv=Ko.default.div`
976
976
  display: flex;
977
977
  flex-direction: column;
978
978
  text-align: left;
979
- `,Gv=Ko.default.div`
979
+ `,Hv=Ko.default.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
- `,Ah=Ko.default.div`
986
+ `,kh=Ko.default.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
- `,Rh=Ko.default.div`
995
+ `,Ah=Ko.default.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
- `,Vv=Ko.default.div`
1009
+ `,Gv=Ko.default.div`
1010
1010
  overflow: visible;
1011
1011
  position: relative;
1012
1012
  height: 44px;
1013
- `,zv=Ko.default.div`
1013
+ `,Vv=Ko.default.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
- `,qv=Ko.default.div`
1025
+ `,zv=Ko.default.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
- `,$v=Ko.default.div`
1038
+ `,qv=Ko.default.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,9 +1057,9 @@ Resources:
1057
1057
  color: var(--privy-color-error);
1058
1058
  }
1059
1059
  }
1060
- `;var Lh=h(require("@heroicons/react/24/solid/XCircleIcon")),Ka=require("react"),Oh=h(require("styled-components"));var ic=require("react");function ac(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=W(),o=(0,ic.useRef)(!1);return{createWallet:(0,ic.useCallback)(async i=>{let a=await ke();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(gi);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((g,C)=>{setTimeout(()=>{C(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 y=Ue(f);if(!y)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:y.address}}),o.current=!0,y}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}var $r=require("react/jsx-runtime"),Nh=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=k(),[i,a]=(0,Ka.useState)(""),{embeddedWallets:l}=dr(),{authenticated:s}=H(),{closePrivyModal:c}=W(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:y}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:C}=ac(),[v,x]=(0,Ka.useState)(null),S=new ot(async()=>{try{let R=await C();if(!R)return;x(R),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(R){a(R.message)}});(0,Ka.useEffect)(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let R=wh("create",l.userOwnedRecoveryOptions);return r(R)}S.execute()},[g,s]);let b=()=>{v?(u(v),c({shouldCallAuthOnSuccess:y})):(f(new Qt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)(_,{closeable:!1}),(0,$r.jsxs)(so,{children:[(0,$r.jsx)(Lh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,$r.jsx)(Be,{title:"Something went wrong",description:i})]}),(0,$r.jsx)(N,{onClick:b,children:"Close"}),(0,$r.jsx)(Kv,{})]}):(0,$r.jsx)(zi,{})},Kv=Oh.default.div`
1060
+ `;var Wh=h(require("@heroicons/react/24/solid/XCircleIcon")),Ka=require("react"),Lh=h(require("styled-components"));var ic=require("react");function ac(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=W(),o=(0,ic.useRef)(!1);return{createWallet:(0,ic.useCallback)(async i=>{let a=await Ae();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(yi);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((g,C)=>{setTimeout(()=>{C(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 y=Fe(f);if(!y)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:y.address}}),o.current=!0,y}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}var $r=require("react/jsx-runtime"),Oh=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=k(),[i,a]=(0,Ka.useState)(""),{embeddedWallets:l}=dr(),{authenticated:s}=H(),{closePrivyModal:c}=W(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:y}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:C}=ac(),[v,x]=(0,Ka.useState)(null),S=new ot(async()=>{try{let R=await C();if(!R)return;x(R),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(R){a(R.message)}});(0,Ka.useEffect)(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let R=Ch("create",l.userOwnedRecoveryOptions);return r(R)}S.execute()},[g,s]);let b=()=>{v?(u(v),c({shouldCallAuthOnSuccess:y})):(f(new Qt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)(_,{closeable:!1}),(0,$r.jsxs)(so,{children:[(0,$r.jsx)(Wh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,$r.jsx)(He,{title:"Something went wrong",description:i})]}),(0,$r.jsx)(N,{onClick:b,children:"Close"}),(0,$r.jsx)($v,{})]}):(0,$r.jsx)(Vi,{})},$v=Lh.default.div`
1061
1061
  height: 44px;
1062
- `;var Qn=require("react");var ta=require("react");var zh=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Qi=require("react");var Dh=h(require("@heroicons/react/24/outline/ArrowPathIcon")),Uh=h(require("@heroicons/react/24/outline/EyeIcon")),Fh=h(require("@heroicons/react/24/outline/EyeSlashIcon")),pt=h(require("styled-components"));var jv=pt.css`
1062
+ `;var Jn=require("react");var ea=require("react");var Vh=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Ji=require("react");var Nh=h(require("@heroicons/react/24/outline/ArrowPathIcon")),Dh=h(require("@heroicons/react/24/outline/EyeIcon")),Uh=h(require("@heroicons/react/24/outline/EyeSlashIcon")),ut=h(require("styled-components"));var Kv=ut.css`
1063
1063
  font-size: 14px;
1064
1064
  font-style: normal;
1065
1065
  font-weight: 400;
@@ -1067,8 +1067,8 @@ Resources:
1067
1067
  letter-spacing: -0.008px;
1068
1068
  text-align: left;
1069
1069
  transition: color 0.1s ease-in;
1070
- `,sc=pt.default.span`
1071
- ${jv}
1070
+ `,sc=ut.default.span`
1071
+ ${Kv}
1072
1072
  transition: color 0.1s ease-in;
1073
1073
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1074
1074
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1076,18 +1076,18 @@ Resources:
1076
1076
  &[aria-hidden='true'] {
1077
1077
  visibility: hidden;
1078
1078
  }
1079
- `,Cn=pt.default.div`
1079
+ `,vn=ut.default.div`
1080
1080
  display: flex;
1081
1081
  flex-direction: column;
1082
1082
  justify-content: center;
1083
1083
  flex-grow: 1;
1084
- `,wn=(0,pt.default)(N)`
1085
- ${e=>e.hideAnimations&&pt.css`
1084
+ `,Cn=(0,ut.default)(N)`
1085
+ ${e=>e.hideAnimations&&ut.css`
1086
1086
  && {
1087
1087
  transition: none;
1088
1088
  }
1089
1089
  `}
1090
- `,Bh=pt.css`
1090
+ `,Fh=ut.css`
1091
1091
  && {
1092
1092
  width: 100%;
1093
1093
  border-width: 1px;
@@ -1102,8 +1102,8 @@ Resources:
1102
1102
  font-weight: 300;
1103
1103
  line-height: 22px; /* 137.5% */
1104
1104
  }
1105
- `,ji=pt.default.input`
1106
- ${Bh}
1105
+ `,Ki=ut.default.input`
1106
+ ${Fh}
1107
1107
 
1108
1108
  &::placeholder {
1109
1109
  color: var(--privy-color-foreground-3);
@@ -1114,15 +1114,15 @@ Resources:
1114
1114
  overflow: hidden;
1115
1115
  text-overflow: ellipsis;
1116
1116
  white-space: nowrap;
1117
- `,Hh=pt.default.div`
1118
- ${Bh}
1119
- `,bn=pt.default.div`
1117
+ `,Bh=ut.default.div`
1118
+ ${Fh}
1119
+ `,wn=ut.default.div`
1120
1120
  position: relative;
1121
1121
  width: 100%;
1122
1122
  display: flex;
1123
1123
  align-items: center;
1124
1124
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1125
- `,En=pt.default.div`
1125
+ `,bn=ut.default.div`
1126
1126
  display: flex;
1127
1127
  flex-direction: column;
1128
1128
  align-items: center;
@@ -1144,12 +1144,12 @@ Resources:
1144
1144
  font-weight: 400;
1145
1145
  line-height: 20px;
1146
1146
  }
1147
- `,ja=pt.default.div`
1147
+ `,ja=ut.default.div`
1148
1148
  display: flex;
1149
1149
  flex-direction: column;
1150
1150
  gap: 10px;
1151
1151
  padding-bottom: 1rem;
1152
- `,Ya=pt.default.div`
1152
+ `,Ya=ut.default.div`
1153
1153
  display: flex;
1154
1154
  text-align: left;
1155
1155
  align-items: center;
@@ -1169,13 +1169,13 @@ Resources:
1169
1169
  > :first-child {
1170
1170
  min-width: 24px;
1171
1171
  }
1172
- `,zS=pt.default.div`
1172
+ `,VS=ut.default.div`
1173
1173
  height: var(--privy-height-modal-full);
1174
1174
 
1175
1175
  @media (max-width: 440px) {
1176
1176
  height: var(--privy-height-modal-compact);
1177
1177
  }
1178
- `,Zd=(0,pt.default)(Hl)`
1178
+ `,Yd=(0,ut.default)(Hl)`
1179
1179
  display: flex;
1180
1180
  flex: 1;
1181
1181
  gap: 4px;
@@ -1187,7 +1187,7 @@ Resources:
1187
1187
  border-color: var(--privy-color-foreground-3);
1188
1188
  border-width: 1px;
1189
1189
  }
1190
- `,Yi=pt.default.div`
1190
+ `,ji=ut.default.div`
1191
1191
  position: absolute;
1192
1192
  right: 0.5rem;
1193
1193
 
@@ -1195,7 +1195,7 @@ Resources:
1195
1195
  flex-direction: row;
1196
1196
  justify-content: space-around;
1197
1197
  align-items: center;
1198
- `,Gh=(0,pt.default)(Dh.default)`
1198
+ `,Hh=(0,ut.default)(Nh.default)`
1199
1199
  height: 1.25rem;
1200
1200
  width: 1.25rem;
1201
1201
  stroke: var(--privy-color-accent);
@@ -1204,7 +1204,7 @@ Resources:
1204
1204
  :active {
1205
1205
  stroke: var(--privy-color-accent-light);
1206
1206
  }
1207
- `,Zi=(0,pt.default)(Fh.default)`
1207
+ `,Yi=(0,ut.default)(Uh.default)`
1208
1208
  height: 1.25rem;
1209
1209
  width: 1.25rem;
1210
1210
  stroke: var(--privy-color-accent);
@@ -1213,7 +1213,7 @@ Resources:
1213
1213
  :active {
1214
1214
  stroke: var(--privy-color-accent-light);
1215
1215
  }
1216
- `,Ji=(0,pt.default)(Uh.default)`
1216
+ `,Zi=(0,ut.default)(Dh.default)`
1217
1217
  height: 1.25rem;
1218
1218
  width: 1.25rem;
1219
1219
  stroke: var(--privy-color-accent);
@@ -1222,7 +1222,7 @@ Resources:
1222
1222
  :active {
1223
1223
  stroke: var(--privy-color-accent-light);
1224
1224
  }
1225
- `,Vh=pt.default.progress`
1225
+ `,Gh=ut.default.progress`
1226
1226
  height: 4px;
1227
1227
  width: 100%;
1228
1228
  margin: 8px 0;
@@ -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
- `;var ut=require("react/jsx-runtime"),qh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,Qi.useState)(!0),[l,s]=(0,Qi.useState)(!1),[c,u]=(0,Qi.useState)(""),f=r===c;return(0,Qi.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,ut.jsxs)(ut.Fragment,{children:[(0,ut.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:n}),(0,ut.jsx)(se,{}),(0,ut.jsxs)(Cn,{children:[(0,ut.jsxs)(En,{children:[(0,ut.jsx)(zh.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ut.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,ut.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,ut.jsxs)(bn,{children:[(0,ut.jsx)(ji,{value:c,onChange:y=>u(y.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),(0,ut.jsx)(Yi,{style:{right:"0.75rem"},children:i?(0,ut.jsx)(Zi,{onClick:()=>a(!1)}):(0,ut.jsx)(Ji,{onClick:()=>a(!0)})})]}),(0,ut.jsx)(sc,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),(0,ut.jsx)(wn,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),(0,ut.jsx)(me,{}),(0,ut.jsx)($,{protectedByPrivy:!0})]})};var Yh=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Zh=require("react"),Jh=h(require("styled-components"));var Xi=h(require("styled-components")),Pn=require("react/jsx-runtime"),$h=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,Pn.jsx)("label",{children:(0,Pn.jsxs)(Yv,{className:e,children:[(0,Pn.jsx)(jh,{checked:t,...o}),(0,Pn.jsx)(Zv,{color:r,checked:t,children:(0,Pn.jsx)(Kh,{viewBox:"0 0 24 24",children:(0,Pn.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})});var QS=Xi.default.label`
1241
+ `;var mt=require("react/jsx-runtime"),zh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,Ji.useState)(!0),[l,s]=(0,Ji.useState)(!1),[c,u]=(0,Ji.useState)(""),f=r===c;return(0,Ji.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:n}),(0,mt.jsx)(se,{}),(0,mt.jsxs)(vn,{children:[(0,mt.jsxs)(bn,{children:[(0,mt.jsx)(Vh.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,mt.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,mt.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,mt.jsxs)(wn,{children:[(0,mt.jsx)(Ki,{value:c,onChange:y=>u(y.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),(0,mt.jsx)(ji,{style:{right:"0.75rem"},children:i?(0,mt.jsx)(Yi,{onClick:()=>a(!1)}):(0,mt.jsx)(Zi,{onClick:()=>a(!0)})})]}),(0,mt.jsx)(sc,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),(0,mt.jsx)(Cn,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),(0,mt.jsx)(me,{}),(0,mt.jsx)(q,{protectedByPrivy:!0})]})};var jh=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Yh=require("react"),Zh=h(require("styled-components"));var Qi=h(require("styled-components")),En=require("react/jsx-runtime"),qh=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,En.jsx)("label",{children:(0,En.jsxs)(jv,{className:e,children:[(0,En.jsx)(Kh,{checked:t,...o}),(0,En.jsx)(Yv,{color:r,checked:t,children:(0,En.jsx)($h,{viewBox:"0 0 24 24",children:(0,En.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})});var JS=Qi.default.label`
1242
1242
  && {
1243
1243
  cursor: pointer;
1244
1244
  display: flex;
@@ -1250,14 +1250,14 @@ Resources:
1250
1250
  border: 1px solid var(--privy-color-foreground-4);
1251
1251
  width: 100%;
1252
1252
  }
1253
- `,Yv=Xi.default.div`
1253
+ `,jv=Qi.default.div`
1254
1254
  display: inline-block;
1255
1255
  vertical-align: middle;
1256
- `,Kh=Xi.default.svg`
1256
+ `,$h=Qi.default.svg`
1257
1257
  fill: none;
1258
1258
  stroke: white;
1259
1259
  stroke-width: 3px;
1260
- `,jh=Xi.default.input.attrs({type:"checkbox"})`
1260
+ `,Kh=Qi.default.input.attrs({type:"checkbox"})`
1261
1261
  border: 0;
1262
1262
  clip: rect(0 0 0 0);
1263
1263
  clippath: inset(50%);
@@ -1268,7 +1268,7 @@ Resources:
1268
1268
  position: absolute;
1269
1269
  white-space: nowrap;
1270
1270
  width: 1px;
1271
- `,Zv=Xi.default.div`
1271
+ `,Yv=Qi.default.div`
1272
1272
  display: inline-block;
1273
1273
  width: 18px;
1274
1274
  height: 18px;
@@ -1283,28 +1283,28 @@ Resources:
1283
1283
  border-width: 1px;
1284
1284
  }
1285
1285
 
1286
- ${jh}:focus + & {
1286
+ ${Kh}:focus + & {
1287
1287
  box-shadow: 0 0 0 1px ${e=>e.color};
1288
1288
  }
1289
1289
 
1290
- ${Kh} {
1290
+ ${$h} {
1291
1291
  visibility: ${e=>e.checked?"visible":"hidden"};
1292
1292
  }
1293
- `;var at=require("react/jsx-runtime"),Qh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=(0,Zh.useState)(!1);return(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:o}),(0,at.jsx)(se,{}),(0,at.jsxs)(Cn,{children:[(0,at.jsxs)(En,{children:[(0,at.jsx)(Yh.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,at.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,at.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,at.jsx)(ja,{children:(0,at.jsxs)(Ya,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[(0,at.jsx)($h,{color:"var(--privy-color-error)",checked:i}),(0,at.jsx)(at.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),(0,at.jsxs)(Jv,{children:[n.initiatedBy==="user"&&(0,at.jsx)(no,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,at.jsx)(wn,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),(0,at.jsx)(me,{}),(0,at.jsx)($,{protectedByPrivy:!0})]})},Jv=Jh.default.div`
1293
+ `;var at=require("react/jsx-runtime"),Jh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=(0,Yh.useState)(!1);return(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:o}),(0,at.jsx)(se,{}),(0,at.jsxs)(vn,{children:[(0,at.jsxs)(bn,{children:[(0,at.jsx)(jh.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,at.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,at.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,at.jsx)(ja,{children:(0,at.jsxs)(Ya,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[(0,at.jsx)(qh,{color:"var(--privy-color-error)",checked:i}),(0,at.jsx)(at.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),(0,at.jsxs)(Zv,{children:[n.initiatedBy==="user"&&(0,at.jsx)(no,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,at.jsx)(Cn,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),(0,at.jsx)(me,{}),(0,at.jsx)(q,{protectedByPrivy:!0})]})},Zv=Zh.default.div`
1294
1294
  display: flex;
1295
1295
  gap: 10px;
1296
- `;var sy=h(require("@heroicons/react/24/outline/KeyIcon")),Jd=h(require("@heroicons/react/24/solid/CheckCircleIcon")),jo=require("react"),Qd=h(require("styled-components"));var Xh=h(require("fast-password-entropy")),ey=h(require("secure-password-utilities")),ty=require("secure-password-utilities/wordlists"),Qv=95,Xv=8,e4=3,t4=.3,r4=/[a-z]/,o4=/[A-Z]/,n4=/[0-9]/,i4="a-zA-Z0-9",ry="!@#$%^&*()\\-_+.",oy=`${i4}${ry}`,a4=new RegExp(`[${ry}]`),s4=new RegExp(`[${oy}]`),ny=new RegExp(`^[${oy}]{6,}$`),iy=(e="")=>{let t=e.split("").filter(r=>!s4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},lc=()=>ey.generatePassphrase(4,ty.DEFAULT_WORDLIST);function l4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function c4(e){if(e.length<Xv)return 0;let t=0;r4.test(e)&&(t+=1),o4.test(e)&&(t+=1),n4.test(e)&&(t+=1),a4.test(e)&&(t+=1);let r=t/e4;return Math.max(0,Math.min(1,r))}function d4(e=""){let t=c4(e),r=(0,Xh.default)(e)/Qv;return(t*t4+r)/2}function ay(e=""){let t=d4(e);return{value:t,label:l4(t)}}var Se=require("react/jsx-runtime"),ly=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=(0,jo.useState)(!1),[f,y]=(0,jo.useState)(!1);(0,jo.useEffect)(()=>{r&&!f&&y(!0)},[r]);let g=(0,jo.useMemo)(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":ny.test(r||"")?null:`Invalid characters used ( ${iy(r).join(" ")} )`:null,[r,f]),C=(0,jo.useMemo)(()=>g?{value:0,label:"Weak"}:ay(r),[r,g]),v=(0,jo.useMemo)(()=>!!(!r?.length||g),[g,r]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(_,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),(0,Se.jsx)(se,{}),(0,Se.jsxs)(Cn,{children:[(0,Se.jsxs)(En,{children:[(0,Se.jsx)(sy.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Se.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,Se.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,Se.jsxs)(bn,{children:[(0,Se.jsx)(ji,{value:r,onChange:x=>l(x.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),(0,Se.jsxs)(Yi,{style:{width:"3.5rem"},children:[c?(0,Se.jsx)(Zi,{onClick:()=>u(!1)}):(0,Se.jsx)(Ji,{onClick:()=>u(!0)}),(0,Se.jsx)(Gh,{onClick:s})]})]}),(0,Se.jsx)(Vh,{value:C.value===0?.01:C.value,label:C.label}),(0,Se.jsx)(sc,{error:!!g,children:g||`Password Strength: ${f?C.label:"--"}`}),(0,Se.jsxs)(u4,{children:[(0,Se.jsx)(p4,{children:(0,Se.jsxs)(ja,{children:[(0,Se.jsxs)(Ya,{children:[(0,Se.jsx)(Jd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,Se.jsxs)(Ya,{children:[(0,Se.jsx)(Jd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),(0,Se.jsx)(wn,{onClick:n,loading:t,disabled:v,hideAnimations:e,children:"Continue"})]})]}),(0,Se.jsx)(me,{}),(0,Se.jsx)($,{protectedByPrivy:!0})]})},p4=(0,Qd.default)(ja)`
1296
+ `;var ay=h(require("@heroicons/react/24/outline/KeyIcon")),Zd=h(require("@heroicons/react/24/solid/CheckCircleIcon")),jo=require("react"),Jd=h(require("styled-components"));var Qh=h(require("fast-password-entropy")),Xh=h(require("secure-password-utilities")),ey=require("secure-password-utilities/wordlists"),Jv=95,Qv=8,Xv=3,e4=.3,t4=/[a-z]/,r4=/[A-Z]/,o4=/[0-9]/,n4="a-zA-Z0-9",ty="!@#$%^&*()\\-_+.",ry=`${n4}${ty}`,i4=new RegExp(`[${ty}]`),a4=new RegExp(`[${ry}]`),oy=new RegExp(`^[${ry}]{6,}$`),ny=(e="")=>{let t=e.split("").filter(r=>!a4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},lc=()=>Xh.generatePassphrase(4,ey.DEFAULT_WORDLIST);function s4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function l4(e){if(e.length<Qv)return 0;let t=0;t4.test(e)&&(t+=1),r4.test(e)&&(t+=1),o4.test(e)&&(t+=1),i4.test(e)&&(t+=1);let r=t/Xv;return Math.max(0,Math.min(1,r))}function c4(e=""){let t=l4(e),r=(0,Qh.default)(e)/Jv;return(t*e4+r)/2}function iy(e=""){let t=c4(e);return{value:t,label:s4(t)}}var _e=require("react/jsx-runtime"),sy=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=(0,jo.useState)(!1),[f,y]=(0,jo.useState)(!1);(0,jo.useEffect)(()=>{r&&!f&&y(!0)},[r]);let g=(0,jo.useMemo)(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":oy.test(r||"")?null:`Invalid characters used ( ${ny(r).join(" ")} )`:null,[r,f]),C=(0,jo.useMemo)(()=>g?{value:0,label:"Weak"}:iy(r),[r,g]),v=(0,jo.useMemo)(()=>!!(!r?.length||g),[g,r]);return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)(_,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),(0,_e.jsx)(se,{}),(0,_e.jsxs)(vn,{children:[(0,_e.jsxs)(bn,{children:[(0,_e.jsx)(ay.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,_e.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,_e.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,_e.jsxs)(wn,{children:[(0,_e.jsx)(Ki,{value:r,onChange:x=>l(x.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),(0,_e.jsxs)(ji,{style:{width:"3.5rem"},children:[c?(0,_e.jsx)(Yi,{onClick:()=>u(!1)}):(0,_e.jsx)(Zi,{onClick:()=>u(!0)}),(0,_e.jsx)(Hh,{onClick:s})]})]}),(0,_e.jsx)(Gh,{value:C.value===0?.01:C.value,label:C.label}),(0,_e.jsx)(sc,{error:!!g,children:g||`Password Strength: ${f?C.label:"--"}`}),(0,_e.jsxs)(p4,{children:[(0,_e.jsx)(d4,{children:(0,_e.jsxs)(ja,{children:[(0,_e.jsxs)(Ya,{children:[(0,_e.jsx)(Zd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,_e.jsxs)(Ya,{children:[(0,_e.jsx)(Zd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),(0,_e.jsx)(Cn,{onClick:n,loading:t,disabled:v,hideAnimations:e,children:"Continue"})]})]}),(0,_e.jsx)(me,{}),(0,_e.jsx)(q,{protectedByPrivy:!0})]})},d4=(0,Jd.default)(ja)`
1297
1297
  flex: 1;
1298
1298
  padding-top: 1rem;
1299
- `,u4=Qd.default.div`
1299
+ `,p4=Jd.default.div`
1300
1300
  display: flex;
1301
1301
  flex-direction: column;
1302
1302
  height: 100%;
1303
- `;var cy=h(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),dy=h(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),py=h(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),uy=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Za=require("react");var Ge=require("react/jsx-runtime"),my=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=(0,Za.useState)(!1),s=(0,Za.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=(0,Za.useCallback)(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),y=new Blob([m4(r,o)],{type:"text/plain"}),g=URL.createObjectURL(y);u.href=g,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(_,{backFn:i,title:"Save Password",closeable:!1}),(0,Ge.jsx)(se,{}),(0,Ge.jsxs)(Cn,{children:[(0,Ge.jsxs)(En,{children:[(0,Ge.jsx)(uy.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Ge.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,Ge.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),(0,Ge.jsx)(bn,{centered:!0,children:(0,Ge.jsx)(Hh,{children:o})}),(0,Ge.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,Ge.jsx)(Zd,{onClick:s,children:a?(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(dy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(py.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,Ge.jsxs)(Zd,{onClick:c,children:[(0,Ge.jsx)(cy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,Ge.jsx)(wn,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,Ge.jsx)(me,{}),(0,Ge.jsx)($,{protectedByPrivy:!0})]})},m4=(e,t)=>`Your wallet recovery password for ${e} is
1303
+ `;var ly=h(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),cy=h(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),dy=h(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),py=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Za=require("react");var Ve=require("react/jsx-runtime"),uy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=(0,Za.useState)(!1),s=(0,Za.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=(0,Za.useCallback)(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),y=new Blob([u4(r,o)],{type:"text/plain"}),g=URL.createObjectURL(y);u.href=g,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(_,{backFn:i,title:"Save Password",closeable:!1}),(0,Ve.jsx)(se,{}),(0,Ve.jsxs)(vn,{children:[(0,Ve.jsxs)(bn,{children:[(0,Ve.jsx)(py.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Ve.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,Ve.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),(0,Ve.jsx)(wn,{centered:!0,children:(0,Ve.jsx)(Bh,{children:o})}),(0,Ve.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,Ve.jsx)(Yd,{onClick:s,children:a?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(cy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(dy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,Ve.jsxs)(Yd,{onClick:c,children:[(0,Ve.jsx)(ly.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,Ve.jsx)(Cn,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,Ve.jsx)(me,{}),(0,Ve.jsx)(q,{protectedByPrivy:!0})]})},u4=(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.`;var fy=h(require("@heroicons/react/24/solid/CheckCircleIcon")),hy=h(require("@heroicons/react/24/solid/XCircleIcon"));var Kt=require("react/jsx-runtime"),yy=({error:e,onClose:t})=>(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(_,{closeable:!1}),(0,Kt.jsx)(se,{}),e?(0,Kt.jsxs)(so,{children:[(0,Kt.jsx)(hy.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Kt.jsx)(Be,{title:"Something went wrong",description:e})]}):(0,Kt.jsxs)(so,{children:[(0,Kt.jsx)(fy.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,Kt.jsx)(Be,{title:"Success"})]}),(0,Kt.jsx)(N,{onClick:t,children:"Close"}),(0,Kt.jsx)(me,{}),(0,Kt.jsx)($,{protectedByPrivy:!0})]});var gy=require("react"),f4=(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}},vy=()=>{let[e,t]=(0,gy.useReducer)(f4,"creating");return{send:t,state:e}};var ea=require("react/jsx-runtime"),cc=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=k(),{send:n,state:i}=vy(),a=(0,ta.useCallback)(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);(0,ta.useEffect)(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Xe)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=(0,ta.useCallback)(()=>{n("back")},[n]),s=(0,ta.useCallback)(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?(0,ea.jsx)(ly,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?(0,ea.jsx)(my,{...t,onSubmit:a,onBack:l}):i==="confirming"?(0,ea.jsx)(qh,{...t,onSubmit:a,onBack:l}):i==="finalizing"?(0,ea.jsx)(Qh,{...t,onSubmit:a,onBack:l}):i==="done"?(0,ea.jsx)(yy,{...t,onSubmit:a}):null};var wy=require("react/jsx-runtime"),Cy=()=>{let[e,t]=(0,Qn.useState)(null),[r,o]=(0,Qn.useState)(!1),[n,i]=(0,Qn.useState)(null),[a,l]=(0,Qn.useState)(""),{authenticated:s,getAccessToken:c,user:u}=H(),{walletProxy:f,refreshUser:y,closePrivyModal:g,createAnalyticsEvent:C}=W(),{app:v,navigate:x,data:S,onUserCloseViaDialogOrKeybindRef:b}=k(),{onSuccess:R,onFailure:A}=S.createWallet,O=Ue(u),M=e?.recoveryMethod==="user-passcode";(0,Qn.useEffect)(()=>{s||(x("LANDING"),A(new As("User must be authenticated before setting a password on a Privy wallet")))},[s]);let I=()=>{if(n){A(n),g({shouldCallAuthOnSuccess:!1});return}if(!M){A(new Qt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};b.current=I;let V=async()=>{let ee=await c();if(ee&&O?.address&&a&&f)try{if(C({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:O.address}}),!(await f.setRecoveryPassword({accessToken:ee,address:O.address,recoveryPassword:a})).address){i(new Qt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"error setting password"}});return}let Y=await y(),D=Ue(Y);if(!D){i(new Qt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"wallet disconnected"}});return}t(D),C({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:O.address}})}catch(L){console.warn(L),i(L instanceof Error?L:new Error("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:L}})}},Z=async()=>{M?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await V(),o(!1))};return(0,wy.jsx)(cc,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(lc()),onPasswordChange:l,onSubmit:Z,onClose:I})};var by=h(require("@heroicons/react/24/outline/UserCircleIcon")),Ey=h(require("@heroicons/react/24/solid/LockClosedIcon"));var Ut=require("react/jsx-runtime"),Py=()=>{let{user:e}=H(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=k(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new Qt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(_,{onClose:c}),(0,Ut.jsx)(se,{}),(0,Ut.jsxs)(so,{children:[(0,Ut.jsxs)(Wf,{children:[(0,Ut.jsx)(by.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Ut.jsx)(Lf,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,Ut.jsx)(Ey.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,Ut.jsxs)(Be,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,Ut.jsx)("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),(0,Ut.jsx)(N,{onClick:()=>{let f=Ue(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"}),(0,Ut.jsx)(me,{}),(0,Ut.jsx)($,{protectedByPrivy:!0})]})};var Ty=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Sy=h(require("@heroicons/react/24/outline/PhoneIcon")),Xd=h(require("styled-components"));var gt=require("react/jsx-runtime"),h4=e=>{let t=(0,gt.jsx)(Ty.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof P)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 tt&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,gt.jsx)(Sy.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof ct)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:(0,gt.jsx)(Ql,{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:(0,gt.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,gt.jsx)("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 Xr&&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}}},_y=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=k();return(0,gt.jsx)(Ja,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},Ja=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Pe(),n=h4(e),i=()=>{e instanceof ct&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsx)(_,{backFn:t}),(0,gt.jsxs)(y4,{children:[(0,gt.jsx)(At,{children:(0,gt.jsxs)("div",{children:[(0,gt.jsx)(Jl,{color:"var(--privy-color-error)"}),n.icon]})}),(0,gt.jsxs)(g4,{children:[(0,gt.jsx)("h3",{children:n.title}),(0,gt.jsx)("p",{children:n.detail})]}),(0,gt.jsx)(N,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},y4=Xd.default.div`
1307
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var my=h(require("@heroicons/react/24/solid/CheckCircleIcon")),fy=h(require("@heroicons/react/24/solid/XCircleIcon"));var $t=require("react/jsx-runtime"),hy=({error:e,onClose:t})=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(_,{closeable:!1}),(0,$t.jsx)(se,{}),e?(0,$t.jsxs)(so,{children:[(0,$t.jsx)(fy.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,$t.jsx)(He,{title:"Something went wrong",description:e})]}):(0,$t.jsxs)(so,{children:[(0,$t.jsx)(my.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,$t.jsx)(He,{title:"Success"})]}),(0,$t.jsx)(N,{onClick:t,children:"Close"}),(0,$t.jsx)(me,{}),(0,$t.jsx)(q,{protectedByPrivy:!0})]});var yy=require("react"),m4=(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}},gy=()=>{let[e,t]=(0,yy.useReducer)(m4,"creating");return{send:t,state:e}};var Xi=require("react/jsx-runtime"),cc=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=k(),{send:n,state:i}=gy(),a=(0,ea.useCallback)(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);(0,ea.useEffect)(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Xe)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=(0,ea.useCallback)(()=>{n("back")},[n]),s=(0,ea.useCallback)(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?(0,Xi.jsx)(sy,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?(0,Xi.jsx)(uy,{...t,onSubmit:a,onBack:l}):i==="confirming"?(0,Xi.jsx)(zh,{...t,onSubmit:a,onBack:l}):i==="finalizing"?(0,Xi.jsx)(Jh,{...t,onSubmit:a,onBack:l}):i==="done"?(0,Xi.jsx)(hy,{...t,onSubmit:a}):null};var Cy=require("react/jsx-runtime"),vy=()=>{let[e,t]=(0,Jn.useState)(null),[r,o]=(0,Jn.useState)(!1),[n,i]=(0,Jn.useState)(null),[a,l]=(0,Jn.useState)(""),{authenticated:s,getAccessToken:c,user:u}=H(),{walletProxy:f,refreshUser:y,closePrivyModal:g,createAnalyticsEvent:C}=W(),{app:v,navigate:x,data:S,onUserCloseViaDialogOrKeybindRef:b}=k(),{onSuccess:R,onFailure:A}=S.createWallet,O=Fe(u),M=e?.recoveryMethod==="user-passcode";(0,Jn.useEffect)(()=>{s||(x("LANDING"),A(new As("User must be authenticated before setting a password on a Privy wallet")))},[s]);let I=()=>{if(n){A(n),g({shouldCallAuthOnSuccess:!1});return}if(!M){A(new Qt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};b.current=I;let V=async()=>{let ee=await c();if(ee&&O?.address&&a&&f)try{if(C({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:O.address}}),!(await f.setRecoveryPassword({accessToken:ee,address:O.address,recoveryPassword:a})).address){i(new Qt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"error setting password"}});return}let j=await y(),D=Fe(j);if(!D){i(new Qt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"wallet disconnected"}});return}t(D),C({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:O.address}})}catch(L){console.warn(L),i(L instanceof Error?L:new Error("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:L}})}},Y=async()=>{M?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await V(),o(!1))};return(0,Cy.jsx)(cc,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(lc()),onPasswordChange:l,onSubmit:Y,onClose:I})};var wy=h(require("@heroicons/react/24/outline/UserCircleIcon")),by=h(require("@heroicons/react/24/solid/LockClosedIcon"));var Ut=require("react/jsx-runtime"),Ey=()=>{let{user:e}=H(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=k(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new Qt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(_,{onClose:c}),(0,Ut.jsx)(se,{}),(0,Ut.jsxs)(so,{children:[(0,Ut.jsxs)(Mf,{children:[(0,Ut.jsx)(wy.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Ut.jsx)(Wf,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,Ut.jsx)(by.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,Ut.jsxs)(He,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,Ut.jsx)("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),(0,Ut.jsx)(N,{onClick:()=>{let f=Fe(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"}),(0,Ut.jsx)(me,{}),(0,Ut.jsx)(q,{protectedByPrivy:!0})]})};var Py=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Ty=h(require("@heroicons/react/24/outline/PhoneIcon")),Qd=h(require("styled-components"));var vt=require("react/jsx-runtime"),f4=e=>{let t=(0,vt.jsx)(Py.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof T)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 tt&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,vt.jsx)(Ty.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof dt)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:(0,vt.jsx)(Ql,{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:(0,vt.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,vt.jsx)("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 Xr&&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}}},Sy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=k();return(0,vt.jsx)(Ja,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},Ja=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Te(),n=f4(e),i=()=>{e instanceof dt&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(_,{backFn:t}),(0,vt.jsxs)(h4,{children:[(0,vt.jsx)(At,{children:(0,vt.jsxs)("div",{children:[(0,vt.jsx)(Jl,{color:"var(--privy-color-error)"}),n.icon]})}),(0,vt.jsxs)(y4,{children:[(0,vt.jsx)("h3",{children:n.title}),(0,vt.jsx)("p",{children:n.detail})]}),(0,vt.jsx)(N,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},h4=Qd.default.div`
1308
1308
  display: flex;
1309
1309
  flex-direction: column;
1310
1310
  align-items: center;
@@ -1312,11 +1312,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1312
1312
  gap: 24px;
1313
1313
  width: 100%;
1314
1314
  padding-bottom: 16px;
1315
- `,g4=Xd.default.div`
1315
+ `,y4=Qd.default.div`
1316
1316
  display: flex;
1317
1317
  flex-direction: column;
1318
1318
  gap: 8px;
1319
- `;var Yo=require("react"),Xa=require("react-device-detect"),op=h(require("styled-components"));var ky=require("react"),Ay=h(require("styled-components"));var ep=require("react/jsx-runtime"),dc=({style:e,color:t,...r})=>(0,ep.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,ep.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var pc=require("react/jsx-runtime"),xy=({color:e,...t})=>(0,pc.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,pc.jsx)("g",{children:(0,pc.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var Qa=require("react/jsx-runtime"),Tn=e=>{let[t,r]=(0,ky.useState)(!1);return(0,Qa.jsxs)(v4,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,Qa.jsx)(dc,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,Qa.jsx)(xy,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},v4=Ay.default.button`
1319
+ `;var Yo=require("react"),Xa=require("react-device-detect"),rp=h(require("styled-components"));var xy=require("react"),ky=h(require("styled-components"));var Xd=require("react/jsx-runtime"),dc=({style:e,color:t,...r})=>(0,Xd.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,Xd.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var pc=require("react/jsx-runtime"),_y=({color:e,...t})=>(0,pc.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,pc.jsx)("g",{children:(0,pc.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var Qa=require("react/jsx-runtime"),Pn=e=>{let[t,r]=(0,xy.useState)(!1);return(0,Qa.jsxs)(g4,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,Qa.jsx)(dc,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,Qa.jsx)(_y,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},g4=ky.default.button`
1320
1320
  display: flex;
1321
1321
  align-items: center;
1322
1322
  gap: 6px;
@@ -1354,7 +1354,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1354
1354
  width: 14px;
1355
1355
  height: 14px;
1356
1356
  }
1357
- `;var Ry=require("react"),Iy=h(require("styled-components")),My=require("react/jsx-runtime"),uc=e=>{let[t,r]=(0,Ry.useState)(!1);return(0,My.jsx)(C4,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},C4=Iy.default.a`
1357
+ `;var Ay=require("react"),Ry=h(require("styled-components")),Iy=require("react/jsx-runtime"),uc=e=>{let[t,r]=(0,Ay.useState)(!1);return(0,Iy.jsx)(v4,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},v4=Ry.default.a`
1358
1358
  display: flex;
1359
1359
  align-items: center;
1360
1360
  gap: 6px;
@@ -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
- `;var Ly=h(require("qrcode")),Oy=h(require("react")),Ny=h(require("styled-components"));var tp=require("react/jsx-runtime"),Wy=()=>(0,tp.jsx)("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:(0,tp.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var Ye=require("react/jsx-runtime"),Ar=7,rp=(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},w4=e=>{let t=Ly.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Gu(Array.from(t.data),t.size);return r=rp(r,0,0,Ar,Ar),r=rp(r,r.length-Ar,0,Ar,Ar),r=rp(r,0,r.length-Ar,Ar,Ar),r},b4=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,Ye.jsx)(Ye.Fragment,{children:[0,1,2].map(i=>(0,Ye.jsx)("circle",{r:r*(Ar-i*2)/2,cx:e+r*Ar/2,cy:t+r*Ar/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),E4=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Ar)*e,0],[0,(t-Ar)*e]];return(0,Ye.jsx)(Ye.Fragment,{children:n.map(([i,a])=>(0,Ye.jsx)(b4,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},P4=({matrix:e,cellSize:t,color:r})=>(0,Ye.jsx)(Ye.Fragment,{children:e.map((i,a)=>i.map((l,s)=>l?(0,Ye.jsx)("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):(0,Ye.jsx)(Oy.default.Fragment,{},`circle-${a}-${s}`)))}),T4=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return(0,Ye.jsx)(Ye.Fragment,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,u=s-s*c*2,f=r,y=a*e;return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),(0,Ye.jsx)(f,{x:y+s*c,y:y+s*c,height:u,width:u})]})},S4=e=>{let t=e.outputSize,r=w4(e.url),o=t/r.length;return(0,Ye.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,Ye.jsx)(P4,{matrix:r,cellSize:o,color:e.fgColor}),(0,Ye.jsx)(E4,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,Ye.jsx)(T4,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},_4=Ny.default.div`
1395
+ `;var Wy=h(require("qrcode")),Ly=h(require("react")),Oy=h(require("styled-components"));var ep=require("react/jsx-runtime"),My=()=>(0,ep.jsx)("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:(0,ep.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var Ze=require("react/jsx-runtime"),Ar=7,tp=(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},C4=e=>{let t=Wy.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Hu(Array.from(t.data),t.size);return r=tp(r,0,0,Ar,Ar),r=tp(r,r.length-Ar,0,Ar,Ar),r=tp(r,0,r.length-Ar,Ar,Ar),r},w4=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,Ze.jsx)(Ze.Fragment,{children:[0,1,2].map(i=>(0,Ze.jsx)("circle",{r:r*(Ar-i*2)/2,cx:e+r*Ar/2,cy:t+r*Ar/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),b4=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Ar)*e,0],[0,(t-Ar)*e]];return(0,Ze.jsx)(Ze.Fragment,{children:n.map(([i,a])=>(0,Ze.jsx)(w4,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},E4=({matrix:e,cellSize:t,color:r})=>(0,Ze.jsx)(Ze.Fragment,{children:e.map((i,a)=>i.map((l,s)=>l?(0,Ze.jsx)("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):(0,Ze.jsx)(Ly.default.Fragment,{},`circle-${a}-${s}`)))}),P4=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return(0,Ze.jsx)(Ze.Fragment,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,u=s-s*c*2,f=r,y=a*e;return(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),(0,Ze.jsx)(f,{x:y+s*c,y:y+s*c,height:u,width:u})]})},T4=e=>{let t=e.outputSize,r=C4(e.url),o=t/r.length;return(0,Ze.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,Ze.jsx)(E4,{matrix:r,cellSize:o,color:e.fgColor}),(0,Ze.jsx)(b4,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,Ze.jsx)(P4,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},S4=Oy.default.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.borderColor};
1408
1408
  border-radius: var(--privy-border-radius-md);
1409
1409
  }
1410
- `,ra=e=>{let{appearance:t}=dr(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return(0,Ye.jsx)(_4,{size:n,bgColor:r,fgColor:o,borderColor:i,children:(0,Ye.jsx)(S4,{url:e.url,logo:{element:e.squareLogoElement??Wy},outputSize:n,bgColor:r,fgColor:o})})};var Xn=require("react/jsx-runtime"),ko=({style:e,...t})=>(0,Xn.jsxs)("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:[(0,Xn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,Xn.jsx)("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"}),(0,Xn.jsx)("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"}),(0,Xn.jsx)("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"})]});var re=require("react/jsx-runtime"),Dy="#8a63d2",Fy=1e3,x4=Fy*2,k4=Fy*120,By=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=k(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:y}=W(),[g,C]=(0,Yo.useState)(void 0),[v,x]=(0,Yo.useState)(!1),[S,b]=(0,Yo.useState)(!1),R=(0,Yo.useRef)([]),A=s?.render.inDialog?Xe:0,O=c(),M=O?.meta.connectUri;return(0,Yo.useEffect)(()=>{let I=Date.now(),V=setInterval(async()=>{let Z=await O.pollForReady.execute(),ee=Date.now()-I;if(Z){clearInterval(V),x(!0);try{await u(),b(!0)}catch(L){let Y={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(L?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(L).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else L?.privyErrorCode==="linked_to_another_user"?Y.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(Y.retryable=!0,Y.detail="Something went wrong. Try again."):L?.privyErrorCode==="too_many_requests"&&(Y.detail="Too many requests. Please wait before trying again.");C(Y)}}else ee>k4&&(clearInterval(V),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},x4);return()=>{clearInterval(V),R.current.forEach(Z=>clearTimeout(Z))}},[]),(0,Yo.useEffect)(()=>{if(r&&e&&S&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let V=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(V)}S&&(cr(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:V=>{console.error(V),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:V,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):R.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[S,r,e,o]),Xa.isMobile||v?(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(_,{backFn:n?a:void 0,onClose:f},"header"),(0,re.jsx)(se,{}),Xa.isIOS?(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(A4,{children:[(0,re.jsx)(At,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(St,{success:S,fail:!!g}),(0,re.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(yt,{children:[(0,re.jsx)(ye,{children:g?g.message:"Sign in with Farcaster"}),(0,re.jsx)(ge,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&(0,re.jsx)(N,{onClick:I=>{I.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(Uy,{children:[(0,re.jsx)(At,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(St,{success:S,fail:!!g}),(0,re.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(yt,{children:[(0,re.jsx)(ye,{children:g?g.message:"Signing in with Farcaster"}),(0,re.jsx)(ge,{children:g?g.detail:"This should only take a moment"}),(0,re.jsx)(er,{children:M&&Xa.isMobile&&(0,re.jsx)(uc,{text:"Take me to Warpcast",url:M,color:Dy})})]})]})}),(0,re.jsx)(z,{})]}):(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(_,{backFn:n?a:void 0,onClose:f},"header"),(0,re.jsx)(se,{}),(0,re.jsx)(Uy,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(ye,{children:"Sign in with Farcaster"}),(0,re.jsx)(ge,{children:"Scan with your phone's camera to continue."}),(0,re.jsx)(Di,{children:M?(0,re.jsx)(ra,{url:M,size:275,squareLogoElement:ko}):(0,re.jsx)(_t,{})}),(0,re.jsxs)(er,{children:[(0,re.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&(0,re.jsx)(Tn,{text:M,itemName:"link",color:Dy})]})]})}),(0,re.jsx)(z,{})]})},Uy=op.default.div`
1410
+ `,ta=e=>{let{appearance:t}=dr(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return(0,Ze.jsx)(S4,{size:n,bgColor:r,fgColor:o,borderColor:i,children:(0,Ze.jsx)(T4,{url:e.url,logo:{element:e.squareLogoElement??My},outputSize:n,bgColor:r,fgColor:o})})};var Qn=require("react/jsx-runtime"),ko=({style:e,...t})=>(0,Qn.jsxs)("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:[(0,Qn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,Qn.jsx)("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"}),(0,Qn.jsx)("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"}),(0,Qn.jsx)("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"})]});var re=require("react/jsx-runtime"),Ny="#8a63d2",Uy=1e3,_4=Uy*2,x4=Uy*120,Fy=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=k(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:y}=W(),[g,C]=(0,Yo.useState)(void 0),[v,x]=(0,Yo.useState)(!1),[S,b]=(0,Yo.useState)(!1),R=(0,Yo.useRef)([]),A=s?.render.inDialog?Xe:0,O=c(),M=O?.meta.connectUri;return(0,Yo.useEffect)(()=>{let I=Date.now(),V=setInterval(async()=>{let Y=await O.pollForReady.execute(),ee=Date.now()-I;if(Y){clearInterval(V),x(!0);try{await u(),b(!0)}catch(L){let j={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(L?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(L).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else L?.privyErrorCode==="linked_to_another_user"?j.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(j.retryable=!0,j.detail="Something went wrong. Try again."):L?.privyErrorCode==="too_many_requests"&&(j.detail="Too many requests. Please wait before trying again.");C(j)}}else ee>x4&&(clearInterval(V),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},_4);return()=>{clearInterval(V),R.current.forEach(Y=>clearTimeout(Y))}},[]),(0,Yo.useEffect)(()=>{if(r&&e&&S&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let V=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(V)}S&&(cr(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:V=>{console.error(V),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:V,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):R.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[S,r,e,o]),Xa.isMobile||v?(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(_,{backFn:n?a:void 0,onClose:f},"header"),(0,re.jsx)(se,{}),Xa.isIOS?(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(k4,{children:[(0,re.jsx)(At,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(St,{success:S,fail:!!g}),(0,re.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(gt,{children:[(0,re.jsx)(ye,{children:g?g.message:"Sign in with Farcaster"}),(0,re.jsx)(ge,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&(0,re.jsx)(N,{onClick:I=>{I.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(Dy,{children:[(0,re.jsx)(At,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(St,{success:S,fail:!!g}),(0,re.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(gt,{children:[(0,re.jsx)(ye,{children:g?g.message:"Signing in with Farcaster"}),(0,re.jsx)(ge,{children:g?g.detail:"This should only take a moment"}),(0,re.jsx)(er,{children:M&&Xa.isMobile&&(0,re.jsx)(uc,{text:"Take me to Warpcast",url:M,color:Ny})})]})]})}),(0,re.jsx)(z,{})]}):(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(_,{backFn:n?a:void 0,onClose:f},"header"),(0,re.jsx)(se,{}),(0,re.jsx)(Dy,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(ye,{children:"Sign in with Farcaster"}),(0,re.jsx)(ge,{children:"Scan with your phone's camera to continue."}),(0,re.jsx)(Ni,{children:M?(0,re.jsx)(ta,{url:M,size:275,squareLogoElement:ko}):(0,re.jsx)(_t,{})}),(0,re.jsxs)(er,{children:[(0,re.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&(0,re.jsx)(Pn,{text:M,itemName:"link",color:Ny})]})]})}),(0,re.jsx)(z,{})]})},Dy=rp.default.div`
1411
1411
  display: flex;
1412
1412
  flex-direction: column;
1413
1413
  align-items: center;
@@ -1415,14 +1415,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1415
1415
  margin-left: 27px;
1416
1416
  margin-right: 27px;
1417
1417
  gap: 24px;
1418
- `,A4=op.default.div`
1418
+ `,k4=rp.default.div`
1419
1419
  display: flex;
1420
1420
  flex-direction: column;
1421
1421
  align-items: center;
1422
1422
  justify-content: center;
1423
1423
  gap: 24px;
1424
1424
  width: 100%;
1425
- `;var Sn=require("react"),es=require("react-device-detect"),np=h(require("styled-components"));var oe=require("react/jsx-runtime"),Hy="#8a63d2",Vy=1e3,R4=Vy*2,I4=Vy*300,zy=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=k(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=W(),[a,l]=(0,Sn.useState)(void 0),[s,c]=(0,Sn.useState)(!1),[u,f]=(0,Sn.useState)(!1),y=(0,Sn.useRef)([]),g=o?.render.inDialog?Xe:0,C=r?.farcasterSigner;(0,Sn.useEffect)(()=>{let x=Date.now(),S=setInterval(async()=>{if(!C?.public_key){clearInterval(S),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}C.status==="approved"&&(clearInterval(S),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let b=await n(C?.public_key),R=Date.now()-x;b.status==="approved"?(clearInterval(S),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):R>I4?(clearInterval(S),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(S),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},R4);return()=>{clearInterval(S),y.current.forEach(b=>clearTimeout(b))}},[]);let v=C?.status==="pending_approval"?C.signer_approval_url:void 0;return es.isMobile||s?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_,{backFn:e?t:void 0,onClose:i},"header"),(0,oe.jsx)(se,{}),es.isIOS?(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(M4,{children:[(0,oe.jsx)(At,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(St,{success:u,fail:!!a}),(0,oe.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,oe.jsxs)(yt,{children:[(0,oe.jsx)(ye,{children:a?a.message:"Add a signer to Farcaster"}),(0,oe.jsx)(ge,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&(0,oe.jsx)(N,{onClick:x=>{x.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(Gy,{children:[(0,oe.jsx)(At,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(St,{success:u,fail:!!a}),(0,oe.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,oe.jsxs)(yt,{children:[(0,oe.jsx)(ye,{children:a?a.message:"Requesting signer from Farcaster"}),(0,oe.jsx)(ge,{children:a?a.detail:"This should only take a moment"}),(0,oe.jsx)(er,{children:v&&es.isMobile&&(0,oe.jsx)(uc,{text:"Take me to Warpcast",url:v,color:Hy})})]})]})}),(0,oe.jsx)(z,{})]}):(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_,{backFn:e?t:void 0,onClose:i},"header"),(0,oe.jsx)(se,{}),(0,oe.jsx)(Gy,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(ye,{children:"Add a signer to Farcaster"}),(0,oe.jsxs)(ge,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,oe.jsx)(Di,{children:C?.status==="pending_approval"?(0,oe.jsx)(ra,{url:C.signer_approval_url,size:275,squareLogoElement:ko}):(0,oe.jsx)(_t,{})}),(0,oe.jsxs)(er,{children:[(0,oe.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),C?.status==="pending_approval"&&(0,oe.jsx)(Tn,{text:C.signer_approval_url,itemName:"link",color:Hy})]})]})}),(0,oe.jsx)(z,{})]})},Gy=np.default.div`
1425
+ `;var Tn=require("react"),es=require("react-device-detect"),op=h(require("styled-components"));var oe=require("react/jsx-runtime"),By="#8a63d2",Gy=1e3,A4=Gy*2,R4=Gy*300,Vy=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=k(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=W(),[a,l]=(0,Tn.useState)(void 0),[s,c]=(0,Tn.useState)(!1),[u,f]=(0,Tn.useState)(!1),y=(0,Tn.useRef)([]),g=o?.render.inDialog?Xe:0,C=r?.farcasterSigner;(0,Tn.useEffect)(()=>{let x=Date.now(),S=setInterval(async()=>{if(!C?.public_key){clearInterval(S),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}C.status==="approved"&&(clearInterval(S),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let b=await n(C?.public_key),R=Date.now()-x;b.status==="approved"?(clearInterval(S),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):R>R4?(clearInterval(S),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(S),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},A4);return()=>{clearInterval(S),y.current.forEach(b=>clearTimeout(b))}},[]);let v=C?.status==="pending_approval"?C.signer_approval_url:void 0;return es.isMobile||s?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_,{backFn:e?t:void 0,onClose:i},"header"),(0,oe.jsx)(se,{}),es.isIOS?(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(I4,{children:[(0,oe.jsx)(At,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(St,{success:u,fail:!!a}),(0,oe.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,oe.jsxs)(gt,{children:[(0,oe.jsx)(ye,{children:a?a.message:"Add a signer to Farcaster"}),(0,oe.jsx)(ge,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&(0,oe.jsx)(N,{onClick:x=>{x.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):(0,oe.jsx)(oe.Fragment,{children:(0,oe.jsxs)(Hy,{children:[(0,oe.jsx)(At,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(St,{success:u,fail:!!a}),(0,oe.jsx)(ko,{style:{width:"38px",height:"38px"}})]})}),(0,oe.jsxs)(gt,{children:[(0,oe.jsx)(ye,{children:a?a.message:"Requesting signer from Farcaster"}),(0,oe.jsx)(ge,{children:a?a.detail:"This should only take a moment"}),(0,oe.jsx)(er,{children:v&&es.isMobile&&(0,oe.jsx)(uc,{text:"Take me to Warpcast",url:v,color:By})})]})]})}),(0,oe.jsx)(z,{})]}):(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_,{backFn:e?t:void 0,onClose:i},"header"),(0,oe.jsx)(se,{}),(0,oe.jsx)(Hy,{children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)(ye,{children:"Add a signer to Farcaster"}),(0,oe.jsxs)(ge,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,oe.jsx)(Ni,{children:C?.status==="pending_approval"?(0,oe.jsx)(ta,{url:C.signer_approval_url,size:275,squareLogoElement:ko}):(0,oe.jsx)(_t,{})}),(0,oe.jsxs)(er,{children:[(0,oe.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),C?.status==="pending_approval"&&(0,oe.jsx)(Pn,{text:C.signer_approval_url,itemName:"link",color:By})]})]})}),(0,oe.jsx)(z,{})]})},Hy=op.default.div`
1426
1426
  display: flex;
1427
1427
  flex-direction: column;
1428
1428
  align-items: center;
@@ -1430,14 +1430,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1430
1430
  margin-left: 27px;
1431
1431
  margin-right: 27px;
1432
1432
  gap: 24px;
1433
- `,M4=np.default.div`
1433
+ `,I4=op.default.div`
1434
1434
  display: flex;
1435
1435
  flex-direction: column;
1436
1436
  align-items: center;
1437
1437
  justify-content: center;
1438
1438
  gap: 24px;
1439
1439
  width: 100%;
1440
- `;var qy=h(require("@heroicons/react/24/outline/ClockIcon")),$y=h(require("@heroicons/react/24/outline/EyeSlashIcon")),Ky=h(require("@heroicons/react/24/outline/LinkIcon")),mo=h(require("styled-components"));var oa=require("react/jsx-runtime"),mc=({size:e=61,...t})=>(0,oa.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,oa.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,oa.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,oa.jsx)("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"})]})});var Ve=require("react/jsx-runtime"),ip=({title:e,desc:t,icon:r})=>(0,Ve.jsxs)(U4,{children:[(0,Ve.jsx)(B4,{children:r}),(0,Ve.jsxs)(F4,{children:[(0,Ve.jsx)(N4,{children:e}),(0,Ve.jsx)(D4,{children:t})]})]}),jy=({app:e,signedUrl:t,onContinue:r})=>(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsxs)(L4,{children:[(0,Ve.jsx)(mc,{size:"3.75rem"}),(0,Ve.jsxs)(O4,{children:[e?.name," uses ",(0,Ve.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,Ve.jsxs)(H4,{children:[(0,Ve.jsx)(ip,{icon:(0,Ve.jsx)(Ky.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,Ve.jsxs)(Ve.Fragment,{children:["Connect a payment method (",(0,Ve.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,Ve.jsx)(ip,{icon:(0,Ve.jsx)(qy.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,Ve.jsx)(ip,{icon:(0,Ve.jsx)($y.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,Ve.jsx)(G4,{className:"mobile-only"})]}),(0,Ve.jsx)(W4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,Ve.jsx)(Gl,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),W4=mo.default.span`
1440
+ `;var zy=h(require("@heroicons/react/24/outline/ClockIcon")),qy=h(require("@heroicons/react/24/outline/EyeSlashIcon")),$y=h(require("@heroicons/react/24/outline/LinkIcon")),mo=h(require("styled-components"));var ra=require("react/jsx-runtime"),mc=({size:e=61,...t})=>(0,ra.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,ra.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,ra.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,ra.jsx)("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"})]})});var ze=require("react/jsx-runtime"),np=({title:e,desc:t,icon:r})=>(0,ze.jsxs)(D4,{children:[(0,ze.jsx)(F4,{children:r}),(0,ze.jsxs)(U4,{children:[(0,ze.jsx)(O4,{children:e}),(0,ze.jsx)(N4,{children:t})]})]}),Ky=({app:e,signedUrl:t,onContinue:r})=>(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsxs)(W4,{children:[(0,ze.jsx)(mc,{size:"3.75rem"}),(0,ze.jsxs)(L4,{children:[e?.name," uses ",(0,ze.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,ze.jsxs)(B4,{children:[(0,ze.jsx)(np,{icon:(0,ze.jsx)($y.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,ze.jsxs)(ze.Fragment,{children:["Connect a payment method (",(0,ze.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,ze.jsx)(np,{icon:(0,ze.jsx)(zy.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,ze.jsx)(np,{icon:(0,ze.jsx)(qy.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,ze.jsx)(H4,{className:"mobile-only"})]}),(0,ze.jsx)(M4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,ze.jsx)(Gl,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),M4=mo.default.span`
1441
1441
  display: inline-block;
1442
1442
  color: var(--privy-color-foreground-3);
1443
1443
  text-align: center;
@@ -1446,13 +1446,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1446
1446
  font-weight: 400;
1447
1447
  line-height: 140%; /* 0.875rem */
1448
1448
  margin-bottom: 0.25rem;
1449
- `,L4=mo.default.div`
1449
+ `,W4=mo.default.div`
1450
1450
  display: flex;
1451
1451
  flex-direction: column;
1452
1452
  align-items: center;
1453
1453
  justify-content: center;
1454
1454
  padding: 1.5rem 0;
1455
- `,O4=mo.default.span`
1455
+ `,L4=mo.default.span`
1456
1456
  color: var(--privy-color-foreground);
1457
1457
  text-align: center;
1458
1458
  font-size: 1.125rem;
@@ -1461,46 +1461,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1461
1461
  margin: 1.5rem 0;
1462
1462
  text-align: center;
1463
1463
  max-width: 19.5rem;
1464
- `,N4=mo.default.span`
1464
+ `,O4=mo.default.span`
1465
1465
  color: var(--privy-color-foreground);
1466
1466
  font-size: 0.875rem;
1467
1467
  font-weight: 500;
1468
1468
  line-height: 1.225rem;
1469
1469
  width: 100%;
1470
- `,D4=mo.default.span`
1470
+ `,N4=mo.default.span`
1471
1471
  color: var(--privy-color-foreground-2);
1472
1472
  font-size: 0.875rem;
1473
1473
  font-weight: 400;
1474
1474
  line-height: 1.225rem;
1475
- `,U4=mo.default.div`
1475
+ `,D4=mo.default.div`
1476
1476
  display: flex;
1477
1477
  align-items: flex-start;
1478
1478
  gap: 0.5rem;
1479
1479
  align-self: stretch;
1480
- `,F4=mo.default.div`
1480
+ `,U4=mo.default.div`
1481
1481
  display: flex;
1482
1482
  flex-direction: column;
1483
1483
  gap: 0.25rem;
1484
1484
  align-items: flex-start;
1485
1485
  text-align: left;
1486
1486
  flex: 1 0 0;
1487
- `,B4=mo.default.div`
1487
+ `,F4=mo.default.div`
1488
1488
  padding-top: 2px;
1489
- `,H4=mo.default.div`
1489
+ `,B4=mo.default.div`
1490
1490
  display: flex;
1491
1491
  flex-direction: column;
1492
1492
  gap: 1.25rem;
1493
1493
  margin: 0 0.5rem;
1494
- `,G4=mo.default.div`
1494
+ `,H4=mo.default.div`
1495
1495
  margin: 30px 0;
1496
- `;var Zy=require("ofetch"),na=require("react");var fc="moonpay",Yy="sdk_fiat_on_ramp_completed_with_status";async function Jy(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 V4(e,t){let r=t?am:im,o=t?lm:sm;return(0,Zy.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Qy(e,t=!1){let[r,o]=(0,na.useState)(null),{createAnalyticsEvent:n}=W(),i=(0,na.useRef)(0);return(0,na.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await V4(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Yy,payload:{status:s,provider:fc,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:Yy,payload:{status:"serviceFailure",provider:fc}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}var _n=require("react/jsx-runtime"),Xy=()=>{let{app:e,data:t,navigate:r}=k(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,_n.jsxs)(_n.Fragment,{children:[(0,_n.jsx)(_,{title:"Fund account"},"header"),(0,_n.jsx)(jy,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:fc}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,_n.jsx)($,{protectedByPrivy:!0})]})};var e1=h(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),t1=h(require("@heroicons/react/24/solid/CheckCircleIcon")),r1=h(require("@heroicons/react/24/solid/XCircleIcon")),o1=require("react"),ap=h(require("styled-components"));var De=require("react/jsx-runtime"),n1=()=>{let{app:e,data:t}=k(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Qy(o||null,e.fiatOnRamp.useSandbox);return(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(_,{title:"Fund account"},"header"),(0,De.jsx)(q4,{status:n,onClickCta:r}),(0,De.jsx)($,{protectedByPrivy:!0})]})},z4=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:(0,De.jsxs)(De.Fragment,{children:[(0,De.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,De.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,De.jsx)("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:""}}},q4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,o1.useMemo)(()=>z4(e),[e]);return(0,De.jsxs)(De.Fragment,{children:[(0,De.jsxs)(Z4,{children:[(0,De.jsx)(j4,{status:e}),(0,De.jsxs)(yt,{children:[(0,De.jsx)("h3",{children:r}),(0,De.jsx)(Y4,{children:o})]})]}),n&&(0,De.jsx)(N,{onClick:t,children:n})]})},$4=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)",K4=e=>{switch(e){case"serviceFailure":case"failed":return r1.default;case"completed":return t1.default;case"waitingAuthorization":return()=>(0,De.jsx)(e1.default,{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}},j4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,De.jsxs)("div",{style:{position:"relative"},children:[(0,De.jsx)(_t,{color:o,style:{position:"absolute"}}),(0,De.jsx)(Ld,{color:o}),(0,De.jsx)(mc,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=K4(e),r=$4(e);return(0,De.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,De.jsx)(t,{width:"4rem",height:"4rem",color:r})})},Y4=ap.default.p`
1496
+ `;var Yy=require("ofetch"),oa=require("react");var fc="moonpay",jy="sdk_fiat_on_ramp_completed_with_status";async function Zy(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 G4(e,t){let r=t?im:nm,o=t?sm:am;return(0,Yy.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Jy(e,t=!1){let[r,o]=(0,oa.useState)(null),{createAnalyticsEvent:n}=W(),i=(0,oa.useRef)(0);return(0,oa.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await G4(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:jy,payload:{status:s,provider:fc,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:jy,payload:{status:"serviceFailure",provider:fc}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}var Sn=require("react/jsx-runtime"),Qy=()=>{let{app:e,data:t,navigate:r}=k(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(_,{title:"Fund account"},"header"),(0,Sn.jsx)(Ky,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:fc}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,Sn.jsx)(q,{protectedByPrivy:!0})]})};var Xy=h(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),e1=h(require("@heroicons/react/24/solid/CheckCircleIcon")),t1=h(require("@heroicons/react/24/solid/XCircleIcon")),r1=require("react"),ip=h(require("styled-components"));var Ue=require("react/jsx-runtime"),o1=()=>{let{app:e,data:t}=k(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Jy(o||null,e.fiatOnRamp.useSandbox);return(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(_,{title:"Fund account"},"header"),(0,Ue.jsx)(z4,{status:n,onClickCta:r}),(0,Ue.jsx)(q,{protectedByPrivy:!0})]})},V4=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:(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,Ue.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,Ue.jsx)("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:""}}},z4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,r1.useMemo)(()=>V4(e),[e]);return(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsxs)(Y4,{children:[(0,Ue.jsx)(K4,{status:e}),(0,Ue.jsxs)(gt,{children:[(0,Ue.jsx)("h3",{children:r}),(0,Ue.jsx)(j4,{children:o})]})]}),n&&(0,Ue.jsx)(N,{onClick:t,children:n})]})},q4=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)",$4=e=>{switch(e){case"serviceFailure":case"failed":return t1.default;case"completed":return e1.default;case"waitingAuthorization":return()=>(0,Ue.jsx)(Xy.default,{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}},K4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,Ue.jsxs)("div",{style:{position:"relative"},children:[(0,Ue.jsx)(_t,{color:o,style:{position:"absolute"}}),(0,Ue.jsx)(Wd,{color:o}),(0,Ue.jsx)(mc,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=$4(e),r=q4(e);return(0,Ue.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,Ue.jsx)(t,{width:"4rem",height:"4rem",color:r})})},j4=ip.default.p`
1497
1497
  font-size: 1rem;
1498
1498
  color: var(--privy-color-foreground-3);
1499
1499
  margin-bottom: 1rem;
1500
1500
  display: flex;
1501
1501
  flex-direction: column;
1502
1502
  gap: 1rem;
1503
- `,Z4=ap.default.div`
1503
+ `,Y4=ip.default.div`
1504
1504
  display: flex;
1505
1505
  flex-direction: column;
1506
1506
  align-items: center;
@@ -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
- `;var i1=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),a1=h(require("styled-components"));var Rr=require("react/jsx-runtime"),s1=()=>{let{closePrivyModal:e}=W();return(0,Rr.jsxs)(Rr.Fragment,{children:[(0,Rr.jsx)(_,{},"header"),(0,Rr.jsx)(J4,{children:(0,Rr.jsx)(i1.default,{style:{width:32,height:32}})}),(0,Rr.jsx)(So,{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"}}),(0,Rr.jsx)(Vr,{children:(0,Rr.jsx)(N,{onClick:()=>e(),children:"Close"})}),(0,Rr.jsx)(me,{}),(0,Rr.jsx)($,{protectedByPrivy:!0})]})},J4=a1.default.div`
1511
+ `;var n1=h(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),i1=h(require("styled-components"));var Rr=require("react/jsx-runtime"),a1=()=>{let{closePrivyModal:e}=W();return(0,Rr.jsxs)(Rr.Fragment,{children:[(0,Rr.jsx)(_,{},"header"),(0,Rr.jsx)(Z4,{children:(0,Rr.jsx)(n1.default,{style:{width:32,height:32}})}),(0,Rr.jsx)(So,{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"}}),(0,Rr.jsx)(Vr,{children:(0,Rr.jsx)(N,{onClick:()=>e(),children:"Close"})}),(0,Rr.jsx)(me,{}),(0,Rr.jsx)(q,{protectedByPrivy:!0})]})},Z4=i1.default.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
- `;var d1=h(require("react-device-detect")),p1=h(require("styled-components"));var hc=h(require("styled-components"));var sp=require("react/jsx-runtime"),l1=({style:e,...t})=>(0,sp.jsx)("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:(0,sp.jsx)("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)"})});var gc=require("react/jsx-runtime"),c1=hc.default.div`
1521
+ `;var c1=h(require("react-device-detect")),d1=h(require("styled-components"));var hc=h(require("styled-components"));var ap=require("react/jsx-runtime"),s1=({style:e,...t})=>(0,ap.jsx)("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:(0,ap.jsx)("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)"})});var gc=require("react/jsx-runtime"),l1=hc.default.div`
1522
1522
  display: flex;
1523
1523
  flex-direction: column;
1524
1524
  justify-content: flex-start;
1525
1525
  gap: 4px;
1526
- `,lp=hc.default.div`
1526
+ `,sp=hc.default.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
- `,yc=({children:e})=>(0,gc.jsxs)(Q4,{children:[(0,gc.jsx)(l1,{style:{width:"16px",height:"16px"}}),e]}),Q4=hc.default.div`
1532
+ `,yc=({children:e})=>(0,gc.jsxs)(J4,{children:[(0,gc.jsx)(s1,{style:{width:"16px",height:"16px"}}),e]}),J4=hc.default.div`
1533
1533
  display: flex;
1534
1534
  justify-content: flex-start;
1535
1535
  justify-items: center;
@@ -1547,15 +1547,15 @@ 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
- `;var $e=require("react/jsx-runtime"),X4=()=>(0,$e.jsxs)(eC,{children:[(0,$e.jsx)(Ga,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,$e.jsx)(er,{children:(0,$e.jsx)(wo,{style:{width:"152px",height:"152px"}})}),(0,$e.jsxs)(c1,{children:[(0,$e.jsx)(yc,{children:(0,$e.jsxs)("div",{children:[(0,$e.jsx)("span",{children:"Install the "}),(0,$e.jsx)("a",{href:d1.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"})]})}),(0,$e.jsx)(lp,{}),(0,$e.jsx)(yc,{children:"Set up your first wallet"}),(0,$e.jsx)(lp,{}),(0,$e.jsx)(yc,{children:"Store your recovery phrase in a safe place!"})]}),(0,$e.jsx)(Li,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),u1=()=>{let{navigateBack:e}=k();return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(_,{backFn:e},"header"),(0,$e.jsx)(se,{}),(0,$e.jsx)(X4,{}),(0,$e.jsx)(me,{}),(0,$e.jsxs)(z,{children:[(0,$e.jsx)("span",{children:"Still not sure? "}),(0,$e.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},eC=(0,p1.default)(er)`
1550
+ `;var Ke=require("react/jsx-runtime"),Q4=()=>(0,Ke.jsxs)(X4,{children:[(0,Ke.jsx)(Ga,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,Ke.jsx)(er,{children:(0,Ke.jsx)(wo,{style:{width:"152px",height:"152px"}})}),(0,Ke.jsxs)(l1,{children:[(0,Ke.jsx)(yc,{children:(0,Ke.jsxs)("div",{children:[(0,Ke.jsx)("span",{children:"Install the "}),(0,Ke.jsx)("a",{href:c1.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),(0,Ke.jsx)(sp,{}),(0,Ke.jsx)(yc,{children:"Set up your first wallet"}),(0,Ke.jsx)(sp,{}),(0,Ke.jsx)(yc,{children:"Store your recovery phrase in a safe place!"})]}),(0,Ke.jsx)(Wi,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),p1=()=>{let{navigateBack:e}=k();return(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(_,{backFn:e},"header"),(0,Ke.jsx)(se,{}),(0,Ke.jsx)(Q4,{}),(0,Ke.jsx)(me,{}),(0,Ke.jsxs)(z,{children:[(0,Ke.jsx)("span",{children:"Still not sure? "}),(0,Ke.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},X4=(0,d1.default)(er)`
1551
1551
  gap: 30px;
1552
1552
 
1553
1553
  > :first-child > svg {
1554
1554
  margin-top: 20px;
1555
1555
  }
1556
- `;var k1=h(require("@heroicons/react/24/outline/UserCircleIcon")),ns=require("react"),A1=require("react-device-detect"),R1=h(require("styled-components"));var f1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),h1=require("react");var m1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),ts=require("react"),cp=h(require("styled-components"));var fo=require("react/jsx-runtime"),vc=(0,ts.forwardRef)((e,t)=>{let[r,o]=(0,ts.useState)(""),[n,i]=(0,ts.useState)(!1),{authenticated:a}=H(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:c,currentScreen:u}=k(),{enabled:f,token:y}=Pe(),g=Ds(r),C=n,v=n||!g,x=b=>{i(!0),l(r,b).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{c({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},S=()=>{f&&!y&&!a?(c({captchaModalData:{callback:b=>l(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(y)};return(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(tC,{children:(0,fo.jsxs)(rC,{stacked:e.stacked,children:[(0,fo.jsx)(m1.default,{}),(0,fo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&S()},value:r,autoComplete:"email"}),e.stacked?null:(0,fo.jsx)(Oi,{isSubmitting:C,onClick:S,disabled:v,children:"Submit"})]})}),e.stacked?(0,fo.jsx)(N,{loadingText:null,loading:C,disabled:v,onClick:S,children:"Submit"}):null]})}),tC=cp.default.div`
1556
+ `;var x1=h(require("@heroicons/react/24/outline/UserCircleIcon")),ns=require("react"),k1=require("react-device-detect"),A1=h(require("styled-components"));var m1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),f1=require("react");var u1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),ts=require("react"),lp=h(require("styled-components"));var fo=require("react/jsx-runtime"),vc=(0,ts.forwardRef)((e,t)=>{let[r,o]=(0,ts.useState)(""),[n,i]=(0,ts.useState)(!1),{authenticated:a}=H(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:c,currentScreen:u}=k(),{enabled:f,token:y}=Te(),g=Ds(r),C=n,v=n||!g,x=b=>{i(!0),l(r,b).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{c({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},S=()=>{f&&!y&&!a?(c({captchaModalData:{callback:b=>l(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(y)};return(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)(eC,{children:(0,fo.jsxs)(tC,{stacked:e.stacked,children:[(0,fo.jsx)(u1.default,{}),(0,fo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&S()},value:r,autoComplete:"email"}),e.stacked?null:(0,fo.jsx)(Li,{isSubmitting:C,onClick:S,disabled:v,children:"Submit"})]})}),e.stacked?(0,fo.jsx)(N,{loadingText:null,loading:C,disabled:v,onClick:S,children:"Submit"}):null]})}),eC=lp.default.div`
1557
1557
  width: 100%;
1558
- `,rC=cp.default.label`
1558
+ `,tC=lp.default.label`
1559
1559
  display: block;
1560
1560
  position: relative;
1561
1561
  width: 100%;
@@ -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
- `;var Ao=require("react/jsx-runtime"),Cc=({isEditable:e,setIsEditable:t})=>{let r=(0,h1.useRef)(null);return(0,Ao.jsxs)(Ao.Fragment,{children:[(0,Ao.jsx)(ao,{if:!e,children:(0,Ao.jsx)(vc,{ref:r})}),(0,Ao.jsx)(ao,{if:e,children:(0,Ao.jsxs)(Ne,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Ao.jsx)(f1.default,{})," Continue with Email"]})})]})};var y1=require("react");var ia=require("react/jsx-runtime"),wc=()=>{let[e,t]=(0,y1.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=k(),{enabled:i,token:a}=Pe(),{initLoginWithFarcaster:l}=W();return(0,ia.jsxs)(Ne,{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:[(0,ia.jsx)(ko,{})," Farcaster",e&&(0,ia.jsx)("span",{children:(0,ia.jsx)(Vo,{})})]})};var bc=h(require("styled-components"));var g1=require("react/jsx-runtime"),Ec=()=>{let{enabled:e,token:t}=Pe(),{navigate:r,setModalData:o}=k(),{initLoginWithPasskey:n}=W();return(0,g1.jsx)(nC,{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"})},oC=bc.css`
1619
+ `;var Ao=require("react/jsx-runtime"),Cc=({isEditable:e,setIsEditable:t})=>{let r=(0,f1.useRef)(null);return(0,Ao.jsxs)(Ao.Fragment,{children:[(0,Ao.jsx)(ao,{if:!e,children:(0,Ao.jsx)(vc,{ref:r})}),(0,Ao.jsx)(ao,{if:e,children:(0,Ao.jsxs)(De,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Ao.jsx)(m1.default,{})," Continue with Email"]})})]})};var h1=require("react");var na=require("react/jsx-runtime"),wc=()=>{let[e,t]=(0,h1.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=k(),{enabled:i,token:a}=Te(),{initLoginWithFarcaster:l}=W();return(0,na.jsxs)(De,{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:[(0,na.jsx)(ko,{})," Farcaster",e&&(0,na.jsx)("span",{children:(0,na.jsx)(Vo,{})})]})};var bc=h(require("styled-components"));var y1=require("react/jsx-runtime"),Ec=()=>{let{enabled:e,token:t}=Te(),{navigate:r,setModalData:o}=k(),{initLoginWithPasskey:n}=W();return(0,y1.jsx)(oC,{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"})},rC=bc.css`
1620
1620
  && {
1621
1621
  width: 100%;
1622
1622
  font-size: 0.875rem;
@@ -1641,11 +1641,11 @@ 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
- `,nC=bc.default.button`
1645
- ${oC}
1646
- `;var P1=h(require("@heroicons/react/24/outline/PhoneIcon")),T1=require("react");var aa=require("react"),dp=h(require("styled-components"));var v1=h(require("libphonenumber-js/examples.mobile.json")),Ir=require("libphonenumber-js/min"),Tc=require("react/jsx-runtime");var rs=(e,t)=>(0,Ir.isPossiblePhoneNumber)(String(e),t),Pc=(e,t)=>`+${(0,Ir.getCountryCallingCode)(t)} ${e}`,C1=e=>`*${e.replaceAll("-","").slice(-4)}`,w1=e=>new Ir.AsYouType(e),iC=(0,Ir.getCountries)().map(e=>({code:e,callCode:(0,Ir.getCountryCallingCode)(e)})),b1=e=>{let t=(0,Ir.getExampleNumber)(e,v1.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},E1=({value:e,onChange:t})=>(0,Tc.jsx)("select",{value:e,onChange:t,children:iC.map(r=>(0,Tc.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var ho=require("react/jsx-runtime"),sa=(0,aa.forwardRef)((e,t)=>{let{app:r}=k(),[o,n]=(0,aa.useState)(""),[i,a]=(0,aa.useState)(r?.intl.defaultCountry??"US"),l=rs(o,i),s=w1(i),c=b1(i),u=(0,Ir.getCountryCallingCode)(i),f=!l,[y,g]=(0,aa.useState)(!1),C=u.length,v=b=>{let R=b.target.value;a(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Pc(o,R),countryCode:R,isValid:rs(o,i)})},x=b=>{try{let R=b.replace(/\D/g,""),A=o.replace(/\D/g,""),O=R===A?b:s.input(b);n(O),e.onChange&&e.onChange({rawPhoneNumber:O,qualifiedPhoneNumber:Pc(b,i),countryCode:i,isValid:rs(b,i)})}catch(R){console.error("Error processing phone number:",R)}},S=()=>{g(!0);let b=Pc(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:i,isValid:rs(o,i)}).finally(()=>g(!1))};return(0,ho.jsxs)(ho.Fragment,{children:[(0,ho.jsx)(aC,{children:(0,ho.jsxs)(sC,{callingCodeLength:C,stacked:e.stacked,children:[(0,ho.jsx)(E1,{value:i,onChange:v}),(0,ho.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{x(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&S()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,ho.jsx)(Oi,{isSubmitting:y,onClick:S,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,ho.jsx)(N,{loading:y,loadingText:null,onClick:S,disabled:f,children:"Submit"}):null]})}),aC=dp.default.div`
1644
+ `,oC=bc.default.button`
1645
+ ${rC}
1646
+ `;var E1=h(require("@heroicons/react/24/outline/PhoneIcon")),P1=require("react");var ia=require("react"),cp=h(require("styled-components"));var g1=h(require("libphonenumber-js/examples.mobile.json")),Ir=require("libphonenumber-js/min"),Tc=require("react/jsx-runtime");var rs=(e,t)=>(0,Ir.isPossiblePhoneNumber)(String(e),t),Pc=(e,t)=>`+${(0,Ir.getCountryCallingCode)(t)} ${e}`,v1=e=>`*${e.replaceAll("-","").slice(-4)}`,C1=e=>new Ir.AsYouType(e),nC=(0,Ir.getCountries)().map(e=>({code:e,callCode:(0,Ir.getCountryCallingCode)(e)})),w1=e=>{let t=(0,Ir.getExampleNumber)(e,g1.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},b1=({value:e,onChange:t})=>(0,Tc.jsx)("select",{value:e,onChange:t,children:nC.map(r=>(0,Tc.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var ho=require("react/jsx-runtime"),aa=(0,ia.forwardRef)((e,t)=>{let{app:r}=k(),[o,n]=(0,ia.useState)(""),[i,a]=(0,ia.useState)(r?.intl.defaultCountry??"US"),l=rs(o,i),s=C1(i),c=w1(i),u=(0,Ir.getCountryCallingCode)(i),f=!l,[y,g]=(0,ia.useState)(!1),C=u.length,v=b=>{let R=b.target.value;a(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Pc(o,R),countryCode:R,isValid:rs(o,i)})},x=b=>{try{let R=b.replace(/\D/g,""),A=o.replace(/\D/g,""),O=R===A?b:s.input(b);n(O),e.onChange&&e.onChange({rawPhoneNumber:O,qualifiedPhoneNumber:Pc(b,i),countryCode:i,isValid:rs(b,i)})}catch(R){console.error("Error processing phone number:",R)}},S=()=>{g(!0);let b=Pc(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:i,isValid:rs(o,i)}).finally(()=>g(!1))};return(0,ho.jsxs)(ho.Fragment,{children:[(0,ho.jsx)(iC,{children:(0,ho.jsxs)(aC,{callingCodeLength:C,stacked:e.stacked,children:[(0,ho.jsx)(b1,{value:i,onChange:v}),(0,ho.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{x(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&S()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,ho.jsx)(Li,{isSubmitting:y,onClick:S,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,ho.jsx)(N,{loading:y,loadingText:null,onClick:S,disabled:f,children:"Submit"}):null]})}),iC=cp.default.div`
1647
1647
  width: 100%;
1648
- `,sC=dp.default.label`
1648
+ `,aC=cp.default.label`
1649
1649
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1650
1650
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1651
1651
  display: block;
@@ -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
- `;var Ro=require("react/jsx-runtime"),Sc=({isEditable:e,setIsEditable:t})=>{let r=(0,T1.useRef)(null),{authenticated:o}=H(),{navigate:n,setModalData:i,currentScreen:a}=k(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=Pe();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:y=>l(f,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(y){i({errorModalData:{error:y,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Ro.jsxs)(Ro.Fragment,{children:[(0,Ro.jsx)(ao,{if:!e,children:(0,Ro.jsx)(sa,{ref:r,onSubmit:u})}),(0,Ro.jsx)(ao,{if:e,children:(0,Ro.jsxs)(Ne,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Ro.jsx)(P1.default,{})," Continue with SMS"]})})]})};var S1=require("react");var Kr=require("react/jsx-runtime"),lC={apple:{logo:(0,Kr.jsx)(Qs,{}),displayName:"Apple"},discord:{logo:(0,Kr.jsx)(Xs,{}),displayName:"Discord"},github:{logo:(0,Kr.jsx)(el,{}),displayName:"GitHub"},google:{logo:(0,Kr.jsx)(tl,{}),displayName:"Google"},linkedin:{logo:(0,Kr.jsx)(ol,{}),displayName:"LinkedIn"},spotify:{logo:(0,Kr.jsx)(nl,{}),displayName:"Spotify"},instagram:{logo:(0,Kr.jsx)(rl,{}),displayName:"Instagram"},twitter:{logo:(0,Kr.jsx)(al,{}),displayName:"Twitter"},tiktok:{logo:(0,Kr.jsx)(il,{}),displayName:"TikTok"}},Mt=({provider:e})=>{let{enabled:t,token:r}=Pe(),{navigate:o,setModalData:n}=k(),[i,a]=(0,S1.useState)(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:c}=lC[e];return(0,Kr.jsxs)(Ne,{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]})};var _1=require("react");var jr=require("react/jsx-runtime");function _c(e){return(0,jr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[(0,jr.jsx)("defs",{children:(0,jr.jsxs)("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[(0,jr.jsx)("stop",{offset:"0",stopColor:"#1d93d2"}),(0,jr.jsx)("stop",{offset:"1",stopColor:"#38b0e3"})]})}),(0,jr.jsx)("title",{children:"Telegram_logo"}),(0,jr.jsx)("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),(0,jr.jsx)("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"}),(0,jr.jsx)("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"}),(0,jr.jsx)("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"})]})}var kc=require("react/jsx-runtime"),xc=()=>{let{enabled:e,token:t}=Pe(),{navigate:r,setModalData:o}=k(),[n,i]=(0,_1.useState)(!1),{initLoginWithTelegram:a}=W();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(0,kc.jsxs)(Ne,{onClick:s,disabled:n,children:[(0,kc.jsx)(_c,{})," Telegram"]})};var x1=h(require("@heroicons/react/24/outline/ChevronRightIcon"));var os=require("react/jsx-runtime"),Ac=({onClick:e,text:t,icon:r})=>(0,os.jsxs)(Ne,{onClick:e,children:[r,(0,os.jsx)(Vl,{children:t}),(0,os.jsx)(x1.default,{})]});var Re=require("react/jsx-runtime"),Ic=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{appearance:{palette:{colorScheme:i}}}=dr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,f]=(0,ns.useState)("default"),[y,g]=(0,ns.useState)("email");(0,ns.useEffect)(()=>{let I=s.indexOf("sms"),V=s.indexOf("email");I>-1&&I<V&&g("sms")},[a,l]);let C=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=C;let v=I=>I==="email"?(0,Re.jsx)(Cc,{isEditable:y==="email",setIsEditable:()=>{g("email")}},I):I==="sms"?(0,Re.jsx)(Sc,{isEditable:y==="sms",setIsEditable:()=>{g("sms")}},I):I==="apple"?(0,Re.jsx)(Mt,{provider:"apple"},I):I==="discord"?(0,Re.jsx)(Mt,{provider:"discord"},I):I==="farcaster"?(0,Re.jsx)(wc,{},I):I==="github"?(0,Re.jsx)(Mt,{provider:"github"},I):I==="google"?(0,Re.jsx)(Mt,{provider:"google"},I):I==="linkedin"?(0,Re.jsx)(Mt,{provider:"linkedin"},I):I==="tiktok"?(0,Re.jsx)(Mt,{provider:"tiktok"},I):I==="twitter"&&(!A1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,Re.jsx)(Mt,{provider:"twitter"},I):I==="telegram"?(0,Re.jsx)(xc,{},I):Va([I],r,e,s),x=a.map(v).flat(),S=l.map(v).flat(),b=[...x,...S],R=cC({primary:x.length,overflow:S.length}),[A,O]=Hu(b,R),M=u==="default"?void 0:()=>{f("default")};return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(_,{title:o.appearance.landingHeader,onClose:C,backFn:M}),u==="default"&&(0,Re.jsx)(dC,{}),(0,Re.jsx)(zl,{style:{overflow:"hidden"},children:(0,Re.jsxs)(Ef,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&(0,Re.jsxs)(Re.Fragment,{children:[...A,O.length>0&&(0,Re.jsx)(Ac,{text:"More options",icon:(0,Re.jsx)(k1.default,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&(0,Re.jsxs)(Re.Fragment,{children:[...O]}),c&&u==="default"&&(0,Re.jsx)(Ec,{})]})}),o&&(0,Re.jsx)(Ni,{app:o}),(0,Re.jsx)($,{protectedByPrivy:!0})]})},Rc=5,cC=({primary:e,overflow:t})=>e<Rc?e:e===Rc&&t===0?Rc:Rc-1,dC=(0,R1.default)(Bi)`
1735
+ `;var Ro=require("react/jsx-runtime"),Sc=({isEditable:e,setIsEditable:t})=>{let r=(0,P1.useRef)(null),{authenticated:o}=H(),{navigate:n,setModalData:i,currentScreen:a}=k(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=Te();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:y=>l(f,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(y){i({errorModalData:{error:y,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Ro.jsxs)(Ro.Fragment,{children:[(0,Ro.jsx)(ao,{if:!e,children:(0,Ro.jsx)(aa,{ref:r,onSubmit:u})}),(0,Ro.jsx)(ao,{if:e,children:(0,Ro.jsxs)(De,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Ro.jsx)(E1.default,{})," Continue with SMS"]})})]})};var T1=require("react");var Kr=require("react/jsx-runtime"),sC={apple:{logo:(0,Kr.jsx)(Qs,{}),displayName:"Apple"},discord:{logo:(0,Kr.jsx)(Xs,{}),displayName:"Discord"},github:{logo:(0,Kr.jsx)(el,{}),displayName:"GitHub"},google:{logo:(0,Kr.jsx)(tl,{}),displayName:"Google"},linkedin:{logo:(0,Kr.jsx)(ol,{}),displayName:"LinkedIn"},spotify:{logo:(0,Kr.jsx)(nl,{}),displayName:"Spotify"},instagram:{logo:(0,Kr.jsx)(rl,{}),displayName:"Instagram"},twitter:{logo:(0,Kr.jsx)(al,{}),displayName:"Twitter"},tiktok:{logo:(0,Kr.jsx)(il,{}),displayName:"TikTok"}},Mt=({provider:e})=>{let{enabled:t,token:r}=Te(),{navigate:o,setModalData:n}=k(),[i,a]=(0,T1.useState)(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:c}=sC[e];return(0,Kr.jsxs)(De,{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]})};var S1=require("react");var jr=require("react/jsx-runtime");function _c(e){return(0,jr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[(0,jr.jsx)("defs",{children:(0,jr.jsxs)("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[(0,jr.jsx)("stop",{offset:"0",stopColor:"#1d93d2"}),(0,jr.jsx)("stop",{offset:"1",stopColor:"#38b0e3"})]})}),(0,jr.jsx)("title",{children:"Telegram_logo"}),(0,jr.jsx)("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),(0,jr.jsx)("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"}),(0,jr.jsx)("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"}),(0,jr.jsx)("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"})]})}var kc=require("react/jsx-runtime"),xc=()=>{let{enabled:e,token:t}=Te(),{navigate:r,setModalData:o}=k(),[n,i]=(0,S1.useState)(!1),{initLoginWithTelegram:a}=W();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(0,kc.jsxs)(De,{onClick:s,disabled:n,children:[(0,kc.jsx)(_c,{})," Telegram"]})};var _1=h(require("@heroicons/react/24/outline/ChevronRightIcon"));var os=require("react/jsx-runtime"),Ac=({onClick:e,text:t,icon:r})=>(0,os.jsxs)(De,{onClick:e,children:[r,(0,os.jsx)(Vl,{children:t}),(0,os.jsx)(_1.default,{})]});var Ie=require("react/jsx-runtime"),Ic=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{appearance:{palette:{colorScheme:i}}}=dr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,f]=(0,ns.useState)("default"),[y,g]=(0,ns.useState)("email");(0,ns.useEffect)(()=>{let I=s.indexOf("sms"),V=s.indexOf("email");I>-1&&I<V&&g("sms")},[a,l]);let C=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=C;let v=I=>I==="email"?(0,Ie.jsx)(Cc,{isEditable:y==="email",setIsEditable:()=>{g("email")}},I):I==="sms"?(0,Ie.jsx)(Sc,{isEditable:y==="sms",setIsEditable:()=>{g("sms")}},I):I==="apple"?(0,Ie.jsx)(Mt,{provider:"apple"},I):I==="discord"?(0,Ie.jsx)(Mt,{provider:"discord"},I):I==="farcaster"?(0,Ie.jsx)(wc,{},I):I==="github"?(0,Ie.jsx)(Mt,{provider:"github"},I):I==="google"?(0,Ie.jsx)(Mt,{provider:"google"},I):I==="linkedin"?(0,Ie.jsx)(Mt,{provider:"linkedin"},I):I==="tiktok"?(0,Ie.jsx)(Mt,{provider:"tiktok"},I):I==="twitter"&&(!k1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,Ie.jsx)(Mt,{provider:"twitter"},I):I==="telegram"?(0,Ie.jsx)(xc,{},I):Va([I],r,e,s),x=a.map(v).flat(),S=l.map(v).flat(),b=[...x,...S],R=lC({primary:x.length,overflow:S.length}),[A,O]=Bu(b,R),M=u==="default"?void 0:()=>{f("default")};return(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)(_,{title:o.appearance.landingHeader,onClose:C,backFn:M}),u==="default"&&(0,Ie.jsx)(cC,{}),(0,Ie.jsx)(zl,{style:{overflow:"hidden"},children:(0,Ie.jsxs)(bf,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&(0,Ie.jsxs)(Ie.Fragment,{children:[...A,O.length>0&&(0,Ie.jsx)(Ac,{text:"More options",icon:(0,Ie.jsx)(x1.default,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&(0,Ie.jsxs)(Ie.Fragment,{children:[...O]}),c&&u==="default"&&(0,Ie.jsx)(Ec,{})]})}),o&&(0,Ie.jsx)(Oi,{app:o}),(0,Ie.jsx)(q,{protectedByPrivy:!0})]})},Rc=5,lC=({primary:e,overflow:t})=>e<Rc?e:e===Rc&&t===0?Rc:Rc-1,cC=(0,A1.default)(Fi)`
1736
1736
  margin-bottom: 16px;
1737
- `;var O1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),N1=h(require("@heroicons/react/24/outline/PhoneIcon")),D1=h(require("@heroicons/react/24/outline/UserCircleIcon")),is=require("react"),U1=require("react-device-detect"),F1=h(require("styled-components"));var Zo=require("react/jsx-runtime"),I1=({...e})=>(0,Zo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,Zo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,Zo.jsx)("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"}),(0,Zo.jsx)("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"})]}),(0,Zo.jsx)("defs",{children:(0,Zo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,Zo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var M1=h(require("@heroicons/react/24/outline/ChevronRightIcon")),W1=h(require("@heroicons/react/24/outline/WalletIcon"));var la=require("react/jsx-runtime"),L1=({onClick:e,text:t})=>(0,la.jsxs)(Ne,{onClick:e,children:[(0,la.jsx)(W1.default,{}),(0,la.jsx)(Vl,{children:t}),(0,la.jsx)(M1.default,{})]});var pe=require("react/jsx-runtime"),Mc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,instagram:y,tiktok:g,linkedin:C,apple:v,wallet:x,farcaster:S,passkey:b,telegram:R}=o?.loginMethods??{},A=o?.appearance.loginGroupPriority||"web2-first",O=o?.appearance.hideDirectWeb2Inputs,[M,I]=(0,is.useState)("default"),[V,Z]=(0,is.useState)(i?"email":"sms");(0,is.useEffect)(()=>{Z(i?"email":"sms")},[i]);let ee=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{I("default")},150)};n.current=ee;let L=[i&&(0,pe.jsx)(Cc,{isEditable:V==="email",setIsEditable:()=>{Z("email")}}),a&&(0,pe.jsx)(Sc,{isEditable:V==="sms",setIsEditable:()=>{Z("sms")}})].filter(Boolean),Y=[l&&(0,pe.jsx)(Mt,{provider:"google"}),s&&(!U1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,pe.jsx)(Mt,{provider:"twitter"}),c&&(0,pe.jsx)(Mt,{provider:"discord"}),u&&(0,pe.jsx)(Mt,{provider:"github"}),f&&(0,pe.jsx)(Mt,{provider:"spotify"}),y&&(0,pe.jsx)(Mt,{provider:"instagram"}),g&&(0,pe.jsx)(Mt,{provider:"tiktok"}),C&&(0,pe.jsx)(Mt,{provider:"linkedin"}),v&&(0,pe.jsx)(Mt,{provider:"apple"}),S&&(0,pe.jsx)(wc,{}),R&&(0,pe.jsx)(xc,{})].filter(Boolean),D=Va(o.appearance.walletList,r,e,o.appearance.walletList),be=M==="default"?void 0:()=>{I("default")},ve=uC({priority:A,email:i,sms:a,social:Y}),Ce=mC({priority:A,email:i,sms:a,social:Y}),Le=fC({priority:A,email:i,sms:a,social:Y}),ce=(0,pe.jsx)(L1,{text:Le,onClick:()=>I("web3-overflow")}),Jt=(0,pe.jsx)(Ac,{text:ve,icon:Ce,onClick:()=>I("web2-overflow")}),Ct=O?0:1;return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(_,{title:o.appearance.landingHeader,onClose:ee,backFn:be}),M==="default"&&(0,pe.jsx)(pC,{}),(0,pe.jsx)(zl,{style:{overflow:"hidden",padding:2},children:(0,pe.jsxs)(io,{children:[M==="default"&&A==="web2-first"&&(0,pe.jsxs)(pe.Fragment,{children:[...L,...Y.length+L.length>4?Y.slice(0,3-L.length):Y,L.length+Y.length>4&&Jt,x&&ce]}),M==="default"&&A==="web3-first"&&(0,pe.jsxs)(pe.Fragment,{children:[x&&(0,pe.jsxs)(pe.Fragment,{children:[...D.length>4?D.slice(0,3):D,D.length>4&&ce]}),L.length+Y.length>Ct&&Jt,L.length+Y.length===Ct&&L.length?L[0]:null,L.length+Y.length===Ct&&Y.length?Y[0]:null]}),M==="web2-overflow"&&(0,pe.jsxs)(pe.Fragment,{children:[...A==="web3-first"?L:[],...Y]}),...M==="web3-overflow"?D:[],b&&M==="default"&&(0,pe.jsx)(Ec,{})]})}),o&&(0,pe.jsx)(Ni,{app:o}),(0,pe.jsx)($,{protectedByPrivy:!0})]})},pC=(0,F1.default)(Bi)`
1737
+ `;var L1=h(require("@heroicons/react/24/outline/EnvelopeIcon")),O1=h(require("@heroicons/react/24/outline/PhoneIcon")),N1=h(require("@heroicons/react/24/outline/UserCircleIcon")),is=require("react"),D1=require("react-device-detect"),U1=h(require("styled-components"));var Zo=require("react/jsx-runtime"),R1=({...e})=>(0,Zo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,Zo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,Zo.jsx)("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"}),(0,Zo.jsx)("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"})]}),(0,Zo.jsx)("defs",{children:(0,Zo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,Zo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var I1=h(require("@heroicons/react/24/outline/ChevronRightIcon")),M1=h(require("@heroicons/react/24/outline/WalletIcon"));var sa=require("react/jsx-runtime"),W1=({onClick:e,text:t})=>(0,sa.jsxs)(De,{onClick:e,children:[(0,sa.jsx)(M1.default,{}),(0,sa.jsx)(Vl,{children:t}),(0,sa.jsx)(I1.default,{})]});var pe=require("react/jsx-runtime"),Mc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=k(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,instagram:y,tiktok:g,linkedin:C,apple:v,wallet:x,farcaster:S,passkey:b,telegram:R}=o?.loginMethods??{},A=o?.appearance.loginGroupPriority||"web2-first",O=o?.appearance.hideDirectWeb2Inputs,[M,I]=(0,is.useState)("default"),[V,Y]=(0,is.useState)(i?"email":"sms");(0,is.useEffect)(()=>{Y(i?"email":"sms")},[i]);let ee=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{I("default")},150)};n.current=ee;let L=[i&&(0,pe.jsx)(Cc,{isEditable:V==="email",setIsEditable:()=>{Y("email")}}),a&&(0,pe.jsx)(Sc,{isEditable:V==="sms",setIsEditable:()=>{Y("sms")}})].filter(Boolean),j=[l&&(0,pe.jsx)(Mt,{provider:"google"}),s&&(!D1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,pe.jsx)(Mt,{provider:"twitter"}),c&&(0,pe.jsx)(Mt,{provider:"discord"}),u&&(0,pe.jsx)(Mt,{provider:"github"}),f&&(0,pe.jsx)(Mt,{provider:"spotify"}),y&&(0,pe.jsx)(Mt,{provider:"instagram"}),g&&(0,pe.jsx)(Mt,{provider:"tiktok"}),C&&(0,pe.jsx)(Mt,{provider:"linkedin"}),v&&(0,pe.jsx)(Mt,{provider:"apple"}),S&&(0,pe.jsx)(wc,{}),R&&(0,pe.jsx)(xc,{})].filter(Boolean),D=Va(o.appearance.walletList,r,e,o.appearance.walletList),be=M==="default"?void 0:()=>{I("default")},ve=pC({priority:A,email:i,sms:a,social:j}),Ce=uC({priority:A,email:i,sms:a,social:j}),Oe=mC({priority:A,email:i,sms:a,social:j}),ce=(0,pe.jsx)(W1,{text:Oe,onClick:()=>I("web3-overflow")}),Zt=(0,pe.jsx)(Ac,{text:ve,icon:Ce,onClick:()=>I("web2-overflow")}),wt=O?0:1;return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(_,{title:o.appearance.landingHeader,onClose:ee,backFn:be}),M==="default"&&(0,pe.jsx)(dC,{}),(0,pe.jsx)(zl,{style:{overflow:"hidden",padding:2},children:(0,pe.jsxs)(io,{children:[M==="default"&&A==="web2-first"&&(0,pe.jsxs)(pe.Fragment,{children:[...L,...j.length+L.length>4?j.slice(0,3-L.length):j,L.length+j.length>4&&Zt,x&&ce]}),M==="default"&&A==="web3-first"&&(0,pe.jsxs)(pe.Fragment,{children:[x&&(0,pe.jsxs)(pe.Fragment,{children:[...D.length>4?D.slice(0,3):D,D.length>4&&ce]}),L.length+j.length>wt&&Zt,L.length+j.length===wt&&L.length?L[0]:null,L.length+j.length===wt&&j.length?j[0]:null]}),M==="web2-overflow"&&(0,pe.jsxs)(pe.Fragment,{children:[...A==="web3-first"?L:[],...j]}),...M==="web3-overflow"?D:[],b&&M==="default"&&(0,pe.jsx)(Ec,{})]})}),o&&(0,pe.jsx)(Oi,{app:o}),(0,pe.jsx)(q,{protectedByPrivy:!0})]})},dC=(0,U1.default)(Fi)`
1738
1738
  margin-bottom: 16px;
1739
- `,uC=({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",mC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,pe.jsx)(D1.default,{}):t&&r?(0,pe.jsx)(I1,{}):t?(0,pe.jsx)(O1.default,{}):r?(0,pe.jsx)(N1.default,{}):null,fC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var pp=require("react/jsx-runtime"),B1=()=>{let{app:e}=k();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,pp.jsx)(Ic,{connectOnly:!0}):(0,pp.jsx)(Mc,{connectOnly:!0})};var up=require("react/jsx-runtime"),H1=()=>{let{app:e}=k();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,up.jsx)(Ic,{connectOnly:!1}):(0,up.jsx)(Mc,{connectOnly:!1})};var G1=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var Mr=require("react/jsx-runtime"),V1=()=>{let{app:e}=k();return(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)(_,{},"header"),(0,Mr.jsx)(se,{}),(0,Mr.jsx)(Be,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Mr.jsx)(G1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Mr.jsx)(Vr,{children:(0,Mr.jsx)(vc,{stacked:!0})}),(0,Mr.jsx)(me,{}),(0,Mr.jsx)($,{protectedByPrivy:!0})]})};var $1=h(require("@heroicons/react/24/outline/ClockIcon")),K1=h(require("@heroicons/react/24/outline/TrashIcon")),j1=h(require("@heroicons/react/24/solid/CheckBadgeIcon")),Y1=h(require("@heroicons/react/24/solid/CheckCircleIcon")),Z1=h(require("@heroicons/react/24/solid/LockClosedIcon")),xn=require("react"),jt=h(require("styled-components"));var mp=require("react/jsx-runtime"),ei=({style:e,...t})=>(0,mp.jsx)("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:(0,mp.jsx)("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"})});var Ie=require("react/jsx-runtime"),ti=({style:e,...t})=>(0,Ie.jsxs)("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:[(0,Ie.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"}),(0,Ie.jsx)("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"})]}),(0,Ie.jsx)("defs",{children:(0,Ie.jsx)("clipPath",{id:"clip0_113_33841",children:(0,Ie.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var K=require("react/jsx-runtime"),z1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=(0,xn.useState)([]),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(0,K.jsxs)("div",{children:[(0,K.jsx)(bC,{children:"Your passkeys"}),(0,K.jsxs)(Q1,{children:[e.slice(0,a).map(c=>(0,K.jsxs)(TC,{children:[(0,K.jsxs)("div",{children:[(0,K.jsx)(EC,{children:l(c)}),(0,K.jsxs)(PC,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),(0,K.jsx)(_C,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?(0,K.jsx)(Vo,{}):(0,K.jsx)(K1.default,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&(0,K.jsx)(vC,{onClick:o,children:"View all"})]})]})},hC=()=>(0,K.jsxs)(Q1,{children:[(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)(j1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)(Z1.default,{})}),"More secure than a password."]}),(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)($1.default,{})}),"Takes seconds to set up and use."]})]}),J1=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=W(),n=e?.linkedAccounts.filter(v=>v.type==="passkey"),[i,a]=(0,xn.useState)(!1),[l,s]=(0,xn.useState)(""),[c,u]=(0,xn.useState)(!1),[f,y]=(0,xn.useState)(!1);(0,xn.useEffect)(()=>{n.length===0&&y(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(v=>{if(v instanceof ct){if(v.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(v.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},C=async v=>(a(!0),await t(v).then(()=>u(!0)).catch(x=>{if(x instanceof ct&&x.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{onClose:()=>o()},"header"),(0,K.jsx)(Fe,{children:(0,K.jsx)(et,{status:"success",children:(0,K.jsx)(Y1.default,{})})}),(0,K.jsx)(q1,{children:"Passkey added"}),(0,K.jsx)(CC,{children:"From now on, you can use your passkey to log in."}),(0,K.jsx)(qt,{children:(0,K.jsx)(N,{onClick:()=>o(),children:"Done"})}),(0,K.jsx)(z,{})]}):f?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{backFn:()=>y(!1),onClose:()=>o()},"header"),(0,K.jsx)(z1,{passkeys:n,expanded:f,onUnlink:C,onExpand:()=>y(!0)}),(0,K.jsx)(z,{})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{onClose:()=>o()},"header"),(0,K.jsx)(Fe,{children:(0,K.jsxs)(Wc,{children:[(0,K.jsx)(ei,{}),(0,K.jsx)(ti,{})]})}),(0,K.jsx)(q1,{children:"Secure your account with a passkey"}),(0,K.jsx)(wC,{}),n.length===0?(0,K.jsx)(hC,{}):(0,K.jsx)(z1,{passkeys:n,expanded:f,onUnlink:C,onExpand:()=>y(!0)}),(0,K.jsxs)(qt,{style:{marginTop:"12px"},children:[l&&(0,K.jsx)(yC,{fail:!0,children:l}),(0,K.jsx)(N,{onClick:g,loading:i,children:"Add new passkey"})]}),(0,K.jsx)(z,{})]})},Wc=jt.default.div`
1739
+ `,pC=({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",uC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,pe.jsx)(N1.default,{}):t&&r?(0,pe.jsx)(R1,{}):t?(0,pe.jsx)(L1.default,{}):r?(0,pe.jsx)(O1.default,{}):null,mC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var dp=require("react/jsx-runtime"),F1=()=>{let{app:e}=k();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,dp.jsx)(Ic,{connectOnly:!0}):(0,dp.jsx)(Mc,{connectOnly:!0})};var pp=require("react/jsx-runtime"),B1=()=>{let{app:e}=k();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,pp.jsx)(Ic,{connectOnly:!1}):(0,pp.jsx)(Mc,{connectOnly:!1})};var H1=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var Mr=require("react/jsx-runtime"),G1=()=>{let{app:e}=k();return(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)(_,{},"header"),(0,Mr.jsx)(se,{}),(0,Mr.jsx)(He,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Mr.jsx)(H1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Mr.jsx)(Vr,{children:(0,Mr.jsx)(vc,{stacked:!0})}),(0,Mr.jsx)(me,{}),(0,Mr.jsx)(q,{protectedByPrivy:!0})]})};var q1=h(require("@heroicons/react/24/outline/ClockIcon")),$1=h(require("@heroicons/react/24/outline/TrashIcon")),K1=h(require("@heroicons/react/24/solid/CheckBadgeIcon")),j1=h(require("@heroicons/react/24/solid/CheckCircleIcon")),Y1=h(require("@heroicons/react/24/solid/LockClosedIcon")),_n=require("react"),Kt=h(require("styled-components"));var up=require("react/jsx-runtime"),Xn=({style:e,...t})=>(0,up.jsx)("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:(0,up.jsx)("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"})});var Me=require("react/jsx-runtime"),ei=({style:e,...t})=>(0,Me.jsxs)("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:[(0,Me.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"}),(0,Me.jsx)("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"})]}),(0,Me.jsx)("defs",{children:(0,Me.jsx)("clipPath",{id:"clip0_113_33841",children:(0,Me.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var $=require("react/jsx-runtime"),V1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=(0,_n.useState)([]),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(0,$.jsxs)("div",{children:[(0,$.jsx)(wC,{children:"Your passkeys"}),(0,$.jsxs)(J1,{children:[e.slice(0,a).map(c=>(0,$.jsxs)(PC,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)(bC,{children:l(c)}),(0,$.jsxs)(EC,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),(0,$.jsx)(SC,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?(0,$.jsx)(Vo,{}):(0,$.jsx)($1.default,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&(0,$.jsx)(gC,{onClick:o,children:"View all"})]})]})},fC=()=>(0,$.jsxs)(J1,{children:[(0,$.jsxs)(mr,{children:[(0,$.jsx)(ur,{children:(0,$.jsx)(K1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,$.jsxs)(mr,{children:[(0,$.jsx)(ur,{children:(0,$.jsx)(Y1.default,{})}),"More secure than a password."]}),(0,$.jsxs)(mr,{children:[(0,$.jsx)(ur,{children:(0,$.jsx)(q1.default,{})}),"Takes seconds to set up and use."]})]}),Z1=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=W(),n=e?.linkedAccounts.filter(v=>v.type==="passkey"),[i,a]=(0,_n.useState)(!1),[l,s]=(0,_n.useState)(""),[c,u]=(0,_n.useState)(!1),[f,y]=(0,_n.useState)(!1);(0,_n.useEffect)(()=>{n.length===0&&y(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(v=>{if(v instanceof dt){if(v.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(v.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},C=async v=>(a(!0),await t(v).then(()=>u(!0)).catch(x=>{if(x instanceof dt&&x.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{onClose:()=>o()},"header"),(0,$.jsx)(Be,{children:(0,$.jsx)(et,{status:"success",children:(0,$.jsx)(j1.default,{})})}),(0,$.jsx)(z1,{children:"Passkey added"}),(0,$.jsx)(vC,{children:"From now on, you can use your passkey to log in."}),(0,$.jsx)(zt,{children:(0,$.jsx)(N,{onClick:()=>o(),children:"Done"})}),(0,$.jsx)(z,{})]}):f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{backFn:()=>y(!1),onClose:()=>o()},"header"),(0,$.jsx)(V1,{passkeys:n,expanded:f,onUnlink:C,onExpand:()=>y(!0)}),(0,$.jsx)(z,{})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_,{onClose:()=>o()},"header"),(0,$.jsx)(Be,{children:(0,$.jsxs)(Wc,{children:[(0,$.jsx)(Xn,{}),(0,$.jsx)(ei,{})]})}),(0,$.jsx)(z1,{children:"Secure your account with a passkey"}),(0,$.jsx)(CC,{}),n.length===0?(0,$.jsx)(fC,{}):(0,$.jsx)(V1,{passkeys:n,expanded:f,onUnlink:C,onExpand:()=>y(!0)}),(0,$.jsxs)(zt,{style:{marginTop:"12px"},children:[l&&(0,$.jsx)(hC,{fail:!0,children:l}),(0,$.jsx)(N,{onClick:g,loading:i,children:"Add new passkey"})]}),(0,$.jsx)(z,{})]})},Wc=Kt.default.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
- `,yC=jt.default.div`
1755
+ `,hC=Kt.default.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
- `,gC=jt.css`
1763
+ `,yC=Kt.css`
1764
1764
  && {
1765
1765
  width: 100%;
1766
1766
  font-size: 0.875rem;
@@ -1785,9 +1785,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1785
1785
  box-shadow: none;
1786
1786
  }
1787
1787
  }
1788
- `,vC=jt.default.button`
1789
- ${gC}
1790
- `,Q1=jt.default.div`
1788
+ `,gC=Kt.default.button`
1789
+ ${yC}
1790
+ `,J1=Kt.default.div`
1791
1791
  display: flex;
1792
1792
  flex-direction: column;
1793
1793
  align-items: stretch;
@@ -1795,18 +1795,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1795
1795
  padding: 0.5rem 0rem 0rem;
1796
1796
  flex-grow: 1;
1797
1797
  width: 100%;
1798
- `,q1=jt.default.div`
1798
+ `,z1=Kt.default.div`
1799
1799
  font-size: 18px;
1800
1800
  line-height: 18px;
1801
1801
  text-align: center;
1802
1802
  font-weight: 600;
1803
- `,CC=jt.default.div`
1803
+ `,vC=Kt.default.div`
1804
1804
  font-size: 0.875rem;
1805
1805
  text-align: center;
1806
1806
  margin-top: 10px;
1807
- `,wC=jt.default.div`
1807
+ `,CC=Kt.default.div`
1808
1808
  height: 32px;
1809
- `,bC=jt.default.div`
1809
+ `,wC=Kt.default.div`
1810
1810
  line-height: 20px;
1811
1811
  height: 20px;
1812
1812
  font-size: 1em;
@@ -1814,18 +1814,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1814
1814
  display: flex;
1815
1815
  justify-content: flex-beginning;
1816
1816
  width: 100%;
1817
- `,EC=jt.default.div`
1817
+ `,bC=Kt.default.div`
1818
1818
  font-size: 1em;
1819
1819
  line-height: 1.3em;
1820
1820
  font-weight: 500;
1821
1821
  color: var(--privy-color-foreground-2);
1822
1822
  padding: 0.2em 0;
1823
- `,PC=jt.default.div`
1823
+ `,EC=Kt.default.div`
1824
1824
  font-size: 0.875rem;
1825
1825
  line-height: 1rem;
1826
1826
  color: #64668b;
1827
1827
  padding: 0.2em 0;
1828
- `,TC=jt.default.div`
1828
+ `,PC=Kt.default.div`
1829
1829
  display: flex;
1830
1830
  align-items: center;
1831
1831
  justify-content: space-between;
@@ -1838,7 +1838,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1838
1838
  border: 1px solid #e2e3f0 !important;
1839
1839
  width: 100%;
1840
1840
  height: 5em;
1841
- `,SC=jt.css`
1841
+ `,TC=Kt.css`
1842
1842
  :focus,
1843
1843
  :hover,
1844
1844
  :active {
@@ -1855,9 +1855,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1855
1855
  svg:hover {
1856
1856
  color: var(--privy-color-foreground-3);
1857
1857
  }
1858
- `,_C=jt.default.button`
1859
- ${SC}
1860
- `;var X1=h(require("@heroicons/react/24/outline/PhoneIcon"));var Wr=require("react/jsx-runtime"),eg=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=k(),{initLoginWithSms:i}=W();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(0,Wr.jsxs)(Wr.Fragment,{children:[(0,Wr.jsx)(_,{},"header"),(0,Wr.jsx)(se,{}),(0,Wr.jsx)(Be,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Wr.jsx)(X1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Wr.jsx)(Vr,{children:(0,Wr.jsx)(sa,{stacked:!0,onSubmit:a})}),(0,Wr.jsx)(me,{}),(0,Wr.jsx)($,{protectedByPrivy:!0})]})};var Io=require("react/jsx-runtime"),tg=()=>{let{linkingHint:e}=W(),{app:t}=k(),r=e?`Select the wallet with ${cn(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,Io.jsxs)(Io.Fragment,{children:[(0,Io.jsx)(_,{},"header"),(0,Io.jsx)(So,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,Io.jsx)(io,{children:(0,Io.jsx)(Fi,{connectOnly:!1})}),(0,Io.jsx)($,{protectedByPrivy:!0})]})};var as=require("react/jsx-runtime"),rg=({style:e,...t})=>(0,as.jsxs)("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:[(0,as.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,as.jsx)("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"})]});var gr=require("react/jsx-runtime"),og=()=>{let{closePrivyModal:e}=W(),{navigate:t}=k();return(0,gr.jsxs)(gr.Fragment,{children:[(0,gr.jsx)(_,{},"header"),(0,gr.jsx)(se,{}),(0,gr.jsx)(rg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,gr.jsx)(So,{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"}}),(0,gr.jsxs)(Vr,{children:[(0,gr.jsx)(N,{onClick:()=>t("LANDING"),children:"Try again"}),(0,gr.jsx)(no,{onClick:()=>e(),children:"Cancel"})]}),(0,gr.jsx)(me,{}),(0,gr.jsx)($,{protectedByPrivy:!0})]})};var Mg=h(require("@heroicons/react/24/solid/CheckBadgeIcon")),Wg=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Lg=h(require("@heroicons/react/24/solid/IdentificationIcon")),Og=h(require("@heroicons/react/24/solid/PhoneIcon")),Ng=h(require("@heroicons/react/24/solid/QuestionMarkCircleIcon")),vp=h(require("@heroicons/react/24/solid/ShieldCheckIcon")),Qo=require("react");var ng=require("react");function ca(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,ng.useContext)(Ae);return{promptMfa:e,init:t,submit:r,cancel:o}}var ig=require("react");function Yr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=(0,ig.useContext)(Ae);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)}}var ag=h(require("styled-components")),ss=require("react/jsx-runtime"),sg=e=>(0,ss.jsxs)(xC,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,ss.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,ss.jsx)("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"})]}),xC=ag.default.svg`
1858
+ `,SC=Kt.default.button`
1859
+ ${TC}
1860
+ `;var Q1=h(require("@heroicons/react/24/outline/PhoneIcon"));var Wr=require("react/jsx-runtime"),X1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=k(),{initLoginWithSms:i}=W();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(0,Wr.jsxs)(Wr.Fragment,{children:[(0,Wr.jsx)(_,{},"header"),(0,Wr.jsx)(se,{}),(0,Wr.jsx)(He,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Wr.jsx)(Q1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Wr.jsx)(Vr,{children:(0,Wr.jsx)(aa,{stacked:!0,onSubmit:a})}),(0,Wr.jsx)(me,{}),(0,Wr.jsx)(q,{protectedByPrivy:!0})]})};var Io=require("react/jsx-runtime"),eg=()=>{let{linkingHint:e}=W(),{app:t}=k(),r=e?`Select the wallet with ${cn(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,Io.jsxs)(Io.Fragment,{children:[(0,Io.jsx)(_,{},"header"),(0,Io.jsx)(So,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,Io.jsx)(io,{children:(0,Io.jsx)(Ui,{connectOnly:!1})}),(0,Io.jsx)(q,{protectedByPrivy:!0})]})};var as=require("react/jsx-runtime"),tg=({style:e,...t})=>(0,as.jsxs)("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:[(0,as.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,as.jsx)("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"})]});var gr=require("react/jsx-runtime"),rg=()=>{let{closePrivyModal:e}=W(),{navigate:t}=k();return(0,gr.jsxs)(gr.Fragment,{children:[(0,gr.jsx)(_,{},"header"),(0,gr.jsx)(se,{}),(0,gr.jsx)(tg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,gr.jsx)(So,{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"}}),(0,gr.jsxs)(Vr,{children:[(0,gr.jsx)(N,{onClick:()=>t("LANDING"),children:"Try again"}),(0,gr.jsx)(no,{onClick:()=>e(),children:"Cancel"})]}),(0,gr.jsx)(me,{}),(0,gr.jsx)(q,{protectedByPrivy:!0})]})};var Ig=h(require("@heroicons/react/24/solid/CheckBadgeIcon")),Mg=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Wg=h(require("@heroicons/react/24/solid/IdentificationIcon")),Lg=h(require("@heroicons/react/24/solid/PhoneIcon")),Og=h(require("@heroicons/react/24/solid/QuestionMarkCircleIcon")),gp=h(require("@heroicons/react/24/solid/ShieldCheckIcon")),Qo=require("react");var og=require("react");function la(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,og.useContext)(Re);return{promptMfa:e,init:t,submit:r,cancel:o}}var ng=require("react");function Yr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=(0,ng.useContext)(Re);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)}}var ig=h(require("styled-components")),ss=require("react/jsx-runtime"),ag=e=>(0,ss.jsxs)(_C,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,ss.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,ss.jsx)("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"})]}),_C=ig.default.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
- `;var Lc=h(require("@heroicons/react/20/solid/CheckIcon")),lg=h(require("@heroicons/react/24/outline/ChevronRightIcon")),cg=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),dg=h(require("@heroicons/react/24/outline/FingerPrintIcon")),pg=h(require("@heroicons/react/24/outline/PhoneIcon")),Oc=h(require("@heroicons/react/24/outline/TrashIcon")),ug=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var te=require("react/jsx-runtime"),mg=({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((g,C)=>({...g,[C]:!0}),{}),y=r.reduce((g,C)=>({...g,[C]:!0}),{});return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(_,{backFn:e?s:void 0,onClose:l},"header"),(0,te.jsx)(Fe,{children:(0,te.jsx)(et,{children:(0,te.jsx)(ug.default,{})})}),(0,te.jsx)(ye,{children:"Choose a verification method"}),t.length>0?(0,te.jsx)(ge,{children:"To add or delete verification methods, verification is required."}):(0,te.jsx)(ge,{children:"How would you like to verify your identity? You can change this later."}),a&&(0,te.jsx)(Zl,{style:{marginTop:"1.25rem"},children:a.message}),(0,te.jsxs)(ql,{children:[(y.totp||f.totp)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(Ne,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?(0,te.jsx)(_t,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(cg.default,{}),"Authenticator App"]}),f.totp?(0,te.jsxs)(Zn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}):(0,te.jsx)(Zn,{children:"Recommended"})]})}),f.totp&&(0,te.jsx)(Kl,{onClick:()=>u("totp"),children:(0,te.jsx)(Oc.default,{})})]},"totp"),(y.sms||f.sms)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(Ne,{disabled:f.sms||o,onClick:()=>c("sms"),children:(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(pg.default,{}),"SMS"]}),f.sms&&(0,te.jsxs)(Zn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}),o&&(0,te.jsx)(Zn,{children:"Disabled"})]})}),f.sms&&(0,te.jsx)(Kl,{onClick:()=>u("sms"),children:(0,te.jsx)(Oc.default,{})})]},"sms"),(y.passkey||f.passkey)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(Ne,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?(0,te.jsx)(_t,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(dg.default,{}),"Passkey"]}),f.passkey?(0,te.jsxs)(Zn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}):(0,te.jsx)(Zn,{isAccent:!0,children:(0,te.jsx)(lg.default,{})})]})}),f.passkey&&(0,te.jsx)(Kl,{onClick:()=>u("passkey"),children:(0,te.jsx)(Oc.default,{})})]},"passkey")]}),(0,te.jsx)(z,{})]})};var hg=h(require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon")),yg=h(require("@heroicons/react/24/outline/ClockIcon")),gg=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),vg=h(require("@heroicons/react/24/solid/CheckCircleIcon")),kn=require("react"),ls=h(require("styled-components"));var j=require("react/jsx-runtime"),Cg=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=H(),{data:n}=k(),{initLinkWithPasskey:i,linkWithPasskey:a}=W(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Yr(),[c,u]=(0,kn.useState)(!1),[f,y]=(0,kn.useState)(!1),[g,C]=(0,kn.useState)(!1),[v,x]=(0,kn.useState)(null),S=(0,kn.useMemo)(()=>o?.linkedAccounts.filter(O=>O.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},R=async O=>{u(!0);try{await l(),await s({credentialIds:O}),C(!0)}catch(M){x(M)}finally{u(!1)}},A=async()=>{y(!0),x(null);try{await i();let M=(await a())?.linkedAccounts.filter(I=>I.type==="passkey").map(I=>I.credentialId)??[];await R(M)}catch(O){x(O)}finally{y(!1)}};return S.length===0||f?(0,j.jsx)(kC,{onReset:r,onClose:t,onClick:A,isCreating:f}):g?(0,j.jsx)(RC,{onClick:b,onClose:b}):v?(0,j.jsx)(Ja,{error:v,backFn:()=>x(null),onClick:()=>x(null)}):(0,j.jsx)(AC,{passkeys:S,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>R(S.map(O=>O.credentialId)),onAddPasskey:A})},kC=({onReset:e,onClose:t,onClick:r,isCreating:o})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{backFn:e,onClose:t},"header"),(0,j.jsx)(Fe,{children:(0,j.jsxs)(Wc,{children:[(0,j.jsx)(ei,{}),(0,j.jsx)(ti,{})]})}),(0,j.jsx)(ye,{children:"Set up paskey verification"}),(0,j.jsxs)(Yn,{children:[(0,j.jsxs)(mr,{children:[(0,j.jsx)(ur,{children:(0,j.jsx)(gg.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),(0,j.jsxs)(mr,{children:[(0,j.jsx)(ur,{children:(0,j.jsx)(yg.default,{})}),"Takes seconds to set up and use"]}),(0,j.jsxs)(mr,{children:[(0,j.jsx)(ur,{children:(0,j.jsx)(hg.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),(0,j.jsx)(N,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),(0,j.jsx)(z,{})]}),AC=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=(0,kn.useState)(!1),c=l?n.length:n.length>3?2:3;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&(0,j.jsx)(Fe,{children:(0,j.jsxs)(Wc,{children:[(0,j.jsx)(ei,{}),(0,j.jsx)(ti,{})]})}),(0,j.jsx)(ye,{children:"Enable your passkeys for verification"}),(0,j.jsxs)(Yn,{children:[n.slice(0,c).map(u=>(0,j.jsxs)(IC,{children:[(0,j.jsx)(MC,{children:LC(u)}),(0,j.jsxs)(WC,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&(0,j.jsx)(fg,{onClick:()=>s(!0),children:"View All"})]}),(0,j.jsx)(N,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&(0,j.jsx)(fg,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?(0,j.jsx)(_t,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),(0,j.jsx)(z,{})]})},RC=({onClick:e,onClose:t})=>(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{onClose:t},"header"),(0,j.jsx)(Fe,{children:(0,j.jsx)(et,{status:"success",children:(0,j.jsx)(vg.default,{})})}),(0,j.jsx)(ye,{children:"Passkey verification added"}),(0,j.jsx)(ge,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),(0,j.jsx)(qt,{children:(0,j.jsx)(N,{onClick:e,children:"Done"})}),(0,j.jsx)(z,{})]}),IC=ls.default.div`
1871
+ `;var Lc=h(require("@heroicons/react/20/solid/CheckIcon")),sg=h(require("@heroicons/react/24/outline/ChevronRightIcon")),lg=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),cg=h(require("@heroicons/react/24/outline/FingerPrintIcon")),dg=h(require("@heroicons/react/24/outline/PhoneIcon")),Oc=h(require("@heroicons/react/24/outline/TrashIcon")),pg=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var te=require("react/jsx-runtime"),ug=({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((g,C)=>({...g,[C]:!0}),{}),y=r.reduce((g,C)=>({...g,[C]:!0}),{});return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(_,{backFn:e?s:void 0,onClose:l},"header"),(0,te.jsx)(Be,{children:(0,te.jsx)(et,{children:(0,te.jsx)(pg.default,{})})}),(0,te.jsx)(ye,{children:"Choose a verification method"}),t.length>0?(0,te.jsx)(ge,{children:"To add or delete verification methods, verification is required."}):(0,te.jsx)(ge,{children:"How would you like to verify your identity? You can change this later."}),a&&(0,te.jsx)(Zl,{style:{marginTop:"1.25rem"},children:a.message}),(0,te.jsxs)(ql,{children:[(y.totp||f.totp)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(De,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?(0,te.jsx)(_t,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(lg.default,{}),"Authenticator App"]}),f.totp?(0,te.jsxs)(Yn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}):(0,te.jsx)(Yn,{children:"Recommended"})]})}),f.totp&&(0,te.jsx)(Kl,{onClick:()=>u("totp"),children:(0,te.jsx)(Oc.default,{})})]},"totp"),(y.sms||f.sms)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(De,{disabled:f.sms||o,onClick:()=>c("sms"),children:(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(dg.default,{}),"SMS"]}),f.sms&&(0,te.jsxs)(Yn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}),o&&(0,te.jsx)(Yn,{children:"Disabled"})]})}),f.sms&&(0,te.jsx)(Kl,{onClick:()=>u("sms"),children:(0,te.jsx)(Oc.default,{})})]},"sms"),(y.passkey||f.passkey)&&(0,te.jsxs)($l,{children:[(0,te.jsx)(De,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?(0,te.jsx)(_t,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,te.jsxs)(Yl,{children:[(0,te.jsxs)(jl,{children:[(0,te.jsx)(cg.default,{}),"Passkey"]}),f.passkey?(0,te.jsxs)(Yn,{children:[(0,te.jsx)(Lc.default,{}),"Added"]}):(0,te.jsx)(Yn,{isAccent:!0,children:(0,te.jsx)(sg.default,{})})]})}),f.passkey&&(0,te.jsx)(Kl,{onClick:()=>u("passkey"),children:(0,te.jsx)(Oc.default,{})})]},"passkey")]}),(0,te.jsx)(z,{})]})};var fg=h(require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon")),hg=h(require("@heroicons/react/24/outline/ClockIcon")),yg=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),gg=h(require("@heroicons/react/24/solid/CheckCircleIcon")),xn=require("react"),ls=h(require("styled-components"));var K=require("react/jsx-runtime"),vg=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=H(),{data:n}=k(),{initLinkWithPasskey:i,linkWithPasskey:a}=W(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Yr(),[c,u]=(0,xn.useState)(!1),[f,y]=(0,xn.useState)(!1),[g,C]=(0,xn.useState)(!1),[v,x]=(0,xn.useState)(null),S=(0,xn.useMemo)(()=>o?.linkedAccounts.filter(O=>O.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},R=async O=>{u(!0);try{await l(),await s({credentialIds:O}),C(!0)}catch(M){x(M)}finally{u(!1)}},A=async()=>{y(!0),x(null);try{await i();let M=(await a())?.linkedAccounts.filter(I=>I.type==="passkey").map(I=>I.credentialId)??[];await R(M)}catch(O){x(O)}finally{y(!1)}};return S.length===0||f?(0,K.jsx)(xC,{onReset:r,onClose:t,onClick:A,isCreating:f}):g?(0,K.jsx)(AC,{onClick:b,onClose:b}):v?(0,K.jsx)(Ja,{error:v,backFn:()=>x(null),onClick:()=>x(null)}):(0,K.jsx)(kC,{passkeys:S,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>R(S.map(O=>O.credentialId)),onAddPasskey:A})},xC=({onReset:e,onClose:t,onClick:r,isCreating:o})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{backFn:e,onClose:t},"header"),(0,K.jsx)(Be,{children:(0,K.jsxs)(Wc,{children:[(0,K.jsx)(Xn,{}),(0,K.jsx)(ei,{})]})}),(0,K.jsx)(ye,{children:"Set up paskey verification"}),(0,K.jsxs)(jn,{children:[(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)(yg.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)(hg.default,{})}),"Takes seconds to set up and use"]}),(0,K.jsxs)(mr,{children:[(0,K.jsx)(ur,{children:(0,K.jsx)(fg.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),(0,K.jsx)(N,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),(0,K.jsx)(z,{})]}),kC=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=(0,xn.useState)(!1),c=l?n.length:n.length>3?2:3;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&(0,K.jsx)(Be,{children:(0,K.jsxs)(Wc,{children:[(0,K.jsx)(Xn,{}),(0,K.jsx)(ei,{})]})}),(0,K.jsx)(ye,{children:"Enable your passkeys for verification"}),(0,K.jsxs)(jn,{children:[n.slice(0,c).map(u=>(0,K.jsxs)(RC,{children:[(0,K.jsx)(IC,{children:WC(u)}),(0,K.jsxs)(MC,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&(0,K.jsx)(mg,{onClick:()=>s(!0),children:"View All"})]}),(0,K.jsx)(N,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&(0,K.jsx)(mg,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?(0,K.jsx)(_t,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),(0,K.jsx)(z,{})]})},AC=({onClick:e,onClose:t})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_,{onClose:t},"header"),(0,K.jsx)(Be,{children:(0,K.jsx)(et,{status:"success",children:(0,K.jsx)(gg.default,{})})}),(0,K.jsx)(ye,{children:"Passkey verification added"}),(0,K.jsx)(ge,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),(0,K.jsx)(zt,{children:(0,K.jsx)(N,{onClick:e,children:"Done"})}),(0,K.jsx)(z,{})]}),RC=ls.default.div`
1872
1872
  && {
1873
1873
  padding: 0.75rem 1rem;
1874
1874
  text-align: left;
@@ -1876,19 +1876,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1876
1876
  border: 1px solid var(--privy-color-foreground-4);
1877
1877
  width: 100%;
1878
1878
  }
1879
- `,MC=ls.default.div`
1879
+ `,IC=ls.default.div`
1880
1880
  font-size: 0.875rem;
1881
1881
  line-height: 1.375rem;
1882
1882
  font-weight: 500;
1883
1883
 
1884
1884
  color: var(--privy-color-foreground-1);
1885
- `,WC=ls.default.div`
1885
+ `,MC=ls.default.div`
1886
1886
  font-size: 0.75rem;
1887
1887
  font-weight: 400;
1888
1888
  line-height: 1.125rem;
1889
1889
 
1890
1890
  color: var(--privy-color-foreground-2);
1891
- `,LC=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",fg=ls.default.button`
1891
+ `,WC=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",mg=ls.default.button`
1892
1892
  && {
1893
1893
  width: 100%;
1894
1894
  font-size: 0.875rem;
@@ -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
- `;var Tg=h(require("@heroicons/react/24/solid/CheckCircleIcon")),yp=h(require("@heroicons/react/24/solid/PhoneIcon")),ds=require("react");var Dc=require("react"),Pg=require("react-device-detect"),hp=h(require("styled-components"));var ri=require("@headlessui/react"),Nc=h(require("react")),oi=h(require("styled-components")),Jo=require("react/jsx-runtime"),wg=({children:e,open:t,onClick:r,...o})=>(0,Jo.jsx)(ri.Transition,{show:t,as:Nc.default.Fragment,children:(0,Jo.jsxs)(ri.Dialog,{onClose:r,...o,as:NC,children:[(0,Jo.jsx)(ri.Transition.Child,{as:Nc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Jo.jsx)(OC,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,Jo.jsx)(DC,{children:(0,Jo.jsx)(ri.Transition.Child,{as:Nc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Jo.jsx)(ri.Dialog.Panel,{as:UC,children:e})})})]})}),da=oi.default.div`
1916
+ `;var Pg=h(require("@heroicons/react/24/solid/CheckCircleIcon")),hp=h(require("@heroicons/react/24/solid/PhoneIcon")),ds=require("react");var Dc=require("react"),Eg=require("react-device-detect"),fp=h(require("styled-components"));var ti=require("@headlessui/react"),Nc=h(require("react")),ri=h(require("styled-components")),Jo=require("react/jsx-runtime"),Cg=({children:e,open:t,onClick:r,...o})=>(0,Jo.jsx)(ti.Transition,{show:t,as:Nc.default.Fragment,children:(0,Jo.jsxs)(ti.Dialog,{onClose:r,...o,as:OC,children:[(0,Jo.jsx)(ti.Transition.Child,{as:Nc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Jo.jsx)(LC,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,Jo.jsx)(NC,{children:(0,Jo.jsx)(ti.Transition.Child,{as:Nc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Jo.jsx)(ti.Dialog.Panel,{as:DC,children:e})})})]})}),ca=ri.default.div`
1917
1917
  display: flex;
1918
1918
  flex-direction: column;
1919
1919
  text-align: center;
@@ -1936,7 +1936,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1936
1936
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1937
1937
  border-radius: var(--privy-border-radius-lg);
1938
1938
  }
1939
- `,OC=oi.default.div`
1939
+ `,LC=ri.default.div`
1940
1940
  position: fixed;
1941
1941
  inset: 0;
1942
1942
 
@@ -1949,10 +1949,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
1949
1949
  backdrop-filter: unset;
1950
1950
  -webkit-backdrop-filter: unset;
1951
1951
  }
1952
- `,NC=oi.default.div`
1952
+ `,OC=ri.default.div`
1953
1953
  position: relative;
1954
1954
  z-index: 999999;
1955
- `,DC=oi.default.div`
1955
+ `,NC=ri.default.div`
1956
1956
  position: fixed;
1957
1957
  inset: 0;
1958
1958
  display: flex;
@@ -1960,7 +1960,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1960
1960
  justify-content: center;
1961
1961
  width: 100vw;
1962
1962
  min-height: 100vh;
1963
- `,UC=oi.default.div`
1963
+ `,DC=ri.default.div`
1964
1964
  // reset some default dialog styles
1965
1965
  padding: 0;
1966
1966
  background: transparent;
@@ -2007,19 +2007,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
2007
2007
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
2008
2008
  border-radius: var(--privy-border-radius-lg);
2009
2009
  }
2010
- `,bg=oi.default.div`
2010
+ `,wg=ri.default.div`
2011
2011
  display: flex;
2012
2012
  flex-direction: column;
2013
2013
  align-items: center;
2014
2014
  justify-content: center;
2015
2015
  height: 100%;
2016
- `;var Mo=require("react/jsx-runtime"),cs=6,FC=new Array(cs).fill("");function BC(e){return e.replace(/\s+/g,"")}function fp(e){return/^[0-9]{1}$/.test(e)}function Eg(e){return e.length===cs&&e.every(fp)}function HC(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var ni=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=(0,Dc.useState)(FC),[a,l]=(0,Dc.useState)(null),[s,c]=(0,Dc.useState)(null),u=async C=>{C.preventDefault();let v=BC(C.currentTarget.value);if(v==="")return;let x=HC(n,fp),S=v.split(""),b=!S.every(fp),R=S.length+x>cs;if(b){l("Passcode can only be numbers"),c(1);return}if(R){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let A=Number(C.currentTarget.name?.charAt(4)),O=[...v||[""]].slice(0,cs-A),M=[...n.slice(0,A),...O,...n.slice(A+O.length)];i(M);let I=O.length,V=Math.min(Math.max(A+I,0),cs-1);if(document.querySelector(`input[name=pin-${V}]`)?.focus(),Eg(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${V}]`)?.blur()}catch(ee){c(1),l(ee.message)}else try{await e(null)}catch(ee){c(1),l(ee.message)}},f=C=>{s===1&&(l(null),c(null));let v=[...n.slice(0,C),"",...n.slice(C+1)];i(v),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),Eg(v)?e(v.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return(0,Mo.jsx)(Mo.Fragment,{children:(0,Mo.jsxs)(GC,{children:[(0,Mo.jsx)("div",{children:n.map((C,v)=>(0,Mo.jsx)("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&f(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:Pg.isMobile?"one-time-code":"off",disabled:t},v))}),(0,Mo.jsx)("div",{children:(0,Mo.jsx)(VC,{fail:!!r||!!a,children:r||a})})]})})},GC=hp.default.div`
2016
+ `;var Mo=require("react/jsx-runtime"),cs=6,UC=new Array(cs).fill("");function FC(e){return e.replace(/\s+/g,"")}function mp(e){return/^[0-9]{1}$/.test(e)}function bg(e){return e.length===cs&&e.every(mp)}function BC(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var oi=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=(0,Dc.useState)(UC),[a,l]=(0,Dc.useState)(null),[s,c]=(0,Dc.useState)(null),u=async C=>{C.preventDefault();let v=FC(C.currentTarget.value);if(v==="")return;let x=BC(n,mp),S=v.split(""),b=!S.every(mp),R=S.length+x>cs;if(b){l("Passcode can only be numbers"),c(1);return}if(R){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let A=Number(C.currentTarget.name?.charAt(4)),O=[...v||[""]].slice(0,cs-A),M=[...n.slice(0,A),...O,...n.slice(A+O.length)];i(M);let I=O.length,V=Math.min(Math.max(A+I,0),cs-1);if(document.querySelector(`input[name=pin-${V}]`)?.focus(),bg(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${V}]`)?.blur()}catch(ee){c(1),l(ee.message)}else try{await e(null)}catch(ee){c(1),l(ee.message)}},f=C=>{s===1&&(l(null),c(null));let v=[...n.slice(0,C),"",...n.slice(C+1)];i(v),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),bg(v)?e(v.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return(0,Mo.jsx)(Mo.Fragment,{children:(0,Mo.jsxs)(HC,{children:[(0,Mo.jsx)("div",{children:n.map((C,v)=>(0,Mo.jsx)("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&f(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:Eg.isMobile?"one-time-code":"off",disabled:t},v))}),(0,Mo.jsx)("div",{children:(0,Mo.jsx)(GC,{fail:!!r||!!a,children:r||a})})]})})},HC=fp.default.div`
2017
2017
  display: flex;
2018
2018
  flex-direction: column;
2019
2019
  width: 100%;
2020
2020
  gap: 8px;
2021
2021
 
2022
- ${da}[data-height='medium'] & {
2022
+ ${ca}[data-height='medium'] & {
2023
2023
  margin-top: 22px;
2024
2024
  }
2025
2025
 
@@ -2084,7 +2084,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2084
2084
  transform: translate(1px, 0px);
2085
2085
  }
2086
2086
  }
2087
- `,VC=hp.default.div`
2087
+ `,GC=fp.default.div`
2088
2088
  line-height: 20px;
2089
2089
  font-size: 13px;
2090
2090
  display: flex;
@@ -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
- `;var ue=require("react/jsx-runtime"),Sg=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,ds.useState)(""),[i,a]=(0,ds.useState)(!1),[l,s]=(0,ds.useState)(null),[c,u]=(0,ds.useState)("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:y}=Yr(),{app:g,data:C}=k();function v(){C?.mfaEnrollmentFlow?.onSuccess(),e()}async function x({qualifiedPhoneNumber:R}){try{await f({phoneNumber:R}),n(R),u("verify")}catch(A){s(A)}}async function S(R){try{if(!R)return;await y({phoneNumber:o,mfaCode:R}),a(!0)}catch(A){throw rc(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):vn(A)?new Error("The code you entered is not valid"):gn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):oc(A)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return l?(0,ue.jsx)(Ja,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{backFn:t,onClose:r},"header"),(0,ue.jsx)(Fe,{children:(0,ue.jsx)(et,{children:(0,ue.jsx)(yp.default,{})})}),(0,ue.jsx)(ye,{children:"Set up SMS verification"}),(0,ue.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,ue.jsxs)(Gr,{children:[(0,ue.jsx)(sa,{onSubmit:x}),(0,ue.jsxs)(Tf,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,ue.jsx)(z,{})]}):i?(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{onClose:v},"header"),(0,ue.jsx)(Fe,{children:(0,ue.jsx)(et,{status:"success",children:(0,ue.jsx)(Tg.default,{})})}),(0,ue.jsx)(ye,{children:"SMS verification added"}),(0,ue.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,ue.jsx)(qt,{children:(0,ue.jsx)(N,{onClick:v,children:"Done"})}),(0,ue.jsx)(z,{})]}):(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{backFn:b,onClose:r},"header"),(0,ue.jsx)(Fe,{children:(0,ue.jsx)(et,{children:(0,ue.jsx)(yp.default,{})})}),(0,ue.jsx)(ye,{children:"Enter enrollment code"}),(0,ue.jsxs)(Gr,{children:[(0,ue.jsx)(ni,{onChange:S}),(0,ue.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,ue.jsx)("strong",{children:C1(o)})]})]}),(0,ue.jsx)(z,{})]})};var Ag=h(require("@heroicons/react/24/solid/CheckCircleIcon")),Rg=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),gp=require("react");var _g=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var kg=require("react/jsx-runtime");var xg=({size:e,authUrl:t})=>(0,kg.jsx)(ra,{url:t,squareLogoElement:_g.default,size:e,fgColor:"#1F1F1F"});var fe=require("react/jsx-runtime"),Ig=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=(0,gp.useState)("enroll"),[a,l]=(0,gp.useState)(!1),{submitEnrollmentWithTotp:s}=Yr(),{data:c}=k();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function y(C){try{if(!C)return;await s({mfaCode:C}),l(!0)}catch(v){throw rc(v)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):vn(v)?new Error("The code you entered is not valid"):gn(v)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):oc(v)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{backFn:r,onClose:t},"header"),(0,fe.jsx)(ye,{children:"Scan QR code"}),(0,fe.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,fe.jsx)(Di,{children:(0,fe.jsx)(xg,{authUrl:o.authUrl,size:200})}),(0,fe.jsxs)(qt,{children:[(0,fe.jsx)(er,{children:(0,fe.jsx)(Tn,{itemName:"secret",text:o.secret})}),(0,fe.jsx)(N,{onClick:f,children:"Continue"})]}),(0,fe.jsx)(z,{})]}):a?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{onClose:u},"header"),(0,fe.jsx)(Fe,{children:(0,fe.jsx)(et,{status:"success",children:(0,fe.jsx)(Ag.default,{})})}),(0,fe.jsx)(ye,{children:"Authenticator app verification added"}),(0,fe.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,fe.jsx)(qt,{children:(0,fe.jsx)(N,{onClick:u,children:"Done"})}),(0,fe.jsx)(z,{})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{backFn:g,onClose:t},"header"),(0,fe.jsx)(Fe,{children:(0,fe.jsx)(et,{children:(0,fe.jsx)(Rg.default,{})})}),(0,fe.jsx)(ye,{children:"Enter enrollment code"}),(0,fe.jsx)(Gr,{children:(0,fe.jsx)(ni,{onChange:y})}),(0,fe.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,fe.jsx)("strong",{children:"authenticator app"})]}),(0,fe.jsx)(z,{})]})};var B=require("react/jsx-runtime"),Dg=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=(0,Qo.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Yr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=k(),{closePrivyModal:f}=W(),{promptMfa:y}=ca(),{initEnrollmentWithTotp:g}=Yr(),[C,v]=(0,Qo.useState)(!1),[x,S]=(0,Qo.useState)(null),[b,R]=(0,Qo.useState)(null),A=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),S(null)},500)},{initEnrollmentWithPasskey:O,submitEnrollmentWithPasskey:M}=Yr(),[I,V]=(0,Qo.useState)(!1),[Z,ee]=(0,Qo.useState)(null);u.current=A;let L=e?.mfaMethods.includes("sms"),Y=!!e?.phone,D=e?.mfaMethods.includes("totp"),be=e?.mfaMethods.includes("passkey"),ve=L||D||be,Ce=e?.linkedAccounts.filter(ft=>ft.type==="passkey").map(ft=>ft.credentialId)??[];(0,Qo.useEffect)(()=>{ve&&v(!0)},[ve]);function Le(){o(null),S(null)}function ce(){v(!1)}async function Jt(){V(!0);try{await O(),await M({credentialIds:Ce})}catch(ft){ee(ft)}finally{V(!1)}}async function Ct(ft){if(await y().catch(ee),ft==="totp"){S(ft),R(null),g().then(Dr=>{R(Dr)}).catch(()=>{R(null),Le()});return}if(ft==="passkey"&&Ce.length===1)return await Jt();S(ft)}if(!s||!e||!l)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(sg,{})}),(0,B.jsx)(Gr,{children:(0,B.jsx)(_t,{})}),(0,B.jsx)(z,{})]});async function nr(){o(null);try{await n()}catch{o(null)}}async function Et(){o(null);try{await i()}catch{o(null)}}async function Nr(){o(null);try{await y(),await a()}catch{o(null)}}if(r==="sms")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Le,onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Og.default,{})})}),(0,B.jsx)(ye,{children:"Remove SMS verification?"}),(0,B.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,B.jsx)(qt,{children:(0,B.jsx)(N,{warn:!0,onClick:nr,children:"Remove SMS for MFA"})}),(0,B.jsx)(z,{})]});if(r==="totp")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Le,onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Wg.default,{})})}),(0,B.jsx)(ye,{children:"Remove Authenticator App verification?"}),(0,B.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,B.jsx)(qt,{children:(0,B.jsx)(N,{warn:!0,onClick:Et,children:"Remove Authenticator App for MFA"})}),(0,B.jsx)(z,{})]});if(r==="passkey")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Le,onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Ng.default,{})})}),(0,B.jsx)(ye,{children:"Are you sure you want to remove passkey verification?"}),(0,B.jsx)(ge,{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."}),(0,B.jsx)(qt,{children:(0,B.jsx)(N,{warn:!0,onClick:Nr,children:"Yes, remove"})}),(0,B.jsx)(z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!ve)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(et,{children:(0,B.jsx)(vp.default,{})})}),(0,B.jsx)(ye,{children:"Add more security"}),(0,B.jsxs)(ge,{children:[l?.name," does not have any verification methods enabled."]}),(0,B.jsx)(qt,{children:(0,B.jsx)(N,{onClick:A,children:"Close"})}),(0,B.jsx)(z,{})]});let je=!ve&&!C;return je?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Fe,{children:(0,B.jsx)(et,{children:(0,B.jsx)(vp.default,{})})}),(0,B.jsx)(ye,{children:"Transaction Protection"}),(0,B.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,B.jsxs)(Yn,{children:[(0,B.jsxs)(mr,{children:[(0,B.jsx)(ur,{children:(0,B.jsx)(Mg.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,B.jsxs)(mr,{children:[(0,B.jsx)(ur,{children:(0,B.jsx)(Lg.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,B.jsxs)(qt,{children:[(0,B.jsx)(N,{onClick:()=>v(!0),children:"Continue"}),(0,B.jsx)(no,{onClick:A,children:"Not now"})]}),(0,B.jsx)(z,{})]}):x==="sms"?(0,B.jsx)(Sg,{onComplete:A,onReset:Le,onClose:A}):x==="totp"&&b?(0,B.jsx)(Ig,{onComplete:A,onClose:A,onReset:Le,totpInfo:b}):x==="passkey"?(0,B.jsx)(Cg,{onComplete:A,onReset:Le,onClose:A}):(0,B.jsx)(mg,{showIntro:je,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:Y,onBackToIntro:ce,handleSelectMethod:Ct,isTotpLoading:x==="totp"&&!b,isPasskeyLoading:I,error:Z,onClose:A,setRemovingMfaMethod:o})};var T2=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),S2=h(require("@heroicons/react/24/outline/FingerPrintIcon")),_2=h(require("@heroicons/react/24/outline/PhoneIcon")),x2=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),k2=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),A2=h(require("@heroicons/react/24/solid/PhoneIcon")),Rn=require("react");var si=require("react"),C2=h(require("styled-components"));var Sp=h(require("styled-components"));var Cp=h(require("styled-components")),ps=require("react/jsx-runtime"),Uc=({label:e,children:t,valueStyles:r})=>(0,ps.jsxs)(zC,{children:[(0,ps.jsx)("div",{children:e}),(0,ps.jsx)(qC,{style:{...r},children:t})]}),zC=Cp.default.div`
2095
+ `;var ue=require("react/jsx-runtime"),Tg=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,ds.useState)(""),[i,a]=(0,ds.useState)(!1),[l,s]=(0,ds.useState)(null),[c,u]=(0,ds.useState)("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:y}=Yr(),{app:g,data:C}=k();function v(){C?.mfaEnrollmentFlow?.onSuccess(),e()}async function x({qualifiedPhoneNumber:R}){try{await f({phoneNumber:R}),n(R),u("verify")}catch(A){s(A)}}async function S(R){try{if(!R)return;await y({phoneNumber:o,mfaCode:R}),a(!0)}catch(A){throw rc(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):gn(A)?new Error("The code you entered is not valid"):yn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):oc(A)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return l?(0,ue.jsx)(Ja,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{backFn:t,onClose:r},"header"),(0,ue.jsx)(Be,{children:(0,ue.jsx)(et,{children:(0,ue.jsx)(hp.default,{})})}),(0,ue.jsx)(ye,{children:"Set up SMS verification"}),(0,ue.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,ue.jsxs)(Gr,{children:[(0,ue.jsx)(aa,{onSubmit:x}),(0,ue.jsxs)(Pf,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,ue.jsx)(z,{})]}):i?(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{onClose:v},"header"),(0,ue.jsx)(Be,{children:(0,ue.jsx)(et,{status:"success",children:(0,ue.jsx)(Pg.default,{})})}),(0,ue.jsx)(ye,{children:"SMS verification added"}),(0,ue.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,ue.jsx)(zt,{children:(0,ue.jsx)(N,{onClick:v,children:"Done"})}),(0,ue.jsx)(z,{})]}):(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{backFn:b,onClose:r},"header"),(0,ue.jsx)(Be,{children:(0,ue.jsx)(et,{children:(0,ue.jsx)(hp.default,{})})}),(0,ue.jsx)(ye,{children:"Enter enrollment code"}),(0,ue.jsxs)(Gr,{children:[(0,ue.jsx)(oi,{onChange:S}),(0,ue.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,ue.jsx)("strong",{children:v1(o)})]})]}),(0,ue.jsx)(z,{})]})};var kg=h(require("@heroicons/react/24/solid/CheckCircleIcon")),Ag=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),yp=require("react");var Sg=h(require("@heroicons/react/24/solid/ShieldCheckIcon"));var xg=require("react/jsx-runtime");var _g=({size:e,authUrl:t})=>(0,xg.jsx)(ta,{url:t,squareLogoElement:Sg.default,size:e,fgColor:"#1F1F1F"});var fe=require("react/jsx-runtime"),Rg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=(0,yp.useState)("enroll"),[a,l]=(0,yp.useState)(!1),{submitEnrollmentWithTotp:s}=Yr(),{data:c}=k();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function y(C){try{if(!C)return;await s({mfaCode:C}),l(!0)}catch(v){throw rc(v)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):gn(v)?new Error("The code you entered is not valid"):yn(v)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):oc(v)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{backFn:r,onClose:t},"header"),(0,fe.jsx)(ye,{children:"Scan QR code"}),(0,fe.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,fe.jsx)(Ni,{children:(0,fe.jsx)(_g,{authUrl:o.authUrl,size:200})}),(0,fe.jsxs)(zt,{children:[(0,fe.jsx)(er,{children:(0,fe.jsx)(Pn,{itemName:"secret",text:o.secret})}),(0,fe.jsx)(N,{onClick:f,children:"Continue"})]}),(0,fe.jsx)(z,{})]}):a?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{onClose:u},"header"),(0,fe.jsx)(Be,{children:(0,fe.jsx)(et,{status:"success",children:(0,fe.jsx)(kg.default,{})})}),(0,fe.jsx)(ye,{children:"Authenticator app verification added"}),(0,fe.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,fe.jsx)(zt,{children:(0,fe.jsx)(N,{onClick:u,children:"Done"})}),(0,fe.jsx)(z,{})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(_,{backFn:g,onClose:t},"header"),(0,fe.jsx)(Be,{children:(0,fe.jsx)(et,{children:(0,fe.jsx)(Ag.default,{})})}),(0,fe.jsx)(ye,{children:"Enter enrollment code"}),(0,fe.jsx)(Gr,{children:(0,fe.jsx)(oi,{onChange:y})}),(0,fe.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,fe.jsx)("strong",{children:"authenticator app"})]}),(0,fe.jsx)(z,{})]})};var B=require("react/jsx-runtime"),Ng=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=(0,Qo.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Yr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=k(),{closePrivyModal:f}=W(),{promptMfa:y}=la(),{initEnrollmentWithTotp:g}=Yr(),[C,v]=(0,Qo.useState)(!1),[x,S]=(0,Qo.useState)(null),[b,R]=(0,Qo.useState)(null),A=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),S(null)},500)},{initEnrollmentWithPasskey:O,submitEnrollmentWithPasskey:M}=Yr(),[I,V]=(0,Qo.useState)(!1),[Y,ee]=(0,Qo.useState)(null);u.current=A;let L=e?.mfaMethods.includes("sms"),j=!!e?.phone,D=e?.mfaMethods.includes("totp"),be=e?.mfaMethods.includes("passkey"),ve=L||D||be,Ce=e?.linkedAccounts.filter(ht=>ht.type==="passkey").map(ht=>ht.credentialId)??[];(0,Qo.useEffect)(()=>{ve&&v(!0)},[ve]);function Oe(){o(null),S(null)}function ce(){v(!1)}async function Zt(){V(!0);try{await O(),await M({credentialIds:Ce})}catch(ht){ee(ht)}finally{V(!1)}}async function wt(ht){if(await y().catch(ee),ht==="totp"){S(ht),R(null),g().then(Dr=>{R(Dr)}).catch(()=>{R(null),Oe()});return}if(ht==="passkey"&&Ce.length===1)return await Zt();S(ht)}if(!s||!e||!l)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(ag,{})}),(0,B.jsx)(Gr,{children:(0,B.jsx)(_t,{})}),(0,B.jsx)(z,{})]});async function nr(){o(null);try{await n()}catch{o(null)}}async function Pt(){o(null);try{await i()}catch{o(null)}}async function Nr(){o(null);try{await y(),await a()}catch{o(null)}}if(r==="sms")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Oe,onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Lg.default,{})})}),(0,B.jsx)(ye,{children:"Remove SMS verification?"}),(0,B.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,B.jsx)(zt,{children:(0,B.jsx)(N,{warn:!0,onClick:nr,children:"Remove SMS for MFA"})}),(0,B.jsx)(z,{})]});if(r==="totp")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Oe,onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Mg.default,{})})}),(0,B.jsx)(ye,{children:"Remove Authenticator App verification?"}),(0,B.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,B.jsx)(zt,{children:(0,B.jsx)(N,{warn:!0,onClick:Pt,children:"Remove Authenticator App for MFA"})}),(0,B.jsx)(z,{})]});if(r==="passkey")return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{backFn:Oe,onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(et,{children:(0,B.jsx)(Og.default,{})})}),(0,B.jsx)(ye,{children:"Are you sure you want to remove passkey verification?"}),(0,B.jsx)(ge,{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."}),(0,B.jsx)(zt,{children:(0,B.jsx)(N,{warn:!0,onClick:Nr,children:"Yes, remove"})}),(0,B.jsx)(z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!ve)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(et,{children:(0,B.jsx)(gp.default,{})})}),(0,B.jsx)(ye,{children:"Add more security"}),(0,B.jsxs)(ge,{children:[l?.name," does not have any verification methods enabled."]}),(0,B.jsx)(zt,{children:(0,B.jsx)(N,{onClick:A,children:"Close"})}),(0,B.jsx)(z,{})]});let Ye=!ve&&!C;return Ye?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{onClose:A},"header"),(0,B.jsx)(Be,{children:(0,B.jsx)(et,{children:(0,B.jsx)(gp.default,{})})}),(0,B.jsx)(ye,{children:"Transaction Protection"}),(0,B.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,B.jsxs)(jn,{children:[(0,B.jsxs)(mr,{children:[(0,B.jsx)(ur,{children:(0,B.jsx)(Ig.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,B.jsxs)(mr,{children:[(0,B.jsx)(ur,{children:(0,B.jsx)(Wg.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,B.jsxs)(zt,{children:[(0,B.jsx)(N,{onClick:()=>v(!0),children:"Continue"}),(0,B.jsx)(no,{onClick:A,children:"Not now"})]}),(0,B.jsx)(z,{})]}):x==="sms"?(0,B.jsx)(Tg,{onComplete:A,onReset:Oe,onClose:A}):x==="totp"&&b?(0,B.jsx)(Rg,{onComplete:A,onClose:A,onReset:Oe,totpInfo:b}):x==="passkey"?(0,B.jsx)(vg,{onComplete:A,onReset:Oe,onClose:A}):(0,B.jsx)(ug,{showIntro:Ye,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:j,onBackToIntro:ce,handleSelectMethod:wt,isTotpLoading:x==="totp"&&!b,isPasskeyLoading:I,error:Y,onClose:A,setRemovingMfaMethod:o})};var P2=h(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),T2=h(require("@heroicons/react/24/outline/FingerPrintIcon")),S2=h(require("@heroicons/react/24/outline/PhoneIcon")),_2=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),x2=h(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),k2=h(require("@heroicons/react/24/solid/PhoneIcon")),An=require("react");var ai=require("react"),v2=h(require("styled-components"));var Tp=h(require("styled-components"));var vp=h(require("styled-components")),ps=require("react/jsx-runtime"),Uc=({label:e,children:t,valueStyles:r})=>(0,ps.jsxs)(VC,{children:[(0,ps.jsx)("div",{children:e}),(0,ps.jsx)(zC,{style:{...r},children:t})]}),VC=vp.default.div`
2096
2096
  display: flex;
2097
2097
  align-items: center;
2098
2098
  justify-content: space-between;
@@ -2107,7 +2107,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2107
2107
  color: var(--privy-color-foreground-2);
2108
2108
  text-align: right;
2109
2109
  }
2110
- `,qC=Cp.default.div`
2110
+ `,zC=vp.default.div`
2111
2111
  font-size: 14px;
2112
2112
  line-height: 100%;
2113
2113
  display: flex;
@@ -2116,28 +2116,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2116
2116
  border-radius: var(--privy-border-radius-full);
2117
2117
  background-color: var(--privy-color-background-2);
2118
2118
  padding: 4px 8px;
2119
- `;var ms=h(require("styled-components"));var wp=require("@ethersproject/bignumber"),bp=require("@ethersproject/units");var us=(e,t)=>{let r=(t*parseFloat((0,bp.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},Wo=(e,t,r=6,o=!1)=>{let i=parseFloat((0,bp.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Ep=e=>e.map(Yt).reduce((t,r)=>t.add(r),wp.BigNumber.from(0)).toHexString(),Ug=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${Ku(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Yt=e=>wp.BigNumber.from(e);var Lo=require("react/jsx-runtime"),Fg=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ep(e),n=t?us(o,t):void 0,i=Wo(o,r);return(0,Lo.jsx)(Bg,{children:n||i})},Pp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ep(e),n=t?us(o,t):void 0,i=Wo(o,r);return(0,Lo.jsx)(Bg,{children:n?(0,Lo.jsxs)(Lo.Fragment,{children:[(0,Lo.jsx)($C,{children:"USD"}),n==="<$0.01"?(0,Lo.jsxs)(jC,{children:[(0,Lo.jsx)(KC,{children:"<"}),"$0.01"]}):n]}):i})},Bg=ms.default.span`
2119
+ `;var ms=h(require("styled-components"));var Cp=require("@ethersproject/bignumber"),wp=require("@ethersproject/units");var us=(e,t)=>{let r=(t*parseFloat((0,wp.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},Wo=(e,t,r=6,o=!1)=>{let i=parseFloat((0,wp.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},bp=e=>e.map(jt).reduce((t,r)=>t.add(r),Cp.BigNumber.from(0)).toHexString(),Dg=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${$u(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},jt=e=>Cp.BigNumber.from(e);var Lo=require("react/jsx-runtime"),Ug=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=bp(e),n=t?us(o,t):void 0,i=Wo(o,r);return(0,Lo.jsx)(Fg,{children:n||i})},Ep=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=bp(e),n=t?us(o,t):void 0,i=Wo(o,r);return(0,Lo.jsx)(Fg,{children:n?(0,Lo.jsxs)(Lo.Fragment,{children:[(0,Lo.jsx)(qC,{children:"USD"}),n==="<$0.01"?(0,Lo.jsxs)(KC,{children:[(0,Lo.jsx)($C,{children:"<"}),"$0.01"]}):n]}):i})},Fg=ms.default.span`
2120
2120
  font-size: 14px;
2121
2121
  line-height: 140%;
2122
2122
  display: flex;
2123
2123
  gap: 4px;
2124
2124
  align-items: center;
2125
- `,$C=ms.default.span`
2125
+ `,qC=ms.default.span`
2126
2126
  font-size: 12px;
2127
2127
  line-height: 12px;
2128
2128
  color: var(--privy-color-foreground-3);
2129
- `,KC=ms.default.span`
2129
+ `,$C=ms.default.span`
2130
2130
  font-size: 10px;
2131
- `,jC=ms.default.span`
2131
+ `,KC=ms.default.span`
2132
2132
  display: flex;
2133
2133
  align-items: center;
2134
- `;var Fc=h(require("styled-components"));var vr=require("react/jsx-runtime"),Hg=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,vr.jsxs)(Gd,{style:{paddingBottom:"12px"},children:[(0,vr.jsxs)(Vg,{children:[(0,vr.jsx)(qg,{children:"Est. Fees"}),(0,vr.jsx)("div",{children:(0,vr.jsx)(Pp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,vr.jsx)(zg,{children:`${Wo(e,r)}`})]}),Gg=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Yt(e.value||0).add(Yt(t)).toHexString();return(0,vr.jsxs)(Gd,{children:[(0,vr.jsxs)(Vg,{children:[(0,vr.jsx)(qg,{children:"Total (including fees)"}),(0,vr.jsx)("div",{children:(0,vr.jsx)(Pp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,vr.jsx)(zg,{children:Wo(n,o)})]})},Vg=Fc.default.div`
2134
+ `;var Fc=h(require("styled-components"));var vr=require("react/jsx-runtime"),Bg=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,vr.jsxs)(Hd,{style:{paddingBottom:"12px"},children:[(0,vr.jsxs)(Gg,{children:[(0,vr.jsx)(zg,{children:"Est. Fees"}),(0,vr.jsx)("div",{children:(0,vr.jsx)(Ep,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,vr.jsx)(Vg,{children:`${Wo(e,r)}`})]}),Hg=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=jt(e.value||0).add(jt(t)).toHexString();return(0,vr.jsxs)(Hd,{children:[(0,vr.jsxs)(Gg,{children:[(0,vr.jsx)(zg,{children:"Total (including fees)"}),(0,vr.jsx)("div",{children:(0,vr.jsx)(Ep,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,vr.jsx)(Vg,{children:Wo(n,o)})]})},Gg=Fc.default.div`
2135
2135
  display: flex;
2136
2136
  flex-direction: row;
2137
2137
  justify-content: space-between;
2138
2138
  align-items: center;
2139
2139
  padding-top: 4px;
2140
- `,zg=Fc.default.div`
2140
+ `,Vg=Fc.default.div`
2141
2141
  display: flex;
2142
2142
  flex-direction: row;
2143
2143
  height: 12px;
@@ -2146,23 +2146,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2146
2146
  line-height: 12px;
2147
2147
  color: var(--privy-color-foreground-3);
2148
2148
  font-weight: 400;
2149
- `,qg=Fc.default.div`
2149
+ `,zg=Fc.default.div`
2150
2150
  font-size: 14px;
2151
2151
  line-height: 22.4px;
2152
2152
  font-weight: 400;
2153
- `;var $g=h(require("@heroicons/react/24/outline/ChevronDownIcon")),Oo=require("react"),Xo=h(require("styled-components"));var Bc=require("react"),pa=(0,Bc.createContext)(void 0);var fs=(0,Bc.createContext)(void 0);var Ft=require("react/jsx-runtime"),Kg=({defaultValue:e,children:t})=>{let[r,o]=(0,Oo.useState)(e||null),n=i=>{o(r===i?null:i)};return(0,Ft.jsx)(pa.Provider,{value:{activePanel:r,togglePanel:n},children:(0,Ft.jsx)(YC,{children:t})})},jg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,Oo.useContext)(pa),n=r===e;return(0,Ft.jsx)(fs.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,Ft.jsx)(XC,{isActive:n,"data-open":n,children:t})})},Yg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(pa),{onToggle:r,value:o}=(0,Oo.useContext)(fs),n=t===o;return(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsxs)(ZC,{onClick:r,"data-open":n,children:[(0,Ft.jsx)(QC,{children:e}),(0,Ft.jsx)(tw,{isactive:n,children:(0,Ft.jsx)($g.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,Ft.jsx)(JC,{})]})},Zg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(pa),{value:r}=(0,Oo.useContext)(fs);return(0,Ft.jsx)(ew,{"data-open":t===r,children:(0,Ft.jsx)(Qg,{children:e})})},Jg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(pa),{value:r}=(0,Oo.useContext)(fs);return(0,Ft.jsx)(Qg,{children:typeof e=="function"?e({isActive:t===r}):e})},YC=Xo.default.div`
2153
+ `;var qg=h(require("@heroicons/react/24/outline/ChevronDownIcon")),Oo=require("react"),Xo=h(require("styled-components"));var Bc=require("react"),da=(0,Bc.createContext)(void 0);var fs=(0,Bc.createContext)(void 0);var Ft=require("react/jsx-runtime"),$g=({defaultValue:e,children:t})=>{let[r,o]=(0,Oo.useState)(e||null),n=i=>{o(r===i?null:i)};return(0,Ft.jsx)(da.Provider,{value:{activePanel:r,togglePanel:n},children:(0,Ft.jsx)(jC,{children:t})})},Kg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,Oo.useContext)(da),n=r===e;return(0,Ft.jsx)(fs.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,Ft.jsx)(QC,{isActive:n,"data-open":n,children:t})})},jg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(da),{onToggle:r,value:o}=(0,Oo.useContext)(fs),n=t===o;return(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsxs)(YC,{onClick:r,"data-open":n,children:[(0,Ft.jsx)(JC,{children:e}),(0,Ft.jsx)(ew,{isactive:n,children:(0,Ft.jsx)(qg.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,Ft.jsx)(ZC,{})]})},Yg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(da),{value:r}=(0,Oo.useContext)(fs);return(0,Ft.jsx)(XC,{"data-open":t===r,children:(0,Ft.jsx)(Jg,{children:e})})},Zg=({children:e})=>{let{activePanel:t}=(0,Oo.useContext)(da),{value:r}=(0,Oo.useContext)(fs);return(0,Ft.jsx)(Jg,{children:typeof e=="function"?e({isActive:t===r}):e})},jC=Xo.default.div`
2154
2154
  display: flex;
2155
2155
  flex-direction: column;
2156
2156
  width: 100%;
2157
2157
  gap: 8px;
2158
- `,ZC=Xo.default.div`
2158
+ `,YC=Xo.default.div`
2159
2159
  display: flex;
2160
2160
  justify-content: space-between;
2161
2161
  align-items: center;
2162
2162
  width: 100%;
2163
2163
  cursor: pointer;
2164
2164
  padding-bottom: 8px;
2165
- `,JC=Xo.default.div`
2165
+ `,ZC=Xo.default.div`
2166
2166
  width: 100%;
2167
2167
 
2168
2168
  && {
@@ -2170,13 +2170,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2170
2170
  border-color: var(--privy-color-foreground-4);
2171
2171
  }
2172
2172
  padding-bottom: 12px;
2173
- `,QC=Xo.default.div`
2173
+ `,JC=Xo.default.div`
2174
2174
  font-size: 14px;
2175
2175
  font-weight: 500;
2176
2176
  line-height: 19.6px;
2177
2177
  width: 100%;
2178
2178
  padding-right: 8px;
2179
- `,XC=Xo.default.div`
2179
+ `,QC=Xo.default.div`
2180
2180
  display: flex;
2181
2181
  flex-direction: column;
2182
2182
  width: 100%;
@@ -2188,7 +2188,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2188
2188
  border-color: var(--privy-color-foreground-4);
2189
2189
  border-radius: var(--privy-border-radius-md);
2190
2190
  }
2191
- `,ew=Xo.default.div`
2191
+ `,XC=Xo.default.div`
2192
2192
  position: relative;
2193
2193
  overflow: hidden;
2194
2194
  transition: max-height 25ms ease-out;
@@ -2200,38 +2200,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
2200
2200
  &[data-open='false'] {
2201
2201
  max-height: 0;
2202
2202
  }
2203
- `,Qg=Xo.default.div`
2203
+ `,Jg=Xo.default.div`
2204
2204
  display: flex;
2205
2205
  flex-direction: column;
2206
2206
  gap: 12px;
2207
2207
  flex: 1 1 auto;
2208
2208
  min-height: 1px;
2209
- `,tw=Xo.default.div`
2209
+ `,ew=Xo.default.div`
2210
2210
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2211
- `;var Xg=h(require("styled-components"));var e2=require("react/jsx-runtime"),Tp=({walletAddress:e,chainId:t=Fo})=>(0,e2.jsx)(rw,{href:Ug(t,e),target:"_blank",children:cn(e)}),rw=Xg.default.a`
2211
+ `;var Qg=h(require("styled-components"));var Xg=require("react/jsx-runtime"),Pp=({walletAddress:e,chainId:t=Fo})=>(0,Xg.jsx)(tw,{href:Dg(t,e),target:"_blank",children:cn(e)}),tw=Qg.default.a`
2212
2212
  &:hover {
2213
2213
  text-decoration: underline;
2214
2214
  }
2215
- `;var Wt=require("react/jsx-runtime"),ua=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return(0,Wt.jsx)(Kg,{children:(0,Wt.jsxs)(jg,{value:"details",children:[(0,Wt.jsx)(Yg,{children:(0,Wt.jsxs)(ow,{children:[(0,Wt.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,Wt.jsx)(nw,{children:(0,Wt.jsx)(Fg,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,Wt.jsxs)(Zg,{children:[(0,Wt.jsx)(Uc,{label:"From",children:(0,Wt.jsx)(Tp,{walletAddress:e,chainId:r.chainId||Fo})}),(0,Wt.jsx)(Uc,{label:"To",children:(0,Wt.jsx)(Tp,{walletAddress:t,chainId:r.chainId||Fo})}),o&&o.action&&(0,Wt.jsx)(Uc,{label:"Action",children:o.action}),i&&(0,Wt.jsx)(Hg,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,Wt.jsx)(Jg,{children:({isActive:s})=>(0,Wt.jsx)(Gg,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},ow=Sp.default.div`
2215
+ `;var Wt=require("react/jsx-runtime"),pa=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return(0,Wt.jsx)($g,{children:(0,Wt.jsxs)(Kg,{value:"details",children:[(0,Wt.jsx)(jg,{children:(0,Wt.jsxs)(rw,{children:[(0,Wt.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,Wt.jsx)(ow,{children:(0,Wt.jsx)(Ug,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,Wt.jsxs)(Yg,{children:[(0,Wt.jsx)(Uc,{label:"From",children:(0,Wt.jsx)(Pp,{walletAddress:e,chainId:r.chainId||Fo})}),(0,Wt.jsx)(Uc,{label:"To",children:(0,Wt.jsx)(Pp,{walletAddress:t,chainId:r.chainId||Fo})}),o&&o.action&&(0,Wt.jsx)(Uc,{label:"Action",children:o.action}),i&&(0,Wt.jsx)(Bg,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,Wt.jsx)(Zg,{children:({isActive:s})=>(0,Wt.jsx)(Hg,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},rw=Tp.default.div`
2216
2216
  display: flex;
2217
2217
  flex-direction: row;
2218
2218
  justify-content: space-between;
2219
- `,nw=Sp.default.div`
2219
+ `,ow=Tp.default.div`
2220
2220
  flex-shrink: 0;
2221
2221
  padding-left: 8px;
2222
- `;var ma=h(require("styled-components")),An=require("react/jsx-runtime"),_p=({description:e,contractInfo:t})=>(0,An.jsxs)(iw,{children:[t.imgUrl&&(0,An.jsx)(aw,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,An.jsx)(sw,{children:(0,An.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,An.jsx)(lw,{children:t.name}),(0,An.jsx)(cw,{children:e||t.actionText})]}),iw=ma.default.div`
2222
+ `;var ua=h(require("styled-components")),kn=require("react/jsx-runtime"),Sp=({description:e,contractInfo:t})=>(0,kn.jsxs)(nw,{children:[t.imgUrl&&(0,kn.jsx)(iw,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,kn.jsx)(aw,{children:(0,kn.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,kn.jsx)(sw,{children:t.name}),(0,kn.jsx)(lw,{children:e||t.actionText})]}),nw=ua.default.div`
2223
2223
  display: flex;
2224
2224
  flex-direction: column;
2225
2225
  align-items: center;
2226
2226
  margin-bottom: 8px;
2227
- `,aw=ma.default.img`
2227
+ `,iw=ua.default.img`
2228
2228
  && {
2229
2229
  height: ${e=>e.size==="sm"?"65px":"140px"};
2230
2230
  width: ${e=>e.size==="sm"?"65px":"140px"};
2231
2231
  border-radius: 16px;
2232
2232
  margin-bottom: 12px;
2233
2233
  }
2234
- `,sw=ma.default.div`
2234
+ `,aw=ua.default.div`
2235
2235
  font-size: 12px;
2236
2236
  line-height: 12px;
2237
2237
  padding: 7px;
@@ -2244,7 +2244,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2244
2244
  text-decoration: underline;
2245
2245
  }
2246
2246
  }
2247
- `,lw=ma.default.div`
2247
+ `,sw=ua.default.div`
2248
2248
  font-size: 18px;
2249
2249
  line-height: 18px;
2250
2250
  font-weight: 500;
@@ -2252,7 +2252,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2252
2252
  white-space: nowrap;
2253
2253
  max-width: 275px;
2254
2254
  text-overflow: ellipsis;
2255
- `,cw=ma.default.div`
2255
+ `,lw=ua.default.div`
2256
2256
  font-size: 16px;
2257
2257
  line-height: 140%;
2258
2258
  font-weight: 400;
@@ -2260,7 +2260,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2260
2260
  overflow: hidden;
2261
2261
  max-width: 275px;
2262
2262
  text-overflow: ellipsis;
2263
- `;var t2=h(require("@heroicons/react/24/outline/WalletIcon")),Hc=h(require("styled-components"));var ii=require("react/jsx-runtime"),r2=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=W(),a=i(t.chainId)||"ETH";return(0,ii.jsxs)(dw,{children:[(0,ii.jsxs)(pw,{children:[(0,ii.jsx)(t2.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,ii.jsx)("div",{children:cn(e)})]}),(0,ii.jsxs)(uw,{displayBalanceColor:n,hasFunds:o,children:[r?Wo(r,a,6,!0):0," available"]})]})},dw=Hc.default.div`
2263
+ `;var e2=h(require("@heroicons/react/24/outline/WalletIcon")),Hc=h(require("styled-components"));var ni=require("react/jsx-runtime"),t2=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=W(),a=i(t.chainId)||"ETH";return(0,ni.jsxs)(cw,{children:[(0,ni.jsxs)(dw,{children:[(0,ni.jsx)(e2.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,ni.jsx)("div",{children:cn(e)})]}),(0,ni.jsxs)(pw,{displayBalanceColor:n,hasFunds:o,children:[r?Wo(r,a,6,!0):0," available"]})]})},cw=Hc.default.div`
2264
2264
  display: flex;
2265
2265
  flex-direction: row;
2266
2266
  justify-content: space-between;
@@ -2273,12 +2273,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2273
2273
  border: 1px solid var(--privy-color-foreground-4);
2274
2274
  border-radius: var(--privy-border-radius-md);
2275
2275
  }
2276
- `,pw=Hc.default.div`
2276
+ `,dw=Hc.default.div`
2277
2277
  display: flex;
2278
2278
  flex-direction: row;
2279
2279
  align-items: center;
2280
2280
  gap: 8px;
2281
- `,uw=Hc.default.div`
2281
+ `,pw=Hc.default.div`
2282
2282
  display: flex;
2283
2283
  align-items: center;
2284
2284
  justify-content: center;
@@ -2288,35 +2288,35 @@ 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
- `;var hs=h(require("styled-components"));var Zr=require("react/jsx-runtime"),n2=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?us(n,o):void 0,a=Wo(n,r);return(0,Zr.jsxs)(mw,{children:[i?(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(o2,{children:i}),(0,Zr.jsx)(fw,{children:a})]}):(0,Zr.jsx)(Zr.Fragment,{children:(0,Zr.jsx)(o2,{children:a})}),(0,Zr.jsx)(hw,{children:e})]})},mw=hs.default.div`
2291
+ `;var hs=h(require("styled-components"));var Zr=require("react/jsx-runtime"),o2=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?us(n,o):void 0,a=Wo(n,r);return(0,Zr.jsxs)(uw,{children:[i?(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(r2,{children:i}),(0,Zr.jsx)(mw,{children:a})]}):(0,Zr.jsx)(Zr.Fragment,{children:(0,Zr.jsx)(r2,{children:a})}),(0,Zr.jsx)(fw,{children:e})]})},uw=hs.default.div`
2292
2292
  display: flex;
2293
2293
  flex-direction: column;
2294
2294
  align-items: center;
2295
2295
  margin-bottom: 20px;
2296
- `,o2=hs.default.h2`
2296
+ `,r2=hs.default.h2`
2297
2297
  && {
2298
2298
  font-size: 48px;
2299
2299
  line-height: 48px;
2300
2300
  margin: 8px auto;
2301
2301
  }
2302
- `,fw=hs.default.p`
2302
+ `,mw=hs.default.p`
2303
2303
  margin-bottom: 12px;
2304
2304
  && {
2305
2305
  font-size: 17px;
2306
2306
  line-height: 17px;
2307
2307
  color: var(--privy-color-foreground-3);
2308
2308
  }
2309
- `,hw=hs.default.div`
2309
+ `,fw=hs.default.div`
2310
2310
  font-size: 16px;
2311
2311
  line-height: 22.4px;
2312
2312
  font-weight: 400;
2313
2313
  overflow: hidden;
2314
2314
  max-width: 275px;
2315
2315
  text-overflow: ellipsis;
2316
- `;var y2=require("@ethersproject/abstract-signer"),vw=require("@ethersproject/providers");var xp=require("@ethersproject/bignumber");var ai=require("@ethersproject/bignumber"),i2=require("@ethersproject/contracts"),a2=require("@ethersproject/transactions");var fa=e=>[Cl.id,wl.id,bl.id,El.id,Pl.id,Tl.id,Sl.id,xl.id,_l.id].includes(e),s2=async(e,t)=>{if(!fa(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=ai.BigNumber.from(r).mul(ai.BigNumber.from(126)).div(ai.BigNumber.from(100)).add(ai.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ys(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function l2(e,t){if(!e.chainId||e.chainId&&!fa(e.chainId))return ai.BigNumber.from(0);let r=ai.BigNumber.from(0);try{let o=new i2.Contract(cm,dm,t),n=c2(e),i=(0,a2.serialize)(n);r=await o.getL1Fee(i)}catch{}return r}async function d2(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var p2=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 ha(e,t){if(!e.gasLimit)throw new nt("gasLimit was not successfully set for transaction.");let r=Yt(e.gasLimit),o=xp.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=Yt(e.maxFeePerGas);else throw new nt("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Yt(e.gasPrice);else throw new nt("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=xp.BigNumber.from(0);if(e.chainId&&fa(e.chainId))try{i=await l2(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}var Gc=require("@ethersproject/bignumber");var kp=e=>[yl.id,gl.id,vl.id].includes(e),u2=async(e,t)=>{if(!kp(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(Gc.BigNumber.from(120)).div(Gc.BigNumber.from(100));e.maxFeePerGas=ys(o),e.maxPriorityFeePerGas=ys(Gc.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Ap=e=>[56,97].includes(e),m2=async(e,t)=>{if(!Ap(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};var Mp=require("@ethersproject/units"),f2=require("ofetch");var Rp={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 Wp=e=>[Ua.id,Fa.id,Rp.id].includes(e),Ip=e=>({maxPriorityFee:(0,Mp.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Mp.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),yw=e=>({safeLow:Ip(e.safeLow),standard:Ip(e.standard),fast:Ip(e.fast)}),gw=async e=>{let t="";switch(e){case Ua.id:t="https://gasstation.polygon.technology/v2";break;case Fa.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Rp.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return yw(await(0,f2.ofetch)(t))};async function h2(e){if(!Wp(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 gw(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 ys(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 c2(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 ya(e,t,r){if(t.chainId=Number(t.chainId),g2(t),t.from||(t.from=e),!t.nonce){let o=new y2.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await d2(t,r)),typeof t.type=="string"&&v2(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),Wp(t.chainId)?t=await h2(t):kp(t.chainId)?t=await u2(t,r):fa(t.chainId)?t=await s2(t,r):Ap(t.chainId)?t=await m2(t,r):t=await p2(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function Vc(e,t,r,o,n){o=Object.assign({chainId:Fo},o),g2(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 zc(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 g2(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Cw(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 Cw(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&v2(e);return t||r||o}function v2(e){return/^-?0x[a-f0-9]+$/i.test(e)}function qc(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}}var ga=require("react");var $c=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,i]=(0,ga.useState)(!0),[a,l]=(0,ga.useState)(void 0),[s,c]=(0,ga.useState)(void 0);return(0,ga.useEffect)(()=>{let u=e.chainId||Fo,f=o.find(g=>g.id===Number(u));if(!f)throw new de(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};var Kc=require("react"),Lp=(0,Kc.createContext)(null);function va(){let e=(0,Kc.useContext)(Lp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Op=require("react/jsx-runtime"),gs=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=va(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=W(),[s,c]=(0,si.useState)(null),[u,f]=(0,si.useState)(e),{tokenPrice:y}=$c(u),g=l(e.chainId)||"ETH",C=(0,si.useMemo)(()=>r.find(v=>v.walletClientType==="privy"),[r]);return(0,si.useEffect)(()=>{async function v(){if(!await t()||!o||!C)return u;let S=Uo(u.chainId,i,n,{appId:a}),b=await ya(C.address,u,S),{totalGasEstimate:R}=await ha(b,S);return c(R.toHexString()),b}v().then(f).catch(console.error)},[o]),C?(0,Op.jsx)(ww,{children:(0,Op.jsx)(ua,{from:C.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:y,tokenSymbol:g})}):null},ww=C2.default.div`
2316
+ `;var h2=require("@ethersproject/abstract-signer"),gw=require("@ethersproject/providers");var _p=require("@ethersproject/bignumber");var ii=require("@ethersproject/bignumber"),n2=require("@ethersproject/contracts"),i2=require("@ethersproject/transactions");var ma=e=>[Cl.id,wl.id,bl.id,El.id,Pl.id,Tl.id,Sl.id,xl.id,_l.id].includes(e),a2=async(e,t)=>{if(!ma(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=ii.BigNumber.from(r).mul(ii.BigNumber.from(126)).div(ii.BigNumber.from(100)).add(ii.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ys(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function s2(e,t){if(!e.chainId||e.chainId&&!ma(e.chainId))return ii.BigNumber.from(0);let r=ii.BigNumber.from(0);try{let o=new n2.Contract(lm,cm,t),n=l2(e),i=(0,i2.serialize)(n);r=await o.getL1Fee(i)}catch{}return r}async function c2(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var d2=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 fa(e,t){if(!e.gasLimit)throw new nt("gasLimit was not successfully set for transaction.");let r=jt(e.gasLimit),o=_p.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=jt(e.maxFeePerGas);else throw new nt("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=jt(e.gasPrice);else throw new nt("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=_p.BigNumber.from(0);if(e.chainId&&ma(e.chainId))try{i=await s2(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}var Gc=require("@ethersproject/bignumber");var xp=e=>[yl.id,gl.id,vl.id].includes(e),p2=async(e,t)=>{if(!xp(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(Gc.BigNumber.from(120)).div(Gc.BigNumber.from(100));e.maxFeePerGas=ys(o),e.maxPriorityFeePerGas=ys(Gc.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var kp=e=>[56,97].includes(e),u2=async(e,t)=>{if(!kp(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};var Ip=require("@ethersproject/units"),m2=require("ofetch");var Ap={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 Mp=e=>[Ua.id,Fa.id,Ap.id].includes(e),Rp=e=>({maxPriorityFee:(0,Ip.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Ip.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),hw=e=>({safeLow:Rp(e.safeLow),standard:Rp(e.standard),fast:Rp(e.fast)}),yw=async e=>{let t="";switch(e){case Ua.id:t="https://gasstation.polygon.technology/v2";break;case Fa.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Ap.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return hw(await(0,m2.ofetch)(t))};async function f2(e){if(!Mp(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 yw(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 ys(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 l2(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=jt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=jt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=jt(e.gasPrice)),e.value!==void 0&&(t.value=jt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=jt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=jt(e.maxPriorityFeePerGas)),t}async function ha(e,t,r){if(t.chainId=Number(t.chainId),y2(t),t.from||(t.from=e),!t.nonce){let o=new h2.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await c2(t,r)),typeof t.type=="string"&&g2(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),Mp(t.chainId)?t=await f2(t):xp(t.chainId)?t=await p2(t,r):ma(t.chainId)?t=await a2(t,r):kp(t.chainId)?t=await u2(t,r):t=await d2(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function Vc(e,t,r,o,n){o=Object.assign({chainId:Fo},o),y2(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 zc(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(jt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function y2(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!vw(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 vw(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&g2(e);return t||r||o}function g2(e){return/^-?0x[a-f0-9]+$/i.test(e)}function qc(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}}var ya=require("react");var $c=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,i]=(0,ya.useState)(!0),[a,l]=(0,ya.useState)(void 0),[s,c]=(0,ya.useState)(void 0);return(0,ya.useEffect)(()=>{let u=e.chainId||Fo,f=o.find(g=>g.id===Number(u));if(!f)throw new de(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};var Kc=require("react"),Wp=(0,Kc.createContext)(null);function ga(){let e=(0,Kc.useContext)(Wp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Lp=require("react/jsx-runtime"),gs=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=ga(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=W(),[s,c]=(0,ai.useState)(null),[u,f]=(0,ai.useState)(e),{tokenPrice:y}=$c(u),g=l(e.chainId)||"ETH",C=(0,ai.useMemo)(()=>r.find(v=>v.walletClientType==="privy"),[r]);return(0,ai.useEffect)(()=>{async function v(){if(!await t()||!o||!C)return u;let S=Uo(u.chainId,i,n,{appId:a}),b=await ha(C.address,u,S),{totalGasEstimate:R}=await fa(b,S);return c(R.toHexString()),b}v().then(f).catch(console.error)},[o]),C?(0,Lp.jsx)(Cw,{children:(0,Lp.jsx)(pa,{from:C.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:y,tokenSymbol:g})}):null},Cw=v2.default.div`
2317
2317
  width: 100%;
2318
2318
  padding: 1rem 0;
2319
- `;var w2=h(require("@heroicons/react/24/outline/CalendarIcon")),b2=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),E2=h(require("@heroicons/react/24/outline/ShieldCheckIcon"));var ze=require("react/jsx-runtime"),P2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=W();return(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(_,{onClose:r},"header"),(0,ze.jsx)(At,{children:(0,ze.jsxs)("div",{children:[(0,ze.jsx)(St,{success:a,fail:!!t}),t?(0,ze.jsx)(b2.default,{style:{width:"38px",height:"38px"}}):(0,ze.jsx)(ei,{style:{width:"38px",height:"38px"}})]})}),(0,ze.jsx)(ye,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,ze.jsxs)(Yn,{children:[(0,ze.jsxs)(mr,{children:[(0,ze.jsx)(ur,{children:(0,ze.jsx)(E2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,ze.jsxs)(mr,{children:[(0,ze.jsx)(ur,{children:(0,ze.jsx)(w2.default,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,ze.jsx)(Gr,{children:(0,ze.jsx)(gs,{pendingTransaction:l})}),t&&(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(Zl,{style:{marginTop:"1.25rem"},children:t.message}),(0,ze.jsx)(N,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&(0,ze.jsx)(Ha,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),(0,ze.jsx)(z,{})]})};var Q=require("react/jsx-runtime"),Np=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=(0,Rn.useState)(null),{init:i,cancel:a,submit:l}=ca(),[s,c]=(0,Rn.useState)(!1),[u,f]=(0,Rn.useState)(!1),[y,g]=(0,Rn.useState)(null),[C,v]=(0,Rn.useState)(null);(0,Rn.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let x=O=>tc(O)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):vn(O)?(c(!1),new Error("The code you entered is not valid")):gn(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 S(O){v(null);try{if(!O||!o)return;await l(o,O),f(!0),c(!1),t()}catch(M){throw x(M)}}async function b(O){if(O==="passkey"){try{n(O);let M=await i(O);if(!M)throw new Error("something went wrong");g(M),await l(O,M),f(!0),c(!1),t()}catch(M){v(x(M))}return}try{n(O),await i(O)}catch(M){console.error(M)}}let R=()=>{n(null),v(null),a(),t()},A=()=>{n(null),v(null)};if(!e||!r)return null;if(o==="passkey"){let O=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,I)=>I.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return(0,Q.jsx)(P2,{account:O,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:C,onClose:R,onBack:A,handleSubmit:()=>S(y).catch(v)})}return o?(0,Q.jsx)(bw,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:S,selectedMethod:o,onClose:R,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:R},"header"),(0,Q.jsx)(Fe,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(x2.default,{})})}),(0,Q.jsx)(ye,{children:"Verify your identity"}),(0,Q.jsx)(ge,{children:"Choose a verification method"}),(0,Q.jsxs)(ql,{children:[r.mfaMethods.includes("totp")&&(0,Q.jsxs)(Ne,{onClick:()=>b("totp"),children:[(0,Q.jsx)(T2.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,Q.jsxs)(Ne,{onClick:()=>b("sms"),children:[(0,Q.jsx)(_2.default,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&(0,Q.jsxs)(Ne,{onClick:()=>b("passkey"),children:[(0,Q.jsx)(S2.default,{}),"Passkey"]},"passkey")]}),(0,Q.jsx)(z,{})]})},bw=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=k(),{pendingTransaction:l}=W();switch(e){case"sms":return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:o},"header"),(0,Q.jsx)(Fe,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(A2.default,{})})}),(0,Q.jsx)(ye,{children:"Enter verification code"}),(0,Q.jsxs)(Gr,{children:[(0,Q.jsx)(ni,{success:t,disabled:r,onChange:i}),(0,Q.jsxs)(ge,{children:["To continue, please enter the 6-digit code sent to your ",(0,Q.jsx)("strong",{children:"mobile device"})]}),l&&(0,Q.jsx)(gs,{pendingTransaction:l})]}),n&&(0,Q.jsx)(Ha,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Q.jsx)(no,{onClick:o,children:"Not now"}),(0,Q.jsx)(z,{})]});case"totp":return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:o},"header"),(0,Q.jsx)(Fe,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(k2.default,{})})}),(0,Q.jsx)(ye,{children:"Enter verification code"}),(0,Q.jsxs)(Gr,{children:[(0,Q.jsx)(ni,{success:t,disabled:r,onChange:i}),(0,Q.jsxs)(ge,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,Q.jsx)("strong",{children:"authenticator app"})]}),l&&(0,Q.jsx)(gs,{pendingTransaction:l})]}),n&&(0,Q.jsx)(Ha,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Q.jsx)(no,{onClick:o,children:"Not now"}),(0,Q.jsx)(z,{})]});default:return null}};var Ca=require("react"),R2=h(require("styled-components"));var Lt=require("react/jsx-runtime"),I2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=k(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:y,closePrivyModal:g,createAnalyticsEvent:C}=W(),[v,x]=(0,Ca.useState)(!1),[S,b]=(0,Ca.useState)(void 0),R=s()?.provider||"google",{name:A,component:O}=Ia(R),M=Ul(),I=n?.render.inDialog?Xe:0;(0,Ca.useEffect)(()=>{u(R).then(ee=>{x(!0),y(!0),ee&&M("login","onOAuthLoginComplete",ee)}).catch(ee=>{if(ee?.privyErrorCode==="allowlist_rejected"){b(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(ee?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(ee).toString()),b(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:L,detail:Y}=fm(ee,R);b({retryable:L,detail:Y,message:"Authentication failed"}),y(!1)}).finally(()=>{zn()})},[A,R]),(0,Ca.useEffect)(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let L=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(L)}if(cr(o,n?.embeddedWallets?.createOnLogin)){let L=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:Y=>{console.error(Y),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Y,provider:R,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(L)}else{let L=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I);return f(),()=>clearTimeout(L)}}},[r,e,v,o]);let V=v?`Successfully connected with ${A}`:S?S.message:`Verifying connection to ${A}`,Z="";return v?Z="You\u2019re good to go!":S?Z=S.detail:Z="Just a few moments more",(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(_,{}),(0,Lt.jsx)(se,{}),(0,Lt.jsxs)(Ew,{children:[(0,Lt.jsx)(At,{children:(0,Lt.jsxs)("div",{children:[(0,Lt.jsx)(St,{success:v,fail:!!S}),(0,Lt.jsx)(O,{style:{width:"38px",height:"38px"}})]})}),(0,Lt.jsxs)(yt,{children:[(0,Lt.jsx)("h3",{children:V}),(0,Lt.jsx)("p",{children:Z})]}),S&&S?.retryable?(0,Lt.jsx)(Li,{onClick:()=>{zn(),c(R),b(void 0)},disabled:!v&&!S?.retryable,children:"Retry"}):null]}),(0,Lt.jsx)(me,{}),(0,Lt.jsx)(z,{})]})},Ew=R2.default.div`
2319
+ `;var C2=h(require("@heroicons/react/24/outline/CalendarIcon")),w2=h(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),b2=h(require("@heroicons/react/24/outline/ShieldCheckIcon"));var qe=require("react/jsx-runtime"),E2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=W();return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_,{onClose:r},"header"),(0,qe.jsx)(At,{children:(0,qe.jsxs)("div",{children:[(0,qe.jsx)(St,{success:a,fail:!!t}),t?(0,qe.jsx)(w2.default,{style:{width:"38px",height:"38px"}}):(0,qe.jsx)(Xn,{style:{width:"38px",height:"38px"}})]})}),(0,qe.jsx)(ye,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,qe.jsxs)(jn,{children:[(0,qe.jsxs)(mr,{children:[(0,qe.jsx)(ur,{children:(0,qe.jsx)(b2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,qe.jsxs)(mr,{children:[(0,qe.jsx)(ur,{children:(0,qe.jsx)(C2.default,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,qe.jsx)(Gr,{children:(0,qe.jsx)(gs,{pendingTransaction:l})}),t&&(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Zl,{style:{marginTop:"1.25rem"},children:t.message}),(0,qe.jsx)(N,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&(0,qe.jsx)(Ha,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),(0,qe.jsx)(z,{})]})};var Q=require("react/jsx-runtime"),Op=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=(0,An.useState)(null),{init:i,cancel:a,submit:l}=la(),[s,c]=(0,An.useState)(!1),[u,f]=(0,An.useState)(!1),[y,g]=(0,An.useState)(null),[C,v]=(0,An.useState)(null);(0,An.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let x=O=>tc(O)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):gn(O)?(c(!1),new Error("The code you entered is not valid")):yn(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 S(O){v(null);try{if(!O||!o)return;await l(o,O),f(!0),c(!1),t()}catch(M){throw x(M)}}async function b(O){if(O==="passkey"){try{n(O);let M=await i(O);if(!M)throw new Error("something went wrong");g(M),await l(O,M),f(!0),c(!1),t()}catch(M){v(x(M))}return}try{n(O),await i(O)}catch(M){console.error(M)}}let R=()=>{n(null),v(null),a(),t()},A=()=>{n(null),v(null)};if(!e||!r)return null;if(o==="passkey"){let O=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,I)=>I.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return(0,Q.jsx)(E2,{account:O,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:C,onClose:R,onBack:A,handleSubmit:()=>S(y).catch(v)})}return o?(0,Q.jsx)(ww,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:S,selectedMethod:o,onClose:R,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:R},"header"),(0,Q.jsx)(Be,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(_2.default,{})})}),(0,Q.jsx)(ye,{children:"Verify your identity"}),(0,Q.jsx)(ge,{children:"Choose a verification method"}),(0,Q.jsxs)(ql,{children:[r.mfaMethods.includes("totp")&&(0,Q.jsxs)(De,{onClick:()=>b("totp"),children:[(0,Q.jsx)(P2.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,Q.jsxs)(De,{onClick:()=>b("sms"),children:[(0,Q.jsx)(S2.default,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&(0,Q.jsxs)(De,{onClick:()=>b("passkey"),children:[(0,Q.jsx)(T2.default,{}),"Passkey"]},"passkey")]}),(0,Q.jsx)(z,{})]})},ww=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=k(),{pendingTransaction:l}=W();switch(e){case"sms":return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:o},"header"),(0,Q.jsx)(Be,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(k2.default,{})})}),(0,Q.jsx)(ye,{children:"Enter verification code"}),(0,Q.jsxs)(Gr,{children:[(0,Q.jsx)(oi,{success:t,disabled:r,onChange:i}),(0,Q.jsxs)(ge,{children:["To continue, please enter the 6-digit code sent to your ",(0,Q.jsx)("strong",{children:"mobile device"})]}),l&&(0,Q.jsx)(gs,{pendingTransaction:l})]}),n&&(0,Q.jsx)(Ha,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Q.jsx)(no,{onClick:o,children:"Not now"}),(0,Q.jsx)(z,{})]});case"totp":return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{onClose:o},"header"),(0,Q.jsx)(Be,{children:(0,Q.jsx)(et,{children:(0,Q.jsx)(x2.default,{})})}),(0,Q.jsx)(ye,{children:"Enter verification code"}),(0,Q.jsxs)(Gr,{children:[(0,Q.jsx)(oi,{success:t,disabled:r,onChange:i}),(0,Q.jsxs)(ge,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,Q.jsx)("strong",{children:"authenticator app"})]}),l&&(0,Q.jsx)(gs,{pendingTransaction:l})]}),n&&(0,Q.jsx)(Ha,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Q.jsx)(no,{onClick:o,children:"Not now"}),(0,Q.jsx)(z,{})]});default:return null}};var va=require("react"),A2=h(require("styled-components"));var Lt=require("react/jsx-runtime"),R2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=k(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:y,closePrivyModal:g,createAnalyticsEvent:C}=W(),[v,x]=(0,va.useState)(!1),[S,b]=(0,va.useState)(void 0),R=s()?.provider||"google",{name:A,component:O}=Ra(R),M=Ul(),I=n?.render.inDialog?Xe:0;(0,va.useEffect)(()=>{u(R).then(ee=>{x(!0),y(!0),ee&&M("login","onOAuthLoginComplete",ee)}).catch(ee=>{if(ee?.privyErrorCode==="allowlist_rejected"){b(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(ee?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(ee).toString()),b(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:L,detail:j}=mm(ee,R);b({retryable:L,detail:j,message:"Authentication failed"}),y(!1)}).finally(()=>{Vn()})},[A,R]),(0,va.useEffect)(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let L=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(L)}if(cr(o,n?.embeddedWallets?.createOnLogin)){let L=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:j=>{console.error(j),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:j,provider:R,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(L)}else{let L=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I);return f(),()=>clearTimeout(L)}}},[r,e,v,o]);let V=v?`Successfully connected with ${A}`:S?S.message:`Verifying connection to ${A}`,Y="";return v?Y="You\u2019re good to go!":S?Y=S.detail:Y="Just a few moments more",(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(_,{}),(0,Lt.jsx)(se,{}),(0,Lt.jsxs)(bw,{children:[(0,Lt.jsx)(At,{children:(0,Lt.jsxs)("div",{children:[(0,Lt.jsx)(St,{success:v,fail:!!S}),(0,Lt.jsx)(O,{style:{width:"38px",height:"38px"}})]})}),(0,Lt.jsxs)(gt,{children:[(0,Lt.jsx)("h3",{children:V}),(0,Lt.jsx)("p",{children:Y})]}),S&&S?.retryable?(0,Lt.jsx)(Wi,{onClick:()=>{Vn(),c(R),b(void 0)},disabled:!v&&!S?.retryable,children:"Retry"}):null]}),(0,Lt.jsx)(me,{}),(0,Lt.jsx)(z,{})]})},bw=A2.default.div`
2320
2320
  display: flex;
2321
2321
  flex-direction: column;
2322
2322
  align-items: center;
@@ -2324,17 +2324,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2324
2324
  margin-left: 27px;
2325
2325
  margin-right: 27px;
2326
2326
  gap: 24px;
2327
- `;var en=require("react"),Dp=h(require("styled-components"));var Bt=require("react/jsx-runtime"),M2=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=k(),{loginWithPasskey:n,closePrivyModal:i}=W(),a=e?.render.inDialog?Xe:0,[l,s]=(0,en.useState)("loading"),[c,u]=(0,en.useState)(null),f=(0,en.useRef)([]),y=S=>{f.current=[S,...f.current]};(0,en.useEffect)(()=>()=>{f.current.forEach(S=>clearTimeout(S)),f.current=[]},[]);let g=()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},C=()=>{switch(l){case"loading":return`Please follow prompts to verify your passkey.
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 ct){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.
2327
+ `;var en=require("react"),Np=h(require("styled-components"));var Bt=require("react/jsx-runtime"),I2=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=k(),{loginWithPasskey:n,closePrivyModal:i}=W(),a=e?.render.inDialog?Xe:0,[l,s]=(0,en.useState)("loading"),[c,u]=(0,en.useState)(null),f=(0,en.useRef)([]),y=S=>{f.current=[S,...f.current]};(0,en.useEffect)(()=>()=>{f.current.forEach(S=>clearTimeout(S)),f.current=[]},[]);let g=()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},C=()=>{switch(l){case"loading":return`Please follow prompts to verify your passkey.
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 dt){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.`}},v=()=>{switch(l){case"loading":case"success":return(0,Bt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return(0,Bt.jsx)(N,{onClick:x,disabled:!1,children:"Retry"})}},x=async()=>{s("loading");try{await n(),s("success")}catch(S){u(S),s("error")}};return(0,en.useEffect)(()=>{l==="success"&&y(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),(0,en.useEffect)(()=>{x()},[]),(0,Bt.jsxs)(Bt.Fragment,{children:[(0,Bt.jsx)(_,{backFn:!t||r===t?void 0:o}),(0,Bt.jsxs)(Pw,{children:[(0,Bt.jsx)(At,{children:(0,Bt.jsxs)("div",{children:[(0,Bt.jsx)(St,{success:l==="success",fail:l==="error"}),(0,Bt.jsx)(ti,{style:{width:"38px",height:"38px"}})]})}),(0,Bt.jsxs)(yt,{children:[(0,Bt.jsx)("h3",{children:g()}),(0,Bt.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),v()]}),(0,Bt.jsx)(z,{})]})},Pw=Dp.default.div`
2330
+ You will have to sign up with another method first to register a passkey for your account.`}},v=()=>{switch(l){case"loading":case"success":return(0,Bt.jsx)(N,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return(0,Bt.jsx)(N,{onClick:x,disabled:!1,children:"Retry"})}},x=async()=>{s("loading");try{await n(),s("success")}catch(S){u(S),s("error")}};return(0,en.useEffect)(()=>{l==="success"&&y(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),(0,en.useEffect)(()=>{x()},[]),(0,Bt.jsxs)(Bt.Fragment,{children:[(0,Bt.jsx)(_,{backFn:!t||r===t?void 0:o}),(0,Bt.jsxs)(Ew,{children:[(0,Bt.jsx)(At,{children:(0,Bt.jsxs)("div",{children:[(0,Bt.jsx)(St,{success:l==="success",fail:l==="error"}),(0,Bt.jsx)(ei,{style:{width:"38px",height:"38px"}})]})}),(0,Bt.jsxs)(gt,{children:[(0,Bt.jsx)("h3",{children:g()}),(0,Bt.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),v()]}),(0,Bt.jsx)(z,{})]})},Ew=Np.default.div`
2331
2331
  display: flex;
2332
2332
  flex-direction: column;
2333
2333
  align-items: center;
2334
2334
  justify-content: center;
2335
2335
  gap: 24px;
2336
2336
  width: 100%;
2337
- `,yO=Dp.default.div`
2337
+ `,hO=Np.default.div`
2338
2338
  display: flex;
2339
2339
  align-items: center;
2340
2340
  justify-content: 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
- `;var vs=require("react"),O2=h(require("styled-components"));var W2=require("react-device-detect");var L2=(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(!ln()&&W2.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var rr=require("react/jsx-runtime"),N2=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=(0,vs.useState)(""),[i,a]=(0,vs.useState)(!1);(0,vs.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=L2(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."),(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(_,{},"header"),(0,rr.jsx)(se,{}),(0,rr.jsx)(So,{title:s.title,description:s.description}),(0,rr.jsxs)(Vr,{children:[(0,rr.jsx)(Tw,{children:(0,rr.jsx)(wo,{style:{width:"72px",height:"72px"}})}),(0,rr.jsx)(Gl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,rr.jsx)("p",{children:s.footnote}):null]}),(0,rr.jsx)(me,{}),(0,rr.jsx)($,{protectedByPrivy:!0})]})},Tw=(0,O2.default)(er)`
2353
+ `;var vs=require("react"),L2=h(require("styled-components"));var M2=require("react-device-detect");var W2=(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(!ln()&&M2.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var rr=require("react/jsx-runtime"),O2=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=(0,vs.useState)(""),[i,a]=(0,vs.useState)(!1);(0,vs.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=W2(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."),(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(_,{},"header"),(0,rr.jsx)(se,{}),(0,rr.jsx)(So,{title:s.title,description:s.description}),(0,rr.jsxs)(Vr,{children:[(0,rr.jsx)(Pw,{children:(0,rr.jsx)(wo,{style:{width:"72px",height:"72px"}})}),(0,rr.jsx)(Gl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,rr.jsx)("p",{children:s.footnote}):null]}),(0,rr.jsx)(me,{}),(0,rr.jsx)(q,{protectedByPrivy:!0})]})},Pw=(0,L2.default)(er)`
2354
2354
  margin: 16px auto;
2355
- `;var D2=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),li=require("react"),ci=h(require("styled-components"));var Ke=require("react/jsx-runtime"),U2=()=>{let[e,t]=(0,li.useState)(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=k(),[u,f]=(0,li.useState)(void 0),[y,g]=(0,li.useState)(""),[C,v]=(0,li.useState)(!1),{privyWallet:x,onCompleteNavigateTo:S,onSuccess:b,onFailure:R}=s.recoverWallet,A=(I="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),R(typeof I=="string"?new Qt(I):I)};c.current=A,(0,li.useEffect)(()=>{if(!r||!x)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let O=I=>{I&&f(I)};return(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(_,{onClose:A}),(0,Ke.jsx)(se,{}),(0,Ke.jsxs)(_w,{children:[(0,Ke.jsxs)(Sw,{children:[(0,Ke.jsx)(D2.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Ke.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,Ke.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,Ke.jsxs)("div",{children:[(0,Ke.jsxs)(bn,{children:[(0,Ke.jsx)(ji,{type:e?"password":"text",onChange:I=>O(I.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),(0,Ke.jsx)(Yi,{style:{right:"0.75rem"},children:e?(0,Ke.jsx)(Zi,{onClick:()=>t(!1)}):(0,Ke.jsx)(Ji,{onClick:()=>t(!0)})})]}),!!y&&(0,Ke.jsx)(xw,{children:y})]}),(0,Ke.jsxs)("div",{children:[(0,Ke.jsxs)(Mf,{children:[(0,Ke.jsx)("h4",{children:"Why is this necessary?"}),(0,Ke.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Ke.jsx)(kw,{loading:C||!n,disabled:!u,onClick:async()=>{v(!0);let I=await o();if(I&&x&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:x.address}}),await n?.recover({address:x.address,accessToken:I,recoveryPin:u}),g(""),S?l(S):i({shouldCallAuthOnSuccess:!1}),b?.(x),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:x.address}})}catch(V){Ch(V)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&C,children:"Recover your account"})]})]}),(0,Ke.jsx)(me,{}),(0,Ke.jsx)($,{protectedByPrivy:!0})]})},Sw=ci.default.div`
2355
+ `;var N2=h(require("@heroicons/react/24/outline/ShieldCheckIcon")),si=require("react"),li=h(require("styled-components"));var je=require("react/jsx-runtime"),D2=()=>{let[e,t]=(0,si.useState)(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=k(),[u,f]=(0,si.useState)(void 0),[y,g]=(0,si.useState)(""),[C,v]=(0,si.useState)(!1),{privyWallet:x,onCompleteNavigateTo:S,onSuccess:b,onFailure:R}=s.recoverWallet,A=(I="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),R(typeof I=="string"?new Qt(I):I)};c.current=A,(0,si.useEffect)(()=>{if(!r||!x)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let O=I=>{I&&f(I)};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(_,{onClose:A}),(0,je.jsx)(se,{}),(0,je.jsxs)(Sw,{children:[(0,je.jsxs)(Tw,{children:[(0,je.jsx)(N2.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,je.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,je.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,je.jsxs)("div",{children:[(0,je.jsxs)(wn,{children:[(0,je.jsx)(Ki,{type:e?"password":"text",onChange:I=>O(I.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),(0,je.jsx)(ji,{style:{right:"0.75rem"},children:e?(0,je.jsx)(Yi,{onClick:()=>t(!1)}):(0,je.jsx)(Zi,{onClick:()=>t(!0)})})]}),!!y&&(0,je.jsx)(_w,{children:y})]}),(0,je.jsxs)("div",{children:[(0,je.jsxs)(If,{children:[(0,je.jsx)("h4",{children:"Why is this necessary?"}),(0,je.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,je.jsx)(xw,{loading:C||!n,disabled:!u,onClick:async()=>{v(!0);let I=await o();if(I&&x&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:x.address}}),await n?.recover({address:x.address,accessToken:I,recoveryPin:u}),g(""),S?l(S):i({shouldCallAuthOnSuccess:!1}),b?.(x),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:x.address}})}catch(V){vh(V)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&C,children:"Recover your account"})]})]}),(0,je.jsx)(me,{}),(0,je.jsx)(q,{protectedByPrivy:!0})]})},Tw=li.default.div`
2356
2356
  display: flex;
2357
2357
  flex-direction: column;
2358
2358
  align-items: center;
@@ -2374,45 +2374,45 @@ You will have to sign up with another method first to register a passkey for you
2374
2374
  font-weight: 400;
2375
2375
  line-height: 20px;
2376
2376
  }
2377
- `,_w=ci.default.div`
2377
+ `,Sw=li.default.div`
2378
2378
  display: flex;
2379
2379
  flex-direction: column;
2380
2380
  justify-content: space-between;
2381
- `,xw=ci.default.div`
2381
+ `,_w=li.default.div`
2382
2382
  line-height: 20px;
2383
2383
  height: 20px;
2384
2384
  font-size: 13px;
2385
2385
  color: var(--privy-color-error);
2386
2386
  text-align: left;
2387
2387
  margin-top: 0.5rem;
2388
- `,kw=(0,ci.default)(N)`
2389
- ${e=>e.hideAnimations&&ci.css`
2388
+ `,xw=(0,li.default)(N)`
2389
+ ${e=>e.hideAnimations&&li.css`
2390
2390
  && {
2391
2391
  // Remove animations because the recoverWallet task on the iframe partially
2392
2392
  // blocks the renderer, so the animation stutters and doesn't look good
2393
2393
  transition: none;
2394
2394
  }
2395
2395
  `}
2396
- `;var tn=require("react");var In=require("react/jsx-runtime"),jc=e=>(0,In.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[(0,In.jsx)("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),(0,In.jsx)("defs",{children:(0,In.jsxs)("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[(0,In.jsx)("stop",{stopColor:"#3E82F4"}),(0,In.jsx)("stop",{offset:1,stopColor:"#93DCF7"})]})})]});var Lr=require("react/jsx-runtime"),Yc=({style:e,...t})=>(0,Lr.jsxs)("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,Lr.jsxs)("g",{clipPath:"url(#clip0_2115_829)",children:[(0,Lr.jsx)("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),(0,Lr.jsx)("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),(0,Lr.jsx)("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),(0,Lr.jsx)("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),(0,Lr.jsx)("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),(0,Lr.jsx)("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),(0,Lr.jsx)("defs",{children:(0,Lr.jsx)("clipPath",{id:"clip0_2115_829",children:(0,Lr.jsx)("rect",{width:"16",height:"14",fill:"white"})})})]});var Up=h(require("styled-components")),Cs=Up.default.div`
2396
+ `;var tn=require("react");var Rn=require("react/jsx-runtime"),jc=e=>(0,Rn.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[(0,Rn.jsx)("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),(0,Rn.jsx)("defs",{children:(0,Rn.jsxs)("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[(0,Rn.jsx)("stop",{stopColor:"#3E82F4"}),(0,Rn.jsx)("stop",{offset:1,stopColor:"#93DCF7"})]})})]});var Lr=require("react/jsx-runtime"),Yc=({style:e,...t})=>(0,Lr.jsxs)("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,Lr.jsxs)("g",{clipPath:"url(#clip0_2115_829)",children:[(0,Lr.jsx)("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),(0,Lr.jsx)("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),(0,Lr.jsx)("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),(0,Lr.jsx)("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),(0,Lr.jsx)("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),(0,Lr.jsx)("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),(0,Lr.jsx)("defs",{children:(0,Lr.jsx)("clipPath",{id:"clip0_2115_829",children:(0,Lr.jsx)("rect",{width:"16",height:"14",fill:"white"})})})]});var Dp=h(require("styled-components")),Cs=Dp.default.div`
2397
2397
  display: flex;
2398
2398
  flex-direction: column;
2399
2399
  gap: 12px;
2400
2400
  padding-top: 24px;
2401
2401
  padding-bottom: 24px;
2402
- `,F2=Up.default.div`
2402
+ `,U2=Dp.default.div`
2403
2403
  padding-bottom: 24px;
2404
- `;var Ht=require("react/jsx-runtime"),B2={"google-drive":{name:"Google Drive",component:Yc},icloud:{name:"iCloud",component:jc}},H2=()=>{let{logout:e}=H(),{navigate:t,setModalData:r,data:o}=k(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),[l,s]=(0,tn.useState)(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[y,g]=(0,tn.useState)(void 0),[C,v]=(0,tn.useState)(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let x=B2[c].name,S=B2[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,R=new ot(async(ee="create-wallet")=>(v(!0),new Promise((L,Y)=>{setTimeout(async()=>{try{let D=window.open();await n(c,ee,D),s(!0),L()}catch{g({message:`${ee==="recover"?"Recovery":"Back up"} with ${x} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${x} account associated with your backup.`:"",retryable:!0}),Y()}},0)})));(0,tn.useEffect)(()=>{u==="create-wallet"&&R.execute("create-wallet")},[]),(0,tn.useEffect)(()=>{if(!l)return;let ee=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:L=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:L,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Xe);return()=>clearTimeout(ee)},[l]);let A=(0,tn.useCallback)(async()=>{await R.execute("recover"),b?t(b):s(!0)},[]),O=c==="google-drive"?"Google Drive":"Apple iCloud",M=u==="recover"?"recovered":"backed up",I=u==="recover"?"Recovering":"Backing up",V=l&&`Successfully ${M} with ${O}.`||y&&y.message||`${I} with ${O}...`,Z=y?y.detail:"";return(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(_,{}),C?(0,Ht.jsx)(Ht.Fragment,{children:(0,Ht.jsxs)(Cs,{children:[(0,Ht.jsx)(Be,{title:V,icon:(0,Ht.jsx)(S,{style:{width:"38px",height:"38px"}}),description:Z}),y&&y?.retryable?(0,Ht.jsx)(N,{onClick:()=>{zn(),g(void 0),u==="create-wallet"?R.execute("create-wallet"):A()},disabled:!l&&!y?.retryable,children:"Try again"}):null]})}):(0,Ht.jsxs)(Cs,{children:[(0,Ht.jsx)(Be,{title:"Confirm it's really you",icon:(0,Ht.jsx)(S,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${O} where your account is backed up.`}),(0,Ht.jsxs)(N,{onClick:A,children:["Confirm with ",O]})]}),(0,Ht.jsx)($,{protectedByPrivy:!0})]})};var rn=require("react");var V2=require("react/jsx-runtime"),G2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=k(),[n,i]=(0,rn.useState)(""),[a,l]=(0,rn.useState)(!1),[s,c]=(0,rn.useState)(),[u,f]=(0,rn.useState)(null),{authenticated:y}=H(),{closePrivyModal:g,isNewUserThisSession:C,initializeWalletProxy:v}=W(),{onSuccess:x,onFailure:S,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:R}=ac(),[A,O]=(0,rn.useState)(null),M=new ot(async()=>{try{let Z=await R(s);if(!Z)return;O(Z),C?t("EMBEDDED_WALLET_CREATED_SCREEN"):(x(Z),g({shouldCallAuthOnSuccess:b}))}catch(Z){i(Z.message)}});(0,rn.useEffect)(()=>{u||v(3e4).then(Z=>f(Z))},[u]),(0,rn.useEffect)(()=>{if(!y){t("LANDING"),S(new Error("User must be authenticated before creating a Privy wallet"));return}},[y]);let I=()=>{A&&A?.recoveryMethod!=="user-passcode"?(S(new Qt("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):A?(x(A),g({shouldCallAuthOnSuccess:b})):(S(new Qt("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let V=async()=>{l(!0);let Z=250;return M.execute().then(()=>new Promise(ee=>setTimeout(ee,Z))).finally(()=>l(!1))};return(0,V2.jsx)(cc,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!A&&a,error:n,password:s||"",onClose:I,onPasswordChange:c,onPasswordGenerate:()=>c(lc()),onSubmit:V})};var z2=h(require("@heroicons/react/24/outline/LockClosedIcon")),q2=h(require("@heroicons/react/24/outline/PencilSquareIcon")),$2=h(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),K2=require("react"),j2=h(require("styled-components"));var _e=require("react/jsx-runtime"),Fp=j2.default.div`
2404
+ `;var Ht=require("react/jsx-runtime"),F2={"google-drive":{name:"Google Drive",component:Yc},icloud:{name:"iCloud",component:jc}},B2=()=>{let{logout:e}=H(),{navigate:t,setModalData:r,data:o}=k(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),[l,s]=(0,tn.useState)(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[y,g]=(0,tn.useState)(void 0),[C,v]=(0,tn.useState)(u==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let x=F2[c].name,S=F2[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,R=new ot(async(ee="create-wallet")=>(v(!0),new Promise((L,j)=>{setTimeout(async()=>{try{let D=window.open();await n(c,ee,D),s(!0),L()}catch{g({message:`${ee==="recover"?"Recovery":"Back up"} with ${x} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${x} account associated with your backup.`:"",retryable:!0}),j()}},0)})));(0,tn.useEffect)(()=>{u==="create-wallet"&&R.execute("create-wallet")},[]),(0,tn.useEffect)(()=>{if(!l)return;let ee=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:L=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:L,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Xe);return()=>clearTimeout(ee)},[l]);let A=(0,tn.useCallback)(async()=>{await R.execute("recover"),b?t(b):s(!0)},[]),O=c==="google-drive"?"Google Drive":"Apple iCloud",M=u==="recover"?"recovered":"backed up",I=u==="recover"?"Recovering":"Backing up",V=l&&`Successfully ${M} with ${O}.`||y&&y.message||`${I} with ${O}...`,Y=y?y.detail:"";return(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(_,{}),C?(0,Ht.jsx)(Ht.Fragment,{children:(0,Ht.jsxs)(Cs,{children:[(0,Ht.jsx)(He,{title:V,icon:(0,Ht.jsx)(S,{style:{width:"38px",height:"38px"}}),description:Y}),y&&y?.retryable?(0,Ht.jsx)(N,{onClick:()=>{Vn(),g(void 0),u==="create-wallet"?R.execute("create-wallet"):A()},disabled:!l&&!y?.retryable,children:"Try again"}):null]})}):(0,Ht.jsxs)(Cs,{children:[(0,Ht.jsx)(He,{title:"Confirm it's really you",icon:(0,Ht.jsx)(S,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${O} where your account is backed up.`}),(0,Ht.jsxs)(N,{onClick:A,children:["Confirm with ",O]})]}),(0,Ht.jsx)(q,{protectedByPrivy:!0})]})};var rn=require("react");var G2=require("react/jsx-runtime"),H2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=k(),[n,i]=(0,rn.useState)(""),[a,l]=(0,rn.useState)(!1),[s,c]=(0,rn.useState)(),[u,f]=(0,rn.useState)(null),{authenticated:y}=H(),{closePrivyModal:g,isNewUserThisSession:C,initializeWalletProxy:v}=W(),{onSuccess:x,onFailure:S,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:R}=ac(),[A,O]=(0,rn.useState)(null),M=new ot(async()=>{try{let Y=await R(s);if(!Y)return;O(Y),C?t("EMBEDDED_WALLET_CREATED_SCREEN"):(x(Y),g({shouldCallAuthOnSuccess:b}))}catch(Y){i(Y.message)}});(0,rn.useEffect)(()=>{u||v(3e4).then(Y=>f(Y))},[u]),(0,rn.useEffect)(()=>{if(!y){t("LANDING"),S(new Error("User must be authenticated before creating a Privy wallet"));return}},[y]);let I=()=>{A&&A?.recoveryMethod!=="user-passcode"?(S(new Qt("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):A?(x(A),g({shouldCallAuthOnSuccess:b})):(S(new Qt("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let V=async()=>{l(!0);let Y=250;return M.execute().then(()=>new Promise(ee=>setTimeout(ee,Y))).finally(()=>l(!1))};return(0,G2.jsx)(cc,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!A&&a,error:n,password:s||"",onClose:I,onPasswordChange:c,onPasswordGenerate:()=>c(lc()),onSubmit:V})};var V2=h(require("@heroicons/react/24/outline/LockClosedIcon")),z2=h(require("@heroicons/react/24/outline/PencilSquareIcon")),q2=h(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),$2=require("react"),K2=h(require("styled-components"));var xe=require("react/jsx-runtime"),Up=K2.default.div`
2405
2405
  width: 24px;
2406
2406
  height: 24px;
2407
2407
  display: flex;
2408
2408
  justify-content: center;
2409
2409
  align-items: center;
2410
- `,Aw=({onClose:e})=>(0,_e.jsxs)(F2,{children:[(0,_e.jsx)(Be,{title:"Why do I need to secure my account?",icon:(0,_e.jsx)($2.default,{width:48}),description:(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),(0,_e.jsx)("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."})]})}),(0,_e.jsx)(N,{onClick:e,children:"Select backup method"})]}),Y2=()=>{let[e,t]=(0,K2.useState)(!1),{navigate:r,setModalData:o,data:n}=k(),{user:i}=H(),{embeddedWallets:a}=dr(),s=Ue(i)===null;function c(u){o({recoveryOAuthStatus:{provider:u,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:!!n?.recoverySelection?.isInAccountCreateFlow}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)(_,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?(0,_e.jsx)(Aw,{onClose:()=>t(!1)}):(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)(Be,{title:"Secure your account",icon:(0,_e.jsx)(z2.default,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),(0,_e.jsx)(Cs,{children:a.userOwnedRecoveryOptions.sort().map(u=>{switch(u){case"google-drive":return(0,_e.jsxs)(Ne,{onClick:()=>c("google-drive"),children:[(0,_e.jsx)(Fp,{children:(0,_e.jsx)(Yc,{style:{width:18}})}),"Back up to Google Drive"]},u);case"icloud":return(0,_e.jsxs)(Ne,{onClick:()=>c("icloud"),children:[(0,_e.jsx)(Fp,{children:(0,_e.jsx)(jc,{style:{width:24}})}),"Back up to Apple iCloud"]},u);case"user-passcode":return(0,_e.jsxs)(Ne,{onClick:()=>{r(s?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[(0,_e.jsx)(Fp,{children:(0,_e.jsx)(q2.default,{style:{width:18}})}),"Set a password"]},u);default:return null}})})]}),(0,_e.jsx)($,{protectedByPrivy:!0})]})};var Bp=require("@ethersproject/bignumber"),vt=require("react"),di=h(require("styled-components"));function Z2(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var wa=require("@heroicons/react/24/outline"),r3=require("react"),Cr=h(require("styled-components"));var ws=require("@ethersproject/logger"),Rw=new Set([ws.ErrorCode.CALL_EXCEPTION,ws.ErrorCode.NONCE_EXPIRED,ws.ErrorCode.REPLACEMENT_UNDERPRICED,ws.ErrorCode.TRANSACTION_REPLACED]),J2=e=>{let t;return e.code&&e.code!==-32e3&&Rw.has(e.code)&&(t=e.transactionHash),t},Q2=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";var qe=require("react/jsx-runtime"),Iw=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=J2(e),o=Q2(e);return{errorCode:t,transactionHash:r,errorMessage:o}},Mw=()=>(0,qe.jsxs)(Nw,{children:[(0,qe.jsx)(Uw,{}),(0,qe.jsx)(Dw,{})]}),o3=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=W(),[i,a]=(0,r3.useState)(!1),{errorCode:l,transactionHash:s,errorMessage:c}=Iw(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_,{onClose:r}),(0,qe.jsxs)(Ww,{children:[(0,qe.jsx)(Mw,{}),(0,qe.jsx)(Lw,{children:l}),(0,qe.jsx)(Ow,{children:"Please try again."}),(0,qe.jsxs)(e3,{children:[(0,qe.jsx)(X2,{children:"Error message"}),(0,qe.jsx)(t3,{clickable:!1,children:c})]}),s&&(0,qe.jsxs)(e3,{children:[(0,qe.jsx)(X2,{children:"Transaction hash"}),(0,qe.jsxs)(Bw,{children:["Copy this hash to view details about the transaction on a"," ",(0,qe.jsx)("u",{children:(0,qe.jsx)("a",{href:u,children:"block explorer"})}),"."]}),(0,qe.jsxs)(t3,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,(0,qe.jsx)(Vw,{clicked:i})]})]}),(0,qe.jsx)(Fw,{onClick:o,children:"Retry transaction"})]}),(0,qe.jsx)(z,{})]})},Ww=Cr.default.div`
2410
+ `,kw=({onClose:e})=>(0,xe.jsxs)(U2,{children:[(0,xe.jsx)(He,{title:"Why do I need to secure my account?",icon:(0,xe.jsx)(q2.default,{width:48}),description:(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),(0,xe.jsx)("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."})]})}),(0,xe.jsx)(N,{onClick:e,children:"Select backup method"})]}),j2=()=>{let[e,t]=(0,$2.useState)(!1),{navigate:r,setModalData:o,data:n}=k(),{user:i}=H(),{embeddedWallets:a}=dr(),s=Fe(i)===null;function c(u){o({recoveryOAuthStatus:{provider:u,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:!!n?.recoverySelection?.isInAccountCreateFlow}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(_,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?(0,xe.jsx)(kw,{onClose:()=>t(!1)}):(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(He,{title:"Secure your account",icon:(0,xe.jsx)(V2.default,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),(0,xe.jsx)(Cs,{children:a.userOwnedRecoveryOptions.sort().map(u=>{switch(u){case"google-drive":return(0,xe.jsxs)(De,{onClick:()=>c("google-drive"),children:[(0,xe.jsx)(Up,{children:(0,xe.jsx)(Yc,{style:{width:18}})}),"Back up to Google Drive"]},u);case"icloud":return(0,xe.jsxs)(De,{onClick:()=>c("icloud"),children:[(0,xe.jsx)(Up,{children:(0,xe.jsx)(jc,{style:{width:24}})}),"Back up to Apple iCloud"]},u);case"user-passcode":return(0,xe.jsxs)(De,{onClick:()=>{r(s?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[(0,xe.jsx)(Up,{children:(0,xe.jsx)(z2.default,{style:{width:18}})}),"Set a password"]},u);default:return null}})})]}),(0,xe.jsx)(q,{protectedByPrivy:!0})]})};var Fp=require("@ethersproject/bignumber"),Ct=require("react"),ci=h(require("styled-components"));function Y2(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var Ca=require("@heroicons/react/24/outline"),t3=require("react"),Cr=h(require("styled-components"));var ws=require("@ethersproject/logger"),Aw=new Set([ws.ErrorCode.CALL_EXCEPTION,ws.ErrorCode.NONCE_EXPIRED,ws.ErrorCode.REPLACEMENT_UNDERPRICED,ws.ErrorCode.TRANSACTION_REPLACED]),Z2=e=>{let t;return e.code&&e.code!==-32e3&&Aw.has(e.code)&&(t=e.transactionHash),t},J2=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";var $e=require("react/jsx-runtime"),Rw=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=Z2(e),o=J2(e);return{errorCode:t,transactionHash:r,errorMessage:o}},Iw=()=>(0,$e.jsxs)(Ow,{children:[(0,$e.jsx)(Dw,{}),(0,$e.jsx)(Nw,{})]}),r3=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=W(),[i,a]=(0,t3.useState)(!1),{errorCode:l,transactionHash:s,errorMessage:c}=Rw(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(_,{onClose:r}),(0,$e.jsxs)(Mw,{children:[(0,$e.jsx)(Iw,{}),(0,$e.jsx)(Ww,{children:l}),(0,$e.jsx)(Lw,{children:"Please try again."}),(0,$e.jsxs)(X2,{children:[(0,$e.jsx)(Q2,{children:"Error message"}),(0,$e.jsx)(e3,{clickable:!1,children:c})]}),s&&(0,$e.jsxs)(X2,{children:[(0,$e.jsx)(Q2,{children:"Transaction hash"}),(0,$e.jsxs)(Fw,{children:["Copy this hash to view details about the transaction on a"," ",(0,$e.jsx)("u",{children:(0,$e.jsx)("a",{href:u,children:"block explorer"})}),"."]}),(0,$e.jsxs)(e3,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,(0,$e.jsx)(Gw,{clicked:i})]})]}),(0,$e.jsx)(Uw,{onClick:o,children:"Retry transaction"})]}),(0,$e.jsx)(z,{})]})},Mw=Cr.default.div`
2411
2411
  display: flex;
2412
2412
  flex-direction: column;
2413
2413
  align-items: center;
2414
2414
  justify-content: center;
2415
- `,Lw=Cr.default.span`
2415
+ `,Ww=Cr.default.span`
2416
2416
  color: var(--privy-color-foreground);
2417
2417
  text-align: center;
2418
2418
  font-size: 1.125rem;
@@ -2420,7 +2420,7 @@ You will have to sign up with another method first to register a passkey for you
2420
2420
  line-height: 1.25rem; /* 111.111% */
2421
2421
  text-align: center;
2422
2422
  margin: 10px;
2423
- `,Ow=Cr.default.span`
2423
+ `,Lw=Cr.default.span`
2424
2424
  margin-top: 4px;
2425
2425
  margin-bottom: 10px;
2426
2426
  color: var(--privy-color-foreground-3);
@@ -2431,7 +2431,7 @@ You will have to sign up with another method first to register a passkey for you
2431
2431
  font-weight: 400;
2432
2432
  line-height: 20px; /* 142.857% */
2433
2433
  letter-spacing: -0.008px;
2434
- `,Nw=Cr.default.div`
2434
+ `,Ow=Cr.default.div`
2435
2435
  position: relative;
2436
2436
  width: 60px;
2437
2437
  height: 60px;
@@ -2439,37 +2439,37 @@ You will have to sign up with another method first to register a passkey for you
2439
2439
  display: flex;
2440
2440
  justify-content: center;
2441
2441
  align-items: center;
2442
- `,Dw=(0,Cr.default)(wa.ExclamationCircleIcon)`
2442
+ `,Nw=(0,Cr.default)(Ca.ExclamationCircleIcon)`
2443
2443
  position: absolute;
2444
2444
  width: 35px;
2445
2445
  height: 35px;
2446
2446
  color: var(--privy-color-error);
2447
- `,Uw=Cr.default.div`
2447
+ `,Dw=Cr.default.div`
2448
2448
  position: absolute;
2449
2449
  width: 60px;
2450
2450
  height: 60px;
2451
2451
  border-radius: 50%;
2452
2452
  background-color: var(--privy-color-error);
2453
2453
  opacity: 0.1;
2454
- `,Fw=(0,Cr.default)(N)`
2454
+ `,Uw=(0,Cr.default)(N)`
2455
2455
  && {
2456
2456
  margin-top: 24px;
2457
2457
  }
2458
2458
  transition: color 350ms ease, background-color 350ms ease;
2459
- `,X2=Cr.default.span`
2459
+ `,Q2=Cr.default.span`
2460
2460
  width: 100%;
2461
2461
  text-align: left;
2462
2462
  font-size: 0.825rem;
2463
2463
  color: var(--privy-color-foreground);
2464
2464
  padding: 4px;
2465
- `,e3=Cr.default.div`
2465
+ `,X2=Cr.default.div`
2466
2466
  width: 100%;
2467
2467
  margin: 5px;
2468
2468
  display: flex;
2469
2469
  flex-direction: column;
2470
2470
  justify-content: center;
2471
2471
  align-items: center;
2472
- `,Bw=Cr.default.text`
2472
+ `,Fw=Cr.default.text`
2473
2473
  position: relative;
2474
2474
  width: 100%;
2475
2475
  padding: 5px;
@@ -2477,7 +2477,7 @@ You will have to sign up with another method first to register a passkey for you
2477
2477
  color: var(--privy-color-foreground-3);
2478
2478
  text-align: left;
2479
2479
  word-wrap: break-word;
2480
- `,t3=Cr.default.span`
2480
+ `,e3=Cr.default.span`
2481
2481
  position: relative;
2482
2482
  width: 100%;
2483
2483
  background-color: var(--privy-color-background-2);
@@ -2495,65 +2495,65 @@ You will have to sign up with another method first to register a passkey for you
2495
2495
  &:hover {
2496
2496
  background-color: var(--privy-color-foreground-4);
2497
2497
  }`}
2498
- `,Hw=(0,Cr.default)(wa.ClipboardDocumentIcon)`
2498
+ `,Bw=(0,Cr.default)(Ca.ClipboardDocumentIcon)`
2499
2499
  position: absolute;
2500
2500
  top: 13px;
2501
2501
  right: 13px;
2502
2502
  width: 24px;
2503
2503
  height: 24px;
2504
- `,Gw=(0,Cr.default)(wa.ClipboardDocumentCheckIcon)`
2504
+ `,Hw=(0,Cr.default)(Ca.ClipboardDocumentCheckIcon)`
2505
2505
  position: absolute;
2506
2506
  top: 13px;
2507
2507
  right: 13px;
2508
2508
  width: 24px;
2509
2509
  height: 24px;
2510
- `,Vw=({clicked:e})=>e?(0,qe.jsx)(Gw,{}):(0,qe.jsx)(Hw,{});var Zc=require("@ethersproject/bignumber"),n3=h(require("styled-components"));var No=require("react/jsx-runtime"),zw=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Zc.BigNumber.from(e.gasUsed),o=Zc.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Zc.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},i3=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>(0,No.jsxs)(No.Fragment,{children:[(0,No.jsx)(_,{onClose:o}),(0,No.jsx)(Ga,{title:l??"Transaction complete!",description:s??"You're all set."}),(0,No.jsx)(ua,{tokenPrice:n,from:t.from,to:t.to,gas:zw(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),(0,No.jsx)(qw,{loading:!1,onClick:o,children:"All Done"}),(0,No.jsx)(z,{})]}),qw=(0,n3.default)(N)`
2510
+ `,Gw=({clicked:e})=>e?(0,$e.jsx)(Hw,{}):(0,$e.jsx)(Bw,{});var Zc=require("@ethersproject/bignumber"),o3=h(require("styled-components"));var No=require("react/jsx-runtime"),Vw=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Zc.BigNumber.from(e.gasUsed),o=Zc.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Zc.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},n3=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>(0,No.jsxs)(No.Fragment,{children:[(0,No.jsx)(_,{onClose:o}),(0,No.jsx)(Ga,{title:l??"Transaction complete!",description:s??"You're all set."}),(0,No.jsx)(pa,{tokenPrice:n,from:t.from,to:t.to,gas:Vw(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),(0,No.jsx)(zw,{loading:!1,onClick:o,children:"All Done"}),(0,No.jsx)(z,{})]}),zw=(0,o3.default)(N)`
2511
2511
  && {
2512
2512
  margin-top: 24px;
2513
2513
  }
2514
2514
  transition: color 350ms ease, background-color 350ms ease;
2515
- `;var Me=require("react/jsx-runtime");var $w=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,Me.jsx)(_p,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,Me.jsx)(_p,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,Me.jsx)(Me.Fragment,{children:(0,Me.jsx)(n2,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},s3=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=va(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=W(),{app:u,navigate:f,data:y,onUserCloseViaDialogOrKeybindRef:g,setModalData:C}=k(),{transactionRequest:v,onSuccess:x,onFailure:S,uiOptions:b,fundWalletConfig:R}=y.sendTransaction,[A,O]=(0,vt.useState)(null),[M,I]=(0,vt.useState)(null),[V,Z]=(0,vt.useState)(""),[ee,L]=(0,vt.useState)(),[Y,D]=(0,vt.useState)(),[be,ve]=(0,vt.useState)(!1),Ce=()=>{Z(""),L(void 0),D(void 0)},Le=(Gt,Pr,Jr)=>{Z(Gt),L(new nt(new _r(Pr??Gt,Jr??Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ce,Jt]=(0,vt.useState)(!1),[Ct,nr]=(0,vt.useState)(!0),[Et,Nr]=(0,vt.useState)(null),[je,ft]=(0,vt.useState)(v),{tokenPrice:Dr,isTokenPriceLoading:ir}=$c(je),st=s(v.chainId)||"ETH",[U,Ln]=(0,vt.useState)(null),[Oe,ie]=(0,vt.useState)(null),[ae,xe]=(0,vt.useState)(!0);(0,vt.useEffect)(()=>{e||(f("LANDING"),S(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let rt=(0,vt.useMemo)(()=>r.find(Gt=>Gt.walletClientType==="privy"),[r]),rd=async()=>{if(!rt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Gt,externalTransactionId:Pr}=await i(rt.address,{config:R?.config||{}});C({fiatOnRampPrompt:{signedUrl:Gt},fiatOnRampStatus:{externalTransactionId:Pr}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},pi=(0,vt.useMemo)(()=>Uo(je.chainId,l,a,{appId:c}),[je.chainId,a]);async function ui(){let Gt=je;if(!await t()||!o||!rt)return;try{Gt=await ya(rt.address,je,pi),ft(Gt)}catch(Do){console.error(Do),Le("There was an error preparing your transaction. Your transaction request will likely fail.",Do.reason)}let Jr=Bp.BigNumber.from(0),Nn=Bp.BigNumber.from(0);try{({totalGasEstimate:Jr,l1ExecutionFeeEstimate:Nn}=await ha(Gt,pi)),Ln(Jr.toHexString()),ie(Nn.toHexString())}catch{Ln(null)}try{let{balance:Do,hasSufficientFunds:Ss}=await zc(rt.address,Gt,Jr,pi);Nr(Do.toHexString()),Ss||(nr(!1),Le("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ve(!0))}catch(Do){console.warn(`Failed to fetch wallet balance with error: ${Do}`)}xe(!1)}(0,vt.useEffect)(()=>{ui()},[o]);let On=Z2(je),od=On==="SEND"?`Send ${st}`:"Review transaction",lt={modalTitle:b.header||b.modalTitle||od,buttonText:b.buttonText||"Submit"},an=()=>{ce||(M?x(M):S(ee||new nt(new _r("The user rejected the request",Dt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=an,Dr===void 0&&ir||ae?(0,Me.jsxs)(Me.Fragment,{children:[b.transactionInfo?.contractInfo?.imgUrl&&(0,Me.jsx)(hl,{src:b.transactionInfo?.contractInfo?.imgUrl}),(0,Me.jsx)(_,{title:lt.modalTitle,onClose:an}),(0,Me.jsx)(a3,{children:(0,Me.jsx)(zi,{})})]}):A!==null?(0,Me.jsx)(i3,{txn:je,onClose:an,receipt:A,transactionInfo:b.transactionInfo,tokenPrice:Dr,tokenSymbol:st,l1GasEstimate:Oe,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):Y?(0,Me.jsx)(o3,{transactionError:Y,chainId:je.chainId,onClose:an,onRetry:()=>{Ce(),ui()}}):(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(_,{title:lt.modalTitle,onClose:an}),(0,Me.jsxs)(a3,{children:[(0,Me.jsxs)(Zw,{children:[(0,Me.jsx)($w,{txn:je,txnFamily:On,uiOptions:b,tokenSymbol:st,tokenPrice:Dr}),rt?(0,Me.jsx)(ua,{from:rt.address,to:je.to,txn:je,transactionInfo:b.transactionInfo,gas:U||void 0,tokenPrice:Dr,tokenSymbol:st}):null]}),(0,Me.jsxs)(Jw,{children:[(0,Me.jsx)(Kw,{children:V}),(0,Me.jsx)(r2,{txn:je,address:rt?.address??"",hasFunds:Ct,balance:Et}),(0,Me.jsxs)(jw,{children:[be&&(0,Me.jsx)(N,{onClick:rd,children:"Add Funds"}),(0,Me.jsx)(Yw,{disabled:ce||!Ct,loading:!o||ce,loadingText:ce?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Jt(!0);let Gt=await t();if(Gt&&!ce&&rt)try{let Pr=await Vc(Gt,rt.address,o,je,pi);I(Pr);let Jr=await Pr.wait();O(qc(Jr)),Ce()}catch(Pr){console.warn({transaction:je,error:Pr}),D(Pr),L(new nt(new _r(Pr.reason??"Error processing transaction",Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Jt(!1)}},children:lt.buttonText})]})]})]})]})},a3=di.default.div`
2515
+ `;var We=require("react/jsx-runtime");var qw=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,We.jsx)(Sp,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,We.jsx)(Sp,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,We.jsx)(We.Fragment,{children:(0,We.jsx)(o2,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},a3=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=ga(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=W(),{app:u,navigate:f,data:y,onUserCloseViaDialogOrKeybindRef:g,setModalData:C}=k(),{transactionRequest:v,onSuccess:x,onFailure:S,uiOptions:b,fundWalletConfig:R}=y.sendTransaction,[A,O]=(0,Ct.useState)(null),[M,I]=(0,Ct.useState)(null),[V,Y]=(0,Ct.useState)(""),[ee,L]=(0,Ct.useState)(),[j,D]=(0,Ct.useState)(),[be,ve]=(0,Ct.useState)(!1),Ce=()=>{Y(""),L(void 0),D(void 0)},Oe=(Gt,Pr,Jr)=>{Y(Gt),L(new nt(new _r(Pr??Gt,Jr??Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ce,Zt]=(0,Ct.useState)(!1),[wt,nr]=(0,Ct.useState)(!0),[Pt,Nr]=(0,Ct.useState)(null),[Ye,ht]=(0,Ct.useState)(v),{tokenPrice:Dr,isTokenPriceLoading:ir}=$c(Ye),st=s(v.chainId)||"ETH",[U,Wn]=(0,Ct.useState)(null),[Ne,ie]=(0,Ct.useState)(null),[ae,ke]=(0,Ct.useState)(!0);(0,Ct.useEffect)(()=>{e||(f("LANDING"),S(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let rt=(0,Ct.useMemo)(()=>r.find(Gt=>Gt.walletClientType==="privy"),[r]),rd=async()=>{if(!rt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Gt,externalTransactionId:Pr}=await i(rt.address,{config:R?.config||{}});C({fiatOnRampPrompt:{signedUrl:Gt},fiatOnRampStatus:{externalTransactionId:Pr}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},di=(0,Ct.useMemo)(()=>Uo(Ye.chainId,l,a,{appId:c}),[Ye.chainId,a]);async function pi(){let Gt=Ye;if(!await t()||!o||!rt)return;try{Gt=await ha(rt.address,Ye,di),ht(Gt)}catch(Do){console.error(Do),Oe("There was an error preparing your transaction. Your transaction request will likely fail.",Do.reason)}let Jr=Fp.BigNumber.from(0),On=Fp.BigNumber.from(0);try{({totalGasEstimate:Jr,l1ExecutionFeeEstimate:On}=await fa(Gt,di)),Wn(Jr.toHexString()),ie(On.toHexString())}catch{Wn(null)}try{let{balance:Do,hasSufficientFunds:Ss}=await zc(rt.address,Gt,Jr,di);Nr(Do.toHexString()),Ss||(nr(!1),Oe("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ve(!0))}catch(Do){console.warn(`Failed to fetch wallet balance with error: ${Do}`)}ke(!1)}(0,Ct.useEffect)(()=>{pi()},[o]);let Ln=Y2(Ye),od=Ln==="SEND"?`Send ${st}`:"Review transaction",lt={modalTitle:b.header||b.modalTitle||od,buttonText:b.buttonText||"Submit"},an=()=>{ce||(M?x(M):S(ee||new nt(new _r("The user rejected the request",Dt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=an,Dr===void 0&&ir||ae?(0,We.jsxs)(We.Fragment,{children:[b.transactionInfo?.contractInfo?.imgUrl&&(0,We.jsx)(hl,{src:b.transactionInfo?.contractInfo?.imgUrl}),(0,We.jsx)(_,{title:lt.modalTitle,onClose:an}),(0,We.jsx)(i3,{children:(0,We.jsx)(Vi,{})})]}):A!==null?(0,We.jsx)(n3,{txn:Ye,onClose:an,receipt:A,transactionInfo:b.transactionInfo,tokenPrice:Dr,tokenSymbol:st,l1GasEstimate:Ne,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):j?(0,We.jsx)(r3,{transactionError:j,chainId:Ye.chainId,onClose:an,onRetry:()=>{Ce(),pi()}}):(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(_,{title:lt.modalTitle,onClose:an}),(0,We.jsxs)(i3,{children:[(0,We.jsxs)(Yw,{children:[(0,We.jsx)(qw,{txn:Ye,txnFamily:Ln,uiOptions:b,tokenSymbol:st,tokenPrice:Dr}),rt?(0,We.jsx)(pa,{from:rt.address,to:Ye.to,txn:Ye,transactionInfo:b.transactionInfo,gas:U||void 0,tokenPrice:Dr,tokenSymbol:st}):null]}),(0,We.jsxs)(Zw,{children:[(0,We.jsx)($w,{children:V}),(0,We.jsx)(t2,{txn:Ye,address:rt?.address??"",hasFunds:wt,balance:Pt}),(0,We.jsxs)(Kw,{children:[be&&(0,We.jsx)(N,{onClick:rd,children:"Add Funds"}),(0,We.jsx)(jw,{disabled:ce||!wt,loading:!o||ce,loadingText:ce?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Zt(!0);let Gt=await t();if(Gt&&!ce&&rt)try{let Pr=await Vc(Gt,rt.address,o,Ye,di);I(Pr);let Jr=await Pr.wait();O(qc(Jr)),Ce()}catch(Pr){console.warn({transaction:Ye,error:Pr}),D(Pr),L(new nt(new _r(Pr.reason??"Error processing transaction",Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{Zt(!1)}},children:lt.buttonText})]})]})]})]})},i3=ci.default.div`
2516
2516
  display: flex;
2517
2517
  flex-direction: column;
2518
2518
  justify-content: space-between;
2519
2519
  flex-grow: 1;
2520
2520
  padding-bottom: 16px;
2521
- `,Kw=di.default.div`
2521
+ `,$w=ci.default.div`
2522
2522
  font-size: 13px;
2523
2523
  color: var(--privy-color-error);
2524
2524
  width: 100%;
2525
2525
  margin-top: 16px;
2526
- `,jw=di.default.div`
2526
+ `,Kw=ci.default.div`
2527
2527
  display: flex;
2528
2528
  direction: row;
2529
2529
  justify-content: space-between;
2530
2530
  align-items: center;
2531
2531
  gap: 8px;
2532
- `,Yw=(0,di.default)(N)`
2532
+ `,jw=(0,ci.default)(N)`
2533
2533
  transition: color 350ms ease, background-color 350ms ease;
2534
- `,Zw=di.default.div`
2534
+ `,Yw=ci.default.div`
2535
2535
  height: 100%;
2536
2536
  display: flex;
2537
2537
  flex-direction: column;
2538
2538
  justify-content: space-evenly;
2539
2539
  flex-grow: 1;
2540
- `,Jw=di.default.div`
2540
+ `,Zw=ci.default.div`
2541
2541
  display: flex;
2542
2542
  flex-direction: column;
2543
2543
  gap: 8px;
2544
- `;var l3=require("@ethersproject/bytes"),c3=require("@ethersproject/strings"),Mn=require("react"),yo=h(require("styled-components"));var We=require("react/jsx-runtime"),Qw=e=>{if(!(0,l3.isHexString)(e))return e;try{return(0,c3.toUtf8String)(e)}catch{return e}},Xw=e=>JSON.stringify(e,null,2),e5=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,We.jsx)(i5,{children:Object.entries(r).map(([o,n])=>(0,We.jsxs)("li",{children:[(0,We.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,We.jsx)("span",{children:String(r)});return(0,We.jsx)("div",{children:t(e)})},t5=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(p3,{children:(0,We.jsx)(e5,{data:o})}),(0,We.jsx)(Tn,{text:Xw(e.typedData),itemName:"full payload to clipboard"})," "]})},d3=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=k(),[a,l]=(0,Mn.useState)(!0),[s,c]=(0,Mn.useState)(""),[u,f]=(0,Mn.useState)(),[y,g]=(0,Mn.useState)(null),C=y!==null;(0,Mn.useEffect)(()=>{e||o("LANDING")},[e]),(0,Mn.useEffect)(()=>{t(gi).then(I=>{l(!1),I||(c("An error has occurred, please try again."),f(new nt(new _r(s,Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:x,confirmAndSign:S,onSuccess:b,onFailure:R,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"},M=I=>{I?b(I):R(u||new nt(new _r("The user rejected the request.",Dt.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),f(void 0)};return i.current=()=>{M(y)},(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(_,{onClose:()=>M(y)}),(0,We.jsx)(se,{}),(0,We.jsxs)(r5,{children:[(0,We.jsx)(o5,{children:O.title}),(0,We.jsx)(n5,{children:O.description}),v==="personal_sign"&&(0,We.jsx)(p3,{children:Qw(x)}),v==="eth_signTypedData_v4"&&(0,We.jsx)(t5,{typedData:x}),(0,We.jsx)(a5,{fail:!0,children:s}),(0,We.jsx)(l5,{success:C,loading:a,disabled:C,onClick:async()=>{try{let I=await S();g(I),c(""),setTimeout(()=>{M(I)},Xe)}catch(I){console.error(I),c("An error has occurred, please try again."),f(new nt(new _r(s,Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?(0,We.jsxs)(s5,{children:[(0,We.jsx)(dc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,We.jsx)("span",{children:"Success"})]}):O.buttonText})]}),(0,We.jsx)(me,{}),(0,We.jsx)($,{protectedByPrivy:!0})]})},r5=yo.default.div`
2544
+ `;var s3=require("@ethersproject/bytes"),l3=require("@ethersproject/strings"),In=require("react"),yo=h(require("styled-components"));var Le=require("react/jsx-runtime"),Jw=e=>{if(!(0,s3.isHexString)(e))return e;try{return(0,l3.toUtf8String)(e)}catch{return e}},Qw=e=>JSON.stringify(e,null,2),Xw=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,Le.jsx)(n5,{children:Object.entries(r).map(([o,n])=>(0,Le.jsxs)("li",{children:[(0,Le.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,Le.jsx)("span",{children:String(r)});return(0,Le.jsx)("div",{children:t(e)})},e5=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(d3,{children:(0,Le.jsx)(Xw,{data:o})}),(0,Le.jsx)(Pn,{text:Qw(e.typedData),itemName:"full payload to clipboard"})," "]})},c3=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=k(),[a,l]=(0,In.useState)(!0),[s,c]=(0,In.useState)(""),[u,f]=(0,In.useState)(),[y,g]=(0,In.useState)(null),C=y!==null;(0,In.useEffect)(()=>{e||o("LANDING")},[e]),(0,In.useEffect)(()=>{t(yi).then(I=>{l(!1),I||(c("An error has occurred, please try again."),f(new nt(new _r(s,Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:x,confirmAndSign:S,onSuccess:b,onFailure:R,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"},M=I=>{I?b(I):R(u||new nt(new _r("The user rejected the request.",Dt.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),f(void 0)};return i.current=()=>{M(y)},(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(_,{onClose:()=>M(y)}),(0,Le.jsx)(se,{}),(0,Le.jsxs)(t5,{children:[(0,Le.jsx)(r5,{children:O.title}),(0,Le.jsx)(o5,{children:O.description}),v==="personal_sign"&&(0,Le.jsx)(d3,{children:Jw(x)}),v==="eth_signTypedData_v4"&&(0,Le.jsx)(e5,{typedData:x}),(0,Le.jsx)(i5,{fail:!0,children:s}),(0,Le.jsx)(s5,{success:C,loading:a,disabled:C,onClick:async()=>{try{let I=await S();g(I),c(""),setTimeout(()=>{M(I)},Xe)}catch(I){console.error(I),c("An error has occurred, please try again."),f(new nt(new _r(s,Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?(0,Le.jsxs)(a5,{children:[(0,Le.jsx)(dc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,Le.jsx)("span",{children:"Success"})]}):O.buttonText})]}),(0,Le.jsx)(me,{}),(0,Le.jsx)(q,{protectedByPrivy:!0})]})},t5=yo.default.div`
2545
2545
  display: flex;
2546
2546
  flex-direction: column;
2547
2547
  align-items: center;
2548
2548
  justify-content: center;
2549
- `,o5=yo.default.span`
2549
+ `,r5=yo.default.span`
2550
2550
  color: var(--privy-color-foreground);
2551
2551
  text-align: center;
2552
2552
  font-size: 1.125rem;
2553
2553
  font-weight: 500;
2554
2554
  line-height: 1.25rem; /* 111.111% */
2555
2555
  text-align: center;
2556
- `,n5=yo.default.span`
2556
+ `,o5=yo.default.span`
2557
2557
  margin-top: 4px;
2558
2558
  color: var(--privy-color-foreground);
2559
2559
  text-align: center;
@@ -2563,7 +2563,7 @@ You will have to sign up with another method first to register a passkey for you
2563
2563
  font-weight: 400;
2564
2564
  line-height: 20px; /* 142.857% */
2565
2565
  letter-spacing: -0.008px;
2566
- `,p3=yo.default.div`
2566
+ `,d3=yo.default.div`
2567
2567
  margin-top: 1.5rem;
2568
2568
  background-color: var(--privy-color-background-2);
2569
2569
  border-radius: var(--privy-border-radius-md);
@@ -2582,7 +2582,7 @@ You will have to sign up with another method first to register a passkey for you
2582
2582
  display: none; /* Safari and Chrome */
2583
2583
  }
2584
2584
  }
2585
- `,i5=yo.default.ul`
2585
+ `,n5=yo.default.ul`
2586
2586
  margin-left: 12px !important;
2587
2587
  white-space: nowrap;
2588
2588
 
@@ -2594,7 +2594,7 @@ You will have to sign up with another method first to register a passkey for you
2594
2594
  font-weight: 500 !important;
2595
2595
  }
2596
2596
  }
2597
- `,a5=yo.default.div`
2597
+ `,i5=yo.default.div`
2598
2598
  line-height: 20px;
2599
2599
  height: 20px;
2600
2600
  font-size: 13px;
@@ -2604,11 +2604,11 @@ You will have to sign up with another method first to register a passkey for you
2604
2604
  width: 100%;
2605
2605
  margin-top: 16px;
2606
2606
  margin-bottom: 4px;
2607
- `,s5=yo.default.span`
2607
+ `,a5=yo.default.span`
2608
2608
  display: flex;
2609
2609
  align-items: center;
2610
2610
  gap: 8px;
2611
- `,l5=(0,yo.default)(N)`
2611
+ `,s5=(0,yo.default)(N)`
2612
2612
  transition: color 350ms ease, background-color 350ms ease;
2613
2613
 
2614
2614
  ${e=>e.success&&yo.css`
@@ -2617,7 +2617,7 @@ You will have to sign up with another method first to register a passkey for you
2617
2617
  color: #ffffff;
2618
2618
  }
2619
2619
  `}
2620
- `;var ba=require("react"),u3=h(require("styled-components"));var Ot=require("react/jsx-runtime"),m3=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=k(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:y,createAnalyticsEvent:g}=W(),[C,v]=(0,ba.useState)(!1),[x,S]=(0,ba.useState)(void 0),b=n?.render.inDialog?Xe:0;async function R(){try{await c(),v(!0),f(!0)}catch(M){if(M?.privyErrorCode==="allowlist_rejected"){S(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(M?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(M).toString()),S(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:I,detail:V}=wd(M);S({retryable:I,detail:V,message:"Authentication failed"})}}(0,ba.useEffect)(()=>{R()},[]),(0,ba.useEffect)(()=>{if(!(r&&e&&C&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let V=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},b);return()=>clearTimeout(V)}if(cr(o,n?.embeddedWallets?.createOnLogin)){let V=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:Z=>{console.error(Z),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Z,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},b);return()=>clearTimeout(V)}u();let I=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),b);return()=>clearTimeout(I)},[r,e,C,o]);let A=C?"Successfully connected with Telegram":x?x.message:"Verifying connection to Telegram",O="";return C?O="You\u2019re good to go!":x?O=x.detail:O="Just a few moments more",(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsx)(_,{}),(0,Ot.jsx)(se,{}),(0,Ot.jsxs)(c5,{children:[(0,Ot.jsx)(At,{children:(0,Ot.jsxs)("div",{children:[(0,Ot.jsx)(St,{success:C,fail:!!x}),(0,Ot.jsx)(_c,{style:{width:"38px",height:"38px"}})]})}),(0,Ot.jsxs)(yt,{children:[(0,Ot.jsx)("h3",{children:A}),(0,Ot.jsx)("p",{children:O})]}),x&&x?.retryable?(0,Ot.jsx)(Li,{onClick:()=>{s().then(async()=>R()).catch(M=>{let{retryable:I,detail:V}=wd(M);S({retryable:I,detail:V,message:"Authentication failed"})}),S(void 0)},disabled:!C&&!x?.retryable,children:"Retry"}):null]}),(0,Ot.jsx)(me,{}),(0,Ot.jsx)(z,{})]})},c5=u3.default.div`
2620
+ `;var wa=require("react"),p3=h(require("styled-components"));var Ot=require("react/jsx-runtime"),u3=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=k(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:u,setReadyToTrue:f,closePrivyModal:y,createAnalyticsEvent:g}=W(),[C,v]=(0,wa.useState)(!1),[x,S]=(0,wa.useState)(void 0),b=n?.render.inDialog?Xe:0;async function R(){try{await c(),v(!0),f(!0)}catch(M){if(M?.privyErrorCode==="allowlist_rejected"){S(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(M?.privyErrorCode==="max_accounts_reached"){console.error(new Ur(M).toString()),S(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:I,detail:V}=Cd(M);S({retryable:I,detail:V,message:"Authentication failed"})}}(0,wa.useEffect)(()=>{R()},[]),(0,wa.useEffect)(()=>{if(!(r&&e&&C&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let V=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},b);return()=>clearTimeout(V)}if(cr(o,n?.embeddedWallets?.createOnLogin)){let V=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:Y=>{console.error(Y),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Y,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},b);return()=>clearTimeout(V)}u();let I=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),b);return()=>clearTimeout(I)},[r,e,C,o]);let A=C?"Successfully connected with Telegram":x?x.message:"Verifying connection to Telegram",O="";return C?O="You\u2019re good to go!":x?O=x.detail:O="Just a few moments more",(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsx)(_,{}),(0,Ot.jsx)(se,{}),(0,Ot.jsxs)(l5,{children:[(0,Ot.jsx)(At,{children:(0,Ot.jsxs)("div",{children:[(0,Ot.jsx)(St,{success:C,fail:!!x}),(0,Ot.jsx)(_c,{style:{width:"38px",height:"38px"}})]})}),(0,Ot.jsxs)(gt,{children:[(0,Ot.jsx)("h3",{children:A}),(0,Ot.jsx)("p",{children:O})]}),x&&x?.retryable?(0,Ot.jsx)(Wi,{onClick:()=>{s().then(async()=>R()).catch(M=>{let{retryable:I,detail:V}=Cd(M);S({retryable:I,detail:V,message:"Authentication failed"})}),S(void 0)},disabled:!C&&!x?.retryable,children:"Retry"}):null]}),(0,Ot.jsx)(me,{}),(0,Ot.jsx)(z,{})]})},l5=p3.default.div`
2621
2621
  display: flex;
2622
2622
  flex-direction: column;
2623
2623
  align-items: center;
@@ -2625,9 +2625,9 @@ You will have to sign up with another method first to register a passkey for you
2625
2625
  margin-left: 27px;
2626
2626
  margin-right: 27px;
2627
2627
  gap: 24px;
2628
- `;var y3=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var f3=h(require("@heroicons/react/24/outline/EnvelopeIcon")),bs=require("react"),Hp=h(require("styled-components"));var go=require("react/jsx-runtime"),h3=(0,bs.forwardRef)((e,t)=>{let[r,o]=(0,bs.useState)(""),[n,i]=(0,bs.useState)(!1),{authenticated:a,user:l}=H(),{initUpdateEmail:s}=W(),{navigate:c,setModalData:u,currentScreen:f}=k(),{enabled:y,token:g}=Pe(),C=Ds(r),v=n,x=n||!C,S=async R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,R),c("AWAITING_PASSWORDLESS_CODE")}catch(A){u({errorModalData:{error:A,previousScreen:f||"LANDING"}})}i(!1)},b=()=>{y&&!g&&!a?(u({captchaModalData:{callback:R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,R)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):S(g)};return(0,go.jsxs)(go.Fragment,{children:[(0,go.jsx)(d5,{children:(0,go.jsxs)(p5,{children:[(0,go.jsx)(f3.default,{}),(0,go.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,go.jsx)(Oi,{isSubmitting:v,onClick:b,disabled:x,children:"Submit"})]})}),e.stacked?(0,go.jsx)(N,{loadingText:null,loading:v,disabled:x,onClick:b,children:"Submit"}):null]})}),d5=Hp.default.div`
2628
+ `;var h3=h(require("@heroicons/react/24/outline/EnvelopeIcon"));var m3=h(require("@heroicons/react/24/outline/EnvelopeIcon")),bs=require("react"),Bp=h(require("styled-components"));var go=require("react/jsx-runtime"),f3=(0,bs.forwardRef)((e,t)=>{let[r,o]=(0,bs.useState)(""),[n,i]=(0,bs.useState)(!1),{authenticated:a,user:l}=H(),{initUpdateEmail:s}=W(),{navigate:c,setModalData:u,currentScreen:f}=k(),{enabled:y,token:g}=Te(),C=Ds(r),v=n,x=n||!C,S=async R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,R),c("AWAITING_PASSWORDLESS_CODE")}catch(A){u({errorModalData:{error:A,previousScreen:f||"LANDING"}})}i(!1)},b=()=>{y&&!g&&!a?(u({captchaModalData:{callback:R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,R)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):S(g)};return(0,go.jsxs)(go.Fragment,{children:[(0,go.jsx)(c5,{children:(0,go.jsxs)(d5,{children:[(0,go.jsx)(m3.default,{}),(0,go.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,go.jsx)(Li,{isSubmitting:v,onClick:b,disabled:x,children:"Submit"})]})}),e.stacked?(0,go.jsx)(N,{loadingText:null,loading:v,disabled:x,onClick:b,children:"Submit"}):null]})}),c5=Bp.default.div`
2629
2629
  width: 100%;
2630
- `,p5=Hp.default.label`
2630
+ `,d5=Bp.default.label`
2631
2631
  display: block;
2632
2632
  position: relative;
2633
2633
  width: 100%;
@@ -2685,7 +2685,7 @@ You will have to sign up with another method first to register a passkey for you
2685
2685
  && > input::placeholder {
2686
2686
  color: var(--privy-color-foreground-3);
2687
2687
  }
2688
- `;var Or=require("react/jsx-runtime"),g3=()=>(0,Or.jsxs)(Or.Fragment,{children:[(0,Or.jsx)(_,{},"header"),(0,Or.jsx)(se,{}),(0,Or.jsx)(Be,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,Or.jsx)(y3.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Or.jsx)(Vr,{children:(0,Or.jsx)(h3,{stacked:!0})}),(0,Or.jsx)(me,{}),(0,Or.jsx)($,{protectedByPrivy:!0})]});var Jc=h(require("styled-components"));var Gp=require("react/jsx-runtime"),v3=({style:e,...t})=>(0,Gp.jsx)("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:(0,Gp.jsx)("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"})});var wr=require("react/jsx-runtime"),C3=()=>{let{navigate:e}=k();return(0,wr.jsxs)(wr.Fragment,{children:[(0,wr.jsx)(_,{}),(0,wr.jsxs)(u5,{children:[(0,wr.jsx)(m5,{children:(0,wr.jsx)(v3,{})}),(0,wr.jsxs)(f5,{children:[(0,wr.jsx)("h3",{children:"Unable to sign in"}),(0,wr.jsx)("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),(0,wr.jsx)(N,{onClick:()=>{e("LANDING")},children:"Go back"})]}),(0,wr.jsx)($,{protectedByPrivy:!0})]})},u5=Jc.default.div`
2688
+ `;var Or=require("react/jsx-runtime"),y3=()=>(0,Or.jsxs)(Or.Fragment,{children:[(0,Or.jsx)(_,{},"header"),(0,Or.jsx)(se,{}),(0,Or.jsx)(He,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,Or.jsx)(h3.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Or.jsx)(Vr,{children:(0,Or.jsx)(f3,{stacked:!0})}),(0,Or.jsx)(me,{}),(0,Or.jsx)(q,{protectedByPrivy:!0})]});var Jc=h(require("styled-components"));var Hp=require("react/jsx-runtime"),g3=({style:e,...t})=>(0,Hp.jsx)("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:(0,Hp.jsx)("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"})});var wr=require("react/jsx-runtime"),v3=()=>{let{navigate:e}=k();return(0,wr.jsxs)(wr.Fragment,{children:[(0,wr.jsx)(_,{}),(0,wr.jsxs)(p5,{children:[(0,wr.jsx)(u5,{children:(0,wr.jsx)(g3,{})}),(0,wr.jsxs)(m5,{children:[(0,wr.jsx)("h3",{children:"Unable to sign in"}),(0,wr.jsx)("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),(0,wr.jsx)(N,{onClick:()=>{e("LANDING")},children:"Go back"})]}),(0,wr.jsx)(q,{protectedByPrivy:!0})]})},p5=Jc.default.div`
2689
2689
  display: flex;
2690
2690
  flex-direction: column;
2691
2691
  align-items: center;
@@ -2694,7 +2694,7 @@ You will have to sign up with another method first to register a passkey for you
2694
2694
  width: 100%;
2695
2695
  padding-top: 8px;
2696
2696
  padding-bottom: 32px;
2697
- `,m5=Jc.default.div`
2697
+ `,u5=Jc.default.div`
2698
2698
  display: flex;
2699
2699
  align-items: center;
2700
2700
  justify-content: center;
@@ -2703,11 +2703,11 @@ You will have to sign up with another method first to register a passkey for you
2703
2703
  color: var(--privy-color-error);
2704
2704
  background-color: var(--privy-color-error-light);
2705
2705
  border-radius: 50%;
2706
- `,f5=Jc.default.div`
2706
+ `,m5=Jc.default.div`
2707
2707
  display: flex;
2708
2708
  flex-direction: column;
2709
2709
  gap: 8px;
2710
- `;var Qc=h(require("styled-components"));var h5=`
2710
+ `;var Qc=h(require("styled-components"));var f5=`
2711
2711
  *,
2712
2712
  ::before,
2713
2713
  ::after {
@@ -2937,7 +2937,7 @@ You will have to sign up with another method first to register a passkey for you
2937
2937
  [hidden] {
2938
2938
  display: none;
2939
2939
  }
2940
- `,w3=h5;var b3=Qc.createGlobalStyle`
2940
+ `,C3=f5;var w3=Qc.createGlobalStyle`
2941
2941
  :root {
2942
2942
  // Borders
2943
2943
  --privy-border-radius-sm: 6px;
@@ -2970,10 +2970,10 @@ You will have to sign up with another method first to register a passkey for you
2970
2970
  --privy-height-modal-full: 620px;
2971
2971
  --privy-height-modal-compact: 480px;
2972
2972
  };
2973
- `,E3=Qc.default.div`
2973
+ `,b3=Qc.default.div`
2974
2974
  // css normalize only the privy application to avoid conflicts
2975
2975
  // with consuming application
2976
- ${w3}
2976
+ ${C3}
2977
2977
 
2978
2978
  // Privy styles
2979
2979
  color: var(--privy-color-foreground-2);
@@ -3032,4 +3032,4 @@ You will have to sign up with another method first to register a passkey for you
3032
3032
  opacity: 1;
3033
3033
  }
3034
3034
  }
3035
- `;var mt=require("react/jsx-runtime"),y5={["LANDING"]:H1,["CONNECT_OR_CREATE"]:B1,["AWAITING_PASSWORDLESS_CODE"]:Hf,["AWAITING_CONNECTION"]:fh,["AWAITING_CONNECT_ONLY_CONNECTION"]:gh,["AWAITING_FARCASTER_CONNECTION"]:By,["AWAITING_FARCASTER_SIGNER"]:zy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:M2,["PHANTOM_INTERSTITIAL_SCREEN"]:N2,["LOGIN_FAILED_SCREEN"]:og,["AWAITING_OAUTH_SCREEN"]:I2,["ALLOWLIST_REJECTION_SCREEN"]:Rf,["USER_LIMIT_REACHED_SCREEN"]:C3,["INSTALL_PHANTOM_SCREEN"]:u1,["LINK_EMAIL_SCREEN"]:V1,["LINK_PHONE_SCREEN"]:eg,["LINK_WALLET_SCREEN"]:tg,["LINK_PASSKEY_SCREEN"]:J1,["UPDATE_EMAIL_SCREEN"]:g3,["CONNECT_ONLY_LANDING_SCREEN"]:ph,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:ih,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Nh,["EMBEDDED_WALLET_CREATED_SCREEN"]:kh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Sh,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:U2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Y2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:H2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Wh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:d3,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:s3,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Xy,["FIAT_ON_RAMP_STATUS_SCREEN"]:n1,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Py,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Cy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:G2,["MFA_ENROLLMENT_FLOW_SCREEN"]:Dg,["CAPTCHA_SCREEN"]:Yf,["ERROR_SCREEN"]:_y,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:s1,["AFFIRMATIVE_CONSENT_SCREEN"]:xf,["TELEGRAM_AUTH_SCREEN"]:m3},g5=["LANDING","AWAITING_CONNECTION"],v5=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=dr(),{ready:i,currentScreen:a}=k(),{status:l,execute:s,reset:c,enabled:u}=Pe(),f=(0,on.useRef)(null),y=hf(f),g=o&&a&&g5.includes(a)&&!n&&l==="ready";if((0,on.useEffect)(()=>{g&&s()},[g]),(0,on.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,mt.jsxs)(da,{id:"privy-modal-content",children:[(0,mt.jsx)(_,{}),(0,mt.jsx)(se,{}),(0,mt.jsx)(bg,{children:(0,mt.jsx)(_t,{})}),(0,mt.jsx)(me,{}),(0,mt.jsx)(z,{})]});if(!a&&e)return(0,mt.jsx)(da,{style:{height:y},id:"privy-modal-conent",children:(0,mt.jsx)("div",{ref:f,children:(0,mt.jsx)(Np,{open:e,onClose:t})})});if(!a)return null;let C=y5[a];return(0,mt.jsx)(da,{style:{height:y},id:"privy-modal-content",children:(0,mt.jsxs)("div",{ref:f,children:[(0,mt.jsx)(ao,{if:!!e,children:(0,mt.jsx)(C,{})}),(0,mt.jsx)(ao,{if:!e,children:(0,mt.jsx)(Np,{open:e,onClose:t})})]})})},C5=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=k();return{gracefulClosePrivyModal:(0,on.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},T3=({open:e})=>{let{app:t}=k(),{gracefulClosePrivyModal:r}=C5(),[o,n]=(0,on.useState)(!1);Fl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,mt.jsx)(E3,{children:(0,mt.jsx)(v5,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,mt.jsx)(wg,{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 P3.default.createPortal(l,s)}return l};var Es=require("react"),_3=require("react/jsx-runtime");function w5({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function S3(e){let t=(0,Es.useRef)(null),r=(0,Es.useRef)();return(0,Es.useEffect)(()=>{r.current?.remove(),r.current=w5(e),t.current?.after(r.current)},[e]),(0,_3.jsx)("div",{ref:t,hidden:!0})}var x3=require("react"),Ea=require("react");var Xc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-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 Wn(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 tt("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((y,g)=>{r.current={resolve:y,reject:g};let C=1e3*60*5;setTimeout(()=>{let v=new tt("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},C)});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 tt("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var A3=require("react/jsx-runtime"),b5=function(e){return()=>`id-${e++}`}(0);function E5(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function br(e){return e.error!==void 0}var or=new Xc,Vp=new Map,P5=(e,t)=>typeof t=="bigint"?t.toString():t,T5=(e,t)=>`${e}${JSON.stringify(t,P5)}`;function Er(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=T5(e,t);if(e==="privy:wallet:create"){let l=Vp.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=b5();or.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{Vp.delete(i)});return Vp.set(i,a),a}function S5(e){switch(e.event){case"privy:iframe:ready":let t=or.dequeue(e.event,e.id);return br(e)?t.reject(new tt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=or.dequeue(e.event,e.id);return br(e)?r.reject(new tt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=or.dequeue(e.event,e.id);return br(e)?o.reject(new tt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=or.dequeue(e.event,e.id);return br(e)?n.reject(new tt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=or.dequeue(e.event,e.id);return br(e)?i.reject(new tt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=or.dequeue(e.event,e.id);return br(e)?a.reject(new tt(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let l=or.dequeue(e.event,e.id);return br(e)?l.reject(new tt(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=or.dequeue(e.event,e.id);return br(e)?s.reject(new tt(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:submit-enrollment":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:unenroll":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:clear":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:init-signer":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:sign":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function k3(e){let t=(0,Ea.useRef)(null),r=(0,Ea.useRef)(e.mfaMethods),o=Ul(),[n,i]=(0,x3.useState)(!1);return(0,Ea.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,Ea.useEffect)(()=>{if(!n)return;let a=t.current;if(!a)return;function l(y){y&&y.origin===e.origin&&E5(y.data)&&S5(y.data)}let s={create(y){return Er("privy:wallet:create",y,a,e.origin)},import(y){return Er("privy:wallet:import",y,a,e.origin)},connect(y){return Er("privy:wallet:connect",y,a,e.origin)},recover(y){return Wn(g=>Er("privy:wallet:recover",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(y){return Wn(g=>Er("privy:wallet:rpc",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(y){return Wn(g=>Er("privy:wallet:set-recovery-password",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(y){return Wn(g=>Er("privy:mfa:verify",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(y){return Wn(g=>Er("privy:mfa:init-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(y){return Wn(g=>Er("privy:mfa:submit-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(y){return Wn(g=>Er("privy:mfa:unenroll",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(y){return Er("privy:mfa:clear",y,a,e.origin)},initFarcasterSigner(y){return Er("privy:farcaster:init-signer",y,a,e.origin)},signFarcasterMessage(y){return Er("privy:farcaster:sign",y,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...y)=>{console.warn("Privy iframe failed to load: ",...y),e.onLoadFailed()},f=new AbortController;return zu(()=>Er("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),(0,A3.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Us(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function ed(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var _5="https://cdn.apple-cloudkit.com";async function zp({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===_5&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var R3=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});var Zt=require("react/jsx-runtime"),nn;function x5(e){return typeof e=="string"&&e.length===25}function ke(){if(!nn){let e=ne.get(Un);return Promise.resolve(e||null)}return nn.getAccessToken()}var M3,vm=(e,t)=>M3(e,t),W3,Cm=(e,t)=>W3(e,t),L3,wm=(e,t)=>L3(e,t),O3,bm=()=>O3(),k5=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ne.put(Sa,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},N3=({config:e,...t})=>{if(!x5(t.appId))throw new P("Cannot initialize the Privy provider with an invalid Privy app ID");nn||(nn=new Mi({appId:t.appId,apiUrl:t.apiUrl||Ta}));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."),(0,Zt.jsx)(Jm,{client:nn,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Zt.jsx)(A5,{...t,client:nn})})},A5=e=>{let t=e.client,[r,o]=(0,le.useState)(!1),[n,i]=(0,le.useState)(!1),[a,l]=(0,le.useState)(!1),[s,c]=(0,le.useState)(null),[u,f]=(0,le.useState)([]),y=(0,le.useRef)(u),[g,C]=(0,le.useState)(!1),[v,x]=(0,le.useState)(null),[S,b]=(0,le.useState)(!1),[R,A]=(0,le.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[O,M]=(0,le.useState)({status:"initial"}),[I,V]=(0,le.useState)(null),[Z,ee]=(0,le.useState)(null),[L,Y]=(0,le.useState)(null),D=dr(),be=kl(),[ve,Ce]=(0,le.useState)(!0),[Le,ce]=(0,le.useState)({}),[Jt,Ct]=(0,le.useState)(null),[nr,Et]=(0,le.useState)(null),[Nr,je]=(0,le.useState)(!1),[ft,Dr]=(0,le.useState)(!1),ir=(0,le.useRef)(null),st=(0,le.useRef)(null),U=(0,le.useRef)(yf),[Ln,Oe]=(0,le.useState)(!1);t.onStoreToken=d=>{d&&F(U,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),F(U,"accessToken","onAccessTokenRemoved")};let ie=(0,le.useRef)(null),ae=(0,le.useRef)(null),xe=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},rt=d=>{D.embeddedWallets.createOnLogin!=="off"&&Ce(!0),xe(d)};(0,le.useEffect)(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),(0,le.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=Ue(s),p=Ci(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!L){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(L,d.address,D.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(L,p.address,D.defaultChain,e.appId)},[L,s]),(0,le.useEffect)(()=>{L&&nr?.(L)},[L]),(0,le.useEffect)(()=>{(async()=>{if(!D.customAuth?.enabled)return;Ce(!0);let{getCustomAccessToken:p,isLoading:m}=D.customAuth;if(!(!n||m))try{let w=await p();if(!w&&a){await mi.logout();return}if(!w||a)return;t.startAuthFlow(new fi(w));let{user:T,isNewUser:G}=await t.authenticate();if(!T){await mi.logout();return}c(T||null),C(G||!1),l(!0),Dr(!0)}catch(w){console.warn(w),a&&await mi.logout()}})()},[D.customAuth?.enabled,D.customAuth?.getCustomAccessToken,D.customAuth?.isLoading,n,a]),(0,le.useEffect)(()=>{ft&&L&&s&&cr(s,D.embeddedWallets.createOnLogin)&&(Dr(!1),Ss(s,gi).catch(console.error))},[ft&&L&&s]),(0,le.useEffect)(()=>{async function d(){let p=rd();k5();let m=(0,I3.createStore)();V(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 w;t.connectors?.on("connectorInitialized",()=>{w&&clearTimeout(w);let G=t.connectors.walletConnectors.length,q=t.connectors.walletConnectors.reduce((Je,Qe)=>Je+(Qe.initialized?1:0),0);q===G?Oe(!0):w=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:q,expected:G}),Oe(!0)},1500)}),t.connectors?.initialize().then(()=>{od()});let T=await t.getAuthenticatedUser();D.customAuth?.enabled||(l(!!T),T&&F(U,"login","onComplete",T,!1,!0,null,null),c(T)),p||Ee.setReadyToTrue(!!T),p&&(T?ae.current="link":ae.current="login")}!n&&be&&d()},[t,Jt,n,be]),(0,le.useEffect)(()=>{if(!n)return;if(!s){je(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){je(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");je(p)},[n,s,u]);let rd=()=>{let d=Ma();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 Co(d)),rt("AWAITING_OAUTH_SCREEN"),!0)},pi=async(d,p,m,w)=>{let T=await t.connectors?.createWalletConnector(d,p)||null;ui(T,p,m,w)};async function ui(d,p,m,w){if(d)A({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return A({status:"disconnected",connectedWallet:null,connectError:new de("Unable to connect to wallet."),connector:null,connectRetry:E}),w?.(null,m);d instanceof Eo&&p&&await d.resetConnection(p),A({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ui(d,p,m,w)});try{let T=await d.connect({showPrompt:!0});if(D.shouldEnforceDefaultChainOnConnect&&!D.chains.find(G=>G.id===Number(T?.chainId))&&!(T?.connectorType==="wallet_connect_v2"&&T?.walletClientType==="metamask")){A(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await T?.switchChain(D.defaultChain.id),T&&(T.chainId=yi(Dn(D.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${D.defaultChain.id}`)}}return A(G=>({...G,status:"connected",connectedWallet:T,connectError:null,connectRetry:E})),T&&!ae.current&&F(U,"connectWallet","onSuccess",T),w?.(T,m)}catch(T){return T instanceof ct?(console.warn(T.cause?T.cause:T.message),ae.current||F(U,"connectWallet","onError",T.privyErrorCode||"generic_connect_wallet_error")):(console.warn(T),ae.current||F(U,"connectWallet","onError","unknown_connect_wallet_error")),A(G=>({...G,status:"disconnected",connectedWallet:null,connectError:T})),w?.(null,m)}}let On=async(d,p)=>{if(d===null)return;let m=new $n(d,p);t.startAuthFlow(m)},od=()=>{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"&&!ln()&&rt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new P("Connector not initialized");xe("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),pi(p,m,void 0,On)};(0,le.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let lt=()=>{if(!a)throw F(U,"linkAccount","onError","must_be_authenticated"),new P("User must be authenticated before linking an account.")},an=()=>{lt(),ie.current="siwe",ae.current="link",xe("LINK_WALLET_SCREEN")},Gt=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},Pr=async d=>{if(!t.connectors)throw new P("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:E})),D.captchaEnabled&&!a){let m={callback:w=>On(d,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ce({captchaModalData:m}),rt("CAPTCHA_SCREEN")}else await On(d),rt("AWAITING_CONNECTION")},Jr=async(d,p)=>{if(!D.fiatOnRamp.enabled)throw new P("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:w}=await Jy(t,d,p?.config??{},D.appearance.palette,D.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:w}}else throw new P("Unsupported fund provider. Currently supported option is `moonpay`.")},Nn=()=>{f(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Gt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new P("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new P("Cannot link or login with embedded wallet");Pr(m)},fund:async w=>{let{signedUrl:T,externalTransactionId:G}=await Jr(m.address,w);ce({fiatOnRampPrompt:{signedUrl:T},fiatOnRampStatus:{externalTransactionId:G}}),xe("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new P("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new P("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(m.address);c(w)}}))||[];return ll(d,p)?d:p})};(0,le.useEffect)(()=>{Nn()},[s?.linkedAccounts,a,n]),(0,le.useEffect)(()=>{if(n){if(!t.connectors)throw new P("Connector not initialized");Nn(),t.connectors.on("walletsUpdated",Nn)}},[n]);let Do=()=>{xe(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,le.useEffect)(()=>{if(!u[0])return;let d=u[0],p=y.current.find(w=>w.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType==="privy"):m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType!=="privy"),!p&&m){let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(w)}y.current=u},[u]);let Ss=async(d,p)=>{if(Ue(d))throw F(U,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,T]=await Promise.all([Ee.initializeWalletProxy(p),ke()]);if(!w&&D.customAuth?.enabled)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!T||D.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((G,q)=>{Ce(!0),ce({createWallet:{onSuccess:Qe=>{F(U,"createWallet","onSuccess",Qe),G(Qe)},onFailure:Qe=>{F(U,"createWallet","onError","unknown_embedded_wallet_error"),q(Qe)},callAuthOnSuccessOnClose:!1}}),xe("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:T});let G=await Ee.refreshUser(),q=Ue(G);if(!q)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(U,"createWallet","onSuccess",q),q}},p0=d=>{if(!D.chains.map(p=>p.id).includes(d))throw new de(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Kp=(d,p,m)=>new Promise(async(w,T)=>{if(!a||!s){F(U,"sendTransaction","onError","must_be_authenticated"),T(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=Ue(s);if(!G){F(U,"sendTransaction","onError","embedded_wallet_not_found"),T(new Error("Must have a Privy wallet before signing"));return}Ce(!0);let q=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Je=d.chainId?Number(d.chainId):q.chainId;p0(Je);let Qe=Object.assign({},d,{chainId:Je}),sr=async()=>{let Pt=await ke();if(!Pt||!L){F(U,"sendTransaction","onError","embedded_wallet_not_found"),T(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Ee.recoverEmbeddedWallet()){F(U,"sendTransaction","onError","unknown_connect_wallet_error"),T(new Error("Unable to connect to wallet"));return}let Qr=Uo(Qe.chainId,D.chains,D.rpcConfig,{appId:e.appId}),nd=await ya(G.address,Qe,Qr);if(D.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:m0}=await ha(nd,Qr),{hasSufficientFunds:f0}=await zc(G.address,nd,m0,Qr);if(!f0)throw new nt(new _r("Wallet has insufficient funds for this transaction.",Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Yp=await Vc(Pt,G.address,L,nd,Qr);F(U,"sendTransaction","onSuccess",Yp),w(Yp)}catch(Vt){F(U,"sendTransaction","onError","transaction_failure"),T(Vt)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),sr();else{let Pt={transactionRequest:Qe,onSuccess:Qr=>{F(U,"sendTransaction","onSuccess",Qr),w(Qr)},onFailure:Qr=>{F(U,"sendTransaction","onError","transaction_failure"),T(Qr)},uiOptions:p||{},fundWalletConfig:m},Vt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{F(U,"sendTransaction","onError","unknown_connect_wallet_error"),T(Qr)}};ce({connectWallet:Vt,sendTransaction:Pt}),xe("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function jp(){return new Promise(async(d,p)=>{let m=await ke();if(!m||!L)throw new Error("Must have valid access token to enroll in MFA");try{await L.verifyMfa({accessToken:m}),d()}catch(w){p(w)}})}let ar=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw F(U,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw F(U,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)},mi={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Do,importWallet:async({privateKey:d})=>{lt();let[p,m]=await Promise.all([Ee.initializeWalletProxy(15e3),ke()]);if(p&&m){await p.import({privateKey:d,accessToken:m});let w=await Ee.refreshUser(),T=Ci(w);if(!T)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return F(U,"createWallet","onSuccess",T),T}else throw new P("User is not authenticated")},linkWallet:an,linkEmail:()=>{lt(),ar("email"),ie.current="email",ae.current="link",xe("LINK_EMAIL_SCREEN")},linkPhone:()=>{lt(),ar("phone"),ie.current="sms",ae.current="link",xe("LINK_PHONE_SCREEN")},linkGoogle:async()=>{lt(),ar("google"),ae.current="link",await Ee.initLoginWithOAuth("google")},linkTwitter:async()=>{lt(),ar("twitter"),ae.current="link",await Ee.initLoginWithOAuth("twitter")},linkDiscord:async()=>{lt(),ar("discord"),ae.current="link",await Ee.initLoginWithOAuth("discord")},linkGithub:async()=>{lt(),ar("github"),ae.current="link",await Ee.initLoginWithOAuth("github")},linkSpotify:async()=>{lt(),ar("spotify"),ae.current="link",await Ee.initLoginWithOAuth("spotify")},linkInstagram:async()=>{lt(),ar("instagram"),ae.current="link",await Ee.initLoginWithOAuth("instagram")},linkTiktok:async()=>{lt(),ar("tiktok"),ae.current="link",await Ee.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{lt(),ar("linkedin"),ae.current="link",await Ee.initLoginWithOAuth("linkedin")},linkApple:async()=>{lt(),ar("apple"),ae.current="link",await Ee.initLoginWithOAuth("apple")},linkPasskey:async()=>{lt(),ar("passkey"),await Ee.initLinkWithPasskey(),xe("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{lt(),ar("telegram"),ae.current="link",ie.current="telegram",await Ee.initLoginWithTelegram(),xe("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{lt(),ar("farcaster"),await Ee.initLoginWithFarcaster(),ae.current="link",ie.current="farcaster",xe("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(lt(),!s?.email)throw new P("User does not have an email linked to their account.");ae.current="link",ie.current="email",xe("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=>{Ct(w=>m.bind(w))});if(Ct(null),p){console.warn(d);return}}if(a){console.warn(d);return}ae.current="login",rt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Ct(()=>d)}),Ct(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}rt("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&L)try{await L.clearMfa({userId:s.id})}catch{}c(null),l(!1),x(null),F(U,"logout","onSuccess"),ae.current=null,ie.current=null,o(!1),ne.del(_a)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Ze;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new Ze:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new td.Web3Provider(new to(new Ze));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new td.Web3Provider(new to(new Ze)):new td.Web3Provider(new to(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new un(new Ze);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new un(new Ze):new un(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(w=>(0,Ps.getAddress)(w.address)===(0,Ps.getAddress)(d)),m=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Ps.getAddress)(w.address)===(0,Ps.getAddress)(d));if(!p||!await p.isConnected())ee(d),an();else if(!p.linked)p.loginOrLink();else{let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(U,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ss(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw F(U,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Ue(s);if(!d||!L)throw F(U,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw F(U,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await jp()}catch(p){throw F(U,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,m)=>{Ce(!0);let w={onSuccess:G=>{F(U,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{F(U,"setWalletPassword","onError","user_exited_set_password_flow"),m(G)},callAuthOnSuccessOnClose:!1},T={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{F(U,"setWalletPassword","onError","unknown_connect_wallet_error"),m(G)}};ce({setWalletPassword:w,connectWallet:T}),xe("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,w)=>{if(!a||!s){F(U,"signMessage","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let T=Ue(s)||Ci(s);if(!T){F(U,"signMessage","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(U,"signMessage","onError","invalid_message"),w(new Error("Message must be a non-empty string"));return}Ce(!0);let G=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let q=await ke();if(!L||!q)throw new Error("Unable to connect to wallet");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:T.address}});let{response:Qe}=await L.rpc({accessToken:q,address:T.address,request:{method:"personal_sign",params:[d,T.address]}}),sr=Qe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:T.address}}),sr};if(D.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let q=await G();F(U,"signMessage","onSuccess",q),m(q)}catch(q){F(U,"signMessage","onError","unable_to_sign"),w(q??new nt("Unable to sign message"))}}else{let Qe={method:"personal_sign",data:d,confirmAndSign:G,onSuccess:Pt=>{F(U,"signMessage","onSuccess",Pt),m(Pt)},onFailure:Pt=>{F(U,"signMessage","onError","unable_to_sign"),w(Pt)},uiOptions:p||{}},sr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Pt=>{F(U,"signMessage","onError","unknown_connect_wallet_error"),w(Pt)}};ce({signMessage:Qe,connectWallet:sr}),xe("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,w)=>{if(!a||!s){F(U,"signTypedData","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let T=Ue(s);if(!T){F(U,"signTypedData","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}Ce(!0);let G=Bs(d),q=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Je=await ke();if(!L||!Je)throw new Error("Unable to connect to wallet");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:T.address}});let{response:sr}=await L.rpc({accessToken:Je,address:T.address,request:{method:"eth_signTypedData_v4",params:[T.address,G]}}),Pt=sr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:T.address}}),Pt};if(D.embeddedWallets.noPromptOnSignature||(D.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Je=await q();F(U,"signTypedData","onSuccess",Je),m(Je)}catch(Je){F(U,"signTypedData","onError","unable_to_sign"),w(Je??new nt("Unable to sign message"))}}else{let sr={method:"eth_signTypedData_v4",data:G,confirmAndSign:q,onSuccess:Vt=>{F(U,"signTypedData","onSuccess",Vt),m(Vt)},onFailure:Vt=>{F(U,"signTypedData","onError","unable_to_sign"),w(Vt)},uiOptions:p||{}},Pt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Vt=>{F(U,"signMessage","onError","unknown_connect_wallet_error"),w(Vt)}};ce({signMessage:sr,connectWallet:Pt}),xe("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let T=await(await Kp(d,p,m)).wait();return qc(T)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Ue(s)){p(new Error("Must have a Privy wallet before exporting"));return}Ce(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ce(Le),!await ke()||!L){p(new Error("Must have valid access token to enroll in MFA"));return}if(!L){p(new Error("Must have a Privy wallet before exporting"));return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ce({keyExport:G,connectWallet:w}),xe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:jp,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 P("Invalid MFA code");ir.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((G,q)=>{st.current={resolve:G,reject:q}});break;case"passkey":if(typeof p=="string")throw new P("Invalid authenticator response");let w=await(await import("@simplewebauthn/browser")).startAuthentication(p),T=R3(w);ir.current?.resolve({mfaMethod:d,mfaCode:T,relyingParty:window.origin}),await new Promise((G,q)=>{st.current={resolve:G,reject:q}});break;default:throw ir.current?.reject(new P("Unsupported MFA method")),new P(`Unsupported MFA method: ${d}`)}},cancel(){ir.current?.reject(new P("MFA canceled"))},async initEnrollmentWithSms(d){let p=await ke();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){Ee.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."),ce({mfaEnrollmentFlow:{mfaMethods:D.mfa.methods,onSuccess:p,onFailure:m}}),xe("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await ke();if(!d||!L)throw new Error("Must have valid access token to enroll in MFA");let p=await L.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await ke();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await ke();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await ke();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await ke();if(!p||!L)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await L.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await ke(),p=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let w=await L.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(w.status==="approved"){let T=await t.getAuthenticatedUser();c(T||s||null)}ce({farcasterSigner:w}),xe("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await ke(),p=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Ee.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(T=>Uint8Array.from(T.match(/.{1,2}/g).map(G=>parseInt(G,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await ke(),m=s?.linkedAccounts.find(q=>q.type==="wallet"&&q.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!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 Ee.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 T=await import("@simplewebauthn/browser"),G=await L.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:T.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(T.base64URLStringToBuffer(G.signature))},isHeadlessOAuthLoading:S,loginWithCode(d){return Ee.loginWithCode(d)},initLoginWithEmail(d){return Ee.initLoginWithEmail(d)},initLoginWithSms(d){return Ee.initLoginWithSms(d)},otpState:O,fundWallet(d,p){return Ee.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Ee.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Ee.loginWithHeadlessOAuth(d)},isModalOpen:r};M3=mi.signMessage,W3=mi.signTypedData,L3=async(...d)=>{let p=await Kp(...d);return D.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Ee=(()=>({isNewUserThisSession:g,linkingHint:Z,pendingTransaction:null,walletConnectionStatus:R,mipdStore:I,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(L)return L;let p=new Promise(T=>{Et(()=>G=>T(G))}),m=new Promise(T=>setTimeout(()=>T(null),d)),w=await Promise.race([p,m]);return Et(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,m;p&&ie.current&&(m=s?.linkedAccounts.filter(w=>w.latestVerifiedAt!==null&&!(w.type==="wallet"&&w.walletClientType==="privy")).sort((w,T)=>T.latestVerifiedAt.getTime()-w.latestVerifiedAt.getTime())[0]),ae.current==="login"&&ie.current?d.shouldCallAuthOnSuccess&&p?(F(U,"login","onComplete",s,g,!1,ie.current,m??null),e.onSuccess?.(s,g)):F(U,"login","onError","exited_auth_flow"):ae.current==="link"&&ie.current&&m&&(d.isSuccess&&p?F(U,"linkAccount","onSuccess",s,ie.current,m):F(U,"linkAccount","onError","exited_link_flow")),ee(null),ae.current=null,ie.current=null,C(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:xe,connectWallet:ui,initLoginWithWallet:async(d,p)=>{ie.current="siwe",On(d,p)},loginWithWallet:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof $n))throw new P("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),ie.current="siwe"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ie.current="siwe"}catch(m){throw F(U,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),C(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Pa(d);t.startAuthFlow(p);try{ie.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw ae.current==="login"?F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof Pa))throw new P("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),ie.current="farcaster"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ie.current="farcaster"}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),C(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ie.current=d,ld()){if(d==="google"&&ed(window.navigator.userAgent)){rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}ne.del(Hn);let m=new Co({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&window.location.assign(w.url)},async initLoginWithTelegram(d){if(!n)throw new vo;ie.current="telegram";let p=new Wa(d);t.startAuthFlow(p),t.authFlow.meta.telegramAuthResult=await new Promise((m,w)=>{if(!D.loginConfig.telegramAuthConfiguration)return w("Telegram Auth configuration is not loaded");if(!window.Telegram)return w("Telegram was not initialized");window.Telegram.Login.auth({bot_id:D.loginConfig.telegramAuthConfiguration.botId,request_access:!0},T=>T?m(T):w("Telegram auth failed or was canceled by the client"))})},async loginWithTelegram(){if(!n)throw new vo;if(!(t.authFlow instanceof Wa))throw new P("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),ie.current="telegram"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,ie.current="telegram"}catch(m){throw ae.current==="login"?F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),C(p||!1),l(!0)},async recoveryOAuthFlow(d,p,m){let w,T;function G(q){if(!q)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new P("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:q,codeVerifier:Je,stateCode:Qe}=await Yd({api:nn.api,provider:d});G(q);let sr,Pt;try{let Vt=await zp({url:q,popup:m,provider:d});if(sr=Vt.stateCode,Pt=Vt.authorizationCode,sr!==Qe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:Qe??"",returnedStateCode:sr??""}}),new P("Unexpected auth flow. This may be a phishing attempt.")}catch(Vt){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Vt.toString(),provider:d}}),new P("Recovery OAuth failed")}[w,T]=await Promise.all([ke(),bh({api:nn.api,provider:d,codeVerifier:Je,stateCode:sr,authorizationCode:Pt})]);break}case"icloud":{let{url:q}=await Yd({api:nn.api,provider:d});G(q);let{ckWebAuthToken:Je}=await zp({url:q,popup:m,provider:d});T=Je,w=await ke();break}}if(!L)throw new P("Cannot connect to wallet proxy");switch(p){case"recover":let q=Le.recoverWallet?.privyWallet?.address;if(!q)throw new P("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:q,recoveryMethod:d}}),await L.recover({address:q,accessToken:w,recoveryAccessToken:T,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:q,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await L.create({accessToken:w,recoveryAccessToken:T,recoveryMethod:d});let Je=await Ee.refreshUser(),Qe=Ue(Je);if(!Qe)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Qe.address}}),F(U,"createWallet","onSuccess",Qe);break;default:throw new P("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Co))throw new P("Must initialize OAuth flow before calling loginWithOAuth");let p=ne.get(Fn),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new P("Unexpected auth flow. This may be a phishing attempt.");let w,T,G;if(a)try{let q=await t.link();w=q.user,G=q.oAuthProviderTokens,ie.current=d}catch(q){throw F(U,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}else try{let q=await t.authenticate();w=q.user,T=q.isNewUser,G=q.oAuthProviderTokens,ie.current=d}catch(q){throw ae.current==="login"?F(U,"login","onError",q.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}return c(w),C(T||!1),l(!0),G},async initLoginWithPasskey(d){let p=new qn(d);t.startAuthFlow(p),ae.current="login";try{ie.current="passkey",await p.initAuthenticationFlow()}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof qn))throw new P("Must initialize Passkey flow first.");if(ie.current!=="passkey")throw new P("Must init login with Passkey flow first.");let d,p;try{ie.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),C(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new qn(d);t.startAuthFlow(p),ae.current="link",ie.current="passkey";try{await p.initLinkFlow()}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof qn))throw new P("Must initialize Passkey flow first.");if(ie.current!=="passkey")throw new P("Must init login with Passkey flow first.");let d;try{ie.current="passkey",{user:d}=await t.link()}catch(p){throw F(U,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(ld()){if(d==="google"&&ed(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 Co({provider:d,headless:!0});p&&m.addCaptchaToken(p);let w=await t.startAuthFlow(m).getAuthorizationUrl();w?.url&&window.location.assign(w.url)},async loginWithHeadlessOAuth(d){b(!0),t.startAuthFlow(new Co(d));let p=ne.get(Fn),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),b(!1),new P("Unexpected auth flow. This may be a phishing attempt.");let w,T;if(a)try{({user:w}=await t.link()),ie.current=d.provider}catch(G){throw F(U,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:w,isNewUser:T}=await t.authenticate()),ie.current=d.provider}catch(G){throw ae.current==="login"?F(U,"login","onError",G.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(w),C(T||!1),l(!0),b(!1),w??void 0},initLoginWithEmail:async(d,p)=>{let m=new sn(d,p);t.startAuthFlow(m);try{ie.current="email",await m.sendCodeEmail()}catch(w){throw ae.current==="login"?F(U,"login","onError",w.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},initUpdateEmail:async(d,p,m)=>{let w=new Ls(d,p,m);t.startAuthFlow(w),await w.sendCodeEmail()},initLoginWithSms:async(d,p)=>{M({status:"sending-code"});let m=new Kn(d,p);t.startAuthFlow(m);try{ie.current="sms",await m.sendSmsCode(),M({status:"awaiting-code-input"})}catch(w){throw M({status:"error",error:w}),ae.current==="login"?F(U,"login","onError",w.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(M({status:"submitting-code"}),!n){let T=new vo;throw M({status:"error",error:T}),T}if(t.authFlow instanceof sn)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Kn)t.authFlow.meta.smsCode=d.trim();else{let T=new P("Must initialize a passwordless code flow first");throw M({status:"error",error:T}),T}let p=await ke(),m,w;if(p&&t.sessionHasActiveToken())try{({user:m}=await t.link())}catch(T){throw M({status:"error",error:T}),F(U,"linkAccount","onError",T.privyErrorCode||"failed_to_link_account"),T}else try{({user:m,isNewUser:w}=await t.authenticate())}catch(T){throw M({status:"error",error:T}),F(U,"login","onError",T.privyErrorCode||"unknown_auth_error"),T}c(m||s||null),C(w||!1),l(!0),M({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:L,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(T=>T.type==="wallet"&&T.walletClientType==="privy"),w=await ke();if(!w||!L||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Ce(!0);try{await L.connect({accessToken:w,address:m.address}),d(!0)}catch(T){if($i(T)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await L.recover({address:m.address,accessToken:w})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if($i(T)&&m.recoveryMethod!=="privy"){ce({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:m.recoveryMethod,action:"recover"}});let G=nc(m.recoveryMethod);xe(G)}else p(T)}}),getFiatOnRampConfig:Jr,setReadyToTrue:d=>{i(!0),Jt?.(d)},updateWallets:()=>Nn(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:w}=await Jr(d,p);ce({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:w}}),xe("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await ke(),m=s?.linkedAccounts.find(T=>T.type==="wallet"&&T.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!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 w=await t.requestFarcasterSignerStatus(d);if(w.status==="approved"){let T=await t.getAuthenticatedUser();c(T||s||null)}return w}}))();O3=Ee.recoverEmbeddedWallet;let u0=(0,le.useMemo)(()=>({wallets:u,ready:Nr&&Ln}),[u,Nr,Ln]);return(0,Zt.jsx)(Ae.Provider,{value:mi,children:(0,Zt.jsx)(Wd.Provider,{value:U,children:(0,Zt.jsx)(Lp.Provider,{value:u0,children:(0,Zt.jsxs)(uf,{...D,children:[e.children,(0,Zt.jsxs)(Md.Provider,{value:Ee,children:[!D.headless&&D.captchaEnabled&&n&&!a&&(0,Zt.jsx)(Ll,{delayedExecution:!1}),(0,Zt.jsx)(b3,{theme:{...D.appearance.palette||{}}}),(0,Zt.jsx)(ef,{data:Le,setModalData:ce,setInitialScreen:x,initialScreen:v,authenticated:a,open:r,children:(0,Zt.jsx)(T3,{open:r})}),ve&&be?(0,Zt.jsx)(k3,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ir,mfaSubmitPromise:st,onLoad:Y,onLoadFailed:()=>null}):null,D.loginMethods.telegram&&D.loginConfig.telegramAuthConfiguration&&(0,Zt.jsx)(ao,{if:!0,children:(0,Zt.jsx)(S3,{scriptHost:e.apiUrl||Ta,botUsername:D.loginConfig.telegramAuthConfiguration.botName})})]})]})})})})};var D3=require("react");function U3(e){let{login:t}=(0,D3.useContext)(Ae);return it("login",e),{login:t}}var F3=require("react");function B3(e){let{logout:t}=(0,F3.useContext)(Ae);return it("logout",e),{logout:t}}var Ts=require("react");function H3(){let e=Pe(),t=kl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=(0,Ts.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new oo(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,Ts.useCallback)(async()=>{let c=Ma();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{zn()}},[o]);return(0,Ts.useEffect)(()=>{let c=Ma();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var qp=require("react");var G3=()=>{let e=Pe(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=(0,qp.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,qp.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new oo(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var $p=require("react");var V3=()=>{let e=Pe(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=(0,$p.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=(0,$p.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new oo(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};var z3=require("react");function q3(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:y,linkTelegram:g,linkFarcaster:C}=(0,z3.useContext)(Ae);return it("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:y,linkFarcaster:C,linkTelegram:g}}var $3=require("react");function K3(e){let{connectWallet:t}=(0,$3.useContext)(Ae);return it("connectWallet",e),{connectWallet:t}}var j3=require("react");function Y3(e){let{createWallet:t}=(0,j3.useContext)(Ae);return it("createWallet",e),{createWallet:t}}var Z3=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var J3=require("react");function Q3(e){let{sendTransaction:t}=(0,J3.useContext)(Ae);return it("sendTransaction",e),{sendTransaction:t}}var X3=require("react");function e0(e){let{setWalletPassword:t}=(0,X3.useContext)(Ae);return it("setWalletPassword",e),{setWalletPassword:t}}var t0=require("react");function r0(e){let{signMessage:t}=(0,t0.useContext)(Ae);return it("signMessage",e),{signMessage:t}}var o0=require("react");function n0(e){let{signTypedData:t}=(0,o0.useContext)(Ae);return it("signTypedData",e),{signTypedData:t}}var i0=require("react");var a0=()=>{let{isModalOpen:e}=(0,i0.useContext)(Ae);return{isOpen:e}};var s0=require("react");function l0(e){let{getAccessToken:t}=(0,s0.useContext)(Ae);return it("accessToken",e),{getAccessToken:t}}function c0(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function d0(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
3035
+ `;var ft=require("react/jsx-runtime"),h5={["LANDING"]:B1,["CONNECT_OR_CREATE"]:F1,["AWAITING_PASSWORDLESS_CODE"]:Bf,["AWAITING_CONNECTION"]:mh,["AWAITING_CONNECT_ONLY_CONNECTION"]:yh,["AWAITING_FARCASTER_CONNECTION"]:Fy,["AWAITING_FARCASTER_SIGNER"]:Vy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:I2,["PHANTOM_INTERSTITIAL_SCREEN"]:O2,["LOGIN_FAILED_SCREEN"]:rg,["AWAITING_OAUTH_SCREEN"]:R2,["ALLOWLIST_REJECTION_SCREEN"]:Af,["USER_LIMIT_REACHED_SCREEN"]:v3,["INSTALL_PHANTOM_SCREEN"]:p1,["LINK_EMAIL_SCREEN"]:G1,["LINK_PHONE_SCREEN"]:X1,["LINK_WALLET_SCREEN"]:eg,["LINK_PASSKEY_SCREEN"]:Z1,["UPDATE_EMAIL_SCREEN"]:y3,["CONNECT_ONLY_LANDING_SCREEN"]:dh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:nh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Oh,["EMBEDDED_WALLET_CREATED_SCREEN"]:xh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Th,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:D2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:j2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:B2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Mh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:c3,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:a3,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Qy,["FIAT_ON_RAMP_STATUS_SCREEN"]:o1,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Ey,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:vy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:H2,["MFA_ENROLLMENT_FLOW_SCREEN"]:Ng,["CAPTCHA_SCREEN"]:jf,["ERROR_SCREEN"]:Sy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:a1,["AFFIRMATIVE_CONSENT_SCREEN"]:_f,["TELEGRAM_AUTH_SCREEN"]:u3},y5=["LANDING","AWAITING_CONNECTION"],g5=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=dr(),{ready:i,currentScreen:a}=k(),{status:l,execute:s,reset:c,enabled:u}=Te(),f=(0,on.useRef)(null),y=ff(f),g=o&&a&&y5.includes(a)&&!n&&l==="ready";if((0,on.useEffect)(()=>{g&&s()},[g]),(0,on.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,ft.jsxs)(ca,{id:"privy-modal-content",children:[(0,ft.jsx)(_,{}),(0,ft.jsx)(se,{}),(0,ft.jsx)(wg,{children:(0,ft.jsx)(_t,{})}),(0,ft.jsx)(me,{}),(0,ft.jsx)(z,{})]});if(!a&&e)return(0,ft.jsx)(ca,{style:{height:y},id:"privy-modal-conent",children:(0,ft.jsx)("div",{ref:f,children:(0,ft.jsx)(Op,{open:e,onClose:t})})});if(!a)return null;let C=h5[a];return(0,ft.jsx)(ca,{style:{height:y},id:"privy-modal-content",children:(0,ft.jsxs)("div",{ref:f,children:[(0,ft.jsx)(ao,{if:!!e,children:(0,ft.jsx)(C,{})}),(0,ft.jsx)(ao,{if:!e,children:(0,ft.jsx)(Op,{open:e,onClose:t})})]})})},v5=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=k();return{gracefulClosePrivyModal:(0,on.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},P3=({open:e})=>{let{app:t}=k(),{gracefulClosePrivyModal:r}=v5(),[o,n]=(0,on.useState)(!1);Fl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,ft.jsx)(b3,{children:(0,ft.jsx)(g5,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,ft.jsx)(Cg,{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 E3.default.createPortal(l,s)}return l};var Es=require("react"),S3=require("react/jsx-runtime");function C5({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function T3(e){let t=(0,Es.useRef)(null),r=(0,Es.useRef)();return(0,Es.useEffect)(()=>{r.current?.remove(),r.current=C5(e),t.current?.after(r.current)},[e]),(0,S3.jsx)("div",{ref:t,hidden:!0})}var _3=require("react"),ba=require("react");var Xc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-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 Mn(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 tt("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((y,g)=>{r.current={resolve:y,reject:g};let C=1e3*60*5;setTimeout(()=>{let v=new tt("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},C)});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 tt("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var k3=require("react/jsx-runtime"),w5=function(e){return()=>`id-${e++}`}(0);function b5(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function br(e){return e.error!==void 0}var or=new Xc,Gp=new Map,E5=(e,t)=>typeof t=="bigint"?t.toString():t,P5=(e,t)=>`${e}${JSON.stringify(t,E5)}`;function Er(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=P5(e,t);if(e==="privy:wallet:create"){let l=Gp.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=w5();or.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{Gp.delete(i)});return Gp.set(i,a),a}function T5(e){switch(e.event){case"privy:iframe:ready":let t=or.dequeue(e.event,e.id);return br(e)?t.reject(new tt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=or.dequeue(e.event,e.id);return br(e)?r.reject(new tt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=or.dequeue(e.event,e.id);return br(e)?o.reject(new tt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=or.dequeue(e.event,e.id);return br(e)?n.reject(new tt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=or.dequeue(e.event,e.id);return br(e)?i.reject(new tt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=or.dequeue(e.event,e.id);return br(e)?a.reject(new tt(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let l=or.dequeue(e.event,e.id);return br(e)?l.reject(new tt(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=or.dequeue(e.event,e.id);return br(e)?s.reject(new tt(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:submit-enrollment":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:unenroll":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:mfa:clear":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:init-signer":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}case"privy:farcaster:sign":{let c=or.dequeue(e.event,e.id);return br(e)?c.reject(new tt(e.error.type,e.error.message)):c.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function x3(e){let t=(0,ba.useRef)(null),r=(0,ba.useRef)(e.mfaMethods),o=Ul(),[n,i]=(0,_3.useState)(!1);return(0,ba.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,ba.useEffect)(()=>{if(!n)return;let a=t.current;if(!a)return;function l(y){y&&y.origin===e.origin&&b5(y.data)&&T5(y.data)}let s={create(y){return Er("privy:wallet:create",y,a,e.origin)},import(y){return Er("privy:wallet:import",y,a,e.origin)},connect(y){return Er("privy:wallet:connect",y,a,e.origin)},recover(y){return Mn(g=>Er("privy:wallet:recover",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(y){return Mn(g=>Er("privy:wallet:rpc",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(y){return Mn(g=>Er("privy:wallet:set-recovery-password",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(y){return Mn(g=>Er("privy:mfa:verify",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(y){return Mn(g=>Er("privy:mfa:init-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(y){return Mn(g=>Er("privy:mfa:submit-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(y){return Mn(g=>Er("privy:mfa:unenroll",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(y){return Er("privy:mfa:clear",y,a,e.origin)},initFarcasterSigner(y){return Er("privy:farcaster:init-signer",y,a,e.origin)},signFarcasterMessage(y){return Er("privy:farcaster:sign",y,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...y)=>{console.warn("Privy iframe failed to load: ",...y),e.onLoadFailed()},f=new AbortController;return Vu(()=>Er("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),(0,k3.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Us(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function ed(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var S5="https://cdn.apple-cloudkit.com";async function Vp({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===S5&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var A3=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});var Yt=require("react/jsx-runtime"),nn;function _5(e){return typeof e=="string"&&e.length===25}function Ae(){if(!nn){let e=ne.get(Dn);return Promise.resolve(e||null)}return nn.getAccessToken()}var I3,gm=(e,t,r)=>I3(e,t,r),M3,vm=(e,t)=>M3(e,t),W3,Cm=(e,t)=>W3(e,t),L3,wm=()=>L3(),x5=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ne.put(Ta,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},O3=({config:e,...t})=>{if(!_5(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");nn||(nn=new Ii({appId:t.appId,apiUrl:t.apiUrl||Pa}));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."),(0,Yt.jsx)(Zm,{client:nn,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Yt.jsx)(k5,{...t,client:nn})})},k5=e=>{let t=e.client,[r,o]=(0,le.useState)(!1),[n,i]=(0,le.useState)(!1),[a,l]=(0,le.useState)(!1),[s,c]=(0,le.useState)(null),[u,f]=(0,le.useState)([]),y=(0,le.useRef)(u),[g,C]=(0,le.useState)(!1),[v,x]=(0,le.useState)(null),[S,b]=(0,le.useState)(!1),[R,A]=(0,le.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[O,M]=(0,le.useState)({status:"initial"}),[I,V]=(0,le.useState)(null),[Y,ee]=(0,le.useState)(null),[L,j]=(0,le.useState)(null),D=dr(),be=kl(),[ve,Ce]=(0,le.useState)(!0),[Oe,ce]=(0,le.useState)({}),[Zt,wt]=(0,le.useState)(null),[nr,Pt]=(0,le.useState)(null),[Nr,Ye]=(0,le.useState)(!1),[ht,Dr]=(0,le.useState)(!1),ir=(0,le.useRef)(null),st=(0,le.useRef)(null),U=(0,le.useRef)(hf),[Wn,Ne]=(0,le.useState)(!1);t.onStoreToken=d=>{d&&F(U,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),F(U,"accessToken","onAccessTokenRemoved")};let ie=(0,le.useRef)(null),ae=(0,le.useRef)(null),ke=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},rt=d=>{D.embeddedWallets.createOnLogin!=="off"&&Ce(!0),ke(d)};(0,le.useEffect)(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),(0,le.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=Fe(s),p=Wa(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!L){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(L,d.address,D.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(L,p.address,D.defaultChain,e.appId)},[L,s]),(0,le.useEffect)(()=>{L&&nr?.(L)},[L]),(0,le.useEffect)(()=>{(async()=>{if(!D.customAuth?.enabled)return;Ce(!0);let{getCustomAccessToken:p,isLoading:m}=D.customAuth;if(!(!n||m))try{let w=await p();if(!w&&a){await ui.logout();return}if(!w||a)return;t.startAuthFlow(new mi(w));let{user:P,isNewUser:G}=await t.authenticate();if(!P){await ui.logout();return}c(P||null),C(G||!1),l(!0),Dr(!0)}catch(w){console.warn(w),a&&await ui.logout()}})()},[D.customAuth?.enabled,D.customAuth?.getCustomAccessToken,D.customAuth?.isLoading,n,a]),(0,le.useEffect)(()=>{ht&&L&&s&&cr(s,D.embeddedWallets.createOnLogin)&&(Dr(!1),Ss(s,yi).catch(console.error))},[ht&&L&&s]),(0,le.useEffect)(()=>{async function d(){let p=rd();x5();let m=(0,R3.createStore)();V(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 w;t.connectors?.on("connectorInitialized",()=>{w&&clearTimeout(w);let G=t.connectors.walletConnectors.length,J=t.connectors.walletConnectors.reduce((Pe,ct)=>Pe+(ct.initialized?1:0),0);J===G?Ne(!0):w=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:J,expected:G}),Ne(!0)},1500)}),t.connectors?.initialize().then(()=>{od()});let P=await t.getAuthenticatedUser();D.customAuth?.enabled||(l(!!P),P&&F(U,"login","onComplete",P,!1,!0,null,null),c(P)),p||Ee.setReadyToTrue(!!P),p&&(P?ae.current="link":ae.current="login")}!n&&be&&d()},[t,Zt,n,be]),(0,le.useEffect)(()=>{if(!n)return;if(!s){Ye(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){Ye(!0);return}let p=!!u.find(m=>m.walletClientType==="privy");Ye(p)},[n,s,u]);let rd=()=>{let d=Ia();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 Co(d)),rt("AWAITING_OAUTH_SCREEN"),!0)},di=async(d,p,m,w)=>{let P=await t.connectors?.createWalletConnector(d,p)||null;pi(P,p,m,w)};async function pi(d,p,m,w){if(d)A({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return A({status:"disconnected",connectedWallet:null,connectError:new de("Unable to connect to wallet."),connector:null,connectRetry:E}),w?.(null,m);d instanceof Eo&&p&&await d.resetConnection(p),A({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>pi(d,p,m,w)});try{let P=await d.connect({showPrompt:!0});if(D.shouldEnforceDefaultChainOnConnect&&!D.chains.find(G=>G.id===Number(P?.chainId))&&!(P?.connectorType==="wallet_connect_v2"&&P?.walletClientType==="metamask")){A(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await P?.switchChain(D.defaultChain.id),P&&(P.chainId=hi(Nn(D.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${D.defaultChain.id}`)}}return A(G=>({...G,status:"connected",connectedWallet:P,connectError:null,connectRetry:E})),P&&!ae.current&&F(U,"connectWallet","onSuccess",P),w?.(P,m)}catch(P){return P instanceof dt?(console.warn(P.cause?P.cause:P.message),ae.current||F(U,"connectWallet","onError",P.privyErrorCode||"generic_connect_wallet_error")):(console.warn(P),ae.current||F(U,"connectWallet","onError","unknown_connect_wallet_error")),A(G=>({...G,status:"disconnected",connectedWallet:null,connectError:P})),w?.(null,m)}}let Ln=async(d,p)=>{if(d===null)return;let m=new qn(d,p);t.startAuthFlow(m)},od=()=>{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"&&!ln()&&rt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");ke("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),di(p,m,void 0,Ln)};(0,le.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let lt=()=>{if(!a)throw F(U,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},an=()=>{lt(),ie.current="siwe",ae.current="link",ke("LINK_WALLET_SCREEN")},Gt=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},Pr=async d=>{if(!t.connectors)throw new T("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:E})),D.captchaEnabled&&!a){let m={callback:w=>Ln(d,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ce({captchaModalData:m}),rt("CAPTCHA_SCREEN")}else await Ln(d),rt("AWAITING_CONNECTION")},Jr=async(d,p)=>{if(!D.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:w}=await Zy(t,d,p?.config??{},D.appearance.palette,D.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:w}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},On=()=>{f(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Gt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new T("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");Pr(m)},fund:async w=>{let{signedUrl:P,externalTransactionId:G}=await Jr(m.address,w);ce({fiatOnRampPrompt:{signedUrl:P},fiatOnRampStatus:{externalTransactionId:G}}),ke("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new T("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(m.address);c(w)}}))||[];return ll(d,p)?d:p})};(0,le.useEffect)(()=>{On()},[s?.linkedAccounts,a,n]),(0,le.useEffect)(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");On(),t.connectors.on("walletsUpdated",On)}},[n]);let Do=()=>{ke(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,le.useEffect)(()=>{if(!u[0])return;let d=u[0],p=y.current.find(w=>w.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType==="privy"):m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType!=="privy"),!p&&m){let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(w)}y.current=u},[u]);let Ss=async(d,p)=>{if(Fe(d))throw F(U,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,P]=await Promise.all([Ee.initializeWalletProxy(p),Ae()]);if(!w&&D.customAuth?.enabled)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!P||D.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((G,J)=>{Ce(!0),ce({createWallet:{onSuccess:ct=>{F(U,"createWallet","onSuccess",ct),G(ct)},onFailure:ct=>{F(U,"createWallet","onError","unknown_embedded_wallet_error"),J(ct)},callAuthOnSuccessOnClose:!1}}),ke("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:P});let G=await Ee.refreshUser(),J=Fe(G);if(!J)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(U,"createWallet","onSuccess",J),J}},d0=d=>{if(!D.chains.map(p=>p.id).includes(d))throw new de(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},$p=(d,p,m)=>new Promise(async(w,P)=>{if(!a||!s){F(U,"sendTransaction","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=Fe(s);if(!G){F(U,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}Ce(!0);let J=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Pe=d.chainId?Number(d.chainId):J.chainId;d0(Pe);let ct=Object.assign({},d,{chainId:Pe}),sr=async()=>{let Jt=await Ae();if(!Jt||!L){F(U,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Ee.recoverEmbeddedWallet()){F(U,"sendTransaction","onError","unknown_connect_wallet_error"),P(new Error("Unable to connect to wallet"));return}let Qr=Uo(ct.chainId,D.chains,D.rpcConfig,{appId:e.appId}),nd=await ha(G.address,ct,Qr);if(D.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:u0}=await fa(nd,Qr),{hasSufficientFunds:m0}=await zc(G.address,nd,u0,Qr);if(!m0)throw new nt(new _r("Wallet has insufficient funds for this transaction.",Dt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let jp=await Vc(Jt,G.address,L,nd,Qr);F(U,"sendTransaction","onSuccess",jp),w(jp)}catch(Qe){F(U,"sendTransaction","onError","transaction_failure"),P(Qe)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),sr();else{let Jt={transactionRequest:ct,onSuccess:Qr=>{F(U,"sendTransaction","onSuccess",Qr),w(Qr)},onFailure:Qr=>{F(U,"sendTransaction","onError","transaction_failure"),P(Qr)},uiOptions:p||{},fundWalletConfig:m},Qe={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{F(U,"sendTransaction","onError","unknown_connect_wallet_error"),P(Qr)}};ce({connectWallet:Qe,sendTransaction:Jt}),ke("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Kp(){return new Promise(async(d,p)=>{let m=await Ae();if(!m||!L)throw new Error("Must have valid access token to enroll in MFA");try{await L.verifyMfa({accessToken:m}),d()}catch(w){p(w)}})}let ar=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw F(U,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw F(U,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},ui={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Do,importWallet:async({privateKey:d})=>{lt();let[p,m]=await Promise.all([Ee.initializeWalletProxy(15e3),Ae()]);if(p&&m){await p.import({privateKey:d,accessToken:m});let w=await Ee.refreshUser(),P=Wa(w);if(!P)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return F(U,"createWallet","onSuccess",P),P}else throw new T("User is not authenticated")},linkWallet:an,linkEmail:()=>{lt(),ar("email"),ie.current="email",ae.current="link",ke("LINK_EMAIL_SCREEN")},linkPhone:()=>{lt(),ar("phone"),ie.current="sms",ae.current="link",ke("LINK_PHONE_SCREEN")},linkGoogle:async()=>{lt(),ar("google"),ae.current="link",await Ee.initLoginWithOAuth("google")},linkTwitter:async()=>{lt(),ar("twitter"),ae.current="link",await Ee.initLoginWithOAuth("twitter")},linkDiscord:async()=>{lt(),ar("discord"),ae.current="link",await Ee.initLoginWithOAuth("discord")},linkGithub:async()=>{lt(),ar("github"),ae.current="link",await Ee.initLoginWithOAuth("github")},linkSpotify:async()=>{lt(),ar("spotify"),ae.current="link",await Ee.initLoginWithOAuth("spotify")},linkInstagram:async()=>{lt(),ar("instagram"),ae.current="link",await Ee.initLoginWithOAuth("instagram")},linkTiktok:async()=>{lt(),ar("tiktok"),ae.current="link",await Ee.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{lt(),ar("linkedin"),ae.current="link",await Ee.initLoginWithOAuth("linkedin")},linkApple:async()=>{lt(),ar("apple"),ae.current="link",await Ee.initLoginWithOAuth("apple")},linkPasskey:async()=>{lt(),ar("passkey"),await Ee.initLinkWithPasskey(),ke("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{lt(),ar("telegram"),ae.current="link",ie.current="telegram",await Ee.initLoginWithTelegram(),ke("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{lt(),ar("farcaster"),await Ee.initLoginWithFarcaster(),ae.current="link",ie.current="farcaster",ke("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(lt(),!s?.email)throw new T("User does not have an email linked to their account.");ae.current="link",ie.current="email",ke("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=>{wt(w=>m.bind(w))});if(wt(null),p){console.warn(d);return}}if(a){console.warn(d);return}ae.current="login",rt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{wt(()=>d)}),wt(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}rt("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&L)try{await L.clearMfa({userId:s.id})}catch{}c(null),l(!1),x(null),F(U,"logout","onSuccess"),ae.current=null,ie.current=null,o(!1),ne.del(Sa)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Je;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new Je:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new td.Web3Provider(new to(new Je));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new td.Web3Provider(new to(new Je)):new td.Web3Provider(new to(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new un(new Je);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new un(new Je):new un(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(w=>(0,Ps.getAddress)(w.address)===(0,Ps.getAddress)(d)),m=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Ps.getAddress)(w.address)===(0,Ps.getAddress)(d));if(!p||!await p.isConnected())ee(d),an();else if(!p.linked)p.loginOrLink();else{let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},c(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(U,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ss(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw F(U,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Fe(s);if(!d||!L)throw F(U,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw F(U,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Kp()}catch(p){throw F(U,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,m)=>{Ce(!0);let w={onSuccess:G=>{F(U,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{F(U,"setWalletPassword","onError","user_exited_set_password_flow"),m(G)},callAuthOnSuccessOnClose:!1},P={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{F(U,"setWalletPassword","onError","unknown_connect_wallet_error"),m(G)}};ce({setWalletPassword:w,connectWallet:P}),ke("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p,m)=>new Promise(async(w,P)=>{if(!a||!s){F(U,"signMessage","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=u.find(Pe=>Pe.address===m)??Fe(s);if(!G){F(U,"signMessage","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(U,"signMessage","onError","invalid_message"),P(new Error("Message must be a non-empty string"));return}Ce(!0);let J=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Pe=await Ae();if(!L||!Pe)throw new Error("Unable to connect to wallet");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:G.address}});let{response:sr}=await L.rpc({accessToken:Pe,address:G.address,request:{method:"personal_sign",params:[d,G.address]}}),Jt=sr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:G.address}}),Jt};if(D.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Pe=await J();F(U,"signMessage","onSuccess",Pe),w(Pe)}catch(Pe){F(U,"signMessage","onError","unable_to_sign"),P(Pe??new nt("Unable to sign message"))}}else{let sr={method:"personal_sign",data:d,confirmAndSign:J,onSuccess:Qe=>{F(U,"signMessage","onSuccess",Qe),w(Qe)},onFailure:Qe=>{F(U,"signMessage","onError","unable_to_sign"),P(Qe)},uiOptions:p||{}},Jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(U,"signMessage","onError","unknown_connect_wallet_error"),P(Qe)}};ce({signMessage:sr,connectWallet:Jt}),ke("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,w)=>{if(!a||!s){F(U,"signTypedData","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let P=Fe(s);if(!P){F(U,"signTypedData","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}Ce(!0);let G=Bs(d),J=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Pe=await Ae();if(!L||!Pe)throw new Error("Unable to connect to wallet");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:P.address}});let{response:sr}=await L.rpc({accessToken:Pe,address:P.address,request:{method:"eth_signTypedData_v4",params:[P.address,G]}}),Jt=sr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:P.address}}),Jt};if(D.embeddedWallets.noPromptOnSignature||(D.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Pe=await J();F(U,"signTypedData","onSuccess",Pe),m(Pe)}catch(Pe){F(U,"signTypedData","onError","unable_to_sign"),w(Pe??new nt("Unable to sign message"))}}else{let sr={method:"eth_signTypedData_v4",data:G,confirmAndSign:J,onSuccess:Qe=>{F(U,"signTypedData","onSuccess",Qe),m(Qe)},onFailure:Qe=>{F(U,"signTypedData","onError","unable_to_sign"),w(Qe)},uiOptions:p||{}},Jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{F(U,"signMessage","onError","unknown_connect_wallet_error"),w(Qe)}};ce({signMessage:sr,connectWallet:Jt}),ke("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let P=await(await $p(d,p,m)).wait();return qc(P)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Fe(s)){p(new Error("Must have a Privy wallet before exporting"));return}Ce(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ce(Oe),!await Ae()||!L){p(new Error("Must have valid access token to enroll in MFA"));return}if(!L){p(new Error("Must have a Privy wallet before exporting"));return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ce({keyExport:G,connectWallet:w}),ke("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Kp,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 T("Invalid MFA code");ir.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((G,J)=>{st.current={resolve:G,reject:J}});break;case"passkey":if(typeof p=="string")throw new T("Invalid authenticator response");let w=await(await import("@simplewebauthn/browser")).startAuthentication(p),P=A3(w);ir.current?.resolve({mfaMethod:d,mfaCode:P,relyingParty:window.origin}),await new Promise((G,J)=>{st.current={resolve:G,reject:J}});break;default:throw ir.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){ir.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ae();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){Ee.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."),ce({mfaEnrollmentFlow:{mfaMethods:D.mfa.methods,onSuccess:p,onFailure:m}}),ke("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ae();if(!d||!L)throw new Error("Must have valid access token to enroll in MFA");let p=await L.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ae();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ae();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Ae();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ae();if(!p||!L)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await L.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Ae(),p=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Ee.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let w=await L.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(w.status==="approved"){let P=await t.getAuthenticatedUser();c(P||s||null)}ce({farcasterSigner:w}),ke("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Ae(),p=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Ee.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(P=>Uint8Array.from(P.match(/.{1,2}/g).map(G=>parseInt(G,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Ae(),m=s?.linkedAccounts.find(J=>J.type==="wallet"&&J.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!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 Ee.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 P=await import("@simplewebauthn/browser"),G=await L.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:P.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(P.base64URLStringToBuffer(G.signature))},isHeadlessOAuthLoading:S,loginWithCode(d){return Ee.loginWithCode(d)},initLoginWithEmail(d){return Ee.initLoginWithEmail(d)},initLoginWithSms(d){return Ee.initLoginWithSms(d)},otpState:O,fundWallet(d,p){return Ee.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Ee.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Ee.loginWithHeadlessOAuth(d)},isModalOpen:r};I3=ui.signMessage,M3=ui.signTypedData,W3=async(...d)=>{let p=await $p(...d);return D.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Ee=(()=>({isNewUserThisSession:g,linkingHint:Y,pendingTransaction:null,walletConnectionStatus:R,mipdStore:I,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(L)return L;let p=new Promise(P=>{Pt(()=>G=>P(G))}),m=new Promise(P=>setTimeout(()=>P(null),d)),w=await Promise.race([p,m]);return Pt(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,m;p&&ie.current&&(m=s?.linkedAccounts.filter(w=>w.latestVerifiedAt!==null&&!(w.type==="wallet"&&w.walletClientType==="privy")).sort((w,P)=>P.latestVerifiedAt.getTime()-w.latestVerifiedAt.getTime())[0]),ae.current==="login"&&ie.current?d.shouldCallAuthOnSuccess&&p?(F(U,"login","onComplete",s,g,!1,ie.current,m??null),e.onSuccess?.(s,g)):F(U,"login","onError","exited_auth_flow"):ae.current==="link"&&ie.current&&m&&(d.isSuccess&&p?F(U,"linkAccount","onSuccess",s,ie.current,m):F(U,"linkAccount","onError","exited_link_flow")),ee(null),ae.current=null,ie.current=null,C(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ke,connectWallet:pi,initLoginWithWallet:async(d,p)=>{ie.current="siwe",Ln(d,p)},loginWithWallet:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof qn))throw new T("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),ie.current="siwe"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ie.current="siwe"}catch(m){throw F(U,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),C(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Ea(d);t.startAuthFlow(p);try{ie.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw ae.current==="login"?F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof Ea))throw new T("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),ie.current="farcaster"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ie.current="farcaster"}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),C(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ie.current=d,ld()){if(d==="google"&&ed(window.navigator.userAgent)){rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{rt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}ne.del(Bn);let m=new Co({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&window.location.assign(w.url)},async initLoginWithTelegram(d){if(!n)throw new vo;ie.current="telegram";let p=new Ma(d);t.startAuthFlow(p),t.authFlow.meta.telegramAuthResult=await new Promise((m,w)=>{if(!D.loginConfig.telegramAuthConfiguration)return w("Telegram Auth configuration is not loaded");if(!window.Telegram)return w("Telegram was not initialized");window.Telegram.Login.auth({bot_id:D.loginConfig.telegramAuthConfiguration.botId,request_access:!0},P=>P?m(P):w("Telegram auth failed or was canceled by the client"))})},async loginWithTelegram(){if(!n)throw new vo;if(!(t.authFlow instanceof Ma))throw new T("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),ie.current="telegram"}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();d=m.user,p=m.isNewUser,ie.current="telegram"}catch(m){throw ae.current==="login"?F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d),C(p||!1),l(!0)},async recoveryOAuthFlow(d,p,m){let w,P;function G(J){if(!J)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new T("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:J,codeVerifier:Pe,stateCode:ct}=await jd({api:nn.api,provider:d});G(J);let sr,Jt;try{let Qe=await Vp({url:J,popup:m,provider:d});if(sr=Qe.stateCode,Jt=Qe.authorizationCode,sr!==ct)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:ct??"",returnedStateCode:sr??""}}),new T("Unexpected auth flow. This may be a phishing attempt.")}catch(Qe){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Qe.toString(),provider:d}}),new T("Recovery OAuth failed")}[w,P]=await Promise.all([Ae(),wh({api:nn.api,provider:d,codeVerifier:Pe,stateCode:sr,authorizationCode:Jt})]);break}case"icloud":{let{url:J}=await jd({api:nn.api,provider:d});G(J);let{ckWebAuthToken:Pe}=await Vp({url:J,popup:m,provider:d});P=Pe,w=await Ae();break}}if(!L)throw new T("Cannot connect to wallet proxy");switch(p){case"recover":let J=Oe.recoverWallet?.privyWallet?.address;if(!J)throw new T("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:J,recoveryMethod:d}}),await L.recover({address:J,accessToken:w,recoveryAccessToken:P,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:J,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await L.create({accessToken:w,recoveryAccessToken:P,recoveryMethod:d});let Pe=await Ee.refreshUser(),ct=Fe(Pe);if(!ct)throw F(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:ct.address}}),F(U,"createWallet","onSuccess",ct);break;default:throw new T("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Co))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=ne.get(Un),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new T("Unexpected auth flow. This may be a phishing attempt.");let w,P,G;if(a)try{let J=await t.link();w=J.user,G=J.oAuthProviderTokens,ie.current=d}catch(J){throw F(U,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}else try{let J=await t.authenticate();w=J.user,P=J.isNewUser,G=J.oAuthProviderTokens,ie.current=d}catch(J){throw ae.current==="login"?F(U,"login","onError",J.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}return c(w),C(P||!1),l(!0),G},async initLoginWithPasskey(d){let p=new zn(d);t.startAuthFlow(p),ae.current="login";try{ie.current="passkey",await p.initAuthenticationFlow()}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof zn))throw new T("Must initialize Passkey flow first.");if(ie.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d,p;try{ie.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw F(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),C(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new zn(d);t.startAuthFlow(p),ae.current="link",ie.current="passkey";try{await p.initLinkFlow()}catch(m){throw F(U,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof zn))throw new T("Must initialize Passkey flow first.");if(ie.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d;try{ie.current="passkey",{user:d}=await t.link()}catch(p){throw F(U,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(ld()){if(d==="google"&&ed(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 Co({provider:d,headless:!0});p&&m.addCaptchaToken(p);let w=await t.startAuthFlow(m).getAuthorizationUrl();w?.url&&window.location.assign(w.url)},async loginWithHeadlessOAuth(d){b(!0),t.startAuthFlow(new Co(d));let p=ne.get(Un),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),b(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let w,P;if(a)try{({user:w}=await t.link()),ie.current=d.provider}catch(G){throw F(U,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:w,isNewUser:P}=await t.authenticate()),ie.current=d.provider}catch(G){throw ae.current==="login"?F(U,"login","onError",G.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(w),C(P||!1),l(!0),b(!1),w??void 0},initLoginWithEmail:async(d,p)=>{let m=new sn(d,p);t.startAuthFlow(m);try{ie.current="email",await m.sendCodeEmail()}catch(w){throw ae.current==="login"?F(U,"login","onError",w.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},initUpdateEmail:async(d,p,m)=>{let w=new Ls(d,p,m);t.startAuthFlow(w),await w.sendCodeEmail()},initLoginWithSms:async(d,p)=>{M({status:"sending-code"});let m=new $n(d,p);t.startAuthFlow(m);try{ie.current="sms",await m.sendSmsCode(),M({status:"awaiting-code-input"})}catch(w){throw M({status:"error",error:w}),ae.current==="login"?F(U,"login","onError",w.privyErrorCode||"unknown_auth_error"):ae.current==="link"&&F(U,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(M({status:"submitting-code"}),!n){let P=new vo;throw M({status:"error",error:P}),P}if(t.authFlow instanceof sn)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof $n)t.authFlow.meta.smsCode=d.trim();else{let P=new T("Must initialize a passwordless code flow first");throw M({status:"error",error:P}),P}let p=await Ae(),m,w;if(p&&t.sessionHasActiveToken())try{({user:m}=await t.link())}catch(P){throw M({status:"error",error:P}),F(U,"linkAccount","onError",P.privyErrorCode||"failed_to_link_account"),P}else try{({user:m,isNewUser:w}=await t.authenticate())}catch(P){throw M({status:"error",error:P}),F(U,"login","onError",P.privyErrorCode||"unknown_auth_error"),P}c(m||s||null),C(w||!1),l(!0),M({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:L,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(P=>P.type==="wallet"&&P.walletClientType==="privy"),w=await Ae();if(!w||!L||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Ce(!0);try{await L.connect({accessToken:w,address:m.address}),d(!0)}catch(P){if(qi(P)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await L.recover({address:m.address,accessToken:w})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0);else if(qi(P)&&m.recoveryMethod!=="privy"){ce({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:m.recoveryMethod,action:"recover"}});let G=nc(m.recoveryMethod);ke(G)}else p(P)}}),getFiatOnRampConfig:Jr,setReadyToTrue:d=>{i(!0),Zt?.(d)},updateWallets:()=>On(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:w}=await Jr(d,p);ce({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:w}}),ke("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Ae(),m=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!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 w=await t.requestFarcasterSignerStatus(d);if(w.status==="approved"){let P=await t.getAuthenticatedUser();c(P||s||null)}return w}}))();L3=Ee.recoverEmbeddedWallet;let p0=(0,le.useMemo)(()=>({wallets:u,ready:Nr&&Wn}),[u,Nr,Wn]);return(0,Yt.jsx)(Re.Provider,{value:ui,children:(0,Yt.jsx)(Md.Provider,{value:U,children:(0,Yt.jsx)(Wp.Provider,{value:p0,children:(0,Yt.jsxs)(pf,{...D,children:[e.children,(0,Yt.jsxs)(Id.Provider,{value:Ee,children:[!D.headless&&D.captchaEnabled&&n&&!a&&(0,Yt.jsx)(Ll,{delayedExecution:!1}),(0,Yt.jsx)(w3,{theme:{...D.appearance.palette||{}}}),(0,Yt.jsx)(Xm,{data:Oe,setModalData:ce,setInitialScreen:x,initialScreen:v,authenticated:a,open:r,children:(0,Yt.jsx)(P3,{open:r})}),ve&&be?(0,Yt.jsx)(x3,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ir,mfaSubmitPromise:st,onLoad:j,onLoadFailed:()=>null}):null,D.loginMethods.telegram&&D.loginConfig.telegramAuthConfiguration&&(0,Yt.jsx)(ao,{if:!0,children:(0,Yt.jsx)(T3,{scriptHost:e.apiUrl||Pa,botUsername:D.loginConfig.telegramAuthConfiguration.botName})})]})]})})})})};var N3=require("react");function D3(e){let{login:t}=(0,N3.useContext)(Re);return it("login",e),{login:t}}var U3=require("react");function F3(e){let{logout:t}=(0,U3.useContext)(Re);return it("logout",e),{logout:t}}var Ts=require("react");function B3(){let e=Te(),t=kl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=(0,Ts.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new oo(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,Ts.useCallback)(async()=>{let c=Ia();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{Vn()}},[o]);return(0,Ts.useEffect)(()=>{let c=Ia();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var zp=require("react");var H3=()=>{let e=Te(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=(0,zp.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,zp.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new oo(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var qp=require("react");var G3=()=>{let e=Te(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=(0,qp.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=(0,qp.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new oo(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};var V3=require("react");function z3(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:y,linkTelegram:g,linkFarcaster:C}=(0,V3.useContext)(Re);return it("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:y,linkFarcaster:C,linkTelegram:g}}var q3=require("react");function $3(e){let{connectWallet:t}=(0,q3.useContext)(Re);return it("connectWallet",e),{connectWallet:t}}var K3=require("react");function j3(e){let{createWallet:t}=(0,K3.useContext)(Re);return it("createWallet",e),{createWallet:t}}var Y3=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var Z3=require("react");function J3(e){let{sendTransaction:t}=(0,Z3.useContext)(Re);return it("sendTransaction",e),{sendTransaction:t}}var Q3=require("react");function X3(e){let{setWalletPassword:t}=(0,Q3.useContext)(Re);return it("setWalletPassword",e),{setWalletPassword:t}}var e0=require("react");function t0(e){let{signMessage:t}=(0,e0.useContext)(Re);return it("signMessage",e),{signMessage:t}}var r0=require("react");function o0(e){let{signTypedData:t}=(0,r0.useContext)(Re);return it("signTypedData",e),{signTypedData:t}}var n0=require("react");var i0=()=>{let{isModalOpen:e}=(0,n0.useContext)(Re);return{isOpen:e}};var a0=require("react");function s0(e){let{getAccessToken:t}=(0,a0.useContext)(Re);return it("accessToken",e),{getAccessToken:t}}function l0(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function c0(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});