@privy-io/react-auth 1.64.0 → 1.64.1-beta-20240508234811

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 +246 -241
  2. package/dist/index.js +244 -239
  3. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var ac=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var cp=(e,t,r)=>(ac(e,t,"read from private field"),r?r.call(e):t.get(e)),Aa=(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)},sc=(e,t,r,o)=>(ac(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var dp=(e,t,r)=>(ac(e,t,"access private method"),r);import{getAddress as nc}from"@ethersproject/address";import{Web3Provider as ap}from"@ethersproject/providers";import{createStore as n8}from"mipd";import{useEffect as Ar,useMemo as i8,useRef as Ci,useState as Ve}from"react";import{FetchError as Vg}from"ofetch";var Fe=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}]`:""}`}},hr=class extends Fe{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},E=class extends Fe{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ra=class extends E{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ee=class extends Fe{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},de=e=>{if(e instanceof Fe)return e;if(!(e instanceof Vg))return dt(e);if(!e.response)return new hr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new hr(t||"ApiError",e.response.status,r||o,e,n)},dt=e=>e instanceof Fe?e:e instanceof Error?new E(e.message,e):new E(`Internal error: ${e}`);var fo=class extends E{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends E{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ia=class extends E{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Rr=class extends E{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var Ma="/api/v1/sessions",Wa="/api/v1/sessions/logout",pp="/api/v1/sessions/fork",La="/api/v1/sessions/fork/recover",up="/api/v1/siwe/init",mp="/api/v1/siwe/authenticate",fp="/api/v1/siwe/link",hp="/api/v1/siwe/unlink",yp="/api/v1/farcaster/init",gp="/api/v1/farcaster/authenticate",vp="/api/v1/farcaster/link",Cp="/api/v1/farcaster/status",wp="/api/v1/farcaster/unlink",bp="/api/v1/passwordless/init",Ep="/api/v1/passwordless/authenticate",Pp="/api/v1/passwordless/link",Tp="/api/v1/passwordless/unlink",Sp="/api/v1/passwordless/update",xp="/api/v1/passwordless_sms/init",_p="/api/v1/passwordless_sms/link",kp="/api/v1/passwordless_sms/unlink",Ap="/api/v1/passwordless_sms/authenticate",Rp="/api/v1/oauth/init",Ip="/api/v1/oauth/authenticate",Mp="/api/v1/oauth/link",Wp="/api/v1/oauth/unlink",Lp="/api/v1/recovery/oauth/init",Op="/api/v1/recovery/oauth/authenticate",Np="/api/v1/passkeys/link/init",Dp="/api/v1/passkeys/authenticate/init",Up="/api/v1/passkeys/link",Fp="/api/v1/passkeys/authenticate",Bp="/api/v1/passkeys/unlink";var Hp="/api/v1/mfa/passwordless_sms/init",Gp="/api/v1/mfa/passkeys/init",Vp="/api/v1/users/me/accept_terms",Oa="/api/v1/analytics_events",zp="/api/v1/plugins/moonpay_on_ramp/sign",qp="/api/v1/custom_jwt_account/authenticate";var vn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let t=await this.api.post(qp,{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 de(t)}}async link(){throw new Error("Unimplemented")}};var ho=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Ep,{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 de(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new E("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Pp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw de(t)}}async sendCodeEmail(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new E("Email must be set when initialzing authentication.");try{return await this.api.post(bp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw de(o)}}},Na=class extends ho{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new E("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Sp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw de(r)}}};import{isMobile as jg,isIOS as Yg}from"react-device-detect";var lc=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)}},Da=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 cc(){try{let e="privy:__session_storage__test",t="blobby",r=new Da;return r.put(e,t),r.del(e),!0}catch{return!1}}function zg(){return typeof window<"u"&&window.localStorage?new Da:new lc}var Y=zg();import{StaticJsonRpcProvider as wn}from"@ethersproject/providers";function $p(){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 Ua=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 dc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ua(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!dc(r))return!1}return!0},yo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Kp=()=>{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 jp="1.64.0";var pc="4df5e2316331463a9130964bd6078dfa",uc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Yp="34357d3c125c2bcf2ce2bc3309d98715",Fa="https://auth.privy.io",Zp=2e4,Be=1400,Jp=2500,mc=jp;var Bo="privy:token",fc="privy-token",Ba="privy:refresh_token",hc="privy-refresh-token",Ha="privy-session",Pi="privy:session_transfer_token",$g="privy:wallet",Ti="privy:caid",Ho="privy:state_code",Go="privy:code_verifier",Vo="privy:headless_oauth",Ga=e=>`${$g}:${e}`,yc="privy:connectors",gc="privy:connections";var zo=12e4,Qr=1,vc="0x1",Cn=3e4,Qp="https://api.moonpay.com/v1",Xp="https://api.moonpay.com/v1",eu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",tu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",ru="0x420000000000000000000000000000000000000F",ou=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var nu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Va=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),iu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},go=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},Cc=e=>new Promise(t=>setTimeout(t,e));function au(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 su=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Cc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},za=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var lu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),qo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function cu(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 $p()){let u=Ua(c);if(!l.some(m=>m.info.name===u)){if(dc(c,!0)&&!s.find(m=>m.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(m=>m.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(m=>m.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(m=>m.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function bn(e){return`eip155:${String(Number(e))}`}var qa=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`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.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+pc:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+uc:a=i.rpcUrls.default?.http[0];if(!a)throw new ee(`No RPC url found for ${e}`);return a},du=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ee(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Xr=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new wn(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new wn(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new wn({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new wn(i.rpcUrls.infura.http[0]+"/"+pc):i.rpcUrls.blast?.http[0]?a=new wn(i.rpcUrls.blast.http[0]+"/"+uc):a=new wn(i.rpcUrls.default?.http[0]),!a)throw new ee(`No RPC url found for ${e}`);return a},$a=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var Ka=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ja))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ja={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function Kg(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function pu(e,t){let r=Kg(t);if(r.deepLink)return yu(r.deepLink,e);if(r.universalLink)return gu(r.universalLink,e);throw new E(`Unsupported wallet ${t.id}`)}var uu="WALLETCONNECT_DEEPLINK_CHOICE";function mu(){try{localStorage.removeItem(uu)}catch{}}function fu({href:e,name:t}){try{localStorage.setItem(uu,JSON.stringify({href:e,name:t}))}catch{}}function hu(e){return e.startsWith("http://")||e.startsWith("https://")}function yu(e,t){if(hu(e))return gu(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 gu(e,t){if(!hu(e))return yu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ya(e,t){window.open(e,t,"noreferrer noopener")}var Le=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Si=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");try{let t=await this.api.post(gp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new E("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw de(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{return await this.api.post(vp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw de(t)}}async _startChannelOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=await this.api.post(yp,{token:this.captchaToken});jg&&!Yg&&t.connect_uri&&Ya(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new E("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.channelToken)throw new E("Auth flow must be initialized first");let t=await this.api.get(Cp,{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}};import{base64url as wu}from"jose";async function vu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Cu(e){return crypto.getRandomValues(new Uint8Array(e))}var Zg="S256",Jg="S256";function xi(){return wu.encode(Cu(36))}function Za(){return xi()}async function Ja(e,t=Zg){if(t==Jg){let r=await vu(e);return wu.encode(r)}else return e}function bu(){let e=Y.get(Go);if(!e)throw new E("Authentication error.");return e}function Qa(){return!!Y.get(Vo)}var Ir=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Qa();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=bu();try{let r=await this.api.post(Ip,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Y.del(Go),this.meta.headless&&Y.del(Vo),{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=de(r);throw o.privyErrorCode?new E(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new E("User denied confirmation during OAuth flow");let t=Y.get(Go);if(!t)throw new E("Authentication error.");try{let r=await this.api.post(Mp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Y.del(Go),r}catch(r){throw de(r)}}async getAuthorizationUrl(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.provider)throw new E("Provider must be set when initializing OAuth authentication.");let t=xi();Y.put(Go,t);let r=Za();Y.put(Ho,r);let o=await Ja(t);this.meta.headless&&Y.put(Vo,!0);try{return await this.api.post(Rp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw de(n)}}};function wc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Eu,jsxs as Qg}from"react/jsx-runtime";var Xa=({style:e,...t})=>Qg("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:[Eu("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"}),Eu("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as _i,jsxs as Xg}from"react/jsx-runtime";var es=({style:e,...t})=>Xg("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:[_i("g",{clipPath:"url(#clip0)",children:_i("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"})}),_i("defs",{children:_i("clipPath",{id:"clip0",children:_i("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Pu}from"react/jsx-runtime";var ts=({style:e,...t})=>Pu("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:Pu("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:"#171515"})});import{jsx as rs,jsxs as e2}from"react/jsx-runtime";var os=({style:e,...t})=>e2("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:[rs("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"}),rs("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"}),rs("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"}),rs("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as nr,jsxs as ns}from"react/jsx-runtime";function is(e){return ns("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:[ns("defs",{children:[ns("linearGradient",{id:"b",children:[nr("stop",{offset:"0",stopColor:"#3771c8"}),nr("stop",{stopColor:"#3771c8",offset:".128"}),nr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),ns("linearGradient",{id:"a",children:[nr("stop",{offset:"0",stopColor:"#fd5"}),nr("stop",{offset:".1",stopColor:"#fd5"}),nr("stop",{offset:".5",stopColor:"#ff543e"}),nr("stop",{offset:"1",stopColor:"#c837ab"})]}),nr("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"}),nr("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"})]}),nr("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)"}),nr("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)"}),nr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as as}from"react/jsx-runtime";function ss({style:e,...t}){return as("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:as("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:as("g",{transform:"scale(5.12,5.12)",children:as("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Tu,jsxs as t2}from"react/jsx-runtime";function ls(e){return t2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Tu("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"}),Tu("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as bc,jsxs as r2}from"react/jsx-runtime";function cs(e){return r2("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:[bc("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"}),bc("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"}),bc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Su}from"react/jsx-runtime";var ds=({style:e,...t})=>Su("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:Su("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:"#000000"})});var o2={google:{name:"Google",component:os},discord:{name:"Discord",component:es},github:{name:"Github",component:ts},linkedin:{name:"LinkedIn",component:ss},twitter:{name:"Twitter",component:ds},spotify:{name:"Spotify",component:ls},instagram:{name:"Instagram",component:is},tiktok:{name:"Tiktok",component:cs},apple:{name:"Apple",component:Xa}},ki=e=>o2[e];function xu(e,t){let r={detail:"",retryable:!1},o=wc(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=ki(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=ki(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ai(){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:Qa(),popupFlow:window.opener!==null}}function $o(){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"),Y.del(Ho),window.history.replaceState({},"",e)}var Ko=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new E("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new E("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Fp,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):de(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new E("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new E("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Up,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new E("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):de(r)}}async _initAuthenticateOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(Dp,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new E("Auth flow has no API instance");return await this.api.post(Np,{})}_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 jo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ var ac=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var cp=(e,t,r)=>(ac(e,t,"read from private field"),r?r.call(e):t.get(e)),Aa=(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)},sc=(e,t,r,o)=>(ac(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var dp=(e,t,r)=>(ac(e,t,"access private method"),r);import{getAddress as nc}from"@ethersproject/address";import{Web3Provider as ap}from"@ethersproject/providers";import{createStore as i8}from"mipd";import{useEffect as Rr,useMemo as a8,useRef as Ci,useState as Ve}from"react";import{FetchError as zg}from"ofetch";var Fe=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}]`:""}`}},hr=class extends Fe{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},P=class extends Fe{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ra=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ee=class extends Fe{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},de=e=>{if(e instanceof Fe)return e;if(!(e instanceof zg))return dt(e);if(!e.response)return new hr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new hr(t||"ApiError",e.response.status,r||o,e,n)},dt=e=>e instanceof Fe?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var fo=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ia=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ir=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 Ma="/api/v1/sessions",Wa="/api/v1/sessions/logout",pp="/api/v1/sessions/fork",La="/api/v1/sessions/fork/recover",up="/api/v1/siwe/init",mp="/api/v1/siwe/authenticate",fp="/api/v1/siwe/link",hp="/api/v1/siwe/unlink",yp="/api/v1/farcaster/init",gp="/api/v1/farcaster/authenticate",vp="/api/v1/farcaster/link",Cp="/api/v1/farcaster/status",wp="/api/v1/farcaster/unlink",bp="/api/v1/passwordless/init",Ep="/api/v1/passwordless/authenticate",Pp="/api/v1/passwordless/link",Tp="/api/v1/passwordless/unlink",Sp="/api/v1/passwordless/update",xp="/api/v1/passwordless_sms/init",_p="/api/v1/passwordless_sms/link",kp="/api/v1/passwordless_sms/unlink",Ap="/api/v1/passwordless_sms/authenticate",Rp="/api/v1/oauth/init",Ip="/api/v1/oauth/authenticate",Mp="/api/v1/oauth/link",Wp="/api/v1/oauth/unlink",Lp="/api/v1/recovery/oauth/init",Op="/api/v1/recovery/oauth/authenticate",Np="/api/v1/passkeys/link/init",Dp="/api/v1/passkeys/authenticate/init",Up="/api/v1/passkeys/link",Fp="/api/v1/passkeys/authenticate",Bp="/api/v1/passkeys/unlink";var Hp="/api/v1/mfa/passwordless_sms/init",Gp="/api/v1/mfa/passkeys/init",Vp="/api/v1/users/me/accept_terms",Oa="/api/v1/analytics_events",zp="/api/v1/plugins/moonpay_on_ramp/sign",qp="/api/v1/custom_jwt_account/authenticate";var Cn=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(qp,{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 de(t)}}async link(){throw new Error("Unimplemented")}};var ho=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(Ep,{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 de(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(Pp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw de(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(bp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw de(o)}}},Na=class extends ho{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(Sp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw de(r)}}};import{isMobile as Yg,isIOS as Zg}from"react-device-detect";var lc=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)}},Da=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 cc(){try{let e="privy:__session_storage__test",t="blobby",r=new Da;return r.put(e,t),r.del(e),!0}catch{return!1}}function qg(){return typeof window<"u"&&window.localStorage?new Da:new lc}var Y=qg();import{StaticJsonRpcProvider as bn}from"@ethersproject/providers";function $p(){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 Ua=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 dc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ua(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!dc(r))return!1}return!0},yo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Kp=()=>{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 jp="1.64.1-beta-20240508234811";var pc="4df5e2316331463a9130964bd6078dfa",uc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Yp="34357d3c125c2bcf2ce2bc3309d98715",Fa="https://auth.privy.io",Zp=2e4,Be=1400,Jp=2500,mc=jp;var Bo="privy:token",fc="privy-token",Ba="privy:refresh_token",hc="privy-refresh-token",Ha="privy-session",Pi="privy:session_transfer_token",Kg="privy:wallet",Ti="privy:caid",Ho="privy:state_code",Go="privy:code_verifier",Vo="privy:headless_oauth",Ga=e=>`${Kg}:${e}`,yc="privy:connectors",gc="privy:connections";var zo=12e4,Qr=1,vc="0x1",wn=3e4,Qp="https://api.moonpay.com/v1",Xp="https://api.moonpay.com/v1",eu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",tu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",ru="0x420000000000000000000000000000000000000F",ou=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var nu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Va=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),iu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},go=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},Cc=e=>new Promise(t=>setTimeout(t,e));function au(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 su=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Cc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},za=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var lu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),qo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function cu(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 $p()){let u=Ua(c);if(!l.some(m=>m.info.name===u)){if(dc(c,!0)&&!s.find(m=>m.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(m=>m.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(m=>m.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(m=>m.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function En(e){return`eip155:${String(Number(e))}`}var qa=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`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.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+pc:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+uc:a=i.rpcUrls.default?.http[0];if(!a)throw new ee(`No RPC url found for ${e}`);return a},du=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ee(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Xr=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ee(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new bn(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new bn(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new bn({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new bn(i.rpcUrls.infura.http[0]+"/"+pc):i.rpcUrls.blast?.http[0]?a=new bn(i.rpcUrls.blast.http[0]+"/"+uc):a=new bn(i.rpcUrls.default?.http[0]),!a)throw new ee(`No RPC url found for ${e}`);return a},$a=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var Ka=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ja))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ja={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function jg(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function pu(e,t){let r=jg(t);if(r.deepLink)return yu(r.deepLink,e);if(r.universalLink)return gu(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var uu="WALLETCONNECT_DEEPLINK_CHOICE";function mu(){try{localStorage.removeItem(uu)}catch{}}function fu({href:e,name:t}){try{localStorage.setItem(uu,JSON.stringify({href:e,name:t}))}catch{}}function hu(e){return e.startsWith("http://")||e.startsWith("https://")}function yu(e,t){if(hu(e))return gu(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 gu(e,t){if(!hu(e))return yu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ya(e,t){window.open(e,t,"noreferrer noopener")}var Le=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Si=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new 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(gp,{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 de(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(vp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw de(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(yp,{token:this.captchaToken});Yg&&!Zg&&t.connect_uri&&Ya(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new 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(Cp,{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}};import{base64url as wu}from"jose";async function vu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Cu(e){return crypto.getRandomValues(new Uint8Array(e))}var Jg="S256",Qg="S256";function xi(){return wu.encode(Cu(36))}function Za(){return xi()}async function Ja(e,t=Jg){if(t==Qg){let r=await vu(e);return wu.encode(r)}else return e}function bu(){let e=Y.get(Go);if(!e)throw new P("Authentication error.");return e}function Qa(){return!!Y.get(Vo)}var Mr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Qa();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=bu();try{let r=await this.api.post(Ip,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Y.del(Go),this.meta.headless&&Y.del(Vo),{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=de(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=Y.get(Go);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(Mp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Y.del(Go),r}catch(r){throw de(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=xi();Y.put(Go,t);let r=Za();Y.put(Ho,r);let o=await Ja(t);this.meta.headless&&Y.put(Vo,!0);try{return await this.api.post(Rp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw de(n)}}};function wc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Eu,jsxs as Xg}from"react/jsx-runtime";var Xa=({style:e,...t})=>Xg("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:[Eu("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"}),Eu("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as _i,jsxs as e2}from"react/jsx-runtime";var es=({style:e,...t})=>e2("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:[_i("g",{clipPath:"url(#clip0)",children:_i("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"})}),_i("defs",{children:_i("clipPath",{id:"clip0",children:_i("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Pu}from"react/jsx-runtime";var ts=({style:e,...t})=>Pu("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:Pu("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:"#171515"})});import{jsx as rs,jsxs as t2}from"react/jsx-runtime";var os=({style:e,...t})=>t2("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:[rs("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"}),rs("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"}),rs("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"}),rs("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as nr,jsxs as ns}from"react/jsx-runtime";function is(e){return ns("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:[ns("defs",{children:[ns("linearGradient",{id:"b",children:[nr("stop",{offset:"0",stopColor:"#3771c8"}),nr("stop",{stopColor:"#3771c8",offset:".128"}),nr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),ns("linearGradient",{id:"a",children:[nr("stop",{offset:"0",stopColor:"#fd5"}),nr("stop",{offset:".1",stopColor:"#fd5"}),nr("stop",{offset:".5",stopColor:"#ff543e"}),nr("stop",{offset:"1",stopColor:"#c837ab"})]}),nr("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"}),nr("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"})]}),nr("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)"}),nr("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)"}),nr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as as}from"react/jsx-runtime";function ss({style:e,...t}){return as("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:as("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:as("g",{transform:"scale(5.12,5.12)",children:as("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Tu,jsxs as r2}from"react/jsx-runtime";function ls(e){return r2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Tu("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"}),Tu("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as bc,jsxs as o2}from"react/jsx-runtime";function cs(e){return o2("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:[bc("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"}),bc("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"}),bc("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Su}from"react/jsx-runtime";var ds=({style:e,...t})=>Su("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:Su("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:"#000000"})});var n2={google:{name:"Google",component:os},discord:{name:"Discord",component:es},github:{name:"Github",component:ts},linkedin:{name:"LinkedIn",component:ss},twitter:{name:"Twitter",component:ds},spotify:{name:"Spotify",component:ls},instagram:{name:"Instagram",component:is},tiktok:{name:"Tiktok",component:cs},apple:{name:"Apple",component:Xa}},ki=e=>n2[e];function xu(e,t){let r={detail:"",retryable:!1},o=wc(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=ki(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=ki(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ai(){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:Qa(),popupFlow:window.opener!==null}}function $o(){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"),Y.del(Ho),window.history.replaceState({},"",e)}var Ko=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new 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(Fp,{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"):de(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(Up,{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"):de(r)}}async _initAuthenticateOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Dp,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Np,{})}_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 jo=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 Le(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(mp,{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 de(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(fp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw de(t)}}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new E("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(up,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new E("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,i,l,o,a)}};var Yo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Ap,{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 de(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(_p,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw de(t)}}async sendSmsCode(t,r){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(xp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw de(o)}}};import{v4 as K2}from"uuid";function j(e){return e?new Date(e*1e3):null}function n2(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let m={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(m);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(h);break;case"tiktok_oauth":let y={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let C={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(C);break;case"apple_oauth":let g={subject:r.subject,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(g);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)});break;case"farcaster":let _={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let T={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(T);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Ut(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Te=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,i2=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),ir=(e,t)=>t==="all-users"&&!Te(e)||t==="users-without-wallets"&&!i2(e)?.length;function ar(e){if(!e)return null;let t=n2(e.linked_accounts),r=Ut(t,"wallet"),o=Ut(t,"email"),n=Ut(t,"phone"),i=Ut(t,"google_oauth"),a=Ut(t,"twitter_oauth"),l=Ut(t,"discord_oauth"),s=Ut(t,"github_oauth"),c=Ut(t,"spotify_oauth"),u=Ut(t,"instagram_oauth"),m=Ut(t,"tiktok_oauth"),h=Ut(t,"linkedin_oauth"),y=Ut(t,"apple_oauth"),C=Ut(t,"farcaster"),g=e.mfa_methods.map(({type:T,verified_at:w})=>({type:T,verifiedAt:j(w)}));return{id:e.id,createdAt:j(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:m&&{subject:m.subject,username:m.username,name:m.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:y&&{subject:y.subject,email:y.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},mfaMethods:g.map(T=>T.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as um}from"@ethersproject/address";import{isHexString as G2}from"@ethersproject/bytes";import V2 from"eventemitter3";import{jsx as _u,jsxs as a2}from"react/jsx-runtime";var ps=({style:e,...t})=>a2("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:[_u("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),_u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as Wr}from"@ethersproject/address";import{Web3Provider as Wu}from"@ethersproject/providers";import{default as m2}from"eventemitter3";import u2 from"eventemitter3";var s2=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],ku=e=>s2.includes(e);import{ErrorCode as l2}from"@ethersproject/logger";var En=class extends ee{constructor(){super("Wallet timeout");this.type="wallet_error"}},Pn=class extends ee{constructor(){super("User rejected connection");this.type="wallet_error"}},yr=e=>{if(e instanceof ee)return e;if(e?.code&&e?.reason){let t=new Oe(e);return e.code===l2.ACTION_REJECTED&&(t.details=ot.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Oe(e):new ee("Unknown connector error",e)},Ft=class extends Fe{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Oe=class extends Ft{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(ot).find(i=>i.eipCode===o.code);this.details=n||ot.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=ot.E32002_CONNECTION_ALREADY_PENDING:this.details=ot.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=ot.E32002_WALLET_LOCKED))}},c2={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}},d2={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}},p2={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}},ot={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...p2,...d2},eo={...c2,...ot};var Me=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 En,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||zo,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 ee(`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 yr(r)})}},vo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},us=class extends u2{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=Xr(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Tn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new vo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Se()||!this.address)throw new vo("Disconnected",4900);return(await Iu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new vo(`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 vo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Xr(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 Au(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 Ru($a(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:qo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return qo(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(ku(r.method)){let o=await Se();if(await Mu(),!o||!this.address)throw new vo("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 vo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Se();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}}},Mr=class extends Me{constructor(r){super(r,r.rpcTimeoutDuration)}},Co=class extends Me{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 f2=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},kt=class extends m2{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=bn(r),this.walletClientType==="privy"&&Y.put(Ga(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=Tn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>Wr(a.address)===Wr(r));return{address:Wr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new ee("Wallet is not currently connected.");let l=this.wallets.find(h=>Wr(h.address)===Wr(r))?.chainId;if(!l)throw new ee("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===bn(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new ee(`Unsupported chainId: ${a}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await m()}catch(h){if(f2(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new ee(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new Wu(new Mr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new Co(this.proxyProvider)},sign:async a=>{if(!await i())throw new ee("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Wr(n),a=[],l;if(this.walletClientType==="privy"){let c=Y.get(Ga(i));this.chains.find(u=>u.id===Number(c))||(Y.del(Ga(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 ${vc}`,c),l=vc}let s=bn(l);if(!a.find(c=>Wr(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(Wr(n),s,c))}ms(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=>Wr(n)===Wr(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 Wu(new Mr(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 Sn={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 h2=(e,t)=>{let o=qa(1,[Sn],{},t);return e.makeWeb3Provider(o,1)},fs,hs=class extends kt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;fs||import("@coinbase/wallet-sdk").then(s=>{fs=new s.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l}),this.proxyProvider.setWalletProvider(h2(fs,i))})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){fs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ps,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 ee("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};import{jsx as Lu}from"react/jsx-runtime";var ys=({...e})=>Lu("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Lu("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 gs=class extends kt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[qo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ys,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Ou}from"react/jsx-runtime";var xn=({style:e,...t})=>Ou("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Ou("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Bt,jsxs as y2}from"react/jsx-runtime";var _n=({style:e,...t})=>y2("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:[Bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Nu,jsxs as g2}from"react/jsx-runtime";var Lr=({style:e,...t})=>g2("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:[Nu("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Nu("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 An=class extends kt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}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 ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}},kn,Rn=class extends kt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Aa(this,kn,void 0);this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?sc(this,kn,{name:"MetaMask",icon:_n,id:"io.metamask"}):a==="phantom"&&sc(this,kn,{name:"Phantom",icon:Lr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return cp(this,kn)??{name:"Browser Extension",icon:xn,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 ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};kn=new WeakMap;import{getAddress as WP}from"@ethersproject/address";import{Web3Provider as OP}from"@ethersproject/providers";import{isMobile as v2}from"react-device-detect";var vs=class extends An{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{v2||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 ee("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw yr(t)}}};var Cs=class extends kt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Me(void 0,zo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}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 ws=class extends Cs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Lr,id:"phantom"}}};import{EthereumProvider as U2,OPTIONAL_EVENTS as F2,OPTIONAL_METHODS as B2}from"@walletconnect/ethereum-provider";import{isMobile as H2}from"react-device-detect";import{createContext as R2,useContext as I2,useEffect as Sc,useRef as M2,useState as W2}from"react";import{jsx as C2}from"react/jsx-runtime";function bs({src:e,...t}){return C2("img",{src:e,...t,style:{display:"none"}})}import{useContext as sm,useEffect as am,useMemo as x2,useState as _2}from"react";import{createContext as k2}from"react";var Ht={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Yp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Du=({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 w2=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Uu=e=>w2.has(e),Fu=(e,t,r)=>r.indexOf(e)===t,Bu=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Uu).filter(Fu):e?e.filter(Uu).filter(Fu):Ht.appearance.walletList;var Es={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 Ps={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 Ts={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 Hu={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 Gu={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 Ss={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 xs={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 _s={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 Vu={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 zu={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 qu={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 $u={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 Ku={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 ju={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 Yu={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 Zu={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 Ju={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},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 Qu={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 ks={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 As={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 Rs={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 Ri={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 Ii={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 Xu={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 em={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 tm={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 Is={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 Ms={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 Ws={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 Mi=[Es,Ps,Ts,Yu,tm,Sn,ks,As,Rs,Ri,Ii,zu,qu,$u,Ku,Ss,xs,_s,Vu,Ju,Qu,Hu,Gu,Is,Ws,Ms,Zu,Xu,ju,em],aS=new Set(Mi.map(e=>e.id));import Zo from"tinycolor2";var rm="#FFFFFF",b2="#000000",E2=rm,P2="#1E1E1D";function T2(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 to(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Zo({...e.toHsl(),l:r})}function om({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=rm,blackHex:a=b2}){let l;switch(e){case"light":l=E2;break;case"dark":l=P2;break;default:l=e;break}let s=Zo(l),c=Zo(t),u=Zo(r),m=Zo(o),h=Zo(n),y=T2(s.getLuminance()),C=to(s,y==="light"?-.04:.11),g=to(s,y==="light"?-.88:.87),_=to(s,y==="light"?-.77:.75),T=to(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),w=to(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),k=to(c,.15),R=to(c,-.06),L=to(h,.3),S=Zo(c.getLuminance()>.5?a:i),N=to(u,-.16);return{colorScheme:y,background:s.toHslString(),background2:C.toHslString(),foreground:g.toHslString(),foreground2:_.toHslString(),foreground3:T.toHslString(),foreground4:w.toHslString(),accent:c.toHslString(),accentLight:k.toHslString(),accentDark:R.toHslString(),foregroundAccent:S.toHslString(),success:u.toHslString(),successDark:N.toHslString(),error:h.toHslString(),errorLight:L.toHslString(),warn:m.toHslString()}}function Ec(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","instagram","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(tt=>n.includes(tt)),a,l,s,c,u,m,h,y,C,g,_,T,w,k;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=i?.includes("google"),m=i?.includes("twitter"),h=i?.includes("discord"),C=i?.includes("spotify"),g=i?.includes("instagram"),y=i?.includes("tiktok"),T=i?.includes("github"),_=i?.includes("linkedin"),w=i?.includes("apple"),k=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,m=e.twitterOAuth,h=e.discordOAuth,T=e.githubOAuth,C=e.spotifyOAuth,g=e.instagramOAuth,y=e.tiktokOAuth,_=e.linkedinOAuth,w=e.appleOAuth,k=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let R=[a,l].filter(Boolean),L=[u,m,h,T,C,g,y,_,w,k].filter(Boolean),S=[c].filter(Boolean);if(R.length+L.length+S.length===0)throw new Error("You must enable at least one login method");let N=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;N&&S.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),N=!1):!N&&L.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"),N=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let $=Bu({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=Du({input:t?.loginMethodsAndOrder}),q=t?.intl?.defaultCountry??"US",{chains:I,defaultChain:Z}=S2({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),U=!!t?.defaultChain,ue=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,re,ce=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ue?re=t?.embeddedWallets?.noPromptOnSignature??!0:re=t?.embeddedWallets?.noPromptOnSignature??ce:re=ce,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&re!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:fe,...Q}=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??Ht.appearance.landingHeader,palette:om({backgroundTheme:t?.appearance?.theme??Ht.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ht.appearance.accentColor}),loginGroupPriority:N?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:$},loginMethods:{wallet:c,email:a,sms:l,passkey:s,google:u,twitter:m,discord:h,github:T,spotify:C,instagram:g,tiktok:y,linkedin:_,apple:w,farcaster:k},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ht.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ht.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ht.rpcConfig.rpcTimeouts},chains:I,defaultChain:Z,intl:{defaultCountry:q},shouldEnforceDefaultChainOnConnect:U,captchaEnabled:e.captchaEnabled??Ht.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof fe=="boolean"?{requireUserOwnedRecoveryOnCreate:fe}:{},...ue?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Q,noPromptOnSignature:re},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ue?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ht.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??Ht._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ht._render.inParentNodeId}}}function nm(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 S2({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:Mi.find(u=>u.id===s.id)??s)}else n=Mi.concat(e??[]);let i=t?n[0]:Sn,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 im=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as A2}from"react/jsx-runtime";var lm={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:""},Pc=Ec(lm,void 0,!1),Tc=k2({appConfig:Pc,isServerConfigLoaded:!1}),cm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=_2(null),a=x2(()=>Ec(n??lm,o,!!n),[n,o]);return am(()=>{if(!n)return;let l=nm(o,t),s=im(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]),am(()=>{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)}})()},[]),A2(Tc.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Or=()=>{let{appConfig:e}=sm(Tc);return e},Ls=()=>{let{isServerConfigLoaded:e}=sm(Tc);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as O2,jsxs as N2}from"react/jsx-runtime";var dm=R2({ready:!1,app:Pc,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),L2=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],pm=e=>{let t=Or(),r=e.authenticated,[o,n]=W2(e.initialScreen);Sc(()=>{!r&&!L2.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=M2(null);Sc(()=>{e.open||(i.current=null)},[e.open]),Sc(()=>{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 N2(dm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&O2(bs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},x=()=>I2(dm);import{jsx as In,jsxs as D2}from"react/jsx-runtime";var Wi=({style:e,...t})=>{let{app:r}=x();return D2("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:[In("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),In("g",{clipPath:"url(#clip0_1765_9946)",children:In("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"})}),In("defs",{children:In("clipPath",{id:"clip0_1765_9946",children:In("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Nr=class extends kt{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 Me(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ja[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:_n,id:"io.metamask"}:{name:lu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Wi,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=ja[r],this.walletClientType=r,this.redirectUri=void 0,mu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Pn)};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 ee("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Tn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(yr(a));return}o(new ee("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=qa(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await U2.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:F2,optionalMethods:B2,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),H2&&this.walletEntry){let{redirect:l,href:s}=pu(a,this.walletEntry);fu({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ya(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Ka(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var xc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>G2(o)).map(o=>um(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Tn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||zo:zo,Li=class extends V2{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 Me: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=this.loadConnectionHistory()}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;Y.get(yc)&&(Y.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Y.del(o)}),Y.del(yc));let r=cu(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"),!yo()&&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")}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 us(r,o,this.rpcConfig,this.chains,i,n.id),s=new gs(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Nr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new vs(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Rn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Rn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Rn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new An(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new hs(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ws(this.defaultChain):new Nr(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()}loadConnectionHistory(){let r=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=Y.get(gc);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Y.put(gc,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=um(r),this.emit("walletsUpdated")}};function ms(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}import{ofetch as z2}from"ofetch";var q2=[Ma,La,Wa,Oa],Os=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=mc,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=z2.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=q2.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 Ra}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw de(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw de(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw de(o)}}};var mm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import Jo from"js-cookie";function fm(e){return e instanceof ho?"email":e instanceof Yo?"sms":e instanceof jo?"siwe":e instanceof vn?"custom_auth":e instanceof Ir?e.meta.provider:null}import*as hm from"jose";var Dr=class{static parse(t){try{return new Dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=hm.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 $2=30,Ns=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=Y.get(Bo);return typeof t=="string"?new Dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Y.get(Ba);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Y.get(Pi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Jo.get(Ha);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=Dr.parse(this.token);return t!==null&&!t.isExpired($2)}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=fm(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:ar(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),dt(r)}}async _link(t){try{let r=await t.link();return ar(r)}catch(r){throw console.warn("Error linking account"),dt(r)}}async _refresh(){if(!this.api)throw new E("Session has no API instance");if(!this.client)throw new E("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(Ma,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(La,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),ar(n.user)}catch(n){if(n instanceof hr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw dt(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(Wa,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new E("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(pp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw dt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Y.get(Bo);if(Y.put(Bo,t),!this.client?.useServerCookies){let o=Dr.parse(t)?.expiration;Jo.set(fc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Y.del(Bo),Jo.remove(fc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Y.put(Ba,t),this.client?.useServerCookies||(Jo.set(Ha,"t",{sameSite:"Strict",secure:!0,expires:30}),Jo.set(hc,t,{sameSite:"Strict",secure:!0,expires:30}))):(Y.del(Ba),Jo.remove(hc),Jo.remove(Ha))}clearForkedToken(){Y.del(Pi)}};var _c,Ds,ym,Oi=class{constructor(t){Aa(this,Ds);this.apiUrl=t.apiUrl||Fa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Zp,this.appId=t.appId,this.clientAnalyticsId=dp(this,Ds,ym).call(this),_c||(_c=new Ns),this.session=_c,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 Li(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Os(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new E("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new E("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Hp,{action:"verify"})}catch(t){throw de(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Gp,{});return mm(t.options)}catch(t){throw de(t)}}async unlinkEmail(t){try{let r=await this.api.post(Tp,{address:t});return ar(r)}catch(r){throw dt(r)}}async acceptTerms(){try{let t=await this.api.post(Vp,{});return ar(t)}catch(t){throw dt(t)}}async unlinkPhone(t){try{let r=await this.api.post(kp,{phoneNumber:t});return ar(r)}catch(r){throw dt(r)}}async unlinkWallet(t){try{let r=await this.api.post(hp,{address:t});return ar(r)}catch(r){throw dt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Wp,{provider:t,subject:r});return ar(o)}catch(o){throw dt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(wp,{fid:t});return ar(r)}catch(r){throw dt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Bp,{credential_id:t});return ar(r)}catch(r){throw dt(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(Oa,{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(zp,t)}catch(r){throw dt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Dr.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});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,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}}catch(t){throw dt(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()}};Ds=new WeakSet,ym=function(){if(typeof window>"u")return null;try{let r=Y.get(Ti);if(typeof r=="string"&&r.length>0)return r}catch{}let t=K2();try{return Y.put(Ti,t),t}catch{return t}};import{Turnstile as X2}from"@marsidev/react-turnstile";import{useEffect as e3,useMemo as t3}from"react";import{useMemo as j2,useRef as Y2,useContext as Z2,useState as kc,createContext as J2}from"react";import{jsx as Q2}from"react/jsx-runtime";var gm=J2({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),gr=class extends Fe{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},vm=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Y2(null),[i,a]=kc(),[l,s]=kc(),[c,u]=kc(!1),m=j2(()=>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 Q2(gm.Provider,{value:{...m,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 au(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new gr("Captcha failed",null,"captcha_timeout")}}},children:e})},Ce=()=>Z2(gm);import{jsx as Cm}from"react/jsx-runtime";var Ac=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Ce(),[,s]=t3(()=>r?.split("t:")||[],[r]);if(e3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Cm("div",{className:"hidden h-0 w-0",children:Cm(X2,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as Vb,useEffect as Tg,useRef as zb,useState as qb}from"react";import $b from"react-dom";import{createContext as r3,useContext as o3}from"react";var Rc=r3({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,recoveryOAuthFlow:b,loginWithOAuth:b,initLoginWithPasskey:b,loginWithPasskey:b,initLinkWithPasskey:b,linkWithPasskey:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),M=()=>o3(Rc);import{createContext as n3,useContext as i3}from"react";var ge=n3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkInstagram:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,linkPasskey:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkInstagram:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,unlinkPasskey:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,initEnrollmentWithPasskey:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,submitEnrollmentWithPasskey:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSignerFromWarpcast:b,getFarcasterSignerPublicKey:b,signFarcasterMessage:b,initLoginWithEmail:b,initLoginWithSms:b,otpState:{status:"initial"},loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),F=()=>i3(ge);import{useEffect as a3,useState as s3}from"react";var wm=e=>{let[t,r]=s3("auto");return a3(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as l3,useContext as c3,useEffect as d3}from"react";var bm={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:[]}},Ic=l3(void 0),Em=()=>c3(Ic);function Ne(e,t){if(!t)return;let o=Em().current[e];return d3(()=>{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 D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Us(){let e=Em();return(t,r,...o)=>D(e,t,r,...o)}function Mc(e){Ne("configureMfa",e)}import Am from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import A3 from"@heroicons/react/24/solid/DocumentCheckIcon";import R3 from"styled-components";import Qo,{css as Nc}from"styled-components";import Lc from"styled-components";import{Fragment as u3,jsx as Wc,jsxs as m3}from"react/jsx-runtime";var pt=({success:e,fail:t})=>m3(u3,{children:[Wc(je,{className:e?"success":t?"fail":""}),Wc(Oc,{className:e?"success":t?"fail":""})]}),je=Lc.span`
12
+ - https://privy.io`;this.getNonceOnce=new Le(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(mp,{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 de(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(fp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw de(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(up,{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 Yo=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(Ap,{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 de(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(_p,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw de(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(xp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw de(o)}}};import{v4 as j2}from"uuid";function j(e){return e?new Date(e*1e3):null}function i2(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let m={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(m);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(h);break;case"tiktok_oauth":let y={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let C={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(C);break;case"apple_oauth":let g={subject:r.subject,email:r.email,type:r.type,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(g);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(x);break;case"passkey":let E={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:j(r.verified_at),firstVerifiedAt:j(r.first_verified_at),latestVerifiedAt:j(r.latest_verified_at)};t.push(E);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Ut(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Te=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,a2=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),ir=(e,t)=>t==="all-users"&&!Te(e)||t==="users-without-wallets"&&!a2(e)?.length;function ar(e){if(!e)return null;let t=i2(e.linked_accounts),r=Ut(t,"wallet"),o=Ut(t,"email"),n=Ut(t,"phone"),i=Ut(t,"google_oauth"),a=Ut(t,"twitter_oauth"),l=Ut(t,"discord_oauth"),s=Ut(t,"github_oauth"),c=Ut(t,"spotify_oauth"),u=Ut(t,"instagram_oauth"),m=Ut(t,"tiktok_oauth"),h=Ut(t,"linkedin_oauth"),y=Ut(t,"apple_oauth"),C=Ut(t,"farcaster"),g=e.mfa_methods.map(({type:E,verified_at:w})=>({type:E,verifiedAt:j(w)}));return{id:e.id,createdAt:j(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:m&&{subject:m.subject,username:m.username,name:m.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:y&&{subject:y.subject,email:y.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},mfaMethods:g.map(E=>E.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as um}from"@ethersproject/address";import{isHexString as V2}from"@ethersproject/bytes";import z2 from"eventemitter3";import{jsx as _u,jsxs as s2}from"react/jsx-runtime";var ps=({style:e,...t})=>s2("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[_u("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),_u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as Lr}from"@ethersproject/address";import{Web3Provider as Wu}from"@ethersproject/providers";import{default as f2}from"eventemitter3";import m2 from"eventemitter3";var l2=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],ku=e=>l2.includes(e);import{ErrorCode as c2}from"@ethersproject/logger";var Pn=class extends ee{constructor(){super("Wallet timeout");this.type="wallet_error"}},Tn=class extends ee{constructor(){super("User rejected connection");this.type="wallet_error"}},yr=e=>{if(e instanceof ee)return e;if(e?.code&&e?.reason){let t=new Oe(e);return e.code===c2.ACTION_REJECTED&&(t.details=ot.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Oe(e):new ee("Unknown connector error",e)},Ft=class extends Fe{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Oe=class extends Ft{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(ot).find(i=>i.eipCode===o.code);this.details=n||ot.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=ot.E32002_CONNECTION_ALREADY_PENDING:this.details=ot.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=ot.E32002_WALLET_LOCKED))}},d2={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}},p2={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}},u2={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}},ot={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...u2,...p2},eo={...d2,...ot};var Me=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 Pn,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||zo,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 ee(`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 yr(r)})}},vo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},us=class extends m2{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=Xr(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Sn(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new vo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Se()||!this.address)throw new vo("Disconnected",4900);return(await Iu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new vo(`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 vo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Xr(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 Au(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 Ru($a(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:qo(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return qo(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(ku(r.method)){let o=await Se();if(await Mu(),!o||!this.address)throw new vo("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 vo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Se();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}}},Wr=class extends Me{constructor(r){super(r,r.rpcTimeoutDuration)}},Co=class extends Me{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 h2=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},kt=class extends f2{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=En(r),this.walletClientType==="privy"&&Y.put(Ga(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=Sn(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>Lr(a.address)===Lr(r));return{address:Lr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new ee("Wallet is not currently connected.");let l=this.wallets.find(h=>Lr(h.address)===Lr(r))?.chainId;if(!l)throw new ee("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===En(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new ee(`Unsupported chainId: ${a}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await m()}catch(h){if(h2(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new ee(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new Wu(new Wr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ee("Wallet is not currently connected.");return new Co(this.proxyProvider)},sign:async a=>{if(!await i())throw new ee("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Lr(n),a=[],l;if(this.walletClientType==="privy"){let c=Y.get(Ga(i));this.chains.find(u=>u.id===Number(c))||(Y.del(Ga(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 ${vc}`,c),l=vc}let s=En(l);if(!a.find(c=>Lr(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(Lr(n),s,c))}ms(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=>Lr(n)===Lr(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 Wu(new Wr(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 xn={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 y2=(e,t)=>{let o=qa(1,[xn],{},t);return e.makeWeb3Provider(o,1)},fs,hs=class extends kt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;fs||import("@coinbase/wallet-sdk").then(s=>{fs=new s.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l}),this.proxyProvider.setWalletProvider(y2(fs,i))})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){fs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ps,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 ee("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};import{jsx as Lu}from"react/jsx-runtime";var ys=({...e})=>Lu("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Lu("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 gs=class extends kt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[qo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ys,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Ou}from"react/jsx-runtime";var _n=({style:e,...t})=>Ou("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Ou("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Bt,jsxs as g2}from"react/jsx-runtime";var kn=({style:e,...t})=>g2("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:[Bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("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"}),Bt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Nu,jsxs as v2}from"react/jsx-runtime";var Or=({style:e,...t})=>v2("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:[Nu("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Nu("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 Rn=class extends kt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}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 ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}},An,In=class extends kt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Aa(this,An,void 0);this.proxyProvider=new Me(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?sc(this,An,{name:"MetaMask",icon:kn,id:"io.metamask"}):a==="phantom"&&sc(this,An,{name:"Phantom",icon:Or,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return cp(this,An)??{name:"Browser Extension",icon:_n,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ee("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw yr(r)}}};An=new WeakMap;import{getAddress as LP}from"@ethersproject/address";import{Web3Provider as NP}from"@ethersproject/providers";import{isMobile as C2}from"react-device-detect";var vs=class extends Rn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{C2||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 ee("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw yr(t)}}};var Cs=class extends kt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Me(void 0,zo);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}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 ws=class extends Cs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Or,id:"phantom"}}};import{EthereumProvider as F2,OPTIONAL_EVENTS as B2,OPTIONAL_METHODS as H2}from"@walletconnect/ethereum-provider";import{isMobile as G2}from"react-device-detect";import{createContext as I2,useContext as M2,useEffect as Sc,useRef as W2,useState as L2}from"react";import{jsx as w2}from"react/jsx-runtime";function bs({src:e,...t}){return w2("img",{src:e,...t,style:{display:"none"}})}import{useContext as sm,useEffect as am,useMemo as _2,useState as k2}from"react";import{createContext as A2}from"react";var Ht={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Yp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Du=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var b2=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Uu=e=>b2.has(e),Fu=(e,t,r)=>r.indexOf(e)===t,Bu=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Uu).filter(Fu):e?e.filter(Uu).filter(Fu):Ht.appearance.walletList;var Es={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 Ps={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 Ts={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 Hu={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 Gu={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 Ss={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 xs={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 _s={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 Vu={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 zu={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 qu={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 $u={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 Ku={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 ju={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 Yu={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 Zu={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 Ju={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},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 Qu={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 ks={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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 As={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 Rs={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 Ri={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 Ii={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 Xu={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 em={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 tm={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 Is={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 Ms={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 Ws={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 Mi=[Es,Ps,Ts,Yu,tm,xn,ks,As,Rs,Ri,Ii,zu,qu,$u,Ku,Ss,xs,_s,Vu,Ju,Qu,Hu,Gu,Is,Ws,Ms,Zu,Xu,ju,em],sS=new Set(Mi.map(e=>e.id));import Zo from"tinycolor2";var rm="#FFFFFF",E2="#000000",P2=rm,T2="#1E1E1D";function S2(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 to(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Zo({...e.toHsl(),l:r})}function om({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=rm,blackHex:a=E2}){let l;switch(e){case"light":l=P2;break;case"dark":l=T2;break;default:l=e;break}let s=Zo(l),c=Zo(t),u=Zo(r),m=Zo(o),h=Zo(n),y=S2(s.getLuminance()),C=to(s,y==="light"?-.04:.11),g=to(s,y==="light"?-.88:.87),x=to(s,y==="light"?-.77:.75),E=to(s,y==="light"?-.43:.45).desaturate(y==="light"?60:20),w=to(s,y==="light"?-.08:.25).desaturate(y==="light"?60:20),_=to(c,.15),A=to(c,-.06),O=to(h,.3),W=Zo(c.getLuminance()>.5?a:i),R=to(u,-.16);return{colorScheme:y,background:s.toHslString(),background2:C.toHslString(),foreground:g.toHslString(),foreground2:x.toHslString(),foreground3:E.toHslString(),foreground4:w.toHslString(),accent:c.toHslString(),accentLight:_.toHslString(),accentDark:A.toHslString(),foregroundAccent:W.toHslString(),success:u.toHslString(),successDark:R.toHslString(),error:h.toHslString(),errorLight:O.toHslString(),warn:m.toHslString()}}function Ec(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","instagram","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(tt=>n.includes(tt)),a,l,s,c,u,m,h,y,C,g,x,E,w,_;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=i?.includes("google"),m=i?.includes("twitter"),h=i?.includes("discord"),C=i?.includes("spotify"),g=i?.includes("instagram"),y=i?.includes("tiktok"),E=i?.includes("github"),x=i?.includes("linkedin"),w=i?.includes("apple"),_=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,m=e.twitterOAuth,h=e.discordOAuth,E=e.githubOAuth,C=e.spotifyOAuth,g=e.instagramOAuth,y=e.tiktokOAuth,x=e.linkedinOAuth,w=e.appleOAuth,_=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let A=[a,l].filter(Boolean),O=[u,m,h,E,C,g,y,x,w,_].filter(Boolean),W=[c].filter(Boolean);if(A.length+O.length+W.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&W.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&O.length+A.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let q=Bu({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=Du({input:t?.loginMethodsAndOrder}),$=t?.intl?.defaultCountry??"US",{chains:I,defaultChain:Z}=x2({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),U=!!t?.defaultChain,ue=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,re,ce=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ue?re=t?.embeddedWallets?.noPromptOnSignature??!0:re=t?.embeddedWallets?.noPromptOnSignature??ce:re=ce,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&re!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:fe,...Q}=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??Ht.appearance.landingHeader,palette:om({backgroundTheme:t?.appearance?.theme??Ht.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ht.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:q},loginMethods:{wallet:c,email:a,sms:l,passkey:s,google:u,twitter:m,discord:h,github:E,spotify:C,instagram:g,tiktok:y,linkedin:x,apple:w,farcaster:_},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ht.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ht.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ht.rpcConfig.rpcTimeouts},chains:I,defaultChain:Z,intl:{defaultCountry:$},shouldEnforceDefaultChainOnConnect:U,captchaEnabled:e.captchaEnabled??Ht.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof fe=="boolean"?{requireUserOwnedRecoveryOnCreate:fe}:{},...ue?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Q,noPromptOnSignature:re},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ue?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ht.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??Ht._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ht._render.inParentNodeId}}}function nm(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 x2({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:Mi.find(u=>u.id===s.id)??s)}else n=Mi.concat(e??[]);let i=t?n[0]:xn,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 im=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as R2}from"react/jsx-runtime";var lm={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:""},Pc=Ec(lm,void 0,!1),Tc=A2({appConfig:Pc,isServerConfigLoaded:!1}),cm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=k2(null),a=_2(()=>Ec(n??lm,o,!!n),[n,o]);return am(()=>{if(!n)return;let l=nm(o,t),s=im(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]),am(()=>{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)}})()},[]),R2(Tc.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},sr=()=>{let{appConfig:e}=sm(Tc);return e},Ls=()=>{let{isServerConfigLoaded:e}=sm(Tc);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as N2,jsxs as D2}from"react/jsx-runtime";var dm=I2({ready:!1,app:Pc,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),O2=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],pm=e=>{let t=sr(),r=e.authenticated,[o,n]=L2(e.initialScreen);Sc(()=>{!r&&!O2.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=W2(null);Sc(()=>{e.open||(i.current=null)},[e.open]),Sc(()=>{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 D2(dm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&N2(bs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},S=()=>M2(dm);import{jsx as Mn,jsxs as U2}from"react/jsx-runtime";var Wi=({style:e,...t})=>{let{app:r}=S();return U2("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:[Mn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Mn("g",{clipPath:"url(#clip0_1765_9946)",children:Mn("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"})}),Mn("defs",{children:Mn("clipPath",{id:"clip0_1765_9946",children:Mn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Nr=class extends kt{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 Me(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ja[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:kn,id:"io.metamask"}:{name:lu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Wi,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=ja[r],this.walletClientType=r,this.redirectUri=void 0,mu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Tn)};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 ee("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ka(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Sn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(yr(a));return}o(new ee("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=qa(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await F2.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:B2,optionalMethods:H2,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),G2&&this.walletEntry){let{redirect:l,href:s}=pu(a,this.walletEntry);fu({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ya(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Ka(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var xc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>V2(o)).map(o=>um(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Sn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||zo:zo,Li=class extends z2{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 Me: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=this.loadConnectionHistory()}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;Y.get(yc)&&(Y.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Y.del(o)}),Y.del(yc));let r=cu(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"),!yo()&&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")}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 us(r,o,this.rpcConfig,this.chains,i,n.id),s=new gs(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Nr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new vs(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new In(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new In(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new In(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Rn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new hs(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ws(this.defaultChain):new Nr(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()}loadConnectionHistory(){let r=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=Y.get(gc);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Y.put(gc,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=um(r),this.emit("walletsUpdated")}};function ms(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}import{ofetch as q2}from"ofetch";var $2=[Ma,La,Wa,Oa],Os=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=mc,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=q2.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=$2.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 Ra}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw de(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw de(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw de(o)}}};var mm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import Jo from"js-cookie";function fm(e){return e instanceof ho?"email":e instanceof Yo?"sms":e instanceof jo?"siwe":e instanceof Cn?"custom_auth":e instanceof Mr?e.meta.provider:null}import*as hm from"jose";var Dr=class{static parse(t){try{return new Dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=hm.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 K2=30,Ns=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=Y.get(Bo);return typeof t=="string"?new Dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Y.get(Ba);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Y.get(Pi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Jo.get(Ha);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=Dr.parse(this.token);return t!==null&&!t.isExpired(K2)}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=fm(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:ar(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),dt(r)}}async _link(t){try{let r=await t.link();return ar(r)}catch(r){throw console.warn("Error linking account"),dt(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(Ma,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(La,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),ar(n.user)}catch(n){if(n instanceof hr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw dt(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(Wa,{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(pp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw dt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Y.get(Bo);if(Y.put(Bo,t),!this.client?.useServerCookies){let o=Dr.parse(t)?.expiration;Jo.set(fc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Y.del(Bo),Jo.remove(fc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Y.put(Ba,t),this.client?.useServerCookies||(Jo.set(Ha,"t",{sameSite:"Strict",secure:!0,expires:30}),Jo.set(hc,t,{sameSite:"Strict",secure:!0,expires:30}))):(Y.del(Ba),Jo.remove(hc),Jo.remove(Ha))}clearForkedToken(){Y.del(Pi)}};var _c,Ds,ym,Oi=class{constructor(t){Aa(this,Ds);this.apiUrl=t.apiUrl||Fa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Zp,this.appId=t.appId,this.clientAnalyticsId=dp(this,Ds,ym).call(this),_c||(_c=new Ns),this.session=_c,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 Li(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Os(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(Hp,{action:"verify"})}catch(t){throw de(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Gp,{});return mm(t.options)}catch(t){throw de(t)}}async unlinkEmail(t){try{let r=await this.api.post(Tp,{address:t});return ar(r)}catch(r){throw dt(r)}}async acceptTerms(){try{let t=await this.api.post(Vp,{});return ar(t)}catch(t){throw dt(t)}}async unlinkPhone(t){try{let r=await this.api.post(kp,{phoneNumber:t});return ar(r)}catch(r){throw dt(r)}}async unlinkWallet(t){try{let r=await this.api.post(hp,{address:t});return ar(r)}catch(r){throw dt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Wp,{provider:t,subject:r});return ar(o)}catch(o){throw dt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(wp,{fid:t});return ar(r)}catch(r){throw dt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Bp,{credential_id:t});return ar(r)}catch(r){throw dt(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(Oa,{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(zp,t)}catch(r){throw dt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Dr.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});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,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}}catch(t){throw dt(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()}};Ds=new WeakSet,ym=function(){if(typeof window>"u")return null;try{let r=Y.get(Ti);if(typeof r=="string"&&r.length>0)return r}catch{}let t=j2();try{return Y.put(Ti,t),t}catch{return t}};import{Turnstile as e3}from"@marsidev/react-turnstile";import{useEffect as t3,useMemo as r3}from"react";import{useMemo as Y2,useRef as Z2,useContext as J2,useState as kc,createContext as Q2}from"react";import{jsx as X2}from"react/jsx-runtime";var gm=Q2({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),gr=class extends Fe{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},vm=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Z2(null),[i,a]=kc(),[l,s]=kc(),[c,u]=kc(!1),m=Y2(()=>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 X2(gm.Provider,{value:{...m,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 au(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new gr("Captcha failed",null,"captcha_timeout")}}},children:e})},Ce=()=>J2(gm);import{jsx as Cm}from"react/jsx-runtime";var Ac=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Ce(),[,s]=r3(()=>r?.split("t:")||[],[r]);if(t3(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Cm("div",{className:"hidden h-0 w-0",children:Cm(e3,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as zb,useEffect as Sg,useRef as qb,useState as $b}from"react";import Kb from"react-dom";import{createContext as o3,useContext as n3}from"react";var Rc=o3({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,recoveryOAuthFlow:b,loginWithOAuth:b,initLoginWithPasskey:b,loginWithPasskey:b,initLinkWithPasskey:b,linkWithPasskey:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),M=()=>n3(Rc);import{createContext as i3,useContext as a3}from"react";var ge=i3({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkInstagram:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,linkPasskey:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkInstagram:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,unlinkPasskey:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,initEnrollmentWithPasskey:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,submitEnrollmentWithPasskey:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSignerFromWarpcast:b,getFarcasterSignerPublicKey:b,signFarcasterMessage:b,initLoginWithEmail:b,initLoginWithSms:b,otpState:{status:"initial"},loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),F=()=>a3(ge);import{useEffect as s3,useState as l3}from"react";var wm=e=>{let[t,r]=l3("auto");return s3(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as c3,useContext as d3,useEffect as p3}from"react";var bm={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:[]}},Ic=c3(void 0),Em=()=>d3(Ic);function Ne(e,t){if(!t)return;let o=Em().current[e];return p3(()=>{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 D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Us(){let e=Em();return(t,r,...o)=>D(e,t,r,...o)}function Mc(e){Ne("configureMfa",e)}import Rm from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import R3 from"@heroicons/react/24/solid/DocumentCheckIcon";import I3 from"styled-components";import Qo,{css as Nc}from"styled-components";import Lc from"styled-components";import{Fragment as m3,jsx as Wc,jsxs as f3}from"react/jsx-runtime";var pt=({success:e,fail:t})=>f3(m3,{children:[Wc(je,{className:e?"success":t?"fail":""}),Wc(Oc,{className:e?"success":t?"fail":""})]}),je=Lc.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -48,7 +48,7 @@ Resources:
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,ro=e=>Wc(p3,{color:e.color||"var(--privy-color-foreground-3)"}),p3=Lc(je)`
51
+ `,ro=e=>Wc(u3,{color:e.color||"var(--privy-color-foreground-3)"}),u3=Lc(je)`
52
52
  && {
53
53
  height: 0.9rem;
54
54
  width: 0.9rem;
@@ -57,7 +57,7 @@ Resources:
57
57
  /* Override default Loader to match button transitions */
58
58
  transition: border-color 200ms ease;
59
59
  }
60
- `;import{jsx as sr,jsxs as Gs}from"react/jsx-runtime";var Fs=Qo.button`
60
+ `;import{jsx as lr,jsxs as Gs}from"react/jsx-runtime";var Fs=Qo.button`
61
61
  display: flex;
62
62
  flex-direction: row;
63
63
  align-items: center;
@@ -85,13 +85,13 @@ Resources:
85
85
  color: var(--privy-color-foreground-3);
86
86
  cursor: not-allowed;
87
87
  }
88
- `,W=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>sr(Pm,{disabled:t||r,...n,children:t?Gs("span",{children:[sr(ro,{}),o?sr("span",{children:o}):null]}):e}),w_=Qo(W)`
88
+ `,L=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>lr(Pm,{disabled:t||r,...n,children:t?Gs("span",{children:[lr(ro,{}),o?lr("span",{children:o}):null]}):e}),b_=Qo(L)`
89
89
  ${e=>e.hideAnimations&&Nc`
90
90
  && {
91
91
  transition: none;
92
92
  }
93
93
  `}
94
- `,Bs=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>sr(Pm,{as:"a",disabled:t||r,...n,children:t?Gs("span",{children:[sr(ro,{}),o?sr("span",{children:o}):null]}):e}),Pm=Qo(Fs)`
94
+ `,Bs=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>lr(Pm,{as:"a",disabled:t||r,...n,children:t?Gs("span",{children:[lr(ro,{}),o?lr("span",{children:o}):null]}):e}),Pm=Qo(Fs)`
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
- `,vr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>sr(f3,{disabled:t||r,...n,children:t?Gs("span",{children:[sr(ro,{}),o?sr("span",{children:o}):null]}):e}),f3=Qo(Fs)`
139
+ `,vr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>lr(h3,{disabled:t||r,...n,children:t?Gs("span",{children:[lr(ro,{}),o?lr("span",{children:o}):null]}):e}),h3=Qo(Fs)`
140
140
  && {
141
141
  border-width: 1px;
142
142
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -196,10 +196,10 @@ Resources:
196
196
  cursor: not-allowed;
197
197
  }
198
198
  }
199
- `,b_=Qo.div`
199
+ `,E_=Qo.div`
200
200
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
201
201
  height: 44px;
202
- `,Mn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Gs(h3,{isSubmitting:o,onClick:t,disabled:r,...n,children:[sr("span",{children:e}),sr("span",{children:sr(ro,{})})]}),h3=Qo.button`
202
+ `,Wn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Gs(y3,{isSubmitting:o,onClick:t,disabled:r,...n,children:[lr("span",{children:e}),lr("span",{children:lr(ro,{})})]}),y3=Qo.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
- `;import Tm from"styled-components";import{Fragment as y3,jsx as wo,jsxs as Sm}from"react/jsx-runtime";var Dc=Tm.div`
244
+ `;import Tm from"styled-components";import{Fragment as g3,jsx as wo,jsxs as Sm}from"react/jsx-runtime";var Dc=Tm.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 Wn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return wo(Dc,{});if(!r&&!t)return wo(Dc,{});let n=!!(t&&r);return Sm(Dc,{children:["By logging in I agree to the"," ",r&&wo("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&wo("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var G=({protectedByPrivy:e})=>wo(V,{children:e?Sm(y3,{children:[wo(ys,{className:"hide-on-mobile"}),wo("span",{className:"hide-on-mobile",children:wo("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),V=Tm.div`
253
+ `;function Ln(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return wo(Dc,{});if(!r&&!t)return wo(Dc,{});let n=!!(t&&r);return Sm(Dc,{children:["By logging in I agree to the"," ",r&&wo("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&wo("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var G=({protectedByPrivy:e})=>wo(V,{children:e?Sm(g3,{children:[wo(ys,{className:"hide-on-mobile"}),wo("span",{className:"hide-on-mobile",children:wo("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),V=Tm.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
- `;import g3 from"@heroicons/react/24/outline/ArrowLeftIcon";import v3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import C3 from"@heroicons/react/24/outline/XMarkIcon";import Ln from"styled-components";import{jsx as At,jsxs as xm}from"react/jsx-runtime";var w3=({backFn:e})=>At("div",{children:At(Uc,{onClick:e,children:At(g3,{height:"16px",width:"16px",strokeWidth:2})})}),b3=({infoFn:e})=>At("div",{children:At(P3,{"aria-label":"info",onClick:e,children:At(v3,{height:"22px",width:"22px",strokeWidth:2})})}),E3=e=>At("div",{children:At(Uc,{"aria-label":"close modal",onClick:e.onClose,children:At(C3,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),{app:a}=x();return xm(T3,{children:[xm(S3,{children:[e&&At(w3,{backFn:e}),t&&At(b3,{infoFn:t})]}),o&&At(_3,{id:"privy-dialog-title",children:o}),At(x3,{children:a?.render.inDialog&&n&&At(E3,{onClose:r||(()=>i())})})]})},Uc=Ln.button`
280
+ `;import v3 from"@heroicons/react/24/outline/ArrowLeftIcon";import C3 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import w3 from"@heroicons/react/24/outline/XMarkIcon";import On from"styled-components";import{jsx as At,jsxs as xm}from"react/jsx-runtime";var b3=({backFn:e})=>At("div",{children:At(Uc,{onClick:e,children:At(v3,{height:"16px",width:"16px",strokeWidth:2})})}),E3=({infoFn:e})=>At("div",{children:At(T3,{"aria-label":"info",onClick:e,children:At(C3,{height:"22px",width:"22px",strokeWidth:2})})}),P3=e=>At("div",{children:At(Uc,{"aria-label":"close modal",onClick:e.onClose,children:At(w3,{height:"16px",width:"16px",strokeWidth:2})})});var T=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=M(),{app:a}=S();return xm(S3,{children:[xm(x3,{children:[e&&At(b3,{backFn:e}),t&&At(E3,{infoFn:t})]}),o&&At(k3,{id:"privy-dialog-title",children:o}),At(_3,{children:a?.render.inDialog&&n&&At(P3,{onClose:r||(()=>i())})})]})},Uc=On.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
- `,P3=Ln(Uc)`
299
+ `,T3=On(Uc)`
300
300
  && {
301
301
  background-color: transparent;
302
302
  }
303
- `,T3=Ln.div`
303
+ `,S3=On.div`
304
304
  padding: 16px 0;
305
305
  display: flex;
306
306
  align-items: center;
@@ -312,31 +312,31 @@ Resources:
312
312
  font-weight: 600;
313
313
  color: var(--privy-color-foreground);
314
314
  }
315
- `,S3=Ln.div`
315
+ `,x3=On.div`
316
316
  flex: 1;
317
317
  align-items: center;
318
318
  display: flex;
319
319
  gap: 8px;
320
- `,x3=Ln.div`
320
+ `,_3=On.div`
321
321
  flex: 1;
322
322
  display: flex;
323
323
  justify-content: flex-end;
324
- `,_3=Ln.div`
324
+ `,k3=On.div`
325
325
  overflow: hidden;
326
326
  white-space: nowrap;
327
327
  max-width: 100%;
328
328
  text-overflow: ellipsis;
329
329
  text-align: center;
330
330
  color: var(--privy-color-foreground-2);
331
- `;import On,{css as k3}from"styled-components";var Vs=On.div`
331
+ `;import Xo,{css as A3}from"styled-components";var Vs=Xo.div`
332
332
  text-align: left;
333
333
  flex-grow: 1;
334
- `,zs=On.div`
334
+ `,zs=Xo.div`
335
335
  display: flex;
336
336
  flex-direction: column;
337
337
  justify-content: flex-end;
338
338
  flex-grow: 1;
339
- `,lr=On.div`
339
+ `,Cr=Xo.div`
340
340
  display: flex;
341
341
  flex-direction: column;
342
342
  gap: 12px;
@@ -351,7 +351,13 @@ Resources:
351
351
  &::-webkit-scrollbar {
352
352
  display: none;
353
353
  }
354
- `,_m=k3`
354
+ `,_m=Xo(Cr)`
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
+
357
+ background-repeat: no-repeat;
358
+ background-size: 100% 32px, 100% 16px;
359
+ background-attachment: local, scroll;
360
+ `,km=A3`
355
361
  && {
356
362
  width: 100%;
357
363
  font-size: 16px;
@@ -369,7 +375,6 @@ Resources:
369
375
  padding: 12px 16px;
370
376
  border: 1px solid var(--privy-color-foreground-4) !important;
371
377
  border-radius: var(--privy-border-radius-mdlg);
372
- background-color: var(--privy-color-background);
373
378
  transition: background-color 200ms ease;
374
379
 
375
380
  cursor: pointer;
@@ -389,11 +394,11 @@ Resources:
389
394
  max-width: 24px;
390
395
  }
391
396
  }
392
- `,Ae=On.button`
393
- ${_m}
394
- `,Fc=On.a`
395
- ${_m}
396
- `,oo=On.div`
397
+ `,Ae=Xo.button`
398
+ ${km}
399
+ `,Fc=Xo.a`
400
+ ${km}
401
+ `,oo=Xo.div`
397
402
  width: 100%;
398
403
  ${e=>e.if?"display: none;":""}
399
404
  `;import Ye from"styled-components";var be=Ye.div`
@@ -424,7 +429,7 @@ Resources:
424
429
  @media (max-width: 440px) {
425
430
  padding: 10px 10px 20px;
426
431
  }
427
- `,Xo=Ye.div`
432
+ `,en=Ye.div`
428
433
  display: flex;
429
434
  flex-direction: column;
430
435
  align-items: stretch;
@@ -496,7 +501,7 @@ Resources:
496
501
  height: 20px !important;
497
502
  width: 20px !important;
498
503
  }
499
- `,en=Ye.div`
504
+ `,tn=Ye.div`
500
505
  display: flex;
501
506
  align-items: center;
502
507
  gap: 6px;
@@ -514,7 +519,7 @@ Resources:
514
519
  width: 100%;
515
520
  display: flex;
516
521
  justify-content: space-between;
517
- `,km=Ye.p`
522
+ `,Am=Ye.p`
518
523
  text-align: left;
519
524
  width: 100%;
520
525
  color: var(--privy-color-foreground-3) !important;
@@ -565,10 +570,10 @@ Resources:
565
570
  }
566
571
  `,Zs=Ye.div`
567
572
  color: var(--privy-color-error);
568
- `;import{Fragment as W3,jsx as Ur,jsxs as Di}from"react/jsx-runtime";var Rm=()=>{let{user:e,logout:t}=F(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=x(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=m=>{m?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async m=>{m.preventDefault(),await a(),e&&ir(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Ur(I3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},I3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Di(W3,{children:[Ur(P,{closeable:!1}),Ur(A3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Ur(ie,{style:{marginTop:24},children:"One last step"}),Ur(se,{children:"By signing up, you agree to our terms and privacy policy."}),Di(lr,{style:{marginTop:24},children:[e&&Di(Fc,{target:"_blank",href:e,children:["View Terms ",Ur(Am,{style:{marginLeft:"auto"}})]}),t&&Di(Fc,{target:"_blank",href:t,children:["View Privacy Policy ",Ur(Am,{style:{marginLeft:"auto"}})]})]}),Di(M3,{style:{marginTop:24},children:[Ur(vr,{onClick:o,children:"No thanks"}),Ur(W,{onClick:r,children:"Accept"})]}),Ur(G,{protectedByPrivy:!0})]}),M3=R3.div`
573
+ `;import{Fragment as L3,jsx as Ur,jsxs as Di}from"react/jsx-runtime";var Im=()=>{let{user:e,logout:t}=F(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=S(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=m=>{m?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async m=>{m.preventDefault(),await a(),e&&ir(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Ur(M3,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},M3=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Di(L3,{children:[Ur(T,{closeable:!1}),Ur(R3,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Ur(ie,{style:{marginTop:24},children:"One last step"}),Ur(se,{children:"By signing up, you agree to our terms and privacy policy."}),Di(Cr,{style:{marginTop:24},children:[e&&Di(Fc,{target:"_blank",href:e,children:["View Terms ",Ur(Rm,{style:{marginLeft:"auto"}})]}),t&&Di(Fc,{target:"_blank",href:t,children:["View Privacy Policy ",Ur(Rm,{style:{marginLeft:"auto"}})]})]}),Di(W3,{style:{marginTop:24},children:[Ur(vr,{onClick:o,children:"No thanks"}),Ur(L,{onClick:r,children:"Accept"})]}),Ur(G,{protectedByPrivy:!0})]}),W3=I3.div`
569
574
  display: flex;
570
575
  gap: 10px;
571
- `;import Mm from"styled-components";import L3 from"styled-components";var Js=L3.span`
576
+ `;import Wm from"styled-components";import O3 from"styled-components";var Js=O3.span`
572
577
  && {
573
578
  width: 82px;
574
579
  height: 82px;
@@ -583,7 +588,7 @@ Resources:
583
588
  transition: border-color 800ms;
584
589
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
585
590
  }
586
- `;import O3 from"styled-components";var N3=O3.div`
591
+ `;import N3 from"styled-components";var D3=N3.div`
587
592
  display: flex;
588
593
  flex-direction: column;
589
594
  justify-content: center;
@@ -606,7 +611,7 @@ Resources:
606
611
  left: -19px;
607
612
  top: -19px;
608
613
  }
609
- `,mt=N3;import{jsx as Im}from"react/jsx-runtime";var Qs=({style:e,...t})=>Im("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:Im("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Bc,jsx as Fr,jsxs as Xs}from"react/jsx-runtime";var Wm=()=>{let{navigate:e,app:t}=x(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return Xs(Bc,{children:[Fr(P,{}),Xs(D3,{children:[Fr(mt,{children:Xs("div",{children:[Fr(Js,{}),Fr(Qs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Xs(U3,{children:[typeof r=="string"?Fr("h3",{children:r}):Fr(Bc,{children:r}),typeof o=="string"?Fr("p",{children:o}):Fr(Bc,{children:o})]}),t?.allowlistConfig.errorCtaLink?Fr(W,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Fr(W,{onClick:()=>{e("LANDING")},children:n})]})]})},D3=Mm.div`
614
+ `,mt=D3;import{jsx as Mm}from"react/jsx-runtime";var Qs=({style:e,...t})=>Mm("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:Mm("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Bc,jsx as Fr,jsxs as Xs}from"react/jsx-runtime";var Lm=()=>{let{navigate:e,app:t}=S(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return Xs(Bc,{children:[Fr(T,{}),Xs(U3,{children:[Fr(mt,{children:Xs("div",{children:[Fr(Js,{}),Fr(Qs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Xs(F3,{children:[typeof r=="string"?Fr("h3",{children:r}):Fr(Bc,{children:r}),typeof o=="string"?Fr("p",{children:o}):Fr(Bc,{children:o})]}),t?.allowlistConfig.errorCtaLink?Fr(L,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Fr(L,{onClick:()=>{e("LANDING")},children:n})]})]})},U3=Wm.div`
610
615
  display: flex;
611
616
  flex-direction: column;
612
617
  align-items: center;
@@ -614,11 +619,11 @@ Resources:
614
619
  gap: 24px;
615
620
  width: 100%;
616
621
  padding-bottom: 16px;
617
- `,U3=Mm.div`
622
+ `,F3=Wm.div`
618
623
  display: flex;
619
624
  flex-direction: column;
620
625
  gap: 8px;
621
- `;import H3 from"@heroicons/react/24/outline/EnvelopeIcon";import G3 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Bm,useState as el}from"react";import{isMobile as V3}from"react-device-detect";import Bi from"styled-components";import Gt from"styled-components";var dr=Gt.div`
626
+ `;import G3 from"@heroicons/react/24/outline/EnvelopeIcon";import V3 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Hm,useState as el}from"react";import{isMobile as z3}from"react-device-detect";import Bi from"styled-components";import Gt from"styled-components";var dr=Gt.div`
622
627
  display: flex;
623
628
  flex-direction: column;
624
629
  align-items: flex-start;
@@ -633,14 +638,14 @@ Resources:
633
638
  justify-content: center;
634
639
  flex-grow: 1;
635
640
  width: 100%;
636
- `,Lm=Gt.div`
641
+ `,Om=Gt.div`
637
642
  display: flex;
638
643
  flex-direction: column;
639
644
  align-items: center;
640
645
  width: 100%;
641
646
  `,Nn=Gt(bt)`
642
647
  padding: 20px 0;
643
- `,Cr=Gt(bt)`
648
+ `,wr=Gt(bt)`
644
649
  gap: 16px;
645
650
  `,Hc=Gt.div`
646
651
  display: flex;
@@ -650,12 +655,12 @@ Resources:
650
655
  display: flex;
651
656
  flex-direction: column;
652
657
  gap: 8px;
653
- `,yk=Gt.div`
658
+ `,gk=Gt.div`
654
659
  display: flex;
655
660
  flex-direction: column;
656
661
  justify-content: space-between;
657
662
  height: 100%;
658
- `,Om=Gt.div`
663
+ `,Nm=Gt.div`
659
664
  display: flex;
660
665
  flex-direction: column;
661
666
  justify-content: flex-start;
@@ -682,9 +687,9 @@ Resources:
682
687
  height: 16px;
683
688
  `,ae=Gt.div`
684
689
  height: 12px;
685
- `,Nm=Gt.div`
686
- position: relative;
687
690
  `,Dm=Gt.div`
691
+ position: relative;
692
+ `,Um=Gt.div`
688
693
  background-color: var(--privy-color-accent);
689
694
  display: flex;
690
695
  justify-content: center;
@@ -692,9 +697,9 @@ Resources:
692
697
  border-radius: 50%;
693
698
  border-color: white;
694
699
  border-width: 2px !important;
695
- `;import Gc from"styled-components";import{Fragment as B3,jsx as Ui,jsxs as Fm}from"react/jsx-runtime";var Fi=({title:e,description:t,children:r,...o})=>Ui(Um,{...o,children:Fm(B3,{children:[Ui("h3",{children:e}),typeof t=="string"?Ui("p",{children:t}):t,r]})}),Br=Gc(Fi)`
700
+ `;import Gc from"styled-components";import{Fragment as H3,jsx as Ui,jsxs as Bm}from"react/jsx-runtime";var Fi=({title:e,description:t,children:r,...o})=>Ui(Fm,{...o,children:Bm(H3,{children:[Ui("h3",{children:e}),typeof t=="string"?Ui("p",{children:t}):t,r]})}),Br=Gc(Fi)`
696
701
  margin-bottom: 24px;
697
- `,Ee=({title:e,description:t,icon:r,children:o,...n})=>Fm(F3,{...n,children:[r||null,Ui("h3",{children:e}),typeof t=="string"?Ui("p",{children:t}):t,o]}),Um=Gc.div`
702
+ `,Ee=({title:e,description:t,icon:r,children:o,...n})=>Bm(B3,{...n,children:[r||null,Ui("h3",{children:e}),typeof t=="string"?Ui("p",{children:t}):t,o]}),Fm=Gc.div`
698
703
  display: flex;
699
704
  flex-direction: column;
700
705
  justify-content: flex-start;
@@ -714,7 +719,7 @@ Resources:
714
719
  color: var(--privy-color-foreground-2);
715
720
  font-size: 14px;
716
721
  }
717
- `,F3=Gc(Um)`
722
+ `,B3=Gc(Fm)`
718
723
  align-items: center;
719
724
  text-align: center;
720
725
  gap: 16px;
@@ -722,7 +727,7 @@ Resources:
722
727
  h3 {
723
728
  margin-bottom: 24px;
724
729
  }
725
- `;import{Fragment as Vc,jsx as ft,jsxs as bo}from"react/jsx-runtime";var zc=6,Hm=new Array(zc).fill(""),z3=1400;var Vm=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:m}=M(),{authenticated:h,logout:y,user:C}=F(),[g,_]=el(Hm),[T,w]=el(!1),[k,R]=el(null),[L,S]=el(null);n.current=()=>null;let N=s()?.email?0:1,$=e?.render.inDialog?Be:0,K=e?.render.inDialog?$-500:0;Bm(()=>{if(h&&T&&C){if(e?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let re=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},K);return()=>clearTimeout(re)}if(ir(C,e?.embeddedWallets?.createOnLogin)){let re=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:ce=>{console.error(ce),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ce,screen:"AwaitingPasswordlessCodeScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},K);return()=>clearTimeout(re)}else{u();let re=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),$);return()=>clearTimeout(re)}}},[h,T,C]),Bm(()=>{if(k&&L===0){let ue=setTimeout(()=>{_(Hm),R(null),document.querySelector("input[name=code-0]")?.focus()},z3);return()=>clearTimeout(ue)}},[k]);let q=ue=>{ue.preventDefault();let re=ue.currentTarget.value.replace(" ","");if(re==="")return;if(isNaN(Number(re))){R("Code should be numeric"),S(1);return}R(null),S(null);let ce=Number(ue.currentTarget.name?.charAt(5)),fe=[...re||[""]].slice(0,zc-ce),Q=[...g.slice(0,ce),...fe,...g.slice(ce+fe.length)];_(Q);let et=fe.length,tt=Math.min(Math.max(ce+et,0),zc-1);isNaN(Number(ue.currentTarget.value))||document.querySelector(`input[name=code-${tt}]`)?.focus(),Q.every(xt=>xt&&!isNaN(+xt))&&(document.querySelector(`input[name=code-${tt}]`)?.blur(),c(Q.join("")).then(()=>w(!0)).catch(ze=>{if(ze?.status===422)R("Invalid or expired verification code");else if(ze instanceof hr&&ze.privyErrorCode==="cannot_link_more_of_type")R(ze.message);else if(ze instanceof hr&&ze.privyErrorCode==="max_accounts_reached"){console.error(new Rr(ze).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else R("Issue verifying code");S(0)}))},I=ue=>{L===1&&(R(null),S(null));let re=[...g.slice(0,ue),"",...g.slice(ue+1)];_(re),ue>0&&document.querySelector(`input[name=code-${ue-1}]`)?.focus()},Z=N==0?ft(H3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ft(G3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),U=N==0?bo("p",{children:["Please check ",ft(Gm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):bo("p",{children:["Please check ",ft(Gm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return bo(Vc,{children:[ft(P,{backFn:()=>r()},"header"),bo(q3,{children:[ft(Ee,{title:"Enter confirmation code",description:U,icon:Z}),bo(Lm,{children:[bo($3,{children:[ft(K3,{fail:!!k,success:T,children:ft("span",{children:k||(T?"Success!":"")})}),ft("div",{children:g.map((ue,re)=>ft("input",{name:`code-${re}`,type:"text",value:g[re],onChange:q,onKeyUp:ce=>{ce.key==="Backspace"&&I(re)},inputMode:"numeric",autoFocus:re===0,pattern:"[0-9]",className:`${T?"success":""} ${k?"fail":""}`,autoComplete:V3?"one-time-code":"off"},re))})]}),ft(j3,{children:N==0?bo(Vc,{children:[ft("span",{children:"Didn't get an email?"}),ft("button",{onClick:a,children:"Resend code"})]}):bo(Vc,{children:[ft("span",{children:"Didn't get a message?"}),ft("button",{onClick:l,children:"Resend code"})]})})]})]}),ft(G,{protectedByPrivy:!0})]})},q3=Bi.div`
730
+ `;import{Fragment as Vc,jsx as ft,jsxs as bo}from"react/jsx-runtime";var zc=6,Gm=new Array(zc).fill(""),q3=1400;var zm=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:m}=M(),{authenticated:h,logout:y,user:C}=F(),[g,x]=el(Gm),[E,w]=el(!1),[_,A]=el(null),[O,W]=el(null);n.current=()=>null;let R=s()?.email?0:1,q=e?.render.inDialog?Be:0,K=e?.render.inDialog?q-500:0;Hm(()=>{if(h&&E&&C){if(e?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let re=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},K);return()=>clearTimeout(re)}if(ir(C,e?.embeddedWallets?.createOnLogin)){let re=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:ce=>{console.error(ce),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ce,screen:"AwaitingPasswordlessCodeScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},K);return()=>clearTimeout(re)}else{u();let re=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),q);return()=>clearTimeout(re)}}},[h,E,C]),Hm(()=>{if(_&&O===0){let ue=setTimeout(()=>{x(Gm),A(null),document.querySelector("input[name=code-0]")?.focus()},q3);return()=>clearTimeout(ue)}},[_]);let $=ue=>{ue.preventDefault();let re=ue.currentTarget.value.replace(" ","");if(re==="")return;if(isNaN(Number(re))){A("Code should be numeric"),W(1);return}A(null),W(null);let ce=Number(ue.currentTarget.name?.charAt(5)),fe=[...re||[""]].slice(0,zc-ce),Q=[...g.slice(0,ce),...fe,...g.slice(ce+fe.length)];x(Q);let et=fe.length,tt=Math.min(Math.max(ce+et,0),zc-1);isNaN(Number(ue.currentTarget.value))||document.querySelector(`input[name=code-${tt}]`)?.focus(),Q.every(xt=>xt&&!isNaN(+xt))&&(document.querySelector(`input[name=code-${tt}]`)?.blur(),c(Q.join("")).then(()=>w(!0)).catch(ze=>{if(ze?.status===422)A("Invalid or expired verification code");else if(ze instanceof hr&&ze.privyErrorCode==="cannot_link_more_of_type")A(ze.message);else if(ze instanceof hr&&ze.privyErrorCode==="max_accounts_reached"){console.error(new Ir(ze).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else A("Issue verifying code");W(0)}))},I=ue=>{O===1&&(A(null),W(null));let re=[...g.slice(0,ue),"",...g.slice(ue+1)];x(re),ue>0&&document.querySelector(`input[name=code-${ue-1}]`)?.focus()},Z=R==0?ft(G3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ft(V3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),U=R==0?bo("p",{children:["Please check ",ft(Vm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):bo("p",{children:["Please check ",ft(Vm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return bo(Vc,{children:[ft(T,{backFn:()=>r()},"header"),bo($3,{children:[ft(Ee,{title:"Enter confirmation code",description:U,icon:Z}),bo(Om,{children:[bo(K3,{children:[ft(j3,{fail:!!_,success:E,children:ft("span",{children:_||(E?"Success!":"")})}),ft("div",{children:g.map((ue,re)=>ft("input",{name:`code-${re}`,type:"text",value:g[re],onChange:$,onKeyUp:ce=>{ce.key==="Backspace"&&I(re)},inputMode:"numeric",autoFocus:re===0,pattern:"[0-9]",className:`${E?"success":""} ${_?"fail":""}`,autoComplete:z3?"one-time-code":"off"},re))})]}),ft(Y3,{children:R==0?bo(Vc,{children:[ft("span",{children:"Didn't get an email?"}),ft("button",{onClick:a,children:"Resend code"})]}):bo(Vc,{children:[ft("span",{children:"Didn't get a message?"}),ft("button",{onClick:l,children:"Resend code"})]})})]})]}),ft(G,{protectedByPrivy:!0})]})},$3=Bi.div`
726
731
  display: flex;
727
732
  flex-direction: column;
728
733
  align-items: flex-start;
@@ -730,7 +735,7 @@ Resources:
730
735
  margin: auto;
731
736
  gap: 16px;
732
737
  flex-grow: 1;
733
- `,$3=Bi.div`
738
+ `,K3=Bi.div`
734
739
  display: flex;
735
740
  flex-direction: column;
736
741
  width: 100%;
@@ -786,7 +791,7 @@ Resources:
786
791
  transform: translate(1px, 0px);
787
792
  }
788
793
  }
789
- `,K3=Bi.div`
794
+ `,j3=Bi.div`
790
795
  line-height: 20px;
791
796
  height: 20px;
792
797
  font-size: 13px;
@@ -794,7 +799,7 @@ Resources:
794
799
  display: flex;
795
800
  justify-content: flex-end;
796
801
  width: 100%;
797
- `,j3=Bi.div`
802
+ `,Y3=Bi.div`
798
803
  font-size: 13px;
799
804
  color: var(--privy-color-foreground-3);
800
805
  display: flex;
@@ -808,10 +813,10 @@ Resources:
808
813
  > button {
809
814
  text-decoration: underline;
810
815
  }
811
- `,Gm=Bi.span`
816
+ `,Vm=Bi.span`
812
817
  font-weight: 500;
813
818
  word-break: break-all;
814
- `;import X3 from"@heroicons/react/24/solid/CheckCircleIcon";import e0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as qc,useRef as t0,useState as Un}from"react";import r0 from"styled-components";import Y3 from"styled-components";import{Fragment as Q3,jsx as Dn,jsxs as J3}from"react/jsx-runtime";var zm=({icon:e})=>{let t=e;return Dn(Q3,{children:Dn(Z3,{children:J3("div",{children:[Dn(pt,{}),typeof t=="string"?Dn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Dn(t,{style:{width:"38px",height:"38px"}}):Dn("span",{})]})})})},Z3=Y3.div`
819
+ `;import e0 from"@heroicons/react/24/solid/CheckCircleIcon";import t0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as qc,useRef as r0,useState as Un}from"react";import o0 from"styled-components";import Z3 from"styled-components";import{Fragment as X3,jsx as Dn,jsxs as Q3}from"react/jsx-runtime";var qm=({icon:e})=>{let t=e;return Dn(X3,{children:Dn(J3,{children:Q3("div",{children:[Dn(pt,{}),typeof t=="string"?Dn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Dn(t,{style:{width:"38px",height:"38px"}}):Dn("span",{})]})})})},J3=Z3.div`
815
820
  display: flex;
816
821
  flex-direction: column;
817
822
  justify-content: center;
@@ -834,14 +839,14 @@ Resources:
834
839
  left: -19px;
835
840
  top: -19px;
836
841
  }
837
- `;import{Fragment as n0,jsx as wr,jsxs as $c}from"react/jsx-runtime";var $m=500,qm=$m*2,Km=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=x(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Ce(),m=t0([]),h=Z=>{m.current=[Z,...m.current]},[y,C]=Un(!0);qc(()=>{let Z=setTimeout(C,qm,!1);return h(Z),()=>{m.current.forEach(U=>clearTimeout(U)),m.current=[]}},[]);let[g,_]=Un(""),[T,w]=Un("Checking that you are a human..."),[k,R]=Un(wr(W,{onClick:()=>{},disabled:!0,children:"Continue"})),[L,S]=Un(!1),[N,$]=Un(3),K=r?.captchaModalData,q=async Z=>{try{await K?.callback(Z),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(U){if(U instanceof gr)return;{let ue={error:U,previousScreen:e||"LANDING"};i({errorModalData:ue}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};qc(()=>{if(a==="success"){let Z=setTimeout(async()=>{let U=await s();!U||K?.userIntentRequired||q(U)},qm);h(Z)}else if(a==="ready"){let Z=setTimeout(()=>{a==="ready"&&u()},$m);h(Z)}},[a]),qc(()=>{if(!y)switch(a){case"success":_("Success!"),w("CAPTCHA passed successfully."),R(wr(W,{onClick:()=>{S(!0),q(l)},disabled:!K?.userIntentRequired,loading:L,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":_(""),w("Checking that you are a human..."),R(wr(W,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":_("Something went wrong"),N<=0?(w("If you use an adblocker or VPN, try disabling and re-attempting."),R(null)):(w("You did not pass CAPTCHA. Please try again."),R(wr(W,{onClick:I,children:"Retry"})));break;case"ready":default:break}},[a,y,L]);let I=async()=>{if(N<=0)return;$(U=>U-1),c(),u();let Z=await s();!Z||K?.userIntentRequired||q(Z)};return $c(n0,{children:[wr(P,{backFn:!e||t===e?void 0:o}),$c(o0,{children:[a==="success"?wr(X3,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?wr(e0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):wr(zm,{}),$c(Ze,{children:[g?wr("h3",{children:g}):null,wr("p",{children:T})]}),k]}),wr(V,{})]})},o0=r0.div`
842
+ `;import{Fragment as i0,jsx as br,jsxs as $c}from"react/jsx-runtime";var Km=500,$m=Km*2,jm=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=S(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Ce(),m=r0([]),h=Z=>{m.current=[Z,...m.current]},[y,C]=Un(!0);qc(()=>{let Z=setTimeout(C,$m,!1);return h(Z),()=>{m.current.forEach(U=>clearTimeout(U)),m.current=[]}},[]);let[g,x]=Un(""),[E,w]=Un("Checking that you are a human..."),[_,A]=Un(br(L,{onClick:()=>{},disabled:!0,children:"Continue"})),[O,W]=Un(!1),[R,q]=Un(3),K=r?.captchaModalData,$=async Z=>{try{await K?.callback(Z),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(U){if(U instanceof gr)return;{let ue={error:U,previousScreen:e||"LANDING"};i({errorModalData:ue}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};qc(()=>{if(a==="success"){let Z=setTimeout(async()=>{let U=await s();!U||K?.userIntentRequired||$(U)},$m);h(Z)}else if(a==="ready"){let Z=setTimeout(()=>{a==="ready"&&u()},Km);h(Z)}},[a]),qc(()=>{if(!y)switch(a){case"success":x("Success!"),w("CAPTCHA passed successfully."),A(br(L,{onClick:()=>{W(!0),$(l)},disabled:!K?.userIntentRequired,loading:O,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),w("Checking that you are a human..."),A(br(L,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),R<=0?(w("If you use an adblocker or VPN, try disabling and re-attempting."),A(null)):(w("You did not pass CAPTCHA. Please try again."),A(br(L,{onClick:I,children:"Retry"})));break;case"ready":default:break}},[a,y,O]);let I=async()=>{if(R<=0)return;q(U=>U-1),c(),u();let Z=await s();!Z||K?.userIntentRequired||$(Z)};return $c(i0,{children:[br(T,{backFn:!e||t===e?void 0:o}),$c(n0,{children:[a==="success"?br(e0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?br(t0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):br(qm,{}),$c(Ze,{children:[g?br("h3",{children:g}):null,br("p",{children:E})]}),_]}),br(V,{})]})},n0=o0.div`
838
843
  display: flex;
839
844
  flex-direction: column;
840
845
  align-items: center;
841
846
  justify-content: center;
842
847
  gap: 24px;
843
848
  width: 100%;
844
- `;import i0 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as a0}from"react-device-detect";import s0 from"styled-components";import{jsx as br,jsxs as jm}from"react/jsx-runtime";var Ym=({...e})=>jm("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[br("defs",{children:jm("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:[br("stop",{offset:"0",stopColor:"#f1562b"}),br("stop",{offset:"0.3",stopColor:"#f1542b"}),br("stop",{offset:"0.41",stopColor:"#f04d2a"}),br("stop",{offset:"0.49",stopColor:"#ef4229"}),br("stop",{offset:"0.5",stopColor:"#ef4029"}),br("stop",{offset:"0.56",stopColor:"#e83e28"}),br("stop",{offset:"0.67",stopColor:"#e13c26"}),br("stop",{offset:"1",stopColor:"#df3c26"})]})}),br("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"}),br("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Er,jsxs as Hi}from"react/jsx-runtime";var Zm=({style:e,...t})=>Hi("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:[Er("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"}),Er("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Er("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"})}),Hi("g",{mask:"url(#mask0_16909_31415)",children:[Er("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"}),Er("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"}),Er("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"}}),Er("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"}})]}),Hi("defs",{children:[Hi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Er("stop",{"stop-color":"#002D72"}),Er("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),Hi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Er("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Er("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as te,jsxs as Vt}from"react/jsx-runtime";var Jm=({style:e,...t})=>Vt("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:[te("g",{clipPath:"url(#clip0_5_32)",children:Vt("g",{clipPath:"url(#clip1_5_32)",children:[te("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:te("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"})}),te("g",{mask:"url(#mask0_5_32)",children:te("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),te("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)"}),te("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),te("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),te("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),te("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),te("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),te("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)"}),te("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),te("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Vt("defs",{children:[Vt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#174299"}),te("stop",{offset:"1",stopColor:"#001E59"})]}),Vt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[te("stop",{offset:"0.770277",stopColor:"#FF4000"}),te("stop",{offset:"1",stopColor:"#8754C9"})]}),Vt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FF4000"}),te("stop",{offset:"1",stopColor:"#8754C9"})]}),Vt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#8754C9"}),te("stop",{offset:"1",stopColor:"#FF4000"})]}),Vt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[te("stop",{offset:"0.723929",stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[te("stop",{offset:"0.59513",stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),Vt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[te("stop",{stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),Vt("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:[te("stop",{stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),te("clipPath",{id:"clip0_5_32",children:te("rect",{width:"120",height:"120",fill:"white"})}),te("clipPath",{id:"clip1_5_32",children:te("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Hr,jsxs as Qm}from"react/jsx-runtime";var Xm=({style:e,...t})=>Qm("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:[Hr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Qm("g",{filter:"url(#filter0_d_12393_20043)",children:[Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Gi,jsxs as ef}from"react/jsx-runtime";var tf=({style:e,...t})=>ef("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:[ef("g",{clipPath:"url(#clip0_1704_1423)",children:[Gi("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"}),Gi("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"})]}),Gi("defs",{children:Gi("clipPath",{id:"clip0_1704_1423",children:Gi("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Fn,jsxs as u0}from"react/jsx-runtime";var Gr={coinbase_wallet:{logo:ps,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:_n,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Lr,displayName:"Phantom"},rainbow:{logo:Jm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Wi,displayName:"WalletConnect"},zerion:{logo:tf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Ym,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Zm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Xm,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="}},tn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=x(),{connectWallet:a}=M(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{yo()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(a0?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},u0(p0,{onClick:s,children:[Fn(d0,{icon:c0(e,n.connectorType)??r,name:n.walletClientType}),Fn("span",{children:l0(e,n.connectorType)||t||n.walletClientType}),Fn("span",{id:"connect-text",children:"Connect"})]})},l0=(e,t)=>{if(Gr[e]?.displayName)return Gr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},c0=(e,t)=>{if(Gr[e]?.logo)return Gr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Wi},d0=({icon:e,name:t})=>typeof e=="string"?Fn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Fn(i0,{}):e?Fn(e,{}):null,p0=s0(Ae)`
849
+ `;import a0 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as s0}from"react-device-detect";import l0 from"styled-components";import{jsx as Er,jsxs as Ym}from"react/jsx-runtime";var Zm=({...e})=>Ym("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Er("defs",{children:Ym("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:[Er("stop",{offset:"0",stopColor:"#f1562b"}),Er("stop",{offset:"0.3",stopColor:"#f1542b"}),Er("stop",{offset:"0.41",stopColor:"#f04d2a"}),Er("stop",{offset:"0.49",stopColor:"#ef4229"}),Er("stop",{offset:"0.5",stopColor:"#ef4029"}),Er("stop",{offset:"0.56",stopColor:"#e83e28"}),Er("stop",{offset:"0.67",stopColor:"#e13c26"}),Er("stop",{offset:"1",stopColor:"#df3c26"})]})}),Er("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"}),Er("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Pr,jsxs as Hi}from"react/jsx-runtime";var Jm=({style:e,...t})=>Hi("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:[Pr("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"}),Pr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Pr("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"})}),Hi("g",{mask:"url(#mask0_16909_31415)",children:[Pr("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"}),Pr("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"}),Pr("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"}}),Pr("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"}})]}),Hi("defs",{children:[Hi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Pr("stop",{"stop-color":"#002D72"}),Pr("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),Hi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Pr("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Pr("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as te,jsxs as Vt}from"react/jsx-runtime";var Qm=({style:e,...t})=>Vt("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:[te("g",{clipPath:"url(#clip0_5_32)",children:Vt("g",{clipPath:"url(#clip1_5_32)",children:[te("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:te("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"})}),te("g",{mask:"url(#mask0_5_32)",children:te("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),te("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)"}),te("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),te("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),te("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),te("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),te("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),te("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)"}),te("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),te("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Vt("defs",{children:[Vt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#174299"}),te("stop",{offset:"1",stopColor:"#001E59"})]}),Vt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[te("stop",{offset:"0.770277",stopColor:"#FF4000"}),te("stop",{offset:"1",stopColor:"#8754C9"})]}),Vt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FF4000"}),te("stop",{offset:"1",stopColor:"#8754C9"})]}),Vt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#8754C9"}),te("stop",{offset:"1",stopColor:"#FF4000"})]}),Vt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[te("stop",{offset:"0.723929",stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[te("stop",{stopColor:"#FFF700"}),te("stop",{offset:"1",stopColor:"#FF9901"})]}),Vt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[te("stop",{offset:"0.59513",stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),Vt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[te("stop",{stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),Vt("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:[te("stop",{stopColor:"#00AAFF"}),te("stop",{offset:"1",stopColor:"#01DA40"})]}),te("clipPath",{id:"clip0_5_32",children:te("rect",{width:"120",height:"120",fill:"white"})}),te("clipPath",{id:"clip1_5_32",children:te("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Hr,jsxs as Xm}from"react/jsx-runtime";var ef=({style:e,...t})=>Xm("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:[Hr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Xm("g",{filter:"url(#filter0_d_12393_20043)",children:[Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("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"}),Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Gi,jsxs as tf}from"react/jsx-runtime";var rf=({style:e,...t})=>tf("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:[tf("g",{clipPath:"url(#clip0_1704_1423)",children:[Gi("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"}),Gi("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"})]}),Gi("defs",{children:Gi("clipPath",{id:"clip0_1704_1423",children:Gi("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Fn,jsxs as m0}from"react/jsx-runtime";var Gr={coinbase_wallet:{logo:ps,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:kn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Or,displayName:"Phantom"},rainbow:{logo:Qm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Wi,displayName:"WalletConnect"},zerion:{logo:rf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Zm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Jm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:ef,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="}},rn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=S(),{connectWallet:a}=M(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{yo()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(s0?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},m0(u0,{onClick:s,children:[Fn(p0,{icon:d0(e,n.connectorType)??r,name:n.walletClientType}),Fn("span",{children:c0(e,n.connectorType)||t||n.walletClientType}),Fn("span",{id:"connect-text",children:"Connect"})]})},c0=(e,t)=>{if(Gr[e]?.displayName)return Gr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},d0=(e,t)=>{if(Gr[e]?.logo)return Gr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Wi},p0=({icon:e,name:t})=>typeof e=="string"?Fn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Fn(a0,{}):e?Fn(e,{}):null,u0=l0(Ae)`
845
850
  /* Show "Connect" on hover */
846
851
  > #connect-text {
847
852
  font-weight: 500;
@@ -863,23 +868,23 @@ Resources:
863
868
  display: none;
864
869
  }
865
870
  }
866
- `;import{Fragment as g0,jsx as Bn,jsxs as v0}from"react/jsx-runtime";var m0=["coinbase_wallet"],f0=["metamask","okx_wallet","rainbow","uniswap","zerion"],h0=["cryptocom"],y0=["phantom"],Hn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=x(),o=Vi(r.appearance.walletList,t,e,r.appearance.walletList);return v0(g0,{children:[...o]})},Vi=(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:m})=>m==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(m));for(let u of c){let{walletClientType:m,walletBranding:h}=u;(m==="unknown"?i:n).push(Bn(tn,{connectOnly:r,provider:m,logo:h.icon,displayName:h.name,connector:u},`${s}-${m}`))}}else if(y0.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(Bn(tn,{connectOnly:r,provider:s,connector:c},s))}else if(f0.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(Bn(tn,{connectOnly:r,provider:s,connector:c},s))}else if(m0.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(Bn(tn,{connectOnly:r,provider:s,connector:c},s))}else h0.includes(s)?l&&a.push(Bn(tn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(Bn(tn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as C0,jsx as zi,jsxs as w0}from"react/jsx-runtime";var rf=()=>{let{app:e}=x(),t=`Connect a wallet to ${e?.name}`;return w0(C0,{children:[zi(P,{},"header"),zi(Br,{title:"Connect your wallet",description:t}),zi(lr,{children:zi(Hn,{connectOnly:!0})}),zi(G,{protectedByPrivy:!0})]})};import S0 from"styled-components";import P0 from"styled-components";import b0 from"react";import{jsx as E0}from"react/jsx-runtime";var of=()=>{let{app:e}=x(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?E0("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?b0.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as nf}from"react/jsx-runtime";var Gn=e=>{let{app:t}=x();return t?.appearance.logo?nf(T0,{...e,children:nf(of,{})}):null},T0=P0.div`
871
+ `;import{Fragment as v0,jsx as Bn,jsxs as C0}from"react/jsx-runtime";var f0=["coinbase_wallet"],h0=["metamask","okx_wallet","rainbow","uniswap","zerion"],y0=["cryptocom"],g0=["phantom"],Hn=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=S(),o=Vi(r.appearance.walletList,t,e,r.appearance.walletList);return C0(v0,{children:[...o]})},Vi=(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:m})=>m==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(m));for(let u of c){let{walletClientType:m,walletBranding:h}=u;(m==="unknown"?i:n).push(Bn(rn,{connectOnly:r,provider:m,logo:h.icon,displayName:h.name,connector:u},`${s}-${m}`))}}else if(g0.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(Bn(rn,{connectOnly:r,provider:s,connector:c},s))}else if(h0.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(Bn(rn,{connectOnly:r,provider:s,connector:c},s))}else if(f0.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(Bn(rn,{connectOnly:r,provider:s,connector:c},s))}else y0.includes(s)?l&&a.push(Bn(rn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(Bn(rn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as w0,jsx as zi,jsxs as b0}from"react/jsx-runtime";var of=()=>{let{app:e}=S(),t=`Connect a wallet to ${e?.name}`;return b0(w0,{children:[zi(T,{},"header"),zi(Br,{title:"Connect your wallet",description:t}),zi(Cr,{children:zi(Hn,{connectOnly:!0})}),zi(G,{protectedByPrivy:!0})]})};import x0 from"styled-components";import T0 from"styled-components";import E0 from"react";import{jsx as P0}from"react/jsx-runtime";var nf=()=>{let{app:e}=S(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?P0("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?E0.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as af}from"react/jsx-runtime";var Gn=e=>{let{app:t}=S();return t?.appearance.logo?af(S0,{...e,children:af(nf,{})}):null},S0=T0.div`
867
872
  display: flex;
868
873
  flex-direction: column;
869
874
  align-items: center;
870
875
  padding: 24px 0;
871
876
  flex-grow: 1;
872
877
  justify-content: center;
873
- `;import{Fragment as _0,jsx as Vn,jsxs as k0}from"react/jsx-runtime";var af=()=>{let{app:e}=x();return k0(_0,{children:[Vn(P,{},"header"),Vn(x0,{}),Vn(lr,{children:Vn(Hn,{connectOnly:!0})}),e&&Vn(Wn,{app:e,alwaysShowImplicitConsent:!0}),Vn(G,{protectedByPrivy:!0})]})},x0=S0(Gn)`
878
+ `;import{Fragment as k0,jsx as Vn,jsxs as A0}from"react/jsx-runtime";var sf=()=>{let{app:e}=S();return A0(k0,{children:[Vn(T,{},"header"),Vn(_0,{}),Vn(Cr,{children:Vn(Hn,{connectOnly:!0})}),e&&Vn(Ln,{app:e,alwaysShowImplicitConsent:!0}),Vn(G,{protectedByPrivy:!0})]})},_0=x0(Gn)`
874
879
  margin-bottom: 16px;
875
- `;import{useEffect as mf,useState as ff}from"react";import{isMobile as N0}from"react-device-detect";import D0 from"styled-components";import{useEffect as Kc,useState as rn}from"react";import{isMobile as tl}from"react-device-detect";import df from"styled-components";import{useEffect as sf,useRef as A0}from"react";var R0=(e,t)=>{let r=A0(()=>{});sf(()=>{r.current=e}),sf(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},lf=R0;import{useState as I0,useEffect as M0,useCallback as W0}from"react";function cf(){let[e,t]=I0(!1),r=W0(()=>{document.hidden&&t(!0)},[]);return M0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as uf,jsx as nt,jsxs as qi}from"react/jsx-runtime";var jc=2,Yc=e=>e?.privyErrorCode==="linked_to_another_user"?eo.ERROR_USER_EXISTS:e instanceof Oe&&!e.details.default?e.details:e instanceof En?eo.ERROR_TIMED_OUT:e instanceof Pn?eo.ERROR_USER_REJECTED_CONNECTION:eo.ERROR_WALLET_CONNECTION,pf=()=>{let[e,t]=rn(!1),[r,o]=rn(!1),[n,i]=rn(void 0),{authenticated:a,logout:l}=F(),{app:s,navigate:c,navigateBack:u,lastScreen:m,currentScreen:h,setModalData:y}=x(),{getAuthFlow:C,walletConnectionStatus:g,closePrivyModal:_,initLoginWithWallet:T,loginWithWallet:w,updateWallets:k,createAnalyticsEvent:R}=M(),{walletConnectors:L}=F(),[S,N]=rn(0),{user:$}=F(),[K]=rn($?.linkedAccounts.length||0),[q,I]=rn(""),[Z,U]=rn(!1),{hasTabbedAway:ue}=cf(),{enabled:re,token:ce}=Ce(),fe=tl&&g?.connector?.connectorType==="wallet_connect_v2"||tl&&g?.connector?.connectorType==="coinbase_wallet"||tl&&g?.connector?.connectorType==="injected"&&g?.connector?.walletClientType==="phantom",Q=g?.status==="connected",et=g?.status==="switching_to_supported_chain";Kc(()=>{let B=C();if(Q&&!B&&(re&&!ce&&!a?(y({captchaModalData:{callback:me=>T(g.connectedWallet,me).then(()=>{U(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):T(g.connectedWallet,ce).then(()=>{U(!0)})),B&&fe&&Q&&!B.preparedMessage){B.buildSiweMessage();return}!B||fe||!Q||r||(async()=>{o(!0),i(void 0);try{g?.connector?.connectorType==="wallet_connect_v2"&&g?.connector?.walletClientType==="metamask"&&await Cc(2500),await xt()}catch(me){console.warn("Auto-prompted signature failed",me)}finally{o(!1)}})()},[S,Q,Z]),Kc(()=>{if($&&e){let B=s?.render.inDialog?Be:0,me=s?.render.inDialog?B-500:0;if(s?.legal.requireUsersAcceptTerms&&!$.hasAcceptedTerms){let Uo=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},me);return()=>clearTimeout(Uo)}if(ir($,s?.embeddedWallets?.createOnLogin)){let Uo=setTimeout(()=>{y({createWallet:{onSuccess:()=>{},onFailure:vt=>{console.error(vt),R({eventName:"embedded_wallet_creation_failure_logout",payload:{error:vt,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},me);return()=>clearTimeout(Uo)}k();let tr=setTimeout(()=>_({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Be);return()=>clearTimeout(tr)}},[$,e]);let tt=B=>{if(B?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(B?.privyErrorCode==="max_accounts_reached"){console.error(new Rr(B).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(Yc(B))};async function xt(){try{if(await w(),!s?.render.inDialog)return _({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(B){tt(B)}finally{o(!1)}}Kc(()=>{g?.connectError&&tt(g?.connectError)},[g]),lf(()=>{let B=ze==="wallet_connect_v2"&&g?.connector instanceof Nr?g.connector.redirectUri:void 0;B&&I(B)},g?.connector instanceof Nr&&!q?500:null);let ze=g?.connector?.connectorType||"injected",Xt=g?.connector?.walletClientType||"unknown",_e=Gr[Xt]?.displayName||g?.connector?.walletBranding.name||"Browser Extension",He=Gr[Xt]?.logo||g?.connector?.walletBranding.icon||(B=>nt(xn,{...B})),er=_e==="Browser Extension"?_e.toLowerCase():_e,_t;e?_t=`Successfully connected with ${er}`:n?_t=n.message:et?_t="Switching networks":Q?_t=r&&fe?"Signing":"Sign to verify":_t=`Waiting for ${er}`;let Ue="Don\u2019t see your wallet? Check your other browser windows.";if(e){let B=$?.linkedAccounts.length||0;K===B?Ue="Wallet was already linked.":Ue="You\u2019re good to go!"}else S>=jc&&n?Ue="Unable to connect wallet":n?Ue=n.detail:et?Ue="Switch your wallet to the requested network.":Q&&fe?Ue="Sign the message in your wallet to verify it belongs to you.":Xt==="metamask"&&tl?Ue="Click continue to open and connect MetaMask.":Xt==="metamask"?Ue="For the best experience, connect only one wallet at a time.":ze==="wallet_connect"?Ue="Open your mobile wallet app to continue":ze==="coinbase_wallet"&&(Kp()||(xc($)?Ue="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Ue="Open the Coinbase app on your phone to continue."));let O=L?.walletConnectors?.find(B=>B.walletClientType==="coinbase_wallet"),ne=Xt==="coinbase_wallet"&&(xc($)||n===eo.ERROR_USER_EXISTS);return qi(uf,{children:[nt(P,{backFn:!m||h===m?void 0:u}),qi(L0,{children:[nt(Zc,{walletLogo:He,success:e,fail:!!n}),qi(Ze,{children:[nt("h3",{children:_t}),nt("p",{children:Ue}),!Q&&q&&!ue?qi("p",{children:["Still here?"," ",nt("a",{href:q,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),ne?nt(W,{onClick:()=>O&&O?.disconnect(),disabled:e,children:"Use a different wallet"}):n==eo.ERROR_USER_EXISTS&&h!==m?nt(W,{onClick:u,children:"Use a different wallet"}):Q&&!e&&fe?nt(W,{onClick:()=>{o(!0),xt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&S<jc?nt(W,{onClick:()=>{N(S+1),i(void 0),Q?(o(!0),xt()):g?.connectRetry()},disabled:!e&&(!n?.retryable||S>=jc),children:"Retry"}):!e&&!n?nt(W,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),nt(V,{})]})},L0=df.div`
880
+ `;import{useEffect as ff,useState as hf}from"react";import{isMobile as D0}from"react-device-detect";import U0 from"styled-components";import{useEffect as Kc,useState as on}from"react";import{isMobile as tl}from"react-device-detect";import pf from"styled-components";import{useEffect as lf,useRef as R0}from"react";var I0=(e,t)=>{let r=R0(()=>{});lf(()=>{r.current=e}),lf(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},cf=I0;import{useState as M0,useEffect as W0,useCallback as L0}from"react";function df(){let[e,t]=M0(!1),r=L0(()=>{document.hidden&&t(!0)},[]);return W0(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as mf,jsx as nt,jsxs as qi}from"react/jsx-runtime";var jc=2,Yc=e=>e?.privyErrorCode==="linked_to_another_user"?eo.ERROR_USER_EXISTS:e instanceof Oe&&!e.details.default?e.details:e instanceof Pn?eo.ERROR_TIMED_OUT:e instanceof Tn?eo.ERROR_USER_REJECTED_CONNECTION:eo.ERROR_WALLET_CONNECTION,uf=()=>{let[e,t]=on(!1),[r,o]=on(!1),[n,i]=on(void 0),{authenticated:a,logout:l}=F(),{app:s,navigate:c,navigateBack:u,lastScreen:m,currentScreen:h,setModalData:y}=S(),{getAuthFlow:C,walletConnectionStatus:g,closePrivyModal:x,initLoginWithWallet:E,loginWithWallet:w,updateWallets:_,createAnalyticsEvent:A}=M(),{walletConnectors:O}=F(),[W,R]=on(0),{user:q}=F(),[K]=on(q?.linkedAccounts.length||0),[$,I]=on(""),[Z,U]=on(!1),{hasTabbedAway:ue}=df(),{enabled:re,token:ce}=Ce(),fe=tl&&g?.connector?.connectorType==="wallet_connect_v2"||tl&&g?.connector?.connectorType==="coinbase_wallet"||tl&&g?.connector?.connectorType==="injected"&&g?.connector?.walletClientType==="phantom",Q=g?.status==="connected",et=g?.status==="switching_to_supported_chain";Kc(()=>{let B=C();if(Q&&!B&&(re&&!ce&&!a?(y({captchaModalData:{callback:me=>E(g.connectedWallet,me).then(()=>{U(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):E(g.connectedWallet,ce).then(()=>{U(!0)})),B&&fe&&Q&&!B.preparedMessage){B.buildSiweMessage();return}!B||fe||!Q||r||(async()=>{o(!0),i(void 0);try{g?.connector?.connectorType==="wallet_connect_v2"&&g?.connector?.walletClientType==="metamask"&&await Cc(2500),await xt()}catch(me){console.warn("Auto-prompted signature failed",me)}finally{o(!1)}})()},[W,Q,Z]),Kc(()=>{if(q&&e){let B=s?.render.inDialog?Be:0,me=s?.render.inDialog?B-500:0;if(s?.legal.requireUsersAcceptTerms&&!q.hasAcceptedTerms){let Uo=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},me);return()=>clearTimeout(Uo)}if(ir(q,s?.embeddedWallets?.createOnLogin)){let Uo=setTimeout(()=>{y({createWallet:{onSuccess:()=>{},onFailure:vt=>{console.error(vt),A({eventName:"embedded_wallet_creation_failure_logout",payload:{error:vt,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},me);return()=>clearTimeout(Uo)}_();let tr=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Be);return()=>clearTimeout(tr)}},[q,e]);let tt=B=>{if(B?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(B?.privyErrorCode==="max_accounts_reached"){console.error(new Ir(B).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(Yc(B))};async function xt(){try{if(await w(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(B){tt(B)}finally{o(!1)}}Kc(()=>{g?.connectError&&tt(g?.connectError)},[g]),cf(()=>{let B=ze==="wallet_connect_v2"&&g?.connector instanceof Nr?g.connector.redirectUri:void 0;B&&I(B)},g?.connector instanceof Nr&&!$?500:null);let ze=g?.connector?.connectorType||"injected",Xt=g?.connector?.walletClientType||"unknown",_e=Gr[Xt]?.displayName||g?.connector?.walletBranding.name||"Browser Extension",He=Gr[Xt]?.logo||g?.connector?.walletBranding.icon||(B=>nt(_n,{...B})),er=_e==="Browser Extension"?_e.toLowerCase():_e,_t;e?_t=`Successfully connected with ${er}`:n?_t=n.message:et?_t="Switching networks":Q?_t=r&&fe?"Signing":"Sign to verify":_t=`Waiting for ${er}`;let Ue="Don\u2019t see your wallet? Check your other browser windows.";if(e){let B=q?.linkedAccounts.length||0;K===B?Ue="Wallet was already linked.":Ue="You\u2019re good to go!"}else W>=jc&&n?Ue="Unable to connect wallet":n?Ue=n.detail:et?Ue="Switch your wallet to the requested network.":Q&&fe?Ue="Sign the message in your wallet to verify it belongs to you.":Xt==="metamask"&&tl?Ue="Click continue to open and connect MetaMask.":Xt==="metamask"?Ue="For the best experience, connect only one wallet at a time.":ze==="wallet_connect"?Ue="Open your mobile wallet app to continue":ze==="coinbase_wallet"&&(Kp()||(xc(q)?Ue="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Ue="Open the Coinbase app on your phone to continue."));let N=O?.walletConnectors?.find(B=>B.walletClientType==="coinbase_wallet"),ne=Xt==="coinbase_wallet"&&(xc(q)||n===eo.ERROR_USER_EXISTS);return qi(mf,{children:[nt(T,{backFn:!m||h===m?void 0:u}),qi(O0,{children:[nt(Zc,{walletLogo:He,success:e,fail:!!n}),qi(Ze,{children:[nt("h3",{children:_t}),nt("p",{children:Ue}),!Q&&$&&!ue?qi("p",{children:["Still here?"," ",nt("a",{href:$,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),ne?nt(L,{onClick:()=>N&&N?.disconnect(),disabled:e,children:"Use a different wallet"}):n==eo.ERROR_USER_EXISTS&&h!==m?nt(L,{onClick:u,children:"Use a different wallet"}):Q&&!e&&fe?nt(L,{onClick:()=>{o(!0),xt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&W<jc?nt(L,{onClick:()=>{R(W+1),i(void 0),Q?(o(!0),xt()):g?.connectRetry()},disabled:!e&&(!n?.retryable||W>=jc),children:"Retry"}):!e&&!n?nt(L,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),nt(V,{})]})},O0=pf.div`
876
881
  display: flex;
877
882
  flex-direction: column;
878
883
  align-items: center;
879
884
  justify-content: center;
880
885
  gap: 24px;
881
886
  width: 100%;
882
- `,O0=df.div`
887
+ `,N0=pf.div`
883
888
  display: flex;
884
889
  flex-direction: column;
885
890
  justify-content: center;
@@ -902,14 +907,14 @@ Resources:
902
907
  left: -19px;
903
908
  top: -19px;
904
909
  }
905
- `,Zc=e=>{let t=e.walletLogo;return nt(uf,{children:nt(O0,{children:qi("div",{children:[nt(pt,{success:e.success,fail:e.fail}),typeof t=="string"?nt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):nt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as F0,jsx as no,jsxs as Jc}from"react/jsx-runtime";var rl=2,hf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=x(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=ff(void 0),[l,s]=ff(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";mf(()=>{if(c){let k=setTimeout(n,Be);return()=>clearTimeout(k)}},[c]);let m=k=>{a(Yc(k))};mf(()=>{o?.connectError&&m(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",y=o?.connector?.walletClientType||"unknown",C=Gr[y]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",g=Gr[y]?.logo||o?.connector?.walletBranding.icon||(k=>no(xn,{...k})),_=C==="Browser Extension"?C.toLowerCase():C,T;c?T=`Successfully connected with ${_}`:i?T=i.message:u?T="Switching networks":T=`Waiting for ${_}`;let w="Don\u2019t see your wallet? Check your other browser windows.";return c?w="You\u2019re good to go!":l>=rl&&i?w="Unable to connect wallet":i?w=i.detail:u?w="Switch your wallet to the requested network.":y==="metamask"&&N0?w="Click to continue to open and connect MetaMask.":y==="metamask"?w="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?w="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(w="Open the Coinbase app on your phone to continue."),Jc(F0,{children:[no(P,{backFn:r===t?void 0:e}),Jc(U0,{children:[no(Zc,{walletLogo:g,success:c,fail:!!i}),Jc(Ze,{children:[no("h3",{children:T}),no("p",{children:w})]}),i==eo.ERROR_USER_EXISTS?no(W,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<rl?no(W,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=rl),children:"Retry"}):!c&&i&&l>=rl?no(W,{onClick:e,children:"Use a different wallet"}):null]}),no(V,{})]})},U0=D0.div`
910
+ `,Zc=e=>{let t=e.walletLogo;return nt(mf,{children:nt(N0,{children:qi("div",{children:[nt(pt,{success:e.success,fail:e.fail}),typeof t=="string"?nt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):nt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as B0,jsx as no,jsxs as Jc}from"react/jsx-runtime";var rl=2,yf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=S(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[i,a]=hf(void 0),[l,s]=hf(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";ff(()=>{if(c){let _=setTimeout(n,Be);return()=>clearTimeout(_)}},[c]);let m=_=>{a(Yc(_))};ff(()=>{o?.connectError&&m(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",y=o?.connector?.walletClientType||"unknown",C=Gr[y]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",g=Gr[y]?.logo||o?.connector?.walletBranding.icon||(_=>no(_n,{..._})),x=C==="Browser Extension"?C.toLowerCase():C,E;c?E=`Successfully connected with ${x}`:i?E=i.message:u?E="Switching networks":E=`Waiting for ${x}`;let w="Don\u2019t see your wallet? Check your other browser windows.";return c?w="You\u2019re good to go!":l>=rl&&i?w="Unable to connect wallet":i?w=i.detail:u?w="Switch your wallet to the requested network.":y==="metamask"&&D0?w="Click to continue to open and connect MetaMask.":y==="metamask"?w="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?w="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(w="Open the Coinbase app on your phone to continue."),Jc(B0,{children:[no(T,{backFn:r===t?void 0:e}),Jc(F0,{children:[no(Zc,{walletLogo:g,success:c,fail:!!i}),Jc(Ze,{children:[no("h3",{children:E}),no("p",{children:w})]}),i==eo.ERROR_USER_EXISTS?no(L,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<rl?no(L,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=rl),children:"Retry"}):!c&&i&&l>=rl?no(L,{onClick:e,children:"Use a different wallet"}):null]}),no(V,{})]})},F0=U0.div`
906
911
  display: flex;
907
912
  flex-direction: column;
908
913
  align-items: center;
909
914
  justify-content: center;
910
915
  gap: 24px;
911
916
  width: 100%;
912
- `;import $0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as K0,useMemo as j0,useState as Y0}from"react";import Z0 from"styled-components";import ol from"styled-components";import{jsx as Qc,jsxs as z0}from"react/jsx-runtime";var zn=()=>Qc(B0,{children:z0(H0,{children:[Qc(G0,{}),Qc(V0,{})]})}),B0=ol.div`
917
+ `;import K0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as j0,useMemo as Y0,useState as Z0}from"react";import J0 from"styled-components";import ol from"styled-components";import{jsx as Qc,jsxs as q0}from"react/jsx-runtime";var zn=()=>Qc(H0,{children:q0(G0,{children:[Qc(V0,{}),Qc(z0,{})]})}),H0=ol.div`
913
918
  display: flex;
914
919
  justify-content: center;
915
920
  align-items: center;
@@ -921,14 +926,14 @@ Resources:
921
926
  @media all and (display-mode: standalone) {
922
927
  margin-bottom: 30px;
923
928
  }
924
- `,H0=ol.div`
929
+ `,G0=ol.div`
925
930
  position: relative;
926
931
  height: 140px;
927
932
  width: 140px;
928
933
 
929
934
  opacity: 1;
930
935
  animation: fadein 200ms ease;
931
- `,G0=ol.div`
936
+ `,V0=ol.div`
932
937
  position: absolute;
933
938
  top: 0;
934
939
  right: 0;
@@ -941,7 +946,7 @@ Resources:
941
946
  border: 4px solid var(--privy-color-accent-light);
942
947
  border-radius: 50%;
943
948
  }
944
- `,V0=ol.div`
949
+ `,z0=ol.div`
945
950
  position: absolute;
946
951
  top: 0;
947
952
  right: 0;
@@ -965,20 +970,20 @@ Resources:
965
970
  transform: rotate(360deg);
966
971
  }
967
972
  }
968
- `;var yf=["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 De=class extends Error{constructor(r,o){super(o);this.type=r}};function qn(e){let t=e.type;return typeof t=="string"&&yf.includes(t)}function q0(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function $n(e){return qn(e)&&e.type==="wallet_not_on_device"}function gf(e){return qn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function on(e){return!!(qn(e)&&e.type==="mfa_timeout")}function nn(e){return!!(qn(e)&&e.type==="missing_or_invalid_mfa")}function Xc(e){return!!(qn(e)&&e.type==="mfa_verification_max_attempts_reached")}function nl(e){return!!(qn(e)&&e.message.includes("code 429"))}function il(e){return!!(q0(e)&&e.message==="MFA canceled")}function vf(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 al(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function Cf({api:e,provider:t}){let r=xi(),o=Za(),n=await Ja(r);try{return{url:(await e.post(Lp,{redirect_to:window.location.href,code_challenge:n,state_code:o,provider:t})).url,codeVerifier:r,stateCode:o}}catch(i){throw de(i)}}async function wf({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new E("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new E("User denied confirmation during OAuth flow");try{return(await e.post(Op,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=de(i);throw a.privyErrorCode?new E(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new E("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new E("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as Ef,jsx as Kn,jsxs as ed}from"react/jsx-runtime";var bf=1,Pf=()=>{let{authenticated:e,user:t,getAccessToken:r}=F(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=x(),u=j0(()=>Date.now(),[]),[m,h]=Y0(!1),{onCompleteNavigateTo:y,onFailure:C,shouldForceMFA:g}=l?.connectWallet,_=w=>{m||(h(!0),C(typeof w=="string"?new Error(w):w))};K0(()=>{let w=Te(t),k;return!e||!w?_("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let L=await r();if(!L)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:L,address:w.address}),g&&await i.verifyMfa({accessToken:L});let S=(Date.now()-u)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&S<bf?k=setTimeout(()=>{a(y)},(bf-S)*1e3):a(y)}catch(S){if($n(S)&&w.recoveryMethod==="privy"){let N=await r();if(!N)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:w.address}}),(await i?.recover({address:w.address,accessToken:N}))?.address||_(new Error("Unable to recover wallet")),y?a(y):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:w.address}}),a(y)}catch{_("An error has occurred, please try again.")}}else if($n(S)){s({...l,recoverWallet:{privyWallet:w,onCompleteNavigateTo:y,onFailure:C},recoveryOAuthStatus:{provider:"google-drive",action:"recover",isInAccountCreateFlow:!1}});let N=al(w.recoveryMethod);a(N)}else _(S)}})(),()=>clearTimeout(k)):void 0},[e,t,i]);let T=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=T,ed(Ef,{children:[Kn(P,{onClose:T}),m?ed(Ef,{children:[ed(Cr,{children:[Kn($0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Kn(Ee,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Kn(W,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Kn(zn,{}),Kn(J0,{})]})},J0=Z0.div`
973
+ `;var gf=["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 De=class extends Error{constructor(r,o){super(o);this.type=r}};function qn(e){let t=e.type;return typeof t=="string"&&gf.includes(t)}function $0(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function $n(e){return qn(e)&&e.type==="wallet_not_on_device"}function vf(e){return qn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function nn(e){return!!(qn(e)&&e.type==="mfa_timeout")}function an(e){return!!(qn(e)&&e.type==="missing_or_invalid_mfa")}function Xc(e){return!!(qn(e)&&e.type==="mfa_verification_max_attempts_reached")}function nl(e){return!!(qn(e)&&e.message.includes("code 429"))}function il(e){return!!($0(e)&&e.message==="MFA canceled")}function Cf(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 al(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function wf({api:e,provider:t}){let r=xi(),o=Za(),n=await Ja(r);try{return{url:(await e.post(Lp,{redirect_to:window.location.href,code_challenge:n,state_code:o,provider:t})).url,codeVerifier:r,stateCode:o}}catch(i){throw de(i)}}async function bf({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(Op,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=de(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")}}import{Fragment as Pf,jsx as Kn,jsxs as ed}from"react/jsx-runtime";var Ef=1,Tf=()=>{let{authenticated:e,user:t,getAccessToken:r}=F(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=M(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=S(),u=Y0(()=>Date.now(),[]),[m,h]=Z0(!1),{onCompleteNavigateTo:y,onFailure:C,shouldForceMFA:g}=l?.connectWallet,x=w=>{m||(h(!0),C(typeof w=="string"?new Error(w):w))};j0(()=>{let w=Te(t),_;return!e||!w?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:w.address}),g&&await i.verifyMfa({accessToken:O});let W=(Date.now()-u)/1e3;y==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&W<Ef?_=setTimeout(()=>{a(y)},(Ef-W)*1e3):a(y)}catch(W){if($n(W)&&w.recoveryMethod==="privy"){let R=await r();if(!R)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:w.address}}),(await i?.recover({address:w.address,accessToken:R}))?.address||x(new Error("Unable to recover wallet")),y?a(y):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:w.address}}),a(y)}catch{x("An error has occurred, please try again.")}}else if($n(W)){s({...l,recoverWallet:{privyWallet:w,onCompleteNavigateTo:y,onFailure:C},recoveryOAuthStatus:{provider:"google-drive",action:"recover",isInAccountCreateFlow:!1}});let R=al(w.recoveryMethod);a(R)}else x(W)}})(),()=>clearTimeout(_)):void 0},[e,t,i]);let E=()=>{x("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=E,ed(Pf,{children:[Kn(T,{onClose:E}),m?ed(Pf,{children:[ed(wr,{children:[Kn(K0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Kn(Ee,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Kn(L,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Kn(zn,{}),Kn(Q0,{})]})},Q0=J0.div`
969
974
  height: 44px;
970
- `;import Q0 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as X0}from"react";import{Fragment as ev,jsx as jn,jsxs as Tf}from"react/jsx-runtime";var Sf=()=>{let{user:e}=F(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=x(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let m=Te(e);m?(o(),l(m)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return X0(()=>{let m=setTimeout(u,Jp);return()=>clearTimeout(m)},[]),a.current=u,Tf(ev,{children:[jn(P,{onClose:u}),jn(X,{}),Tf(Cr,{children:[jn(Q0,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),jn(Ee,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),jn(ae,{}),jn(G,{protectedByPrivy:!0})]})};import tv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import rv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as kf,useRef as ov,useState as td}from"react";import Eo from"styled-components";import{Fragment as uv,jsx as Ge,jsxs as Pr}from"react/jsx-runtime";var Af=()=>{let[e,t]=td(null),{authenticated:r,user:o,getAccessToken:n}=F(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=x(),u=Te(o)?.address,{onFailure:m,onSuccess:h,origin:y,appId:C}=s.keyExport,g=T=>{i({shouldCallAuthOnSuccess:!1}),m(typeof T=="string"?new Error(T):T)},_=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return kf(()=>{let T=Te(o);if(!r||!T)return g("User must be authenticated before exporting their wallet");n().then(t,g)},[r,o]),c.current=_,Pr(uv,{children:[Ge(P,{onClose:_}),Pr(av,{children:[Pr(Ee,{icon:Ge(rv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Pr(dv,{children:[Ge(iv,{style:{marginRight:6}}),go(u)]}),Ge("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Pr(sv,{children:[Pr(xf,{children:[Ge(_f,{children:"1"}),Pr("span",{children:[Ge("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."]})]}),Pr(xf,{children:[Ge(_f,{children:"2"}),Ge("span",{children:"Copy this key into your other wallet"})]})]}),Ge("div",{style:{width:"100%"},children:e&&Ge(nv,{origin:y,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Pr(pv,{children:[Pr("div",{children:[Ge(tv,{viewBox:"0 0 20 18"}),Ge("h4",{children:"Warning"})]}),Ge("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Ge(G,{protectedByPrivy:!0})]})};function nv(e){let[t,r]=td(e.dimensions.width),[o,n]=td(void 0),i=ov(null);return kf(()=>{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")})},[]),Ge("div",{ref:i,children:t&&Pr(lv,{children:[Ge("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:za(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Ge(cv,{children:"Loading..."})]})})}function iv(e){return Ge("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Ge("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 av=Eo.div`
975
+ `;import X0 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as ev}from"react";import{Fragment as tv,jsx as jn,jsxs as Sf}from"react/jsx-runtime";var xf=()=>{let{user:e}=F(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let m=Te(e);m?(o(),l(m)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return ev(()=>{let m=setTimeout(u,Jp);return()=>clearTimeout(m)},[]),a.current=u,Sf(tv,{children:[jn(T,{onClose:u}),jn(X,{}),Sf(wr,{children:[jn(X0,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),jn(Ee,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),jn(ae,{}),jn(G,{protectedByPrivy:!0})]})};import rv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import ov from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Af,useRef as nv,useState as td}from"react";import Eo from"styled-components";import{Fragment as mv,jsx as Ge,jsxs as Tr}from"react/jsx-runtime";var Rf=()=>{let[e,t]=td(null),{authenticated:r,user:o,getAccessToken:n}=F(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),u=Te(o)?.address,{onFailure:m,onSuccess:h,origin:y,appId:C}=s.keyExport,g=E=>{i({shouldCallAuthOnSuccess:!1}),m(typeof E=="string"?new Error(E):E)},x=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return Af(()=>{let E=Te(o);if(!r||!E)return g("User must be authenticated before exporting their wallet");n().then(t,g)},[r,o]),c.current=x,Tr(mv,{children:[Ge(T,{onClose:x}),Tr(sv,{children:[Tr(Ee,{icon:Ge(ov,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Tr(pv,{children:[Ge(av,{style:{marginRight:6}}),go(u)]}),Ge("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Tr(lv,{children:[Tr(_f,{children:[Ge(kf,{children:"1"}),Tr("span",{children:[Ge("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."]})]}),Tr(_f,{children:[Ge(kf,{children:"2"}),Ge("span",{children:"Copy this key into your other wallet"})]})]}),Ge("div",{style:{width:"100%"},children:e&&Ge(iv,{origin:y,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Tr(uv,{children:[Tr("div",{children:[Ge(rv,{viewBox:"0 0 20 18"}),Ge("h4",{children:"Warning"})]}),Ge("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Ge(G,{protectedByPrivy:!0})]})};function iv(e){let[t,r]=td(e.dimensions.width),[o,n]=td(void 0),i=nv(null);return Af(()=>{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")})},[]),Ge("div",{ref:i,children:t&&Tr(cv,{children:[Ge("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:za(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Ge(dv,{children:"Loading..."})]})})}function av(e){return Ge("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Ge("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 sv=Eo.div`
971
976
  display: flex;
972
977
  flex-direction: column;
973
978
  text-align: left;
974
- `,sv=Eo.div`
979
+ `,lv=Eo.div`
975
980
  display: flex;
976
981
  flex-direction: column;
977
982
  gap: 24px;
978
983
  padding-bottom: 16px;
979
984
  margin-left: 11px;
980
985
  border-left: 1px solid var(--privy-color-foreground-4) !important;
981
- `,xf=Eo.div`
986
+ `,_f=Eo.div`
982
987
  display: flex;
983
988
  align-items: top;
984
989
  gap: 8px;
@@ -987,7 +992,7 @@ Resources:
987
992
  color: var(--privy-color-accent);
988
993
  text-decoration: underline;
989
994
  }
990
- `,_f=Eo.div`
995
+ `,kf=Eo.div`
991
996
  display: flex;
992
997
  align-items: center;
993
998
  justify-content: center;
@@ -1001,11 +1006,11 @@ Resources:
1001
1006
  border-radius: 100%;
1002
1007
  background: var(--privy-color-background);
1003
1008
  color: var(--privy-color-accent);
1004
- `,lv=Eo.div`
1009
+ `,cv=Eo.div`
1005
1010
  overflow: visible;
1006
1011
  position: relative;
1007
1012
  height: 44px;
1008
- `,cv=Eo.div`
1013
+ `,dv=Eo.div`
1009
1014
  position: absolute;
1010
1015
  display: flex;
1011
1016
  align-items: center;
@@ -1017,7 +1022,7 @@ Resources:
1017
1022
  border-radius: var(--privy-border-radius-md);
1018
1023
  background-color: var(--privy-color-background-2);
1019
1024
  color: var(--privy-color-foreground-3);
1020
- `,dv=Eo.div`
1025
+ `,pv=Eo.div`
1021
1026
  display: flex;
1022
1027
  align-items: center;
1023
1028
  padding-top: 1px;
@@ -1030,7 +1035,7 @@ Resources:
1030
1035
  font-size: 12px;
1031
1036
  font-weight: 500;
1032
1037
  margin: auto;
1033
- `,pv=Eo.div`
1038
+ `,uv=Eo.div`
1034
1039
  border: 1px solid var(--privy-color-background-2) !important;
1035
1040
  border-radius: var(--privy-border-radius-md);
1036
1041
  padding: 16px;
@@ -1052,9 +1057,9 @@ Resources:
1052
1057
  color: var(--privy-color-error);
1053
1058
  }
1054
1059
  }
1055
- `;import hv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as yv,useState as Rf}from"react";import gv from"styled-components";import{useCallback as mv,useRef as fv}from"react";function sl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=fv(!1);return{createWallet:mv(async i=>{let a=await Se();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(Cn);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((y,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 m=await e();if(!m)throw new Error("Failed to refresh user.");let h=Te(m);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as Cv,jsx as Yn,jsxs as If}from"react/jsx-runtime";var Mf=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),[i,a]=Rf(""),{embeddedWallets:l}=Or(),{authenticated:s}=F(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:m,callAuthOnSuccessOnClose:h}=o.createWallet,y=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:C}=sl(),[g,_]=Rf(null),T=new Le(async()=>{try{let k=await C();if(!k)return;_(k),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(k){a(k.message)}});yv(()=>{if(!s){r("LANDING"),m(new Error("User must be authenticated before creating a Privy wallet"));return}if(y){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let k=vf("create",l.userOwnedRecoveryOptions);return r(k)}T.execute()},[y,s]);let w=()=>{g?(u(g),c({shouldCallAuthOnSuccess:h})):(m(new wt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?If(Cv,{children:[Yn(P,{closeable:!1}),If(Cr,{children:[Yn(hv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Yn(Ee,{title:"Something went wrong",description:i})]}),Yn(W,{onClick:w,children:"Close"}),Yn(vv,{})]}):Yn(zn,{})},vv=gv.div`
1060
+ `;import yv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as gv,useState as If}from"react";import vv from"styled-components";import{useCallback as fv,useRef as hv}from"react";function sl(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=M(),o=hv(!1);return{createWallet:fv(async i=>{let a=await Se();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(wn);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((y,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 m=await e();if(!m)throw new Error("Failed to refresh user.");let h=Te(m);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as wv,jsx as Yn,jsxs as Mf}from"react/jsx-runtime";var Wf=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=S(),[i,a]=If(""),{embeddedWallets:l}=sr(),{authenticated:s}=F(),{closePrivyModal:c}=M(),{onSuccess:u,onFailure:m,callAuthOnSuccessOnClose:h}=o.createWallet,y=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:C}=sl(),[g,x]=If(null),E=new Le(async()=>{try{let _=await C();if(!_)return;x(_),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(_){a(_.message)}});gv(()=>{if(!s){r("LANDING"),m(new Error("User must be authenticated before creating a Privy wallet"));return}if(y){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let _=Cf("create",l.userOwnedRecoveryOptions);return r(_)}E.execute()},[y,s]);let w=()=>{g?(u(g),c({shouldCallAuthOnSuccess:h})):(m(new wt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?Mf(wv,{children:[Yn(T,{closeable:!1}),Mf(wr,{children:[Yn(yv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Yn(Ee,{title:"Something went wrong",description:i})]}),Yn(L,{onClick:w,children:"Close"}),Yn(Cv,{})]}):Yn(zn,{})},Cv=vv.div`
1056
1061
  height: 44px;
1057
- `;import{useEffect as uC,useState as ul}from"react";import{useCallback as ld,useEffect as pC}from"react";import Tv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as Sv,useState as nd}from"react";import wv from"@heroicons/react/24/outline/ArrowPathIcon";import bv from"@heroicons/react/24/outline/EyeIcon";import Ev from"@heroicons/react/24/outline/EyeSlashIcon";import ht,{css as rd}from"styled-components";var Pv=rd`
1062
+ `;import{useEffect as mC,useState as ul}from"react";import{useCallback as ld,useEffect as uC}from"react";import Sv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as xv,useState as nd}from"react";import bv from"@heroicons/react/24/outline/ArrowPathIcon";import Ev from"@heroicons/react/24/outline/EyeIcon";import Pv from"@heroicons/react/24/outline/EyeSlashIcon";import ht,{css as rd}from"styled-components";var Tv=rd`
1058
1063
  font-size: 14px;
1059
1064
  font-style: normal;
1060
1065
  font-weight: 400;
@@ -1063,7 +1068,7 @@ Resources:
1063
1068
  text-align: left;
1064
1069
  transition: color 0.1s ease-in;
1065
1070
  `,ll=ht.span`
1066
- ${Pv}
1071
+ ${Tv}
1067
1072
  transition: color 0.1s ease-in;
1068
1073
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1069
1074
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1076,13 +1081,13 @@ Resources:
1076
1081
  flex-direction: column;
1077
1082
  justify-content: center;
1078
1083
  flex-grow: 1;
1079
- `,To=ht(W)`
1084
+ `,To=ht(L)`
1080
1085
  ${e=>e.hideAnimations&&rd`
1081
1086
  && {
1082
1087
  transition: none;
1083
1088
  }
1084
1089
  `}
1085
- `,Wf=rd`
1090
+ `,Lf=rd`
1086
1091
  && {
1087
1092
  width: 100%;
1088
1093
  border-width: 1px;
@@ -1098,7 +1103,7 @@ Resources:
1098
1103
  line-height: 22px; /* 137.5% */
1099
1104
  }
1100
1105
  `,Zn=ht.input`
1101
- ${Wf}
1106
+ ${Lf}
1102
1107
 
1103
1108
  &::placeholder {
1104
1109
  color: var(--privy-color-foreground-3);
@@ -1109,8 +1114,8 @@ Resources:
1109
1114
  overflow: hidden;
1110
1115
  text-overflow: ellipsis;
1111
1116
  white-space: nowrap;
1112
- `,Lf=ht.div`
1113
- ${Wf}
1117
+ `,Of=ht.div`
1118
+ ${Lf}
1114
1119
  `,So=ht.div`
1115
1120
  position: relative;
1116
1121
  width: 100%;
@@ -1164,7 +1169,7 @@ Resources:
1164
1169
  > :first-child {
1165
1170
  min-width: 24px;
1166
1171
  }
1167
- `,_M=ht.div`
1172
+ `,kM=ht.div`
1168
1173
  height: var(--privy-height-modal-full);
1169
1174
 
1170
1175
  @media (max-width: 440px) {
@@ -1190,7 +1195,7 @@ Resources:
1190
1195
  flex-direction: row;
1191
1196
  justify-content: space-around;
1192
1197
  align-items: center;
1193
- `,Of=ht(wv)`
1198
+ `,Nf=ht(bv)`
1194
1199
  height: 1.25rem;
1195
1200
  width: 1.25rem;
1196
1201
  stroke: var(--privy-color-accent);
@@ -1199,7 +1204,7 @@ Resources:
1199
1204
  :active {
1200
1205
  stroke: var(--privy-color-accent-light);
1201
1206
  }
1202
- `,Qn=ht(Ev)`
1207
+ `,Qn=ht(Pv)`
1203
1208
  height: 1.25rem;
1204
1209
  width: 1.25rem;
1205
1210
  stroke: var(--privy-color-accent);
@@ -1208,7 +1213,7 @@ Resources:
1208
1213
  :active {
1209
1214
  stroke: var(--privy-color-accent-light);
1210
1215
  }
1211
- `,Xn=ht(bv)`
1216
+ `,Xn=ht(Ev)`
1212
1217
  height: 1.25rem;
1213
1218
  width: 1.25rem;
1214
1219
  stroke: var(--privy-color-accent);
@@ -1217,7 +1222,7 @@ Resources:
1217
1222
  :active {
1218
1223
  stroke: var(--privy-color-accent-light);
1219
1224
  }
1220
- `,Nf=ht.progress`
1225
+ `,Df=ht.progress`
1221
1226
  height: 4px;
1222
1227
  width: 100%;
1223
1228
  margin: 8px 0;
@@ -1233,7 +1238,7 @@ Resources:
1233
1238
  transition: all 0.1s ease-out;
1234
1239
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1235
1240
  }
1236
- `;import{Fragment as xv,jsx as zt,jsxs as cl}from"react/jsx-runtime";var Df=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=nd(!0),[l,s]=nd(!1),[c,u]=nd(""),m=r===c;return Sv(()=>{c&&!l&&s(!0)},[c]),cl(xv,{children:[zt(P,{title:"Confirm Password",closeable:!1,backFn:n}),zt(X,{}),cl(Po,{children:[cl(xo,{children:[zt(Tv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),zt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),zt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),cl(So,{children:[zt(Zn,{value:c,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),zt(Jn,{style:{right:"0.75rem"},children:i?zt(Qn,{onClick:()=>a(!1)}):zt(Xn,{onClick:()=>a(!0)})})]}),zt(ll,{"aria-hidden":!l||m,error:!0,children:"Passwords do not match"})]}),zt(To,{onClick:o,loading:t,disabled:!m,hideAnimations:e,children:"Continue"}),zt(ae,{}),zt(G,{protectedByPrivy:!0})]})};import Rv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Iv}from"react";import Mv from"styled-components";import Yi from"styled-components";import{jsx as ji,jsxs as Av}from"react/jsx-runtime";var Uf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ji("label",{children:Av(_v,{className:e,children:[ji(Bf,{checked:t,...o}),ji(kv,{color:r,checked:t,children:ji(Ff,{viewBox:"0 0 24 24",children:ji("polyline",{points:"20 6 9 17 4 12"})})})]})});var FM=Yi.label`
1241
+ `;import{Fragment as _v,jsx as zt,jsxs as cl}from"react/jsx-runtime";var Uf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=nd(!0),[l,s]=nd(!1),[c,u]=nd(""),m=r===c;return xv(()=>{c&&!l&&s(!0)},[c]),cl(_v,{children:[zt(T,{title:"Confirm Password",closeable:!1,backFn:n}),zt(X,{}),cl(Po,{children:[cl(xo,{children:[zt(Sv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),zt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),zt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),cl(So,{children:[zt(Zn,{value:c,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),zt(Jn,{style:{right:"0.75rem"},children:i?zt(Qn,{onClick:()=>a(!1)}):zt(Xn,{onClick:()=>a(!0)})})]}),zt(ll,{"aria-hidden":!l||m,error:!0,children:"Passwords do not match"})]}),zt(To,{onClick:o,loading:t,disabled:!m,hideAnimations:e,children:"Continue"}),zt(ae,{}),zt(G,{protectedByPrivy:!0})]})};import Iv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Mv}from"react";import Wv from"styled-components";import Yi from"styled-components";import{jsx as ji,jsxs as Rv}from"react/jsx-runtime";var Ff=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ji("label",{children:Rv(kv,{className:e,children:[ji(Hf,{checked:t,...o}),ji(Av,{color:r,checked:t,children:ji(Bf,{viewBox:"0 0 24 24",children:ji("polyline",{points:"20 6 9 17 4 12"})})})]})});var BM=Yi.label`
1237
1242
  && {
1238
1243
  cursor: pointer;
1239
1244
  display: flex;
@@ -1245,14 +1250,14 @@ Resources:
1245
1250
  border: 1px solid var(--privy-color-foreground-4);
1246
1251
  width: 100%;
1247
1252
  }
1248
- `,_v=Yi.div`
1253
+ `,kv=Yi.div`
1249
1254
  display: inline-block;
1250
1255
  vertical-align: middle;
1251
- `,Ff=Yi.svg`
1256
+ `,Bf=Yi.svg`
1252
1257
  fill: none;
1253
1258
  stroke: white;
1254
1259
  stroke-width: 3px;
1255
- `,Bf=Yi.input.attrs({type:"checkbox"})`
1260
+ `,Hf=Yi.input.attrs({type:"checkbox"})`
1256
1261
  border: 0;
1257
1262
  clip: rect(0 0 0 0);
1258
1263
  clippath: inset(50%);
@@ -1263,7 +1268,7 @@ Resources:
1263
1268
  position: absolute;
1264
1269
  white-space: nowrap;
1265
1270
  width: 1px;
1266
- `,kv=Yi.div`
1271
+ `,Av=Yi.div`
1267
1272
  display: inline-block;
1268
1273
  width: 18px;
1269
1274
  height: 18px;
@@ -1278,28 +1283,28 @@ Resources:
1278
1283
  border-width: 1px;
1279
1284
  }
1280
1285
 
1281
- ${Bf}:focus + & {
1286
+ ${Hf}:focus + & {
1282
1287
  box-shadow: 0 0 0 1px ${e=>e.color};
1283
1288
  }
1284
1289
 
1285
- ${Ff} {
1290
+ ${Bf} {
1286
1291
  visibility: ${e=>e.checked?"visible":"hidden"};
1287
1292
  }
1288
- `;import{Fragment as Hf,jsx as pr,jsxs as Zi}from"react/jsx-runtime";var Gf=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=Iv(!1);return Zi(Hf,{children:[pr(P,{title:"Confirm Password",closeable:!1,backFn:o}),pr(X,{}),Zi(Po,{children:[Zi(xo,{children:[pr(Rv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),pr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),pr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),pr($i,{children:Zi(Ki,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[pr(Uf,{color:"var(--privy-color-error)",checked:i}),pr(Hf,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Zi(Wv,{children:[n.initiatedBy==="user"&&pr(vr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),pr(To,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),pr(ae,{}),pr(G,{protectedByPrivy:!0})]})},Wv=Mv.div`
1293
+ `;import{Fragment as Gf,jsx as pr,jsxs as Zi}from"react/jsx-runtime";var Vf=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=Mv(!1);return Zi(Gf,{children:[pr(T,{title:"Confirm Password",closeable:!1,backFn:o}),pr(X,{}),Zi(Po,{children:[Zi(xo,{children:[pr(Iv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),pr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),pr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),pr($i,{children:Zi(Ki,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[pr(Ff,{color:"var(--privy-color-error)",checked:i}),pr(Gf,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Zi(Lv,{children:[n.initiatedBy==="user"&&pr(vr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),pr(To,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),pr(ae,{}),pr(G,{protectedByPrivy:!0})]})},Lv=Wv.div`
1289
1294
  display: flex;
1290
1295
  gap: 10px;
1291
- `;import Yv from"@heroicons/react/24/outline/KeyIcon";import Yf from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Zf,useMemo as id,useEffect as Zv}from"react";import Jf from"styled-components";import Lv from"fast-password-entropy";import*as Vf from"secure-password-utilities";import{DEFAULT_WORDLIST as Ov}from"secure-password-utilities/wordlists";var Nv=95,Dv=8,Uv=3,Fv=.3,Bv=/[a-z]/,Hv=/[A-Z]/,Gv=/[0-9]/,Vv="a-zA-Z0-9",zf="!@#$%^&*()\\-_+.",qf=`${Vv}${zf}`,zv=new RegExp(`[${zf}]`),qv=new RegExp(`[${qf}]`),$f=new RegExp(`^[${qf}]{6,}$`),Kf=(e="")=>{let t=e.split("").filter(r=>!qv.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},dl=()=>Vf.generatePassphrase(4,Ov);function $v(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Kv(e){if(e.length<Dv)return 0;let t=0;Bv.test(e)&&(t+=1),Hv.test(e)&&(t+=1),Gv.test(e)&&(t+=1),zv.test(e)&&(t+=1);let r=t/Uv;return Math.max(0,Math.min(1,r))}function jv(e=""){let t=Kv(e),r=Lv(e)/Nv;return(t*Fv+r)/2}function jf(e=""){let t=jv(e);return{value:t,label:$v(t)}}import{Fragment as Xv,jsx as it,jsxs as io}from"react/jsx-runtime";var Qf=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=Zf(!1),[m,h]=Zf(!1);Zv(()=>{r&&!m&&h(!0)},[r]);let y=id(()=>m?(r?.length||0)<6?"Password must be at least 6 characters":$f.test(r||"")?null:`Invalid characters used ( ${Kf(r).join(" ")} )`:null,[r,m]),C=id(()=>y?{value:0,label:"Weak"}:jf(r),[r,y]),g=id(()=>!!(!r?.length||y),[y,r]);return io(Xv,{children:[it(P,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),it(X,{}),io(Po,{children:[io(xo,{children:[it(Yv,{height:48,width:48,stroke:"var(--privy-color-accent)"}),it("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),it("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),io(So,{children:[it(Zn,{value:r,onChange:_=>l(_.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),io(Jn,{style:{width:"3.5rem"},children:[c?it(Qn,{onClick:()=>u(!1)}):it(Xn,{onClick:()=>u(!0)}),it(Of,{onClick:s})]})]}),it(Nf,{value:C.value===0?.01:C.value,label:C.label}),it(ll,{error:!!y,children:y||`Password Strength: ${m?C.label:"--"}`}),io(Qv,{children:[it(Jv,{children:io($i,{children:[io(Ki,{children:[it(Yf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),io(Ki,{children:[it(Yf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),it(To,{onClick:n,loading:t,disabled:g,hideAnimations:e,children:"Continue"})]})]}),it(ae,{}),it(G,{protectedByPrivy:!0})]})},Jv=Jf($i)`
1296
+ `;import Zv from"@heroicons/react/24/outline/KeyIcon";import Zf from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Jf,useMemo as id,useEffect as Jv}from"react";import Qf from"styled-components";import Ov from"fast-password-entropy";import*as zf from"secure-password-utilities";import{DEFAULT_WORDLIST as Nv}from"secure-password-utilities/wordlists";var Dv=95,Uv=8,Fv=3,Bv=.3,Hv=/[a-z]/,Gv=/[A-Z]/,Vv=/[0-9]/,zv="a-zA-Z0-9",qf="!@#$%^&*()\\-_+.",$f=`${zv}${qf}`,qv=new RegExp(`[${qf}]`),$v=new RegExp(`[${$f}]`),Kf=new RegExp(`^[${$f}]{6,}$`),jf=(e="")=>{let t=e.split("").filter(r=>!$v.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},dl=()=>zf.generatePassphrase(4,Nv);function Kv(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function jv(e){if(e.length<Uv)return 0;let t=0;Hv.test(e)&&(t+=1),Gv.test(e)&&(t+=1),Vv.test(e)&&(t+=1),qv.test(e)&&(t+=1);let r=t/Fv;return Math.max(0,Math.min(1,r))}function Yv(e=""){let t=jv(e),r=Ov(e)/Dv;return(t*Bv+r)/2}function Yf(e=""){let t=Yv(e);return{value:t,label:Kv(t)}}import{Fragment as eC,jsx as it,jsxs as io}from"react/jsx-runtime";var Xf=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=Jf(!1),[m,h]=Jf(!1);Jv(()=>{r&&!m&&h(!0)},[r]);let y=id(()=>m?(r?.length||0)<6?"Password must be at least 6 characters":Kf.test(r||"")?null:`Invalid characters used ( ${jf(r).join(" ")} )`:null,[r,m]),C=id(()=>y?{value:0,label:"Weak"}:Yf(r),[r,y]),g=id(()=>!!(!r?.length||y),[y,r]);return io(eC,{children:[it(T,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),it(X,{}),io(Po,{children:[io(xo,{children:[it(Zv,{height:48,width:48,stroke:"var(--privy-color-accent)"}),it("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),it("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),io(So,{children:[it(Zn,{value:r,onChange:x=>l(x.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),io(Jn,{style:{width:"3.5rem"},children:[c?it(Qn,{onClick:()=>u(!1)}):it(Xn,{onClick:()=>u(!0)}),it(Nf,{onClick:s})]})]}),it(Df,{value:C.value===0?.01:C.value,label:C.label}),it(ll,{error:!!y,children:y||`Password Strength: ${m?C.label:"--"}`}),io(Xv,{children:[it(Qv,{children:io($i,{children:[io(Ki,{children:[it(Zf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),io(Ki,{children:[it(Zf,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),it(To,{onClick:n,loading:t,disabled:g,hideAnimations:e,children:"Continue"})]})]}),it(ae,{}),it(G,{protectedByPrivy:!0})]})},Qv=Qf($i)`
1292
1297
  flex: 1;
1293
1298
  padding-top: 1rem;
1294
- `,Qv=Jf.div`
1299
+ `,Xv=Qf.div`
1295
1300
  display: flex;
1296
1301
  flex-direction: column;
1297
1302
  height: 100%;
1298
- `;import eC from"@heroicons/react/24/outline/ArrowDownTrayIcon";import tC from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import rC from"@heroicons/react/24/outline/DocumentDuplicateIcon";import oC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as nC,useCallback as Xf}from"react";import{Fragment as ad,jsx as Mt,jsxs as an}from"react/jsx-runtime";var eh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=nC(!1),s=Xf(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Xf(()=>{let u=document.createElement("a"),m=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([iC(r,o)],{type:"text/plain"}),y=URL.createObjectURL(h);u.href=y,u.target="_blank",u.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(y)},5e3)},[o]);return an(ad,{children:[Mt(P,{backFn:i,title:"Save Password",closeable:!1}),Mt(X,{}),an(Po,{children:[an(xo,{children:[Mt(oC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Mt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Mt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Mt(So,{centered:!0,children:Mt(Lf,{children:o})}),an("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Mt(od,{onClick:s,children:a?an(ad,{children:[Mt(tC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):an(ad,{children:[Mt(rC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),an(od,{onClick:c,children:[Mt(eC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Mt(To,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Mt(ae,{}),Mt(G,{protectedByPrivy:!0})]})},iC=(e,t)=>`Your wallet recovery password for ${e} is
1303
+ `;import tC from"@heroicons/react/24/outline/ArrowDownTrayIcon";import rC from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import oC from"@heroicons/react/24/outline/DocumentDuplicateIcon";import nC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as iC,useCallback as eh}from"react";import{Fragment as ad,jsx as Mt,jsxs as sn}from"react/jsx-runtime";var th=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=iC(!1),s=eh(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=eh(()=>{let u=document.createElement("a"),m=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([aC(r,o)],{type:"text/plain"}),y=URL.createObjectURL(h);u.href=y,u.target="_blank",u.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(y)},5e3)},[o]);return sn(ad,{children:[Mt(T,{backFn:i,title:"Save Password",closeable:!1}),Mt(X,{}),sn(Po,{children:[sn(xo,{children:[Mt(nC,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Mt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Mt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Mt(So,{centered:!0,children:Mt(Of,{children:o})}),sn("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Mt(od,{onClick:s,children:a?sn(ad,{children:[Mt(rC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):sn(ad,{children:[Mt(oC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),sn(od,{onClick:c,children:[Mt(tC,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Mt(To,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Mt(ae,{}),Mt(G,{protectedByPrivy:!0})]})},aC=(e,t)=>`Your wallet recovery password for ${e} is
1299
1304
 
1300
1305
  ${t}
1301
1306
 
1302
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import aC from"@heroicons/react/24/solid/CheckCircleIcon";import sC from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as lC,jsx as ao,jsxs as sd}from"react/jsx-runtime";var th=({error:e,onClose:t})=>sd(lC,{children:[ao(P,{closeable:!1}),ao(X,{}),e?sd(Cr,{children:[ao(sC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ao(Ee,{title:"Something went wrong",description:e})]}):sd(Cr,{children:[ao(aC,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ao(Ee,{title:"Success"})]}),ao(W,{onClick:t,children:"Close"}),ao(ae,{}),ao(G,{protectedByPrivy:!0})]});import{useReducer as cC}from"react";var dC=(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}},rh=()=>{let[e,t]=cC(dC,"creating");return{send:t,state:e}};import{jsx as Ji}from"react/jsx-runtime";var pl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=x(),{send:n,state:i}=rh(),a=ld(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);pC(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Be)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=ld(()=>{n("back")},[n]),s=ld(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ji(Qf,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ji(eh,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ji(Df,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ji(Gf,{...t,onSubmit:a,onBack:l}):i==="done"?Ji(th,{...t,onSubmit:a}):null};import{jsx as mC}from"react/jsx-runtime";var oh=()=>{let[e,t]=ul(null),[r,o]=ul(!1),[n,i]=ul(null),[a,l]=ul(""),{authenticated:s,getAccessToken:c,user:u}=F(),{walletProxy:m,refreshUser:h,closePrivyModal:y,createAnalyticsEvent:C}=M(),{app:g,navigate:_,data:T,onUserCloseViaDialogOrKeybindRef:w}=x(),{onSuccess:k,onFailure:R}=T.createWallet,L=Te(u),S=e?.recoveryMethod==="user-passcode";uC(()=>{s||(_("LANDING"),R(new Ia("User must be authenticated before setting a password on a Privy wallet")))},[s]);let N=()=>{if(n){R(n),y({shouldCallAuthOnSuccess:!1});return}if(!S){R(new wt("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}k(e),y({shouldCallAuthOnSuccess:!1})};w.current=N;let $=async()=>{let q=await c();if(q&&L?.address&&a&&m)try{if(C({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:L.address}}),!(await m.setRecoveryPassword({accessToken:q,address:L.address,recoveryPassword:a})).address){i(new wt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:L.address,reason:"error setting password"}});return}let Z=await h(),U=Te(Z);if(!U){i(new wt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:L.address,reason:"wallet disconnected"}});return}t(U),C({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:L.address}})}catch(I){console.warn(I),i(I instanceof Error?I:new Error("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:L.address,reason:I}})}},K=async()=>{S?(k(e),y({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await $(),o(!1))};return mC(pl,{appName:g?.name||"privy",config:{initiatedBy:"user",onCancel:N},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(dl()),onPasswordChange:l,onSubmit:K,onClose:N})};import fC from"@heroicons/react/24/outline/UserCircleIcon";import hC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as yC,jsx as so,jsxs as ml}from"react/jsx-runtime";var nh=()=>{let{user:e}=F(),{closePrivyModal:t,createAnalyticsEvent:r}=M(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=x(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new wt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,ml(yC,{children:[so(P,{onClose:c}),so(X,{}),ml(Cr,{children:[ml(Nm,{children:[so(fC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),so(Dm,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:so(hC,{width:"12px",height:"12px",fill:"white"})})]}),ml(Ee,{title:"Secure Your Account",children:["Please set a password to secure your account.",so("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),so(W,{onClick:()=>{let m=Te(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:m?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),so(ae,{}),so(G,{protectedByPrivy:!0})]})};import gC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import vC from"@heroicons/react/24/outline/PhoneIcon";import ih from"styled-components";import{Fragment as EC,jsx as ur,jsxs as fl}from"react/jsx-runtime";var CC=e=>{let t=ur(gC,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof E)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof De&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:ur(vC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Fe)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:ur(Qs,{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:ur("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:ur("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof hr&&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}}},ah=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=x();return ur(Qi,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},Qi=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Ce(),n=CC(e),i=()=>{e instanceof Fe&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return fl(EC,{children:[ur(P,{backFn:t}),fl(wC,{children:[ur(mt,{children:fl("div",{children:[ur(Js,{color:"var(--privy-color-error)"}),n.icon]})}),fl(bC,{children:[ur("h3",{children:n.title}),ur("p",{children:n.detail})]}),ur(W,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},wC=ih.div`
1307
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import sC from"@heroicons/react/24/solid/CheckCircleIcon";import lC from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as cC,jsx as ao,jsxs as sd}from"react/jsx-runtime";var rh=({error:e,onClose:t})=>sd(cC,{children:[ao(T,{closeable:!1}),ao(X,{}),e?sd(wr,{children:[ao(lC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ao(Ee,{title:"Something went wrong",description:e})]}):sd(wr,{children:[ao(sC,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),ao(Ee,{title:"Success"})]}),ao(L,{onClick:t,children:"Close"}),ao(ae,{}),ao(G,{protectedByPrivy:!0})]});import{useReducer as dC}from"react";var pC=(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}},oh=()=>{let[e,t]=dC(pC,"creating");return{send:t,state:e}};import{jsx as Ji}from"react/jsx-runtime";var pl=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=S(),{send:n,state:i}=oh(),a=ld(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);uC(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Be)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=ld(()=>{n("back")},[n]),s=ld(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ji(Xf,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ji(th,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ji(Uf,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ji(Vf,{...t,onSubmit:a,onBack:l}):i==="done"?Ji(rh,{...t,onSubmit:a}):null};import{jsx as fC}from"react/jsx-runtime";var nh=()=>{let[e,t]=ul(null),[r,o]=ul(!1),[n,i]=ul(null),[a,l]=ul(""),{authenticated:s,getAccessToken:c,user:u}=F(),{walletProxy:m,refreshUser:h,closePrivyModal:y,createAnalyticsEvent:C}=M(),{app:g,navigate:x,data:E,onUserCloseViaDialogOrKeybindRef:w}=S(),{onSuccess:_,onFailure:A}=E.createWallet,O=Te(u),W=e?.recoveryMethod==="user-passcode";mC(()=>{s||(x("LANDING"),A(new Ia("User must be authenticated before setting a password on a Privy wallet")))},[s]);let R=()=>{if(n){A(n),y({shouldCallAuthOnSuccess:!1});return}if(!W){A(new wt("Exited before password was added to wallet")),y({shouldCallAuthOnSuccess:!1});return}_(e),y({shouldCallAuthOnSuccess:!1})};w.current=R;let q=async()=>{let $=await c();if($&&O?.address&&a&&m)try{if(C({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:O.address}}),!(await m.setRecoveryPassword({accessToken:$,address:O.address,recoveryPassword:a})).address){i(new wt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"error setting password"}});return}let Z=await h(),U=Te(Z);if(!U){i(new wt("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:"wallet disconnected"}});return}t(U),C({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:O.address}})}catch(I){console.warn(I),i(I instanceof Error?I:new Error("Error setting password on privy wallet")),C({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:O.address,reason:I}})}},K=async()=>{W?(_(e),y({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await q(),o(!1))};return fC(pl,{appName:g?.name||"privy",config:{initiatedBy:"user",onCancel:R},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(dl()),onPasswordChange:l,onSubmit:K,onClose:R})};import hC from"@heroicons/react/24/outline/UserCircleIcon";import yC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as gC,jsx as so,jsxs as ml}from"react/jsx-runtime";var ih=()=>{let{user:e}=F(),{closePrivyModal:t,createAnalyticsEvent:r}=M(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new wt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,ml(gC,{children:[so(T,{onClose:c}),so(X,{}),ml(wr,{children:[ml(Dm,{children:[so(hC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),so(Um,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:so(yC,{width:"12px",height:"12px",fill:"white"})})]}),ml(Ee,{title:"Secure Your Account",children:["Please set a password to secure your account.",so("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),so(L,{onClick:()=>{let m=Te(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:m?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),so(ae,{}),so(G,{protectedByPrivy:!0})]})};import vC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import CC from"@heroicons/react/24/outline/PhoneIcon";import ah from"styled-components";import{Fragment as PC,jsx as ur,jsxs as fl}from"react/jsx-runtime";var wC=e=>{let t=ur(vC,{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 De&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:ur(CC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Fe)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:ur(Qs,{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:ur("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:ur("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof hr&&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}}},sh=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=S();return ur(Qi,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},Qi=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Ce(),n=wC(e),i=()=>{e instanceof Fe&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return fl(PC,{children:[ur(T,{backFn:t}),fl(bC,{children:[ur(mt,{children:fl("div",{children:[ur(Js,{color:"var(--privy-color-error)"}),n.icon]})}),fl(EC,{children:[ur("h3",{children:n.title}),ur("p",{children:n.detail})]}),ur(L,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},bC=ah.div`
1303
1308
  display: flex;
1304
1309
  flex-direction: column;
1305
1310
  align-items: center;
@@ -1307,11 +1312,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1307
1312
  gap: 24px;
1308
1313
  width: 100%;
1309
1314
  padding-bottom: 16px;
1310
- `,bC=ih.div`
1315
+ `,EC=ah.div`
1311
1316
  display: flex;
1312
1317
  flex-direction: column;
1313
1318
  gap: 8px;
1314
- `;import{useEffect as fh,useRef as GC,useState as pd}from"react";import{isIOS as VC,isMobile as hh}from"react-device-detect";import vh from"styled-components";import{useState as PC}from"react";import TC from"styled-components";import{jsx as sh}from"react/jsx-runtime";var hl=({style:e,color:t,...r})=>sh("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:sh("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as cd}from"react/jsx-runtime";var lh=({color:e,...t})=>cd("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:cd("g",{children:cd("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as ch,jsxs as xC}from"react/jsx-runtime";var _o=e=>{let[t,r]=PC(!1);return xC(SC,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?ch(hl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):ch(lh,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},SC=TC.button`
1319
+ `;import{useEffect as hh,useRef as VC,useState as pd}from"react";import{isIOS as zC,isMobile as yh}from"react-device-detect";import Ch from"styled-components";import{useState as TC}from"react";import SC from"styled-components";import{jsx as lh}from"react/jsx-runtime";var hl=({style:e,color:t,...r})=>lh("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:lh("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as cd}from"react/jsx-runtime";var ch=({color:e,...t})=>cd("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:cd("g",{children:cd("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as dh,jsxs as _C}from"react/jsx-runtime";var _o=e=>{let[t,r]=TC(!1);return _C(xC,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?dh(hl,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):dh(ch,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},xC=SC.button`
1315
1320
  display: flex;
1316
1321
  align-items: center;
1317
1322
  gap: 6px;
@@ -1349,7 +1354,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1349
1354
  width: 14px;
1350
1355
  height: 14px;
1351
1356
  }
1352
- `;import{useState as _C}from"react";import kC from"styled-components";import{jsx as RC}from"react/jsx-runtime";var yl=e=>{let[t,r]=_C(!1);return RC(AC,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},AC=kC.a`
1357
+ `;import{useState as kC}from"react";import AC from"styled-components";import{jsx as IC}from"react/jsx-runtime";var yl=e=>{let[t,r]=kC(!1);return IC(RC,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},RC=AC.a`
1353
1358
  display: flex;
1354
1359
  align-items: center;
1355
1360
  gap: 6px;
@@ -1387,7 +1392,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1387
1392
  width: 14px;
1388
1393
  height: 14px;
1389
1394
  }
1390
- `;import IC from"qrcode";import MC from"react";import WC from"styled-components";import{jsx as dh}from"react/jsx-runtime";var ph=()=>dh("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:dh("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Xi,jsx as Et,jsxs as mh}from"react/jsx-runtime";var qt=7,dd=(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},LC=e=>{let t=IC.create(e,{errorCorrectionLevel:"high"}).modules,r=iu(Array.from(t.data),t.size);return r=dd(r,0,0,qt,qt),r=dd(r,r.length-qt,0,qt,qt),r=dd(r,0,r.length-qt,qt,qt),r},OC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Et(Xi,{children:[0,1,2].map(i=>Et("circle",{r:r*(qt-i*2)/2,cx:e+r*qt/2,cy:t+r*qt/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),NC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-qt)*e,0],[0,(t-qt)*e]];return Et(Xi,{children:n.map(([i,a])=>Et(OC,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},DC=({matrix:e,cellSize:t,color:r})=>Et(Xi,{children:e.map((o,n)=>o.map((i,a)=>i?Et("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):Et(MC.Fragment,{},`circle-${n}-${a}`)))}),uh=(e,t)=>e-e%t,UC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return Et(Xi,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return mh(Xi,{children:[Et("rect",{x:uh(c,t),y:uh(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Et(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},FC=e=>{let t=e.outputSize,r=LC(e.url),o=t/r.length;return mh("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Et(DC,{matrix:r,cellSize:o,color:e.fgColor}),Et(NC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Et(UC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},BC=WC.div`
1395
+ `;import MC from"qrcode";import WC from"react";import LC from"styled-components";import{jsx as ph}from"react/jsx-runtime";var uh=()=>ph("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:ph("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Xi,jsx as Et,jsxs as fh}from"react/jsx-runtime";var qt=7,dd=(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},OC=e=>{let t=MC.create(e,{errorCorrectionLevel:"high"}).modules,r=iu(Array.from(t.data),t.size);return r=dd(r,0,0,qt,qt),r=dd(r,r.length-qt,0,qt,qt),r=dd(r,0,r.length-qt,qt,qt),r},NC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Et(Xi,{children:[0,1,2].map(i=>Et("circle",{r:r*(qt-i*2)/2,cx:e+r*qt/2,cy:t+r*qt/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),DC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-qt)*e,0],[0,(t-qt)*e]];return Et(Xi,{children:n.map(([i,a])=>Et(NC,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},UC=({matrix:e,cellSize:t,color:r})=>Et(Xi,{children:e.map((o,n)=>o.map((i,a)=>i?Et("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):Et(WC.Fragment,{},`circle-${n}-${a}`)))}),mh=(e,t)=>e-e%t,FC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return Et(Xi,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return fh(Xi,{children:[Et("rect",{x:mh(c,t),y:mh(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Et(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},BC=e=>{let t=e.outputSize,r=OC(e.url),o=t/r.length;return fh("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Et(UC,{matrix:r,cellSize:o,color:e.fgColor}),Et(DC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Et(FC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},HC=LC.div`
1391
1396
  display: flex;
1392
1397
  justify-content: center;
1393
1398
  align-items: center;
@@ -1402,7 +1407,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1402
1407
  border-color: ${e=>e.fgColor};
1403
1408
  border-radius: var(--privy-border-radius-md);
1404
1409
  }
1405
- `,ei=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return Et(BC,{size:o,bgColor:t,fgColor:r,children:Et(FC,{url:e.url,logo:{element:e.squareLogoElement??ph},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as gl,jsxs as HC}from"react/jsx-runtime";var Vr=({style:e,...t})=>HC("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:[gl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),gl("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"}),gl("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"}),gl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as vl,jsx as ve,jsxs as zr}from"react/jsx-runtime";var yh="#8a63d2",Ch=1e3,zC=Ch*2,qC=Ch*120,wh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=x(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:m,createAnalyticsEvent:h}=M(),[y,C]=pd(void 0),[g,_]=pd(!1),[T,w]=pd(!1),k=GC([]),R=s?.render.inDialog?Be:0,L=c(),S=L?.meta.connectUri;return fh(()=>{let N=Date.now(),$=setInterval(async()=>{let K=await L.pollForReady.execute(),q=Date.now()-N;if(K){clearInterval($),_(!0);try{await u(),w(!0)}catch(I){let Z={retryable:!1,message:"Authentication failed"};if(I?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(I?.privyErrorCode==="max_accounts_reached"){console.error(new Rr(I).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else I?.privyErrorCode==="linked_to_another_user"?Z.detail="This account has already been linked to another user.":I?.privyErrorCode==="invalid_credentials"?(Z.retryable=!0,Z.detail="Something went wrong. Try again."):I?.privyErrorCode==="too_many_requests"&&(Z.detail="Too many requests. Please wait before trying again.");C(Z)}}else q>qC&&(clearInterval($),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},zC);return()=>{clearInterval($),k.current.forEach(K=>clearTimeout(K))}},[]),fh(()=>{if(r&&e&&T&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let $=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout($)}T&&(ir(o,s?.embeddedWallets.createOnLogin)?k.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:$,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R)):k.current.push(setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R)))}},[T,r,e,o]),hh||g?zr(vl,{children:[ve(P,{backFn:n?a:void 0,onClose:m},"header"),ve(X,{}),VC?ve(vl,{children:zr($C,{children:[ve(mt,{children:zr("div",{children:[ve(pt,{success:T,fail:!!y}),ve(Vr,{style:{width:"38px",height:"38px"}})]})}),zr(Ze,{children:[ve(ie,{children:y?y.message:"Sign in with Farcaster"}),ve(se,{children:y?y.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),S&&ve(W,{onClick:N=>{N.preventDefault(),window.location.href=S},children:"Open Warpcast app"})]})}):ve(vl,{children:zr(gh,{children:[ve(mt,{children:zr("div",{children:[ve(pt,{success:T,fail:!!y}),ve(Vr,{style:{width:"38px",height:"38px"}})]})}),zr(Ze,{children:[ve(ie,{children:y?y.message:"Signing in with Farcaster"}),ve(se,{children:y?y.detail:"This should only take a moment"}),ve(bt,{children:S&&hh&&ve(yl,{text:"Take me to Warpcast",url:S,color:yh})})]})]})}),ve(V,{})]}):zr(vl,{children:[ve(P,{backFn:n?a:void 0,onClose:m},"header"),ve(X,{}),ve(gh,{children:zr("div",{children:[ve(ie,{children:"Sign in with Farcaster"}),ve(se,{children:"Scan with your phone's camera to continue."}),ve(Nn,{children:S?ve(ei,{url:S,size:275,squareLogoElement:Vr}):ve(je,{})}),zr(bt,{children:[ve(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),S&&ve(_o,{text:S,itemName:"link",color:yh})]})]})}),ve(V,{})]})},gh=vh.div`
1410
+ `,ei=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return Et(HC,{size:o,bgColor:t,fgColor:r,children:Et(BC,{url:e.url,logo:{element:e.squareLogoElement??uh},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as gl,jsxs as GC}from"react/jsx-runtime";var Vr=({style:e,...t})=>GC("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:[gl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),gl("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"}),gl("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"}),gl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as vl,jsx as ve,jsxs as zr}from"react/jsx-runtime";var gh="#8a63d2",wh=1e3,qC=wh*2,$C=wh*120,bh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=S(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:m,createAnalyticsEvent:h}=M(),[y,C]=pd(void 0),[g,x]=pd(!1),[E,w]=pd(!1),_=VC([]),A=s?.render.inDialog?Be:0,O=c(),W=O?.meta.connectUri;return hh(()=>{let R=Date.now(),q=setInterval(async()=>{let K=await O.pollForReady.execute(),$=Date.now()-R;if(K){clearInterval(q),x(!0);try{await u(),w(!0)}catch(I){let Z={retryable:!1,message:"Authentication failed"};if(I?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(I?.privyErrorCode==="max_accounts_reached"){console.error(new Ir(I).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else I?.privyErrorCode==="linked_to_another_user"?Z.detail="This account has already been linked to another user.":I?.privyErrorCode==="invalid_credentials"?(Z.retryable=!0,Z.detail="Something went wrong. Try again."):I?.privyErrorCode==="too_many_requests"&&(Z.detail="Too many requests. Please wait before trying again.");C(Z)}}else $>$C&&(clearInterval(q),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},qC);return()=>{clearInterval(q),_.current.forEach(K=>clearTimeout(K))}},[]),hh(()=>{if(r&&e&&E&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(q)}E&&(ir(o,s?.embeddedWallets.createOnLogin)?_.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A)):_.current.push(setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A)))}},[E,r,e,o]),yh||g?zr(vl,{children:[ve(T,{backFn:n?a:void 0,onClose:m},"header"),ve(X,{}),zC?ve(vl,{children:zr(KC,{children:[ve(mt,{children:zr("div",{children:[ve(pt,{success:E,fail:!!y}),ve(Vr,{style:{width:"38px",height:"38px"}})]})}),zr(Ze,{children:[ve(ie,{children:y?y.message:"Sign in with Farcaster"}),ve(se,{children:y?y.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),W&&ve(L,{onClick:R=>{R.preventDefault(),window.location.href=W},children:"Open Warpcast app"})]})}):ve(vl,{children:zr(vh,{children:[ve(mt,{children:zr("div",{children:[ve(pt,{success:E,fail:!!y}),ve(Vr,{style:{width:"38px",height:"38px"}})]})}),zr(Ze,{children:[ve(ie,{children:y?y.message:"Signing in with Farcaster"}),ve(se,{children:y?y.detail:"This should only take a moment"}),ve(bt,{children:W&&yh&&ve(yl,{text:"Take me to Warpcast",url:W,color:gh})})]})]})}),ve(V,{})]}):zr(vl,{children:[ve(T,{backFn:n?a:void 0,onClose:m},"header"),ve(X,{}),ve(vh,{children:zr("div",{children:[ve(ie,{children:"Sign in with Farcaster"}),ve(se,{children:"Scan with your phone's camera to continue."}),ve(Nn,{children:W?ve(ei,{url:W,size:275,squareLogoElement:Vr}):ve(je,{})}),zr(bt,{children:[ve(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),W&&ve(_o,{text:W,itemName:"link",color:gh})]})]})}),ve(V,{})]})},vh=Ch.div`
1406
1411
  display: flex;
1407
1412
  flex-direction: column;
1408
1413
  align-items: center;
@@ -1410,14 +1415,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1410
1415
  margin-left: 27px;
1411
1416
  margin-right: 27px;
1412
1417
  gap: 24px;
1413
- `,$C=vh.div`
1418
+ `,KC=Ch.div`
1414
1419
  display: flex;
1415
1420
  flex-direction: column;
1416
1421
  align-items: center;
1417
1422
  justify-content: center;
1418
1423
  gap: 24px;
1419
1424
  width: 100%;
1420
- `;import{useEffect as KC,useRef as jC,useState as ud}from"react";import{isIOS as YC,isMobile as bh}from"react-device-detect";import Th from"styled-components";import{Fragment as Cl,jsx as we,jsxs as Tr}from"react/jsx-runtime";var Eh="#8a63d2",Sh=1e3,ZC=Sh*2,JC=Sh*300,xh=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=x(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=ud(void 0),[s,c]=ud(!1),[u,m]=ud(!1),h=jC([]),y=o?.render.inDialog?Be:0,C=r?.farcasterSigner;KC(()=>{let _=Date.now(),T=setInterval(async()=>{if(!C?.public_key){clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}C.status==="approved"&&(clearInterval(T),c(!1),m(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y)));let w=await n(C?.public_key),k=Date.now()-_;w.status==="approved"?(clearInterval(T),c(!1),m(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y))):k>JC?(clearInterval(T),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):w.status==="revoked"&&(clearInterval(T),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},ZC);return()=>{clearInterval(T),h.current.forEach(w=>clearTimeout(w))}},[]);let g=C?.status==="pending_approval"?C.signer_approval_url:void 0;return bh||s?Tr(Cl,{children:[we(P,{backFn:e?t:void 0,onClose:i},"header"),we(X,{}),YC?we(Cl,{children:Tr(QC,{children:[we(mt,{children:Tr("div",{children:[we(pt,{success:u,fail:!!a}),we(Vr,{style:{width:"38px",height:"38px"}})]})}),Tr(Ze,{children:[we(ie,{children:a?a.message:"Add a signer to Farcaster"}),we(se,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),g&&we(W,{onClick:_=>{_.preventDefault(),window.location.href=g},children:"Open Warpcast app"})]})}):we(Cl,{children:Tr(Ph,{children:[we(mt,{children:Tr("div",{children:[we(pt,{success:u,fail:!!a}),we(Vr,{style:{width:"38px",height:"38px"}})]})}),Tr(Ze,{children:[we(ie,{children:a?a.message:"Requesting signer from Farcaster"}),we(se,{children:a?a.detail:"This should only take a moment"}),we(bt,{children:g&&bh&&we(yl,{text:"Take me to Warpcast",url:g,color:Eh})})]})]})}),we(V,{})]}):Tr(Cl,{children:[we(P,{backFn:e?t:void 0,onClose:i},"header"),we(X,{}),we(Ph,{children:Tr("div",{children:[we(ie,{children:"Add a signer to Farcaster"}),Tr(se,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),we(Nn,{children:C?.status==="pending_approval"?we(ei,{url:C.signer_approval_url,size:275,squareLogoElement:Vr}):we(je,{})}),Tr(bt,{children:[we(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),C?.status==="pending_approval"&&we(_o,{text:C.signer_approval_url,itemName:"link",color:Eh})]})]})}),we(V,{})]})},Ph=Th.div`
1425
+ `;import{useEffect as jC,useRef as YC,useState as ud}from"react";import{isIOS as ZC,isMobile as Eh}from"react-device-detect";import Sh from"styled-components";import{Fragment as Cl,jsx as we,jsxs as Sr}from"react/jsx-runtime";var Ph="#8a63d2",xh=1e3,JC=xh*2,QC=xh*300,_h=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=S(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=M(),[a,l]=ud(void 0),[s,c]=ud(!1),[u,m]=ud(!1),h=YC([]),y=o?.render.inDialog?Be:0,C=r?.farcasterSigner;jC(()=>{let x=Date.now(),E=setInterval(async()=>{if(!C?.public_key){clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}C.status==="approved"&&(clearInterval(E),c(!1),m(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y)));let w=await n(C?.public_key),_=Date.now()-x;w.status==="approved"?(clearInterval(E),c(!1),m(!0),h.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),y))):_>QC?(clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):w.status==="revoked"&&(clearInterval(E),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},JC);return()=>{clearInterval(E),h.current.forEach(w=>clearTimeout(w))}},[]);let g=C?.status==="pending_approval"?C.signer_approval_url:void 0;return Eh||s?Sr(Cl,{children:[we(T,{backFn:e?t:void 0,onClose:i},"header"),we(X,{}),ZC?we(Cl,{children:Sr(XC,{children:[we(mt,{children:Sr("div",{children:[we(pt,{success:u,fail:!!a}),we(Vr,{style:{width:"38px",height:"38px"}})]})}),Sr(Ze,{children:[we(ie,{children:a?a.message:"Add a signer to Farcaster"}),we(se,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),g&&we(L,{onClick:x=>{x.preventDefault(),window.location.href=g},children:"Open Warpcast app"})]})}):we(Cl,{children:Sr(Th,{children:[we(mt,{children:Sr("div",{children:[we(pt,{success:u,fail:!!a}),we(Vr,{style:{width:"38px",height:"38px"}})]})}),Sr(Ze,{children:[we(ie,{children:a?a.message:"Requesting signer from Farcaster"}),we(se,{children:a?a.detail:"This should only take a moment"}),we(bt,{children:g&&Eh&&we(yl,{text:"Take me to Warpcast",url:g,color:Ph})})]})]})}),we(V,{})]}):Sr(Cl,{children:[we(T,{backFn:e?t:void 0,onClose:i},"header"),we(X,{}),we(Th,{children:Sr("div",{children:[we(ie,{children:"Add a signer to Farcaster"}),Sr(se,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),we(Nn,{children:C?.status==="pending_approval"?we(ei,{url:C.signer_approval_url,size:275,squareLogoElement:Vr}):we(je,{})}),Sr(bt,{children:[we(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),C?.status==="pending_approval"&&we(_o,{text:C.signer_approval_url,itemName:"link",color:Ph})]})]})}),we(V,{})]})},Th=Sh.div`
1421
1426
  display: flex;
1422
1427
  flex-direction: column;
1423
1428
  align-items: center;
@@ -1425,14 +1430,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1425
1430
  margin-left: 27px;
1426
1431
  margin-right: 27px;
1427
1432
  gap: 24px;
1428
- `,QC=Th.div`
1433
+ `,XC=Sh.div`
1429
1434
  display: flex;
1430
1435
  flex-direction: column;
1431
1436
  align-items: center;
1432
1437
  justify-content: center;
1433
1438
  gap: 24px;
1434
1439
  width: 100%;
1435
- `;import e4 from"@heroicons/react/24/outline/ClockIcon";import t4 from"@heroicons/react/24/outline/EyeSlashIcon";import r4 from"@heroicons/react/24/outline/LinkIcon";import qr from"styled-components";import{jsx as md,jsxs as XC}from"react/jsx-runtime";var wl=({size:e=61,...t})=>md("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:XC("g",{id:"moonpay_symbol_wht 2",children:[md("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),md("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as _h,jsx as Pt,jsxs as sn}from"react/jsx-runtime";var fd=({title:e,desc:t,icon:r})=>sn(l4,{children:[Pt(d4,{children:r}),sn(c4,{children:[Pt(a4,{children:e}),Pt(s4,{children:t})]})]}),kh=({app:e,signedUrl:t,onContinue:r})=>sn(_h,{children:[sn(n4,{children:[Pt(wl,{size:"3.75rem"}),sn(i4,{children:[e?.name," uses ",Pt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),sn(p4,{children:[Pt(fd,{icon:Pt(r4,{width:"1rem"}),title:"Purchase assets to fund your account",desc:sn(_h,{children:["Connect a payment method (",Pt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Pt(fd,{icon:Pt(e4,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Pt(fd,{icon:Pt(t4,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Pt(u4,{className:"mobile-only"})]}),Pt(o4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Pt(Bs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),o4=qr.span`
1440
+ `;import t4 from"@heroicons/react/24/outline/ClockIcon";import r4 from"@heroicons/react/24/outline/EyeSlashIcon";import o4 from"@heroicons/react/24/outline/LinkIcon";import qr from"styled-components";import{jsx as md,jsxs as e4}from"react/jsx-runtime";var wl=({size:e=61,...t})=>md("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e4("g",{id:"moonpay_symbol_wht 2",children:[md("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),md("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as kh,jsx as Pt,jsxs as ln}from"react/jsx-runtime";var fd=({title:e,desc:t,icon:r})=>ln(c4,{children:[Pt(p4,{children:r}),ln(d4,{children:[Pt(s4,{children:e}),Pt(l4,{children:t})]})]}),Ah=({app:e,signedUrl:t,onContinue:r})=>ln(kh,{children:[ln(i4,{children:[Pt(wl,{size:"3.75rem"}),ln(a4,{children:[e?.name," uses ",Pt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),ln(u4,{children:[Pt(fd,{icon:Pt(o4,{width:"1rem"}),title:"Purchase assets to fund your account",desc:ln(kh,{children:["Connect a payment method (",Pt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Pt(fd,{icon:Pt(t4,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Pt(fd,{icon:Pt(r4,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Pt(m4,{className:"mobile-only"})]}),Pt(n4,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Pt(Bs,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),n4=qr.span`
1436
1441
  display: inline-block;
1437
1442
  color: var(--privy-color-foreground-3);
1438
1443
  text-align: center;
@@ -1441,13 +1446,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1441
1446
  font-weight: 400;
1442
1447
  line-height: 140%; /* 0.875rem */
1443
1448
  margin-bottom: 0.25rem;
1444
- `,n4=qr.div`
1449
+ `,i4=qr.div`
1445
1450
  display: flex;
1446
1451
  flex-direction: column;
1447
1452
  align-items: center;
1448
1453
  justify-content: center;
1449
1454
  padding: 1.5rem 0;
1450
- `,i4=qr.span`
1455
+ `,a4=qr.span`
1451
1456
  color: var(--privy-color-foreground);
1452
1457
  text-align: center;
1453
1458
  font-size: 1.125rem;
@@ -1456,46 +1461,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1456
1461
  margin: 1.5rem 0;
1457
1462
  text-align: center;
1458
1463
  max-width: 19.5rem;
1459
- `,a4=qr.span`
1464
+ `,s4=qr.span`
1460
1465
  color: var(--privy-color-foreground);
1461
1466
  font-size: 0.875rem;
1462
1467
  font-weight: 500;
1463
1468
  line-height: 1.225rem;
1464
1469
  width: 100%;
1465
- `,s4=qr.span`
1470
+ `,l4=qr.span`
1466
1471
  color: var(--privy-color-foreground-2);
1467
1472
  font-size: 0.875rem;
1468
1473
  font-weight: 400;
1469
1474
  line-height: 1.225rem;
1470
- `,l4=qr.div`
1475
+ `,c4=qr.div`
1471
1476
  display: flex;
1472
1477
  align-items: flex-start;
1473
1478
  gap: 0.5rem;
1474
1479
  align-self: stretch;
1475
- `,c4=qr.div`
1480
+ `,d4=qr.div`
1476
1481
  display: flex;
1477
1482
  flex-direction: column;
1478
1483
  gap: 0.25rem;
1479
1484
  align-items: flex-start;
1480
1485
  text-align: left;
1481
1486
  flex: 1 0 0;
1482
- `,d4=qr.div`
1483
- padding-top: 2px;
1484
1487
  `,p4=qr.div`
1488
+ padding-top: 2px;
1489
+ `,u4=qr.div`
1485
1490
  display: flex;
1486
1491
  flex-direction: column;
1487
1492
  gap: 1.25rem;
1488
1493
  margin: 0 0.5rem;
1489
- `,u4=qr.div`
1494
+ `,m4=qr.div`
1490
1495
  margin: 30px 0;
1491
- `;import{ofetch as m4}from"ofetch";import{useEffect as f4,useRef as h4,useState as y4}from"react";var bl="moonpay",Ah="sdk_fiat_on_ramp_completed_with_status";async function Rh(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?Xp:Qp,o=t?tu:eu;return m4(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Ih(e,t=!1){let[r,o]=y4(null),{createAnalyticsEvent:n}=M(),i=h4(0);return f4(()=>{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:Ah,payload:{status:s,provider:bl,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:Ah,payload:{status:"serviceFailure",provider:bl}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as v4,jsx as hd,jsxs as C4}from"react/jsx-runtime";var Mh=()=>{let{app:e,data:t,navigate:r}=x(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:C4(v4,{children:[hd(P,{title:"Fund account"},"header"),hd(kh,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:bl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),hd(G,{protectedByPrivy:!0})]})};import w4 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import b4 from"@heroicons/react/24/solid/CheckCircleIcon";import E4 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as P4}from"react";import Wh from"styled-components";import{Fragment as yd,jsx as Tt,jsxs as ln}from"react/jsx-runtime";var Lh=()=>{let{app:e,data:t}=x(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Ih(o||null,e.fiatOnRamp.useSandbox);return ln(yd,{children:[Tt(P,{title:"Fund account"},"header"),Tt(S4,{status:n,onClickCta:r}),Tt(G,{protectedByPrivy:!0})]})},T4=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:ln(yd,{children:[ln("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Tt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Tt("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:""}}},S4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=P4(()=>T4(e),[e]);return ln(yd,{children:[ln(R4,{children:[Tt(k4,{status:e}),ln(Ze,{children:[Tt("h3",{children:r}),Tt(A4,{children:o})]})]}),n&&Tt(W,{onClick:t,children:n})]})},x4=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 E4;case"completed":return b4;case"waitingAuthorization":return()=>Tt(w4,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},k4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return ln("div",{style:{position:"relative"},children:[Tt(je,{color:o,style:{position:"absolute"}}),Tt(Oc,{color:o}),Tt(wl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=_4(e),r=x4(e);return Tt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Tt(t,{width:"4rem",height:"4rem",color:r})})},A4=Wh.p`
1496
+ `;import{ofetch as f4}from"ofetch";import{useEffect as h4,useRef as y4,useState as g4}from"react";var bl="moonpay",Rh="sdk_fiat_on_ramp_completed_with_status";async function Ih(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?Xp:Qp,o=t?tu:eu;return f4(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Mh(e,t=!1){let[r,o]=g4(null),{createAnalyticsEvent:n}=M(),i=y4(0);return h4(()=>{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:Rh,payload:{status:s,provider:bl,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:Rh,payload:{status:"serviceFailure",provider:bl}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as C4,jsx as hd,jsxs as w4}from"react/jsx-runtime";var Wh=()=>{let{app:e,data:t,navigate:r}=S(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:w4(C4,{children:[hd(T,{title:"Fund account"},"header"),hd(Ah,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:bl}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),hd(G,{protectedByPrivy:!0})]})};import b4 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import E4 from"@heroicons/react/24/solid/CheckCircleIcon";import P4 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as T4}from"react";import Lh from"styled-components";import{Fragment as yd,jsx as Tt,jsxs as cn}from"react/jsx-runtime";var Oh=()=>{let{app:e,data:t}=S(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Mh(o||null,e.fiatOnRamp.useSandbox);return cn(yd,{children:[Tt(T,{title:"Fund account"},"header"),Tt(x4,{status:n,onClickCta:r}),Tt(G,{protectedByPrivy:!0})]})},S4=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:cn(yd,{children:[cn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Tt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Tt("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:""}}},x4=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=T4(()=>S4(e),[e]);return cn(yd,{children:[cn(I4,{children:[Tt(A4,{status:e}),cn(Ze,{children:[Tt("h3",{children:r}),Tt(R4,{children:o})]})]}),n&&Tt(L,{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 P4;case"completed":return E4;case"waitingAuthorization":return()=>Tt(b4,{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}},A4=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return cn("div",{style:{position:"relative"},children:[Tt(je,{color:o,style:{position:"absolute"}}),Tt(Oc,{color:o}),Tt(wl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=k4(e),r=_4(e);return Tt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Tt(t,{width:"4rem",height:"4rem",color:r})})},R4=Lh.p`
1492
1497
  font-size: 1rem;
1493
1498
  color: var(--privy-color-foreground-3);
1494
1499
  margin-bottom: 1rem;
1495
1500
  display: flex;
1496
1501
  flex-direction: column;
1497
1502
  gap: 1rem;
1498
- `,R4=Wh.div`
1503
+ `,I4=Lh.div`
1499
1504
  display: flex;
1500
1505
  flex-direction: column;
1501
1506
  align-items: center;
@@ -1503,7 +1508,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1503
1508
  margin-left: 1.75rem;
1504
1509
  margin-right: 1.75rem;
1505
1510
  padding: 2rem 0;
1506
- `;import I4 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import M4 from"styled-components";import{Fragment as L4,jsx as ko,jsxs as O4}from"react/jsx-runtime";var Oh=()=>{let{closePrivyModal:e}=M();return O4(L4,{children:[ko(P,{},"header"),ko(W4,{children:ko(I4,{style:{width:32,height:32}})}),ko(Br,{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"}}),ko(dr,{children:ko(W,{onClick:()=>e(),children:"Close"})}),ko(ae,{}),ko(G,{protectedByPrivy:!0})]})},W4=M4.div`
1511
+ `;import M4 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import W4 from"styled-components";import{Fragment as O4,jsx as ko,jsxs as N4}from"react/jsx-runtime";var Nh=()=>{let{closePrivyModal:e}=M();return N4(O4,{children:[ko(T,{},"header"),ko(L4,{children:ko(M4,{style:{width:32,height:32}})}),ko(Br,{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"}}),ko(dr,{children:ko(L,{onClick:()=>e(),children:"Close"})}),ko(ae,{}),ko(G,{protectedByPrivy:!0})]})},L4=W4.div`
1507
1512
  border-radius: 50%;
1508
1513
  height: 68px;
1509
1514
  width: 68px;
@@ -1513,7 +1518,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1513
1518
  background-color: var(--privy-color-accent);
1514
1519
  color: white;
1515
1520
  margin: 0 auto 24px auto;
1516
- `;import*as Fh from"react-device-detect";import F4 from"styled-components";import gd from"styled-components";import{jsx as Nh}from"react/jsx-runtime";var Dh=({style:e,...t})=>Nh("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:Nh("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as D4,jsxs as U4}from"react/jsx-runtime";var Uh=gd.div`
1521
+ `;import*as Bh from"react-device-detect";import B4 from"styled-components";import gd from"styled-components";import{jsx as Dh}from"react/jsx-runtime";var Uh=({style:e,...t})=>Dh("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:Dh("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as U4,jsxs as F4}from"react/jsx-runtime";var Fh=gd.div`
1517
1522
  display: flex;
1518
1523
  flex-direction: column;
1519
1524
  justify-content: flex-start;
@@ -1524,7 +1529,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1524
1529
  border-left: 2px solid var(--privy-color-foreground-4);
1525
1530
  height: 12px;
1526
1531
  }
1527
- `,El=({children:e})=>U4(N4,{children:[D4(Dh,{style:{width:"16px",height:"16px"}}),e]}),N4=gd.div`
1532
+ `,El=({children:e})=>F4(D4,{children:[U4(Uh,{style:{width:"16px",height:"16px"}}),e]}),D4=gd.div`
1528
1533
  display: flex;
1529
1534
  justify-content: flex-start;
1530
1535
  justify-items: center;
@@ -1542,15 +1547,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
1542
1547
  margin-bottom: auto;
1543
1548
  }
1544
1549
  }
1545
- `;import{Fragment as G4,jsx as at,jsxs as ea}from"react/jsx-runtime";var B4=()=>ea(H4,{children:[at(Fi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),at(bt,{children:at(Lr,{style:{width:"152px",height:"152px"}})}),ea(Uh,{children:[at(El,{children:ea("div",{children:[at("span",{children:"Install the "}),at("a",{href:Fh.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"})]})}),at(vd,{}),at(El,{children:"Set up your first wallet"}),at(vd,{}),at(El,{children:"Store your recovery phrase in a safe place!"})]}),at(Hs,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Bh=()=>{let{navigateBack:e}=x();return ea(G4,{children:[at(P,{backFn:e},"header"),at(X,{}),at(B4,{}),at(ae,{}),ea(V,{children:[at("span",{children:"Still not sure? "}),at("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},H4=F4(bt)`
1550
+ `;import{Fragment as V4,jsx as at,jsxs as ea}from"react/jsx-runtime";var H4=()=>ea(G4,{children:[at(Fi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),at(bt,{children:at(Or,{style:{width:"152px",height:"152px"}})}),ea(Fh,{children:[at(El,{children:ea("div",{children:[at("span",{children:"Install the "}),at("a",{href:Bh.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"})]})}),at(vd,{}),at(El,{children:"Set up your first wallet"}),at(vd,{}),at(El,{children:"Store your recovery phrase in a safe place!"})]}),at(Hs,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Hh=()=>{let{navigateBack:e}=S();return ea(V4,{children:[at(T,{backFn:e},"header"),at(X,{}),at(H4,{}),at(ae,{}),ea(V,{children:[at("span",{children:"Still not sure? "}),at("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},G4=B4(bt)`
1546
1551
  gap: 30px;
1547
1552
 
1548
1553
  > :first-child > svg {
1549
1554
  margin-top: 20px;
1550
1555
  }
1551
- `;import Tw from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Sw,useState as Xh}from"react";import{isMobile as xw}from"react-device-detect";import _w from"styled-components";import j4 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as Y4}from"react";import V4 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as z4,useState as Hh}from"react";import Vh from"styled-components";import{Fragment as K4,jsx as ta,jsxs as Gh}from"react/jsx-runtime";var Pl=z4((e,t)=>{let[r,o]=Hh(""),[n,i]=Hh(!1),{authenticated:a}=F(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:u}=x(),{enabled:m,token:h}=Ce(),y=Va(r),C=n,g=n||!y,_=w=>{i(!0),l(r,w).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(k=>{c({errorModalData:{error:k,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},T=()=>{m&&!h&&!a?(c({captchaModalData:{callback:w=>l(r,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):_(h)};return Gh(K4,{children:[ta(q4,{children:Gh($4,{stacked:e.stacked,children:[ta(V4,{}),ta("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:w=>o(w.target.value),onKeyUp:w=>{w.key==="Enter"&&T()},value:r,autoComplete:"email"}),e.stacked?null:ta(Mn,{isSubmitting:C,onClick:T,disabled:g,children:"Submit"})]})}),e.stacked?ta(W,{loadingText:null,loading:C,disabled:g,onClick:T,children:"Submit"}):null]})}),q4=Vh.div`
1556
+ `;import Sw from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as xw,useState as ey}from"react";import{isMobile as _w}from"react-device-detect";import kw from"styled-components";import Y4 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as Z4}from"react";import z4 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as q4,useState as Gh}from"react";import zh from"styled-components";import{Fragment as j4,jsx as ta,jsxs as Vh}from"react/jsx-runtime";var Pl=q4((e,t)=>{let[r,o]=Gh(""),[n,i]=Gh(!1),{authenticated:a}=F(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:u}=S(),{enabled:m,token:h}=Ce(),y=Va(r),C=n,g=n||!y,x=w=>{i(!0),l(r,w).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(_=>{c({errorModalData:{error:_,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},E=()=>{m&&!h&&!a?(c({captchaModalData:{callback:w=>l(r,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(h)};return Vh(j4,{children:[ta($4,{children:Vh(K4,{stacked:e.stacked,children:[ta(z4,{}),ta("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:w=>o(w.target.value),onKeyUp:w=>{w.key==="Enter"&&E()},value:r,autoComplete:"email"}),e.stacked?null:ta(Wn,{isSubmitting:C,onClick:E,disabled:g,children:"Submit"})]})}),e.stacked?ta(L,{loadingText:null,loading:C,disabled:g,onClick:E,children:"Submit"}):null]})}),$4=zh.div`
1552
1557
  width: 100%;
1553
- `,$4=Vh.label`
1558
+ `,K4=zh.label`
1554
1559
  display: block;
1555
1560
  position: relative;
1556
1561
  width: 100%;
@@ -1611,7 +1616,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1611
1616
  && > input::placeholder {
1612
1617
  color: var(--privy-color-foreground-3);
1613
1618
  }
1614
- `;import{Fragment as Z4,jsx as Tl,jsxs as zh}from"react/jsx-runtime";var Sl=({isEditable:e,setIsEditable:t})=>{let r=Y4(null);return zh(Z4,{children:[Tl(oo,{if:!e,children:Tl(Pl,{ref:r})}),Tl(oo,{if:e,children:zh(Ae,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Tl(j4,{})," Continue with Email"]})})]})};import{useState as J4}from"react";import{jsx as Cd,jsxs as Q4}from"react/jsx-runtime";var xl=()=>{let[e,t]=J4(!1),{currentScreen:r,navigate:o,setModalData:n}=x(),{enabled:i,token:a}=Ce(),{initLoginWithFarcaster:l}=M();return Q4(Ae,{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:[Cd(Vr,{})," Farcaster",e&&Cd("span",{children:Cd(ro,{})})]})};import X4,{css as ew}from"styled-components";import{jsx as ow}from"react/jsx-runtime";var _l=()=>{let{enabled:e,token:t}=Ce(),{navigate:r,setModalData:o}=x(),{initLoginWithPasskey:n}=M();return ow(rw,{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"})},tw=ew`
1619
+ `;import{Fragment as J4,jsx as Tl,jsxs as qh}from"react/jsx-runtime";var Sl=({isEditable:e,setIsEditable:t})=>{let r=Z4(null);return qh(J4,{children:[Tl(oo,{if:!e,children:Tl(Pl,{ref:r})}),Tl(oo,{if:e,children:qh(Ae,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Tl(Y4,{})," Continue with Email"]})})]})};import{useState as Q4}from"react";import{jsx as Cd,jsxs as X4}from"react/jsx-runtime";var xl=()=>{let[e,t]=Q4(!1),{currentScreen:r,navigate:o,setModalData:n}=S(),{enabled:i,token:a}=Ce(),{initLoginWithFarcaster:l}=M();return X4(Ae,{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:[Cd(Vr,{})," Farcaster",e&&Cd("span",{children:Cd(ro,{})})]})};import ew,{css as tw}from"styled-components";import{jsx as nw}from"react/jsx-runtime";var _l=()=>{let{enabled:e,token:t}=Ce(),{navigate:r,setModalData:o}=S(),{initLoginWithPasskey:n}=M();return nw(ow,{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"})},rw=tw`
1615
1620
  && {
1616
1621
  width: 100%;
1617
1622
  font-size: 0.875rem;
@@ -1636,11 +1641,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1636
1641
  box-shadow: none;
1637
1642
  }
1638
1643
  }
1639
- `,rw=X4.button`
1640
- ${tw}
1641
- `;import yw from"@heroicons/react/24/outline/PhoneIcon";import{useRef as gw}from"react";import{forwardRef as uw,useState as wd}from"react";import Zh from"styled-components";import nw from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as iw,AsYouType as aw,getCountries as sw,getCountryCallingCode as kl,getExampleNumber as lw}from"libphonenumber-js/min";import{jsx as pw,jsxs as dw}from"react/jsx-runtime";var ra=(e,t)=>iw(String(e),t),Al=(e,t)=>`+${kl(t)} ${e}`,qh=e=>`*${e.replaceAll("-","").slice(-4)}`,$h=e=>new aw(e),cw=sw().map(e=>({code:e,callCode:kl(e)})),Kh=e=>{let t=lw(e,nw)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},jh=({value:e,onChange:t})=>pw("select",{value:e,onChange:t,children:cw.map(r=>dw("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as hw,jsx as oa,jsxs as Yh}from"react/jsx-runtime";var ti=uw((e,t)=>{let{app:r}=x(),[o,n]=wd(""),[i,a]=wd(r?.intl.defaultCountry??"US"),l=ra(o,i),s=$h(i),c=Kh(i),u=kl(i),m=!l,[h,y]=wd(!1),C=u.length,g=w=>{let k=w.target.value;a(k),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Al(o,k),countryCode:k,isValid:ra(o,i)})},_=w=>{try{let k=w.replace(/\D/g,""),R=o.replace(/\D/g,""),L=k===R?w:s.input(w);n(L),e.onChange&&e.onChange({rawPhoneNumber:L,qualifiedPhoneNumber:Al(w,i),countryCode:i,isValid:ra(w,i)})}catch(k){console.error("Error processing phone number:",k)}},T=()=>{y(!0);let w=Al(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:w,countryCode:i,isValid:ra(o,i)}).finally(()=>y(!1))};return Yh(hw,{children:[oa(mw,{children:Yh(fw,{callingCodeLength:C,stacked:e.stacked,children:[oa(jh,{value:i,onChange:g}),oa("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:w=>{_(w.target.value)},onKeyUp:w=>{w.key==="Enter"&&T()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?oa(Mn,{isSubmitting:h,onClick:T,disabled:m,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?oa(W,{loading:h,loadingText:null,onClick:T,disabled:m,children:"Submit"}):null]})}),mw=Zh.div`
1644
+ `,ow=ew.button`
1645
+ ${rw}
1646
+ `;import gw from"@heroicons/react/24/outline/PhoneIcon";import{useRef as vw}from"react";import{forwardRef as mw,useState as wd}from"react";import Jh from"styled-components";import iw from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as aw,AsYouType as sw,getCountries as lw,getCountryCallingCode as kl,getExampleNumber as cw}from"libphonenumber-js/min";import{jsx as uw,jsxs as pw}from"react/jsx-runtime";var ra=(e,t)=>aw(String(e),t),Al=(e,t)=>`+${kl(t)} ${e}`,$h=e=>`*${e.replaceAll("-","").slice(-4)}`,Kh=e=>new sw(e),dw=lw().map(e=>({code:e,callCode:kl(e)})),jh=e=>{let t=cw(e,iw)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Yh=({value:e,onChange:t})=>uw("select",{value:e,onChange:t,children:dw.map(r=>pw("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as yw,jsx as oa,jsxs as Zh}from"react/jsx-runtime";var ti=mw((e,t)=>{let{app:r}=S(),[o,n]=wd(""),[i,a]=wd(r?.intl.defaultCountry??"US"),l=ra(o,i),s=Kh(i),c=jh(i),u=kl(i),m=!l,[h,y]=wd(!1),C=u.length,g=w=>{let _=w.target.value;a(_),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Al(o,_),countryCode:_,isValid:ra(o,i)})},x=w=>{try{let _=w.replace(/\D/g,""),A=o.replace(/\D/g,""),O=_===A?w:s.input(w);n(O),e.onChange&&e.onChange({rawPhoneNumber:O,qualifiedPhoneNumber:Al(w,i),countryCode:i,isValid:ra(w,i)})}catch(_){console.error("Error processing phone number:",_)}},E=()=>{y(!0);let w=Al(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:w,countryCode:i,isValid:ra(o,i)}).finally(()=>y(!1))};return Zh(yw,{children:[oa(fw,{children:Zh(hw,{callingCodeLength:C,stacked:e.stacked,children:[oa(Yh,{value:i,onChange:g}),oa("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:w=>{x(w.target.value)},onKeyUp:w=>{w.key==="Enter"&&E()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?oa(Wn,{isSubmitting:h,onClick:E,disabled:m,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?oa(L,{loading:h,loadingText:null,onClick:E,disabled:m,children:"Submit"}):null]})}),fw=Jh.div`
1642
1647
  width: 100%;
1643
- `,fw=Zh.label`
1648
+ `,hw=Jh.label`
1644
1649
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1645
1650
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1646
1651
  display: block;
@@ -1727,11 +1732,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1727
1732
  && > input::placeholder {
1728
1733
  color: var(--privy-color-foreground-3);
1729
1734
  }
1730
- `;import{Fragment as vw,jsx as Rl,jsxs as Jh}from"react/jsx-runtime";var Il=({isEditable:e,setIsEditable:t})=>{let r=gw(null),{authenticated:o}=F(),{navigate:n,setModalData:i,currentScreen:a}=x(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=Ce();async function u({qualifiedPhoneNumber:m}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(m,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(m,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Jh(vw,{children:[Rl(oo,{if:!e,children:Rl(ti,{ref:r,onSubmit:u})}),Rl(oo,{if:e,children:Jh(Ae,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Rl(yw,{})," Continue with SMS"]})})]})};import{useState as Cw}from"react";import{jsx as lo,jsxs as bw}from"react/jsx-runtime";var ww={apple:{logo:lo(Xa,{}),displayName:"Apple"},discord:{logo:lo(es,{}),displayName:"Discord"},github:{logo:lo(ts,{}),displayName:"GitHub"},google:{logo:lo(os,{}),displayName:"Google"},linkedin:{logo:lo(ss,{}),displayName:"LinkedIn"},spotify:{logo:lo(ls,{}),displayName:"Spotify"},instagram:{logo:lo(is,{}),displayName:"Instagram"},twitter:{logo:lo(ds,{}),displayName:"Twitter"},tiktok:{logo:lo(cs,{}),displayName:"TikTok"}},Je=({provider:e})=>{let{enabled:t,token:r}=Ce(),{navigate:o,setModalData:n}=x(),[i,a]=Cw(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=ww[e];return bw(Ae,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:m=>l(e,m),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import Ew from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Qh,jsxs as Pw}from"react/jsx-runtime";var Ml=({onClick:e,text:t,icon:r})=>Pw(Ae,{onClick:e,children:[r,Qh(Vs,{children:t}),Qh(Ew,{})]});import{Fragment as bd,jsx as Qe,jsxs as Ll}from"react/jsx-runtime";var Ol=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),i=o.loginMethodsAndOrder?.primary??[],a=o.loginMethodsAndOrder?.overflow??[],l=[...i,...a],s=o.loginMethods.passkey,[c,u]=Xh("default"),[m,h]=Xh("email");Sw(()=>{let S=l.indexOf("sms"),N=l.indexOf("email");S>-1&&S<N&&h("sms")},[i,a]);let y=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{u("default")},150)};n.current=y;let C=S=>S==="email"?Qe(Sl,{isEditable:m==="email",setIsEditable:()=>{h("email")}},S):S==="sms"?Qe(Il,{isEditable:m==="sms",setIsEditable:()=>{h("sms")}},S):S==="apple"?Qe(Je,{provider:"apple"},S):S==="discord"?Qe(Je,{provider:"discord"},S):S==="farcaster"?Qe(xl,{},S):S==="github"?Qe(Je,{provider:"github"},S):S==="google"?Qe(Je,{provider:"google"},S):S==="linkedin"?Qe(Je,{provider:"linkedin"},S):S==="tiktok"?Qe(Je,{provider:"tiktok"},S):S==="twitter"&&(!xw||o?.loginConfig.twitterOAuthOnMobileEnabled)?Qe(Je,{provider:"twitter"},S):Vi([S],r,e,l),g=i.map(C).flat(),_=a.map(C).flat(),T=[...g,..._],w=kw({primary:g.length,overflow:_.length}),[k,R]=nu(T,w),L=c==="default"?void 0:()=>{u("default")};return Ll(bd,{children:[Qe(P,{title:o.appearance.landingHeader,onClose:y,backFn:L}),c==="default"&&Qe(Aw,{}),Qe(zs,{style:{overflow:"hidden",padding:2},children:Ll(lr,{children:[c==="default"&&Ll(bd,{children:[...k,R.length>0&&Qe(Ml,{text:"More options",icon:Qe(Tw,{}),onClick:()=>u("overflow")})]}),c==="overflow"&&Ll(bd,{children:[...R]}),s&&c==="default"&&Qe(_l,{})]})}),o&&Qe(Wn,{app:o}),Qe(G,{protectedByPrivy:!0})]})},Wl=5,kw=({primary:e,overflow:t})=>e<Wl?e:e===Wl&&t===0?Wl:Wl-1,Aw=_w(Gn)`
1735
+ `;import{Fragment as Cw,jsx as Rl,jsxs as Qh}from"react/jsx-runtime";var Il=({isEditable:e,setIsEditable:t})=>{let r=vw(null),{authenticated:o}=F(),{navigate:n,setModalData:i,currentScreen:a}=S(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=Ce();async function u({qualifiedPhoneNumber:m}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(m,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(m,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Qh(Cw,{children:[Rl(oo,{if:!e,children:Rl(ti,{ref:r,onSubmit:u})}),Rl(oo,{if:e,children:Qh(Ae,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Rl(gw,{})," Continue with SMS"]})})]})};import{useState as ww}from"react";import{jsx as lo,jsxs as Ew}from"react/jsx-runtime";var bw={apple:{logo:lo(Xa,{}),displayName:"Apple"},discord:{logo:lo(es,{}),displayName:"Discord"},github:{logo:lo(ts,{}),displayName:"GitHub"},google:{logo:lo(os,{}),displayName:"Google"},linkedin:{logo:lo(ss,{}),displayName:"LinkedIn"},spotify:{logo:lo(ls,{}),displayName:"Spotify"},instagram:{logo:lo(is,{}),displayName:"Instagram"},twitter:{logo:lo(ds,{}),displayName:"Twitter"},tiktok:{logo:lo(cs,{}),displayName:"TikTok"}},Je=({provider:e})=>{let{enabled:t,token:r}=Ce(),{navigate:o,setModalData:n}=S(),[i,a]=ww(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=bw[e];return Ew(Ae,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:m=>l(e,m),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import Pw from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Xh,jsxs as Tw}from"react/jsx-runtime";var Ml=({onClick:e,text:t,icon:r})=>Tw(Ae,{onClick:e,children:[r,Xh(Vs,{children:t}),Xh(Pw,{})]});import{Fragment as bd,jsx as Qe,jsxs as Ll}from"react/jsx-runtime";var Ol=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{appearance:{palette:{colorScheme:i}}}=sr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,m]=ey("default"),[h,y]=ey("email");xw(()=>{let R=s.indexOf("sms"),q=s.indexOf("email");R>-1&&R<q&&y("sms")},[a,l]);let C=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{m("default")},150)};n.current=C;let g=R=>R==="email"?Qe(Sl,{isEditable:h==="email",setIsEditable:()=>{y("email")}},R):R==="sms"?Qe(Il,{isEditable:h==="sms",setIsEditable:()=>{y("sms")}},R):R==="apple"?Qe(Je,{provider:"apple"},R):R==="discord"?Qe(Je,{provider:"discord"},R):R==="farcaster"?Qe(xl,{},R):R==="github"?Qe(Je,{provider:"github"},R):R==="google"?Qe(Je,{provider:"google"},R):R==="linkedin"?Qe(Je,{provider:"linkedin"},R):R==="tiktok"?Qe(Je,{provider:"tiktok"},R):R==="twitter"&&(!_w||o?.loginConfig.twitterOAuthOnMobileEnabled)?Qe(Je,{provider:"twitter"},R):Vi([R],r,e,s),x=a.map(g).flat(),E=l.map(g).flat(),w=[...x,...E],_=Aw({primary:x.length,overflow:E.length}),[A,O]=nu(w,_),W=u==="default"?void 0:()=>{m("default")};return Ll(bd,{children:[Qe(T,{title:o.appearance.landingHeader,onClose:C,backFn:W}),u==="default"&&Qe(Rw,{}),Qe(zs,{style:{overflow:"hidden"},children:Ll(_m,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&Ll(bd,{children:[...A,O.length>0&&Qe(Ml,{text:"More options",icon:Qe(Sw,{}),onClick:()=>m("overflow")})]}),u==="overflow"&&Ll(bd,{children:[...O]}),c&&u==="default"&&Qe(_l,{})]})}),o&&Qe(Ln,{app:o}),Qe(G,{protectedByPrivy:!0})]})},Wl=5,Aw=({primary:e,overflow:t})=>e<Wl?e:e===Wl&&t===0?Wl:Wl-1,Rw=kw(Gn)`
1731
1736
  margin-bottom: 16px;
1732
- `;import Ww from"@heroicons/react/24/outline/EnvelopeIcon";import Lw from"@heroicons/react/24/outline/PhoneIcon";import Ow from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Nw,useState as oy}from"react";import{isMobile as Dw}from"react-device-detect";import Uw from"styled-components";import{jsx as na,jsxs as ey}from"react/jsx-runtime";var ty=({...e})=>ey("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[ey("g",{clipPath:"url(#clip0_2856_1743)",children:[na("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"}),na("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"})]}),na("defs",{children:na("clipPath",{id:"clip0_2856_1743",children:na("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import Rw from"@heroicons/react/24/outline/ChevronRightIcon";import Iw from"@heroicons/react/24/outline/WalletIcon";import{jsx as Ed,jsxs as Mw}from"react/jsx-runtime";var ry=({onClick:e,text:t})=>Mw(Ae,{onClick:e,children:[Ed(Iw,{}),Ed(Vs,{children:t}),Ed(Rw,{})]});import{Fragment as ia,jsx as Ie,jsxs as ri}from"react/jsx-runtime";var Nl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:m,instagram:h,tiktok:y,linkedin:C,apple:g,wallet:_,farcaster:T,passkey:w}=o?.loginMethods??{},k=o?.appearance.loginGroupPriority||"web2-first",R=o?.appearance.hideDirectWeb2Inputs,[L,S]=oy("default"),[N,$]=oy(i?"email":"sms");Nw(()=>{$(i?"email":"sms")},[i]);let K=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{S("default")},150)};n.current=K;let q=[i&&Ie(Sl,{isEditable:N==="email",setIsEditable:()=>{$("email")}}),a&&Ie(Il,{isEditable:N==="sms",setIsEditable:()=>{$("sms")}})].filter(Boolean),I=[l&&Ie(Je,{provider:"google"}),s&&(!Dw||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Ie(Je,{provider:"twitter"}),c&&Ie(Je,{provider:"discord"}),u&&Ie(Je,{provider:"github"}),m&&Ie(Je,{provider:"spotify"}),h&&Ie(Je,{provider:"instagram"}),y&&Ie(Je,{provider:"tiktok"}),C&&Ie(Je,{provider:"linkedin"}),g&&Ie(Je,{provider:"apple"}),T&&Ie(xl,{})].filter(Boolean),Z=Vi(o.appearance.walletList,r,e,o.appearance.walletList),U=L==="default"?void 0:()=>{S("default")},ue=Bw({priority:k,email:i,sms:a,social:I}),re=Hw({priority:k,email:i,sms:a,social:I}),ce=Gw({priority:k,email:i,sms:a,social:I}),fe=Ie(ry,{text:ce,onClick:()=>S("web3-overflow")}),Q=Ie(Ml,{text:ue,icon:re,onClick:()=>S("web2-overflow")}),et=R?0:1;return ri(ia,{children:[Ie(P,{title:o.appearance.landingHeader,onClose:K,backFn:U}),L==="default"&&Ie(Fw,{}),Ie(zs,{style:{overflow:"hidden",padding:2},children:ri(lr,{children:[L==="default"&&k==="web2-first"&&ri(ia,{children:[...q,...I.length+q.length>4?I.slice(0,3-q.length):I,q.length+I.length>4&&Q,_&&fe]}),L==="default"&&k==="web3-first"&&ri(ia,{children:[_&&ri(ia,{children:[...Z.length>4?Z.slice(0,3):Z,Z.length>4&&fe]}),q.length+I.length>et&&Q,q.length+I.length===et&&q.length?q[0]:null,q.length+I.length===et&&I.length?I[0]:null]}),L==="web2-overflow"&&ri(ia,{children:[...k==="web3-first"?q:[],...I]}),...L==="web3-overflow"?Z:[],w&&L==="default"&&Ie(_l,{})]})}),o&&Ie(Wn,{app:o}),Ie(G,{protectedByPrivy:!0})]})},Fw=Uw(Gn)`
1737
+ `;import Lw from"@heroicons/react/24/outline/EnvelopeIcon";import Ow from"@heroicons/react/24/outline/PhoneIcon";import Nw from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Dw,useState as ny}from"react";import{isMobile as Uw}from"react-device-detect";import Fw from"styled-components";import{jsx as na,jsxs as ty}from"react/jsx-runtime";var ry=({...e})=>ty("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[ty("g",{clipPath:"url(#clip0_2856_1743)",children:[na("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"}),na("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"})]}),na("defs",{children:na("clipPath",{id:"clip0_2856_1743",children:na("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import Iw from"@heroicons/react/24/outline/ChevronRightIcon";import Mw from"@heroicons/react/24/outline/WalletIcon";import{jsx as Ed,jsxs as Ww}from"react/jsx-runtime";var oy=({onClick:e,text:t})=>Ww(Ae,{onClick:e,children:[Ed(Mw,{}),Ed(Vs,{children:t}),Ed(Iw,{})]});import{Fragment as ia,jsx as Ie,jsxs as ri}from"react/jsx-runtime";var Nl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:m,instagram:h,tiktok:y,linkedin:C,apple:g,wallet:x,farcaster:E,passkey:w}=o?.loginMethods??{},_=o?.appearance.loginGroupPriority||"web2-first",A=o?.appearance.hideDirectWeb2Inputs,[O,W]=ny("default"),[R,q]=ny(i?"email":"sms");Dw(()=>{q(i?"email":"sms")},[i]);let K=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{W("default")},150)};n.current=K;let $=[i&&Ie(Sl,{isEditable:R==="email",setIsEditable:()=>{q("email")}}),a&&Ie(Il,{isEditable:R==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),I=[l&&Ie(Je,{provider:"google"}),s&&(!Uw||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Ie(Je,{provider:"twitter"}),c&&Ie(Je,{provider:"discord"}),u&&Ie(Je,{provider:"github"}),m&&Ie(Je,{provider:"spotify"}),h&&Ie(Je,{provider:"instagram"}),y&&Ie(Je,{provider:"tiktok"}),C&&Ie(Je,{provider:"linkedin"}),g&&Ie(Je,{provider:"apple"}),E&&Ie(xl,{})].filter(Boolean),Z=Vi(o.appearance.walletList,r,e,o.appearance.walletList),U=O==="default"?void 0:()=>{W("default")},ue=Hw({priority:_,email:i,sms:a,social:I}),re=Gw({priority:_,email:i,sms:a,social:I}),ce=Vw({priority:_,email:i,sms:a,social:I}),fe=Ie(oy,{text:ce,onClick:()=>W("web3-overflow")}),Q=Ie(Ml,{text:ue,icon:re,onClick:()=>W("web2-overflow")}),et=A?0:1;return ri(ia,{children:[Ie(T,{title:o.appearance.landingHeader,onClose:K,backFn:U}),O==="default"&&Ie(Bw,{}),Ie(zs,{style:{overflow:"hidden",padding:2},children:ri(Cr,{children:[O==="default"&&_==="web2-first"&&ri(ia,{children:[...$,...I.length+$.length>4?I.slice(0,3-$.length):I,$.length+I.length>4&&Q,x&&fe]}),O==="default"&&_==="web3-first"&&ri(ia,{children:[x&&ri(ia,{children:[...Z.length>4?Z.slice(0,3):Z,Z.length>4&&fe]}),$.length+I.length>et&&Q,$.length+I.length===et&&$.length?$[0]:null,$.length+I.length===et&&I.length?I[0]:null]}),O==="web2-overflow"&&ri(ia,{children:[..._==="web3-first"?$:[],...I]}),...O==="web3-overflow"?Z:[],w&&O==="default"&&Ie(_l,{})]})}),o&&Ie(Ln,{app:o}),Ie(G,{protectedByPrivy:!0})]})},Bw=Fw(Gn)`
1733
1738
  margin-bottom: 16px;
1734
- `,Bw=({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",Hw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ie(Ow,{}):t&&r?Ie(ty,{}):t?Ie(Ww,{}):r?Ie(Lw,{}):null,Gw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as ny}from"react/jsx-runtime";var iy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?ny(Ol,{connectOnly:!0}):ny(Nl,{connectOnly:!0})};import{jsx as ay}from"react/jsx-runtime";var sy=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?ay(Ol,{connectOnly:!1}):ay(Nl,{connectOnly:!1})};import Vw from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as zw,jsx as Ao,jsxs as qw}from"react/jsx-runtime";var ly=()=>{let{app:e}=x();return qw(zw,{children:[Ao(P,{},"header"),Ao(X,{}),Ao(Ee,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Ao(Vw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Ao(dr,{children:Ao(Pl,{stacked:!0})}),Ao(ae,{}),Ao(G,{protectedByPrivy:!0})]})};import $w from"@heroicons/react/24/outline/ClockIcon";import Kw from"@heroicons/react/24/outline/TrashIcon";import jw from"@heroicons/react/24/solid/CheckBadgeIcon";import Yw from"@heroicons/react/24/solid/CheckCircleIcon";import Zw from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as Jw,useState as aa}from"react";import mr,{css as my}from"styled-components";import{jsx as cy}from"react/jsx-runtime";var cn=({style:e,...t})=>cy("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:cy("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Re,jsxs as dy}from"react/jsx-runtime";var dn=({style:e,...t})=>dy("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:[dy("g",{clipPath:"url(#clip0_113_33841)",children:[Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"})]}),Re("defs",{children:Re("clipPath",{id:"clip0_113_33841",children:Re("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Pd,jsx as le,jsxs as Wt}from"react/jsx-runtime";var py=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=aa([]),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(m=>m!==c))};return Wt("div",{children:[le(n5,{children:"Your passkeys"}),Wt(hy,{children:[e.slice(0,a).map(c=>Wt(s5,{children:[Wt("div",{children:[le(i5,{children:l(c)}),Wt(a5,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),le(c5,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?le(ro,{}):le(Kw,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&le(t5,{onClick:o,children:"View all"})]})]})},Qw=()=>Wt(hy,{children:[Wt(It,{children:[le(Rt,{children:le(jw,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Wt(It,{children:[le(Rt,{children:le(Zw,{})}),"More secure than a password."]}),Wt(It,{children:[le(Rt,{children:le($w,{})}),"Takes seconds to set up and use."]})]}),fy=()=>{let{user:e,unlinkPasskey:t}=F(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[i,a]=aa(!1),[l,s]=aa(""),[c,u]=aa(!1),[m,h]=aa(!1);Jw(()=>{n.length===0&&h(!1)},[n.length]);let y=()=>{a(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof Fe){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},C=async g=>(a(!0),await t(g).then(()=>u(!0)).catch(_=>{if(_ instanceof Fe&&_.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?Wt(Pd,{children:[le(P,{onClose:()=>o()},"header"),le(be,{children:le(We,{status:"success",children:le(Yw,{})})}),le(uy,{children:"Passkey added"}),le(r5,{children:"From now on, you can use your passkey to log in."}),le(ut,{children:le(W,{onClick:()=>o(),children:"Done"})}),le(V,{})]}):m?Wt(Pd,{children:[le(P,{backFn:()=>h(!1),onClose:()=>o()},"header"),le(py,{passkeys:n,expanded:m,onUnlink:C,onExpand:()=>h(!0)}),le(V,{})]}):Wt(Pd,{children:[le(P,{onClose:()=>o()},"header"),le(be,{children:Wt(Dl,{children:[le(cn,{}),le(dn,{})]})}),le(uy,{children:"Secure your account with a passkey"}),le(o5,{}),n.length===0?le(Qw,{}):le(py,{passkeys:n,expanded:m,onUnlink:C,onExpand:()=>h(!0)}),Wt(ut,{style:{marginTop:"12px"},children:[l&&le(Xw,{fail:!0,children:l}),le(W,{onClick:y,loading:i,children:"Add new passkey"})]}),le(V,{})]})},Dl=mr.div`
1739
+ `,Hw=({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",Gw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ie(Nw,{}):t&&r?Ie(ry,{}):t?Ie(Lw,{}):r?Ie(Ow,{}):null,Vw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as iy}from"react/jsx-runtime";var ay=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?iy(Ol,{connectOnly:!0}):iy(Nl,{connectOnly:!0})};import{jsx as sy}from"react/jsx-runtime";var ly=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?sy(Ol,{connectOnly:!1}):sy(Nl,{connectOnly:!1})};import zw from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as qw,jsx as Ao,jsxs as $w}from"react/jsx-runtime";var cy=()=>{let{app:e}=S();return $w(qw,{children:[Ao(T,{},"header"),Ao(X,{}),Ao(Ee,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Ao(zw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Ao(dr,{children:Ao(Pl,{stacked:!0})}),Ao(ae,{}),Ao(G,{protectedByPrivy:!0})]})};import Kw from"@heroicons/react/24/outline/ClockIcon";import jw from"@heroicons/react/24/outline/TrashIcon";import Yw from"@heroicons/react/24/solid/CheckBadgeIcon";import Zw from"@heroicons/react/24/solid/CheckCircleIcon";import Jw from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as Qw,useState as aa}from"react";import mr,{css as fy}from"styled-components";import{jsx as dy}from"react/jsx-runtime";var dn=({style:e,...t})=>dy("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:dy("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Re,jsxs as py}from"react/jsx-runtime";var pn=({style:e,...t})=>py("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[py("g",{clipPath:"url(#clip0_113_33841)",children:[Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"}),Re("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"})]}),Re("defs",{children:Re("clipPath",{id:"clip0_113_33841",children:Re("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Pd,jsx as le,jsxs as Wt}from"react/jsx-runtime";var uy=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=aa([]),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(m=>m!==c))};return Wt("div",{children:[le(i5,{children:"Your passkeys"}),Wt(yy,{children:[e.slice(0,a).map(c=>Wt(l5,{children:[Wt("div",{children:[le(a5,{children:l(c)}),Wt(s5,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),le(d5,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?le(ro,{}):le(jw,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&le(r5,{onClick:o,children:"View all"})]})]})},Xw=()=>Wt(yy,{children:[Wt(It,{children:[le(Rt,{children:le(Yw,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Wt(It,{children:[le(Rt,{children:le(Jw,{})}),"More secure than a password."]}),Wt(It,{children:[le(Rt,{children:le(Kw,{})}),"Takes seconds to set up and use."]})]}),hy=()=>{let{user:e,unlinkPasskey:t}=F(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[i,a]=aa(!1),[l,s]=aa(""),[c,u]=aa(!1),[m,h]=aa(!1);Qw(()=>{n.length===0&&h(!1)},[n.length]);let y=()=>{a(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof Fe){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},C=async g=>(a(!0),await t(g).then(()=>u(!0)).catch(x=>{if(x instanceof Fe&&x.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?Wt(Pd,{children:[le(T,{onClose:()=>o()},"header"),le(be,{children:le(We,{status:"success",children:le(Zw,{})})}),le(my,{children:"Passkey added"}),le(o5,{children:"From now on, you can use your passkey to log in."}),le(ut,{children:le(L,{onClick:()=>o(),children:"Done"})}),le(V,{})]}):m?Wt(Pd,{children:[le(T,{backFn:()=>h(!1),onClose:()=>o()},"header"),le(uy,{passkeys:n,expanded:m,onUnlink:C,onExpand:()=>h(!0)}),le(V,{})]}):Wt(Pd,{children:[le(T,{onClose:()=>o()},"header"),le(be,{children:Wt(Dl,{children:[le(dn,{}),le(pn,{})]})}),le(my,{children:"Secure your account with a passkey"}),le(n5,{}),n.length===0?le(Xw,{}):le(uy,{passkeys:n,expanded:m,onUnlink:C,onExpand:()=>h(!0)}),Wt(ut,{style:{marginTop:"12px"},children:[l&&le(e5,{fail:!0,children:l}),le(L,{onClick:y,loading:i,children:"Add new passkey"})]}),le(V,{})]})},Dl=mr.div`
1735
1740
  display: flex;
1736
1741
  align-items: center;
1737
1742
  justify-content: center;
@@ -1747,7 +1752,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1747
1752
  stroke: var(--privy-color-accent) !important;
1748
1753
  fill: var(--privy-color-accent) !important;
1749
1754
  }
1750
- `,Xw=mr.div`
1755
+ `,e5=mr.div`
1751
1756
  line-height: 20px;
1752
1757
  height: 20px;
1753
1758
  font-size: 13px;
@@ -1755,7 +1760,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1755
1760
  display: flex;
1756
1761
  justify-content: flex-beginngin;
1757
1762
  width: 100%;
1758
- `,e5=my`
1763
+ `,t5=fy`
1759
1764
  && {
1760
1765
  width: 100%;
1761
1766
  font-size: 0.875rem;
@@ -1780,9 +1785,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1780
1785
  box-shadow: none;
1781
1786
  }
1782
1787
  }
1783
- `,t5=mr.button`
1784
- ${e5}
1785
- `,hy=mr.div`
1788
+ `,r5=mr.button`
1789
+ ${t5}
1790
+ `,yy=mr.div`
1786
1791
  display: flex;
1787
1792
  flex-direction: column;
1788
1793
  align-items: stretch;
@@ -1790,18 +1795,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1790
1795
  padding: 0.5rem 0rem 0rem;
1791
1796
  flex-grow: 1;
1792
1797
  width: 100%;
1793
- `,uy=mr.div`
1798
+ `,my=mr.div`
1794
1799
  font-size: 18px;
1795
1800
  line-height: 18px;
1796
1801
  text-align: center;
1797
1802
  font-weight: 600;
1798
- `,r5=mr.div`
1803
+ `,o5=mr.div`
1799
1804
  font-size: 0.875rem;
1800
1805
  text-align: center;
1801
1806
  margin-top: 10px;
1802
- `,o5=mr.div`
1803
- height: 32px;
1804
1807
  `,n5=mr.div`
1808
+ height: 32px;
1809
+ `,i5=mr.div`
1805
1810
  line-height: 20px;
1806
1811
  height: 20px;
1807
1812
  font-size: 1em;
@@ -1809,18 +1814,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1809
1814
  display: flex;
1810
1815
  justify-content: flex-beginning;
1811
1816
  width: 100%;
1812
- `,i5=mr.div`
1817
+ `,a5=mr.div`
1813
1818
  font-size: 1em;
1814
1819
  line-height: 1.3em;
1815
1820
  font-weight: 500;
1816
1821
  color: var(--privy-color-foreground-2);
1817
1822
  padding: 0.2em 0;
1818
- `,a5=mr.div`
1823
+ `,s5=mr.div`
1819
1824
  font-size: 0.875rem;
1820
1825
  line-height: 1rem;
1821
1826
  color: #64668b;
1822
1827
  padding: 0.2em 0;
1823
- `,s5=mr.div`
1828
+ `,l5=mr.div`
1824
1829
  display: flex;
1825
1830
  align-items: center;
1826
1831
  justify-content: space-between;
@@ -1833,7 +1838,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1833
1838
  border: 1px solid #e2e3f0 !important;
1834
1839
  width: 100%;
1835
1840
  height: 5em;
1836
- `,l5=my`
1841
+ `,c5=fy`
1837
1842
  :focus,
1838
1843
  :hover,
1839
1844
  :active {
@@ -1850,9 +1855,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1850
1855
  svg:hover {
1851
1856
  color: var(--privy-color-foreground-3);
1852
1857
  }
1853
- `,c5=mr.button`
1854
- ${l5}
1855
- `;import d5 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as p5,jsx as Ro,jsxs as u5}from"react/jsx-runtime";var yy=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=x(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return u5(p5,{children:[Ro(P,{},"header"),Ro(X,{}),Ro(Ee,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Ro(d5,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Ro(dr,{children:Ro(ti,{stacked:!0,onSubmit:a})}),Ro(ae,{}),Ro(G,{protectedByPrivy:!0})]})};import{Fragment as m5,jsx as sa,jsxs as f5}from"react/jsx-runtime";var gy=()=>{let{linkingHint:e}=M(),{app:t}=x(),r=e?`Select the wallet with ${go(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return f5(m5,{children:[sa(P,{},"header"),sa(Br,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),sa(lr,{children:sa(Hn,{connectOnly:!1})}),sa(G,{protectedByPrivy:!0})]})};import{jsx as vy,jsxs as h5}from"react/jsx-runtime";var Cy=({style:e,...t})=>h5("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:[vy("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),vy("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as y5,jsx as Io,jsxs as wy}from"react/jsx-runtime";var by=()=>{let{closePrivyModal:e}=M(),{navigate:t}=x();return wy(y5,{children:[Io(P,{},"header"),Io(X,{}),Io(Cy,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Io(Br,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),wy(dr,{children:[Io(W,{onClick:()=>t("LANDING"),children:"Try again"}),Io(vr,{onClick:()=>e(),children:"Cancel"})]}),Io(ae,{}),Io(G,{protectedByPrivy:!0})]})};import n6 from"@heroicons/react/24/solid/CheckBadgeIcon";import i6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import a6 from"@heroicons/react/24/solid/IdentificationIcon";import s6 from"@heroicons/react/24/solid/PhoneIcon";import l6 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Dy from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as c6,useState as ai}from"react";import{useContext as g5}from"react";function la(){let{promptMfa:e,init:t,submit:r,cancel:o}=g5(ge);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as v5}from"react";function Sr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=v5(ge);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import C5 from"styled-components";import{jsx as Ey,jsxs as b5}from"react/jsx-runtime";var Py=e=>b5(w5,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Ey("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Ey("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"})]}),w5=C5.svg`
1858
+ `,d5=mr.button`
1859
+ ${c5}
1860
+ `;import p5 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as u5,jsx as Ro,jsxs as m5}from"react/jsx-runtime";var gy=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=S(),{initLoginWithSms:i}=M();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return m5(u5,{children:[Ro(T,{},"header"),Ro(X,{}),Ro(Ee,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Ro(p5,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Ro(dr,{children:Ro(ti,{stacked:!0,onSubmit:a})}),Ro(ae,{}),Ro(G,{protectedByPrivy:!0})]})};import{Fragment as f5,jsx as sa,jsxs as h5}from"react/jsx-runtime";var vy=()=>{let{linkingHint:e}=M(),{app:t}=S(),r=e?`Select the wallet with ${go(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return h5(f5,{children:[sa(T,{},"header"),sa(Br,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),sa(Cr,{children:sa(Hn,{connectOnly:!1})}),sa(G,{protectedByPrivy:!0})]})};import{jsx as Cy,jsxs as y5}from"react/jsx-runtime";var wy=({style:e,...t})=>y5("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:[Cy("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Cy("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as g5,jsx as Io,jsxs as by}from"react/jsx-runtime";var Ey=()=>{let{closePrivyModal:e}=M(),{navigate:t}=S();return by(g5,{children:[Io(T,{},"header"),Io(X,{}),Io(wy,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Io(Br,{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"}}),by(dr,{children:[Io(L,{onClick:()=>t("LANDING"),children:"Try again"}),Io(vr,{onClick:()=>e(),children:"Cancel"})]}),Io(ae,{}),Io(G,{protectedByPrivy:!0})]})};import i6 from"@heroicons/react/24/solid/CheckBadgeIcon";import a6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import s6 from"@heroicons/react/24/solid/IdentificationIcon";import l6 from"@heroicons/react/24/solid/PhoneIcon";import c6 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import Uy from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as d6,useState as ai}from"react";import{useContext as v5}from"react";function la(){let{promptMfa:e,init:t,submit:r,cancel:o}=v5(ge);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as C5}from"react";function xr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=C5(ge);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import w5 from"styled-components";import{jsx as Py,jsxs as E5}from"react/jsx-runtime";var Ty=e=>E5(b5,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Py("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Py("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"})]}),b5=w5.svg`
1856
1861
  height: 90px;
1857
1862
  width: 90px;
1858
1863
 
@@ -1863,7 +1868,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1863
1868
  > path {
1864
1869
  fill: white;
1865
1870
  }
1866
- `;import Td from"@heroicons/react/20/solid/CheckIcon";import E5 from"@heroicons/react/24/outline/ChevronRightIcon";import P5 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import T5 from"@heroicons/react/24/outline/FingerPrintIcon";import S5 from"@heroicons/react/24/outline/PhoneIcon";import Sd from"@heroicons/react/24/outline/TrashIcon";import x5 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as _5,jsx as ye,jsxs as Lt}from"react/jsx-runtime";var Ty=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let m=t.reduce((y,C)=>({...y,[C]:!0}),{}),h=r.reduce((y,C)=>({...y,[C]:!0}),{});return Lt(_5,{children:[ye(P,{backFn:e?s:void 0,onClose:l},"header"),ye(be,{children:ye(We,{children:ye(x5,{})})}),ye(ie,{children:"Choose a verification method"}),t.length>0?ye(se,{children:"To add or delete verification methods, verification is required."}):ye(se,{children:"How would you like to verify your identity? You can change this later."}),a&&ye(Zs,{style:{marginTop:"1.25rem"},children:a.message}),Lt(qs,{children:[(h.totp||m.totp)&&Lt($s,{children:[ye(Ae,{style:{justifyContent:"center"},disabled:m.totp||n,onClick:()=>c("totp"),children:n?ye(je,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Lt(Ys,{children:[Lt(js,{children:[ye(P5,{}),"Authenticator App"]}),m.totp?Lt(en,{children:[ye(Td,{}),"Added"]}):ye(en,{children:"Recommended"})]})}),m.totp&&ye(Ks,{onClick:()=>u("totp"),children:ye(Sd,{})})]},"totp"),(h.sms||m.sms)&&Lt($s,{children:[ye(Ae,{disabled:m.sms||o,onClick:()=>c("sms"),children:Lt(Ys,{children:[Lt(js,{children:[ye(S5,{}),"SMS"]}),m.sms&&Lt(en,{children:[ye(Td,{}),"Added"]}),o&&ye(en,{children:"Disabled"})]})}),m.sms&&ye(Ks,{onClick:()=>u("sms"),children:ye(Sd,{})})]},"sms"),(h.passkey||m.passkey)&&Lt($s,{children:[ye(Ae,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:m.passkey||i,children:i?ye(je,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Lt(Ys,{children:[Lt(js,{children:[ye(T5,{}),"Passkey"]}),m.passkey?Lt(en,{children:[ye(Td,{}),"Added"]}):ye(en,{isAccent:!0,children:ye(E5,{})})]})}),m.passkey&&ye(Ks,{onClick:()=>u("passkey"),children:ye(Sd,{})})]},"passkey")]}),ye(V,{})]})};import k5 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import A5 from"@heroicons/react/24/outline/ClockIcon";import R5 from"@heroicons/react/24/outline/ShieldCheckIcon";import I5 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as M5,useState as ca}from"react";import Ul from"styled-components";import{Fragment as xd,jsx as oe,jsxs as fr}from"react/jsx-runtime";var xy=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=F(),{data:n}=x(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=Sr(),[c,u]=ca(!1),[m,h]=ca(!1),[y,C]=ca(!1),[g,_]=ca(null),T=M5(()=>o?.linkedAccounts.filter(L=>L.type==="passkey")??[],[o]),w=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},k=async L=>{u(!0);try{await l(),await s({credentialIds:L}),C(!0)}catch(S){_(S)}finally{u(!1)}},R=async()=>{h(!0),_(null);try{await i();let S=(await a())?.linkedAccounts.filter(N=>N.type==="passkey").map(N=>N.credentialId)??[];await k(S)}catch(L){_(L)}finally{h(!1)}};return T.length===0||m?oe(W5,{onReset:r,onClose:t,onClick:R,isCreating:m}):y?oe(O5,{onClick:w,onClose:w}):g?oe(Qi,{error:g,backFn:()=>_(null),onClick:()=>_(null)}):oe(L5,{passkeys:T,isSubmitting:c,isCreating:m,onReset:r,onClose:t,onSubmitEnrollment:()=>k(T.map(L=>L.credentialId)),onAddPasskey:R})},W5=({onReset:e,onClose:t,onClick:r,isCreating:o})=>fr(xd,{children:[oe(P,{backFn:e,onClose:t},"header"),oe(be,{children:fr(Dl,{children:[oe(cn,{}),oe(dn,{})]})}),oe(ie,{children:"Set up paskey verification"}),fr(Xo,{children:[fr(It,{children:[oe(Rt,{children:oe(R5,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),fr(It,{children:[oe(Rt,{children:oe(A5,{})}),"Takes seconds to set up and use"]}),fr(It,{children:[oe(Rt,{children:oe(k5,{})}),"Use your passkey to verify transactions and login to your account"]})]}),oe(W,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),oe(V,{})]}),L5=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ca(!1),c=l?n.length:n.length>3?2:3;return fr(xd,{children:[oe(P,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&oe(be,{children:fr(Dl,{children:[oe(cn,{}),oe(dn,{})]})}),oe(ie,{children:"Enable your passkeys for verification"}),fr(Xo,{children:[n.slice(0,c).map(u=>fr(N5,{children:[oe(D5,{children:F5(u)}),fr(U5,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&oe(Sy,{onClick:()=>s(!0),children:"View All"})]}),oe(W,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&oe(Sy,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?oe(je,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),oe(V,{})]})},O5=({onClick:e,onClose:t})=>fr(xd,{children:[oe(P,{onClose:t},"header"),oe(be,{children:oe(We,{status:"success",children:oe(I5,{})})}),oe(ie,{children:"Passkey verification added"}),oe(se,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),oe(ut,{children:oe(W,{onClick:e,children:"Done"})}),oe(V,{})]}),N5=Ul.div`
1871
+ `;import Td from"@heroicons/react/20/solid/CheckIcon";import P5 from"@heroicons/react/24/outline/ChevronRightIcon";import T5 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import S5 from"@heroicons/react/24/outline/FingerPrintIcon";import x5 from"@heroicons/react/24/outline/PhoneIcon";import Sd from"@heroicons/react/24/outline/TrashIcon";import _5 from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as k5,jsx as ye,jsxs as Lt}from"react/jsx-runtime";var Sy=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let m=t.reduce((y,C)=>({...y,[C]:!0}),{}),h=r.reduce((y,C)=>({...y,[C]:!0}),{});return Lt(k5,{children:[ye(T,{backFn:e?s:void 0,onClose:l},"header"),ye(be,{children:ye(We,{children:ye(_5,{})})}),ye(ie,{children:"Choose a verification method"}),t.length>0?ye(se,{children:"To add or delete verification methods, verification is required."}):ye(se,{children:"How would you like to verify your identity? You can change this later."}),a&&ye(Zs,{style:{marginTop:"1.25rem"},children:a.message}),Lt(qs,{children:[(h.totp||m.totp)&&Lt($s,{children:[ye(Ae,{style:{justifyContent:"center"},disabled:m.totp||n,onClick:()=>c("totp"),children:n?ye(je,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Lt(Ys,{children:[Lt(js,{children:[ye(T5,{}),"Authenticator App"]}),m.totp?Lt(tn,{children:[ye(Td,{}),"Added"]}):ye(tn,{children:"Recommended"})]})}),m.totp&&ye(Ks,{onClick:()=>u("totp"),children:ye(Sd,{})})]},"totp"),(h.sms||m.sms)&&Lt($s,{children:[ye(Ae,{disabled:m.sms||o,onClick:()=>c("sms"),children:Lt(Ys,{children:[Lt(js,{children:[ye(x5,{}),"SMS"]}),m.sms&&Lt(tn,{children:[ye(Td,{}),"Added"]}),o&&ye(tn,{children:"Disabled"})]})}),m.sms&&ye(Ks,{onClick:()=>u("sms"),children:ye(Sd,{})})]},"sms"),(h.passkey||m.passkey)&&Lt($s,{children:[ye(Ae,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:m.passkey||i,children:i?ye(je,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):Lt(Ys,{children:[Lt(js,{children:[ye(S5,{}),"Passkey"]}),m.passkey?Lt(tn,{children:[ye(Td,{}),"Added"]}):ye(tn,{isAccent:!0,children:ye(P5,{})})]})}),m.passkey&&ye(Ks,{onClick:()=>u("passkey"),children:ye(Sd,{})})]},"passkey")]}),ye(V,{})]})};import A5 from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import R5 from"@heroicons/react/24/outline/ClockIcon";import I5 from"@heroicons/react/24/outline/ShieldCheckIcon";import M5 from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as W5,useState as ca}from"react";import Ul from"styled-components";import{Fragment as xd,jsx as oe,jsxs as fr}from"react/jsx-runtime";var _y=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=F(),{data:n}=S(),{initLinkWithPasskey:i,linkWithPasskey:a}=M(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=xr(),[c,u]=ca(!1),[m,h]=ca(!1),[y,C]=ca(!1),[g,x]=ca(null),E=W5(()=>o?.linkedAccounts.filter(O=>O.type==="passkey")??[],[o]),w=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},_=async O=>{u(!0);try{await l(),await s({credentialIds:O}),C(!0)}catch(W){x(W)}finally{u(!1)}},A=async()=>{h(!0),x(null);try{await i();let W=(await a())?.linkedAccounts.filter(R=>R.type==="passkey").map(R=>R.credentialId)??[];await _(W)}catch(O){x(O)}finally{h(!1)}};return E.length===0||m?oe(L5,{onReset:r,onClose:t,onClick:A,isCreating:m}):y?oe(N5,{onClick:w,onClose:w}):g?oe(Qi,{error:g,backFn:()=>x(null),onClick:()=>x(null)}):oe(O5,{passkeys:E,isSubmitting:c,isCreating:m,onReset:r,onClose:t,onSubmitEnrollment:()=>_(E.map(O=>O.credentialId)),onAddPasskey:A})},L5=({onReset:e,onClose:t,onClick:r,isCreating:o})=>fr(xd,{children:[oe(T,{backFn:e,onClose:t},"header"),oe(be,{children:fr(Dl,{children:[oe(dn,{}),oe(pn,{})]})}),oe(ie,{children:"Set up paskey verification"}),fr(en,{children:[fr(It,{children:[oe(Rt,{children:oe(I5,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),fr(It,{children:[oe(Rt,{children:oe(R5,{})}),"Takes seconds to set up and use"]}),fr(It,{children:[oe(Rt,{children:oe(A5,{})}),"Use your passkey to verify transactions and login to your account"]})]}),oe(L,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),oe(V,{})]}),O5=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=ca(!1),c=l?n.length:n.length>3?2:3;return fr(xd,{children:[oe(T,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&oe(be,{children:fr(Dl,{children:[oe(dn,{}),oe(pn,{})]})}),oe(ie,{children:"Enable your passkeys for verification"}),fr(en,{children:[n.slice(0,c).map(u=>fr(D5,{children:[oe(U5,{children:B5(u)}),fr(F5,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&oe(xy,{onClick:()=>s(!0),children:"View All"})]}),oe(L,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&oe(xy,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?oe(je,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),oe(V,{})]})},N5=({onClick:e,onClose:t})=>fr(xd,{children:[oe(T,{onClose:t},"header"),oe(be,{children:oe(We,{status:"success",children:oe(M5,{})})}),oe(ie,{children:"Passkey verification added"}),oe(se,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),oe(ut,{children:oe(L,{onClick:e,children:"Done"})}),oe(V,{})]}),D5=Ul.div`
1867
1872
  && {
1868
1873
  padding: 0.75rem 1rem;
1869
1874
  text-align: left;
@@ -1871,19 +1876,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1871
1876
  border: 1px solid var(--privy-color-foreground-4);
1872
1877
  width: 100%;
1873
1878
  }
1874
- `,D5=Ul.div`
1879
+ `,U5=Ul.div`
1875
1880
  font-size: 0.875rem;
1876
1881
  line-height: 1.375rem;
1877
1882
  font-weight: 500;
1878
1883
 
1879
1884
  color: var(--privy-color-foreground-1);
1880
- `,U5=Ul.div`
1885
+ `,F5=Ul.div`
1881
1886
  font-size: 0.75rem;
1882
1887
  font-weight: 400;
1883
1888
  line-height: 1.125rem;
1884
1889
 
1885
1890
  color: var(--privy-color-foreground-2);
1886
- `,F5=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",Sy=Ul.button`
1891
+ `,B5=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",xy=Ul.button`
1887
1892
  && {
1888
1893
  width: 100%;
1889
1894
  font-size: 0.875rem;
@@ -1908,7 +1913,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1908
1913
  box-shadow: none;
1909
1914
  }
1910
1915
  }
1911
- `;import X5 from"@heroicons/react/24/solid/CheckCircleIcon";import My from"@heroicons/react/24/solid/PhoneIcon";import{useState as Fl}from"react";import{useState as Ad}from"react";import{isMobile as q5}from"react-device-detect";import Iy from"styled-components";import{Dialog as _y,Transition as _d}from"@headlessui/react";import kd from"react";import ni from"styled-components";import{jsx as oi,jsxs as z5}from"react/jsx-runtime";var ky=({children:e,open:t,onClick:r,...o})=>oi(_d,{show:t,as:kd.Fragment,children:z5(_y,{onClose:r,...o,as:H5,children:[oi(_d.Child,{as:kd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:oi(B5,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),oi(G5,{children:oi(_d.Child,{as:kd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:oi(_y.Panel,{as:V5,children:e})})})]})}),ii=ni.div`
1916
+ `;import e6 from"@heroicons/react/24/solid/CheckCircleIcon";import Wy from"@heroicons/react/24/solid/PhoneIcon";import{useState as Fl}from"react";import{useState as Ad}from"react";import{isMobile as $5}from"react-device-detect";import My from"styled-components";import{Dialog as ky,Transition as _d}from"@headlessui/react";import kd from"react";import ni from"styled-components";import{jsx as oi,jsxs as q5}from"react/jsx-runtime";var Ay=({children:e,open:t,onClick:r,...o})=>oi(_d,{show:t,as:kd.Fragment,children:q5(ky,{onClose:r,...o,as:G5,children:[oi(_d.Child,{as:kd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:oi(H5,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),oi(V5,{children:oi(_d.Child,{as:kd.Fragment,enterFrom:"entering",leaveTo:"leaving",children:oi(ky.Panel,{as:z5,children:e})})})]})}),ii=ni.div`
1912
1917
  display: flex;
1913
1918
  flex-direction: column;
1914
1919
  text-align: center;
@@ -1931,7 +1936,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1931
1936
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1932
1937
  border-radius: var(--privy-border-radius-lg);
1933
1938
  }
1934
- `,B5=ni.div`
1939
+ `,H5=ni.div`
1935
1940
  position: fixed;
1936
1941
  inset: 0;
1937
1942
 
@@ -1944,10 +1949,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
1944
1949
  backdrop-filter: unset;
1945
1950
  -webkit-backdrop-filter: unset;
1946
1951
  }
1947
- `,H5=ni.div`
1952
+ `,G5=ni.div`
1948
1953
  position: relative;
1949
1954
  z-index: 999999;
1950
- `,G5=ni.div`
1955
+ `,V5=ni.div`
1951
1956
  position: fixed;
1952
1957
  inset: 0;
1953
1958
  display: flex;
@@ -1955,7 +1960,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1955
1960
  justify-content: center;
1956
1961
  width: 100vw;
1957
1962
  min-height: 100vh;
1958
- `,V5=ni.div`
1963
+ `,z5=ni.div`
1959
1964
  // reset some default dialog styles
1960
1965
  padding: 0;
1961
1966
  background: transparent;
@@ -2002,13 +2007,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2002
2007
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
2003
2008
  border-radius: var(--privy-border-radius-lg);
2004
2009
  }
2005
- `,Ay=ni.div`
2010
+ `,Ry=ni.div`
2006
2011
  display: flex;
2007
2012
  flex-direction: column;
2008
2013
  align-items: center;
2009
2014
  justify-content: center;
2010
2015
  height: 100%;
2011
- `;import{Fragment as Q5,jsx as da,jsxs as J5}from"react/jsx-runtime";var pa=6,$5=new Array(pa).fill("");function K5(e){return e.replace(/\s+/g,"")}function Rd(e){return/^[0-9]{1}$/.test(e)}function Ry(e){return e.length===pa&&e.every(Rd)}function j5(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var pn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Ad($5),[a,l]=Ad(null),[s,c]=Ad(null),u=async C=>{C.preventDefault();let g=K5(C.currentTarget.value);if(g==="")return;let _=j5(n,Rd),T=g.split(""),w=!T.every(Rd),k=T.length+_>pa;if(w){l("Passcode can only be numbers"),c(1);return}if(k){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let R=Number(C.currentTarget.name?.charAt(4)),L=[...g||[""]].slice(0,pa-R),S=[...n.slice(0,R),...L,...n.slice(R+L.length)];i(S);let N=L.length,$=Math.min(Math.max(R+N,0),pa-1);if(document.querySelector(`input[name=pin-${$}]`)?.focus(),Ry(S))try{await e(S.join("")),document.querySelector(`input[name=pin-${$}]`)?.blur()}catch(q){c(1),l(q.message)}else try{await e(null)}catch(q){c(1),l(q.message)}},m=C=>{s===1&&(l(null),c(null));let g=[...n.slice(0,C),"",...n.slice(C+1)];i(g),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),Ry(g)?e(g.join("")):e(null)},y=o?"success":!!(r||a)?"fail":"";return da(Q5,{children:J5(Y5,{children:[da("div",{children:n.map((C,g)=>da("input",{name:`pin-${g}`,type:"text",value:n[g],onChange:u,onKeyUp:_=>{_.key==="Backspace"&&m(g)},inputMode:"numeric",autoFocus:g===0,pattern:"[0-9]",className:y,autoComplete:q5?"one-time-code":"off",disabled:t},g))}),da("div",{children:da(Z5,{fail:!!r||!!a,children:r||a})})]})})},Y5=Iy.div`
2016
+ `;import{Fragment as X5,jsx as da,jsxs as Q5}from"react/jsx-runtime";var pa=6,K5=new Array(pa).fill("");function j5(e){return e.replace(/\s+/g,"")}function Rd(e){return/^[0-9]{1}$/.test(e)}function Iy(e){return e.length===pa&&e.every(Rd)}function Y5(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var un=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Ad(K5),[a,l]=Ad(null),[s,c]=Ad(null),u=async C=>{C.preventDefault();let g=j5(C.currentTarget.value);if(g==="")return;let x=Y5(n,Rd),E=g.split(""),w=!E.every(Rd),_=E.length+x>pa;if(w){l("Passcode can only be numbers"),c(1);return}if(_){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let A=Number(C.currentTarget.name?.charAt(4)),O=[...g||[""]].slice(0,pa-A),W=[...n.slice(0,A),...O,...n.slice(A+O.length)];i(W);let R=O.length,q=Math.min(Math.max(A+R,0),pa-1);if(document.querySelector(`input[name=pin-${q}]`)?.focus(),Iy(W))try{await e(W.join("")),document.querySelector(`input[name=pin-${q}]`)?.blur()}catch($){c(1),l($.message)}else try{await e(null)}catch($){c(1),l($.message)}},m=C=>{s===1&&(l(null),c(null));let g=[...n.slice(0,C),"",...n.slice(C+1)];i(g),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),Iy(g)?e(g.join("")):e(null)},y=o?"success":!!(r||a)?"fail":"";return da(X5,{children:Q5(Z5,{children:[da("div",{children:n.map((C,g)=>da("input",{name:`pin-${g}`,type:"text",value:n[g],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&m(g)},inputMode:"numeric",autoFocus:g===0,pattern:"[0-9]",className:y,autoComplete:$5?"one-time-code":"off",disabled:t},g))}),da("div",{children:da(J5,{fail:!!r||!!a,children:r||a})})]})})},Z5=My.div`
2012
2017
  display: flex;
2013
2018
  flex-direction: column;
2014
2019
  width: 100%;
@@ -2079,7 +2084,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2079
2084
  transform: translate(1px, 0px);
2080
2085
  }
2081
2086
  }
2082
- `,Z5=Iy.div`
2087
+ `,J5=My.div`
2083
2088
  line-height: 20px;
2084
2089
  font-size: 13px;
2085
2090
  display: flex;
@@ -2087,7 +2092,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2087
2092
  width: 100%;
2088
2093
 
2089
2094
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2090
- `;import{Fragment as Id,jsx as xe,jsxs as un}from"react/jsx-runtime";var Wy=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Fl(""),[i,a]=Fl(!1),[l,s]=Fl(null),[c,u]=Fl("enroll"),{initEnrollmentWithSms:m,submitEnrollmentWithSms:h}=Sr(),{app:y,data:C}=x();function g(){C?.mfaEnrollmentFlow?.onSuccess(),e()}async function _({qualifiedPhoneNumber:k}){try{await m({phoneNumber:k}),n(k),u("verify")}catch(R){s(R)}}async function T(k){try{if(!k)return;await h({phoneNumber:o,mfaCode:k}),a(!0)}catch(R){throw nl(R)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):nn(R)?new Error("The code you entered is not valid"):on(R)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):il(R)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){c==="verify"?u("enroll"):t()}return l?xe(Qi,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?un(Id,{children:[xe(P,{backFn:t,onClose:r},"header"),xe(be,{children:xe(We,{children:xe(My,{})})}),xe(ie,{children:"Set up SMS verification"}),xe(se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),un(cr,{children:[xe(ti,{onSubmit:_}),un(km,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),xe(V,{})]}):i?un(Id,{children:[xe(P,{onClose:g},"header"),xe(be,{children:xe(We,{status:"success",children:xe(X5,{})})}),xe(ie,{children:"SMS verification added"}),xe(se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),xe(ut,{children:xe(W,{onClick:g,children:"Done"})}),xe(V,{})]}):un(Id,{children:[xe(P,{backFn:w,onClose:r},"header"),xe(be,{children:xe(We,{children:xe(My,{})})}),xe(ie,{children:"Enter enrollment code"}),un(cr,{children:[xe(pn,{onChange:T}),un(se,{children:["To continue, enter the 6-digit code sent to ",xe("strong",{children:qh(o)})]})]}),xe(V,{})]})};import r6 from"@heroicons/react/24/solid/CheckCircleIcon";import o6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as Oy}from"react";import e6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as t6}from"react/jsx-runtime";var Ly=({size:e,authUrl:t})=>t6(ei,{url:t,squareLogoElement:e6,size:e,fgColor:"#1F1F1F"});import{Fragment as Md,jsx as Pe,jsxs as ua}from"react/jsx-runtime";var Ny=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=Oy("enroll"),[a,l]=Oy(!1),{submitEnrollmentWithTotp:s}=Sr(),{data:c}=x();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function m(){i("verify")}async function h(C){try{if(!C)return;await s({mfaCode:C}),l(!0)}catch(g){throw nl(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):nn(g)?new Error("The code you entered is not valid"):on(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):il(g)?new Error("Verification canceled"):new Error("Unknown error")}}function y(){n==="verify"?i("enroll"):r()}return n==="enroll"?ua(Md,{children:[Pe(P,{backFn:r,onClose:t},"header"),Pe(ie,{children:"Scan QR code"}),Pe(se,{children:"Open your authenticator app and scan the QR code to continue."}),Pe(Nn,{children:Pe(Ly,{authUrl:o.authUrl,size:200})}),ua(ut,{children:[Pe(bt,{children:Pe(_o,{itemName:"secret",text:o.secret})}),Pe(W,{onClick:m,children:"Continue"})]}),Pe(V,{})]}):a?ua(Md,{children:[Pe(P,{onClose:u},"header"),Pe(be,{children:Pe(We,{status:"success",children:Pe(r6,{})})}),Pe(ie,{children:"Authenticator app verification added"}),Pe(se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Pe(ut,{children:Pe(W,{onClick:u,children:"Done"})}),Pe(V,{})]}):ua(Md,{children:[Pe(P,{backFn:y,onClose:t},"header"),Pe(be,{children:Pe(We,{children:Pe(o6,{})})}),Pe(ie,{children:"Enter enrollment code"}),Pe(cr,{children:Pe(pn,{onChange:h})}),ua(se,{children:["To continue, enter the 6-digit code generated from your ",Pe("strong",{children:"authenticator app"})]}),Pe(V,{})]})};import{Fragment as si,jsx as z,jsxs as $t}from"react/jsx-runtime";var Uy=()=>{let{user:e,enrollInMfa:t}=F(),[r,o]=ai(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=Sr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=x(),{closePrivyModal:m}=M(),{promptMfa:h}=la(),{initEnrollmentWithTotp:y}=Sr(),[C,g]=ai(!1),[_,T]=ai(null),[w,k]=ai(null),R=()=>{m({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),T(null)},500)},{initEnrollmentWithPasskey:L,submitEnrollmentWithPasskey:S}=Sr(),[N,$]=ai(!1),[K,q]=ai(null);u.current=R;let I=e?.mfaMethods.includes("sms"),Z=!!e?.phone,U=e?.mfaMethods.includes("totp"),ue=e?.mfaMethods.includes("passkey"),re=I||U||ue,ce=e?.linkedAccounts.filter(He=>He.type==="passkey").map(He=>He.credentialId)??[];c6(()=>{re&&g(!0)},[re]);function fe(){o(null),T(null)}function Q(){g(!1)}async function et(){$(!0);try{await L(),await S({credentialIds:ce})}catch(He){q(He)}finally{$(!1)}}async function tt(He){if(await h().catch(q),He==="totp"){T(He),k(null),y().then(er=>{k(er)}).catch(()=>{k(null),fe()});return}if(He==="passkey"&&ce.length===1)return await et();T(He)}if(!s||!e||!l)return $t(si,{children:[z(P,{onClose:R},"header"),z(be,{children:z(Py,{})}),z(cr,{children:z(je,{})}),z(V,{})]});async function xt(){o(null);try{await n()}catch{o(null)}}async function ze(){o(null);try{await i()}catch{o(null)}}async function Xt(){o(null);try{await h(),await a()}catch{o(null)}}if(r==="sms")return $t(si,{children:[z(P,{backFn:fe,onClose:R},"header"),z(be,{children:z(We,{children:z(s6,{})})}),z(ie,{children:"Remove SMS verification?"}),$t(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(ut,{children:z(W,{warn:!0,onClick:xt,children:"Remove SMS for MFA"})}),z(V,{})]});if(r==="totp")return $t(si,{children:[z(P,{backFn:fe,onClose:R},"header"),z(be,{children:z(We,{children:z(i6,{})})}),z(ie,{children:"Remove Authenticator App verification?"}),$t(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(ut,{children:z(W,{warn:!0,onClick:ze,children:"Remove Authenticator App for MFA"})}),z(V,{})]});if(r==="passkey")return $t(si,{children:[z(P,{backFn:fe,onClose:R},"header"),z(be,{children:z(We,{children:z(l6,{})})}),z(ie,{children:"Are you sure you want to remove passkey verification?"}),z(se,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),z(ut,{children:z(W,{warn:!0,onClick:Xt,children:"Yes, remove"})}),z(V,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!re)return $t(si,{children:[z(P,{onClose:R},"header"),z(be,{children:z(We,{children:z(Dy,{})})}),z(ie,{children:"Add more security"}),$t(se,{children:[l?.name," does not have any verification methods enabled."]}),z(ut,{children:z(W,{onClick:R,children:"Close"})}),z(V,{})]});let _e=!re&&!C;return _e?$t(si,{children:[z(P,{onClose:R},"header"),z(be,{children:z(We,{children:z(Dy,{})})}),z(ie,{children:"Transaction Protection"}),z(se,{children:"Set up transaction protection to add an extra layer of security to your account"}),$t(Xo,{children:[$t(It,{children:[z(Rt,{children:z(n6,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),$t(It,{children:[z(Rt,{children:z(a6,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),$t(ut,{children:[z(W,{onClick:()=>g(!0),children:"Continue"}),z(vr,{onClick:R,children:"Not now"})]}),z(V,{})]}):_==="sms"?z(Wy,{onComplete:R,onReset:fe,onClose:R}):_==="totp"&&w?z(Ny,{onComplete:R,onClose:R,onReset:fe,totpInfo:w}):_==="passkey"?z(xy,{onComplete:R,onReset:fe,onClose:R}):z(Ty,{showIntro:_e,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:Z,onBackToIntro:Q,handleSelectMethod:tt,isTotpLoading:_==="totp"&&!w,isPasskeyLoading:N,error:K,onClose:R,setRemovingMfaMethod:o})};import l7 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import c7 from"@heroicons/react/24/outline/FingerPrintIcon";import d7 from"@heroicons/react/24/outline/PhoneIcon";import p7 from"@heroicons/react/24/outline/ShieldCheckIcon";import u7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import m7 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as f7,useState as ba}from"react";import{useMemo as t7,useEffect as r7,useState as S1}from"react";import o7 from"styled-components";import a1 from"styled-components";import By from"styled-components";import{jsx as Fy,jsxs as u6}from"react/jsx-runtime";var Bl=({label:e,children:t,valueStyles:r})=>u6(d6,{children:[Fy("div",{children:e}),Fy(p6,{style:{...r},children:t})]}),d6=By.div`
2095
+ `;import{Fragment as Id,jsx as xe,jsxs as mn}from"react/jsx-runtime";var Ly=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Fl(""),[i,a]=Fl(!1),[l,s]=Fl(null),[c,u]=Fl("enroll"),{initEnrollmentWithSms:m,submitEnrollmentWithSms:h}=xr(),{app:y,data:C}=S();function g(){C?.mfaEnrollmentFlow?.onSuccess(),e()}async function x({qualifiedPhoneNumber:_}){try{await m({phoneNumber:_}),n(_),u("verify")}catch(A){s(A)}}async function E(_){try{if(!_)return;await h({phoneNumber:o,mfaCode:_}),a(!0)}catch(A){throw nl(A)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(A)?new Error("The code you entered is not valid"):nn(A)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):il(A)?new Error("Verification canceled"):new Error("Unknown error")}}function w(){c==="verify"?u("enroll"):t()}return l?xe(Qi,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?mn(Id,{children:[xe(T,{backFn:t,onClose:r},"header"),xe(be,{children:xe(We,{children:xe(Wy,{})})}),xe(ie,{children:"Set up SMS verification"}),xe(se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),mn(cr,{children:[xe(ti,{onSubmit:x}),mn(Am,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),xe(V,{})]}):i?mn(Id,{children:[xe(T,{onClose:g},"header"),xe(be,{children:xe(We,{status:"success",children:xe(e6,{})})}),xe(ie,{children:"SMS verification added"}),xe(se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),xe(ut,{children:xe(L,{onClick:g,children:"Done"})}),xe(V,{})]}):mn(Id,{children:[xe(T,{backFn:w,onClose:r},"header"),xe(be,{children:xe(We,{children:xe(Wy,{})})}),xe(ie,{children:"Enter enrollment code"}),mn(cr,{children:[xe(un,{onChange:E}),mn(se,{children:["To continue, enter the 6-digit code sent to ",xe("strong",{children:$h(o)})]})]}),xe(V,{})]})};import o6 from"@heroicons/react/24/solid/CheckCircleIcon";import n6 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as Ny}from"react";import t6 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as r6}from"react/jsx-runtime";var Oy=({size:e,authUrl:t})=>r6(ei,{url:t,squareLogoElement:t6,size:e,fgColor:"#1F1F1F"});import{Fragment as Md,jsx as Pe,jsxs as ua}from"react/jsx-runtime";var Dy=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=Ny("enroll"),[a,l]=Ny(!1),{submitEnrollmentWithTotp:s}=xr(),{data:c}=S();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function m(){i("verify")}async function h(C){try{if(!C)return;await s({mfaCode:C}),l(!0)}catch(g){throw nl(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):an(g)?new Error("The code you entered is not valid"):nn(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):il(g)?new Error("Verification canceled"):new Error("Unknown error")}}function y(){n==="verify"?i("enroll"):r()}return n==="enroll"?ua(Md,{children:[Pe(T,{backFn:r,onClose:t},"header"),Pe(ie,{children:"Scan QR code"}),Pe(se,{children:"Open your authenticator app and scan the QR code to continue."}),Pe(Nn,{children:Pe(Oy,{authUrl:o.authUrl,size:200})}),ua(ut,{children:[Pe(bt,{children:Pe(_o,{itemName:"secret",text:o.secret})}),Pe(L,{onClick:m,children:"Continue"})]}),Pe(V,{})]}):a?ua(Md,{children:[Pe(T,{onClose:u},"header"),Pe(be,{children:Pe(We,{status:"success",children:Pe(o6,{})})}),Pe(ie,{children:"Authenticator app verification added"}),Pe(se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Pe(ut,{children:Pe(L,{onClick:u,children:"Done"})}),Pe(V,{})]}):ua(Md,{children:[Pe(T,{backFn:y,onClose:t},"header"),Pe(be,{children:Pe(We,{children:Pe(n6,{})})}),Pe(ie,{children:"Enter enrollment code"}),Pe(cr,{children:Pe(un,{onChange:h})}),ua(se,{children:["To continue, enter the 6-digit code generated from your ",Pe("strong",{children:"authenticator app"})]}),Pe(V,{})]})};import{Fragment as si,jsx as z,jsxs as $t}from"react/jsx-runtime";var Fy=()=>{let{user:e,enrollInMfa:t}=F(),[r,o]=ai(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=xr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=S(),{closePrivyModal:m}=M(),{promptMfa:h}=la(),{initEnrollmentWithTotp:y}=xr(),[C,g]=ai(!1),[x,E]=ai(null),[w,_]=ai(null),A=()=>{m({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),E(null)},500)},{initEnrollmentWithPasskey:O,submitEnrollmentWithPasskey:W}=xr(),[R,q]=ai(!1),[K,$]=ai(null);u.current=A;let I=e?.mfaMethods.includes("sms"),Z=!!e?.phone,U=e?.mfaMethods.includes("totp"),ue=e?.mfaMethods.includes("passkey"),re=I||U||ue,ce=e?.linkedAccounts.filter(He=>He.type==="passkey").map(He=>He.credentialId)??[];d6(()=>{re&&g(!0)},[re]);function fe(){o(null),E(null)}function Q(){g(!1)}async function et(){q(!0);try{await O(),await W({credentialIds:ce})}catch(He){$(He)}finally{q(!1)}}async function tt(He){if(await h().catch($),He==="totp"){E(He),_(null),y().then(er=>{_(er)}).catch(()=>{_(null),fe()});return}if(He==="passkey"&&ce.length===1)return await et();E(He)}if(!s||!e||!l)return $t(si,{children:[z(T,{onClose:A},"header"),z(be,{children:z(Ty,{})}),z(cr,{children:z(je,{})}),z(V,{})]});async function xt(){o(null);try{await n()}catch{o(null)}}async function ze(){o(null);try{await i()}catch{o(null)}}async function Xt(){o(null);try{await h(),await a()}catch{o(null)}}if(r==="sms")return $t(si,{children:[z(T,{backFn:fe,onClose:A},"header"),z(be,{children:z(We,{children:z(l6,{})})}),z(ie,{children:"Remove SMS verification?"}),$t(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(ut,{children:z(L,{warn:!0,onClick:xt,children:"Remove SMS for MFA"})}),z(V,{})]});if(r==="totp")return $t(si,{children:[z(T,{backFn:fe,onClose:A},"header"),z(be,{children:z(We,{children:z(a6,{})})}),z(ie,{children:"Remove Authenticator App verification?"}),$t(se,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),z(ut,{children:z(L,{warn:!0,onClick:ze,children:"Remove Authenticator App for MFA"})}),z(V,{})]});if(r==="passkey")return $t(si,{children:[z(T,{backFn:fe,onClose:A},"header"),z(be,{children:z(We,{children:z(c6,{})})}),z(ie,{children:"Are you sure you want to remove passkey verification?"}),z(se,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),z(ut,{children:z(L,{warn:!0,onClick:Xt,children:"Yes, remove"})}),z(V,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!re)return $t(si,{children:[z(T,{onClose:A},"header"),z(be,{children:z(We,{children:z(Uy,{})})}),z(ie,{children:"Add more security"}),$t(se,{children:[l?.name," does not have any verification methods enabled."]}),z(ut,{children:z(L,{onClick:A,children:"Close"})}),z(V,{})]});let _e=!re&&!C;return _e?$t(si,{children:[z(T,{onClose:A},"header"),z(be,{children:z(We,{children:z(Uy,{})})}),z(ie,{children:"Transaction Protection"}),z(se,{children:"Set up transaction protection to add an extra layer of security to your account"}),$t(en,{children:[$t(It,{children:[z(Rt,{children:z(i6,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),$t(It,{children:[z(Rt,{children:z(s6,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),$t(ut,{children:[z(L,{onClick:()=>g(!0),children:"Continue"}),z(vr,{onClick:A,children:"Not now"})]}),z(V,{})]}):x==="sms"?z(Ly,{onComplete:A,onReset:fe,onClose:A}):x==="totp"&&w?z(Dy,{onComplete:A,onClose:A,onReset:fe,totpInfo:w}):x==="passkey"?z(_y,{onComplete:A,onReset:fe,onClose:A}):z(Sy,{showIntro:_e,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:Z,onBackToIntro:Q,handleSelectMethod:tt,isTotpLoading:x==="totp"&&!w,isPasskeyLoading:R,error:K,onClose:A,setRemovingMfaMethod:o})};import c7 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import d7 from"@heroicons/react/24/outline/FingerPrintIcon";import p7 from"@heroicons/react/24/outline/PhoneIcon";import u7 from"@heroicons/react/24/outline/ShieldCheckIcon";import m7 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import f7 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as h7,useState as ba}from"react";import{useMemo as r7,useEffect as o7,useState as x1}from"react";import n7 from"styled-components";import s1 from"styled-components";import Hy from"styled-components";import{jsx as By,jsxs as m6}from"react/jsx-runtime";var Bl=({label:e,children:t,valueStyles:r})=>m6(p6,{children:[By("div",{children:e}),By(u6,{style:{...r},children:t})]}),p6=Hy.div`
2091
2096
  display: flex;
2092
2097
  align-items: center;
2093
2098
  justify-content: space-between;
@@ -2102,7 +2107,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2102
2107
  color: var(--privy-color-foreground-2);
2103
2108
  text-align: right;
2104
2109
  }
2105
- `,p6=By.div`
2110
+ `,u6=Hy.div`
2106
2111
  font-size: 14px;
2107
2112
  line-height: 100%;
2108
2113
  display: flex;
@@ -2111,28 +2116,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2111
2116
  border-radius: var(--privy-border-radius-full);
2112
2117
  background-color: var(--privy-color-background-2);
2113
2118
  padding: 4px 8px;
2114
- `;import Gl from"styled-components";import{BigNumber as Hy}from"@ethersproject/bignumber";import{formatEther as Gy}from"@ethersproject/units";var ma=(e,t)=>{let r=(t*parseFloat(Gy(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},$r=(e,t,r=6,o=!1)=>{let i=parseFloat(Gy(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Wd=e=>e.map(yt).reduce((t,r)=>t.add(r),Hy.from(0)).toHexString(),Vy=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${du(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},yt=e=>Hy.from(e);import{Fragment as y6,jsx as Hl,jsxs as zy}from"react/jsx-runtime";var qy=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wd(e),n=t?ma(o,t):void 0,i=$r(o,r);return Hl($y,{children:n||i})},Ld=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wd(e),n=t?ma(o,t):void 0,i=$r(o,r);return Hl($y,{children:n?zy(y6,{children:[Hl(m6,{children:"USD"}),n==="<$0.01"?zy(h6,{children:[Hl(f6,{children:"<"}),"$0.01"]}):n]}):i})},$y=Gl.span`
2119
+ `;import Gl from"styled-components";import{BigNumber as Gy}from"@ethersproject/bignumber";import{formatEther as Vy}from"@ethersproject/units";var ma=(e,t)=>{let r=(t*parseFloat(Vy(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},$r=(e,t,r=6,o=!1)=>{let i=parseFloat(Vy(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Wd=e=>e.map(yt).reduce((t,r)=>t.add(r),Gy.from(0)).toHexString(),zy=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${du(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},yt=e=>Gy.from(e);import{Fragment as g6,jsx as Hl,jsxs as qy}from"react/jsx-runtime";var $y=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wd(e),n=t?ma(o,t):void 0,i=$r(o,r);return Hl(Ky,{children:n||i})},Ld=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wd(e),n=t?ma(o,t):void 0,i=$r(o,r);return Hl(Ky,{children:n?qy(g6,{children:[Hl(f6,{children:"USD"}),n==="<$0.01"?qy(y6,{children:[Hl(h6,{children:"<"}),"$0.01"]}):n]}):i})},Ky=Gl.span`
2115
2120
  font-size: 14px;
2116
2121
  line-height: 140%;
2117
2122
  display: flex;
2118
2123
  gap: 4px;
2119
2124
  align-items: center;
2120
- `,m6=Gl.span`
2125
+ `,f6=Gl.span`
2121
2126
  font-size: 12px;
2122
2127
  line-height: 12px;
2123
2128
  color: var(--privy-color-foreground-3);
2124
- `,f6=Gl.span`
2125
- font-size: 10px;
2126
2129
  `,h6=Gl.span`
2130
+ font-size: 10px;
2131
+ `,y6=Gl.span`
2127
2132
  display: flex;
2128
2133
  align-items: center;
2129
- `;import Od from"styled-components";import{jsx as Mo,jsxs as Vl}from"react/jsx-runtime";var Ky=({gas:e,tokenPrice:t,tokenSymbol:r})=>Vl(Hc,{style:{paddingBottom:"12px"},children:[Vl(Yy,{children:[Mo(Jy,{children:"Est. Fees"}),Mo("div",{children:Mo(Ld,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&Mo(Zy,{children:`${$r(e,r)}`})]}),jy=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=yt(e.value||0).add(yt(t)).toHexString();return Vl(Hc,{children:[Vl(Yy,{children:[Mo(Jy,{children:"Total (including fees)"}),Mo("div",{children:Mo(Ld,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&Mo(Zy,{children:$r(n,o)})]})},Yy=Od.div`
2134
+ `;import Od from"styled-components";import{jsx as Mo,jsxs as Vl}from"react/jsx-runtime";var jy=({gas:e,tokenPrice:t,tokenSymbol:r})=>Vl(Hc,{style:{paddingBottom:"12px"},children:[Vl(Zy,{children:[Mo(Qy,{children:"Est. Fees"}),Mo("div",{children:Mo(Ld,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&Mo(Jy,{children:`${$r(e,r)}`})]}),Yy=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=yt(e.value||0).add(yt(t)).toHexString();return Vl(Hc,{children:[Vl(Zy,{children:[Mo(Qy,{children:"Total (including fees)"}),Mo("div",{children:Mo(Ld,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&Mo(Jy,{children:$r(n,o)})]})},Zy=Od.div`
2130
2135
  display: flex;
2131
2136
  flex-direction: row;
2132
2137
  justify-content: space-between;
2133
2138
  align-items: center;
2134
2139
  padding-top: 4px;
2135
- `,Zy=Od.div`
2140
+ `,Jy=Od.div`
2136
2141
  display: flex;
2137
2142
  flex-direction: row;
2138
2143
  height: 12px;
@@ -2141,23 +2146,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2141
2146
  line-height: 12px;
2142
2147
  color: var(--privy-color-foreground-3);
2143
2148
  font-weight: 400;
2144
- `,Jy=Od.div`
2149
+ `,Qy=Od.div`
2145
2150
  font-size: 14px;
2146
2151
  line-height: 22.4px;
2147
2152
  font-weight: 400;
2148
- `;import g6 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as mn,useState as v6}from"react";import Wo from"styled-components";import{createContext as Qy,useContext as sV}from"react";var li=Qy(void 0);var fa=Qy(void 0);import{Fragment as x6,jsx as xr,jsxs as Xy}from"react/jsx-runtime";var e1=({defaultValue:e,children:t})=>{let[r,o]=v6(e||null),n=i=>{o(r===i?null:i)};return xr(li.Provider,{value:{activePanel:r,togglePanel:n},children:xr(C6,{children:t})})},t1=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=mn(li),n=r===e;return xr(fa.Provider,{value:{onToggle:()=>o(e),value:e},children:xr(P6,{isActive:n,"data-open":n,children:t})})},r1=({children:e})=>{let{activePanel:t}=mn(li),{onToggle:r,value:o}=mn(fa),n=t===o;return Xy(x6,{children:[Xy(w6,{onClick:r,"data-open":n,children:[xr(E6,{children:e}),xr(S6,{isactive:n,children:xr(g6,{height:"16px",width:"16px",strokeWidth:"2"})})]}),xr(b6,{})]})},o1=({children:e})=>{let{activePanel:t}=mn(li),{value:r}=mn(fa);return xr(T6,{"data-open":t===r,children:xr(i1,{children:e})})},n1=({children:e})=>{let{activePanel:t}=mn(li),{value:r}=mn(fa);return xr(i1,{children:typeof e=="function"?e({isActive:t===r}):e})},C6=Wo.div`
2153
+ `;import v6 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as fn,useState as C6}from"react";import Wo from"styled-components";import{createContext as Xy,useContext as cV}from"react";var li=Xy(void 0);var fa=Xy(void 0);import{Fragment as _6,jsx as _r,jsxs as e1}from"react/jsx-runtime";var t1=({defaultValue:e,children:t})=>{let[r,o]=C6(e||null),n=i=>{o(r===i?null:i)};return _r(li.Provider,{value:{activePanel:r,togglePanel:n},children:_r(w6,{children:t})})},r1=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=fn(li),n=r===e;return _r(fa.Provider,{value:{onToggle:()=>o(e),value:e},children:_r(T6,{isActive:n,"data-open":n,children:t})})},o1=({children:e})=>{let{activePanel:t}=fn(li),{onToggle:r,value:o}=fn(fa),n=t===o;return e1(_6,{children:[e1(b6,{onClick:r,"data-open":n,children:[_r(P6,{children:e}),_r(x6,{isactive:n,children:_r(v6,{height:"16px",width:"16px",strokeWidth:"2"})})]}),_r(E6,{})]})},n1=({children:e})=>{let{activePanel:t}=fn(li),{value:r}=fn(fa);return _r(S6,{"data-open":t===r,children:_r(a1,{children:e})})},i1=({children:e})=>{let{activePanel:t}=fn(li),{value:r}=fn(fa);return _r(a1,{children:typeof e=="function"?e({isActive:t===r}):e})},w6=Wo.div`
2149
2154
  display: flex;
2150
2155
  flex-direction: column;
2151
2156
  width: 100%;
2152
2157
  gap: 8px;
2153
- `,w6=Wo.div`
2158
+ `,b6=Wo.div`
2154
2159
  display: flex;
2155
2160
  justify-content: space-between;
2156
2161
  align-items: center;
2157
2162
  width: 100%;
2158
2163
  cursor: pointer;
2159
2164
  padding-bottom: 8px;
2160
- `,b6=Wo.div`
2165
+ `,E6=Wo.div`
2161
2166
  width: 100%;
2162
2167
 
2163
2168
  && {
@@ -2165,13 +2170,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2165
2170
  border-color: var(--privy-color-foreground-4);
2166
2171
  }
2167
2172
  padding-bottom: 12px;
2168
- `,E6=Wo.div`
2173
+ `,P6=Wo.div`
2169
2174
  font-size: 14px;
2170
2175
  font-weight: 500;
2171
2176
  line-height: 19.6px;
2172
2177
  width: 100%;
2173
2178
  padding-right: 8px;
2174
- `,P6=Wo.div`
2179
+ `,T6=Wo.div`
2175
2180
  display: flex;
2176
2181
  flex-direction: column;
2177
2182
  width: 100%;
@@ -2183,7 +2188,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2183
2188
  border-color: var(--privy-color-foreground-4);
2184
2189
  border-radius: var(--privy-border-radius-md);
2185
2190
  }
2186
- `,T6=Wo.div`
2191
+ `,S6=Wo.div`
2187
2192
  position: relative;
2188
2193
  overflow: hidden;
2189
2194
  transition: max-height 25ms ease-out;
@@ -2195,38 +2200,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
2195
2200
  &[data-open='false'] {
2196
2201
  max-height: 0;
2197
2202
  }
2198
- `,i1=Wo.div`
2203
+ `,a1=Wo.div`
2199
2204
  display: flex;
2200
2205
  flex-direction: column;
2201
2206
  gap: 12px;
2202
2207
  flex: 1 1 auto;
2203
2208
  min-height: 1px;
2204
- `,S6=Wo.div`
2209
+ `,x6=Wo.div`
2205
2210
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2206
- `;import _6 from"styled-components";import{jsx as A6}from"react/jsx-runtime";var Nd=({walletAddress:e,chainId:t=Qr})=>A6(k6,{href:Vy(t,e),target:"_blank",children:go(e)}),k6=_6.a`
2211
+ `;import k6 from"styled-components";import{jsx as R6}from"react/jsx-runtime";var Nd=({walletAddress:e,chainId:t=Qr})=>R6(A6,{href:zy(t,e),target:"_blank",children:go(e)}),A6=k6.a`
2207
2212
  &:hover {
2208
2213
  text-decoration: underline;
2209
2214
  }
2210
- `;import{jsx as Kt,jsxs as Dd}from"react/jsx-runtime";var ci=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return Kt(e1,{children:Dd(t1,{value:"details",children:[Kt(r1,{children:Dd(R6,{children:[Kt("div",{children:o?.title||o?.actionDescription||"Details"}),Kt(I6,{children:Kt(qy,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Dd(o1,{children:[Kt(Bl,{label:"From",children:Kt(Nd,{walletAddress:e,chainId:r.chainId||Qr})}),Kt(Bl,{label:"To",children:Kt(Nd,{walletAddress:t,chainId:r.chainId||Qr})}),o&&o.action&&Kt(Bl,{label:"Action",children:o.action}),i&&Kt(Ky,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),Kt(n1,{children:({isActive:s})=>Kt(jy,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},R6=a1.div`
2215
+ `;import{jsx as Kt,jsxs as Dd}from"react/jsx-runtime";var ci=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return Kt(t1,{children:Dd(r1,{value:"details",children:[Kt(o1,{children:Dd(I6,{children:[Kt("div",{children:o?.title||o?.actionDescription||"Details"}),Kt(M6,{children:Kt($y,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Dd(n1,{children:[Kt(Bl,{label:"From",children:Kt(Nd,{walletAddress:e,chainId:r.chainId||Qr})}),Kt(Bl,{label:"To",children:Kt(Nd,{walletAddress:t,chainId:r.chainId||Qr})}),o&&o.action&&Kt(Bl,{label:"Action",children:o.action}),i&&Kt(jy,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),Kt(i1,{children:({isActive:s})=>Kt(Yy,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},I6=s1.div`
2211
2216
  display: flex;
2212
2217
  flex-direction: row;
2213
2218
  justify-content: space-between;
2214
- `,I6=a1.div`
2219
+ `,M6=s1.div`
2215
2220
  flex-shrink: 0;
2216
2221
  padding-left: 8px;
2217
- `;import ya from"styled-components";import{jsx as ha,jsxs as D6}from"react/jsx-runtime";var Ud=({description:e,contractInfo:t})=>D6(M6,{children:[t.imgUrl&&ha(W6,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&ha(L6,{children:ha("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&ha(O6,{children:t.name}),ha(N6,{children:e||t.actionText})]}),M6=ya.div`
2222
+ `;import ya from"styled-components";import{jsx as ha,jsxs as U6}from"react/jsx-runtime";var Ud=({description:e,contractInfo:t})=>U6(W6,{children:[t.imgUrl&&ha(L6,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&ha(O6,{children:ha("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&ha(N6,{children:t.name}),ha(D6,{children:e||t.actionText})]}),W6=ya.div`
2218
2223
  display: flex;
2219
2224
  flex-direction: column;
2220
2225
  align-items: center;
2221
2226
  margin-bottom: 8px;
2222
- `,W6=ya.img`
2227
+ `,L6=ya.img`
2223
2228
  && {
2224
2229
  height: ${e=>e.size==="sm"?"65px":"140px"};
2225
2230
  width: ${e=>e.size==="sm"?"65px":"140px"};
2226
2231
  border-radius: 16px;
2227
2232
  margin-bottom: 12px;
2228
2233
  }
2229
- `,L6=ya.div`
2234
+ `,O6=ya.div`
2230
2235
  font-size: 12px;
2231
2236
  line-height: 12px;
2232
2237
  padding: 7px;
@@ -2239,7 +2244,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2239
2244
  text-decoration: underline;
2240
2245
  }
2241
2246
  }
2242
- `,O6=ya.div`
2247
+ `,N6=ya.div`
2243
2248
  font-size: 18px;
2244
2249
  line-height: 18px;
2245
2250
  font-weight: 500;
@@ -2247,7 +2252,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2247
2252
  white-space: nowrap;
2248
2253
  max-width: 275px;
2249
2254
  text-overflow: ellipsis;
2250
- `,N6=ya.div`
2255
+ `,D6=ya.div`
2251
2256
  font-size: 16px;
2252
2257
  line-height: 140%;
2253
2258
  font-weight: 400;
@@ -2255,7 +2260,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2255
2260
  overflow: hidden;
2256
2261
  max-width: 275px;
2257
2262
  text-overflow: ellipsis;
2258
- `;import U6 from"@heroicons/react/24/outline/WalletIcon";import Bd from"styled-components";import{jsx as s1,jsxs as Fd}from"react/jsx-runtime";var l1=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=M(),a=i(t.chainId)||"ETH";return Fd(F6,{children:[Fd(B6,{children:[s1(U6,{strokeWidth:"2",width:"16px",height:"16px"}),s1("div",{children:go(e)})]}),Fd(H6,{displayBalanceColor:n,hasFunds:o,children:[r?$r(r,a,6,!0):0," available"]})]})},F6=Bd.div`
2263
+ `;import F6 from"@heroicons/react/24/outline/WalletIcon";import Bd from"styled-components";import{jsx as l1,jsxs as Fd}from"react/jsx-runtime";var c1=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=M(),a=i(t.chainId)||"ETH";return Fd(B6,{children:[Fd(H6,{children:[l1(F6,{strokeWidth:"2",width:"16px",height:"16px"}),l1("div",{children:go(e)})]}),Fd(G6,{displayBalanceColor:n,hasFunds:o,children:[r?$r(r,a,6,!0):0," available"]})]})},B6=Bd.div`
2259
2264
  display: flex;
2260
2265
  flex-direction: row;
2261
2266
  justify-content: space-between;
@@ -2268,12 +2273,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2268
2273
  border: 1px solid var(--privy-color-foreground-4);
2269
2274
  border-radius: var(--privy-border-radius-md);
2270
2275
  }
2271
- `,B6=Bd.div`
2276
+ `,H6=Bd.div`
2272
2277
  display: flex;
2273
2278
  flex-direction: row;
2274
2279
  align-items: center;
2275
2280
  gap: 8px;
2276
- `,H6=Bd.div`
2281
+ `,G6=Bd.div`
2277
2282
  display: flex;
2278
2283
  align-items: center;
2279
2284
  justify-content: center;
@@ -2283,35 +2288,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
2283
2288
  background-color: var(--privy-color-background-2);
2284
2289
  padding: 5px 8px;
2285
2290
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2286
- `;import zl from"styled-components";import{Fragment as d1,jsx as ga,jsxs as p1}from"react/jsx-runtime";var u1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?ma(n,o):void 0,a=$r(n,r);return p1(G6,{children:[i?p1(d1,{children:[ga(c1,{children:i}),ga(V6,{children:a})]}):ga(d1,{children:ga(c1,{children:a})}),ga(z6,{children:e})]})},G6=zl.div`
2291
+ `;import zl from"styled-components";import{Fragment as p1,jsx as ga,jsxs as u1}from"react/jsx-runtime";var m1=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?ma(n,o):void 0,a=$r(n,r);return u1(V6,{children:[i?u1(p1,{children:[ga(d1,{children:i}),ga(z6,{children:a})]}):ga(p1,{children:ga(d1,{children:a})}),ga(q6,{children:e})]})},V6=zl.div`
2287
2292
  display: flex;
2288
2293
  flex-direction: column;
2289
2294
  align-items: center;
2290
2295
  margin-bottom: 20px;
2291
- `,c1=zl.h2`
2296
+ `,d1=zl.h2`
2292
2297
  && {
2293
2298
  font-size: 48px;
2294
2299
  line-height: 48px;
2295
2300
  margin: 8px auto;
2296
2301
  }
2297
- `,V6=zl.p`
2302
+ `,z6=zl.p`
2298
2303
  margin-bottom: 12px;
2299
2304
  && {
2300
2305
  font-size: 17px;
2301
2306
  line-height: 17px;
2302
2307
  color: var(--privy-color-foreground-3);
2303
2308
  }
2304
- `,z6=zl.div`
2309
+ `,q6=zl.div`
2305
2310
  font-size: 16px;
2306
2311
  line-height: 22.4px;
2307
2312
  font-weight: 400;
2308
2313
  overflow: hidden;
2309
2314
  max-width: 275px;
2310
2315
  text-overflow: ellipsis;
2311
- `;import{VoidSigner as Z6}from"@ethersproject/abstract-signer";import{EtherscanProvider as _z}from"@ethersproject/providers";import{BigNumber as y1}from"@ethersproject/bignumber";import{BigNumber as di}from"@ethersproject/bignumber";import{Contract as q6}from"@ethersproject/contracts";import{serialize as $6}from"@ethersproject/transactions";var pi=e=>[Ss.id,xs.id,_s.id,ks.id,As.id,Rs.id,Is.id,Ws.id,Ms.id].includes(e),m1=async(e,t)=>{if(!pi(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=di.from(r).mul(di.from(126)).div(di.from(100)).add(di.from(e.maxPriorityFeePerGas));e.maxFeePerGas=va(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function f1(e,t){if(!e.chainId||e.chainId&&!pi(e.chainId))return di.from(0);let r=di.from(0);try{let o=new q6(ru,ou,t),n=h1(e),i=$6(n);r=await o.getL1Fee(i)}catch{}return r}async function g1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var v1=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 ui(e,t){if(!e.gasLimit)throw new Oe("gasLimit was not successfully set for transaction.");let r=yt(e.gasLimit),o=y1.from(0);if(e.type==2)if(e.maxFeePerGas)o=yt(e.maxFeePerGas);else throw new Oe("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=yt(e.gasPrice);else throw new Oe("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=y1.from(0);if(e.chainId&&pi(e.chainId))try{i=await f1(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as Hd}from"@ethersproject/bignumber";var Gd=e=>[Es.id,Ps.id,Ts.id].includes(e),C1=async(e,t)=>{if(!Gd(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(Hd.from(120)).div(Hd.from(100));e.maxFeePerGas=va(o),e.maxPriorityFeePerGas=va(Hd.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Vd=e=>[56,97].includes(e),w1=async(e,t)=>{if(!Vd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as b1}from"@ethersproject/units";import{ofetch as K6}from"ofetch";var zd={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 $d=e=>[Ri.id,Ii.id,zd.id].includes(e),qd=e=>({maxPriorityFee:b1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:b1(e.maxFee.toFixed(9),"gwei").toHexString()}),j6=e=>({safeLow:qd(e.safeLow),standard:qd(e.standard),fast:qd(e.fast)}),Y6=async e=>{let t="";switch(e){case Ri.id:t="https://gasstation.polygon.technology/v2";break;case Ii.id:t="https://gasstation-testnet.polygon.technology/v2";break;case zd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return j6(await K6(t))};async function E1(e){if(!$d(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 Y6(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 va(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 h1(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 mi(e,t,r){if(t.chainId=Number(t.chainId),P1(t),t.from||(t.from=e),!t.nonce){let o=new Z6(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await g1(t,r)),typeof t.type=="string"&&T1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),$d(t.chainId)?t=await E1(t):Gd(t.chainId)?t=await C1(t,r):pi(t.chainId)?t=await m1(t,r):Vd(t.chainId)?t=await w1(t,r):t=await v1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function ql(e,t,r,o,n){o=Object.assign({chainId:Qr},o),P1(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 $l(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 P1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!J6(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 J6(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&T1(e);return t||r||o}function T1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Kl(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as Kd,useEffect as Q6}from"react";var jl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=Kd(!0),[a,l]=Kd(void 0),[s,c]=Kd(void 0);return Q6(()=>{let u=e.chainId||Qr,m=o.find(y=>y.id===Number(u));if(!m)throw new ee(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let y=await r(m);y?c(y):l(new Error(`Unable to fetch token price on chain id ${m.id}`))}catch(y){l(y)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as X6,useContext as e7}from"react";var jd=X6(null);function Ca(){let e=e7(jd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as x1}from"react/jsx-runtime";var wa=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:r}=Ca(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=S1(null),[u,m]=S1(e),{tokenPrice:h}=jl(u),y=l(e.chainId)||"ETH",C=t7(()=>r.find(g=>g.walletClientType==="privy"),[r]);return r7(()=>{async function g(){if(!await t()||!o||!C)return u;let T=Xr(u.chainId,i,n,{appId:a}),w=await mi(C.address,u,T),{totalGasEstimate:k}=await ui(w,T);return c(k.toHexString()),w}g().then(m).catch(console.error)},[o]),C?x1(n7,{children:x1(ci,{from:C.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:y})}):null},n7=o7.div`
2316
+ `;import{VoidSigner as J6}from"@ethersproject/abstract-signer";import{EtherscanProvider as Az}from"@ethersproject/providers";import{BigNumber as g1}from"@ethersproject/bignumber";import{BigNumber as di}from"@ethersproject/bignumber";import{Contract as $6}from"@ethersproject/contracts";import{serialize as K6}from"@ethersproject/transactions";var pi=e=>[Ss.id,xs.id,_s.id,ks.id,As.id,Rs.id,Is.id,Ws.id,Ms.id].includes(e),f1=async(e,t)=>{if(!pi(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=di.from(r).mul(di.from(126)).div(di.from(100)).add(di.from(e.maxPriorityFeePerGas));e.maxFeePerGas=va(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function h1(e,t){if(!e.chainId||e.chainId&&!pi(e.chainId))return di.from(0);let r=di.from(0);try{let o=new $6(ru,ou,t),n=y1(e),i=K6(n);r=await o.getL1Fee(i)}catch{}return r}async function v1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var C1=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 ui(e,t){if(!e.gasLimit)throw new Oe("gasLimit was not successfully set for transaction.");let r=yt(e.gasLimit),o=g1.from(0);if(e.type==2)if(e.maxFeePerGas)o=yt(e.maxFeePerGas);else throw new Oe("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=yt(e.gasPrice);else throw new Oe("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=g1.from(0);if(e.chainId&&pi(e.chainId))try{i=await h1(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as Hd}from"@ethersproject/bignumber";var Gd=e=>[Es.id,Ps.id,Ts.id].includes(e),w1=async(e,t)=>{if(!Gd(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(Hd.from(120)).div(Hd.from(100));e.maxFeePerGas=va(o),e.maxPriorityFeePerGas=va(Hd.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Vd=e=>[56,97].includes(e),b1=async(e,t)=>{if(!Vd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as E1}from"@ethersproject/units";import{ofetch as j6}from"ofetch";var zd={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 $d=e=>[Ri.id,Ii.id,zd.id].includes(e),qd=e=>({maxPriorityFee:E1(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:E1(e.maxFee.toFixed(9),"gwei").toHexString()}),Y6=e=>({safeLow:qd(e.safeLow),standard:qd(e.standard),fast:qd(e.fast)}),Z6=async e=>{let t="";switch(e){case Ri.id:t="https://gasstation.polygon.technology/v2";break;case Ii.id:t="https://gasstation-testnet.polygon.technology/v2";break;case zd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return Y6(await j6(t))};async function P1(e){if(!$d(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 Z6(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 va(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 y1(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 mi(e,t,r){if(t.chainId=Number(t.chainId),T1(t),t.from||(t.from=e),!t.nonce){let o=new J6(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await v1(t,r)),typeof t.type=="string"&&S1(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),$d(t.chainId)?t=await P1(t):Gd(t.chainId)?t=await w1(t,r):pi(t.chainId)?t=await f1(t,r):Vd(t.chainId)?t=await b1(t,r):t=await C1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function ql(e,t,r,o,n){o=Object.assign({chainId:Qr},o),T1(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 $l(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 T1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Q6(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 Q6(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&S1(e);return t||r||o}function S1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Kl(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as Kd,useEffect as X6}from"react";var jl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,i]=Kd(!0),[a,l]=Kd(void 0),[s,c]=Kd(void 0);return X6(()=>{let u=e.chainId||Qr,m=o.find(y=>y.id===Number(u));if(!m)throw new ee(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let y=await r(m);y?c(y):l(new Error(`Unable to fetch token price on chain id ${m.id}`))}catch(y){l(y)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as e7,useContext as t7}from"react";var jd=e7(null);function Ca(){let e=t7(jd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as _1}from"react/jsx-runtime";var wa=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:r}=Ca(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=M(),[s,c]=x1(null),[u,m]=x1(e),{tokenPrice:h}=jl(u),y=l(e.chainId)||"ETH",C=r7(()=>r.find(g=>g.walletClientType==="privy"),[r]);return o7(()=>{async function g(){if(!await t()||!o||!C)return u;let E=Xr(u.chainId,i,n,{appId:a}),w=await mi(C.address,u,E),{totalGasEstimate:_}=await ui(w,E);return c(_.toHexString()),w}g().then(m).catch(console.error)},[o]),C?_1(i7,{children:_1(ci,{from:C.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:y})}):null},i7=n7.div`
2312
2317
  width: 100%;
2313
2318
  padding: 1rem 0;
2314
- `;import i7 from"@heroicons/react/24/outline/CalendarIcon";import a7 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import s7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as _1,jsx as gt,jsxs as fi}from"react/jsx-runtime";var k1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return fi(_1,{children:[gt(P,{onClose:r},"header"),gt(mt,{children:fi("div",{children:[gt(pt,{success:a,fail:!!t}),t?gt(a7,{style:{width:"38px",height:"38px"}}):gt(cn,{style:{width:"38px",height:"38px"}})]})}),gt(ie,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),fi(Xo,{children:[fi(It,{children:[gt(Rt,{children:gt(s7,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),fi(It,{children:[gt(Rt,{children:gt(i7,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&gt(cr,{children:gt(wa,{pendingTransaction:l})}),t&&fi(_1,{children:[gt(Zs,{style:{marginTop:"1.25rem"},children:t.message}),gt(W,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&gt(Ni,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),gt(V,{})]})};import{Fragment as Yd,jsx as pe,jsxs as _r}from"react/jsx-runtime";var Zd=({open:e,onClose:t})=>{let{user:r}=F(),[o,n]=ba(null),{init:i,cancel:a,submit:l}=la(),[s,c]=ba(!1),[u,m]=ba(!1),[h,y]=ba(null),[C,g]=ba(null);f7(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?w(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let _=L=>Xc(L)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):nn(L)?(c(!1),new Error("The code you entered is not valid")):on(L)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(L),c(!1),new Error("Something went wrong."));async function T(L){g(null);try{if(!L||!o)return;await l(o,L),m(!0),c(!1),t()}catch(S){throw _(S)}}async function w(L){if(L==="passkey"){try{n(L);let S=await i(L);if(!S)throw new Error("something went wrong");y(S),await l(L,S),m(!0),c(!1),t()}catch(S){g(_(S))}return}try{n(L),await i(L)}catch(S){console.error(S)}}let k=()=>{n(null),g(null),a(),t()},R=()=>{n(null),g(null)};if(!e||!r)return null;if(o==="passkey"){let L=r.linkedAccounts.filter(S=>S.type==="passkey"&&S.enrolledInMfa).sort((S,N)=>N.firstVerifiedAt.valueOf()-S.firstVerifiedAt.valueOf())[0];return pe(k1,{account:L,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:C,onClose:k,onBack:R,handleSubmit:()=>T(h).catch(g)})}return o?pe(h7,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:T,selectedMethod:o,onClose:k,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):_r(Yd,{children:[pe(P,{onClose:k},"header"),pe(be,{children:pe(We,{children:pe(p7,{})})}),pe(ie,{children:"Verify your identity"}),pe(se,{children:"Choose a verification method"}),_r(qs,{children:[r.mfaMethods.includes("totp")&&_r(Ae,{onClick:()=>w("totp"),children:[pe(l7,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&_r(Ae,{onClick:()=>w("sms"),children:[pe(d7,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&_r(Ae,{onClick:()=>w("passkey"),children:[pe(c7,{}),"Passkey"]},"passkey")]}),pe(V,{})]})},h7=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=x(),{pendingTransaction:l}=M();switch(e){case"sms":return _r(Yd,{children:[pe(P,{onClose:o},"header"),pe(be,{children:pe(We,{children:pe(m7,{})})}),pe(ie,{children:"Enter verification code"}),_r(cr,{children:[pe(pn,{success:t,disabled:r,onChange:i}),_r(se,{children:["To continue, please enter the 6-digit code sent to your ",pe("strong",{children:"mobile device"})]}),l&&pe(wa,{pendingTransaction:l})]}),n&&pe(Ni,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(vr,{onClick:o,children:"Not now"}),pe(V,{})]});case"totp":return _r(Yd,{children:[pe(P,{onClose:o},"header"),pe(be,{children:pe(We,{children:pe(u7,{})})}),pe(ie,{children:"Enter verification code"}),_r(cr,{children:[pe(pn,{success:t,disabled:r,onChange:i}),_r(se,{children:["To continue, please enter the 6-digit code generated from your"," ",pe("strong",{children:"authenticator app"})]}),l&&pe(wa,{pendingTransaction:l})]}),n&&pe(Ni,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(vr,{onClick:o,children:"Not now"}),pe(V,{})]});default:return null}};import{useEffect as A1,useState as R1}from"react";import y7 from"styled-components";import{Fragment as v7,jsx as Kr,jsxs as Yl}from"react/jsx-runtime";var I1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=x(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:m,setReadyToTrue:h,closePrivyModal:y,createAnalyticsEvent:C}=M(),[g,_]=R1(!1),[T,w]=R1(void 0),k=s()?.provider||"google",{name:R,component:L}=ki(k),S=Us(),N=n?.render.inDialog?Be:0;A1(()=>{u(k).then(q=>{_(!0),h(!0),q&&S("login","onOAuthLoginComplete",q)}).catch(q=>{if(q?.privyErrorCode==="allowlist_rejected"){w(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(q?.privyErrorCode==="max_accounts_reached"){console.error(new Rr(q).toString()),w(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:I,detail:Z}=xu(q,k);w({retryable:I,detail:Z,message:"Authentication failed"}),h(!1)}).finally(()=>{$o()})},[R,k]),A1(()=>{if(r&&e&&g&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let I=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},N);return()=>clearTimeout(I)}if(ir(o,n?.embeddedWallets?.createOnLogin)){let I=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:Z=>{console.error(Z),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Z,provider:k,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},N);return()=>clearTimeout(I)}else{let I=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),N);return m(),()=>clearTimeout(I)}}},[r,e,g,o]);let $=g?`Successfully connected with ${R}`:T?T.message:`Verifying connection to ${R}`,K="";return g?K="You\u2019re good to go!":T?K=T.detail:K="Just a few moments more",Yl(v7,{children:[Kr(P,{}),Kr(X,{}),Yl(g7,{children:[Kr(mt,{children:Yl("div",{children:[Kr(pt,{success:g,fail:!!T}),Kr(L,{style:{width:"38px",height:"38px"}})]})}),Yl(Ze,{children:[Kr("h3",{children:$}),Kr("p",{children:K})]}),T&&T?.retryable?Kr(Hs,{onClick:()=>{$o(),c(k),w(void 0)},disabled:!g&&!T?.retryable,children:"Retry"}):null]}),Kr(ae,{}),Kr(V,{})]})},g7=y7.div`
2319
+ `;import a7 from"@heroicons/react/24/outline/CalendarIcon";import s7 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import l7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as k1,jsx as gt,jsxs as fi}from"react/jsx-runtime";var A1=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=M();return fi(k1,{children:[gt(T,{onClose:r},"header"),gt(mt,{children:fi("div",{children:[gt(pt,{success:a,fail:!!t}),t?gt(s7,{style:{width:"38px",height:"38px"}}):gt(dn,{style:{width:"38px",height:"38px"}})]})}),gt(ie,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),fi(en,{children:[fi(It,{children:[gt(Rt,{children:gt(l7,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),fi(It,{children:[gt(Rt,{children:gt(a7,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&gt(cr,{children:gt(wa,{pendingTransaction:l})}),t&&fi(k1,{children:[gt(Zs,{style:{marginTop:"1.25rem"},children:t.message}),gt(L,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&gt(Ni,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),gt(V,{})]})};import{Fragment as Yd,jsx as pe,jsxs as kr}from"react/jsx-runtime";var Zd=({open:e,onClose:t})=>{let{user:r}=F(),[o,n]=ba(null),{init:i,cancel:a,submit:l}=la(),[s,c]=ba(!1),[u,m]=ba(!1),[h,y]=ba(null),[C,g]=ba(null);h7(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?w(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let x=O=>Xc(O)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):an(O)?(c(!1),new Error("The code you entered is not valid")):nn(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 E(O){g(null);try{if(!O||!o)return;await l(o,O),m(!0),c(!1),t()}catch(W){throw x(W)}}async function w(O){if(O==="passkey"){try{n(O);let W=await i(O);if(!W)throw new Error("something went wrong");y(W),await l(O,W),m(!0),c(!1),t()}catch(W){g(x(W))}return}try{n(O),await i(O)}catch(W){console.error(W)}}let _=()=>{n(null),g(null),a(),t()},A=()=>{n(null),g(null)};if(!e||!r)return null;if(o==="passkey"){let O=r.linkedAccounts.filter(W=>W.type==="passkey"&&W.enrolledInMfa).sort((W,R)=>R.firstVerifiedAt.valueOf()-W.firstVerifiedAt.valueOf())[0];return pe(A1,{account:O,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:C,onClose:_,onBack:A,handleSubmit:()=>E(h).catch(g)})}return o?pe(y7,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:E,selectedMethod:o,onClose:_,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):kr(Yd,{children:[pe(T,{onClose:_},"header"),pe(be,{children:pe(We,{children:pe(u7,{})})}),pe(ie,{children:"Verify your identity"}),pe(se,{children:"Choose a verification method"}),kr(qs,{children:[r.mfaMethods.includes("totp")&&kr(Ae,{onClick:()=>w("totp"),children:[pe(c7,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&kr(Ae,{onClick:()=>w("sms"),children:[pe(p7,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&kr(Ae,{onClick:()=>w("passkey"),children:[pe(d7,{}),"Passkey"]},"passkey")]}),pe(V,{})]})},y7=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=S(),{pendingTransaction:l}=M();switch(e){case"sms":return kr(Yd,{children:[pe(T,{onClose:o},"header"),pe(be,{children:pe(We,{children:pe(f7,{})})}),pe(ie,{children:"Enter verification code"}),kr(cr,{children:[pe(un,{success:t,disabled:r,onChange:i}),kr(se,{children:["To continue, please enter the 6-digit code sent to your ",pe("strong",{children:"mobile device"})]}),l&&pe(wa,{pendingTransaction:l})]}),n&&pe(Ni,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(vr,{onClick:o,children:"Not now"}),pe(V,{})]});case"totp":return kr(Yd,{children:[pe(T,{onClose:o},"header"),pe(be,{children:pe(We,{children:pe(m7,{})})}),pe(ie,{children:"Enter verification code"}),kr(cr,{children:[pe(un,{success:t,disabled:r,onChange:i}),kr(se,{children:["To continue, please enter the 6-digit code generated from your"," ",pe("strong",{children:"authenticator app"})]}),l&&pe(wa,{pendingTransaction:l})]}),n&&pe(Ni,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),pe(vr,{onClick:o,children:"Not now"}),pe(V,{})]});default:return null}};import{useEffect as R1,useState as I1}from"react";import g7 from"styled-components";import{Fragment as C7,jsx as Kr,jsxs as Yl}from"react/jsx-runtime";var M1=()=>{let{authenticated:e,logout:t,ready:r,user:o}=F(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:m,setReadyToTrue:h,closePrivyModal:y,createAnalyticsEvent:C}=M(),[g,x]=I1(!1),[E,w]=I1(void 0),_=s()?.provider||"google",{name:A,component:O}=ki(_),W=Us(),R=n?.render.inDialog?Be:0;R1(()=>{u(_).then($=>{x(!0),h(!0),$&&W("login","onOAuthLoginComplete",$)}).catch($=>{if($?.privyErrorCode==="allowlist_rejected"){w(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if($?.privyErrorCode==="max_accounts_reached"){console.error(new Ir($).toString()),w(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:I,detail:Z}=xu($,_);w({retryable:I,detail:Z,message:"Authentication failed"}),h(!1)}).finally(()=>{$o()})},[A,_]),R1(()=>{if(r&&e&&g&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let I=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(I)}if(ir(o,n?.embeddedWallets?.createOnLogin)){let I=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:Z=>{console.error(Z),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Z,provider:_,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(I)}else{let I=setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return m(),()=>clearTimeout(I)}}},[r,e,g,o]);let q=g?`Successfully connected with ${A}`:E?E.message:`Verifying connection to ${A}`,K="";return g?K="You\u2019re good to go!":E?K=E.detail:K="Just a few moments more",Yl(C7,{children:[Kr(T,{}),Kr(X,{}),Yl(v7,{children:[Kr(mt,{children:Yl("div",{children:[Kr(pt,{success:g,fail:!!E}),Kr(O,{style:{width:"38px",height:"38px"}})]})}),Yl(Ze,{children:[Kr("h3",{children:q}),Kr("p",{children:K})]}),E&&E?.retryable?Kr(Hs,{onClick:()=>{$o(),c(_),w(void 0)},disabled:!g&&!E?.retryable,children:"Retry"}):null]}),Kr(ae,{}),Kr(V,{})]})},v7=g7.div`
2315
2320
  display: flex;
2316
2321
  flex-direction: column;
2317
2322
  align-items: center;
@@ -2319,17 +2324,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
2319
2324
  margin-left: 27px;
2320
2325
  margin-right: 27px;
2321
2326
  gap: 24px;
2322
- `;import{useEffect as Jd,useRef as C7,useState as M1}from"react";import W1 from"styled-components";import{Fragment as b7,jsx as co,jsxs as Zl}from"react/jsx-runtime";var L1=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=x(),{loginWithPasskey:n,closePrivyModal:i}=M(),a=e?.render.inDialog?Be:0,[l,s]=M1("loading"),[c,u]=M1(null),m=C7([]),h=T=>{m.current=[T,...m.current]};Jd(()=>()=>{m.current.forEach(T=>clearTimeout(T)),m.current=[]},[]);let y=()=>{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.
2327
+ `;import{useEffect as Jd,useRef as w7,useState as W1}from"react";import L1 from"styled-components";import{Fragment as E7,jsx as co,jsxs as Zl}from"react/jsx-runtime";var O1=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=S(),{loginWithPasskey:n,closePrivyModal:i}=M(),a=e?.render.inDialog?Be:0,[l,s]=W1("loading"),[c,u]=W1(null),m=w7([]),h=E=>{m.current=[E,...m.current]};Jd(()=>()=>{m.current.forEach(E=>clearTimeout(E)),m.current=[]},[]);let y=()=>{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.
2323
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 Fe){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.
2324
2329
  You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2325
- You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(l){case"loading":case"success":return co(W,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return co(W,{onClick:_,disabled:!1,children:"Retry"})}},_=async()=>{s("loading");try{await n(),s("success")}catch(T){u(T),s("error")}};return Jd(()=>{l==="success"&&h(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),Jd(()=>{_()},[]),Zl(b7,{children:[co(P,{backFn:!t||r===t?void 0:o}),Zl(w7,{children:[co(mt,{children:Zl("div",{children:[co(pt,{success:l==="success",fail:l==="error"}),co(dn,{style:{width:"38px",height:"38px"}})]})}),Zl(Ze,{children:[co("h3",{children:y()}),co("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),g()]}),co(V,{})]})},w7=W1.div`
2330
+ You will have to sign up with another method first to register a passkey for your account.`}},g=()=>{switch(l){case"loading":case"success":return co(L,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return co(L,{onClick:x,disabled:!1,children:"Retry"})}},x=async()=>{s("loading");try{await n(),s("success")}catch(E){u(E),s("error")}};return Jd(()=>{l==="success"&&h(setTimeout(()=>{i({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[l]),Jd(()=>{x()},[]),Zl(E7,{children:[co(T,{backFn:!t||r===t?void 0:o}),Zl(b7,{children:[co(mt,{children:Zl("div",{children:[co(pt,{success:l==="success",fail:l==="error"}),co(pn,{style:{width:"38px",height:"38px"}})]})}),Zl(Ze,{children:[co("h3",{children:y()}),co("p",{style:{whiteSpace:"pre-wrap"},children:C()})]}),g()]}),co(V,{})]})},b7=L1.div`
2326
2331
  display: flex;
2327
2332
  flex-direction: column;
2328
2333
  align-items: center;
2329
2334
  justify-content: center;
2330
2335
  gap: 24px;
2331
2336
  width: 100%;
2332
- `,h$=W1.div`
2337
+ `,g$=L1.div`
2333
2338
  display: flex;
2334
2339
  align-items: center;
2335
2340
  justify-content: center;
@@ -2345,9 +2350,9 @@ You will have to sign up with another method first to register a passkey for you
2345
2350
  stroke: var(--privy-color-accent) !important;
2346
2351
  fill: var(--privy-color-accent) !important;
2347
2352
  }
2348
- `;import{useEffect as P7,useState as N1}from"react";import T7 from"styled-components";import{isMobile as E7}from"react-device-detect";var O1=(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(!yo()&&E7)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as x7,jsx as po,jsxs as D1}from"react/jsx-runtime";var U1=()=>{let{forkSession:e,ready:t,authenticated:r}=F(),[o,n]=N1(""),[i,a]=N1(!1);P7(()=>{t&&r&&e().then(n)},[t,r]);let l=O1(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."),D1(x7,{children:[po(P,{},"header"),po(X,{}),po(Br,{title:s.title,description:s.description}),D1(dr,{children:[po(S7,{children:po(Lr,{style:{width:"72px",height:"72px"}})}),po(Bs,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?po("p",{children:s.footnote}):null]}),po(ae,{}),po(G,{protectedByPrivy:!0})]})},S7=T7(bt)`
2353
+ `;import{useEffect as T7,useState as D1}from"react";import S7 from"styled-components";import{isMobile as P7}from"react-device-detect";var N1=(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(!yo()&&P7)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as _7,jsx as po,jsxs as U1}from"react/jsx-runtime";var F1=()=>{let{forkSession:e,ready:t,authenticated:r}=F(),[o,n]=D1(""),[i,a]=D1(!1);T7(()=>{t&&r&&e().then(n)},[t,r]);let l=N1(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."),U1(_7,{children:[po(T,{},"header"),po(X,{}),po(Br,{title:s.title,description:s.description}),U1(dr,{children:[po(x7,{children:po(Or,{style:{width:"72px",height:"72px"}})}),po(Bs,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?po("p",{children:s.footnote}):null]}),po(ae,{}),po(G,{protectedByPrivy:!0})]})},x7=S7(bt)`
2349
2354
  margin: 16px auto;
2350
- `;import _7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as k7,useState as Jl}from"react";import Ql,{css as A7}from"styled-components";import{Fragment as L7,jsx as St,jsxs as fn}from"react/jsx-runtime";var F1=()=>{let[e,t]=Jl(!0),{authenticated:r,getAccessToken:o}=F(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=x(),[u,m]=Jl(void 0),[h,y]=Jl(""),[C,g]=Jl(!1),{privyWallet:_,onCompleteNavigateTo:T,onSuccess:w,onFailure:k}=s.recoverWallet,R=(N="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),k(typeof N=="string"?new wt(N):N)};c.current=R,k7(()=>{if(!r||!_)return R("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let L=N=>{N&&m(N)};return fn(L7,{children:[St(P,{onClose:R}),St(X,{}),fn(I7,{children:[fn(R7,{children:[St(_7,{height:48,width:48,stroke:"var(--privy-color-accent)"}),St("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),St("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),fn("div",{children:[fn(So,{children:[St(Zn,{type:e?"password":"text",onChange:N=>L(N.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),St(Jn,{style:{right:"0.75rem"},children:e?St(Qn,{onClick:()=>t(!1)}):St(Xn,{onClick:()=>t(!0)})})]}),!!h&&St(M7,{children:h})]}),fn("div",{children:[fn(Om,{children:[St("h4",{children:"Why is this necessary?"}),St("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),St(W7,{loading:C||!n,disabled:!u,onClick:async()=>{g(!0);let N=await o();if(N&&_&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:_.address}}),await n?.recover({address:_.address,accessToken:N,recoveryPin:u}),y(""),T?l(T):i({shouldCallAuthOnSuccess:!1}),w?.(_),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:_.address}})}catch($){gf($)?y("Invalid recovery password, please try again."):y("An error has occurred, please try again.")}finally{g(!1)}else return R("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!_&&C,children:"Recover your account"})]})]}),St(ae,{}),St(G,{protectedByPrivy:!0})]})},R7=Ql.div`
2355
+ `;import k7 from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as A7,useState as Jl}from"react";import Ql,{css as R7}from"styled-components";import{Fragment as O7,jsx as St,jsxs as hn}from"react/jsx-runtime";var B1=()=>{let[e,t]=Jl(!0),{authenticated:r,getAccessToken:o}=F(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),[u,m]=Jl(void 0),[h,y]=Jl(""),[C,g]=Jl(!1),{privyWallet:x,onCompleteNavigateTo:E,onSuccess:w,onFailure:_}=s.recoverWallet,A=(R="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),_(typeof R=="string"?new wt(R):R)};c.current=A,A7(()=>{if(!r||!x)return A("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let O=R=>{R&&m(R)};return hn(O7,{children:[St(T,{onClose:A}),St(X,{}),hn(M7,{children:[hn(I7,{children:[St(k7,{height:48,width:48,stroke:"var(--privy-color-accent)"}),St("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),St("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),hn("div",{children:[hn(So,{children:[St(Zn,{type:e?"password":"text",onChange:R=>O(R.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),St(Jn,{style:{right:"0.75rem"},children:e?St(Qn,{onClick:()=>t(!1)}):St(Xn,{onClick:()=>t(!0)})})]}),!!h&&St(W7,{children:h})]}),hn("div",{children:[hn(Nm,{children:[St("h4",{children:"Why is this necessary?"}),St("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),St(L7,{loading:C||!n,disabled:!u,onClick:async()=>{g(!0);let R=await o();if(R&&x&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:x.address}}),await n?.recover({address:x.address,accessToken:R,recoveryPin:u}),y(""),E?l(E):i({shouldCallAuthOnSuccess:!1}),w?.(x),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:x.address}})}catch(q){vf(q)?y("Invalid recovery password, please try again."):y("An error has occurred, please try again.")}finally{g(!1)}else return A("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&C,children:"Recover your account"})]})]}),St(ae,{}),St(G,{protectedByPrivy:!0})]})},I7=Ql.div`
2351
2356
  display: flex;
2352
2357
  flex-direction: column;
2353
2358
  align-items: center;
@@ -2369,40 +2374,40 @@ You will have to sign up with another method first to register a passkey for you
2369
2374
  font-weight: 400;
2370
2375
  line-height: 20px;
2371
2376
  }
2372
- `,I7=Ql.div`
2377
+ `,M7=Ql.div`
2373
2378
  display: flex;
2374
2379
  flex-direction: column;
2375
2380
  justify-content: space-between;
2376
- `,M7=Ql.div`
2381
+ `,W7=Ql.div`
2377
2382
  line-height: 20px;
2378
2383
  height: 20px;
2379
2384
  font-size: 13px;
2380
2385
  color: var(--privy-color-error);
2381
2386
  text-align: left;
2382
2387
  margin-top: 0.5rem;
2383
- `,W7=Ql(W)`
2384
- ${e=>e.hideAnimations&&A7`
2388
+ `,L7=Ql(L)`
2389
+ ${e=>e.hideAnimations&&R7`
2385
2390
  && {
2386
2391
  // Remove animations because the recoverWallet task on the iframe partially
2387
2392
  // blocks the renderer, so the animation stutters and doesn't look good
2388
2393
  transition: none;
2389
2394
  }
2390
2395
  `}
2391
- `;import{useCallback as O7,useEffect as V1,useState as Qd}from"react";import{jsx as uo,jsxs as B1}from"react/jsx-runtime";var Xl=({style:e,...t})=>B1("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[B1("g",{clipPath:"url(#clip0_2115_829)",children:[uo("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"}),uo("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"}),uo("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"}),uo("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"}),uo("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"}),uo("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"})]}),uo("defs",{children:uo("clipPath",{id:"clip0_2115_829",children:uo("rect",{width:"16",height:"14",fill:"white"})})})]});import H1 from"styled-components";var Ea=H1.div`
2396
+ `;import{useCallback as N7,useEffect as z1,useState as Qd}from"react";import{jsx as uo,jsxs as H1}from"react/jsx-runtime";var Xl=({style:e,...t})=>H1("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[H1("g",{clipPath:"url(#clip0_2115_829)",children:[uo("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"}),uo("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"}),uo("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"}),uo("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"}),uo("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"}),uo("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"})]}),uo("defs",{children:uo("clipPath",{id:"clip0_2115_829",children:uo("rect",{width:"16",height:"14",fill:"white"})})})]});import G1 from"styled-components";var Ea=G1.div`
2392
2397
  display: flex;
2393
2398
  flex-direction: column;
2394
2399
  gap: 12px;
2395
2400
  padding-top: 24px;
2396
2401
  padding-bottom: 24px;
2397
- `,G1=H1.div`
2402
+ `,V1=G1.div`
2398
2403
  padding-bottom: 24px;
2399
- `;import{Fragment as q1,jsx as mo,jsxs as Xd}from"react/jsx-runtime";var z1={"google-drive":{name:"Google Drive",component:Xl}},$1=()=>{let{logout:e}=F(),{navigate:t,setModalData:r,data:o}=x(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=Qd(!1),{provider:c,action:u,isInAccountCreateFlow:m}=o?.recoveryOAuthStatus,[h,y]=Qd(void 0),[C,g]=Qd(u==="create-wallet"),_=z1[c].name,T=z1[c].component,w=o?.recoverWallet?.onCompleteNavigateTo,k=new Le(async(N="create-wallet")=>(g(!0),new Promise(($,K)=>{setTimeout(async()=>{try{let q=window.open();await n(c,N,q),s(!0),$()}catch{y({message:`${N==="recover"?"Recovery":"Back up"} with ${_} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${_} account associated with your backup.`:"Something went wrong.",retryable:!0}),K()}},0)})));V1(()=>{u==="create-wallet"&&k.execute("create-wallet")},[]),V1(()=>{if(!l)return;let N=setTimeout(()=>{m?(r({createWallet:{onSuccess:()=>{},onFailure:$=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:$,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Be);return()=>clearTimeout(N)},[l]);let R=O7(async()=>{await k.execute("recover"),w?t(w):s(!0)},[]),L=l?"Success!":h?h.message:`Verifying connection to ${_}`,S="";return h?S=h.detail:l?S=`Successfully ${u==="recover"?"recovered":"backed up"} with Google.`:S=`${u==="recover"?"Recovering":"Backing up"} with Google...`,Xd(q1,{children:[mo(P,{}),C?mo(q1,{children:Xd(Ea,{children:[mo(Ee,{title:L,icon:mo(T,{style:{width:"38px",height:"38px"}}),description:S}),h&&h?.retryable?mo(W,{onClick:()=>{$o(),y(void 0),u==="create-wallet"?k.execute("create-wallet"):R()},disabled:!l&&!h?.retryable,children:"Try again"}):null]})}):Xd(Ea,{children:[mo(Ee,{title:"Confirm it's really you",icon:mo(T,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to Google Drive where your account is
2400
- backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protectedByPrivy:!0})]})};import{useEffect as K1,useState as Pa}from"react";import{jsx as N7}from"react/jsx-runtime";var j1=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=x(),[n,i]=Pa(""),[a,l]=Pa(!1),[s,c]=Pa(),[u,m]=Pa(null),{authenticated:h}=F(),{closePrivyModal:y,isNewUserThisSession:C,initializeWalletProxy:g}=M(),{onSuccess:_,onFailure:T,callAuthOnSuccessOnClose:w}=r.createWallet,{createWallet:k}=sl(),[R,L]=Pa(null),S=new Le(async()=>{try{let K=await k(s);if(!K)return;L(K),C?t("EMBEDDED_WALLET_CREATED_SCREEN"):(_(K),y({shouldCallAuthOnSuccess:w}))}catch(K){i(K.message)}});K1(()=>{u||g(3e4).then(K=>m(K))},[u]),K1(()=>{if(!h){t("LANDING"),T(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let N=()=>{R&&R?.recoveryMethod!=="user-passcode"?(T(new wt("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):R?(_(R),y({shouldCallAuthOnSuccess:w})):(T(new wt("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let $=async()=>{l(!0);let K=250;return S.execute().then(()=>new Promise(q=>setTimeout(q,K))).finally(()=>l(!1))};return N7(pl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!R&&a,error:n,password:s||"",onClose:N,onPasswordChange:c,onPasswordGenerate:()=>c(dl()),onSubmit:$})};import D7 from"@heroicons/react/24/outline/LockClosedIcon";import U7 from"@heroicons/react/24/outline/PencilSquareIcon";import F7 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as B7}from"react";import{Fragment as ep,jsx as jt,jsxs as hi}from"react/jsx-runtime";var H7=({onClose:e})=>hi(G1,{children:[jt(Ee,{title:"Why do I need to secure my account?",icon:jt(F7,{width:48}),description:hi(ep,{children:[jt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),jt("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."})]})}),jt(W,{onClick:e,children:"Select backup method"})]}),Y1=()=>{let{navigate:e,setModalData:t,data:r}=x(),{user:o}=F(),{embeddedWallets:n}=Or(),a=Te(o)===null,[l,s]=B7(!1);return hi(ep,{children:[jt(P,{backFn:l?()=>s(!1):void 0,infoFn:l?void 0:()=>s(!0)},"header"),l?jt(H7,{onClose:()=>s(!1)}):hi(ep,{children:[jt(Ee,{title:"Secure your account",icon:jt(D7,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),jt(Ea,{children:n.userOwnedRecoveryOptions.map(c=>{switch(c){case"google-drive":return hi(Ae,{onClick:async()=>{t({recoveryOAuthStatus:{provider:"google-drive",action:a?"create-wallet":"set-recovery",isInAccountCreateFlow:r?.recoverySelection?.isInAccountCreateFlow??!1}}),e("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")},children:[jt(Xl,{style:{width:18}})," Back up to Google Drive"]},c);case"user-passcode":return hi(Ae,{onClick:()=>{e(a?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[jt(U7,{style:{width:18}})," Set a password"]},c);default:return null}})})]}),jt(G,{protectedByPrivy:!0})]})};import{BigNumber as ng}from"@ethersproject/bignumber";import{useMemo as ig,useEffect as ag,useState as Zt}from"react";import gi from"styled-components";function Z1(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as V7,ClipboardDocumentIcon as z7}from"@heroicons/react/24/outline";import{useState as q7}from"react";import kr from"styled-components";import{ErrorCode as ec}from"@ethersproject/logger";var G7=new Set([ec.CALL_EXCEPTION,ec.NONCE_EXPIRED,ec.REPLACEMENT_UNDERPRICED,ec.TRANSACTION_REPLACED]),J1=e=>{let t;return e.code&&e.code!==-32e3&&G7.has(e.code)&&(t=e.transactionHash),t},Q1=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as rb,jsx as Yt,jsxs as hn}from"react/jsx-runtime";var $7=e=>{let t=e.code?.toString().replace("_"," "),r=J1(e),o=Q1(e);return{errorCode:t,transactionHash:r,errorMessage:o}},K7=()=>hn(J7,{children:[Yt(X7,{}),Yt(Q7,{})]}),rg=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=q7(!1),{errorCode:l,transactionHash:s,errorMessage:c}=$7(e),u=n.find(m=>m.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return hn(rb,{children:[Yt(P,{onClose:r}),hn(j7,{children:[Yt(K7,{}),Yt(Y7,{children:l??"Something went wrong."}),Yt(Z7,{children:"Please try again."}),hn(eg,{children:[Yt(X1,{children:"Error message"}),Yt(tg,{clickable:!1,children:c})]}),s&&hn(eg,{children:[Yt(X1,{children:"Transaction hash (click to copy)"}),hn(tg,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,Yt(tb,{})]})]}),i&&hn("a",{href:u,children:["Copied transaction hash. View details about the failed transaction on a"," ",Yt("u",{children:"block explorer"}),"."]}),Yt(eb,{onClick:o,children:"Retry transaction"})]}),Yt(V,{})]})},j7=kr.div`
2404
+ `;import{Fragment as $1,jsx as mo,jsxs as Xd}from"react/jsx-runtime";var q1={"google-drive":{name:"Google Drive",component:Xl}},K1=()=>{let{logout:e}=F(),{navigate:t,setModalData:r,data:o}=S(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=M(),[l,s]=Qd(!1),{provider:c,action:u,isInAccountCreateFlow:m}=o?.recoveryOAuthStatus,[h,y]=Qd(void 0),[C,g]=Qd(u==="create-wallet"),x=q1[c].name,E=q1[c].component,w=o?.recoverWallet?.onCompleteNavigateTo,_=new Le(async(R="create-wallet")=>(g(!0),new Promise((q,K)=>{setTimeout(async()=>{try{let $=window.open();await n(c,R,$),s(!0),q()}catch{y({message:`${R==="recover"?"Recovery":"Back up"} with ${x} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${x} account associated with your backup.`:"Something went wrong.",retryable:!0}),K()}},0)})));z1(()=>{u==="create-wallet"&&_.execute("create-wallet")},[]),z1(()=>{if(!l)return;let R=setTimeout(()=>{m?(r({createWallet:{onSuccess:()=>{},onFailure:q=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Be);return()=>clearTimeout(R)},[l]);let A=N7(async()=>{await _.execute("recover"),w?t(w):s(!0)},[]),O=l?"Success!":h?h.message:`Verifying connection to ${x}`,W="";return h?W=h.detail:l?W=`Successfully ${u==="recover"?"recovered":"backed up"} with Google.`:W=`${u==="recover"?"Recovering":"Backing up"} with Google...`,Xd($1,{children:[mo(T,{}),C?mo($1,{children:Xd(Ea,{children:[mo(Ee,{title:O,icon:mo(E,{style:{width:"38px",height:"38px"}}),description:W}),h&&h?.retryable?mo(L,{onClick:()=>{$o(),y(void 0),u==="create-wallet"?_.execute("create-wallet"):A()},disabled:!l&&!h?.retryable,children:"Try again"}):null]})}):Xd(Ea,{children:[mo(Ee,{title:"Confirm it's really you",icon:mo(E,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to Google Drive where your account is
2405
+ backed up.`}),mo(L,{onClick:A,children:"Confirm with Google"})]}),mo(G,{protectedByPrivy:!0})]})};import{useEffect as j1,useState as Pa}from"react";import{jsx as D7}from"react/jsx-runtime";var Y1=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=S(),[n,i]=Pa(""),[a,l]=Pa(!1),[s,c]=Pa(),[u,m]=Pa(null),{authenticated:h}=F(),{closePrivyModal:y,isNewUserThisSession:C,initializeWalletProxy:g}=M(),{onSuccess:x,onFailure:E,callAuthOnSuccessOnClose:w}=r.createWallet,{createWallet:_}=sl(),[A,O]=Pa(null),W=new Le(async()=>{try{let K=await _(s);if(!K)return;O(K),C?t("EMBEDDED_WALLET_CREATED_SCREEN"):(x(K),y({shouldCallAuthOnSuccess:w}))}catch(K){i(K.message)}});j1(()=>{u||g(3e4).then(K=>m(K))},[u]),j1(()=>{if(!h){t("LANDING"),E(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let R=()=>{A&&A?.recoveryMethod!=="user-passcode"?(E(new wt("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):A?(x(A),y({shouldCallAuthOnSuccess:w})):(E(new wt("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let q=async()=>{l(!0);let K=250;return W.execute().then(()=>new Promise($=>setTimeout($,K))).finally(()=>l(!1))};return D7(pl,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!A&&a,error:n,password:s||"",onClose:R,onPasswordChange:c,onPasswordGenerate:()=>c(dl()),onSubmit:q})};import U7 from"@heroicons/react/24/outline/LockClosedIcon";import F7 from"@heroicons/react/24/outline/PencilSquareIcon";import B7 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as H7}from"react";import{Fragment as ep,jsx as jt,jsxs as hi}from"react/jsx-runtime";var G7=({onClose:e})=>hi(V1,{children:[jt(Ee,{title:"Why do I need to secure my account?",icon:jt(B7,{width:48}),description:hi(ep,{children:[jt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),jt("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."})]})}),jt(L,{onClick:e,children:"Select backup method"})]}),Z1=()=>{let{navigate:e,setModalData:t,data:r}=S(),{user:o}=F(),{embeddedWallets:n}=sr(),a=Te(o)===null,[l,s]=H7(!1);return hi(ep,{children:[jt(T,{backFn:l?()=>s(!1):void 0,infoFn:l?void 0:()=>s(!0)},"header"),l?jt(G7,{onClose:()=>s(!1)}):hi(ep,{children:[jt(Ee,{title:"Secure your account",icon:jt(U7,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),jt(Ea,{children:n.userOwnedRecoveryOptions.map(c=>{switch(c){case"google-drive":return hi(Ae,{onClick:async()=>{t({recoveryOAuthStatus:{provider:"google-drive",action:a?"create-wallet":"set-recovery",isInAccountCreateFlow:r?.recoverySelection?.isInAccountCreateFlow??!1}}),e("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")},children:[jt(Xl,{style:{width:18}})," Back up to Google Drive"]},c);case"user-passcode":return hi(Ae,{onClick:()=>{e(a?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[jt(F7,{style:{width:18}})," Set a password"]},c);default:return null}})})]}),jt(G,{protectedByPrivy:!0})]})};import{BigNumber as ig}from"@ethersproject/bignumber";import{useMemo as ag,useEffect as sg,useState as Zt}from"react";import gi from"styled-components";function J1(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{ExclamationCircleIcon as z7,ClipboardDocumentIcon as q7}from"@heroicons/react/24/outline";import{useState as $7}from"react";import Ar from"styled-components";import{ErrorCode as ec}from"@ethersproject/logger";var V7=new Set([ec.CALL_EXCEPTION,ec.NONCE_EXPIRED,ec.REPLACEMENT_UNDERPRICED,ec.TRANSACTION_REPLACED]),Q1=e=>{let t;return e.code&&e.code!==-32e3&&V7.has(e.code)&&(t=e.transactionHash),t},X1=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as ob,jsx as Yt,jsxs as yn}from"react/jsx-runtime";var K7=e=>{let t=e.code?.toString().replace("_"," "),r=Q1(e),o=X1(e);return{errorCode:t,transactionHash:r,errorMessage:o}},j7=()=>yn(Q7,{children:[Yt(eb,{}),Yt(X7,{})]}),og=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=M(),[i,a]=$7(!1),{errorCode:l,transactionHash:s,errorMessage:c}=K7(e),u=n.find(m=>m.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return yn(ob,{children:[Yt(T,{onClose:r}),yn(Y7,{children:[Yt(j7,{}),Yt(Z7,{children:l??"Something went wrong."}),Yt(J7,{children:"Please try again."}),yn(tg,{children:[Yt(eg,{children:"Error message"}),Yt(rg,{clickable:!1,children:c})]}),s&&yn(tg,{children:[Yt(eg,{children:"Transaction hash (click to copy)"}),yn(rg,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,Yt(rb,{})]})]}),i&&yn("a",{href:u,children:["Copied transaction hash. View details about the failed transaction on a"," ",Yt("u",{children:"block explorer"}),"."]}),Yt(tb,{onClick:o,children:"Retry transaction"})]}),Yt(V,{})]})},Y7=Ar.div`
2401
2406
  display: flex;
2402
2407
  flex-direction: column;
2403
2408
  align-items: center;
2404
2409
  justify-content: center;
2405
- `,Y7=kr.span`
2410
+ `,Z7=Ar.span`
2406
2411
  color: var(--privy-color-error);
2407
2412
  text-align: center;
2408
2413
  font-size: 1.125rem;
@@ -2410,7 +2415,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2410
2415
  line-height: 1.25rem; /* 111.111% */
2411
2416
  text-align: center;
2412
2417
  margin: 10px;
2413
- `,Z7=kr.span`
2418
+ `,J7=Ar.span`
2414
2419
  margin-top: 4px;
2415
2420
  margin-bottom: 10px;
2416
2421
  color: var(--privy-color-foreground);
@@ -2421,7 +2426,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2421
2426
  font-weight: 400;
2422
2427
  line-height: 20px; /* 142.857% */
2423
2428
  letter-spacing: -0.008px;
2424
- `,J7=kr.div`
2429
+ `,Q7=Ar.div`
2425
2430
  position: relative;
2426
2431
  width: 60px;
2427
2432
  height: 60px;
@@ -2429,37 +2434,37 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2429
2434
  display: flex;
2430
2435
  justify-content: center;
2431
2436
  align-items: center;
2432
- `,Q7=kr(V7)`
2437
+ `,X7=Ar(z7)`
2433
2438
  position: absolute;
2434
2439
  width: 35px;
2435
2440
  height: 35px;
2436
2441
  color: var(--privy-color-error);
2437
- `,X7=kr.div`
2442
+ `,eb=Ar.div`
2438
2443
  position: absolute;
2439
2444
  width: 60px;
2440
2445
  height: 60px;
2441
2446
  border-radius: 50%;
2442
2447
  background-color: var(--privy-color-error);
2443
2448
  opacity: 0.1;
2444
- `,eb=kr(W)`
2449
+ `,tb=Ar(L)`
2445
2450
  && {
2446
2451
  margin-top: 24px;
2447
2452
  }
2448
2453
  transition: color 350ms ease, background-color 350ms ease;
2449
- `,X1=kr.span`
2454
+ `,eg=Ar.span`
2450
2455
  width: 100%;
2451
2456
  text-align: left;
2452
2457
  font-size: 0.825rem;
2453
2458
  color: var(--privy-color-foreground);
2454
2459
  padding: 4px;
2455
- `,eg=kr.div`
2460
+ `,tg=Ar.div`
2456
2461
  width: 100%;
2457
2462
  margin: 20px;
2458
2463
  display: flex;
2459
2464
  flex-direction: column;
2460
2465
  justify-content: center;
2461
2466
  align-items: center;
2462
- `,tg=kr.span`
2467
+ `,rg=Ar.span`
2463
2468
  position: relative;
2464
2469
  width: 100%;
2465
2470
  background-color: var(--privy-color-background-2);
@@ -2477,59 +2482,59 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2477
2482
  &:hover {
2478
2483
  background-color: var(--privy-color-foreground-4);
2479
2484
  }`}
2480
- `,tb=kr(z7)`
2485
+ `,rb=Ar(q7)`
2481
2486
  position: absolute;
2482
2487
  top: 13px;
2483
2488
  right: 13px;
2484
2489
  width: 30px;
2485
2490
  height: 30px;
2486
- `;import{BigNumber as tp}from"@ethersproject/bignumber";import ob from"styled-components";import{Fragment as ab,jsx as Ta,jsxs as sb}from"react/jsx-runtime";var nb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=tp.from(e.gasUsed),o=tp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=tp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},og=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>sb(ab,{children:[Ta(P,{onClose:o}),Ta(Fi,{title:l??"Transaction complete!",description:s??"You're all set."}),Ta(ci,{tokenPrice:n,from:t.from,to:t.to,gas:nb(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ta(ib,{loading:!1,onClick:o,children:"All Done"}),Ta(V,{})]}),ib=ob(W)`
2491
+ `;import{BigNumber as tp}from"@ethersproject/bignumber";import nb from"styled-components";import{Fragment as sb,jsx as Ta,jsxs as lb}from"react/jsx-runtime";var ib=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=tp.from(e.gasUsed),o=tp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=tp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},ng=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>lb(sb,{children:[Ta(T,{onClose:o}),Ta(Fi,{title:l??"Transaction complete!",description:s??"You're all set."}),Ta(ci,{tokenPrice:n,from:t.from,to:t.to,gas:ib(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ta(ab,{loading:!1,onClick:o,children:"All Done"}),Ta(V,{})]}),ab=nb(L)`
2487
2492
  && {
2488
2493
  margin-top: 24px;
2489
2494
  }
2490
2495
  transition: color 350ms ease, background-color 350ms ease;
2491
- `;import{Fragment as rp,jsx as st,jsxs as yi}from"react/jsx-runtime";var lb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return st(Ud,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return st(Ud,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return st(rp,{children:st(u1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},lg=()=>{let{authenticated:e,getAccessToken:t}=F(),{wallets:r}=Ca(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:m,data:h,onUserCloseViaDialogOrKeybindRef:y,setModalData:C}=x(),{transactionRequest:g,onSuccess:_,onFailure:T,uiOptions:w,fundWalletConfig:k}=h.sendTransaction,[R,L]=Zt(null),[S,N]=Zt(null),[$,K]=Zt(""),[q,I]=Zt(),[Z,U]=Zt(),[ue,re]=Zt(!1),ce=()=>{K(""),I(void 0),U(void 0)},fe=($e,ct,Zr)=>{K($e),I(new Oe(new Ft(ct??$e,Zr??ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Q,et]=Zt(!1),[tt,xt]=Zt(!0),[ze,Xt]=Zt(null),[_e,He]=Zt(g),{tokenPrice:er,isTokenPriceLoading:_t}=jl(_e),Ue=s(g.chainId)||"ETH",[O,ne]=Zt(null),[B,me]=Zt(null),[tr,Uo]=Zt(!0);ag(()=>{e||(m("LANDING"),T(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let vt=ig(()=>r.find($e=>$e.walletClientType==="privy"),[r]),wi=async()=>{if(!vt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:$e,externalTransactionId:ct}=await i(vt.address,{config:k?.config||{}});C({fiatOnRampPrompt:{signedUrl:$e},fiatOnRampStatus:{externalTransactionId:ct}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Yr=ig(()=>Xr(_e.chainId,l,a,{appId:c}),[_e.chainId,a]);async function xa(){let $e=_e;if(!await t()||!o||!vt)return;try{$e=await mi(vt.address,_e,Yr),He($e)}catch(Jr){console.error(Jr),fe("There was an error preparing your transaction. Your transaction request will likely fail.",Jr.reason)}let Zr=ng.from(0),Ei=ng.from(0);try{({totalGasEstimate:Zr,l1ExecutionFeeEstimate:Ei}=await ui($e,Yr)),ne(Zr.toHexString()),me(Ei.toHexString())}catch{ne(null)}try{let{balance:Jr,hasSufficientFunds:ka}=await $l(vt.address,$e,Zr,Yr);Xt(Jr.toHexString()),ka||(xt(!1),fe("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&re(!0))}catch(Jr){console.warn(`Failed to fetch wallet balance with error: ${Jr}`)}Uo(!1)}ag(()=>{xa()},[o]);let qe=Z1(_e),_a=qe==="SEND"?`Send ${Ue}`:"Review transaction",bi={modalTitle:w.header||w.modalTitle||_a,buttonText:w.buttonText||"Submit"},Fo=()=>{Q||(S?_(S):T(q||new Oe(new Ft("The user rejected the request",ot.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return y.current=Fo,er===void 0&&_t||tr?yi(rp,{children:[w.transactionInfo?.contractInfo?.imgUrl&&st(bs,{src:w.transactionInfo?.contractInfo?.imgUrl}),st(P,{title:bi.modalTitle,onClose:Fo}),st(sg,{children:st(zn,{})})]}):R!==null?st(og,{txn:_e,onClose:Fo,receipt:R,transactionInfo:w.transactionInfo,tokenPrice:er,tokenSymbol:Ue,l1GasEstimate:B,receiptHeader:w.successHeader,receiptDescription:w.successDescription}):Z?st(rg,{transactionError:Z,chainId:_e.chainId,onClose:Fo,onRetry:()=>{ce(),xa()}}):yi(rp,{children:[st(P,{title:bi.modalTitle,onClose:Fo}),yi(sg,{children:[yi(ub,{children:[st(lb,{txn:_e,txnFamily:qe,uiOptions:w,tokenSymbol:Ue,tokenPrice:er}),vt?st(ci,{from:vt.address,to:_e.to,txn:_e,transactionInfo:w.transactionInfo,gas:O||void 0,tokenPrice:er,tokenSymbol:Ue}):null]}),yi(mb,{children:[st(cb,{children:$}),st(l1,{txn:_e,address:vt?.address??"",hasFunds:tt,balance:ze}),yi(db,{children:[ue&&st(W,{onClick:wi,children:"Add Funds"}),st(pb,{disabled:Q||!tt,loading:!o||Q,loadingText:Q?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{et(!0);let $e=await t();if($e&&!Q&&vt)try{let ct=await ql($e,vt.address,o,_e,Yr);N(ct);let Zr=await ct.wait();L(Kl(Zr)),ce()}catch(ct){console.warn({transaction:_e,error:ct}),U(ct),I(new Oe(new Ft(ct.reason??"Error processing transaction",ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{et(!1)}},children:bi.buttonText})]})]})]})]})},sg=gi.div`
2496
+ `;import{Fragment as rp,jsx as st,jsxs as yi}from"react/jsx-runtime";var cb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return st(Ud,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return st(Ud,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return st(rp,{children:st(m1,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},cg=()=>{let{authenticated:e,getAccessToken:t}=F(),{wallets:r}=Ca(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:m,data:h,onUserCloseViaDialogOrKeybindRef:y,setModalData:C}=S(),{transactionRequest:g,onSuccess:x,onFailure:E,uiOptions:w,fundWalletConfig:_}=h.sendTransaction,[A,O]=Zt(null),[W,R]=Zt(null),[q,K]=Zt(""),[$,I]=Zt(),[Z,U]=Zt(),[ue,re]=Zt(!1),ce=()=>{K(""),I(void 0),U(void 0)},fe=($e,ct,Zr)=>{K($e),I(new Oe(new Ft(ct??$e,Zr??ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Q,et]=Zt(!1),[tt,xt]=Zt(!0),[ze,Xt]=Zt(null),[_e,He]=Zt(g),{tokenPrice:er,isTokenPriceLoading:_t}=jl(_e),Ue=s(g.chainId)||"ETH",[N,ne]=Zt(null),[B,me]=Zt(null),[tr,Uo]=Zt(!0);sg(()=>{e||(m("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let vt=ag(()=>r.find($e=>$e.walletClientType==="privy"),[r]),wi=async()=>{if(!vt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:$e,externalTransactionId:ct}=await i(vt.address,{config:_?.config||{}});C({fiatOnRampPrompt:{signedUrl:$e},fiatOnRampStatus:{externalTransactionId:ct}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Yr=ag(()=>Xr(_e.chainId,l,a,{appId:c}),[_e.chainId,a]);async function xa(){let $e=_e;if(!await t()||!o||!vt)return;try{$e=await mi(vt.address,_e,Yr),He($e)}catch(Jr){console.error(Jr),fe("There was an error preparing your transaction. Your transaction request will likely fail.",Jr.reason)}let Zr=ig.from(0),Ei=ig.from(0);try{({totalGasEstimate:Zr,l1ExecutionFeeEstimate:Ei}=await ui($e,Yr)),ne(Zr.toHexString()),me(Ei.toHexString())}catch{ne(null)}try{let{balance:Jr,hasSufficientFunds:ka}=await $l(vt.address,$e,Zr,Yr);Xt(Jr.toHexString()),ka||(xt(!1),fe("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&re(!0))}catch(Jr){console.warn(`Failed to fetch wallet balance with error: ${Jr}`)}Uo(!1)}sg(()=>{xa()},[o]);let qe=J1(_e),_a=qe==="SEND"?`Send ${Ue}`:"Review transaction",bi={modalTitle:w.header||w.modalTitle||_a,buttonText:w.buttonText||"Submit"},Fo=()=>{Q||(W?x(W):E($||new Oe(new Ft("The user rejected the request",ot.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return y.current=Fo,er===void 0&&_t||tr?yi(rp,{children:[w.transactionInfo?.contractInfo?.imgUrl&&st(bs,{src:w.transactionInfo?.contractInfo?.imgUrl}),st(T,{title:bi.modalTitle,onClose:Fo}),st(lg,{children:st(zn,{})})]}):A!==null?st(ng,{txn:_e,onClose:Fo,receipt:A,transactionInfo:w.transactionInfo,tokenPrice:er,tokenSymbol:Ue,l1GasEstimate:B,receiptHeader:w.successHeader,receiptDescription:w.successDescription}):Z?st(og,{transactionError:Z,chainId:_e.chainId,onClose:Fo,onRetry:()=>{ce(),xa()}}):yi(rp,{children:[st(T,{title:bi.modalTitle,onClose:Fo}),yi(lg,{children:[yi(mb,{children:[st(cb,{txn:_e,txnFamily:qe,uiOptions:w,tokenSymbol:Ue,tokenPrice:er}),vt?st(ci,{from:vt.address,to:_e.to,txn:_e,transactionInfo:w.transactionInfo,gas:N||void 0,tokenPrice:er,tokenSymbol:Ue}):null]}),yi(fb,{children:[st(db,{children:q}),st(c1,{txn:_e,address:vt?.address??"",hasFunds:tt,balance:ze}),yi(pb,{children:[ue&&st(L,{onClick:wi,children:"Add Funds"}),st(ub,{disabled:Q||!tt,loading:!o||Q,loadingText:Q?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{et(!0);let $e=await t();if($e&&!Q&&vt)try{let ct=await ql($e,vt.address,o,_e,Yr);R(ct);let Zr=await ct.wait();O(Kl(Zr)),ce()}catch(ct){console.warn({transaction:_e,error:ct}),U(ct),I(new Oe(new Ft(ct.reason??"Error processing transaction",ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{et(!1)}},children:bi.buttonText})]})]})]})]})},lg=gi.div`
2492
2497
  display: flex;
2493
2498
  flex-direction: column;
2494
2499
  justify-content: space-between;
2495
2500
  flex-grow: 1;
2496
2501
  padding-bottom: 16px;
2497
- `,cb=gi.div`
2502
+ `,db=gi.div`
2498
2503
  font-size: 13px;
2499
2504
  color: var(--privy-color-error);
2500
2505
  width: 100%;
2501
2506
  margin-top: 16px;
2502
- `,db=gi.div`
2507
+ `,pb=gi.div`
2503
2508
  display: flex;
2504
2509
  direction: row;
2505
2510
  justify-content: space-between;
2506
2511
  align-items: center;
2507
2512
  gap: 8px;
2508
- `,pb=gi(W)`
2513
+ `,ub=gi(L)`
2509
2514
  transition: color 350ms ease, background-color 350ms ease;
2510
- `,ub=gi.div`
2515
+ `,mb=gi.div`
2511
2516
  height: 100%;
2512
2517
  display: flex;
2513
2518
  flex-direction: column;
2514
2519
  justify-content: space-evenly;
2515
2520
  flex-grow: 1;
2516
- `,mb=gi.div`
2521
+ `,fb=gi.div`
2517
2522
  display: flex;
2518
2523
  flex-direction: column;
2519
2524
  gap: 8px;
2520
- `;import{isHexString as fb}from"@ethersproject/bytes";import{toUtf8String as hb}from"@ethersproject/strings";import{useEffect as cg,useState as tc}from"react";import Lo,{css as yb}from"styled-components";import{Fragment as ug,jsx as Xe,jsxs as vi}from"react/jsx-runtime";var gb=e=>{if(!fb(e))return e;try{return hb(e)}catch{return e}},vb=e=>JSON.stringify(e,null,2),Cb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Xe(Tb,{children:Object.entries(r).map(([o,n])=>vi("li",{children:[vi("strong",{children:[o,":"]})," ",t(n)]},o))}):Xe("span",{children:String(r)});return Xe("div",{children:t(e)})},wb=e=>{let{types:t,primaryType:r,...o}=e.typedData;return vi(ug,{children:[Xe(pg,{children:Xe(Cb,{data:o})}),Xe(_o,{text:vb(e.typedData),itemName:"full payload to clipboard"})," "]})},dg=()=>{let{authenticated:e}=F(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=x(),[a,l]=tc(!0),[s,c]=tc(""),[u,m]=tc(),[h,y]=tc(null),C=h!==null;cg(()=>{e||o("LANDING")},[e]),cg(()=>{t(Cn).then(N=>{l(!1),N||(c("An error has occurred, please try again."),m(new Oe(new Ft(s,ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:g,data:_,confirmAndSign:T,onSuccess:w,onFailure:k,uiOptions:R}=n.signMessage,L={title:R.title||"Sign message",description:R.description||"Signing this message will not cost you any fees.",buttonText:R.buttonText||"Sign and continue"},S=N=>{N?w(N):k(u||new Oe(new Ft("The user rejected the request.",ot.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),y(null),c(""),m(void 0)};return i.current=()=>{S(h)},vi(ug,{children:[Xe(P,{onClose:()=>S(h)}),Xe(X,{}),vi(bb,{children:[Xe(Eb,{children:L.title}),Xe(Pb,{children:L.description}),g==="personal_sign"&&Xe(pg,{children:gb(_)}),g==="eth_signTypedData_v4"&&Xe(wb,{typedData:_}),Xe(Sb,{fail:!0,children:s}),Xe(_b,{success:C,loading:a,disabled:C,onClick:async()=>{try{let N=await T();y(N),c(""),setTimeout(()=>{S(N)},Be)}catch{c("An error has occurred, please try again."),m(new Oe(new Ft(s,ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?vi(xb,{children:[Xe(hl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Xe("span",{children:"Success"})]}):L.buttonText})]}),Xe(ae,{}),Xe(G,{protectedByPrivy:!0})]})},bb=Lo.div`
2525
+ `;import{isHexString as hb}from"@ethersproject/bytes";import{toUtf8String as yb}from"@ethersproject/strings";import{useEffect as dg,useState as tc}from"react";import Lo,{css as gb}from"styled-components";import{Fragment as mg,jsx as Xe,jsxs as vi}from"react/jsx-runtime";var vb=e=>{if(!hb(e))return e;try{return yb(e)}catch{return e}},Cb=e=>JSON.stringify(e,null,2),wb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Xe(Sb,{children:Object.entries(r).map(([o,n])=>vi("li",{children:[vi("strong",{children:[o,":"]})," ",t(n)]},o))}):Xe("span",{children:String(r)});return Xe("div",{children:t(e)})},bb=e=>{let{types:t,primaryType:r,...o}=e.typedData;return vi(mg,{children:[Xe(ug,{children:Xe(wb,{data:o})}),Xe(_o,{text:Cb(e.typedData),itemName:"full payload to clipboard"})," "]})},pg=()=>{let{authenticated:e}=F(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=S(),[a,l]=tc(!0),[s,c]=tc(""),[u,m]=tc(),[h,y]=tc(null),C=h!==null;dg(()=>{e||o("LANDING")},[e]),dg(()=>{t(wn).then(R=>{l(!1),R||(c("An error has occurred, please try again."),m(new Oe(new Ft(s,ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:g,data:x,confirmAndSign:E,onSuccess:w,onFailure:_,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"},W=R=>{R?w(R):_(u||new Oe(new Ft("The user rejected the request.",ot.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),y(null),c(""),m(void 0)};return i.current=()=>{W(h)},vi(mg,{children:[Xe(T,{onClose:()=>W(h)}),Xe(X,{}),vi(Eb,{children:[Xe(Pb,{children:O.title}),Xe(Tb,{children:O.description}),g==="personal_sign"&&Xe(ug,{children:vb(x)}),g==="eth_signTypedData_v4"&&Xe(bb,{typedData:x}),Xe(xb,{fail:!0,children:s}),Xe(kb,{success:C,loading:a,disabled:C,onClick:async()=>{try{let R=await E();y(R),c(""),setTimeout(()=>{W(R)},Be)}catch{c("An error has occurred, please try again."),m(new Oe(new Ft(s,ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?vi(_b,{children:[Xe(hl,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Xe("span",{children:"Success"})]}):O.buttonText})]}),Xe(ae,{}),Xe(G,{protectedByPrivy:!0})]})},Eb=Lo.div`
2521
2526
  display: flex;
2522
2527
  flex-direction: column;
2523
2528
  align-items: center;
2524
2529
  justify-content: center;
2525
- `,Eb=Lo.span`
2530
+ `,Pb=Lo.span`
2526
2531
  color: var(--privy-color-foreground);
2527
2532
  text-align: center;
2528
2533
  font-size: 1.125rem;
2529
2534
  font-weight: 500;
2530
2535
  line-height: 1.25rem; /* 111.111% */
2531
2536
  text-align: center;
2532
- `,Pb=Lo.span`
2537
+ `,Tb=Lo.span`
2533
2538
  margin-top: 4px;
2534
2539
  color: var(--privy-color-foreground);
2535
2540
  text-align: center;
@@ -2539,7 +2544,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2539
2544
  font-weight: 400;
2540
2545
  line-height: 20px; /* 142.857% */
2541
2546
  letter-spacing: -0.008px;
2542
- `,pg=Lo.div`
2547
+ `,ug=Lo.div`
2543
2548
  margin-top: 1.5rem;
2544
2549
  background-color: var(--privy-color-background-2);
2545
2550
  border-radius: var(--privy-border-radius-md);
@@ -2558,7 +2563,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2558
2563
  display: none; /* Safari and Chrome */
2559
2564
  }
2560
2565
  }
2561
- `,Tb=Lo.ul`
2566
+ `,Sb=Lo.ul`
2562
2567
  margin-left: 12px !important;
2563
2568
  white-space: nowrap;
2564
2569
 
@@ -2570,7 +2575,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2570
2575
  font-weight: 500 !important;
2571
2576
  }
2572
2577
  }
2573
- `,Sb=Lo.div`
2578
+ `,xb=Lo.div`
2574
2579
  line-height: 20px;
2575
2580
  height: 20px;
2576
2581
  font-size: 13px;
@@ -2580,22 +2585,22 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2580
2585
  width: 100%;
2581
2586
  margin-top: 16px;
2582
2587
  margin-bottom: 4px;
2583
- `,xb=Lo.span`
2588
+ `,_b=Lo.span`
2584
2589
  display: flex;
2585
2590
  align-items: center;
2586
2591
  gap: 8px;
2587
- `,_b=Lo(W)`
2592
+ `,kb=Lo(L)`
2588
2593
  transition: color 350ms ease, background-color 350ms ease;
2589
2594
 
2590
- ${e=>e.success&&yb`
2595
+ ${e=>e.success&&gb`
2591
2596
  &&&& {
2592
2597
  background-color: var(--privy-color-success);
2593
2598
  color: #ffffff;
2594
2599
  }
2595
2600
  `}
2596
- `;import Wb from"@heroicons/react/24/outline/EnvelopeIcon";import kb from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as Ab,useState as mg}from"react";import hg from"styled-components";import{Fragment as Mb,jsx as Sa,jsxs as fg}from"react/jsx-runtime";var yg=Ab((e,t)=>{let[r,o]=mg(""),[n,i]=mg(!1),{authenticated:a,user:l}=F(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:u,currentScreen:m}=x(),{enabled:h,token:y}=Ce(),C=Va(r),g=n,_=n||!C,T=async k=>{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,k),c("AWAITING_PASSWORDLESS_CODE")}catch(R){u({errorModalData:{error:R,previousScreen:m||"LANDING"}})}i(!1)},w=()=>{h&&!y&&!a?(u({captchaModalData:{callback:k=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,k)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):T(y)};return fg(Mb,{children:[Sa(Rb,{children:fg(Ib,{children:[Sa(kb,{}),Sa("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:k=>o(k.target.value),onKeyUp:k=>{k.key==="Enter"&&w()},value:r,autoComplete:"email"}),e.stacked?null:Sa(Mn,{isSubmitting:g,onClick:w,disabled:_,children:"Submit"})]})}),e.stacked?Sa(W,{loadingText:null,loading:g,disabled:_,onClick:w,children:"Submit"}):null]})}),Rb=hg.div`
2601
+ `;import Lb from"@heroicons/react/24/outline/EnvelopeIcon";import Ab from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as Rb,useState as fg}from"react";import yg from"styled-components";import{Fragment as Wb,jsx as Sa,jsxs as hg}from"react/jsx-runtime";var gg=Rb((e,t)=>{let[r,o]=fg(""),[n,i]=fg(!1),{authenticated:a,user:l}=F(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:u,currentScreen:m}=S(),{enabled:h,token:y}=Ce(),C=Va(r),g=n,x=n||!C,E=async _=>{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,_),c("AWAITING_PASSWORDLESS_CODE")}catch(A){u({errorModalData:{error:A,previousScreen:m||"LANDING"}})}i(!1)},w=()=>{h&&!y&&!a?(u({captchaModalData:{callback:_=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,_)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):E(y)};return hg(Wb,{children:[Sa(Ib,{children:hg(Mb,{children:[Sa(Ab,{}),Sa("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:_=>o(_.target.value),onKeyUp:_=>{_.key==="Enter"&&w()},value:r,autoComplete:"email"}),e.stacked?null:Sa(Wn,{isSubmitting:g,onClick:w,disabled:x,children:"Submit"})]})}),e.stacked?Sa(L,{loadingText:null,loading:g,disabled:x,onClick:w,children:"Submit"}):null]})}),Ib=yg.div`
2597
2602
  width: 100%;
2598
- `,Ib=hg.label`
2603
+ `,Mb=yg.label`
2599
2604
  display: block;
2600
2605
  position: relative;
2601
2606
  width: 100%;
@@ -2653,7 +2658,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2653
2658
  && > input::placeholder {
2654
2659
  color: var(--privy-color-foreground-3);
2655
2660
  }
2656
- `;import{Fragment as Lb,jsx as Oo,jsxs as Ob}from"react/jsx-runtime";var gg=()=>Ob(Lb,{children:[Oo(P,{},"header"),Oo(X,{}),Oo(Ee,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Oo(Wb,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Oo(dr,{children:Oo(yg,{stacked:!0})}),Oo(ae,{}),Oo(G,{protectedByPrivy:!0})]});import np from"styled-components";import{jsx as vg}from"react/jsx-runtime";var Cg=({style:e,...t})=>vg("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:vg("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as Fb,jsx as yn,jsxs as op}from"react/jsx-runtime";var wg=()=>{let{navigate:e}=x();return op(Fb,{children:[yn(P,{}),op(Nb,{children:[yn(Db,{children:yn(Cg,{})}),op(Ub,{children:[yn("h3",{children:"Unable to sign in"}),yn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),yn(W,{onClick:()=>{e("LANDING")},children:"Go back"})]}),yn(G,{protectedByPrivy:!0})]})},Nb=np.div`
2661
+ `;import{Fragment as Ob,jsx as Oo,jsxs as Nb}from"react/jsx-runtime";var vg=()=>Nb(Ob,{children:[Oo(T,{},"header"),Oo(X,{}),Oo(Ee,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Oo(Lb,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Oo(dr,{children:Oo(gg,{stacked:!0})}),Oo(ae,{}),Oo(G,{protectedByPrivy:!0})]});import np from"styled-components";import{jsx as Cg}from"react/jsx-runtime";var wg=({style:e,...t})=>Cg("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:Cg("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as Bb,jsx as gn,jsxs as op}from"react/jsx-runtime";var bg=()=>{let{navigate:e}=S();return op(Bb,{children:[gn(T,{}),op(Db,{children:[gn(Ub,{children:gn(wg,{})}),op(Fb,{children:[gn("h3",{children:"Unable to sign in"}),gn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),gn(L,{onClick:()=>{e("LANDING")},children:"Go back"})]}),gn(G,{protectedByPrivy:!0})]})},Db=np.div`
2657
2662
  display: flex;
2658
2663
  flex-direction: column;
2659
2664
  align-items: center;
@@ -2662,7 +2667,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2662
2667
  width: 100%;
2663
2668
  padding-top: 8px;
2664
2669
  padding-bottom: 32px;
2665
- `,Db=np.div`
2670
+ `,Ub=np.div`
2666
2671
  display: flex;
2667
2672
  align-items: center;
2668
2673
  justify-content: center;
@@ -2671,11 +2676,11 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2671
2676
  color: var(--privy-color-error);
2672
2677
  background-color: var(--privy-color-error-light);
2673
2678
  border-radius: 50%;
2674
- `,Ub=np.div`
2679
+ `,Fb=np.div`
2675
2680
  display: flex;
2676
2681
  flex-direction: column;
2677
2682
  gap: 8px;
2678
- `;import Hb,{createGlobalStyle as Gb}from"styled-components";var Bb=`
2683
+ `;import Gb,{createGlobalStyle as Vb}from"styled-components";var Hb=`
2679
2684
  *,
2680
2685
  ::before,
2681
2686
  ::after {
@@ -2905,7 +2910,7 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2905
2910
  [hidden] {
2906
2911
  display: none;
2907
2912
  }
2908
- `,bg=Bb;var Eg=Gb`
2913
+ `,Eg=Hb;var Pg=Vb`
2909
2914
  :root {
2910
2915
  // Borders
2911
2916
  --privy-border-radius-sm: 6px;
@@ -2938,10 +2943,10 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
2938
2943
  --privy-height-modal-full: 620px;
2939
2944
  --privy-height-modal-compact: 480px;
2940
2945
  };
2941
- `,Pg=Hb.div`
2946
+ `,Tg=Gb.div`
2942
2947
  // css normalize only the privy application to avoid conflicts
2943
2948
  // with consuming application
2944
- ${bg}
2949
+ ${Eg}
2945
2950
 
2946
2951
  // Privy styles
2947
2952
  color: var(--privy-color-foreground-2);
@@ -3000,4 +3005,4 @@ backed up.`}),mo(W,{onClick:R,children:"Confirm with Google"})]}),mo(G,{protecte
3000
3005
  opacity: 1;
3001
3006
  }
3002
3007
  }
3003
- `;import{jsx as lt,jsxs as Sg}from"react/jsx-runtime";var Kb={["LANDING"]:sy,["CONNECT_OR_CREATE"]:iy,["AWAITING_PASSWORDLESS_CODE"]:Vm,["AWAITING_CONNECTION"]:pf,["AWAITING_CONNECT_ONLY_CONNECTION"]:hf,["AWAITING_FARCASTER_CONNECTION"]:wh,["AWAITING_FARCASTER_SIGNER"]:xh,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:L1,["PHANTOM_INTERSTITIAL_SCREEN"]:U1,["LOGIN_FAILED_SCREEN"]:by,["AWAITING_OAUTH_SCREEN"]:I1,["ALLOWLIST_REJECTION_SCREEN"]:Wm,["USER_LIMIT_REACHED_SCREEN"]:wg,["INSTALL_PHANTOM_SCREEN"]:Bh,["LINK_EMAIL_SCREEN"]:ly,["LINK_PHONE_SCREEN"]:yy,["LINK_WALLET_SCREEN"]:gy,["LINK_PASSKEY_SCREEN"]:fy,["UPDATE_EMAIL_SCREEN"]:gg,["CONNECT_ONLY_LANDING_SCREEN"]:af,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:rf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Mf,["EMBEDDED_WALLET_CREATED_SCREEN"]:Sf,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Pf,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:F1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Y1,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:$1,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Af,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:dg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:lg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Mh,["FIAT_ON_RAMP_STATUS_SCREEN"]:Lh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:nh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:oh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:j1,["MFA_ENROLLMENT_FLOW_SCREEN"]:Uy,["CAPTCHA_SCREEN"]:Km,["ERROR_SCREEN"]:ah,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Oh,["AFFIRMATIVE_CONSENT_SCREEN"]:Rm},jb=["LANDING","AWAITING_CONNECTION"],Yb=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=F(),{headless:n}=Or(),{ready:i,currentScreen:a}=x(),{status:l,execute:s,reset:c,enabled:u}=Ce(),m=zb(null),h=wm(m),y=o&&a&&jb.includes(a)&&!n&&l==="ready";if(Tg(()=>{y&&s()},[y]),Tg(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Sg(ii,{id:"privy-modal-content",children:[lt(P,{}),lt(X,{}),lt(Ay,{children:lt(je,{})}),lt(ae,{}),lt(V,{})]});if(!a&&e)return lt(ii,{style:{height:h},id:"privy-modal-conent",children:lt("div",{ref:m,children:lt(Zd,{open:e,onClose:t})})});if(!a)return null;let C=Kb[a];return lt(ii,{style:{height:h},id:"privy-modal-content",children:Sg("div",{ref:m,children:[lt(oo,{if:!!e,children:lt(C,{})}),lt(oo,{if:!e,children:lt(Zd,{open:e,onClose:t})})]})})},Zb=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=x();return{gracefulClosePrivyModal:Vb(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},xg=({open:e})=>{let{app:t}=x(),{gracefulClosePrivyModal:r}=Zb(),[o,n]=qb(!1);Mc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=lt(Pg,{children:lt(Yb,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?lt(ky,{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 $b.createPortal(l,s)}return l};import{useState as Jb}from"react";import{useEffect as _g,useRef as kg}from"react";var rc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function No(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 De("missing_or_invalid_mfa","MFA verification failed, retry."));let m=await new Promise((h,y)=>{r.current={resolve:h,reject:y};let C=1e3*60*5;setTimeout(()=>{let g=new De("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),y(g)},C)});return await e(m)}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(m){if(m.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),m}if(c===null){let u=new De("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as o8}from"react/jsx-runtime";var Qb=function(e){return()=>`id-${e++}`}(0);function Xb(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Jt(e){return e.error!==void 0}var Ot=new rc,ip=new Map,e8=(e,t)=>typeof t=="bigint"?t.toString():t,t8=(e,t)=>`${e}${JSON.stringify(t,e8)}`;function Qt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=t8(e,t);if(e==="privy:wallet:create"){let l=ip.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=Qb();Ot.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{ip.delete(i)});return ip.set(i,a),a}function r8(e){switch(e.event){case"privy:iframe:ready":let t=Ot.dequeue(e.event,e.id);return Jt(e)?t.reject(new De(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ot.dequeue(e.event,e.id);return Jt(e)?r.reject(new De(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ot.dequeue(e.event,e.id);return Jt(e)?o.reject(new De(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ot.dequeue(e.event,e.id);return Jt(e)?n.reject(new De(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Ot.dequeue(e.event,e.id);return Jt(e)?i.reject(new De(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Ot.dequeue(e.event,e.id);return Jt(e)?a.reject(new De(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Ot.dequeue(e.event,e.id);return Jt(e)?l.reject(new De(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ag(e){let t=kg(null),r=kg(e.mfaMethods),o=Us(),[n,i]=Jb(!1);return _g(()=>{r.current=e.mfaMethods},[e.mfaMethods]),_g(()=>{if(!n)return;let a=t.current;if(!a)return;function l(h){h&&h.origin===e.origin&&Xb(h.data)&&r8(h.data)}let s={create(h){return Qt("privy:wallet:create",h,a,e.origin)},connect(h){return Qt("privy:wallet:connect",h,a,e.origin)},recover(h){return No(y=>Qt("privy:wallet:recover",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return No(y=>Qt("privy:wallet:rpc",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return No(y=>Qt("privy:wallet:set-recovery-password",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return No(y=>Qt("privy:mfa:verify",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return No(y=>Qt("privy:mfa:init-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return No(y=>Qt("privy:mfa:submit-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return No(y=>Qt("privy:mfa:unenroll",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return Qt("privy:mfa:clear",h,a,e.origin)},initFarcasterSigner(h){return Qt("privy:farcaster:init-signer",h,a,e.origin)},signFarcasterMessage(h){return Qt("privy:farcaster:sign",h,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},m=new AbortController;return su(()=>Qt("privy:iframe:ready",{},a,e.origin),{abortSignal:m.signal}).then(c,u),()=>{window.removeEventListener("message",l),m.abort()}},[n]),o8("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:za(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function oc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function Rg({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var Ig=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as jr,jsxs as Mg}from"react/jsx-runtime";var Do;function a8(e){return typeof e=="string"&&e.length===25}function Se(){if(!Do){let e=Y.get(Bo);return Promise.resolve(e||null)}return Do.getAccessToken()}var Wg,Au=(e,t)=>Wg(e,t),Lg,Ru=(e,t)=>Lg(e,t),Og,Iu=(e,t)=>Og(e,t),Ng,Mu=()=>Ng(),s8=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Y.put(Pi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},l8=({config:e,...t})=>{if(!a8(t.appId))throw new E("Cannot initialize the Privy provider with an invalid Privy app ID");Do||(Do=new Oi({appId:t.appId,apiUrl:t.apiUrl||Fa}));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."),jr(cm,{client:Do,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:jr(c8,{...t,client:Do})})},c8=e=>{let t=e.client,[r,o]=Ve(!1),[n,i]=Ve(!1),[a,l]=Ve(!1),[s,c]=Ve(null),[u,m]=Ve([]),h=Ci(u),[y,C]=Ve(!1),[g,_]=Ve(null),[T,w]=Ve(!1),[k,R]=Ve({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[L,S]=Ve({status:"initial"}),[N,$]=Ve(null),[K,q]=Ve(null),[I,Z]=Ve(null),U=Or(),ue=Ls(),[re,ce]=Ve(!0),[fe,Q]=Ve({}),[et,tt]=Ve(null),[xt,ze]=Ve(null),[Xt,_e]=Ve(!1),[He,er]=Ve(!1),_t=Ci(null),Ue=Ci(null),O=Ci(bm);t.onStoreToken=d=>{d&&D(O,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),D(O,"accessToken","onAccessTokenRemoved")};let ne=Ci(null),B=Ci(null),me=d=>{_(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},tr=d=>{U.embeddedWallets.createOnLogin!=="off"&&ce(!0),me(d)};Ar(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Ar(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!I){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(I,d.address,U.defaultChain,e.appId)},[I,s]),Ar(()=>{I&&xt?.(I)},[I]),Ar(()=>{(async()=>{if(!U.customAuth?.enabled)return;ce(!0);let{getCustomAccessToken:p,isLoading:f}=U.customAuth;if(!(!n||f))try{let v=await p();if(!v&&a){await gn.logout();return}if(!v||a)return;t.startAuthFlow(new vn(v));let{user:A,isNewUser:H}=await t.authenticate();if(!A){await gn.logout();return}c(A||null),C(H||!1),l(!0),er(!0)}catch(v){console.warn(v),a&&await gn.logout()}})()},[U.customAuth?.enabled,U.customAuth?.getCustomAccessToken,U.customAuth?.isLoading,n,a]),Ar(()=>{He&&I&&s&&ir(s,U.embeddedWallets.createOnLogin)&&(er(!1),Ei(s,Cn).catch(console.error))},[He&&I&&s]),Ar(()=>{async function d(){let p=Uo();s8();let f=n8();$(f),t.initializeConnectorManager({walletConnectCloudProjectId:U.walletConnectCloudProjectId,rpcConfig:U.rpcConfig,chains:U.chains,defaultChain:U.defaultChain,store:f,walletList:U.appearance.walletList,shouldEnforceDefaultChainOnConnect:U.shouldEnforceDefaultChainOnConnect,appName:U.name??"Privy"}),t.connectors?.initialize().then(()=>{xa()});let v=await t.getAuthenticatedUser();U.customAuth?.enabled||(l(!!v),v&&D(O,"login","onComplete",v,!1,!0,null,null),c(v)),p||he.setReadyToTrue(!!v),p&&(v?B.current="link":B.current="login")}!n&&ue&&d()},[t,et,n,ue]),Ar(()=>{if(!n)return;if(!s){_e(!0);return}if(!!!s.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){_e(!0);return}let p=!!u.find(f=>f.walletClientType==="privy");_e(p)},[n,s,u]);let Uo=()=>{let d=Ai();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 Ir(d)),tr("AWAITING_OAUTH_SCREEN"),!0)},vt=async(d,p,f,v)=>{let A=await t.connectors?.createWalletConnector(d,p)||null;wi(A,p,f,v)};async function wi(d,p,f,v){if(d)R({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:b});else return R({status:"disconnected",connectedWallet:null,connectError:new ee("Unable to connect to wallet."),connector:null,connectRetry:b}),v?.(null,f);d instanceof Nr&&p&&await d.resetConnection(p),R({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>wi(d,p,f,v)});try{let A=await d.connect({showPrompt:!0});if(U.shouldEnforceDefaultChainOnConnect&&!U.chains.find(H=>H.id===Number(A?.chainId))&&!(A?.connectorType==="wallet_connect_v2"&&A?.walletClientType==="metamask")){R(H=>({...H,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await A?.switchChain(U.defaultChain.id),A&&(A.chainId=bn(qo(U.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${U.defaultChain.id}`)}}return R(H=>({...H,status:"connected",connectedWallet:A,connectError:null,connectRetry:b})),A&&!B.current&&D(O,"connectWallet","onSuccess",A),v?.(A,f)}catch(A){return A instanceof Fe?(console.warn(A.cause?A.cause:A.message),B.current||D(O,"connectWallet","onError",A.privyErrorCode||"generic_connect_wallet_error")):(console.warn(A),B.current||D(O,"connectWallet","onError","unknown_connect_wallet_error")),R(H=>({...H,status:"disconnected",connectedWallet:null,connectError:A})),v?.(null,f)}}let Yr=async(d,p)=>{if(d===null)return;let f=new jo(d,p);t.startAuthFlow(f)},xa=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),f=d.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!yo()&&tr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new E("Connector not initialized");me("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),vt(p,f,void 0,Yr)};Ar(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let qe=()=>{if(!a)throw D(O,"linkAccount","onError","must_be_authenticated"),new E("User must be authenticated before linking an account.")},_a=()=>{qe(),ne.current="siwe",B.current="link",me("LINK_WALLET_SCREEN")},bi=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},Fo=async d=>{if(!t.connectors)throw new E("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(R(f=>({...f,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:b})),U.captchaEnabled&&!a){let f={callback:v=>Yr(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Q({captchaModalData:f}),tr("CAPTCHA_SCREEN")}else await Yr(d),tr("AWAITING_CONNECTION")},$e=async(d,p)=>{if(!U.fiatOnRamp.enabled)throw new E("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:v}=await Rh(t,d,p?.config??{},U.appearance.palette,U.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:v}}else throw new E("Unsupported fund provider. Currently supported option is `moonpay`.")},ct=()=>{m(d=>{let p=t.connectors?.wallets.map(f=>({...f,linked:bi(f),loginOrLink:async()=>{if(!await f.isConnected())throw new E("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new E("Cannot link or login with embedded wallet");Fo(f)},fund:async v=>{let{signedUrl:A,externalTransactionId:H}=await $e(f.address,v);Q({fiatOnRampPrompt:{signedUrl:A},fiatOnRampStatus:{externalTransactionId:H}}),me("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new E("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new E("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(f.address);c(v)}}))||[];return ms(d,p)?d:p})};Ar(()=>{ct()},[s?.linkedAccounts,a,n]),Ar(()=>{if(n){if(!t.connectors)throw new E("Connector not initialized");ct(),t.connectors.on("walletsUpdated",ct)}},[n]);let Zr=()=>{me(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Ar(()=>{if(!u[0])return;let d=u[0],p=h.current.find(v=>v.address===d.address),f;if(d.walletClientType==="privy"?f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&f){let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(v)}h.current=u},[u]);let Ei=async(d,p)=>{if(Te(d))throw D(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,A]=await Promise.all([he.initializeWalletProxy(p),Se()]);if(!v&&U.customAuth?.enabled)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!A||U.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((H,J)=>{ce(!0),Q({createWallet:{onSuccess:rt=>{D(O,"createWallet","onSuccess",rt),H(rt)},onFailure:rt=>{D(O,"createWallet","onError","unknown_embedded_wallet_error"),J(rt)},callAuthOnSuccessOnClose:!1}}),me("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:A});let H=await he.refreshUser(),J=Te(H);if(!J)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(O,"createWallet","onSuccess",J),J}},Jr=d=>{if(!U.chains.map(p=>p.id).includes(d))throw new ee(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},ka=(d,p,f)=>new Promise(async(v,A)=>{if(!a||!s){D(O,"sendTransaction","onError","must_be_authenticated"),A(new Error("User must be authenticated before signing with a Privy wallet"));return}let H=Te(s);if(!H){D(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have a Privy wallet before signing"));return}ce(!0);let J=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ke=d.chainId?Number(d.chainId):J.chainId;Jr(Ke);let rt=Object.assign({},d,{chainId:Ke}),rr=async()=>{let ke=await Se();if(!ke||!I){D(O,"sendTransaction","onError","embedded_wallet_not_found"),A(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await he.recoverEmbeddedWallet()){D(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(new Error("Unable to connect to wallet"));return}let Ct=Xr(rt.chainId,U.chains,U.rpcConfig,{appId:e.appId}),ic=await mi(H.address,rt,Ct);if(U.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Hg}=await ui(ic,Ct),{hasSufficientFunds:Gg}=await $l(H.address,ic,Hg,Ct);if(!Gg)throw new Oe(new Ft("Wallet has insufficient funds for this transaction.",ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let lp=await ql(ke,H.address,I,ic,Ct);D(O,"sendTransaction","onSuccess",lp),v(lp)}catch(Dt){D(O,"sendTransaction","onError","transaction_failure"),A(Dt)}};if(U.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),rr();else{let ke={transactionRequest:rt,onSuccess:Ct=>{D(O,"sendTransaction","onSuccess",Ct),v(Ct)},onFailure:Ct=>{D(O,"sendTransaction","onError","transaction_failure"),A(Ct)},uiOptions:p||{},fundWalletConfig:f},Dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Ct=>{D(O,"sendTransaction","onError","unknown_connect_wallet_error"),A(Ct)}};Q({connectWallet:Dt,sendTransaction:ke}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function sp(){return new Promise(async(d,p)=>{let f=await Se();if(!f||!I)throw new Error("Must have valid access token to enroll in MFA");try{await I.verifyMfa({accessToken:f}),d()}catch(v){p(v)}})}let Nt=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new E(`User already has an account of type ${d} linked.`)},gn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Zr,linkWallet:_a,linkEmail:()=>{qe(),Nt("email"),ne.current="email",B.current="link",me("LINK_EMAIL_SCREEN")},linkPhone:()=>{qe(),Nt("phone"),ne.current="sms",B.current="link",me("LINK_PHONE_SCREEN")},linkGoogle:async()=>{qe(),Nt("google"),B.current="link",await he.initLoginWithOAuth("google")},linkTwitter:async()=>{qe(),Nt("twitter"),B.current="link",await he.initLoginWithOAuth("twitter")},linkDiscord:async()=>{qe(),Nt("discord"),B.current="link",await he.initLoginWithOAuth("discord")},linkGithub:async()=>{qe(),Nt("github"),B.current="link",await he.initLoginWithOAuth("github")},linkSpotify:async()=>{qe(),Nt("spotify"),B.current="link",await he.initLoginWithOAuth("spotify")},linkInstagram:async()=>{qe(),Nt("instagram"),B.current="link",await he.initLoginWithOAuth("instagram")},linkTiktok:async()=>{qe(),Nt("tiktok"),B.current="link",await he.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{qe(),Nt("linkedin"),B.current="link",await he.initLoginWithOAuth("linkedin")},linkApple:async()=>{qe(),Nt("apple"),B.current="link",await he.initLoginWithOAuth("apple")},linkPasskey:async()=>{qe(),Nt("passkey"),await he.initLinkWithPasskey(),me("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{qe(),Nt("farcaster"),await he.initLoginWithFarcaster(),B.current="link",ne.current="farcaster",me("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(qe(),!s?.email)throw new E("User does not have an email linked to their account.");B.current="link",ne.current="email",me("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(f=>{tt(v=>f.bind(v))});if(tt(null),p){console.warn(d);return}}if(a){console.warn(d);return}B.current="login",tr("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{tt(()=>d)}),tt(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}tr("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&I)try{await I.clearMfa({userId:s.id})}catch{}c(null),l(!1),_(null),D(O,"logout","onSuccess"),B.current=null,ne.current=null,o(!1),Y.del(Ti)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Me;let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new Me:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new ap(new Mr(new Me));let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new ap(new Mr(new Me)):new ap(new Mr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Co(new Me);let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new Co(new Me):new Co(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(v=>nc(v.address)===nc(d)),f=s?.linkedAccounts.find(v=>v.type==="wallet"&&nc(v.address)===nc(d));if(!p||!await p.isConnected())q(d),_a();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw D(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ei(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw D(O,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Te(s);if(!d||!I)throw D(O,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw D(O,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await sp()}catch(p){throw D(O,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,f)=>{ce(!0);let v={onSuccess:H=>{D(O,"setWalletPassword","onSuccess",H),p(H)},onFailure:H=>{D(O,"setWalletPassword","onError","user_exited_set_password_flow"),f(H)},callAuthOnSuccessOnClose:!1},A={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:H=>{D(O,"setWalletPassword","onError","unknown_connect_wallet_error"),f(H)}};Q({setWalletPassword:v,connectWallet:A}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(f,v)=>{if(!a||!s){D(O,"signMessage","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let A=Te(s);if(!A){D(O,"signMessage","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){D(O,"signMessage","onError","invalid_message"),v(new Error("Message must be a non-empty string"));return}ce(!0);let H=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let J=await Se();if(!I||!J)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:A.address}});let{response:rt}=await I.rpc({accessToken:J,address:A.address,request:{method:"personal_sign",params:[d,A.address]}}),rr=rt.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:A.address}}),rr};if(U.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let J=await H();D(O,"signMessage","onSuccess",J),f(J)}catch(J){D(O,"signMessage","onError","unable_to_sign"),v(J??new Oe("Unable to sign message"))}}else{let rt={method:"personal_sign",data:d,confirmAndSign:H,onSuccess:ke=>{D(O,"signMessage","onSuccess",ke),f(ke)},onFailure:ke=>{D(O,"signMessage","onError","unable_to_sign"),v(ke)},uiOptions:p||{}},rr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:ke=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),v(ke)}};Q({signMessage:rt,connectWallet:rr}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(f,v)=>{if(!a||!s){D(O,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let A=Te(s);if(!A){D(O,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}ce(!0);let H=$a(d),J=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ke=await Se();if(!I||!Ke)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:A.address}});let{response:rr}=await I.rpc({accessToken:Ke,address:A.address,request:{method:"eth_signTypedData_v4",params:[A.address,H]}}),ke=rr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:A.address}}),ke};if(U.embeddedWallets.noPromptOnSignature||(U.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ke=await J();D(O,"signTypedData","onSuccess",Ke),f(Ke)}catch(Ke){D(O,"signTypedData","onError","unable_to_sign"),v(Ke??new Oe("Unable to sign message"))}}else{let rr={method:"eth_signTypedData_v4",data:H,confirmAndSign:J,onSuccess:Dt=>{D(O,"signTypedData","onSuccess",Dt),f(Dt)},onFailure:Dt=>{D(O,"signTypedData","onError","unable_to_sign"),v(Dt)},uiOptions:p||{}},ke={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Dt=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),v(Dt)}};Q({signMessage:rr,connectWallet:ke}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,f)=>{let A=await(await ka(d,p,f)).wait();return Kl(A)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Te(s)){p(new Error("Must have a Privy wallet before exporting"));return}ce(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(Q(fe),!await Se()||!I){p(new Error("Must have valid access token to enroll in MFA"));return}if(!I){p(new Error("Must have a Privy wallet before exporting"));return}let H={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};Q({keyExport:H,connectWallet:v}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:sp,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new E("Invalid MFA code");_t.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((H,J)=>{Ue.current={resolve:H,reject:J}});break;case"passkey":if(typeof p=="string")throw new E("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),A=Ig(v);_t.current?.resolve({mfaMethod:d,mfaCode:A,relyingParty:window.origin}),await new Promise((H,J)=>{Ue.current={resolve:H,reject:J}});break;default:throw _t.current?.reject(new E("Unsupported MFA method")),new E(`Unsupported MFA method: ${d}`)}},cancel(){_t.current?.reject(new E("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,f)=>{if(!d){he.closePrivyModal(),p();return}U.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."),Q({mfaEnrollmentFlow:{mfaMethods:U.mfa.methods,onSuccess:p,onFailure:f}}),me("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Se();if(!d||!I)throw new Error("Must have valid access token to enroll in MFA");let p=await I.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let f=await t.getAuthenticatedUser();c(f)},async unenroll(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await I.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await I.unenrollMfa({method:d,accessToken:p});let f=await t.getAuthenticatedUser();c(f)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Se(),p=s?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!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 he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let v=await I.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let A=await t.getAuthenticatedUser();c(A||s||null)}Q({farcasterSigner:v}),me("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Se(),p=s?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!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 he.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(A=>Uint8Array.from(A.match(/.{1,2}/g).map(H=>parseInt(H,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Se(),f=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(!I||!f)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 he.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 A=await import("@simplewebauthn/browser"),H=await I.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:A.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(A.base64URLStringToBuffer(H.signature))},isHeadlessOAuthLoading:T,loginWithCode(d){return he.loginWithCode(d)},initLoginWithEmail(d){return he.initLoginWithEmail(d)},initLoginWithSms(d){return he.initLoginWithSms(d)},otpState:L,fundWallet(d,p){return he.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return he.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return he.loginWithHeadlessOAuth(d)},isModalOpen:r};Wg=gn.signMessage,Lg=gn.signTypedData,Og=async(...d)=>{let p=await ka(...d);return U.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let he=(()=>({isNewUserThisSession:y,linkingHint:K,pendingTransaction:null,walletConnectionStatus:k,mipdStore:N,connectors:t.connectors?.walletConnectors??[],rpcConfig:U.rpcConfig,chains:U.chains,appId:e.appId,showFiatPrices:U.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>U.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(I)return I;let p=new Promise(A=>{ze(()=>H=>A(H))}),f=new Promise(A=>setTimeout(()=>A(null),d)),v=await Promise.race([p,f]);return ze(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,f;p&&ne.current&&(f=s?.linkedAccounts.filter(v=>v.latestVerifiedAt!==null&&!(v.type==="wallet"&&v.walletClientType==="privy")).sort((v,A)=>A.latestVerifiedAt.getTime()-v.latestVerifiedAt.getTime())[0]),B.current==="login"&&ne.current?d.shouldCallAuthOnSuccess&&p?(D(O,"login","onComplete",s,y,!1,ne.current,f??null),e.onSuccess?.(s,y)):D(O,"login","onError","exited_auth_flow"):B.current==="link"&&ne.current&&f&&(d.isSuccess&&p?D(O,"linkAccount","onSuccess",s,ne.current,f):D(O,"linkAccount","onError","exited_link_flow")),q(null),B.current=null,ne.current=null,C(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:me,connectWallet:wi,initLoginWithWallet:async(d,p)=>{ne.current="siwe",Yr(d,p)},loginWithWallet:async()=>{if(!n)throw new fo;if(!(t.authFlow instanceof jo))throw new E("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),ne.current="siwe"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),ne.current="siwe"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(d||s||null),C(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Si(d);t.startAuthFlow(p);try{ne.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw B.current==="login"?D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new fo;if(!(t.authFlow instanceof Si))throw new E("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),ne.current="farcaster"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),ne.current="farcaster"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d||null),C(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ne.current=d,cc()){if(d==="google"&&oc(window.navigator.userAgent)){tr("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{tr("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Y.del(Vo);let f=new Ir({provider:d});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},async recoveryOAuthFlow(d,p,f){let{url:v,codeVerifier:A,stateCode:H}=await Cf({api:Do.api,provider:d});if(!v)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new E("Recovery OAuth failed");let J,Ke;try{let ke=await Rg({url:v,popup:f});if(J=ke.stateCode,Ke=ke.authorizationCode,J!==H)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:H??"",returnedStateCode:J??""}}),new E("Unexpected auth flow. This may be a phishing attempt.")}catch(ke){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:ke.toString(),provider:d}}),new E("Recovery OAuth failed")}let[rt,rr]=await Promise.all([Se(),wf({api:Do.api,provider:d,codeVerifier:A,stateCode:J,authorizationCode:Ke})]);if(!I)throw new E("Cannot connect to wallet proxy");switch(p){case"recover":let ke=fe.recoverWallet?.privyWallet?.address;if(!ke)throw new E("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:ke,recoveryMethod:d}}),await I.recover({address:ke,accessToken:rt,recoveryAccessToken:rr,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:ke,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await I.create({accessToken:rt,recoveryAccessToken:rr,recoveryMethod:d});let Dt=await he.refreshUser(),Ct=Te(Dt);if(!Ct)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Ct.address}}),D(O,"createWallet","onSuccess",Ct);break;default:throw new E("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Ir))throw new E("Must initialize OAuth flow before calling loginWithOAuth");let p=Y.get(Ho),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:f??""}}),new E("Unexpected auth flow. This may be a phishing attempt.");let v,A,H;if(a)try{v=await t.link(),ne.current=d}catch(J){throw D(O,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}else try{let J=await t.authenticate();v=J.user,A=J.isNewUser,H=J.oAuthProviderTokens,ne.current=d}catch(J){throw B.current==="login"?D(O,"login","onError",J.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(O,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}return c(v),C(A||!1),l(!0),H},async initLoginWithPasskey(d){let p=new Ko(d);t.startAuthFlow(p),B.current="login";try{ne.current="passkey",await p.initAuthenticationFlow()}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new fo;if(!(t.authFlow instanceof Ko))throw new E("Must initialize Passkey flow first.");if(ne.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d,p;try{ne.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d),C(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Ko(d);t.startAuthFlow(p),B.current="link",ne.current="passkey";try{await p.initLinkFlow()}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},async linkWithPasskey(){if(!n)throw new fo;if(!(t.authFlow instanceof Ko))throw new E("Must initialize Passkey flow first.");if(ne.current!=="passkey")throw new E("Must init login with Passkey flow first.");let d;try{ne.current="passkey",d=await t.link()}catch(p){throw D(O,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(cc()){if(d==="google"&&oc(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Ir({provider:d,headless:!0});p&&f.addCaptchaToken(p);let v=await t.startAuthFlow(f).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){w(!0),t.startAuthFlow(new Ir(d));let p=Y.get(Ho),f=d.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:f??""}}),w(!1),new E("Unexpected auth flow. This may be a phishing attempt.");let v,A;if(a)try{v=await t.link(),ne.current=d.provider}catch(H){throw D(O,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account"),H}else try{({user:v,isNewUser:A}=await t.authenticate()),ne.current=d.provider}catch(H){throw B.current==="login"?D(O,"login","onError",H.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(O,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account"),H}return c(v),C(A||!1),l(!0),w(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let f=new ho(d,p);t.startAuthFlow(f);try{ne.current="email",await f.sendCodeEmail()}catch(v){throw B.current==="login"?D(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},initUpdateEmail:async(d,p,f)=>{let v=new Na(d,p,f);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{S({status:"sending-code"});let f=new Yo(d,p);t.startAuthFlow(f);try{ne.current="sms",await f.sendSmsCode(),S({status:"awaiting-code-input"})}catch(v){throw S({status:"error",error:v}),B.current==="login"?D(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(S({status:"submitting-code"}),!n){let A=new fo;throw S({status:"error",error:A}),A}if(t.authFlow instanceof ho)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Yo)t.authFlow.meta.smsCode=d.trim();else{let A=new E("Must initialize a passwordless code flow first");throw S({status:"error",error:A}),A}let p=await Se(),f,v;if(p&&t.sessionHasActiveToken())try{f=await t.link()}catch(A){throw S({status:"error",error:A}),D(O,"linkAccount","onError",A.privyErrorCode||"failed_to_link_account"),A}else try{({user:f,isNewUser:v}=await t.authenticate())}catch(A){throw S({status:"error",error:A}),D(O,"login","onError",A.privyErrorCode||"unknown_auth_error"),A}c(f||s||null),C(v||!1),l(!0),S({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:I,createAnalyticsEvent:({eventName:d,payload:p,timestamp:f})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:f}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let f=s?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy"),v=await Se();if(!v||!I||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ce(!0);try{await I.connect({accessToken:v,address:f.address}),d(!0)}catch(A){if($n(A)&&f.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await I.recover({address:f.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:f.address}}),d(!0);else if($n(A)){Q({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let H=al(f.recoveryMethod);me(H)}else p(A)}}),getFiatOnRampConfig:$e,setReadyToTrue:d=>{i(!0),et?.(d)},updateWallets:()=>ct(),fundWallet:async(d,p)=>{let{signedUrl:f,externalTransactionId:v}=await $e(d,p);Q({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:v}}),me("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Se(),f=s?.linkedAccounts.find(A=>A.type==="wallet"&&A.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let A=await t.getAuthenticatedUser();c(A||s||null)}return v}}))();Ng=he.recoverEmbeddedWallet;let Bg=i8(()=>({wallets:u,ready:Xt}),[u,Xt]);return jr(ge.Provider,{value:gn,children:jr(Ic.Provider,{value:O,children:jr(jd.Provider,{value:Bg,children:Mg(vm,{...U,children:[e.children,Mg(Rc.Provider,{value:he,children:[!U.headless&&U.captchaEnabled&&n&&!a&&jr(Ac,{delayedExecution:!1}),jr(Eg,{theme:{...U.appearance.palette||{}}}),jr(pm,{data:fe,setModalData:Q,setInitialScreen:_,initialScreen:g,authenticated:a,open:r,children:jr(xg,{open:r})}),re&&ue?jr(Ag,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:_t,mfaSubmitPromise:Ue,onLoad:Z,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as d8}from"react";function p8(e){let{login:t}=d8(ge);return Ne("login",e),{login:t}}import{useContext as u8}from"react";function m8(e){let{logout:t}=u8(ge);return Ne("logout",e),{logout:t}}import{useCallback as Dg,useEffect as f8}from"react";function h8(){let e=Ce(),t=Ls(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=F(),l=Dg(async c=>{if(e.enabled&&e.status!=="success")throw new gr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=Dg(async()=>{let c=Ai();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{$o()}},[o]);return f8(()=>{let c=Ai();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Ug}from"react";var y8=()=>{let e=Ce(),{initLoginWithEmail:t,loginWithCode:r}=F(),o=Ug(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=Ug(async({code:i})=>{if(e.enabled&&e.status==="error")throw new gr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Fg}from"react";var g8=()=>{let e=Ce(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=F(),n=Fg(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=Fg(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new gr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as v8}from"react";function C8(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkFarcaster:y}=v8(ge);return Ne("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkFarcaster:y}}import{useContext as w8}from"react";function b8(e){let{connectWallet:t}=w8(ge);return Ne("connectWallet",e),{connectWallet:t}}import{useContext as E8}from"react";function P8(e){let{createWallet:t}=E8(ge);return Ne("createWallet",e),{createWallet:t}}var T8=()=>{let{fundWallet:e}=F();return{fundWallet:e}};import{useContext as S8}from"react";function x8(e){let{sendTransaction:t}=S8(ge);return Ne("sendTransaction",e),{sendTransaction:t}}import{useContext as _8}from"react";function k8(e){let{setWalletPassword:t}=_8(ge);return Ne("setWalletPassword",e),{setWalletPassword:t}}import{useContext as A8}from"react";function R8(e){let{signMessage:t}=A8(ge);return Ne("signMessage",e),{signMessage:t}}import{useContext as I8}from"react";function M8(e){let{signTypedData:t}=I8(ge);return Ne("signTypedData",e),{signTypedData:t}}import{useContext as W8}from"react";var L8=()=>{let{isModalOpen:e}=W8(ge);return{isOpen:e}};import{useContext as O8}from"react";function N8(e){let{getAccessToken:t}=O8(ge);return Ne("accessToken",e),{getAccessToken:t}}function D8(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function U8(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Mr as AsExternalProvider,Ac as Captcha,Li as ConnectorManager,Oi as PrivyClient,l8 as PrivyProvider,Me as PrivyProxyProvider,Mi as SUPPORTED_CHAINS,mc as VERSION,kt as WalletConnector,U8 as addRpcUrlOverrideToChain,Xc as errorIndicatesMaxMfaRetries,on as errorIndicatesMfaTimeout,nn as errorIndicatesMfaVerificationFailed,Se as getAccessToken,b8 as useConnectWallet,P8 as useCreateWallet,D8 as useExperimentalFarcasterSigner,T8 as useFundWallet,C8 as useLinkAccount,p8 as useLogin,y8 as useLoginWithEmail,h8 as useLoginWithOAuth,g8 as useLoginWithSms,m8 as useLogout,la as useMfa,Sr as useMfaEnrollment,L8 as useModalStatus,F as usePrivy,Mc as useRegisterMfaListener,x8 as useSendTransaction,k8 as useSetWalletPassword,R8 as useSignMessage,M8 as useSignTypedData,N8 as useToken,Ca as useWallets};
3008
+ `;import{jsx as lt,jsxs as xg}from"react/jsx-runtime";var jb={["LANDING"]:ly,["CONNECT_OR_CREATE"]:ay,["AWAITING_PASSWORDLESS_CODE"]:zm,["AWAITING_CONNECTION"]:uf,["AWAITING_CONNECT_ONLY_CONNECTION"]:yf,["AWAITING_FARCASTER_CONNECTION"]:bh,["AWAITING_FARCASTER_SIGNER"]:_h,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:O1,["PHANTOM_INTERSTITIAL_SCREEN"]:F1,["LOGIN_FAILED_SCREEN"]:Ey,["AWAITING_OAUTH_SCREEN"]:M1,["ALLOWLIST_REJECTION_SCREEN"]:Lm,["USER_LIMIT_REACHED_SCREEN"]:bg,["INSTALL_PHANTOM_SCREEN"]:Hh,["LINK_EMAIL_SCREEN"]:cy,["LINK_PHONE_SCREEN"]:gy,["LINK_WALLET_SCREEN"]:vy,["LINK_PASSKEY_SCREEN"]:hy,["UPDATE_EMAIL_SCREEN"]:vg,["CONNECT_ONLY_LANDING_SCREEN"]:sf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:of,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Wf,["EMBEDDED_WALLET_CREATED_SCREEN"]:xf,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Tf,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:B1,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Z1,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:K1,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Rf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:pg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:cg,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Wh,["FIAT_ON_RAMP_STATUS_SCREEN"]:Oh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:ih,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:nh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:Y1,["MFA_ENROLLMENT_FLOW_SCREEN"]:Fy,["CAPTCHA_SCREEN"]:jm,["ERROR_SCREEN"]:sh,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Nh,["AFFIRMATIVE_CONSENT_SCREEN"]:Im},Yb=["LANDING","AWAITING_CONNECTION"],Zb=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=F(),{headless:n}=sr(),{ready:i,currentScreen:a}=S(),{status:l,execute:s,reset:c,enabled:u}=Ce(),m=qb(null),h=wm(m),y=o&&a&&Yb.includes(a)&&!n&&l==="ready";if(Sg(()=>{y&&s()},[y]),Sg(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return xg(ii,{id:"privy-modal-content",children:[lt(T,{}),lt(X,{}),lt(Ry,{children:lt(je,{})}),lt(ae,{}),lt(V,{})]});if(!a&&e)return lt(ii,{style:{height:h},id:"privy-modal-conent",children:lt("div",{ref:m,children:lt(Zd,{open:e,onClose:t})})});if(!a)return null;let C=jb[a];return lt(ii,{style:{height:h},id:"privy-modal-content",children:xg("div",{ref:m,children:[lt(oo,{if:!!e,children:lt(C,{})}),lt(oo,{if:!e,children:lt(Zd,{open:e,onClose:t})})]})})},Jb=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=S();return{gracefulClosePrivyModal:zb(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},_g=({open:e})=>{let{app:t}=S(),{gracefulClosePrivyModal:r}=Jb(),[o,n]=$b(!1);Mc({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=lt(Tg,{children:lt(Zb,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?lt(Ay,{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 Kb.createPortal(l,s)}return l};import{useState as Qb}from"react";import{useEffect as kg,useRef as Ag}from"react";var rc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function No(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 De("missing_or_invalid_mfa","MFA verification failed, retry."));let m=await new Promise((h,y)=>{r.current={resolve:h,reject:y};let C=1e3*60*5;setTimeout(()=>{let g=new De("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),y(g)},C)});return await e(m)}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(m){if(m.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),m}if(c===null){let u=new De("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as n8}from"react/jsx-runtime";var Xb=function(e){return()=>`id-${e++}`}(0);function e8(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Jt(e){return e.error!==void 0}var Ot=new rc,ip=new Map,t8=(e,t)=>typeof t=="bigint"?t.toString():t,r8=(e,t)=>`${e}${JSON.stringify(t,t8)}`;function Qt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=r8(e,t);if(e==="privy:wallet:create"){let l=ip.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=Xb();Ot.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{ip.delete(i)});return ip.set(i,a),a}function o8(e){switch(e.event){case"privy:iframe:ready":let t=Ot.dequeue(e.event,e.id);return Jt(e)?t.reject(new De(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ot.dequeue(e.event,e.id);return Jt(e)?r.reject(new De(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ot.dequeue(e.event,e.id);return Jt(e)?o.reject(new De(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ot.dequeue(e.event,e.id);return Jt(e)?n.reject(new De(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Ot.dequeue(e.event,e.id);return Jt(e)?i.reject(new De(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Ot.dequeue(e.event,e.id);return Jt(e)?a.reject(new De(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Ot.dequeue(e.event,e.id);return Jt(e)?l.reject(new De(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=Ot.dequeue(e.event,e.id);return Jt(e)?s.reject(new De(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Rg(e){let t=Ag(null),r=Ag(e.mfaMethods),o=Us(),[n,i]=Qb(!1);return kg(()=>{r.current=e.mfaMethods},[e.mfaMethods]),kg(()=>{if(!n)return;let a=t.current;if(!a)return;function l(h){h&&h.origin===e.origin&&e8(h.data)&&o8(h.data)}let s={create(h){return Qt("privy:wallet:create",h,a,e.origin)},connect(h){return Qt("privy:wallet:connect",h,a,e.origin)},recover(h){return No(y=>Qt("privy:wallet:recover",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return No(y=>Qt("privy:wallet:rpc",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return No(y=>Qt("privy:wallet:set-recovery-password",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return No(y=>Qt("privy:mfa:verify",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return No(y=>Qt("privy:mfa:init-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return No(y=>Qt("privy:mfa:submit-enrollment",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return No(y=>Qt("privy:mfa:unenroll",{...h,...y},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return Qt("privy:mfa:clear",h,a,e.origin)},initFarcasterSigner(h){return Qt("privy:farcaster:init-signer",h,a,e.origin)},signFarcasterMessage(h){return Qt("privy:farcaster:sign",h,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},m=new AbortController;return su(()=>Qt("privy:iframe:ready",{},a,e.origin),{abortSignal:m.signal}).then(c,u),()=>{window.removeEventListener("message",l),m.abort()}},[n]),n8("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:za(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function oc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function Ig({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var Mg=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as jr,jsxs as Wg}from"react/jsx-runtime";var Do;function s8(e){return typeof e=="string"&&e.length===25}function Se(){if(!Do){let e=Y.get(Bo);return Promise.resolve(e||null)}return Do.getAccessToken()}var Lg,Au=(e,t)=>Lg(e,t),Og,Ru=(e,t)=>Og(e,t),Ng,Iu=(e,t)=>Ng(e,t),Dg,Mu=()=>Dg(),l8=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Y.put(Pi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},c8=({config:e,...t})=>{if(!s8(t.appId))throw new P("Cannot initialize the Privy provider with an invalid Privy app ID");Do||(Do=new Oi({appId:t.appId,apiUrl:t.apiUrl||Fa}));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."),jr(cm,{client:Do,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:jr(d8,{...t,client:Do})})},d8=e=>{let t=e.client,[r,o]=Ve(!1),[n,i]=Ve(!1),[a,l]=Ve(!1),[s,c]=Ve(null),[u,m]=Ve([]),h=Ci(u),[y,C]=Ve(!1),[g,x]=Ve(null),[E,w]=Ve(!1),[_,A]=Ve({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[O,W]=Ve({status:"initial"}),[R,q]=Ve(null),[K,$]=Ve(null),[I,Z]=Ve(null),U=sr(),ue=Ls(),[re,ce]=Ve(!0),[fe,Q]=Ve({}),[et,tt]=Ve(null),[xt,ze]=Ve(null),[Xt,_e]=Ve(!1),[He,er]=Ve(!1),_t=Ci(null),Ue=Ci(null),N=Ci(bm);t.onStoreToken=d=>{d&&D(N,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),D(N,"accessToken","onAccessTokenRemoved")};let ne=Ci(null),B=Ci(null),me=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},tr=d=>{U.embeddedWallets.createOnLogin!=="off"&&ce(!0),me(d)};Rr(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Rr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!I){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(I,d.address,U.defaultChain,e.appId)},[I,s]),Rr(()=>{I&&xt?.(I)},[I]),Rr(()=>{(async()=>{if(!U.customAuth?.enabled)return;ce(!0);let{getCustomAccessToken:p,isLoading:f}=U.customAuth;if(!(!n||f))try{let v=await p();if(!v&&a){await vn.logout();return}if(!v||a)return;t.startAuthFlow(new Cn(v));let{user:k,isNewUser:H}=await t.authenticate();if(!k){await vn.logout();return}c(k||null),C(H||!1),l(!0),er(!0)}catch(v){console.warn(v),a&&await vn.logout()}})()},[U.customAuth?.enabled,U.customAuth?.getCustomAccessToken,U.customAuth?.isLoading,n,a]),Rr(()=>{He&&I&&s&&ir(s,U.embeddedWallets.createOnLogin)&&(er(!1),Ei(s,wn).catch(console.error))},[He&&I&&s]),Rr(()=>{async function d(){let p=Uo();l8();let f=i8();q(f),t.initializeConnectorManager({walletConnectCloudProjectId:U.walletConnectCloudProjectId,rpcConfig:U.rpcConfig,chains:U.chains,defaultChain:U.defaultChain,store:f,walletList:U.appearance.walletList,shouldEnforceDefaultChainOnConnect:U.shouldEnforceDefaultChainOnConnect,appName:U.name??"Privy"}),t.connectors?.initialize().then(()=>{xa()});let v=await t.getAuthenticatedUser();U.customAuth?.enabled||(l(!!v),v&&D(N,"login","onComplete",v,!1,!0,null,null),c(v)),p||he.setReadyToTrue(!!v),p&&(v?B.current="link":B.current="login")}!n&&ue&&d()},[t,et,n,ue]),Rr(()=>{if(!n)return;if(!s){_e(!0);return}if(!!!s.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){_e(!0);return}let p=!!u.find(f=>f.walletClientType==="privy");_e(p)},[n,s,u]);let Uo=()=>{let d=Ai();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 Mr(d)),tr("AWAITING_OAUTH_SCREEN"),!0)},vt=async(d,p,f,v)=>{let k=await t.connectors?.createWalletConnector(d,p)||null;wi(k,p,f,v)};async function wi(d,p,f,v){if(d)A({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:b});else return A({status:"disconnected",connectedWallet:null,connectError:new ee("Unable to connect to wallet."),connector:null,connectRetry:b}),v?.(null,f);d instanceof Nr&&p&&await d.resetConnection(p),A({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>wi(d,p,f,v)});try{let k=await d.connect({showPrompt:!0});if(U.shouldEnforceDefaultChainOnConnect&&!U.chains.find(H=>H.id===Number(k?.chainId))&&!(k?.connectorType==="wallet_connect_v2"&&k?.walletClientType==="metamask")){A(H=>({...H,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await k?.switchChain(U.defaultChain.id),k&&(k.chainId=En(qo(U.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${U.defaultChain.id}`)}}return A(H=>({...H,status:"connected",connectedWallet:k,connectError:null,connectRetry:b})),k&&!B.current&&D(N,"connectWallet","onSuccess",k),v?.(k,f)}catch(k){return k instanceof Fe?(console.warn(k.cause?k.cause:k.message),B.current||D(N,"connectWallet","onError",k.privyErrorCode||"generic_connect_wallet_error")):(console.warn(k),B.current||D(N,"connectWallet","onError","unknown_connect_wallet_error")),A(H=>({...H,status:"disconnected",connectedWallet:null,connectError:k})),v?.(null,f)}}let Yr=async(d,p)=>{if(d===null)return;let f=new jo(d,p);t.startAuthFlow(f)},xa=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),f=d.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!yo()&&tr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new P("Connector not initialized");me("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),vt(p,f,void 0,Yr)};Rr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let qe=()=>{if(!a)throw D(N,"linkAccount","onError","must_be_authenticated"),new P("User must be authenticated before linking an account.")},_a=()=>{qe(),ne.current="siwe",B.current="link",me("LINK_WALLET_SCREEN")},bi=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},Fo=async d=>{if(!t.connectors)throw new P("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(A(f=>({...f,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:b})),U.captchaEnabled&&!a){let f={callback:v=>Yr(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Q({captchaModalData:f}),tr("CAPTCHA_SCREEN")}else await Yr(d),tr("AWAITING_CONNECTION")},$e=async(d,p)=>{if(!U.fiatOnRamp.enabled)throw new P("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:v}=await Ih(t,d,p?.config??{},U.appearance.palette,U.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:v}}else throw new P("Unsupported fund provider. Currently supported option is `moonpay`.")},ct=()=>{m(d=>{let p=t.connectors?.wallets.map(f=>({...f,linked:bi(f),loginOrLink:async()=>{if(!await f.isConnected())throw new P("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot link or login with embedded wallet");Fo(f)},fund:async v=>{let{signedUrl:k,externalTransactionId:H}=await $e(f.address,v);Q({fiatOnRampPrompt:{signedUrl:k},fiatOnRampStatus:{externalTransactionId:H}}),me("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new P("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(f.address);c(v)}}))||[];return ms(d,p)?d:p})};Rr(()=>{ct()},[s?.linkedAccounts,a,n]),Rr(()=>{if(n){if(!t.connectors)throw new P("Connector not initialized");ct(),t.connectors.on("walletsUpdated",ct)}},[n]);let Zr=()=>{me(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Rr(()=>{if(!u[0])return;let d=u[0],p=h.current.find(v=>v.address===d.address),f;if(d.walletClientType==="privy"?f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&f){let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(v)}h.current=u},[u]);let Ei=async(d,p)=>{if(Te(d))throw D(N,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,k]=await Promise.all([he.initializeWalletProxy(p),Se()]);if(!v&&U.customAuth?.enabled)throw D(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!k||U.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((H,J)=>{ce(!0),Q({createWallet:{onSuccess:rt=>{D(N,"createWallet","onSuccess",rt),H(rt)},onFailure:rt=>{D(N,"createWallet","onError","unknown_embedded_wallet_error"),J(rt)},callAuthOnSuccessOnClose:!1}}),me("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:k});let H=await he.refreshUser(),J=Te(H);if(!J)throw D(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(N,"createWallet","onSuccess",J),J}},Jr=d=>{if(!U.chains.map(p=>p.id).includes(d))throw new ee(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},ka=(d,p,f)=>new Promise(async(v,k)=>{if(!a||!s){D(N,"sendTransaction","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let H=Te(s);if(!H){D(N,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}ce(!0);let J=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ke=d.chainId?Number(d.chainId):J.chainId;Jr(Ke);let rt=Object.assign({},d,{chainId:Ke}),rr=async()=>{let ke=await Se();if(!ke||!I){D(N,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await he.recoverEmbeddedWallet()){D(N,"sendTransaction","onError","unknown_connect_wallet_error"),k(new Error("Unable to connect to wallet"));return}let Ct=Xr(rt.chainId,U.chains,U.rpcConfig,{appId:e.appId}),ic=await mi(H.address,rt,Ct);if(U.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Gg}=await ui(ic,Ct),{hasSufficientFunds:Vg}=await $l(H.address,ic,Gg,Ct);if(!Vg)throw new Oe(new Ft("Wallet has insufficient funds for this transaction.",ot.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let lp=await ql(ke,H.address,I,ic,Ct);D(N,"sendTransaction","onSuccess",lp),v(lp)}catch(Dt){D(N,"sendTransaction","onError","transaction_failure"),k(Dt)}};if(U.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),rr();else{let ke={transactionRequest:rt,onSuccess:Ct=>{D(N,"sendTransaction","onSuccess",Ct),v(Ct)},onFailure:Ct=>{D(N,"sendTransaction","onError","transaction_failure"),k(Ct)},uiOptions:p||{},fundWalletConfig:f},Dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Ct=>{D(N,"sendTransaction","onError","unknown_connect_wallet_error"),k(Ct)}};Q({connectWallet:Dt,sendTransaction:ke}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function sp(){return new Promise(async(d,p)=>{let f=await Se();if(!f||!I)throw new Error("Must have valid access token to enroll in MFA");try{await I.verifyMfa({accessToken:f}),d()}catch(v){p(v)}})}let Nt=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw D(N,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw D(N,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)},vn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Zr,linkWallet:_a,linkEmail:()=>{qe(),Nt("email"),ne.current="email",B.current="link",me("LINK_EMAIL_SCREEN")},linkPhone:()=>{qe(),Nt("phone"),ne.current="sms",B.current="link",me("LINK_PHONE_SCREEN")},linkGoogle:async()=>{qe(),Nt("google"),B.current="link",await he.initLoginWithOAuth("google")},linkTwitter:async()=>{qe(),Nt("twitter"),B.current="link",await he.initLoginWithOAuth("twitter")},linkDiscord:async()=>{qe(),Nt("discord"),B.current="link",await he.initLoginWithOAuth("discord")},linkGithub:async()=>{qe(),Nt("github"),B.current="link",await he.initLoginWithOAuth("github")},linkSpotify:async()=>{qe(),Nt("spotify"),B.current="link",await he.initLoginWithOAuth("spotify")},linkInstagram:async()=>{qe(),Nt("instagram"),B.current="link",await he.initLoginWithOAuth("instagram")},linkTiktok:async()=>{qe(),Nt("tiktok"),B.current="link",await he.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{qe(),Nt("linkedin"),B.current="link",await he.initLoginWithOAuth("linkedin")},linkApple:async()=>{qe(),Nt("apple"),B.current="link",await he.initLoginWithOAuth("apple")},linkPasskey:async()=>{qe(),Nt("passkey"),await he.initLinkWithPasskey(),me("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{qe(),Nt("farcaster"),await he.initLoginWithFarcaster(),B.current="link",ne.current="farcaster",me("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(qe(),!s?.email)throw new P("User does not have an email linked to their account.");B.current="link",ne.current="email",me("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(f=>{tt(v=>f.bind(v))});if(tt(null),p){console.warn(d);return}}if(a){console.warn(d);return}B.current="login",tr("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{tt(()=>d)}),tt(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}tr("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&I)try{await I.clearMfa({userId:s.id})}catch{}c(null),l(!1),x(null),D(N,"logout","onSuccess"),B.current=null,ne.current=null,o(!1),Y.del(Ti)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Me;let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new Me:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new ap(new Wr(new Me));let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new ap(new Wr(new Me)):new ap(new Wr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Co(new Me);let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new Co(new Me):new Co(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(v=>nc(v.address)===nc(d)),f=s?.linkedAccounts.find(v=>v.type==="wallet"&&nc(v.address)===nc(d));if(!p||!await p.isConnected())$(d),_a();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw D(N,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ei(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw D(N,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Te(s);if(!d||!I)throw D(N,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw D(N,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await sp()}catch(p){throw D(N,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,f)=>{ce(!0);let v={onSuccess:H=>{D(N,"setWalletPassword","onSuccess",H),p(H)},onFailure:H=>{D(N,"setWalletPassword","onError","user_exited_set_password_flow"),f(H)},callAuthOnSuccessOnClose:!1},k={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:H=>{D(N,"setWalletPassword","onError","unknown_connect_wallet_error"),f(H)}};Q({setWalletPassword:v,connectWallet:k}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(f,v)=>{if(!a||!s){D(N,"signMessage","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Te(s);if(!k){D(N,"signMessage","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){D(N,"signMessage","onError","invalid_message"),v(new Error("Message must be a non-empty string"));return}ce(!0);let H=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let J=await Se();if(!I||!J)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:k.address}});let{response:rt}=await I.rpc({accessToken:J,address:k.address,request:{method:"personal_sign",params:[d,k.address]}}),rr=rt.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:k.address}}),rr};if(U.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let J=await H();D(N,"signMessage","onSuccess",J),f(J)}catch(J){D(N,"signMessage","onError","unable_to_sign"),v(J??new Oe("Unable to sign message"))}}else{let rt={method:"personal_sign",data:d,confirmAndSign:H,onSuccess:ke=>{D(N,"signMessage","onSuccess",ke),f(ke)},onFailure:ke=>{D(N,"signMessage","onError","unable_to_sign"),v(ke)},uiOptions:p||{}},rr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:ke=>{D(N,"signMessage","onError","unknown_connect_wallet_error"),v(ke)}};Q({signMessage:rt,connectWallet:rr}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(f,v)=>{if(!a||!s){D(N,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Te(s);if(!k){D(N,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}ce(!0);let H=$a(d),J=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ke=await Se();if(!I||!Ke)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:k.address}});let{response:rr}=await I.rpc({accessToken:Ke,address:k.address,request:{method:"eth_signTypedData_v4",params:[k.address,H]}}),ke=rr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:k.address}}),ke};if(U.embeddedWallets.noPromptOnSignature||(U.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ke=await J();D(N,"signTypedData","onSuccess",Ke),f(Ke)}catch(Ke){D(N,"signTypedData","onError","unable_to_sign"),v(Ke??new Oe("Unable to sign message"))}}else{let rr={method:"eth_signTypedData_v4",data:H,confirmAndSign:J,onSuccess:Dt=>{D(N,"signTypedData","onSuccess",Dt),f(Dt)},onFailure:Dt=>{D(N,"signTypedData","onError","unable_to_sign"),v(Dt)},uiOptions:p||{}},ke={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Dt=>{D(N,"signMessage","onError","unknown_connect_wallet_error"),v(Dt)}};Q({signMessage:rr,connectWallet:ke}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,f)=>{let k=await(await ka(d,p,f)).wait();return Kl(k)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Te(s)){p(new Error("Must have a Privy wallet before exporting"));return}ce(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(Q(fe),!await Se()||!I){p(new Error("Must have valid access token to enroll in MFA"));return}if(!I){p(new Error("Must have a Privy wallet before exporting"));return}let H={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};Q({keyExport:H,connectWallet:v}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:sp,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");_t.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((H,J)=>{Ue.current={resolve:H,reject:J}});break;case"passkey":if(typeof p=="string")throw new P("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),k=Mg(v);_t.current?.resolve({mfaMethod:d,mfaCode:k,relyingParty:window.origin}),await new Promise((H,J)=>{Ue.current={resolve:H,reject:J}});break;default:throw _t.current?.reject(new P("Unsupported MFA method")),new P(`Unsupported MFA method: ${d}`)}},cancel(){_t.current?.reject(new P("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,f)=>{if(!d){he.closePrivyModal(),p();return}U.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."),Q({mfaEnrollmentFlow:{mfaMethods:U.mfa.methods,onSuccess:p,onFailure:f}}),me("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Se();if(!d||!I)throw new Error("Must have valid access token to enroll in MFA");let p=await I.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to enroll in MFA");await I.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let f=await t.getAuthenticatedUser();c(f)},async unenroll(d){let p=await Se();if(!p||!I)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await I.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await I.unenrollMfa({method:d,accessToken:p});let f=await t.getAuthenticatedUser();c(f)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Se(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!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 he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let v=await I.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}Q({farcasterSigner:v}),me("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Se(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!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 he.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(k=>Uint8Array.from(k.match(/.{1,2}/g).map(H=>parseInt(H,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Se(),f=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(!I||!f)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 he.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 k=await import("@simplewebauthn/browser"),H=await I.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:k.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(k.base64URLStringToBuffer(H.signature))},isHeadlessOAuthLoading:E,loginWithCode(d){return he.loginWithCode(d)},initLoginWithEmail(d){return he.initLoginWithEmail(d)},initLoginWithSms(d){return he.initLoginWithSms(d)},otpState:O,fundWallet(d,p){return he.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return he.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return he.loginWithHeadlessOAuth(d)},isModalOpen:r};Lg=vn.signMessage,Og=vn.signTypedData,Ng=async(...d)=>{let p=await ka(...d);return U.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let he=(()=>({isNewUserThisSession:y,linkingHint:K,pendingTransaction:null,walletConnectionStatus:_,mipdStore:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:U.rpcConfig,chains:U.chains,appId:e.appId,showFiatPrices:U.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>U.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(I)return I;let p=new Promise(k=>{ze(()=>H=>k(H))}),f=new Promise(k=>setTimeout(()=>k(null),d)),v=await Promise.race([p,f]);return ze(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,f;p&&ne.current&&(f=s?.linkedAccounts.filter(v=>v.latestVerifiedAt!==null&&!(v.type==="wallet"&&v.walletClientType==="privy")).sort((v,k)=>k.latestVerifiedAt.getTime()-v.latestVerifiedAt.getTime())[0]),B.current==="login"&&ne.current?d.shouldCallAuthOnSuccess&&p?(D(N,"login","onComplete",s,y,!1,ne.current,f??null),e.onSuccess?.(s,y)):D(N,"login","onError","exited_auth_flow"):B.current==="link"&&ne.current&&f&&(d.isSuccess&&p?D(N,"linkAccount","onSuccess",s,ne.current,f):D(N,"linkAccount","onError","exited_link_flow")),$(null),B.current=null,ne.current=null,C(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:me,connectWallet:wi,initLoginWithWallet:async(d,p)=>{ne.current="siwe",Yr(d,p)},loginWithWallet:async()=>{if(!n)throw new fo;if(!(t.authFlow instanceof jo))throw new P("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),ne.current="siwe"}catch(f){throw D(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),ne.current="siwe"}catch(f){throw D(N,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(d||s||null),C(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Si(d);t.startAuthFlow(p);try{ne.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw B.current==="login"?D(N,"login","onError",f.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(N,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new fo;if(!(t.authFlow instanceof Si))throw new P("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),ne.current="farcaster"}catch(f){throw D(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),ne.current="farcaster"}catch(f){throw D(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d||null),C(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ne.current=d,cc()){if(d==="google"&&oc(window.navigator.userAgent)){tr("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{tr("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Y.del(Vo);let f=new Mr({provider:d});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},async recoveryOAuthFlow(d,p,f){let{url:v,codeVerifier:k,stateCode:H}=await wf({api:Do.api,provider:d});if(!v)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new P("Recovery OAuth failed");let J,Ke;try{let ke=await Ig({url:v,popup:f});if(J=ke.stateCode,Ke=ke.authorizationCode,J!==H)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:H??"",returnedStateCode:J??""}}),new P("Unexpected auth flow. This may be a phishing attempt.")}catch(ke){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:ke.toString(),provider:d}}),new P("Recovery OAuth failed")}let[rt,rr]=await Promise.all([Se(),bf({api:Do.api,provider:d,codeVerifier:k,stateCode:J,authorizationCode:Ke})]);if(!I)throw new P("Cannot connect to wallet proxy");switch(p){case"recover":let ke=fe.recoverWallet?.privyWallet?.address;if(!ke)throw new P("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:ke,recoveryMethod:d}}),await I.recover({address:ke,accessToken:rt,recoveryAccessToken:rr,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:ke,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await I.create({accessToken:rt,recoveryAccessToken:rr,recoveryMethod:d});let Dt=await he.refreshUser(),Ct=Te(Dt);if(!Ct)throw D(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Ct.address}}),D(N,"createWallet","onSuccess",Ct);break;default:throw new P("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Mr))throw new P("Must initialize OAuth flow before calling loginWithOAuth");let p=Y.get(Ho),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:f??""}}),new P("Unexpected auth flow. This may be a phishing attempt.");let v,k,H;if(a)try{v=await t.link(),ne.current=d}catch(J){throw D(N,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}else try{let J=await t.authenticate();v=J.user,k=J.isNewUser,H=J.oAuthProviderTokens,ne.current=d}catch(J){throw B.current==="login"?D(N,"login","onError",J.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(N,"linkAccount","onError",J.privyErrorCode||"failed_to_link_account"),J}return c(v),C(k||!1),l(!0),H},async initLoginWithPasskey(d){let p=new Ko(d);t.startAuthFlow(p),B.current="login";try{ne.current="passkey",await p.initAuthenticationFlow()}catch(f){throw D(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new fo;if(!(t.authFlow instanceof Ko))throw new P("Must initialize Passkey flow first.");if(ne.current!=="passkey")throw new P("Must init login with Passkey flow first.");let d,p;try{ne.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(f){throw D(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d),C(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Ko(d);t.startAuthFlow(p),B.current="link",ne.current="passkey";try{await p.initLinkFlow()}catch(f){throw D(N,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},async linkWithPasskey(){if(!n)throw new fo;if(!(t.authFlow instanceof Ko))throw new P("Must initialize Passkey flow first.");if(ne.current!=="passkey")throw new P("Must init login with Passkey flow first.");let d;try{ne.current="passkey",d=await t.link()}catch(p){throw D(N,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(cc()){if(d==="google"&&oc(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Mr({provider:d,headless:!0});p&&f.addCaptchaToken(p);let v=await t.startAuthFlow(f).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){w(!0),t.startAuthFlow(new Mr(d));let p=Y.get(Ho),f=d.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:f??""}}),w(!1),new P("Unexpected auth flow. This may be a phishing attempt.");let v,k;if(a)try{v=await t.link(),ne.current=d.provider}catch(H){throw D(N,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account"),H}else try{({user:v,isNewUser:k}=await t.authenticate()),ne.current=d.provider}catch(H){throw B.current==="login"?D(N,"login","onError",H.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(N,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account"),H}return c(v),C(k||!1),l(!0),w(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let f=new ho(d,p);t.startAuthFlow(f);try{ne.current="email",await f.sendCodeEmail()}catch(v){throw B.current==="login"?D(N,"login","onError",v.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(N,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},initUpdateEmail:async(d,p,f)=>{let v=new Na(d,p,f);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{W({status:"sending-code"});let f=new Yo(d,p);t.startAuthFlow(f);try{ne.current="sms",await f.sendSmsCode(),W({status:"awaiting-code-input"})}catch(v){throw W({status:"error",error:v}),B.current==="login"?D(N,"login","onError",v.privyErrorCode||"unknown_auth_error"):B.current==="link"&&D(N,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(W({status:"submitting-code"}),!n){let k=new fo;throw W({status:"error",error:k}),k}if(t.authFlow instanceof ho)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Yo)t.authFlow.meta.smsCode=d.trim();else{let k=new P("Must initialize a passwordless code flow first");throw W({status:"error",error:k}),k}let p=await Se(),f,v;if(p&&t.sessionHasActiveToken())try{f=await t.link()}catch(k){throw W({status:"error",error:k}),D(N,"linkAccount","onError",k.privyErrorCode||"failed_to_link_account"),k}else try{({user:f,isNewUser:v}=await t.authenticate())}catch(k){throw W({status:"error",error:k}),D(N,"login","onError",k.privyErrorCode||"unknown_auth_error"),k}c(f||s||null),C(v||!1),l(!0),W({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:I,createAnalyticsEvent:({eventName:d,payload:p,timestamp:f})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:f}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let f=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy"),v=await Se();if(!v||!I||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ce(!0);try{await I.connect({accessToken:v,address:f.address}),d(!0)}catch(k){if($n(k)&&f.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await I.recover({address:f.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:f.address}}),d(!0);else if($n(k)){Q({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let H=al(f.recoveryMethod);me(H)}else p(k)}}),getFiatOnRampConfig:$e,setReadyToTrue:d=>{i(!0),et?.(d)},updateWallets:()=>ct(),fundWallet:async(d,p)=>{let{signedUrl:f,externalTransactionId:v}=await $e(d,p);Q({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:v}}),me("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Se(),f=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!I||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}return v}}))();Dg=he.recoverEmbeddedWallet;let Hg=a8(()=>({wallets:u,ready:Xt}),[u,Xt]);return jr(ge.Provider,{value:vn,children:jr(Ic.Provider,{value:N,children:jr(jd.Provider,{value:Hg,children:Wg(vm,{...U,children:[e.children,Wg(Rc.Provider,{value:he,children:[!U.headless&&U.captchaEnabled&&n&&!a&&jr(Ac,{delayedExecution:!1}),jr(Pg,{theme:{...U.appearance.palette||{}}}),jr(pm,{data:fe,setModalData:Q,setInitialScreen:x,initialScreen:g,authenticated:a,open:r,children:jr(_g,{open:r})}),re&&ue?jr(Rg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:_t,mfaSubmitPromise:Ue,onLoad:Z,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as p8}from"react";function u8(e){let{login:t}=p8(ge);return Ne("login",e),{login:t}}import{useContext as m8}from"react";function f8(e){let{logout:t}=m8(ge);return Ne("logout",e),{logout:t}}import{useCallback as Ug,useEffect as h8}from"react";function y8(){let e=Ce(),t=Ls(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=F(),l=Ug(async c=>{if(e.enabled&&e.status!=="success")throw new gr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=Ug(async()=>{let c=Ai();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{$o()}},[o]);return h8(()=>{let c=Ai();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Fg}from"react";var g8=()=>{let e=Ce(),{initLoginWithEmail:t,loginWithCode:r}=F(),o=Fg(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=Fg(async({code:i})=>{if(e.enabled&&e.status==="error")throw new gr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Bg}from"react";var v8=()=>{let e=Ce(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=F(),n=Bg(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=Bg(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new gr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useContext as C8}from"react";function w8(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkFarcaster:y}=C8(ge);return Ne("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkFarcaster:y}}import{useContext as b8}from"react";function E8(e){let{connectWallet:t}=b8(ge);return Ne("connectWallet",e),{connectWallet:t}}import{useContext as P8}from"react";function T8(e){let{createWallet:t}=P8(ge);return Ne("createWallet",e),{createWallet:t}}var S8=()=>{let{fundWallet:e}=F();return{fundWallet:e}};import{useContext as x8}from"react";function _8(e){let{sendTransaction:t}=x8(ge);return Ne("sendTransaction",e),{sendTransaction:t}}import{useContext as k8}from"react";function A8(e){let{setWalletPassword:t}=k8(ge);return Ne("setWalletPassword",e),{setWalletPassword:t}}import{useContext as R8}from"react";function I8(e){let{signMessage:t}=R8(ge);return Ne("signMessage",e),{signMessage:t}}import{useContext as M8}from"react";function W8(e){let{signTypedData:t}=M8(ge);return Ne("signTypedData",e),{signTypedData:t}}import{useContext as L8}from"react";var O8=()=>{let{isModalOpen:e}=L8(ge);return{isOpen:e}};import{useContext as N8}from"react";function D8(e){let{getAccessToken:t}=N8(ge);return Ne("accessToken",e),{getAccessToken:t}}function U8(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function F8(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Wr as AsExternalProvider,Ac as Captcha,Li as ConnectorManager,Oi as PrivyClient,c8 as PrivyProvider,Me as PrivyProxyProvider,Mi as SUPPORTED_CHAINS,mc as VERSION,kt as WalletConnector,F8 as addRpcUrlOverrideToChain,Xc as errorIndicatesMaxMfaRetries,nn as errorIndicatesMfaTimeout,an as errorIndicatesMfaVerificationFailed,Se as getAccessToken,E8 as useConnectWallet,T8 as useCreateWallet,U8 as useExperimentalFarcasterSigner,S8 as useFundWallet,w8 as useLinkAccount,u8 as useLogin,g8 as useLoginWithEmail,y8 as useLoginWithOAuth,v8 as useLoginWithSms,f8 as useLogout,la as useMfa,xr as useMfaEnrollment,O8 as useModalStatus,F as usePrivy,Mc as useRegisterMfaListener,_8 as useSendTransaction,A8 as useSetWalletPassword,I8 as useSignMessage,W8 as useSignTypedData,D8 as useToken,Ca as useWallets};