@privy-io/react-auth 1.59.6-beta-20240325144824 → 1.59.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Xs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ad=(e,t,r)=>(Xs(e,t,"read from private field"),r?r.call(e):t.get(e)),Fi=(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)},el=(e,t,r,o)=>(Xs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var sd=(e,t,r)=>(Xs(e,t,"access private method"),r);import{getAddress as Ys}from"@ethersproject/address";import{Web3Provider as td}from"@ethersproject/providers";import{createStore as LE}from"mipd";import{useCallback as OE,useEffect as Nr,useMemo as NE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=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}]`:""}`}},ir=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},x=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ui=class extends x{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ce=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return ot(e);if(!e.response)return new ir("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new ir(t||"ApiError",e.response.status,r||o,e,n)},ot=e=>e instanceof $e?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Oo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ct=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Bi=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hi="/api/v1/sessions",Gi="/api/v1/sessions/logout",ld="/api/v1/sessions/fork",Vi="/api/v1/sessions/fork/recover",cd="/api/v1/siwe/init",dd="/api/v1/siwe/authenticate",pd="/api/v1/siwe/link",ud="/api/v1/siwe/unlink",md="/api/v1/farcaster/init",fd="/api/v1/farcaster/authenticate",hd="/api/v1/farcaster/link",yd="/api/v1/farcaster/status",gd="/api/v1/farcaster/unlink",vd="/api/v1/passwordless/init",wd="/api/v1/passwordless/authenticate",Cd="/api/v1/passwordless/link",bd="/api/v1/passwordless/unlink",Ed="/api/v1/passwordless/update",Td="/api/v1/passwordless_sms/init",Pd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",xd="/api/v1/passwordless_sms/authenticate",_d="/api/v1/oauth/init",Ad="/api/v1/oauth/authenticate",kd="/api/v1/oauth/link",Rd="/api/v1/oauth/unlink";var Id="/api/v1/mfa/passwordless_sms/init",Md="/api/v1/mfa/passwordless_sms/enroll";var Wd="/api/v1/users/me/accept_terms",Ld="/api/v1/analytics_events",Od="/api/v1/plugins/moonpay_on_ramp/sign",Nd="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(Nd,{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 ce(t)}}async link(){throw new Error("Unimplemented")}};var Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{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 ce(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ce(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(vd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ce(o)}}},zi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ed,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ce(r)}}};import{isMobile as Qy,isIOS as Xy}from"react-device-detect";var qi=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)}},tl=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)}},rl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ol(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new tl:new qi}function Ky(){return typeof window<"u"&&window.sessionStorage?new rl:new qi}var je=Ky(),de=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Dd(){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 $i=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 nl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||$i(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!nl(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fd=()=>{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 Ud="1.59.6-beta-20240325144824";var il="4df5e2316331463a9130964bd6078dfa",al="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Bd="34357d3c125c2bcf2ce2bc3309d98715",ji="https://auth.privy.io",Hd=2e4,Oe=1400,Gd=2500,sl=Ud;var fo="privy:token",ll="privy-token",Ki="privy:refresh_token",cl="privy-refresh-token",Yi="privy-session",Hn="privy:session_transfer_token",Jy="privy:wallet",Gn="privy:caid",ho="privy:state_code",Do="privy:code_verifier",Vn="privy:headless_oauth",Ji=e=>`${Jy}:${e}`,dl="privy:connectors",pl="privy:connections";var yo=12e4,xr=1,ul="0x1",Fo=3e4,Vd="https://api.moonpay.com/v1",zd="https://api.moonpay.com/v1",qd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",$d="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",jd="0x420000000000000000000000000000000000000F",Kd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Yd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Zi=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,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},ml=e=>new Promise(t=>setTimeout(t,e));function Zd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Qd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await ml(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Qi=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Xd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ep(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Dd()){let u=$i(d);if(!l.some(y=>y.info.name===u)){if(nl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Xi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+il:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+al:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},_r=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+il):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+al):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ea=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 ta=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={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 Zy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var rp=e=>e in Ho,op=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function np(e,t){let r=Zy(t);if(r.deepLink)return cp(r.deepLink,e);if(r.universalLink)return dp(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var ip="WALLETCONNECT_DEEPLINK_CHOICE";function ap(){try{localStorage.removeItem(ip)}catch{}}function sp({href:e,name:t}){try{localStorage.setItem(ip,JSON.stringify({href:e,name:t}))}catch{}}function lp(e){return e.startsWith("http://")||e.startsWith("https://")}function cp(e,t){if(lp(e))return dp(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 dp(e,t){if(!lp(e))return cp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ra(e,t){window.open(e,t,"noreferrer noopener")}var nt=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 zn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(fd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 ce(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{return await this.api.post(hd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ce(t)}}async _startChannelOnce(){if(!this.api)throw new x("Auth flow has no API instance");let t=await this.api.post(md,{token:this.captchaToken});Qy&&!Xy&&t.connect_uri&&ra(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(yd,{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 mp}from"jose";async function pp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function up(e){return crypto.getRandomValues(new Uint8Array(e))}function oa(){return!!je.get(Vn)}var eg="S256",tg="S256",ar=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:oa();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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(Ad,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),this.meta.headless&&je.del(Vn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ce(r);throw o.privyErrorCode?new x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),r}catch(r){throw ce(r)}}createCodeVerifier(){return mp.encode(up(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=eg){if(r==tg){let o=await pp(t);return mp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();je.put(Do,t);let r=this.createStateCode();je.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&je.put(Vn,!0);try{return await this.api.post(_d,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ce(n)}}};function fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fp(e,t){let r={detail:"",retryable:!1},o=fl(t);return 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==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function $n(){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:oa()}}function jn(){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"),je.del(ho),window.history.replaceState({},"",e)}var vo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ var Xs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ad=(e,t,r)=>(Xs(e,t,"read from private field"),r?r.call(e):t.get(e)),Fi=(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)},el=(e,t,r,o)=>(Xs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var sd=(e,t,r)=>(Xs(e,t,"access private method"),r);import{getAddress as Ys}from"@ethersproject/address";import{Web3Provider as td}from"@ethersproject/providers";import{createStore as LE}from"mipd";import{useCallback as OE,useEffect as Nr,useMemo as NE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=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}]`:""}`}},ir=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},x=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ui=class extends x{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return ot(e);if(!e.response)return new ir("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new ir(t||"ApiError",e.response.status,r||o,e,n)},ot=e=>e instanceof $e?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Oo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ct=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Bi=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hi="/api/v1/sessions",Gi="/api/v1/sessions/logout",ld="/api/v1/sessions/fork",Vi="/api/v1/sessions/fork/recover",cd="/api/v1/siwe/init",dd="/api/v1/siwe/authenticate",pd="/api/v1/siwe/link",ud="/api/v1/siwe/unlink",md="/api/v1/farcaster/init",fd="/api/v1/farcaster/authenticate",hd="/api/v1/farcaster/link",yd="/api/v1/farcaster/status",gd="/api/v1/farcaster/unlink",vd="/api/v1/passwordless/init",wd="/api/v1/passwordless/authenticate",Cd="/api/v1/passwordless/link",bd="/api/v1/passwordless/unlink",Ed="/api/v1/passwordless/update",Td="/api/v1/passwordless_sms/init",Pd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",xd="/api/v1/passwordless_sms/authenticate",_d="/api/v1/oauth/init",Ad="/api/v1/oauth/authenticate",kd="/api/v1/oauth/link",Rd="/api/v1/oauth/unlink";var Id="/api/v1/mfa/passwordless_sms/init",Md="/api/v1/mfa/passwordless_sms/enroll";var Wd="/api/v1/users/me/accept_terms",Ld="/api/v1/analytics_events",Od="/api/v1/plugins/moonpay_on_ramp/sign",Nd="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(Nd,{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 pe(t)}}async link(){throw new Error("Unimplemented")}};var Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{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 pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(vd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},zi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ed,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as Qy,isIOS as Xy}from"react-device-detect";var qi=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)}},tl=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)}},rl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ol(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new tl:new qi}function Ky(){return typeof window<"u"&&window.sessionStorage?new rl:new qi}var je=Ky(),ue=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Dd(){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 $i=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 nl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||$i(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!nl(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fd=()=>{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 Ud="1.59.6";var il="4df5e2316331463a9130964bd6078dfa",al="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Bd="34357d3c125c2bcf2ce2bc3309d98715",ji="https://auth.privy.io",Hd=2e4,Oe=1400,Gd=2500,sl=Ud;var fo="privy:token",ll="privy-token",Ki="privy:refresh_token",cl="privy-refresh-token",Yi="privy-session",Hn="privy:session_transfer_token",Jy="privy:wallet",Gn="privy:caid",ho="privy:state_code",Do="privy:code_verifier",Vn="privy:headless_oauth",Ji=e=>`${Jy}:${e}`,dl="privy:connectors",pl="privy:connections";var yo=12e4,xr=1,ul="0x1",Fo=3e4,Vd="https://api.moonpay.com/v1",zd="https://api.moonpay.com/v1",qd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",$d="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",jd="0x420000000000000000000000000000000000000F",Kd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Yd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Zi=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,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},ml=e=>new Promise(t=>setTimeout(t,e));function Zd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Qd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await ml(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Qi=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Xd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function ep(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Dd()){let u=$i(d);if(!l.some(y=>y.info.name===u)){if(nl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Xi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+il:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+al:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},_r=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+il):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+al):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ea=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 ta=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={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 Zy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var rp=e=>e in Ho,op=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function np(e,t){let r=Zy(t);if(r.deepLink)return cp(r.deepLink,e);if(r.universalLink)return dp(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var ip="WALLETCONNECT_DEEPLINK_CHOICE";function ap(){try{localStorage.removeItem(ip)}catch{}}function sp({href:e,name:t}){try{localStorage.setItem(ip,JSON.stringify({href:e,name:t}))}catch{}}function lp(e){return e.startsWith("http://")||e.startsWith("https://")}function cp(e,t){if(lp(e))return dp(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 dp(e,t){if(!lp(e))return cp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ra(e,t){window.open(e,t,"noreferrer noopener")}var nt=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 zn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(fd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{return await this.api.post(hd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new x("Auth flow has no API instance");let t=await this.api.post(md,{token:this.captchaToken});Qy&&!Xy&&t.connect_uri&&ra(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(yd,{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 mp}from"jose";async function pp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function up(e){return crypto.getRandomValues(new Uint8Array(e))}function oa(){return!!je.get(Vn)}var eg="S256",tg="S256",ar=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:oa();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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(Ad,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),this.meta.headless&&je.del(Vn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),r}catch(r){throw pe(r)}}createCodeVerifier(){return mp.encode(up(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=eg){if(r==tg){let o=await pp(t);return mp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();je.put(Do,t);let r=this.createStateCode();je.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&je.put(Vn,!0);try{return await this.api.post(_d,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fp(e,t){let r={detail:"",retryable:!1},o=fl(t);return 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==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function $n(){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:oa()}}function jn(){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"),je.del(ho),window.history.replaceState({},"",e)}var vo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,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: ${i}
10
10
  Issued At: ${a}
11
11
  Resources:
12
- - https://privy.io`;this.getNonceOnce=new nt(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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(dd,{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 ce(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(pd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ce(t)}}async sign(){if(!this.api)throw new x("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new x("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 x("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(cd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new x("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,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(xd,{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 ce(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ce(t)}}async sendSmsCode(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Td,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ce(o)}}};import{v4 as qg}from"uuid";function it(e){return new Date(e*1e3)}function rg(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:it(r.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 a={address:r.address,type:r.type,verifiedAt:it(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:it(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:it(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:it(r.verified_at)});break;case"farcaster":let v={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:it(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function At(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,og=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),kt=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!og(e)?.length;function bt(e){if(!e)return null;let t=rg(e.linked_accounts),r=At(t,"wallet"),o=At(t,"email"),n=At(t,"phone"),a=At(t,"google_oauth"),i=At(t,"twitter_oauth"),l=At(t,"discord_oauth"),s=At(t,"github_oauth"),d=At(t,"spotify_oauth"),u=At(t,"tiktok_oauth"),y=At(t,"linkedin_oauth"),f=At(t,"apple_oauth"),g=At(t,"farcaster"),E=e.mfa_methods.map(({type:S,verified_at:C})=>({type:S,verifiedAt:it(C)}));return{id:e.id,createdAt:it(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:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord: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:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:E.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Jp}from"@ethersproject/address";import Hg from"eventemitter3";import mg from"@coinbase/wallet-sdk";import{jsx as hp,jsxs as ng}from"react/jsx-runtime";var na=({style:e,...t})=>ng("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:[hp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),hp("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 bp}from"@ethersproject/providers";import{default as pg}from"eventemitter3";import dg from"eventemitter3";var ig=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],yp=e=>ig.includes(e);import{ErrorCode as ag}from"@ethersproject/logger";var Go=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},qt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new Se(e);return e.code===ag.ACTION_REJECTED&&(t.details=Ke.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Se(e):new J("Unknown connector error",e)},Rt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Se=class extends Rt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Ke).find(a=>a.eipCode===o.code);this.details=n||Ke.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Ke.E32002_CONNECTION_ALREADY_PENDING:this.details=Ke.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Ke.E32002_WALLET_LOCKED))}},sg={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}},lg={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}},cg={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}},Ke={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...cg,...lg},Ar={...sg,...Ke};var be=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 Go,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new J(`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 qt(r)})}},Gr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ia=class extends dg{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=_r(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Gr("Disconnected",4900);return(await wp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`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 Gr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=_r(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 gp(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 vp(ea(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:go(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 go(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(yp(r.method)){let o=await ve();if(await Cp(),!o||!this.address)throw new Gr("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 Gr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();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}}},sr=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Vr=class extends be{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 ug=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ft=class extends pg{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Bo(r),this.walletClientType==="privy"&&de.put(Ji(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>lr(i.address)===lr(r));return{address:lr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>lr(f.address)===lr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new J(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(ug(f,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??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new bp(new sr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Vr(this.proxyProvider)},sign:async i=>{if(!await a())throw new J("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}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],a=lr(n),i=[],l;if(this.walletClientType==="privy"){let d=de.get(Ji(a));this.chains.find(u=>u.id===Number(d))||(de.del(Ji(a)),d=null),l=d||`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 d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${ul}`,d),l=ul}let s=Bo(l);if(!i.find(d=>lr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(lr(n),s,d))}aa(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>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 bp(new sr(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 qo={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 fg=(e,t)=>{let o=Xi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},sa,la=class extends ft{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),sa||(sa=new mg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(fg(sa,a))}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(){sa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:na,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 J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};import{jsx as Ep}from"react/jsx-runtime";var ca=({...e})=>Ep("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ep("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 da=class extends ft{constructor(r,o,n,a){super("privy",o,n,a);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:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ca,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Tp}from"react/jsx-runtime";var $o=({style:e,...t})=>Tp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Tp("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 Et,jsxs as hg}from"react/jsx-runtime";var jo=({style:e,...t})=>hg("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:[Et("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Et("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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 Pp,jsxs as yg}from"react/jsx-runtime";var cr=({style:e,...t})=>yg("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:[Pp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Pp("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 Yo=class extends ft{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}},Ko,Jo=class extends ft{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Fi(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?el(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&el(this,Ko,{name:"Phantom",icon:cr,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 ad(this,Ko)??{name:"Browser Extension",icon:$o,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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};Ko=new WeakMap;import{getAddress as _T}from"@ethersproject/address";import{Web3Provider as kT}from"@ethersproject/providers";import{isMobile as gg}from"react-device-detect";var pa=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{gg||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 J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw qt(t)}}};var ua=class extends ft{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);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 ma=class extends ua{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:cr,id:"phantom"}}};import{EthereumProvider as Dg,OPTIONAL_EVENTS as Fg,OPTIONAL_METHODS as Ug}from"@walletconnect/ethereum-provider";import{isMobile as Bg}from"react-device-detect";import{createContext as kg,useContext as Rg,useEffect as vl,useRef as Ig,useState as Mg}from"react";import{jsx as vg}from"react/jsx-runtime";function fa({src:e,...t}){return vg("img",{src:e,...t,style:{display:"none"}})}import{useContext as qp,useEffect as zp,useMemo as Sg,useState as xg}from"react";import{createContext as _g}from"react";var It={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Bd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Sp=({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 wg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),xp=e=>wg.has(e),_p=(e,t,r)=>r.indexOf(e)===t,Ap=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(xp).filter(_p):e?e.filter(xp).filter(_p):It.appearance.walletList;var ha={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 ya={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 ga={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 kp={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 Rp={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 va={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 wa={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 Ca={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 Ip={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Dp={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 Fp={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 ba={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 Ea={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 Ta={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 Kn={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 Yn={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 Up={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 Bp={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 Pa={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 Sa={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 xa={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 Jn=[ha,ya,ga,Op,Bp,qo,ba,Ea,Ta,Kn,Yn,Ip,Mp,Wp,Lp,va,wa,Ca,Dp,Fp,kp,Rp,Pa,xa,Sa,Np,Up],K6=new Set(Jn.map(e=>e.id));import Co from"tinycolor2";var Hp="#FFFFFF",Cg="#000000",bg=Hp,Eg="#1E1E1D";function Tg(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 zr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Gp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Hp,blackHex:i=Cg}){let l;switch(e){case"light":l=bg;break;case"dark":l=Eg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Tg(s.getLuminance()),E=zr(s,g==="light"?-.04:.11),v=zr(s,g==="light"?-.88:.87),S=zr(s,g==="light"?-.77:.75),C=zr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=zr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),I=zr(d,.15),M=zr(d,-.06),k=Co(d.getLuminance()>.5?i:a),U=zr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:S.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:I.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:U.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function hl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,S,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),S=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,S=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),I=[d,u,y,v,g,f,E,S,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+I.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&I.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let U=Ap({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),F=Sp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Pg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,K=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ie,te=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?K?ie=t?.embeddedWallets?.noPromptOnSignature??!0:ie=t?.embeddedWallets?.noPromptOnSignature??te:ie=te,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ie!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Gp({backgroundTheme:t?.appearance?.theme??It.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??It.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:U},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:S,farcaster:C},loginMethodsAndOrder:F,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??It.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??It.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??It.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??It.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...K?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:K?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??It.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??It._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??It._render.inParentNodeId}}}function Vp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Pg({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:Jn.find(u=>u.id===s.id)??s)}else n=Jn.concat(e??[]);let a=t?n[0]:qo,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}import{jsx as Ag}from"react/jsx-runtime";var $p={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",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},yl=hl($p,void 0,!1),gl=_g({appConfig:yl,isServerConfigLoaded:!1}),jp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=xg(null),i=Sg(()=>hl(n??$p,o,!!n),[n,o]);return zp(()=>{let l=Vp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),zp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Ag(gl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},_a=()=>{let{appConfig:e}=qp(gl);return e},Aa=()=>{let{isServerConfigLoaded:e}=qp(gl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Lg,jsxs as Og}from"react/jsx-runtime";var Kp=kg({ready:!1,app:yl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Wg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Yp=e=>{let t=_a(),r=e.authenticated,[o,n]=Mg(e.initialScreen);vl(()=>{!r&&!Wg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Ig(null);vl(()=>{e.open||(a.current=null)},[e.open]),vl(()=>{a.current=null},[e.initialScreen]);let i={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:a};return Og(Kp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Lg(fa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Rg(Kp);import{jsx as Zo,jsxs as Ng}from"react/jsx-runtime";var Zn=({style:e,...t})=>{let{app:r}=_();return Ng("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:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("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"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var dr=class extends ft{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[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=ta(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:jo,id:"io.metamask"}:{name:Xd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Zn,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=Ho[r],this.walletClientType=r,this.redirectUri=void 0,ap(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ta(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(qt(i));return}o(new J("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Xi(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Dg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fg,optionalMethods:Ug,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Bg&&this.walletEntry){let{redirect:l,href:s}=np(i,this.walletEntry);sp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ra(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ta(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var wl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Jp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Qn=class extends Hg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;de.get(dl)&&(de.getKeys().forEach(o=>{o.startsWith("walletconnect")&&de.del(o)}),de.del(dl));let r=ep(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Br()&&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(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new ia(r,o,this.rpcConfig,this.chains,a,n.id),s=new da(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 a=this.findWalletConnector(r,o);if(a)return a instanceof dr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new pa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new la(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ma(this.defaultChain):new dr(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=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=de.get(pl);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));de.put(pl,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=Jp(r),this.emit("walletsUpdated")}};function aa(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 Gg}from"ofetch";var Vg=[Hi,Vi,Gi],ka=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=sl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Gg.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:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Vg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Ui}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ce(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ce(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ce(o)}}};import bo from"js-cookie";function Zp(e){return e instanceof Ur?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ar?e.meta.provider:null}import*as Qp from"jose";var pr=class{static parse(t){try{return new pr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Qp.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 zg=30,Ra=class{constructor(){this.authenticateOnce=new nt(async t=>this._authenticate(t)),this.linkOnce=new nt(async t=>this._link(t)),this.refreshOnce=new nt(this._refresh.bind(this)),this.destroyOnce=new nt(this._destroy.bind(this)),this.forkSessionOnce=new nt(this._forkSession.bind(this))}get token(){try{let t=de.get(fo);return typeof t=="string"?new pr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=de.get(Ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=de.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Yi);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=pr.parse(this.token);return t!==null&&!t.isExpired(zg)}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{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Zp(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:bt(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),ot(r)}}async _link(t){try{let r=await t.link();return bt(r)}catch(r){throw console.warn("Error linking account"),ot(r)}}async _refresh(){if(!this.api)throw new x("Session has no API instance");if(!this.client)throw new x("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 a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Hi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Vi,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),bt(n.user)}catch(n){if(n instanceof ir&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ot(n)}}async _destroy(){try{await this.api?.post(Gi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new x("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ld,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw ot(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=de.get(fo);if(de.put(fo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=pr.parse(t)?.expiration;bo.set(ll,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else de.del(fo),bo.remove(ll)}storeRefreshToken(t){typeof t=="string"?(de.put(Ki,t),this.client?.useServerCookies||(bo.set(Yi,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(cl,t,{sameSite:"Strict",secure:!0,expires:30}))):(de.del(Ki),bo.remove(cl),bo.remove(Yi))}clearForkedToken(){de.del(Hn)}};var Cl,Ia,Xp,Xn=class{constructor(t){Fi(this,Ia);this.apiUrl=t.apiUrl||ji,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Hd,this.appId=t.appId,this.clientAnalyticsId=sd(this,Ia,Xp).call(this),Cl||(Cl=new Ra),this.session=Cl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Qn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new ka(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 x("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new x("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}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(bd,{address:t});return bt(r)}catch(r){throw ot(r)}}async acceptTerms(){try{let t=await this.api.post(Wd,{});return bt(t)}catch(t){throw ot(t)}}async unlinkPhone(t){try{let r=await this.api.post(Sd,{phoneNumber:t});return bt(r)}catch(r){throw ot(r)}}async unlinkWallet(t){try{let r=await this.api.post(ud,{address:t});return bt(r)}catch(r){throw ot(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Rd,{provider:t,subject:r});return bt(o)}catch(o){throw ot(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(gd,{fid:t});return bt(r)}catch(r){throw ot(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ld,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Od,t)}catch(r){throw ot(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?pr.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=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw ot(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()}};Ia=new WeakSet,Xp=function(){if(typeof window>"u")return null;try{let r=de.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=qg();try{return de.put(Gn,t),t}catch{return t}};import{Turnstile as Zg}from"@marsidev/react-turnstile";import{useEffect as Qg,useMemo as Xg}from"react";import{useMemo as $g,useRef as jg,useContext as Kg,useState as bl,createContext as Yg}from"react";import{jsx as Jg}from"react/jsx-runtime";var eu=Yg({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}),$t=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},tu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=jg(null),[a,i]=bl(),[l,s]=bl(),[d,u]=bl(!1),y=$g(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Jg(eu.Provider,{value:{...y,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Zd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new $t("Captcha failed",null,"captcha_timeout")}}},children:e})},ue=()=>Kg(eu);import{jsx as ru}from"react/jsx-runtime";var El=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=ue(),[,s]=Xg(()=>r?.split("t:")||[],[r]);if(Qg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return ru("div",{className:"hidden h-0 w-0",children:ru(Zg,{...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"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as wE,useEffect as ky,useRef as CE,useState as bE}from"react";import EE from"react-dom";import{createContext as e1,useContext as t1}from"react";var Tl=e1({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,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>t1(Tl);import{createContext as r1,useContext as o1}from"react";var ae=r1({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,linkTiktok:b,linkLinkedIn:b,linkApple: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,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>o1(ae);import{useEffect as n1,useState as i1}from"react";var ou=e=>{let[t,r]=i1("auto");return n1(()=>{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 a1,useContext as s1,useEffect as l1}from"react";var nu={login:{onComplete:[],onError:[]},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:[]}},Pl=a1(void 0),iu=()=>s1(Pl);function Ee(e,t){if(!t)return;let o=iu().current[e];return l1(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function au(){let e=iu();return(t,r,...o)=>N(e,t,r,...o)}function Sl(e){Ee("configureMfa",e)}import hu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import T1 from"@heroicons/react/24/solid/DocumentCheckIcon";import P1 from"styled-components";import To,{css as kl}from"styled-components";import _l from"styled-components";import{Fragment as d1,jsx as xl,jsxs as p1}from"react/jsx-runtime";var Mt=({success:e,fail:t})=>p1(d1,{children:[xl(ht,{className:e?"success":t?"fail":""}),xl(Al,{className:e?"success":t?"fail":""})]}),ht=_l.span`
12
+ - https://privy.io`;this.getNonceOnce=new nt(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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(dd,{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 pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(pd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw pe(t)}}async sign(){if(!this.api)throw new x("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new x("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 x("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(cd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new x("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,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(xd,{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 pe(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Td,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as qg}from"uuid";function it(e){return new Date(e*1e3)}function rg(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:it(r.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 a={address:r.address,type:r.type,verifiedAt:it(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:it(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:it(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:it(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:it(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:it(r.verified_at)});break;case"farcaster":let v={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:it(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function At(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,og=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),kt=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!og(e)?.length;function bt(e){if(!e)return null;let t=rg(e.linked_accounts),r=At(t,"wallet"),o=At(t,"email"),n=At(t,"phone"),a=At(t,"google_oauth"),i=At(t,"twitter_oauth"),l=At(t,"discord_oauth"),s=At(t,"github_oauth"),d=At(t,"spotify_oauth"),u=At(t,"tiktok_oauth"),y=At(t,"linkedin_oauth"),f=At(t,"apple_oauth"),g=At(t,"farcaster"),E=e.mfa_methods.map(({type:S,verified_at:C})=>({type:S,verifiedAt:it(C)}));return{id:e.id,createdAt:it(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:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord: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:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:E.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Jp}from"@ethersproject/address";import Hg from"eventemitter3";import mg from"@coinbase/wallet-sdk";import{jsx as hp,jsxs as ng}from"react/jsx-runtime";var na=({style:e,...t})=>ng("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:[hp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),hp("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 bp}from"@ethersproject/providers";import{default as pg}from"eventemitter3";import dg from"eventemitter3";var ig=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],yp=e=>ig.includes(e);import{ErrorCode as ag}from"@ethersproject/logger";var Go=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},qt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new Se(e);return e.code===ag.ACTION_REJECTED&&(t.details=Ke.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Se(e):new J("Unknown connector error",e)},Rt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Se=class extends Rt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Ke).find(a=>a.eipCode===o.code);this.details=n||Ke.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Ke.E32002_CONNECTION_ALREADY_PENDING:this.details=Ke.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Ke.E32002_WALLET_LOCKED))}},sg={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}},lg={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}},cg={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}},Ke={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...cg,...lg},Ar={...sg,...Ke};var be=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 Go,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yo,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new J(`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 qt(r)})}},Gr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ia=class extends dg{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=_r(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Gr("Disconnected",4900);return(await wp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`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 Gr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=_r(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 gp(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 vp(ea(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:go(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 go(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(yp(r.method)){let o=await ve();if(await Cp(),!o||!this.address)throw new Gr("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 Gr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();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}}},sr=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Vr=class extends be{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 ug=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ft=class extends pg{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Bo(r),this.walletClientType==="privy"&&ue.put(Ji(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>lr(i.address)===lr(r));return{address:lr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>lr(f.address)===lr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new J(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(ug(f,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??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new bp(new sr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Vr(this.proxyProvider)},sign:async i=>{if(!await a())throw new J("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}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],a=lr(n),i=[],l;if(this.walletClientType==="privy"){let d=ue.get(Ji(a));this.chains.find(u=>u.id===Number(d))||(ue.del(Ji(a)),d=null),l=d||`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 d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${ul}`,d),l=ul}let s=Bo(l);if(!i.find(d=>lr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(lr(n),s,d))}aa(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>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 bp(new sr(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 qo={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 fg=(e,t)=>{let o=Xi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},sa,la=class extends ft{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),sa||(sa=new mg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(fg(sa,a))}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(){sa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:na,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 J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};import{jsx as Ep}from"react/jsx-runtime";var ca=({...e})=>Ep("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ep("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 da=class extends ft{constructor(r,o,n,a){super("privy",o,n,a);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:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ca,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Tp}from"react/jsx-runtime";var $o=({style:e,...t})=>Tp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Tp("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 Et,jsxs as hg}from"react/jsx-runtime";var jo=({style:e,...t})=>hg("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:[Et("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Et("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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"}),Et("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 Pp,jsxs as yg}from"react/jsx-runtime";var cr=({style:e,...t})=>yg("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:[Pp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Pp("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 Yo=class extends ft{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}},Ko,Jo=class extends ft{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Fi(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?el(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&el(this,Ko,{name:"Phantom",icon:cr,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 ad(this,Ko)??{name:"Browser Extension",icon:$o,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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw qt(r)}}};Ko=new WeakMap;import{getAddress as _T}from"@ethersproject/address";import{Web3Provider as kT}from"@ethersproject/providers";import{isMobile as gg}from"react-device-detect";var pa=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{gg||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 J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw qt(t)}}};var ua=class extends ft{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);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 ma=class extends ua{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:cr,id:"phantom"}}};import{EthereumProvider as Dg,OPTIONAL_EVENTS as Fg,OPTIONAL_METHODS as Ug}from"@walletconnect/ethereum-provider";import{isMobile as Bg}from"react-device-detect";import{createContext as kg,useContext as Rg,useEffect as vl,useRef as Ig,useState as Mg}from"react";import{jsx as vg}from"react/jsx-runtime";function fa({src:e,...t}){return vg("img",{src:e,...t,style:{display:"none"}})}import{useContext as qp,useEffect as zp,useMemo as Sg,useState as xg}from"react";import{createContext as _g}from"react";var It={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Bd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Sp=({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 wg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),xp=e=>wg.has(e),_p=(e,t,r)=>r.indexOf(e)===t,Ap=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(xp).filter(_p):e?e.filter(xp).filter(_p):It.appearance.walletList;var ha={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 ya={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 ga={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 kp={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 Rp={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 va={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 wa={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 Ca={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 Ip={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Dp={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 Fp={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 ba={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 Ea={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 Ta={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 Kn={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 Yn={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 Up={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 Bp={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 Pa={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 Sa={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 xa={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 Jn=[ha,ya,ga,Op,Bp,qo,ba,Ea,Ta,Kn,Yn,Ip,Mp,Wp,Lp,va,wa,Ca,Dp,Fp,kp,Rp,Pa,xa,Sa,Np,Up],K6=new Set(Jn.map(e=>e.id));import Co from"tinycolor2";var Hp="#FFFFFF",Cg="#000000",bg=Hp,Eg="#1E1E1D";function Tg(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 zr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Gp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Hp,blackHex:i=Cg}){let l;switch(e){case"light":l=bg;break;case"dark":l=Eg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Tg(s.getLuminance()),E=zr(s,g==="light"?-.04:.11),v=zr(s,g==="light"?-.88:.87),S=zr(s,g==="light"?-.77:.75),C=zr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=zr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=zr(d,.15),M=zr(d,-.06),k=Co(d.getLuminance()>.5?i:a),B=zr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:S.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function hl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,S,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),S=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,S=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,S,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=Ap({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Sp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Pg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,K=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ae,te=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?K?ae=t?.embeddedWallets?.noPromptOnSignature??!0:ae=t?.embeddedWallets?.noPromptOnSignature??te:ae=te,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ae!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Gp({backgroundTheme:t?.appearance?.theme??It.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??It.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:S,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??It.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??It.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??It.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??It.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...K?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ae},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:K?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??It.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??It._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??It._render.inParentNodeId}}}function Vp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function Pg({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:Jn.find(u=>u.id===s.id)??s)}else n=Jn.concat(e??[]);let a=t?n[0]:qo,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}import{jsx as Ag}from"react/jsx-runtime";var $p={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",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},yl=hl($p,void 0,!1),gl=_g({appConfig:yl,isServerConfigLoaded:!1}),jp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=xg(null),i=Sg(()=>hl(n??$p,o,!!n),[n,o]);return zp(()=>{let l=Vp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),zp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Ag(gl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},_a=()=>{let{appConfig:e}=qp(gl);return e},Aa=()=>{let{isServerConfigLoaded:e}=qp(gl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Lg,jsxs as Og}from"react/jsx-runtime";var Kp=kg({ready:!1,app:yl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Wg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Yp=e=>{let t=_a(),r=e.authenticated,[o,n]=Mg(e.initialScreen);vl(()=>{!r&&!Wg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Ig(null);vl(()=>{e.open||(a.current=null)},[e.open]),vl(()=>{a.current=null},[e.initialScreen]);let i={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:a};return Og(Kp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Lg(fa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Rg(Kp);import{jsx as Zo,jsxs as Ng}from"react/jsx-runtime";var Zn=({style:e,...t})=>{let{app:r}=_();return Ng("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:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("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"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var dr=class extends ft{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[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=ta(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:jo,id:"io.metamask"}:{name:Xd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Zn,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=Ho[r],this.walletClientType=r,this.redirectUri=void 0,ap(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ta(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(qt(i));return}o(new J("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Xi(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Dg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fg,optionalMethods:Ug,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Bg&&this.walletEntry){let{redirect:l,href:s}=np(i,this.walletEntry);sp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ra(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=ta(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var wl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Jp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Qn=class extends Hg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;ue.get(dl)&&(ue.getKeys().forEach(o=>{o.startsWith("walletconnect")&&ue.del(o)}),ue.del(dl));let r=ep(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Br()&&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(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new ia(r,o,this.rpcConfig,this.chains,a,n.id),s=new da(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 a=this.findWalletConnector(r,o);if(a)return a instanceof dr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new pa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new la(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ma(this.defaultChain):new dr(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=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=ue.get(pl);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));ue.put(pl,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=Jp(r),this.emit("walletsUpdated")}};function aa(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 Gg}from"ofetch";var Vg=[Hi,Vi,Gi],ka=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=sl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Gg.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:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Vg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Ui}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw pe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw pe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw pe(o)}}};import bo from"js-cookie";function Zp(e){return e instanceof Ur?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ar?e.meta.provider:null}import*as Qp from"jose";var pr=class{static parse(t){try{return new pr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Qp.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 zg=30,Ra=class{constructor(){this.authenticateOnce=new nt(async t=>this._authenticate(t)),this.linkOnce=new nt(async t=>this._link(t)),this.refreshOnce=new nt(this._refresh.bind(this)),this.destroyOnce=new nt(this._destroy.bind(this)),this.forkSessionOnce=new nt(this._forkSession.bind(this))}get token(){try{let t=ue.get(fo);return typeof t=="string"?new pr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ue.get(Ki);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ue.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Yi);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=pr.parse(this.token);return t!==null&&!t.isExpired(zg)}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{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Zp(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:bt(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),ot(r)}}async _link(t){try{let r=await t.link();return bt(r)}catch(r){throw console.warn("Error linking account"),ot(r)}}async _refresh(){if(!this.api)throw new x("Session has no API instance");if(!this.client)throw new x("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 a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Hi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Vi,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),bt(n.user)}catch(n){if(n instanceof ir&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ot(n)}}async _destroy(){try{await this.api?.post(Gi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new x("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ld,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw ot(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=ue.get(fo);if(ue.put(fo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=pr.parse(t)?.expiration;bo.set(ll,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else ue.del(fo),bo.remove(ll)}storeRefreshToken(t){typeof t=="string"?(ue.put(Ki,t),this.client?.useServerCookies||(bo.set(Yi,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(cl,t,{sameSite:"Strict",secure:!0,expires:30}))):(ue.del(Ki),bo.remove(cl),bo.remove(Yi))}clearForkedToken(){ue.del(Hn)}};var Cl,Ia,Xp,Xn=class{constructor(t){Fi(this,Ia);this.apiUrl=t.apiUrl||ji,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Hd,this.appId=t.appId,this.clientAnalyticsId=sd(this,Ia,Xp).call(this),Cl||(Cl=new Ra),this.session=Cl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Qn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new ka(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 x("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new x("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}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(bd,{address:t});return bt(r)}catch(r){throw ot(r)}}async acceptTerms(){try{let t=await this.api.post(Wd,{});return bt(t)}catch(t){throw ot(t)}}async unlinkPhone(t){try{let r=await this.api.post(Sd,{phoneNumber:t});return bt(r)}catch(r){throw ot(r)}}async unlinkWallet(t){try{let r=await this.api.post(ud,{address:t});return bt(r)}catch(r){throw ot(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Rd,{provider:t,subject:r});return bt(o)}catch(o){throw ot(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(gd,{fid:t});return bt(r)}catch(r){throw ot(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Ld,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Od,t)}catch(r){throw ot(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?pr.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=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw ot(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()}};Ia=new WeakSet,Xp=function(){if(typeof window>"u")return null;try{let r=ue.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=qg();try{return ue.put(Gn,t),t}catch{return t}};import{Turnstile as Zg}from"@marsidev/react-turnstile";import{useEffect as Qg,useMemo as Xg}from"react";import{useMemo as $g,useRef as jg,useContext as Kg,useState as bl,createContext as Yg}from"react";import{jsx as Jg}from"react/jsx-runtime";var eu=Yg({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}),$t=class extends $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},tu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=jg(null),[a,i]=bl(),[l,s]=bl(),[d,u]=bl(!1),y=$g(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Jg(eu.Provider,{value:{...y,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Zd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new $t("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>Kg(eu);import{jsx as ru}from"react/jsx-runtime";var El=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=Xg(()=>r?.split("t:")||[],[r]);if(Qg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return ru("div",{className:"hidden h-0 w-0",children:ru(Zg,{...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"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as wE,useEffect as ky,useRef as CE,useState as bE}from"react";import EE from"react-dom";import{createContext as e1,useContext as t1}from"react";var Tl=e1({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,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>t1(Tl);import{createContext as r1,useContext as o1}from"react";var le=r1({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,linkTiktok:b,linkLinkedIn:b,linkApple: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,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>o1(le);import{useEffect as n1,useState as i1}from"react";var ou=e=>{let[t,r]=i1("auto");return n1(()=>{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 a1,useContext as s1,useEffect as l1}from"react";var nu={login:{onComplete:[],onError:[]},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:[]}},Pl=a1(void 0),iu=()=>s1(Pl);function Ee(e,t){if(!t)return;let o=iu().current[e];return l1(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function au(){let e=iu();return(t,r,...o)=>N(e,t,r,...o)}function Sl(e){Ee("configureMfa",e)}import hu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import T1 from"@heroicons/react/24/solid/DocumentCheckIcon";import P1 from"styled-components";import To,{css as kl}from"styled-components";import _l from"styled-components";import{Fragment as d1,jsx as xl,jsxs as p1}from"react/jsx-runtime";var Mt=({success:e,fail:t})=>p1(d1,{children:[xl(ht,{className:e?"success":t?"fail":""}),xl(Al,{className:e?"success":t?"fail":""})]}),ht=_l.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -85,7 +85,7 @@ Resources:
85
85
  color: var(--privy-color-foreground-3);
86
86
  cursor: not-allowed;
87
87
  }
88
- `,D=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Wt(su,{disabled:t||r,...n,children:t?Oa("span",{children:[Wt(Eo,{}),o?Wt("span",{children:o}):null]}):e}),o8=To(D)`
88
+ `,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Wt(su,{disabled:t||r,...n,children:t?Oa("span",{children:[Wt(Eo,{}),o?Wt("span",{children:o}):null]}):e}),o8=To(F)`
89
89
  ${e=>e.hideAnimations&&kl`
90
90
  && {
91
91
  transition: none;
@@ -401,13 +401,13 @@ Resources:
401
401
  @media (max-width: 440px) {
402
402
  padding: 10px 10px 20px;
403
403
  }
404
- `,me=Ne.div`
404
+ `,he=Ne.div`
405
405
  font-size: 18px;
406
406
  line-height: 18px;
407
407
  text-align: center;
408
408
  font-weight: 600;
409
409
  margin-bottom: 10px;
410
- `,se=Ne.div`
410
+ `,ce=Ne.div`
411
411
  font-size: 0.875rem;
412
412
 
413
413
  text-align: center;
@@ -565,7 +565,7 @@ Resources:
565
565
  width: auto !important;
566
566
  color: white;
567
567
  }
568
- `;import{Fragment as _1,jsx as ur,jsxs as ei}from"react/jsx-runtime";var yu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=_(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=W(),d=y=>{y?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async y=>{y.preventDefault(),await i(),e&&kt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s("embedded_wallet_creation_failure_logout",{error:f,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return ur(S1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},S1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ei(_1,{children:[ur(A,{closeable:!1}),ur(T1,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),ur(me,{style:{marginTop:24},children:"One last step"}),ur(se,{children:"By signing up, you agree to our terms and privacy policy."}),ei(Ot,{style:{marginTop:24},children:[e&&ei(Ml,{target:"_blank",href:e,children:["View Terms ",ur(hu,{style:{marginLeft:"auto"}})]}),t&&ei(Ml,{target:"_blank",href:t,children:["View Privacy Policy ",ur(hu,{style:{marginLeft:"auto"}})]})]}),ei(x1,{style:{marginTop:24},children:[ur(jt,{onClick:o,children:"No thanks"}),ur(D,{onClick:r,children:"Accept"})]}),ur(V,{protectedByPrivy:!0})]}),x1=P1.div`
568
+ `;import{Fragment as _1,jsx as ur,jsxs as ei}from"react/jsx-runtime";var yu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=_(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=W(),d=y=>{y?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async y=>{y.preventDefault(),await i(),e&&kt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s("embedded_wallet_creation_failure_logout",{error:f,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return ur(S1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},S1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ei(_1,{children:[ur(A,{closeable:!1}),ur(T1,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),ur(he,{style:{marginTop:24},children:"One last step"}),ur(ce,{children:"By signing up, you agree to our terms and privacy policy."}),ei(Ot,{style:{marginTop:24},children:[e&&ei(Ml,{target:"_blank",href:e,children:["View Terms ",ur(hu,{style:{marginLeft:"auto"}})]}),t&&ei(Ml,{target:"_blank",href:t,children:["View Privacy Policy ",ur(hu,{style:{marginLeft:"auto"}})]})]}),ei(x1,{style:{marginTop:24},children:[ur(jt,{onClick:o,children:"No thanks"}),ur(F,{onClick:r,children:"Accept"})]}),ur(V,{protectedByPrivy:!0})]}),x1=P1.div`
569
569
  display: flex;
570
570
  gap: 10px;
571
571
  `;import Fl from"styled-components";import A1 from"styled-components";var Ga=A1.span`
@@ -583,7 +583,7 @@ Resources:
583
583
  transition: border-color 800ms;
584
584
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
585
585
  }
586
- `;import{jsx as gu}from"react/jsx-runtime";var Va=({style:e,...t})=>gu("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:gu("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 Dl,jsx as mr,jsxs as za}from"react/jsx-runtime";var vu=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return za(Dl,{children:[mr(A,{}),za(k1,{children:[mr(I1,{children:za("div",{children:[mr(Ga,{}),mr(Va,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),za(R1,{children:[typeof r=="string"?mr("h3",{children:r}):mr(Dl,{children:r}),typeof o=="string"?mr("p",{children:o}):mr(Dl,{children:o})]}),t?.allowlistConfig.errorCtaLink?mr(D,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):mr(D,{onClick:()=>{e("LANDING")},children:n})]})]})},k1=Fl.div`
586
+ `;import{jsx as gu}from"react/jsx-runtime";var Va=({style:e,...t})=>gu("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:gu("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 Dl,jsx as mr,jsxs as za}from"react/jsx-runtime";var vu=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return za(Dl,{children:[mr(A,{}),za(k1,{children:[mr(I1,{children:za("div",{children:[mr(Ga,{}),mr(Va,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),za(R1,{children:[typeof r=="string"?mr("h3",{children:r}):mr(Dl,{children:r}),typeof o=="string"?mr("p",{children:o}):mr(Dl,{children:o})]}),t?.allowlistConfig.errorCtaLink?mr(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):mr(F,{onClick:()=>{e("LANDING")},children:n})]})]})},k1=Fl.div`
587
587
  display: flex;
588
588
  flex-direction: column;
589
589
  align-items: center;
@@ -722,7 +722,7 @@ Resources:
722
722
  h3 {
723
723
  margin-bottom: 24px;
724
724
  }
725
- `;import{Fragment as Hl,jsx as Ze,jsxs as Kr}from"react/jsx-runtime";var Gl=6,xu=new Array(Gl).fill(""),D1=1400;var Au=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:y}=W(),{authenticated:f,logout:g,user:E}=G(),[v,S]=qa(xu),[C,P]=qa(!1),[I,M]=qa(null),[k,U]=qa(null);n.current=()=>null;let F=s()?.email?0:1,H=e?.render.inDialog?Oe:0,T=e?.render.inDialog?H-500:0;Su(()=>{if(f&&C&&E){if(e?.legal.requireUsersAcceptTerms&&!E.hasAcceptedTerms){let ee=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},T);return()=>clearTimeout(ee)}if(kt(E,e?.embeddedWallets?.createOnLogin)){let ee=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),y("embedded_wallet_creation_failure_logout",{error:z,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},T);return()=>clearTimeout(ee)}else{u();let ee=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(ee)}}},[f,C,E]),Su(()=>{if(I&&k===0){let te=setTimeout(()=>{S(xu),M(null),document.querySelector("input[name=code-0]")?.focus()},D1);return()=>clearTimeout(te)}},[I]);let q=te=>{te.preventDefault();let ee=te.currentTarget.value.replace(" ","");if(ee==="")return;if(isNaN(Number(ee))){M("Code should be numeric"),U(1);return}M(null),U(null);let z=Number(te.currentTarget.name?.charAt(5)),Pe=[...ee||[""]].slice(0,Gl-z),we=[...v.slice(0,z),...Pe,...v.slice(z+Pe.length)];S(we);let Pr=Pe.length,gt=Math.min(Math.max(z+Pr,0),Gl-1);isNaN(Number(te.currentTarget.value))||document.querySelector(`input[name=code-${gt}]`)?.focus(),we.every(Ae=>Ae&&!isNaN(+Ae))&&(document.querySelector(`input[name=code-${gt}]`)?.blur(),d(we.join("")).then(()=>P(!0)).catch(he=>{he?.status===422?M("Invalid or expired verification code"):he instanceof ir&&he.privyErrorCode==="cannot_link_more_of_type"?M(he.message):M("Issue verifying code"),U(0)}))},O=te=>{k===1&&(M(null),U(null));let ee=[...v.slice(0,te),"",...v.slice(te+1)];S(ee),te>0&&document.querySelector(`input[name=code-${te-1}]`)?.focus()},K=F==0?Ze(L1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Ze(O1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ie=F==0?Kr("p",{children:["Please check ",Ze(_u,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Kr("p",{children:["Please check ",Ze(_u,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Kr(Hl,{children:[Ze(A,{backFn:()=>r()},"header"),Kr(F1,{children:[Ze(_e,{title:"Enter confirmation code",description:ie,icon:K}),Kr(wu,{children:[Kr(U1,{children:[Ze(B1,{fail:!!I,success:C,children:Ze("span",{children:I||(C?"Success!":"")})}),Ze("div",{children:v.map((te,ee)=>Ze("input",{name:`code-${ee}`,type:"text",value:v[ee],onChange:q,onKeyUp:z=>{z.key==="Backspace"&&O(ee)},inputMode:"numeric",autoFocus:ee===0,pattern:"[0-9]",className:`${C?"success":""} ${I?"fail":""}`,autoComplete:N1?"one-time-code":"off"},ee))})]}),Ze(H1,{children:F==0?Kr(Hl,{children:[Ze("span",{children:"Didn't get an email?"}),Ze("button",{onClick:i,children:"Resend code"})]}):Kr(Hl,{children:[Ze("span",{children:"Didn't get a message?"}),Ze("button",{onClick:l,children:"Resend code"})]})})]})]}),Ze(V,{protectedByPrivy:!0})]})},F1=oi.div`
725
+ `;import{Fragment as Hl,jsx as Ze,jsxs as Kr}from"react/jsx-runtime";var Gl=6,xu=new Array(Gl).fill(""),D1=1400;var Au=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:y}=W(),{authenticated:f,logout:g,user:E}=G(),[v,S]=qa(xu),[C,P]=qa(!1),[R,M]=qa(null),[k,B]=qa(null);n.current=()=>null;let U=s()?.email?0:1,H=e?.render.inDialog?Oe:0,T=e?.render.inDialog?H-500:0;Su(()=>{if(f&&C&&E){if(e?.legal.requireUsersAcceptTerms&&!E.hasAcceptedTerms){let ee=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},T);return()=>clearTimeout(ee)}if(kt(E,e?.embeddedWallets?.createOnLogin)){let ee=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),y("embedded_wallet_creation_failure_logout",{error:z,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},T);return()=>clearTimeout(ee)}else{u();let ee=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(ee)}}},[f,C,E]),Su(()=>{if(R&&k===0){let te=setTimeout(()=>{S(xu),M(null),document.querySelector("input[name=code-0]")?.focus()},D1);return()=>clearTimeout(te)}},[R]);let q=te=>{te.preventDefault();let ee=te.currentTarget.value.replace(" ","");if(ee==="")return;if(isNaN(Number(ee))){M("Code should be numeric"),B(1);return}M(null),B(null);let z=Number(te.currentTarget.name?.charAt(5)),Pe=[...ee||[""]].slice(0,Gl-z),we=[...v.slice(0,z),...Pe,...v.slice(z+Pe.length)];S(we);let Pr=Pe.length,gt=Math.min(Math.max(z+Pr,0),Gl-1);isNaN(Number(te.currentTarget.value))||document.querySelector(`input[name=code-${gt}]`)?.focus(),we.every(Ae=>Ae&&!isNaN(+Ae))&&(document.querySelector(`input[name=code-${gt}]`)?.blur(),d(we.join("")).then(()=>P(!0)).catch(ge=>{ge?.status===422?M("Invalid or expired verification code"):ge instanceof ir&&ge.privyErrorCode==="cannot_link_more_of_type"?M(ge.message):M("Issue verifying code"),B(0)}))},O=te=>{k===1&&(M(null),B(null));let ee=[...v.slice(0,te),"",...v.slice(te+1)];S(ee),te>0&&document.querySelector(`input[name=code-${te-1}]`)?.focus()},K=U==0?Ze(L1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Ze(O1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ae=U==0?Kr("p",{children:["Please check ",Ze(_u,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Kr("p",{children:["Please check ",Ze(_u,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Kr(Hl,{children:[Ze(A,{backFn:()=>r()},"header"),Kr(F1,{children:[Ze(_e,{title:"Enter confirmation code",description:ae,icon:K}),Kr(wu,{children:[Kr(U1,{children:[Ze(B1,{fail:!!R,success:C,children:Ze("span",{children:R||(C?"Success!":"")})}),Ze("div",{children:v.map((te,ee)=>Ze("input",{name:`code-${ee}`,type:"text",value:v[ee],onChange:q,onKeyUp:z=>{z.key==="Backspace"&&O(ee)},inputMode:"numeric",autoFocus:ee===0,pattern:"[0-9]",className:`${C?"success":""} ${R?"fail":""}`,autoComplete:N1?"one-time-code":"off"},ee))})]}),Ze(H1,{children:U==0?Kr(Hl,{children:[Ze("span",{children:"Didn't get an email?"}),Ze("button",{onClick:i,children:"Resend code"})]}):Kr(Hl,{children:[Ze("span",{children:"Didn't get a message?"}),Ze("button",{onClick:l,children:"Resend code"})]})})]})]}),Ze(V,{protectedByPrivy:!0})]})},F1=oi.div`
726
726
  display: flex;
727
727
  flex-direction: column;
728
728
  align-items: flex-start;
@@ -834,7 +834,7 @@ Resources:
834
834
  left: -19px;
835
835
  top: -19px;
836
836
  }
837
- `;import{Fragment as Z1,jsx as Yt,jsxs as zl}from"react/jsx-runtime";var Iu=500,Ru=Iu*2,Mu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=_(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=ue(),y=K1([]),f=K=>{y.current=[K,...y.current]},[g,E]=nn(!0);Vl(()=>{let K=setTimeout(E,Ru,!1);return f(K),()=>{y.current.forEach(ie=>clearTimeout(ie)),y.current=[]}},[]);let[v,S]=nn(""),[C,P]=nn("Checking that you are a human..."),[I,M]=nn(Yt(D,{onClick:()=>{},disabled:!0,children:"Continue"})),[k,U]=nn(!1),[F,H]=nn(3),T=r?.captchaModalData,q=async K=>{try{await T?.callback(K),T?.onSuccessNavigateTo&&n(T?.onSuccessNavigateTo,!1)}catch(ie){if(ie instanceof $t)return;{let te={error:ie,previousScreen:e||"LANDING"};a({errorModalData:te}),n(T?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Vl(()=>{if(i==="success"){let K=setTimeout(async()=>{let ie=await s();!ie||T?.userIntentRequired||q(ie)},Ru);f(K)}else if(i==="ready"){let K=setTimeout(()=>{i==="ready"&&u()},Iu);f(K)}},[i]),Vl(()=>{if(!g)switch(i){case"success":S("Success!"),P("CAPTCHA passed successfully."),M(Yt(D,{onClick:()=>{U(!0),q(l)},disabled:!T?.userIntentRequired,loading:k,children:T?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),P("Checking that you are a human..."),M(Yt(D,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),F<=0?(P("If you use an adblocker or VPN, try disabling and re-attempting."),M(null)):(P("You did not pass CAPTCHA. Please try again."),M(Yt(D,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[i,g,k]);let O=async()=>{if(F<=0)return;H(ie=>ie-1),d(),u();let K=await s();!K||T?.userIntentRequired||q(K)};return zl(Z1,{children:[Yt(A,{backFn:!e||t===e?void 0:o}),zl(J1,{children:[i==="success"?Yt($1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?Yt(j1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Yt(ku,{}),zl(Je,{children:[v?Yt("h3",{children:v}):null,Yt("p",{children:C})]}),I]}),Yt(Q,{})]})},J1=Y1.div`
837
+ `;import{Fragment as Z1,jsx as Yt,jsxs as zl}from"react/jsx-runtime";var Iu=500,Ru=Iu*2,Mu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=_(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=fe(),y=K1([]),f=K=>{y.current=[K,...y.current]},[g,E]=nn(!0);Vl(()=>{let K=setTimeout(E,Ru,!1);return f(K),()=>{y.current.forEach(ae=>clearTimeout(ae)),y.current=[]}},[]);let[v,S]=nn(""),[C,P]=nn("Checking that you are a human..."),[R,M]=nn(Yt(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[k,B]=nn(!1),[U,H]=nn(3),T=r?.captchaModalData,q=async K=>{try{await T?.callback(K),T?.onSuccessNavigateTo&&n(T?.onSuccessNavigateTo,!1)}catch(ae){if(ae instanceof $t)return;{let te={error:ae,previousScreen:e||"LANDING"};a({errorModalData:te}),n(T?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Vl(()=>{if(i==="success"){let K=setTimeout(async()=>{let ae=await s();!ae||T?.userIntentRequired||q(ae)},Ru);f(K)}else if(i==="ready"){let K=setTimeout(()=>{i==="ready"&&u()},Iu);f(K)}},[i]),Vl(()=>{if(!g)switch(i){case"success":S("Success!"),P("CAPTCHA passed successfully."),M(Yt(F,{onClick:()=>{B(!0),q(l)},disabled:!T?.userIntentRequired,loading:k,children:T?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),P("Checking that you are a human..."),M(Yt(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),U<=0?(P("If you use an adblocker or VPN, try disabling and re-attempting."),M(null)):(P("You did not pass CAPTCHA. Please try again."),M(Yt(F,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[i,g,k]);let O=async()=>{if(U<=0)return;H(ae=>ae-1),d(),u();let K=await s();!K||T?.userIntentRequired||q(K)};return zl(Z1,{children:[Yt(A,{backFn:!e||t===e?void 0:o}),zl(J1,{children:[i==="success"?Yt($1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?Yt(j1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Yt(ku,{}),zl(Je,{children:[v?Yt("h3",{children:v}):null,Yt("p",{children:C})]}),R]}),Yt(Q,{})]})},J1=Y1.div`
838
838
  display: flex;
839
839
  flex-direction: column;
840
840
  align-items: center;
@@ -872,7 +872,7 @@ Resources:
872
872
  justify-content: center;
873
873
  `;import{Fragment as Cv,jsx as dn,jsxs as bv}from"react/jsx-runtime";var zu=()=>{let{app:e}=_();return bv(Cv,{children:[dn(A,{},"header"),dn(wv,{}),dn(Ot,{children:dn(ln,{connectOnly:!0})}),e&&dn(Xo,{app:e,alwaysShowImplicitConsent:!0}),dn(V,{protectedByPrivy:!0})]})},wv=vv(cn)`
874
874
  margin-bottom: 16px;
875
- `;import{useEffect as Yu,useState as Ju}from"react";import{isMobile as kv}from"react-device-detect";import Rv from"styled-components";import{useEffect as ql,useState as So}from"react";import{isMobile as li}from"react-device-detect";import{useInterval as Sv}from"react-use";import $u from"styled-components";import{useState as Ev,useEffect as Tv,useCallback as Pv}from"react";function qu(){let[e,t]=Ev(!1),r=Pv(()=>{document.hidden&&t(!0)},[]);return Tv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Ku,jsx as De,jsxs as ci}from"react/jsx-runtime";var $l=2,jl=e=>e?.privyErrorCode==="linked_to_another_user"?Ar.ERROR_USER_EXISTS:e instanceof Se&&!e.details.default?e.details:e instanceof Go?Ar.ERROR_TIMED_OUT:e instanceof Vo?Ar.ERROR_USER_REJECTED_CONNECTION:Ar.ERROR_WALLET_CONNECTION,ju=()=>{let[e,t]=So(!1),[r,o]=So(!1),[n,a]=So(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:d,navigateBack:u,lastScreen:y,currentScreen:f,setModalData:g}=_(),{getAuthFlow:E,walletConnectionStatus:v,closePrivyModal:S,initLoginWithWallet:C,loginWithWallet:P,updateWallets:I,createAnalyticsEvent:M}=W(),{walletConnectors:k}=G(),[U,F]=So(0),{user:H}=G(),[T]=So(H?.linkedAccounts.length||0),[q,O]=So(""),[K,ie]=So(!1),{hasTabbedAway:te}=qu(),{enabled:ee,token:z}=ue(),Pe=li&&v?.connector?.connectorType==="wallet_connect_v2"||li&&v?.connector?.connectorType==="coinbase_wallet"||li&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",we=v?.status==="connected",Pr=v?.status==="switching_to_supported_chain";ql(()=>{let $=E();if(we&&!$&&(ee&&!z&&!i?(g({captchaModalData:{callback:We=>C(v.connectedWallet,We).then(()=>{ie(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):C(v.connectedWallet,z).then(()=>{ie(!0)})),$&&Pe&&we&&!$.preparedMessage){$.buildSiweMessage();return}!$||Pe||!we||r||(async()=>{o(!0),a(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await ml(2500),await Ae()}catch(We){console.warn("Auto-prompted signature failed",We)}finally{o(!1)}})()},[U,we,K]),ql(()=>{if(H&&e){let $=s?.render.inDialog?Oe:0,We=s?.render.inDialog?$-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let po=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},We);return()=>clearTimeout(po)}if(kt(H,s?.embeddedWallets?.createOnLogin)){let po=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Ht=>{console.error(Ht),M("embedded_wallet_creation_failure_logout",{error:Ht,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},We);return()=>clearTimeout(po)}I();let ut=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Oe);return()=>clearTimeout(ut)}},[H,e]);let gt=$=>{if($?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(jl($))};async function Ae(){try{if(await P(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch($){gt($)}finally{o(!1)}}ql(()=>{v?.connectError&&gt(v?.connectError)},[v]),Sv(()=>{let $=he==="wallet_connect_v2"&&v?.connector instanceof dr?v.connector.redirectUri:void 0;$&&O($)},v?.connector instanceof dr&&!q?500:null);let he=v?.connector?.connectorType||"injected",vt=v?.connector?.walletClientType||"unknown",Bt=yr[vt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",Dr=yr[vt]?.logo||v?.connector?.walletBranding.icon||($=>De($o,{...$})),rr=Bt==="Browser Extension"?Bt.toLowerCase():Bt,L;e?L=`Successfully connected with ${rr}`:n?L=n.message:Pr?L="Switching networks":we?L=r&&Pe?"Signing":"Sign to verify":L=`Waiting for ${rr}`;let Y="Don\u2019t see your wallet? Check your other browser windows.";if(e){let $=H?.linkedAccounts.length||0;T===$?Y="Wallet was already linked.":Y="You\u2019re good to go!"}else U>=$l&&n?Y="Unable to connect wallet":n?Y=n.detail:Pr?Y="Switch your wallet to the requested network.":we&&Pe?Y="Sign the message in your wallet to verify it belongs to you.":vt==="metamask"&&li?Y="Click continue to open and connect MetaMask.":vt==="metamask"?Y="For the best experience, connect only one wallet at a time.":he==="wallet_connect"?Y="Open your mobile wallet app to continue":he==="coinbase_wallet"&&(Fd()||(wl(H)?Y="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Y="Open the Coinbase app on your phone to continue."));let Z=k?.walletConnectors?.find($=>$.walletClientType==="coinbase_wallet"),Bn=vt==="coinbase_wallet"&&(wl(H)||n===Ar.ERROR_USER_EXISTS);return ci(Ku,{children:[De(A,{backFn:!y||f===y?void 0:u}),ci(_v,{children:[De(Kl,{walletLogo:Dr,success:e,fail:!!n}),ci(Je,{children:[De("h3",{children:L}),De("p",{children:Y}),!we&&q&&!te?ci("p",{children:["Still here?"," ",De("a",{href:q,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Bn?De(D,{onClick:()=>Z&&Z?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Ar.ERROR_USER_EXISTS&&f!==y?De(D,{onClick:u,children:"Use a different wallet"}):we&&!e&&Pe?De(D,{onClick:()=>{o(!0),Ae(),xv(vt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&U<$l?De(D,{onClick:()=>{F(U+1),a(void 0),we?(o(!0),Ae()):v?.connectRetry()},disabled:!e&&(!n?.retryable||U>=$l),children:"Retry"}):!e&&!n?De(D,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),De(Q,{})]})},xv=e=>{if(!li||!rp(e))return;let t=op(e);t&&window.open(t,"_self","noopener,noreferrer")},_v=$u.div`
875
+ `;import{useEffect as Yu,useState as Ju}from"react";import{isMobile as kv}from"react-device-detect";import Rv from"styled-components";import{useEffect as ql,useState as So}from"react";import{isMobile as li}from"react-device-detect";import{useInterval as Sv}from"react-use";import $u from"styled-components";import{useState as Ev,useEffect as Tv,useCallback as Pv}from"react";function qu(){let[e,t]=Ev(!1),r=Pv(()=>{document.hidden&&t(!0)},[]);return Tv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Ku,jsx as De,jsxs as ci}from"react/jsx-runtime";var $l=2,jl=e=>e?.privyErrorCode==="linked_to_another_user"?Ar.ERROR_USER_EXISTS:e instanceof Se&&!e.details.default?e.details:e instanceof Go?Ar.ERROR_TIMED_OUT:e instanceof Vo?Ar.ERROR_USER_REJECTED_CONNECTION:Ar.ERROR_WALLET_CONNECTION,ju=()=>{let[e,t]=So(!1),[r,o]=So(!1),[n,a]=So(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:d,navigateBack:u,lastScreen:y,currentScreen:f,setModalData:g}=_(),{getAuthFlow:E,walletConnectionStatus:v,closePrivyModal:S,initLoginWithWallet:C,loginWithWallet:P,updateWallets:R,createAnalyticsEvent:M}=W(),{walletConnectors:k}=G(),[B,U]=So(0),{user:H}=G(),[T]=So(H?.linkedAccounts.length||0),[q,O]=So(""),[K,ae]=So(!1),{hasTabbedAway:te}=qu(),{enabled:ee,token:z}=fe(),Pe=li&&v?.connector?.connectorType==="wallet_connect_v2"||li&&v?.connector?.connectorType==="coinbase_wallet"||li&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",we=v?.status==="connected",Pr=v?.status==="switching_to_supported_chain";ql(()=>{let $=E();if(we&&!$&&(ee&&!z&&!i?(g({captchaModalData:{callback:We=>C(v.connectedWallet,We).then(()=>{ae(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):C(v.connectedWallet,z).then(()=>{ae(!0)})),$&&Pe&&we&&!$.preparedMessage){$.buildSiweMessage();return}!$||Pe||!we||r||(async()=>{o(!0),a(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await ml(2500),await Ae()}catch(We){console.warn("Auto-prompted signature failed",We)}finally{o(!1)}})()},[B,we,K]),ql(()=>{if(H&&e){let $=s?.render.inDialog?Oe:0,We=s?.render.inDialog?$-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let po=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},We);return()=>clearTimeout(po)}if(kt(H,s?.embeddedWallets?.createOnLogin)){let po=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Ht=>{console.error(Ht),M("embedded_wallet_creation_failure_logout",{error:Ht,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},We);return()=>clearTimeout(po)}R();let ut=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Oe);return()=>clearTimeout(ut)}},[H,e]);let gt=$=>{if($?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(jl($))};async function Ae(){try{if(await P(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch($){gt($)}finally{o(!1)}}ql(()=>{v?.connectError&&gt(v?.connectError)},[v]),Sv(()=>{let $=ge==="wallet_connect_v2"&&v?.connector instanceof dr?v.connector.redirectUri:void 0;$&&O($)},v?.connector instanceof dr&&!q?500:null);let ge=v?.connector?.connectorType||"injected",vt=v?.connector?.walletClientType||"unknown",Bt=yr[vt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",Dr=yr[vt]?.logo||v?.connector?.walletBranding.icon||($=>De($o,{...$})),rr=Bt==="Browser Extension"?Bt.toLowerCase():Bt,L;e?L=`Successfully connected with ${rr}`:n?L=n.message:Pr?L="Switching networks":we?L=r&&Pe?"Signing":"Sign to verify":L=`Waiting for ${rr}`;let Y="Don\u2019t see your wallet? Check your other browser windows.";if(e){let $=H?.linkedAccounts.length||0;T===$?Y="Wallet was already linked.":Y="You\u2019re good to go!"}else B>=$l&&n?Y="Unable to connect wallet":n?Y=n.detail:Pr?Y="Switch your wallet to the requested network.":we&&Pe?Y="Sign the message in your wallet to verify it belongs to you.":vt==="metamask"&&li?Y="Click continue to open and connect MetaMask.":vt==="metamask"?Y="For the best experience, connect only one wallet at a time.":ge==="wallet_connect"?Y="Open your mobile wallet app to continue":ge==="coinbase_wallet"&&(Fd()||(wl(H)?Y="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Y="Open the Coinbase app on your phone to continue."));let Z=k?.walletConnectors?.find($=>$.walletClientType==="coinbase_wallet"),Bn=vt==="coinbase_wallet"&&(wl(H)||n===Ar.ERROR_USER_EXISTS);return ci(Ku,{children:[De(A,{backFn:!y||f===y?void 0:u}),ci(_v,{children:[De(Kl,{walletLogo:Dr,success:e,fail:!!n}),ci(Je,{children:[De("h3",{children:L}),De("p",{children:Y}),!we&&q&&!te?ci("p",{children:["Still here?"," ",De("a",{href:q,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Bn?De(F,{onClick:()=>Z&&Z?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Ar.ERROR_USER_EXISTS&&f!==y?De(F,{onClick:u,children:"Use a different wallet"}):we&&!e&&Pe?De(F,{onClick:()=>{o(!0),Ae(),xv(vt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&B<$l?De(F,{onClick:()=>{U(B+1),a(void 0),we?(o(!0),Ae()):v?.connectRetry()},disabled:!e&&(!n?.retryable||B>=$l),children:"Retry"}):!e&&!n?De(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),De(Q,{})]})},xv=e=>{if(!li||!rp(e))return;let t=op(e);t&&window.open(t,"_self","noopener,noreferrer")},_v=$u.div`
876
876
  display: flex;
877
877
  flex-direction: column;
878
878
  align-items: center;
@@ -902,7 +902,7 @@ Resources:
902
902
  left: -19px;
903
903
  top: -19px;
904
904
  }
905
- `,Kl=e=>{let t=e.walletLogo;return De(Ku,{children:De(Av,{children:ci("div",{children:[De(Mt,{success:e.success,fail:e.fail}),typeof t=="string"?De("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):De(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Mv,jsx as Rr,jsxs as Yl}from"react/jsx-runtime";var $a=2,Zu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[a,i]=Ju(void 0),[l,s]=Ju(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Yu(()=>{if(d){let I=setTimeout(n,Oe);return()=>clearTimeout(I)}},[d]);let y=I=>{i(jl(I))};Yu(()=>{o?.connectError&&y(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",E=yr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=yr[g]?.logo||o?.connector?.walletBranding.icon||(I=>Rr($o,{...I})),S=E==="Browser Extension"?E.toLowerCase():E,C;d?C=`Successfully connected with ${S}`:a?C=a.message:u?C="Switching networks":C=`Waiting for ${S}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return d?P="You\u2019re good to go!":l>=$a&&a?P="Unable to connect wallet":a?P=a.detail:u?P="Switch your wallet to the requested network.":g==="metamask"&&kv?P="Click to continue to open and connect MetaMask.":g==="metamask"?P="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?P="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),Yl(Mv,{children:[Rr(A,{backFn:r===t?void 0:e}),Yl(Iv,{children:[Rr(Kl,{walletLogo:v,success:d,fail:!!a}),Yl(Je,{children:[Rr("h3",{children:C}),Rr("p",{children:P})]}),a==Ar.ERROR_USER_EXISTS?Rr(D,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<$a?Rr(D,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=$a),children:"Retry"}):!d&&a&&l>=$a?Rr(D,{onClick:e,children:"Use a different wallet"}):null]}),Rr(Q,{})]})},Iv=Rv.div`
905
+ `,Kl=e=>{let t=e.walletLogo;return De(Ku,{children:De(Av,{children:ci("div",{children:[De(Mt,{success:e.success,fail:e.fail}),typeof t=="string"?De("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):De(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Mv,jsx as Rr,jsxs as Yl}from"react/jsx-runtime";var $a=2,Zu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[a,i]=Ju(void 0),[l,s]=Ju(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Yu(()=>{if(d){let R=setTimeout(n,Oe);return()=>clearTimeout(R)}},[d]);let y=R=>{i(jl(R))};Yu(()=>{o?.connectError&&y(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",E=yr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=yr[g]?.logo||o?.connector?.walletBranding.icon||(R=>Rr($o,{...R})),S=E==="Browser Extension"?E.toLowerCase():E,C;d?C=`Successfully connected with ${S}`:a?C=a.message:u?C="Switching networks":C=`Waiting for ${S}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return d?P="You\u2019re good to go!":l>=$a&&a?P="Unable to connect wallet":a?P=a.detail:u?P="Switch your wallet to the requested network.":g==="metamask"&&kv?P="Click to continue to open and connect MetaMask.":g==="metamask"?P="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?P="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),Yl(Mv,{children:[Rr(A,{backFn:r===t?void 0:e}),Yl(Iv,{children:[Rr(Kl,{walletLogo:v,success:d,fail:!!a}),Yl(Je,{children:[Rr("h3",{children:C}),Rr("p",{children:P})]}),a==Ar.ERROR_USER_EXISTS?Rr(F,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<$a?Rr(F,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=$a),children:"Retry"}):!d&&a&&l>=$a?Rr(F,{onClick:e,children:"Use a different wallet"}):null]}),Rr(Q,{})]})},Iv=Rv.div`
906
906
  display: flex;
907
907
  flex-direction: column;
908
908
  align-items: center;
@@ -965,7 +965,7 @@ Resources:
965
965
  transform: rotate(360deg);
966
966
  }
967
967
  }
968
- `;var Qu=["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 fe=class extends Error{constructor(r,o){super(o);this.type=r}};function un(e){let t=e.type;return typeof t=="string"&&Qu.includes(t)}function Fv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function xo(e){return un(e)&&e.type==="wallet_not_on_device"}function Xu(e){return un(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function mn(e){return!!(un(e)&&e.type==="mfa_timeout")}function fn(e){return!!(un(e)&&e.type==="missing_or_invalid_mfa")}function Zl(e){return!!(un(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ql(e){return!!(un(e)&&e.message.includes("code 429"))}function Xl(e){return!!(Fv(e)&&e.message==="MFA canceled")}import{Fragment as tm,jsx as hn,jsxs as ec}from"react/jsx-runtime";var em=1,rm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=W(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Hv(()=>Date.now(),[]),[y,f]=Gv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{y||(f(!0),E(typeof C=="string"?new Error(C):C))};Bv(()=>{let C=Ce(t),P;return!e||!C?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:C.address});let k=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<em?P=setTimeout(()=>{i(g)},(em-k)*1e3):i(g)}catch(k){if(xo(k)&&C.recoveryMethod==="privy"){let U=await r();if(!U)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:C.address}),(await a?.recover({address:C.address,accessToken:U}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:C.address}),i(g)}catch{v("An error has occurred, please try again.")}}else xo(k)?(s({...l,recoverWallet:{privyWallet:C,onCompleteNavigateTo:g,onFailure:E}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(k)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let S=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=S,ec(tm,{children:[hn(A,{onClose:S}),y?ec(tm,{children:[ec(Kt,{children:[hn(Uv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),hn(_e,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),hn(D,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):hn(pn,{}),hn(zv,{})]})},zv=Vv.div`
968
+ `;var Qu=["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 ye=class extends Error{constructor(r,o){super(o);this.type=r}};function un(e){let t=e.type;return typeof t=="string"&&Qu.includes(t)}function Fv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function xo(e){return un(e)&&e.type==="wallet_not_on_device"}function Xu(e){return un(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function mn(e){return!!(un(e)&&e.type==="mfa_timeout")}function fn(e){return!!(un(e)&&e.type==="missing_or_invalid_mfa")}function Zl(e){return!!(un(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ql(e){return!!(un(e)&&e.message.includes("code 429"))}function Xl(e){return!!(Fv(e)&&e.message==="MFA canceled")}import{Fragment as tm,jsx as hn,jsxs as ec}from"react/jsx-runtime";var em=1,rm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=W(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Hv(()=>Date.now(),[]),[y,f]=Gv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{y||(f(!0),E(typeof C=="string"?new Error(C):C))};Bv(()=>{let C=Ce(t),P;return!e||!C?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:C.address});let k=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<em?P=setTimeout(()=>{i(g)},(em-k)*1e3):i(g)}catch(k){if(xo(k)&&C.recoveryMethod==="privy"){let B=await r();if(!B)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:C.address}),(await a?.recover({address:C.address,accessToken:B}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:C.address}),i(g)}catch{v("An error has occurred, please try again.")}}else xo(k)?(s({...l,recoverWallet:{privyWallet:C,onCompleteNavigateTo:g,onFailure:E}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(k)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let S=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=S,ec(tm,{children:[hn(A,{onClose:S}),y?ec(tm,{children:[ec(Kt,{children:[hn(Uv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),hn(_e,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),hn(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):hn(pn,{}),hn(zv,{})]})},zv=Vv.div`
969
969
  height: 44px;
970
970
  `;import qv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as $v}from"react";import{Fragment as jv,jsx as yn,jsxs as om}from"react/jsx-runtime";var nm=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let y=Ce(e);y?(o(),l(y)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return $v(()=>{let y=setTimeout(u,Gd);return()=>clearTimeout(y)},[]),i.current=u,om(jv,{children:[yn(A,{onClose:u}),yn(j,{}),om(Kt,{children:[yn(qv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),yn(_e,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),yn(re,{}),yn(V,{protectedByPrivy:!0})]})};import Kv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Yv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as sm,useRef as Jv,useState as tc}from"react";import Yr from"styled-components";import{Fragment as iw,jsx as ke,jsxs as Qt}from"react/jsx-runtime";var lm=()=>{let[e,t]=tc(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),u=Ce(o)?.address,{onFailure:y,onSuccess:f,origin:g,appId:E}=s.keyExport,v=C=>{a({shouldCallAuthOnSuccess:!1}),y(typeof C=="string"?new Error(C):C)},S=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return sm(()=>{let C=Ce(o);if(!r||!C)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),d.current=S,Qt(iw,{children:[ke(A,{onClose:S}),Qt(Xv,{children:[Qt(_e,{icon:ke(Yv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Qt(ow,{children:[ke(Qv,{style:{marginRight:6}}),Hr(u)]}),ke("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Qt(ew,{children:[Qt(im,{children:[ke(am,{children:"1"}),Qt("span",{children:[ke("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."]})]}),Qt(im,{children:[ke(am,{children:"2"}),ke("span",{children:"Copy this key into your other wallet"})]})]}),ke("div",{style:{width:"100%"},children:e&&ke(Zv,{origin:g,appId:E,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Qt(nw,{children:[Qt("div",{children:[ke(Kv,{viewBox:"0 0 20 18"}),ke("h4",{children:"Warning"})]}),ke("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ke(V,{protectedByPrivy:!0})]})};function Zv(e){let[t,r]=tc(e.dimensions.width),[o,n]=tc(void 0),a=Jv(null);return sm(()=>{if(a.current&&t===void 0){let{width:l}=a.current.getBoundingClientRect();r(l)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),ke("div",{ref:a,children:t&&Qt(tw,{children:[ke("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Qi(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),ke(rw,{children:"Loading..."})]})})}function Qv(e){return ke("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ke("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Xv=Yr.div`
971
971
  display: flex;
@@ -1074,7 +1074,7 @@ Resources:
1074
1074
  flex-direction: column;
1075
1075
  justify-content: center;
1076
1076
  flex-grow: 1;
1077
- `,Zr=Qe(D)`
1077
+ `,Zr=Qe(F)`
1078
1078
  ${e=>e.hideAnimations&&rc`
1079
1079
  && {
1080
1080
  transition: none;
@@ -1285,9 +1285,9 @@ Resources:
1285
1285
 
1286
1286
  ${t}
1287
1287
 
1288
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import $w from"@heroicons/react/24/solid/CheckCircleIcon";import jw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as Kw,jsx as Mr,jsxs as sc}from"react/jsx-runtime";var Im=({error:e,onClose:t})=>sc(Kw,{children:[Mr(A,{closeable:!1}),Mr(j,{}),e?sc(Kt,{children:[Mr(jw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Mr(_e,{title:"Something went wrong",description:e})]}):sc(Kt,{children:[Mr($w,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Mr(_e,{title:"Success"})]}),Mr(D,{onClick:t,children:"Close"}),Mr(re,{}),Mr(V,{protectedByPrivy:!0})]});import{useReducer as Yw}from"react";var Jw=(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}},Mm=()=>{let[e,t]=Yw(Jw,"creating");return{send:t,state:e}};import{jsx as fi}from"react/jsx-runtime";var Qa=({onSubmit:e,...t})=>{let{send:r,state:o}=Mm(),n=Wm(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);Zw(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),Oe)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=Wm(()=>{r("back")},[r]);return o==="creating"?fi(Am,{...t,onSubmit:n}):o==="saving"?fi(Rm,{...t,onSubmit:n,onBack:a}):o==="confirming"?fi(mm,{...t,onSubmit:n,onBack:a}):o==="finalizing"?fi(vm,{...t,onSubmit:n,onBack:a}):o==="done"?fi(Im,{...t,onSubmit:n}):null};import{Fragment as rC,jsx as Ao,jsxs as Om}from"react/jsx-runtime";var Nm=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,a]=hi(""),[i,l]=hi(!1),[s,d]=hi(),[u,y]=hi(null),[f,g]=hi(null),E=Xw(!1),{authenticated:v,getAccessToken:S}=G(),{refreshUser:C,closePrivyModal:P,createAnalyticsEvent:I,isNewUserThisSession:M,initializeWalletProxy:k}=W(),{onSuccess:U,onFailure:F,callAuthOnSuccessOnClose:H}=r.createWallet,T=e?.embeddedWallets.requireUserPasswordOnCreate===!0,q=!!(!n||E.current)&&!T,O=new nt(async()=>ie());Lm(()=>{u||k(3e4).then(ee=>y(ee))},[u]),Lm(()=>{if(!v){t("LANDING"),F(new Error("User must be authenticated before creating a Privy wallet"));return}!T&&!i&&!E.current&&(l(!0),O.execute().finally(()=>l(!1)))},[T,v]);let K=()=>{T&&f&&f?.recoveryMethod!=="user-passcode"?(F(new Ct("User created a wallet but failed to set a password for it")),P({shouldCallAuthOnSuccess:!1})):f?(U(f),P({shouldCallAuthOnSuccess:H})):(F(new Ct("User wallet creation failed")),P({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ie=async function(){let ee=await S();if(ee)try{I("embedded_wallet_creation_started");let z=await k(Fo);if(!z)throw new Error("walletProxy does not exist.");let Pe=1e4,we=new Promise((he,vt)=>{setTimeout(()=>{vt(new Error("walletProxy.create timed out."))},Pe)});if(!await Promise.race([z.create({accessToken:ee,recoveryPassword:s}),we]))throw new Error("walletProxy.create did not send a response.");let gt=await C();if(!gt)throw new Error("Failed to refresh user.");let Ae=Ce(gt);if(!Ae)throw new Error("Updated user is missing embedded wallet.");g(Ae),I("embedded_wallet_creation_completed",{walletAddress:Ae.address}),a(""),E.current=!0,T?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ae&&(U(Ae),P({shouldCallAuthOnSuccess:H}))}catch(z){if(E.current)return;I("embedded_wallet_creation_failed",{error:z.toString()}),a("An error has occurred, please try again."),console.warn(z)}else a("An error has occured, please login again."),I("embedded_wallet_creation_failed",{error:"Missing access token for user."})},te=async()=>{if(!T)return P({shouldCallAuthOnSuccess:H});l(!0);let ee=250;return O.execute().then(()=>new Promise(z=>setTimeout(z,ee))).finally(()=>l(!1))};return!T&&n?Om(rC,{children:[Ao(A,{closeable:!1}),Om(Kt,{children:[Ao(Qw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ao(_e,{title:"Something went wrong",description:n})]}),Ao(D,{onClick:K,children:"Close"}),Ao(tC,{})]}):q?Ao(pn,{}):Ao(Qa,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:q||!u,buttonLoading:i,buttonHideAnimations:!f&&i,error:n,password:s||"",onClose:K,onPasswordChange:d,onPasswordGenerate:()=>d(Za()),onSubmit:te})},tC=eC.div`
1288
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import $w from"@heroicons/react/24/solid/CheckCircleIcon";import jw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as Kw,jsx as Mr,jsxs as sc}from"react/jsx-runtime";var Im=({error:e,onClose:t})=>sc(Kw,{children:[Mr(A,{closeable:!1}),Mr(j,{}),e?sc(Kt,{children:[Mr(jw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Mr(_e,{title:"Something went wrong",description:e})]}):sc(Kt,{children:[Mr($w,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Mr(_e,{title:"Success"})]}),Mr(F,{onClick:t,children:"Close"}),Mr(re,{}),Mr(V,{protectedByPrivy:!0})]});import{useReducer as Yw}from"react";var Jw=(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}},Mm=()=>{let[e,t]=Yw(Jw,"creating");return{send:t,state:e}};import{jsx as fi}from"react/jsx-runtime";var Qa=({onSubmit:e,...t})=>{let{send:r,state:o}=Mm(),n=Wm(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);Zw(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),Oe)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=Wm(()=>{r("back")},[r]);return o==="creating"?fi(Am,{...t,onSubmit:n}):o==="saving"?fi(Rm,{...t,onSubmit:n,onBack:a}):o==="confirming"?fi(mm,{...t,onSubmit:n,onBack:a}):o==="finalizing"?fi(vm,{...t,onSubmit:n,onBack:a}):o==="done"?fi(Im,{...t,onSubmit:n}):null};import{Fragment as rC,jsx as Ao,jsxs as Om}from"react/jsx-runtime";var Nm=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,a]=hi(""),[i,l]=hi(!1),[s,d]=hi(),[u,y]=hi(null),[f,g]=hi(null),E=Xw(!1),{authenticated:v,getAccessToken:S}=G(),{refreshUser:C,closePrivyModal:P,createAnalyticsEvent:R,isNewUserThisSession:M,initializeWalletProxy:k}=W(),{onSuccess:B,onFailure:U,callAuthOnSuccessOnClose:H}=r.createWallet,T=e?.embeddedWallets.requireUserPasswordOnCreate===!0,q=!!(!n||E.current)&&!T,O=new nt(async()=>ae());Lm(()=>{u||k(3e4).then(ee=>y(ee))},[u]),Lm(()=>{if(!v){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!T&&!i&&!E.current&&(l(!0),O.execute().finally(()=>l(!1)))},[T,v]);let K=()=>{T&&f&&f?.recoveryMethod!=="user-passcode"?(U(new Ct("User created a wallet but failed to set a password for it")),P({shouldCallAuthOnSuccess:!1})):f?(B(f),P({shouldCallAuthOnSuccess:H})):(U(new Ct("User wallet creation failed")),P({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ae=async function(){let ee=await S();if(ee)try{R("embedded_wallet_creation_started");let z=await k(Fo);if(!z)throw new Error("walletProxy does not exist.");let Pe=1e4,we=new Promise((ge,vt)=>{setTimeout(()=>{vt(new Error("walletProxy.create timed out."))},Pe)});if(!await Promise.race([z.create({accessToken:ee,recoveryPassword:s}),we]))throw new Error("walletProxy.create did not send a response.");let gt=await C();if(!gt)throw new Error("Failed to refresh user.");let Ae=Ce(gt);if(!Ae)throw new Error("Updated user is missing embedded wallet.");g(Ae),R("embedded_wallet_creation_completed",{walletAddress:Ae.address}),a(""),E.current=!0,T?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ae&&(B(Ae),P({shouldCallAuthOnSuccess:H}))}catch(z){if(E.current)return;R("embedded_wallet_creation_failed",{error:z.toString()}),a("An error has occurred, please try again."),console.warn(z)}else a("An error has occured, please login again."),R("embedded_wallet_creation_failed",{error:"Missing access token for user."})},te=async()=>{if(!T)return P({shouldCallAuthOnSuccess:H});l(!0);let ee=250;return O.execute().then(()=>new Promise(z=>setTimeout(z,ee))).finally(()=>l(!1))};return!T&&n?Om(rC,{children:[Ao(A,{closeable:!1}),Om(Kt,{children:[Ao(Qw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ao(_e,{title:"Something went wrong",description:n})]}),Ao(F,{onClick:K,children:"Close"}),Ao(tC,{})]}):q?Ao(pn,{}):Ao(Qa,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:q||!u,buttonLoading:i,buttonHideAnimations:!f&&i,error:n,password:s||"",onClose:K,onPasswordChange:d,onPasswordGenerate:()=>d(Za()),onSubmit:te})},tC=eC.div`
1289
1289
  height: 44px;
1290
- `;import{useEffect as oC,useState as Xa}from"react";import{jsx as nC}from"react/jsx-runtime";var Dm=()=>{let[e,t]=Xa(null),[r,o]=Xa(!1),[n,a]=Xa(null),[i,l]=Xa(""),{authenticated:s,getAccessToken:d,user:u}=G(),{walletProxy:y,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),{app:v,navigate:S,data:C,onUserCloseViaDialogOrKeybindRef:P}=_(),{onSuccess:I,onFailure:M}=C.createWallet,k=Ce(u),U=e?.recoveryMethod==="user-passcode";oC(()=>{s||(S("LANDING"),M(new Bi("User must be authenticated before setting a password on a Privy wallet")))},[s]);let F=()=>{if(n){M(n),g({shouldCallAuthOnSuccess:!1});return}if(!U){M(new Ct("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}I(e),g({shouldCallAuthOnSuccess:!1})};P.current=F;let H=async()=>{let q=await d();if(q&&k?.address&&i&&y)try{if(E("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await y.setRecoveryPassword({accessToken:q,address:k.address,recoveryPassword:i})).address){a(new Ct("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let K=await f(),ie=Ce(K);if(!ie){a(new Ct("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(ie),E("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(O){console.warn(O),a(O instanceof Error?O:new Error("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:O})}},T=async()=>{U?(I(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await H(),o(!1))};return nC(Qa,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:F},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(Za()),onPasswordChange:l,onSubmit:T,onClose:F})};import iC from"@heroicons/react/24/outline/UserCircleIcon";import aC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as sC,jsx as Wr,jsxs as es}from"react/jsx-runtime";var Fm=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new Ct("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,es(sC,{children:[Wr(A,{onClose:d}),Wr(j,{}),es(Kt,{children:[es(bu,{children:[Wr(iC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Wr(Eu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Wr(aC,{width:"12px",height:"12px",fill:"white"})})]}),es(_e,{title:"Secure Your Account",children:["Please set a password to secure your account.",Wr("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),Wr(D,{onClick:()=>{let y=Ce(e);r("embedded_wallet_set_password_started",{walletAddress:y?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Wr(re,{}),Wr(V,{protectedByPrivy:!0})]})};import lC from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as cC,useState as ts}from"react";import rs,{css as dC}from"styled-components";import{Fragment as hC,jsx as lt,jsxs as ko}from"react/jsx-runtime";var Um=()=>{let[e,t]=ts(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),[u,y]=ts(void 0),[f,g]=ts(""),[E,v]=ts(!1),{privyWallet:S,onCompleteNavigateTo:C,onSuccess:P,onFailure:I}=s.recoverWallet,M=(F="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),I(typeof F=="string"?new Ct(F):F)};d.current=M,cC(()=>{if(!r||!S)return M("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let k=F=>{F&&y(F)};return ko(hC,{children:[lt(A,{onClose:M}),lt(j,{}),ko(uC,{children:[ko(pC,{children:[lt(lC,{height:48,width:48,stroke:"var(--privy-color-accent)"}),lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),ko("div",{children:[ko(Qr,{children:[lt(gn,{type:e?"password":"text",onChange:F=>k(F.target.value),disabled:E,style:{paddingRight:"2.3rem"}}),lt(vn,{style:{right:"0.75rem"},children:e?lt(wn,{onClick:()=>t(!1)}):lt(Cn,{onClick:()=>t(!0)})})]}),!!f&&lt(mC,{children:f})]}),ko("div",{children:[ko(Cu,{children:[lt("h4",{children:"Why is this necessary?"}),lt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),lt(fC,{loading:E||!n,disabled:!u,onClick:async()=>{v(!0);let F=await o();if(F&&S&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:F,recoveryPin:u}),g(""),C?l(C):a({shouldCallAuthOnSuccess:!1}),P?.(S),i("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(H){Xu(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return M("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&E,children:"Recover your account"})]})]}),lt(re,{}),lt(V,{protectedByPrivy:!0})]})},pC=rs.div`
1290
+ `;import{useEffect as oC,useState as Xa}from"react";import{jsx as nC}from"react/jsx-runtime";var Dm=()=>{let[e,t]=Xa(null),[r,o]=Xa(!1),[n,a]=Xa(null),[i,l]=Xa(""),{authenticated:s,getAccessToken:d,user:u}=G(),{walletProxy:y,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),{app:v,navigate:S,data:C,onUserCloseViaDialogOrKeybindRef:P}=_(),{onSuccess:R,onFailure:M}=C.createWallet,k=Ce(u),B=e?.recoveryMethod==="user-passcode";oC(()=>{s||(S("LANDING"),M(new Bi("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){M(n),g({shouldCallAuthOnSuccess:!1});return}if(!B){M(new Ct("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};P.current=U;let H=async()=>{let q=await d();if(q&&k?.address&&i&&y)try{if(E("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await y.setRecoveryPassword({accessToken:q,address:k.address,recoveryPassword:i})).address){a(new Ct("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let K=await f(),ae=Ce(K);if(!ae){a(new Ct("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(ae),E("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(O){console.warn(O),a(O instanceof Error?O:new Error("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:O})}},T=async()=>{B?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await H(),o(!1))};return nC(Qa,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:U},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(Za()),onPasswordChange:l,onSubmit:T,onClose:U})};import iC from"@heroicons/react/24/outline/UserCircleIcon";import aC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as sC,jsx as Wr,jsxs as es}from"react/jsx-runtime";var Fm=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new Ct("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,es(sC,{children:[Wr(A,{onClose:d}),Wr(j,{}),es(Kt,{children:[es(bu,{children:[Wr(iC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Wr(Eu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Wr(aC,{width:"12px",height:"12px",fill:"white"})})]}),es(_e,{title:"Secure Your Account",children:["Please set a password to secure your account.",Wr("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),Wr(F,{onClick:()=>{let y=Ce(e);r("embedded_wallet_set_password_started",{walletAddress:y?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Wr(re,{}),Wr(V,{protectedByPrivy:!0})]})};import lC from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as cC,useState as ts}from"react";import rs,{css as dC}from"styled-components";import{Fragment as hC,jsx as lt,jsxs as ko}from"react/jsx-runtime";var Um=()=>{let[e,t]=ts(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),[u,y]=ts(void 0),[f,g]=ts(""),[E,v]=ts(!1),{privyWallet:S,onCompleteNavigateTo:C,onSuccess:P,onFailure:R}=s.recoverWallet,M=(U="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),R(typeof U=="string"?new Ct(U):U)};d.current=M,cC(()=>{if(!r||!S)return M("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let k=U=>{U&&y(U)};return ko(hC,{children:[lt(A,{onClose:M}),lt(j,{}),ko(uC,{children:[ko(pC,{children:[lt(lC,{height:48,width:48,stroke:"var(--privy-color-accent)"}),lt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),lt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),ko("div",{children:[ko(Qr,{children:[lt(gn,{type:e?"password":"text",onChange:U=>k(U.target.value),disabled:E,style:{paddingRight:"2.3rem"}}),lt(vn,{style:{right:"0.75rem"},children:e?lt(wn,{onClick:()=>t(!1)}):lt(Cn,{onClick:()=>t(!0)})})]}),!!f&&lt(mC,{children:f})]}),ko("div",{children:[ko(Cu,{children:[lt("h4",{children:"Why is this necessary?"}),lt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),lt(fC,{loading:E||!n,disabled:!u,onClick:async()=>{v(!0);let U=await o();if(U&&S&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:U,recoveryPin:u}),g(""),C?l(C):a({shouldCallAuthOnSuccess:!1}),P?.(S),i("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(H){Xu(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return M("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&E,children:"Recover your account"})]})]}),lt(re,{}),lt(V,{protectedByPrivy:!0})]})},pC=rs.div`
1291
1291
  display: flex;
1292
1292
  flex-direction: column;
1293
1293
  align-items: center;
@@ -1320,7 +1320,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1320
1320
  color: var(--privy-color-error);
1321
1321
  text-align: left;
1322
1322
  margin-top: 0.5rem;
1323
- `,fC=rs(D)`
1323
+ `,fC=rs(F)`
1324
1324
  ${e=>e.hideAnimations&&dC`
1325
1325
  && {
1326
1326
  // Remove animations because the recoverWallet task on the iframe partially
@@ -1328,7 +1328,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1328
1328
  transition: none;
1329
1329
  }
1330
1330
  `}
1331
- `;import yC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import gC from"@heroicons/react/24/outline/PhoneIcon";import lc from"styled-components";import{Fragment as EC,jsx as Xt,jsxs as os}from"react/jsx-runtime";var vC=e=>{let t=Xt(yC,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof x)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 fe&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Xt(gC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof $e)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:Xt(Va,{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:Xt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Xt("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 ir&&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}}},Bm=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:a}=ue(),i=r?.errorModalData,l=vC(i?.error||new Error),s=d=>{if(d instanceof $e)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return os(EC,{children:[Xt(A,{backFn:!o||n===o?void 0:t}),os(wC,{children:[Xt(bC,{children:os("div",{children:[Xt(Ga,{color:"var(--privy-color-error)"}),l.icon]})}),os(CC,{children:[Xt("h3",{children:l.title}),Xt("p",{children:l.detail})]}),Xt(D,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},wC=lc.div`
1331
+ `;import yC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import gC from"@heroicons/react/24/outline/PhoneIcon";import lc from"styled-components";import{Fragment as EC,jsx as Xt,jsxs as os}from"react/jsx-runtime";var vC=e=>{let t=Xt(yC,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof x)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 ye&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Xt(gC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof $e)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:Xt(Va,{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:Xt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Xt("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 ir&&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}}},Bm=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:a}=fe(),i=r?.errorModalData,l=vC(i?.error||new Error),s=d=>{if(d instanceof $e)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return os(EC,{children:[Xt(A,{backFn:!o||n===o?void 0:t}),os(wC,{children:[Xt(bC,{children:os("div",{children:[Xt(Ga,{color:"var(--privy-color-error)"}),l.icon]})}),os(CC,{children:[Xt("h3",{children:l.title}),Xt("p",{children:l.detail})]}),Xt(F,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},wC=lc.div`
1332
1332
  display: flex;
1333
1333
  flex-direction: column;
1334
1334
  align-items: center;
@@ -1454,7 +1454,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1454
1454
  border-color: ${e=>e.fgColor};
1455
1455
  border-radius: var(--privy-border-radius-md);
1456
1456
  }
1457
- `,bn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return ct(BC,{size:o,bgColor:t,fgColor:r,children:ct(UC,{url:e.url,logo:{element:e.squareLogoElement??qm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as as,jsxs as HC}from"react/jsx-runtime";var gr=({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:[as("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),as("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"}),as("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"}),as("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 ss,jsx as le,jsxs as vr}from"react/jsx-runtime";var Jm="#8a63d2",Xm=1e3,zC=Xm*2,qC=Xm*120,ef=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=_(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:y,createAnalyticsEvent:f}=W(),[g,E]=pc(void 0),[v,S]=pc(!1),[C,P]=pc(!1),I=GC([]),M=s?.render.inDialog?Oe:0,k=d(),U=k?.meta.connectUri;return Km(()=>{let F=Date.now(),H=setInterval(async()=>{let T=await k.pollForReady.execute(),q=Date.now()-F;if(T){clearInterval(H),S(!0);try{await u(),P(!0)}catch(O){let K={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?K.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(K.retryable=!0,K.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(K.detail="Too many requests. Please wait before trying again.");E(K)}}else q>qC&&(clearInterval(H),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},zC);return()=>{clearInterval(H),I.current.forEach(T=>clearTimeout(T))}},[]),Km(()=>{if(r&&e&&C&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(H)}C&&(kt(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f("embedded_wallet_creation_failure_logout",{error:H,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M)):I.current.push(setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M)))}},[C,r,e,o]),Ym||v?vr(ss,{children:[le(A,{backFn:n?i:void 0,onClose:y},"header"),le(j,{}),VC?le(ss,{children:vr($C,{children:[le(Qm,{children:vr("div",{children:[le(Mt,{success:C,fail:!!g}),le(gr,{style:{width:"38px",height:"38px"}})]})}),vr(Je,{children:[le(me,{children:g?g.message:"Sign in with Farcaster"}),le(se,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),U&&le(D,{onClick:F=>{F.preventDefault(),window.location.href=U},children:"Open Warpcast app"})]})}):le(ss,{children:vr(Zm,{children:[le(Qm,{children:vr("div",{children:[le(Mt,{success:C,fail:!!g}),le(gr,{style:{width:"38px",height:"38px"}})]})}),vr(Je,{children:[le(me,{children:g?g.message:"Signing in with Farcaster"}),le(se,{children:g?g.detail:"This should only take a moment"}),le(st,{children:U&&Ym&&le(is,{text:"Take me to Warpcast",url:U,color:Jm})})]})]})}),le(Q,{})]}):vr(ss,{children:[le(A,{backFn:n?i:void 0,onClose:y},"header"),le(j,{}),le(Zm,{children:vr("div",{children:[le(me,{children:"Sign in with Farcaster"}),le(se,{children:"Scan with your phone's camera to continue."}),le(rn,{children:U?le(bn,{url:U,size:275,squareLogoElement:gr}):le(ht,{})}),vr(st,{children:[le(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),U&&le(eo,{text:U,itemName:"link",color:Jm})]})]})}),le(Q,{})]})},Zm=uc.div`
1457
+ `,bn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return ct(BC,{size:o,bgColor:t,fgColor:r,children:ct(UC,{url:e.url,logo:{element:e.squareLogoElement??qm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as as,jsxs as HC}from"react/jsx-runtime";var gr=({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:[as("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),as("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"}),as("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"}),as("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 ss,jsx as de,jsxs as vr}from"react/jsx-runtime";var Jm="#8a63d2",Xm=1e3,zC=Xm*2,qC=Xm*120,ef=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=_(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:y,createAnalyticsEvent:f}=W(),[g,E]=pc(void 0),[v,S]=pc(!1),[C,P]=pc(!1),R=GC([]),M=s?.render.inDialog?Oe:0,k=d(),B=k?.meta.connectUri;return Km(()=>{let U=Date.now(),H=setInterval(async()=>{let T=await k.pollForReady.execute(),q=Date.now()-U;if(T){clearInterval(H),S(!0);try{await u(),P(!0)}catch(O){let K={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?K.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(K.retryable=!0,K.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(K.detail="Too many requests. Please wait before trying again.");E(K)}}else q>qC&&(clearInterval(H),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},zC);return()=>{clearInterval(H),R.current.forEach(T=>clearTimeout(T))}},[]),Km(()=>{if(r&&e&&C&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(H)}C&&(kt(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f("embedded_wallet_creation_failure_logout",{error:H,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M)):R.current.push(setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M)))}},[C,r,e,o]),Ym||v?vr(ss,{children:[de(A,{backFn:n?i:void 0,onClose:y},"header"),de(j,{}),VC?de(ss,{children:vr($C,{children:[de(Qm,{children:vr("div",{children:[de(Mt,{success:C,fail:!!g}),de(gr,{style:{width:"38px",height:"38px"}})]})}),vr(Je,{children:[de(he,{children:g?g.message:"Sign in with Farcaster"}),de(ce,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),B&&de(F,{onClick:U=>{U.preventDefault(),window.location.href=B},children:"Open Warpcast app"})]})}):de(ss,{children:vr(Zm,{children:[de(Qm,{children:vr("div",{children:[de(Mt,{success:C,fail:!!g}),de(gr,{style:{width:"38px",height:"38px"}})]})}),vr(Je,{children:[de(he,{children:g?g.message:"Signing in with Farcaster"}),de(ce,{children:g?g.detail:"This should only take a moment"}),de(st,{children:B&&Ym&&de(is,{text:"Take me to Warpcast",url:B,color:Jm})})]})]})}),de(Q,{})]}):vr(ss,{children:[de(A,{backFn:n?i:void 0,onClose:y},"header"),de(j,{}),de(Zm,{children:vr("div",{children:[de(he,{children:"Sign in with Farcaster"}),de(ce,{children:"Scan with your phone's camera to continue."}),de(rn,{children:B?de(bn,{url:B,size:275,squareLogoElement:gr}):de(ht,{})}),vr(st,{children:[de(ce,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),B&&de(eo,{text:B,itemName:"link",color:Jm})]})]})}),de(Q,{})]})},Zm=uc.div`
1458
1458
  display: flex;
1459
1459
  flex-direction: column;
1460
1460
  align-items: center;
@@ -1492,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1492
1492
  left: -19px;
1493
1493
  top: -19px;
1494
1494
  }
1495
- `;import{useEffect as jC,useRef as KC,useState as mc}from"react";import{isIOS as YC,isMobile as tf}from"react-device-detect";import fc from"styled-components";import{Fragment as ls,jsx as pe,jsxs as er}from"react/jsx-runtime";var rf="#8a63d2",af=1e3,JC=af*2,ZC=af*300,sf=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=W(),[i,l]=mc(void 0),[s,d]=mc(!1),[u,y]=mc(!1),f=KC([]),g=o?.render.inDialog?Oe:0,E=r?.farcasterSigner;jC(()=>{let S=Date.now(),C=setInterval(async()=>{if(!E?.public_key){clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}E.status==="approved"&&(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let P=await n(E?.public_key),I=Date.now()-S;P.status==="approved"?(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):I>ZC?(clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):P.status==="revoked"&&(clearInterval(C),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},JC);return()=>{clearInterval(C),f.current.forEach(P=>clearTimeout(P))}},[]);let v=E?.status==="pending_approval"?E.signer_approval_url:void 0;return tf||s?er(ls,{children:[pe(A,{backFn:e?t:void 0,onClose:a},"header"),pe(j,{}),YC?pe(ls,{children:er(QC,{children:[pe(nf,{children:er("div",{children:[pe(Mt,{success:u,fail:!!i}),pe(gr,{style:{width:"38px",height:"38px"}})]})}),er(Je,{children:[pe(me,{children:i?i.message:"Add a signer to Farcaster"}),pe(se,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&pe(D,{onClick:S=>{S.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):pe(ls,{children:er(of,{children:[pe(nf,{children:er("div",{children:[pe(Mt,{success:u,fail:!!i}),pe(gr,{style:{width:"38px",height:"38px"}})]})}),er(Je,{children:[pe(me,{children:i?i.message:"Requesting signer from Farcaster"}),pe(se,{children:i?i.detail:"This should only take a moment"}),pe(st,{children:v&&tf&&pe(is,{text:"Take me to Warpcast",url:v,color:rf})})]})]})}),pe(Q,{})]}):er(ls,{children:[pe(A,{backFn:e?t:void 0,onClose:a},"header"),pe(j,{}),pe(of,{children:er("div",{children:[pe(me,{children:"Add a signer to Farcaster"}),er(se,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),pe(rn,{children:E?.status==="pending_approval"?pe(bn,{url:E.signer_approval_url,size:275,squareLogoElement:gr}):pe(ht,{})}),er(st,{children:[pe(se,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),E?.status==="pending_approval"&&pe(eo,{text:E.signer_approval_url,itemName:"link",color:rf})]})]})}),pe(Q,{})]})},of=fc.div`
1495
+ `;import{useEffect as jC,useRef as KC,useState as mc}from"react";import{isIOS as YC,isMobile as tf}from"react-device-detect";import fc from"styled-components";import{Fragment as ls,jsx as me,jsxs as er}from"react/jsx-runtime";var rf="#8a63d2",af=1e3,JC=af*2,ZC=af*300,sf=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=W(),[i,l]=mc(void 0),[s,d]=mc(!1),[u,y]=mc(!1),f=KC([]),g=o?.render.inDialog?Oe:0,E=r?.farcasterSigner;jC(()=>{let S=Date.now(),C=setInterval(async()=>{if(!E?.public_key){clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}E.status==="approved"&&(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let P=await n(E?.public_key),R=Date.now()-S;P.status==="approved"?(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):R>ZC?(clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):P.status==="revoked"&&(clearInterval(C),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},JC);return()=>{clearInterval(C),f.current.forEach(P=>clearTimeout(P))}},[]);let v=E?.status==="pending_approval"?E.signer_approval_url:void 0;return tf||s?er(ls,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(j,{}),YC?me(ls,{children:er(QC,{children:[me(nf,{children:er("div",{children:[me(Mt,{success:u,fail:!!i}),me(gr,{style:{width:"38px",height:"38px"}})]})}),er(Je,{children:[me(he,{children:i?i.message:"Add a signer to Farcaster"}),me(ce,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&me(F,{onClick:S=>{S.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):me(ls,{children:er(of,{children:[me(nf,{children:er("div",{children:[me(Mt,{success:u,fail:!!i}),me(gr,{style:{width:"38px",height:"38px"}})]})}),er(Je,{children:[me(he,{children:i?i.message:"Requesting signer from Farcaster"}),me(ce,{children:i?i.detail:"This should only take a moment"}),me(st,{children:v&&tf&&me(is,{text:"Take me to Warpcast",url:v,color:rf})})]})]})}),me(Q,{})]}):er(ls,{children:[me(A,{backFn:e?t:void 0,onClose:a},"header"),me(j,{}),me(of,{children:er("div",{children:[me(he,{children:"Add a signer to Farcaster"}),er(ce,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),me(rn,{children:E?.status==="pending_approval"?me(bn,{url:E.signer_approval_url,size:275,squareLogoElement:gr}):me(ht,{})}),er(st,{children:[me(ce,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),E?.status==="pending_approval"&&me(eo,{text:E.signer_approval_url,itemName:"link",color:rf})]})]})}),me(Q,{})]})},of=fc.div`
1496
1496
  display: flex;
1497
1497
  flex-direction: column;
1498
1498
  align-items: center;
@@ -1586,7 +1586,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1586
1586
  margin: 0 0.5rem;
1587
1587
  `,u0=wr.div`
1588
1588
  margin: 30px 0;
1589
- `;import{ofetch as m0}from"ofetch";import{useEffect as f0,useRef as h0,useState as y0}from"react";var ds="moonpay",df="sdk_fiat_on_ramp_completed_with_status";async function pf(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function g0(e,t){let r=t?zd:Vd,o=t?$d:qd;return m0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function uf(e,t=!1){let[r,o]=y0(null),{createAnalyticsEvent:n}=W(),a=h0(0);return f0(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await g0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(df,{status:s,provider:ds,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(i))}catch(l){l.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n(df,{status:"serviceFailure",provider:ds}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as v0,jsx as gc,jsxs as w0}from"react/jsx-runtime";var mf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:w0(v0,{children:[gc(A,{title:"Fund account"},"header"),gc(cf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:ds}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),gc(V,{protectedByPrivy:!0})]})};import C0 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import b0 from"@heroicons/react/24/solid/CheckCircleIcon";import E0 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as T0}from"react";import ff from"styled-components";import{Fragment as vc,jsx as pt,jsxs as Io}from"react/jsx-runtime";var hf=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=uf(o||null,e.fiatOnRamp.useSandbox);return Io(vc,{children:[pt(A,{title:"Fund account"},"header"),pt(S0,{status:n,onClickCta:r}),pt(V,{protectedByPrivy:!0})]})},P0=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:Io(vc,{children:[Io("p",{children:["It looks like there was an issue with your payment. Please contact"," ",pt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),pt("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:""}}},S0=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=T0(()=>P0(e),[e]);return Io(vc,{children:[Io(R0,{children:[pt(A0,{status:e}),Io(Je,{children:[pt("h3",{children:r}),pt(k0,{children:o})]})]}),n&&pt(D,{onClick:t,children:n})]})},x0=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)",_0=e=>{switch(e){case"serviceFailure":case"failed":return E0;case"completed":return b0;case"waitingAuthorization":return()=>pt(C0,{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}},A0=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Io("div",{style:{position:"relative"},children:[pt(ht,{color:o,style:{position:"absolute"}}),pt(Al,{color:o}),pt(cs,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=_0(e),r=x0(e);return pt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&pt(t,{width:"4rem",height:"4rem",color:r})})},k0=ff.p`
1589
+ `;import{ofetch as m0}from"ofetch";import{useEffect as f0,useRef as h0,useState as y0}from"react";var ds="moonpay",df="sdk_fiat_on_ramp_completed_with_status";async function pf(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function g0(e,t){let r=t?zd:Vd,o=t?$d:qd;return m0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function uf(e,t=!1){let[r,o]=y0(null),{createAnalyticsEvent:n}=W(),a=h0(0);return f0(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await g0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(df,{status:s,provider:ds,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(i))}catch(l){l.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n(df,{status:"serviceFailure",provider:ds}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as v0,jsx as gc,jsxs as w0}from"react/jsx-runtime";var mf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:w0(v0,{children:[gc(A,{title:"Fund account"},"header"),gc(cf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:ds}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),gc(V,{protectedByPrivy:!0})]})};import C0 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import b0 from"@heroicons/react/24/solid/CheckCircleIcon";import E0 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as T0}from"react";import ff from"styled-components";import{Fragment as vc,jsx as pt,jsxs as Io}from"react/jsx-runtime";var hf=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=uf(o||null,e.fiatOnRamp.useSandbox);return Io(vc,{children:[pt(A,{title:"Fund account"},"header"),pt(S0,{status:n,onClickCta:r}),pt(V,{protectedByPrivy:!0})]})},P0=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:Io(vc,{children:[Io("p",{children:["It looks like there was an issue with your payment. Please contact"," ",pt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),pt("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:""}}},S0=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=T0(()=>P0(e),[e]);return Io(vc,{children:[Io(R0,{children:[pt(A0,{status:e}),Io(Je,{children:[pt("h3",{children:r}),pt(k0,{children:o})]})]}),n&&pt(F,{onClick:t,children:n})]})},x0=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)",_0=e=>{switch(e){case"serviceFailure":case"failed":return E0;case"completed":return b0;case"waitingAuthorization":return()=>pt(C0,{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}},A0=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Io("div",{style:{position:"relative"},children:[pt(ht,{color:o,style:{position:"absolute"}}),pt(Al,{color:o}),pt(cs,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=_0(e),r=x0(e);return pt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&pt(t,{width:"4rem",height:"4rem",color:r})})},k0=ff.p`
1590
1590
  font-size: 1rem;
1591
1591
  color: var(--privy-color-foreground-3);
1592
1592
  margin-bottom: 1rem;
@@ -1601,7 +1601,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1601
1601
  margin-left: 1.75rem;
1602
1602
  margin-right: 1.75rem;
1603
1603
  padding: 2rem 0;
1604
- `;import I0 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import M0 from"styled-components";import{Fragment as L0,jsx as to,jsxs as O0}from"react/jsx-runtime";var yf=()=>{let{closePrivyModal:e}=W();return O0(L0,{children:[to(A,{},"header"),to(W0,{children:to(I0,{style:{width:32,height:32}})}),to(fr,{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"}}),to(Nt,{children:to(D,{onClick:()=>e(),children:"Close"})}),to(re,{}),to(V,{protectedByPrivy:!0})]})},W0=M0.div`
1604
+ `;import I0 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import M0 from"styled-components";import{Fragment as L0,jsx as to,jsxs as O0}from"react/jsx-runtime";var yf=()=>{let{closePrivyModal:e}=W();return O0(L0,{children:[to(A,{},"header"),to(W0,{children:to(I0,{style:{width:32,height:32}})}),to(fr,{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"}}),to(Nt,{children:to(F,{onClick:()=>e(),children:"Close"})}),to(re,{}),to(V,{protectedByPrivy:!0})]})},W0=M0.div`
1605
1605
  border-radius: 50%;
1606
1606
  height: 68px;
1607
1607
  width: 68px;
@@ -1646,7 +1646,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1646
1646
  > :first-child > svg {
1647
1647
  margin-top: 20px;
1648
1648
  }
1649
- `;import P2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as S2,useState as Ff}from"react";import{isMobile as x2}from"react-device-detect";import _2 from"styled-components";import K0 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as Y0}from"react";import V0 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as z0,useState as Ef}from"react";import Pf from"styled-components";import{Fragment as j0,jsx as vi,jsxs as Tf}from"react/jsx-runtime";var us=z0((e,t)=>{let[r,o]=Ef(""),[n,a]=Ef(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:d,currentScreen:u}=_(),{enabled:y,token:f}=ue(),g=Zi(r),E=n,v=n||!g,S=P=>{a(!0),l(r,P).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{d({errorModalData:{error:I,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},C=()=>{y&&!f&&!i?(d({captchaModalData:{callback:P=>l(r,P),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(f)};return Tf(j0,{children:[vi(q0,{children:Tf($0,{stacked:e.stacked,children:[vi(V0,{}),vi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:P=>o(P.target.value),onKeyUp:P=>{P.key==="Enter"&&C()},value:r,autoComplete:"email"}),e.stacked?null:vi(Qo,{isSubmitting:E,onClick:C,disabled:v,children:"Submit"})]})}),e.stacked?vi(D,{loadingText:null,loading:E,disabled:v,onClick:C,children:"Submit"}):null]})}),q0=Pf.div`
1649
+ `;import P2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as S2,useState as Ff}from"react";import{isMobile as x2}from"react-device-detect";import _2 from"styled-components";import K0 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as Y0}from"react";import V0 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as z0,useState as Ef}from"react";import Pf from"styled-components";import{Fragment as j0,jsx as vi,jsxs as Tf}from"react/jsx-runtime";var us=z0((e,t)=>{let[r,o]=Ef(""),[n,a]=Ef(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:d,currentScreen:u}=_(),{enabled:y,token:f}=fe(),g=Zi(r),E=n,v=n||!g,S=P=>{a(!0),l(r,P).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{d({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},C=()=>{y&&!f&&!i?(d({captchaModalData:{callback:P=>l(r,P),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(f)};return Tf(j0,{children:[vi(q0,{children:Tf($0,{stacked:e.stacked,children:[vi(V0,{}),vi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:P=>o(P.target.value),onKeyUp:P=>{P.key==="Enter"&&C()},value:r,autoComplete:"email"}),e.stacked?null:vi(Qo,{isSubmitting:E,onClick:C,disabled:v,children:"Submit"})]})}),e.stacked?vi(F,{loadingText:null,loading:E,disabled:v,onClick:C,children:"Submit"}):null]})}),q0=Pf.div`
1650
1650
  width: 100%;
1651
1651
  `,$0=Pf.label`
1652
1652
  display: block;
@@ -1711,7 +1711,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1711
1711
  && > input::placeholder {
1712
1712
  color: var(--privy-color-foreground-3);
1713
1713
  }
1714
- `;import{Fragment as J0,jsx as ms,jsxs as Sf}from"react/jsx-runtime";var fs=({isEditable:e,setIsEditable:t})=>{let r=Y0(null);return Sf(J0,{children:[ms(kr,{if:!e,children:ms(us,{ref:r})}),ms(kr,{if:e,children:Sf(xe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[ms(K0,{})," Continue with Email"]})})]})};import{useState as Z0}from"react";import{jsx as bc,jsxs as Q0}from"react/jsx-runtime";var hs=()=>{let[e,t]=Z0(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=ue(),{initLoginWithFarcaster:l}=W();return Q0(xe,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[bc(gr,{})," Farcaster",e&&bc("span",{children:bc(Eo,{})})]})};import p2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as u2}from"react";import{forwardRef as s2,useState as Ec}from"react";import If from"styled-components";import X0 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as e2,AsYouType as t2,getCountries as r2,getCountryCallingCode as ys,getExampleNumber as o2}from"libphonenumber-js/min";import{jsx as a2,jsxs as i2}from"react/jsx-runtime";var wi=(e,t)=>e2(String(e),t),gs=(e,t)=>`+${ys(t)} ${e}`,xf=e=>`*${e.replaceAll("-","").slice(-4)}`,_f=e=>new t2(e),n2=r2().map(e=>({code:e,callCode:ys(e)})),Af=e=>{let t=o2(e,X0)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},kf=({value:e,onChange:t})=>a2("select",{value:e,onChange:t,children:n2.map(r=>i2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as d2,jsx as Ci,jsxs as Rf}from"react/jsx-runtime";var En=s2((e,t)=>{let{app:r}=_(),[o,n]=Ec(""),[a,i]=Ec(r?.intl.defaultCountry??"US"),l=wi(o,a),s=_f(a),d=Af(a),u=ys(a),y=!l,[f,g]=Ec(!1),E=u.length,v=P=>{let I=P.target.value;i(I),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:gs(o,I),countryCode:I,isValid:wi(o,a)})},S=P=>{try{let I=P.replace(/\D/g,""),M=o.replace(/\D/g,""),k=I===M?P:s.input(P);n(k),e.onChange&&e.onChange({rawPhoneNumber:k,qualifiedPhoneNumber:gs(P,a),countryCode:a,isValid:wi(P,a)})}catch(I){console.error("Error processing phone number:",I)}},C=()=>{g(!0);let P=gs(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:P,countryCode:a,isValid:wi(o,a)}).finally(()=>g(!1))};return Rf(d2,{children:[Ci(l2,{children:Rf(c2,{callingCodeLength:E,stacked:e.stacked,children:[Ci(kf,{value:a,onChange:v}),Ci("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:P=>{S(P.target.value)},onKeyUp:P=>{P.key==="Enter"&&C()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?Ci(Qo,{isSubmitting:f,onClick:C,disabled:y,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?Ci(D,{loading:f,loadingText:null,onClick:C,disabled:y,children:"Submit"}):null]})}),l2=If.div`
1714
+ `;import{Fragment as J0,jsx as ms,jsxs as Sf}from"react/jsx-runtime";var fs=({isEditable:e,setIsEditable:t})=>{let r=Y0(null);return Sf(J0,{children:[ms(kr,{if:!e,children:ms(us,{ref:r})}),ms(kr,{if:e,children:Sf(xe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[ms(K0,{})," Continue with Email"]})})]})};import{useState as Z0}from"react";import{jsx as bc,jsxs as Q0}from"react/jsx-runtime";var hs=()=>{let[e,t]=Z0(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=fe(),{initLoginWithFarcaster:l}=W();return Q0(xe,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[bc(gr,{})," Farcaster",e&&bc("span",{children:bc(Eo,{})})]})};import p2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as u2}from"react";import{forwardRef as s2,useState as Ec}from"react";import If from"styled-components";import X0 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as e2,AsYouType as t2,getCountries as r2,getCountryCallingCode as ys,getExampleNumber as o2}from"libphonenumber-js/min";import{jsx as a2,jsxs as i2}from"react/jsx-runtime";var wi=(e,t)=>e2(String(e),t),gs=(e,t)=>`+${ys(t)} ${e}`,xf=e=>`*${e.replaceAll("-","").slice(-4)}`,_f=e=>new t2(e),n2=r2().map(e=>({code:e,callCode:ys(e)})),Af=e=>{let t=o2(e,X0)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},kf=({value:e,onChange:t})=>a2("select",{value:e,onChange:t,children:n2.map(r=>i2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as d2,jsx as Ci,jsxs as Rf}from"react/jsx-runtime";var En=s2((e,t)=>{let{app:r}=_(),[o,n]=Ec(""),[a,i]=Ec(r?.intl.defaultCountry??"US"),l=wi(o,a),s=_f(a),d=Af(a),u=ys(a),y=!l,[f,g]=Ec(!1),E=u.length,v=P=>{let R=P.target.value;i(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:gs(o,R),countryCode:R,isValid:wi(o,a)})},S=P=>{try{let R=P.replace(/\D/g,""),M=o.replace(/\D/g,""),k=R===M?P:s.input(P);n(k),e.onChange&&e.onChange({rawPhoneNumber:k,qualifiedPhoneNumber:gs(P,a),countryCode:a,isValid:wi(P,a)})}catch(R){console.error("Error processing phone number:",R)}},C=()=>{g(!0);let P=gs(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:P,countryCode:a,isValid:wi(o,a)}).finally(()=>g(!1))};return Rf(d2,{children:[Ci(l2,{children:Rf(c2,{callingCodeLength:E,stacked:e.stacked,children:[Ci(kf,{value:a,onChange:v}),Ci("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:P=>{S(P.target.value)},onKeyUp:P=>{P.key==="Enter"&&C()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?Ci(Qo,{isSubmitting:f,onClick:C,disabled:y,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?Ci(F,{loading:f,loadingText:null,onClick:C,disabled:y,children:"Submit"}):null]})}),l2=If.div`
1715
1715
  width: 100%;
1716
1716
  `,c2=If.label`
1717
1717
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
@@ -1804,11 +1804,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1804
1804
  && > input::placeholder {
1805
1805
  color: var(--privy-color-foreground-3);
1806
1806
  }
1807
- `;import{Fragment as m2,jsx as vs,jsxs as Mf}from"react/jsx-runtime";var ws=({isEditable:e,setIsEditable:t})=>{let r=u2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=ue();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Mf(m2,{children:[vs(kr,{if:!e,children:vs(En,{ref:r,onSubmit:u})}),vs(kr,{if:e,children:Mf(xe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[vs(p2,{})," Continue with SMS"]})})]})};import{useState as w2}from"react";import{jsx as Wf,jsxs as f2}from"react/jsx-runtime";var Cs=({style:e,...t})=>f2("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:[Wf("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"}),Wf("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 bi,jsxs as h2}from"react/jsx-runtime";var bs=({style:e,...t})=>h2("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:[bi("g",{clipPath:"url(#clip0)",children:bi("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"})}),bi("defs",{children:bi("clipPath",{id:"clip0",children:bi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Lf}from"react/jsx-runtime";var Es=({style:e,...t})=>Lf("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:Lf("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 Ts,jsxs as y2}from"react/jsx-runtime";var Ps=({style:e,...t})=>y2("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ts("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ts("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ts("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ts("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Ss}from"react/jsx-runtime";function xs({style:e,...t}){return Ss("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:Ss("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ss("g",{transform:"scale(5.12,5.12)",children:Ss("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 Of,jsxs as g2}from"react/jsx-runtime";function _s(e){return g2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Of("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"}),Of("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 Tc,jsxs as v2}from"react/jsx-runtime";function As(e){return v2("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:[Tc("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"}),Tc("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"}),Tc("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 Nf}from"react/jsx-runtime";var ks=({style:e,...t})=>Nf("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:Nf("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"})});import{jsx as ro,jsxs as b2}from"react/jsx-runtime";var C2={apple:{logo:ro(Cs,{}),displayName:"Apple"},discord:{logo:ro(bs,{}),displayName:"Discord"},github:{logo:ro(Es,{}),displayName:"GitHub"},google:{logo:ro(Ps,{}),displayName:"Google"},linkedin:{logo:ro(xs,{}),displayName:"LinkedIn"},spotify:{logo:ro(_s,{}),displayName:"Spotify"},twitter:{logo:ro(ks,{}),displayName:"Twitter"},tiktok:{logo:ro(As,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=ue(),{navigate:o,setModalData:n}=_(),[a,i]=w2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=C2[e];return b2(xe,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import E2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Df,jsxs as T2}from"react/jsx-runtime";var Rs=({onClick:e,text:t,icon:r})=>T2(xe,{onClick:e,children:[r,Df(Na,{children:t}),Df(E2,{})]});import{Fragment as Pc,jsx as He,jsxs as Ms}from"react/jsx-runtime";var Ws=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Ff("default"),[u,y]=Ff("email");S2(()=>{let k=l.indexOf("sms"),U=l.indexOf("email");k>-1&&k<U&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(fs,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(ws,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(hs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!x2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ai([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),S=[...E,...v],C=A2({primary:E.length,overflow:v.length}),[P,I]=Yd(S,C);return Ms(Pc,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(k2,{}),He(Da,{style:{overflow:"hidden",padding:2},children:Ms(Ot,{children:[s==="default"&&Ms(Pc,{children:[...P,I.length>0&&He(Rs,{text:"More options",icon:He(P2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Ms(Pc,{children:[...I]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Is=5,A2=({primary:e,overflow:t})=>e<Is?e:e===Is&&t===0?Is:Is-1,k2=_2(cn)`
1807
+ `;import{Fragment as m2,jsx as vs,jsxs as Mf}from"react/jsx-runtime";var ws=({isEditable:e,setIsEditable:t})=>{let r=u2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Mf(m2,{children:[vs(kr,{if:!e,children:vs(En,{ref:r,onSubmit:u})}),vs(kr,{if:e,children:Mf(xe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[vs(p2,{})," Continue with SMS"]})})]})};import{useState as w2}from"react";import{jsx as Wf,jsxs as f2}from"react/jsx-runtime";var Cs=({style:e,...t})=>f2("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:[Wf("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"}),Wf("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 bi,jsxs as h2}from"react/jsx-runtime";var bs=({style:e,...t})=>h2("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:[bi("g",{clipPath:"url(#clip0)",children:bi("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"})}),bi("defs",{children:bi("clipPath",{id:"clip0",children:bi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Lf}from"react/jsx-runtime";var Es=({style:e,...t})=>Lf("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:Lf("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 Ts,jsxs as y2}from"react/jsx-runtime";var Ps=({style:e,...t})=>y2("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ts("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ts("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ts("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ts("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Ss}from"react/jsx-runtime";function xs({style:e,...t}){return Ss("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:Ss("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ss("g",{transform:"scale(5.12,5.12)",children:Ss("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 Of,jsxs as g2}from"react/jsx-runtime";function _s(e){return g2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Of("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"}),Of("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 Tc,jsxs as v2}from"react/jsx-runtime";function As(e){return v2("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:[Tc("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"}),Tc("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"}),Tc("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 Nf}from"react/jsx-runtime";var ks=({style:e,...t})=>Nf("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:Nf("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"})});import{jsx as ro,jsxs as b2}from"react/jsx-runtime";var C2={apple:{logo:ro(Cs,{}),displayName:"Apple"},discord:{logo:ro(bs,{}),displayName:"Discord"},github:{logo:ro(Es,{}),displayName:"GitHub"},google:{logo:ro(Ps,{}),displayName:"Google"},linkedin:{logo:ro(xs,{}),displayName:"LinkedIn"},spotify:{logo:ro(_s,{}),displayName:"Spotify"},twitter:{logo:ro(ks,{}),displayName:"Twitter"},tiktok:{logo:ro(As,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[a,i]=w2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=C2[e];return b2(xe,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import E2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Df,jsxs as T2}from"react/jsx-runtime";var Rs=({onClick:e,text:t,icon:r})=>T2(xe,{onClick:e,children:[r,Df(Na,{children:t}),Df(E2,{})]});import{Fragment as Pc,jsx as He,jsxs as Ms}from"react/jsx-runtime";var Ws=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Ff("default"),[u,y]=Ff("email");S2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(fs,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(ws,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(hs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!x2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ai([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),S=[...E,...v],C=A2({primary:E.length,overflow:v.length}),[P,R]=Yd(S,C);return Ms(Pc,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(k2,{}),He(Da,{style:{overflow:"hidden",padding:2},children:Ms(Ot,{children:[s==="default"&&Ms(Pc,{children:[...P,R.length>0&&He(Rs,{text:"More options",icon:He(P2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Ms(Pc,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Is=5,A2=({primary:e,overflow:t})=>e<Is?e:e===Is&&t===0?Is:Is-1,k2=_2(cn)`
1808
1808
  margin-bottom: 16px;
1809
- `;import W2 from"@heroicons/react/24/outline/EnvelopeIcon";import L2 from"@heroicons/react/24/outline/PhoneIcon";import O2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as N2,useState as Gf}from"react";import{isMobile as D2}from"react-device-detect";import F2 from"styled-components";import{jsx as Ei,jsxs as Uf}from"react/jsx-runtime";var Bf=({...e})=>Uf("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Uf("g",{clipPath:"url(#clip0_2856_1743)",children:[Ei("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"}),Ei("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"})]}),Ei("defs",{children:Ei("clipPath",{id:"clip0_2856_1743",children:Ei("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import R2 from"@heroicons/react/24/outline/ChevronRightIcon";import I2 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Sc,jsxs as M2}from"react/jsx-runtime";var Hf=({onClick:e,text:t})=>M2(xe,{onClick:e,children:[Sc(I2,{}),Sc(Na,{children:t}),Sc(R2,{})]});import{Fragment as Ti,jsx as Te,jsxs as Tn}from"react/jsx-runtime";var Ls=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:y,tiktok:f,linkedin:g,apple:E,wallet:v,farcaster:S}=o?.loginMethods??{},C=o?.appearance.loginGroupPriority||"web2-first",P=o?.appearance.hideDirectWeb2Inputs,[I,M]=Gf("default"),[k,U]=Gf(a?"email":"sms");N2(()=>{U(a?"email":"sms")},[a]);let F=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=F;let H=[a&&Te(fs,{isEditable:k==="email",setIsEditable:()=>{U("email")}}),i&&Te(ws,{isEditable:k==="sms",setIsEditable:()=>{U("sms")}})].filter(Boolean),T=[l&&Te(Be,{provider:"google"}),s&&(!D2||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Te(Be,{provider:"twitter"}),d&&Te(Be,{provider:"discord"}),u&&Te(Be,{provider:"github"}),y&&Te(Be,{provider:"spotify"}),f&&Te(Be,{provider:"tiktok"}),g&&Te(Be,{provider:"linkedin"}),E&&Te(Be,{provider:"apple"}),S&&Te(hs,{})].filter(Boolean),q=ai(o.appearance.walletList,r,e,o.appearance.walletList),O=I==="default"?void 0:()=>{M("default")},K=B2({priority:C,email:a,sms:i,social:T}),ie=H2({priority:C,email:a,sms:i,social:T}),te=G2({priority:C,email:a,sms:i,social:T}),ee=Te(Hf,{text:te,onClick:()=>M("web3-overflow")}),z=Te(Rs,{text:K,icon:ie,onClick:()=>M("web2-overflow")}),Pe=P?0:1;return Tn(Ti,{children:[Te(A,{title:"Log in or sign up",onClose:F,backFn:O}),I==="default"&&Te(U2,{}),Te(Da,{style:{overflow:"hidden",padding:2},children:Tn(Ot,{children:[I==="default"&&C==="web2-first"&&Tn(Ti,{children:[...H,...T.length+H.length>4?T.slice(0,3-H.length):T,H.length+T.length>4&&z,v&&ee]}),I==="default"&&C==="web3-first"&&Tn(Ti,{children:[v&&Tn(Ti,{children:[...q.length>4?q.slice(0,3):q,q.length>4&&ee]}),H.length+T.length>Pe&&z,H.length+T.length===Pe&&H.length?H[0]:null,H.length+T.length===Pe&&T.length?T[0]:null]}),I==="web2-overflow"&&Tn(Ti,{children:[...C==="web3-first"?H:[],...T]}),...I==="web3-overflow"?q:[]]})}),o&&Te(Xo,{app:o}),Te(V,{protectedByPrivy:!0})]})},U2=F2(cn)`
1809
+ `;import W2 from"@heroicons/react/24/outline/EnvelopeIcon";import L2 from"@heroicons/react/24/outline/PhoneIcon";import O2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as N2,useState as Gf}from"react";import{isMobile as D2}from"react-device-detect";import F2 from"styled-components";import{jsx as Ei,jsxs as Uf}from"react/jsx-runtime";var Bf=({...e})=>Uf("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Uf("g",{clipPath:"url(#clip0_2856_1743)",children:[Ei("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"}),Ei("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"})]}),Ei("defs",{children:Ei("clipPath",{id:"clip0_2856_1743",children:Ei("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import R2 from"@heroicons/react/24/outline/ChevronRightIcon";import I2 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Sc,jsxs as M2}from"react/jsx-runtime";var Hf=({onClick:e,text:t})=>M2(xe,{onClick:e,children:[Sc(I2,{}),Sc(Na,{children:t}),Sc(R2,{})]});import{Fragment as Ti,jsx as Te,jsxs as Tn}from"react/jsx-runtime";var Ls=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:y,tiktok:f,linkedin:g,apple:E,wallet:v,farcaster:S}=o?.loginMethods??{},C=o?.appearance.loginGroupPriority||"web2-first",P=o?.appearance.hideDirectWeb2Inputs,[R,M]=Gf("default"),[k,B]=Gf(a?"email":"sms");N2(()=>{B(a?"email":"sms")},[a]);let U=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=U;let H=[a&&Te(fs,{isEditable:k==="email",setIsEditable:()=>{B("email")}}),i&&Te(ws,{isEditable:k==="sms",setIsEditable:()=>{B("sms")}})].filter(Boolean),T=[l&&Te(Be,{provider:"google"}),s&&(!D2||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Te(Be,{provider:"twitter"}),d&&Te(Be,{provider:"discord"}),u&&Te(Be,{provider:"github"}),y&&Te(Be,{provider:"spotify"}),f&&Te(Be,{provider:"tiktok"}),g&&Te(Be,{provider:"linkedin"}),E&&Te(Be,{provider:"apple"}),S&&Te(hs,{})].filter(Boolean),q=ai(o.appearance.walletList,r,e,o.appearance.walletList),O=R==="default"?void 0:()=>{M("default")},K=B2({priority:C,email:a,sms:i,social:T}),ae=H2({priority:C,email:a,sms:i,social:T}),te=G2({priority:C,email:a,sms:i,social:T}),ee=Te(Hf,{text:te,onClick:()=>M("web3-overflow")}),z=Te(Rs,{text:K,icon:ae,onClick:()=>M("web2-overflow")}),Pe=P?0:1;return Tn(Ti,{children:[Te(A,{title:"Log in or sign up",onClose:U,backFn:O}),R==="default"&&Te(U2,{}),Te(Da,{style:{overflow:"hidden",padding:2},children:Tn(Ot,{children:[R==="default"&&C==="web2-first"&&Tn(Ti,{children:[...H,...T.length+H.length>4?T.slice(0,3-H.length):T,H.length+T.length>4&&z,v&&ee]}),R==="default"&&C==="web3-first"&&Tn(Ti,{children:[v&&Tn(Ti,{children:[...q.length>4?q.slice(0,3):q,q.length>4&&ee]}),H.length+T.length>Pe&&z,H.length+T.length===Pe&&H.length?H[0]:null,H.length+T.length===Pe&&T.length?T[0]:null]}),R==="web2-overflow"&&Tn(Ti,{children:[...C==="web3-first"?H:[],...T]}),...R==="web3-overflow"?q:[]]})}),o&&Te(Xo,{app:o}),Te(V,{protectedByPrivy:!0})]})},U2=F2(cn)`
1810
1810
  margin-bottom: 16px;
1811
- `,B2=({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",H2=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Te(O2,{}):t&&r?Te(Bf,{}):t?Te(W2,{}):r?Te(L2,{}):null,G2=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Vf}from"react/jsx-runtime";var zf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Vf(Ws,{connectOnly:!0}):Vf(Ls,{connectOnly:!0})};import{jsx as qf}from"react/jsx-runtime";var $f=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?qf(Ws,{connectOnly:!1}):qf(Ls,{connectOnly:!1})};import V2 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as z2,jsx as oo,jsxs as q2}from"react/jsx-runtime";var jf=()=>{let{app:e}=_();return q2(z2,{children:[oo(A,{},"header"),oo(j,{}),oo(_e,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:oo(V2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),oo(Nt,{children:oo(us,{stacked:!0})}),oo(re,{}),oo(V,{protectedByPrivy:!0})]})};import $2 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as j2,jsx as no,jsxs as K2}from"react/jsx-runtime";var Kf=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:a}=W();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return K2(j2,{children:[no(A,{},"header"),no(j,{}),no(_e,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:no($2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),no(Nt,{children:no(En,{stacked:!0,onSubmit:i})}),no(re,{}),no(V,{protectedByPrivy:!0})]})};import{Fragment as Y2,jsx as Pi,jsxs as J2}from"react/jsx-runtime";var Yf=()=>{let{linkingHint:e}=W(),{app:t}=_(),r=e?`Select the wallet with ${Hr(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return J2(Y2,{children:[Pi(A,{},"header"),Pi(fr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Pi(Ot,{children:Pi(ln,{connectOnly:!1})}),Pi(V,{protectedByPrivy:!0})]})};import{jsx as Jf,jsxs as Z2}from"react/jsx-runtime";var Zf=({style:e,...t})=>Z2("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:[Jf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Jf("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 Q2,jsx as io,jsxs as Qf}from"react/jsx-runtime";var Xf=()=>{let{closePrivyModal:e}=W(),{navigate:t}=_();return Qf(Q2,{children:[io(A,{},"header"),io(j,{}),io(Zf,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),io(fr,{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"}}),Qf(Nt,{children:[io(D,{onClick:()=>t("LANDING"),children:"Try again"}),io(jt,{onClick:()=>e(),children:"Cancel"})]}),io(re,{}),io(V,{protectedByPrivy:!0})]})};import lh from"@heroicons/react/20/solid/CheckIcon";import w3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import C3 from"@heroicons/react/24/outline/FingerPrintIcon";import b3 from"@heroicons/react/24/outline/PhoneIcon";import ch from"@heroicons/react/24/outline/TrashIcon";import E3 from"@heroicons/react/24/solid/CheckBadgeIcon";import dh from"@heroicons/react/24/solid/CheckCircleIcon";import ph from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import T3 from"@heroicons/react/24/solid/IdentificationIcon";import Ic from"@heroicons/react/24/solid/PhoneIcon";import Rc from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as uh,useState as Lr}from"react";import{useState as Ac}from"react";import{isMobile as n3}from"react-device-detect";import nh from"styled-components";import{Dialog as eh,Transition as xc}from"@headlessui/react";import _c from"react";import Sn from"styled-components";import{jsx as Pn,jsxs as o3}from"react/jsx-runtime";var th=({children:e,open:t,onClick:r,...o})=>Pn(xc,{show:t,as:_c.Fragment,children:o3(eh,{onClose:r,...o,as:e3,children:[Pn(xc.Child,{as:_c.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(X2,{"aria-hidden":"true"})}),Pn(t3,{children:Pn(xc.Child,{as:_c.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(eh.Panel,{as:r3,children:e})})})]})}),xn=Sn.div`
1811
+ `,B2=({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",H2=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Te(O2,{}):t&&r?Te(Bf,{}):t?Te(W2,{}):r?Te(L2,{}):null,G2=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as Vf}from"react/jsx-runtime";var zf=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Vf(Ws,{connectOnly:!0}):Vf(Ls,{connectOnly:!0})};import{jsx as qf}from"react/jsx-runtime";var $f=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?qf(Ws,{connectOnly:!1}):qf(Ls,{connectOnly:!1})};import V2 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as z2,jsx as oo,jsxs as q2}from"react/jsx-runtime";var jf=()=>{let{app:e}=_();return q2(z2,{children:[oo(A,{},"header"),oo(j,{}),oo(_e,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:oo(V2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),oo(Nt,{children:oo(us,{stacked:!0})}),oo(re,{}),oo(V,{protectedByPrivy:!0})]})};import $2 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as j2,jsx as no,jsxs as K2}from"react/jsx-runtime";var Kf=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:a}=W();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return K2(j2,{children:[no(A,{},"header"),no(j,{}),no(_e,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:no($2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),no(Nt,{children:no(En,{stacked:!0,onSubmit:i})}),no(re,{}),no(V,{protectedByPrivy:!0})]})};import{Fragment as Y2,jsx as Pi,jsxs as J2}from"react/jsx-runtime";var Yf=()=>{let{linkingHint:e}=W(),{app:t}=_(),r=e?`Select the wallet with ${Hr(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return J2(Y2,{children:[Pi(A,{},"header"),Pi(fr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Pi(Ot,{children:Pi(ln,{connectOnly:!1})}),Pi(V,{protectedByPrivy:!0})]})};import{jsx as Jf,jsxs as Z2}from"react/jsx-runtime";var Zf=({style:e,...t})=>Z2("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:[Jf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Jf("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 Q2,jsx as io,jsxs as Qf}from"react/jsx-runtime";var Xf=()=>{let{closePrivyModal:e}=W(),{navigate:t}=_();return Qf(Q2,{children:[io(A,{},"header"),io(j,{}),io(Zf,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),io(fr,{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"}}),Qf(Nt,{children:[io(F,{onClick:()=>t("LANDING"),children:"Try again"}),io(jt,{onClick:()=>e(),children:"Cancel"})]}),io(re,{}),io(V,{protectedByPrivy:!0})]})};import lh from"@heroicons/react/20/solid/CheckIcon";import w3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import C3 from"@heroicons/react/24/outline/FingerPrintIcon";import b3 from"@heroicons/react/24/outline/PhoneIcon";import ch from"@heroicons/react/24/outline/TrashIcon";import E3 from"@heroicons/react/24/solid/CheckBadgeIcon";import dh from"@heroicons/react/24/solid/CheckCircleIcon";import ph from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import T3 from"@heroicons/react/24/solid/IdentificationIcon";import Ic from"@heroicons/react/24/solid/PhoneIcon";import Rc from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as uh,useState as Lr}from"react";import{useState as Ac}from"react";import{isMobile as n3}from"react-device-detect";import nh from"styled-components";import{Dialog as eh,Transition as xc}from"@headlessui/react";import _c from"react";import Sn from"styled-components";import{jsx as Pn,jsxs as o3}from"react/jsx-runtime";var th=({children:e,open:t,onClick:r,...o})=>Pn(xc,{show:t,as:_c.Fragment,children:o3(eh,{onClose:r,...o,as:e3,children:[Pn(xc.Child,{as:_c.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(X2,{"aria-hidden":"true"})}),Pn(t3,{children:Pn(xc.Child,{as:_c.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Pn(eh.Panel,{as:r3,children:e})})})]})}),xn=Sn.div`
1812
1812
  display: flex;
1813
1813
  flex-direction: column;
1814
1814
  text-align: center;
@@ -1908,7 +1908,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1908
1908
  align-items: center;
1909
1909
  justify-content: center;
1910
1910
  height: 100%;
1911
- `;import{Fragment as p3,jsx as Si,jsxs as d3}from"react/jsx-runtime";var xi=6,i3=new Array(xi).fill("");function a3(e){return e.replace(/\s+/g,"")}function kc(e){return/^[0-9]{1}$/.test(e)}function oh(e){return e.length===xi&&e.every(kc)}function s3(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var _n=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=Ac(i3),[i,l]=Ac(null),[s,d]=Ac(null),u=async E=>{E.preventDefault();let v=a3(E.currentTarget.value);if(v==="")return;let S=s3(n,kc),C=v.split(""),P=!C.every(kc),I=C.length+S>xi;if(P){l("Passcode can only be numbers"),d(1);return}if(I){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let M=Number(E.currentTarget.name?.charAt(4)),k=[...v||[""]].slice(0,xi-M),U=[...n.slice(0,M),...k,...n.slice(M+k.length)];a(U);let F=k.length,H=Math.min(Math.max(M+F,0),xi-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),oh(U))try{await e(U.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(q){d(1),l(q.message)}else try{await e(null)}catch(q){d(1),l(q.message)}},y=E=>{s===1&&(l(null),d(null));let v=[...n.slice(0,E),"",...n.slice(E+1)];a(v),E>0&&document.querySelector(`input[name=pin-${E-1}]`)?.focus(),oh(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Si(p3,{children:d3(l3,{children:[Si("div",{children:n.map((E,v)=>Si("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&y(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:n3?"one-time-code":"off",disabled:t},v))}),Si("div",{children:Si(c3,{fail:!!r||!!i,children:r||i})})]})})},l3=nh.div`
1911
+ `;import{Fragment as p3,jsx as Si,jsxs as d3}from"react/jsx-runtime";var xi=6,i3=new Array(xi).fill("");function a3(e){return e.replace(/\s+/g,"")}function kc(e){return/^[0-9]{1}$/.test(e)}function oh(e){return e.length===xi&&e.every(kc)}function s3(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var _n=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=Ac(i3),[i,l]=Ac(null),[s,d]=Ac(null),u=async E=>{E.preventDefault();let v=a3(E.currentTarget.value);if(v==="")return;let S=s3(n,kc),C=v.split(""),P=!C.every(kc),R=C.length+S>xi;if(P){l("Passcode can only be numbers"),d(1);return}if(R){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let M=Number(E.currentTarget.name?.charAt(4)),k=[...v||[""]].slice(0,xi-M),B=[...n.slice(0,M),...k,...n.slice(M+k.length)];a(B);let U=k.length,H=Math.min(Math.max(M+U,0),xi-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),oh(B))try{await e(B.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(q){d(1),l(q.message)}else try{await e(null)}catch(q){d(1),l(q.message)}},y=E=>{s===1&&(l(null),d(null));let v=[...n.slice(0,E),"",...n.slice(E+1)];a(v),E>0&&document.querySelector(`input[name=pin-${E-1}]`)?.focus(),oh(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Si(p3,{children:d3(l3,{children:[Si("div",{children:n.map((E,v)=>Si("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&y(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:n3?"one-time-code":"off",disabled:t},v))}),Si("div",{children:Si(c3,{fail:!!r||!!i,children:r||i})})]})})},l3=nh.div`
1912
1912
  display: flex;
1913
1913
  flex-direction: column;
1914
1914
  width: 100%;
@@ -1987,7 +1987,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1987
1987
  width: 100%;
1988
1988
 
1989
1989
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1990
- `;import{useContext as u3}from"react";function An(){let{promptMfa:e,init:t,submit:r,cancel:o}=u3(ae);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as m3}from"react";function _i(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=m3(ae);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import f3 from"styled-components";import{jsx as ih,jsxs as y3}from"react/jsx-runtime";var ah=e=>y3(h3,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[ih("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),ih("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"})]}),h3=f3.svg`
1990
+ `;import{useContext as u3}from"react";function An(){let{promptMfa:e,init:t,submit:r,cancel:o}=u3(le);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as m3}from"react";function _i(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=m3(le);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import f3 from"styled-components";import{jsx as ih,jsxs as y3}from"react/jsx-runtime";var ah=e=>y3(h3,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[ih("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),ih("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"})]}),h3=f3.svg`
1991
1991
  height: 90px;
1992
1992
  width: 90px;
1993
1993
 
@@ -1998,7 +1998,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1998
1998
  > path {
1999
1999
  fill: white;
2000
2000
  }
2001
- `;import g3 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as v3}from"react/jsx-runtime";var sh=({size:e,authUrl:t})=>v3(bn,{url:t,squareLogoElement:g3,size:e,fgColor:"#1F1F1F"});import{Fragment as Ft,jsx as w,jsxs as oe}from"react/jsx-runtime";var mh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=Lr(null),{unenrollWithSms:n,unenrollWithTotp:a}=_i(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),{closePrivyModal:u}=W(),{promptMfa:y}=An(),[f,g]=Lr(s?.mfaEnrollmentFlow?.seenIntro||!1),[E,v]=Lr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};d.current=S;let C=e?.mfaMethods.includes("sms"),P=!!e?.phone,I=e?.mfaMethods.includes("totp"),M=C||I;uh(()=>{M&&g(!0)},[M]);function k(){o(null),v(null)}function U(){g(!1)}async function F(O){await y(),v(O)}if(!l||!e||!i)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(ah,{})}),w($r,{children:w(ht,{})}),w(Q,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function T(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return oe(Ft,{children:[w(A,{backFn:k,onClose:S},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(me,{children:"Remove SMS verification?"}),oe(se,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(D,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),w(Q,{})]});if(r==="totp")return oe(Ft,{children:[w(A,{backFn:k,onClose:S},"header"),w(Ye,{children:w(at,{children:w(ph,{})})}),w(me,{children:"Remove Authenticator App verification?"}),oe(se,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(D,{warn:!0,onClick:T,children:"Remove Authenticator App for MFA"})}),w(Q,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(me,{children:"Add more security"}),oe(se,{children:[i?.name," does not have any verification methods enabled."]}),w(jr,{children:w(D,{onClick:S,children:"Close"})}),w(Q,{})]});let q=!M&&!f;if(q)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(me,{children:"Transaction Protection"}),w(se,{children:"Set up transaction protection to add an extra layer of security to your account"}),oe(mu,{children:[oe(Ll,{children:[w(Wl,{children:w(E3,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),oe(Ll,{children:[w(Wl,{children:w(T3,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),oe(jr,{children:[w(D,{onClick:()=>g(!0),children:"Continue"}),w(jt,{onClick:S,children:"Not now"})]}),w(Q,{})]});switch(E){case"sms":return w(P3,{onComplete:S,onReset:k,onClose:S});case"totp":return w(S3,{onComplete:S,onClose:S,onReset:k});default:return oe(Ft,{children:[w(A,{backFn:q?U:void 0,onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(me,{children:"Choose a verification method"}),M?w(se,{children:"To add or delete verification methods, verification is required."}):w(se,{children:"How would you like to verify your identity? You can change this later."}),oe(Fa,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||I)&&oe(Ua,{children:[w(xe,{disabled:I,onClick:()=>F("totp"),children:oe(Ha,{children:[oe(Ba,{children:[w(w3,{}),"Authenticator App"]}),I?oe(tn,{children:[w(lh,{}),"Added"]}):w(tn,{children:"Recommended"})]})}),I&&w(Ol,{id:"remove",onClick:()=>o("totp"),children:w(ch,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||C)&&oe(Ua,{children:[w(xe,{disabled:C||P,onClick:()=>F("sms"),children:oe(Ha,{children:[oe(Ba,{children:[w(b3,{}),"SMS"]}),C&&oe(tn,{children:[w(lh,{}),"Added"]}),P&&w(tn,{children:"Disabled"})]})}),C&&w(Ol,{id:"remove",onClick:()=>o("sms"),children:w(ch,{})})]},"sms"),w(Ua,{children:w(xe,{disabled:!0,children:oe(Ha,{children:[oe(Ba,{children:[w(C3,{}),"Passkey"]}),w(tn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(Q,{})]})}},P3=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Lr(""),[a,i]=Lr(!1),[l,s]=Lr("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=_i(),{app:y,data:f,currentScreen:g,navigate:E,setModalData:v}=_();function S(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function C({qualifiedPhoneNumber:M}){try{await d({phoneNumber:M}),n(M),s("verify")}catch(k){v({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:k,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),E("ERROR_SCREEN")}}async function P(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),i(!0)}catch(k){throw Ql(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(k)?new Error("The code you entered is not valid"):mn(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Xl(k)?new Error("Verification canceled"):new Error("Unknown error")}}function I(){l==="verify"?s("enroll"):t()}return l==="enroll"?oe(Ft,{children:[w(A,{backFn:t,onClose:r},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(me,{children:"Set up SMS verification"}),w(se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),oe($r,{children:[w(En,{onSubmit:C}),oe(fu,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),w(Q,{})]}):a?oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{status:"success",children:w(dh,{})})}),w(me,{children:"SMS verification added"}),w(se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w(jr,{children:w(D,{onClick:S,children:"Done"})}),w(Q,{})]}):oe(Ft,{children:[w(A,{backFn:I,onClose:r},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(me,{children:"Enter enrollment code"}),oe($r,{children:[w(_n,{onChange:P}),oe(se,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:xf(o)})]})]}),w(Q,{})]})},S3=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=Lr("enroll"),[a,i]=Lr(null),[l,s]=Lr(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=_i(),{data:y}=_();uh(()=>{i(null),d().then(S=>{i(S)}).catch(()=>{i(null),r()})},[]);function f(){y?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function E(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(C){throw Ql(C)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(C)?new Error("The code you entered is not valid"):mn(C)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Xl(C)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?oe(Ft,{children:[w(A,{backFn:r,onClose:t},"header"),w(me,{children:"Scan QR code"}),w(se,{children:"Open your authenticator app and scan the QR code to continue."}),w(rn,{children:a?.authUrl?w(sh,{authUrl:a.authUrl,size:200}):w(ht,{})}),oe(jr,{children:[w(st,{children:a?.secret&&w(eo,{itemName:"secret",text:a.secret})}),w(D,{onClick:g,children:"Continue"})]}),w(Q,{})]}):l?oe(Ft,{children:[w(A,{onClose:f},"header"),w(Ye,{children:w(at,{status:"success",children:w(dh,{})})}),w(me,{children:"Authenticator app verification added"}),w(se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w(jr,{children:w(D,{onClick:f,children:"Done"})}),w(Q,{})]}):oe(Ft,{children:[w(A,{backFn:v,onClose:t},"header"),w(Ye,{children:w(at,{children:w(ph,{})})}),w(me,{children:"Enter enrollment code"}),w($r,{children:w(_n,{onChange:E})}),oe(se,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(Q,{})]})};import Eb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Tb from"@heroicons/react/24/outline/PhoneIcon";import Pb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Sb from"@heroicons/react/24/solid/PhoneIcon";import xb from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as _b,useState as Yc}from"react";import{useMemo as vb,useEffect as wb,useState as Xh}from"react";import Cb from"styled-components";import Oh from"styled-components";import hh from"styled-components";import{jsx as fh,jsxs as A3}from"react/jsx-runtime";var Os=({label:e,children:t,valueStyles:r})=>A3(x3,{children:[fh("div",{children:e}),fh(_3,{style:{...r},children:t})]}),x3=hh.div`
2001
+ `;import g3 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as v3}from"react/jsx-runtime";var sh=({size:e,authUrl:t})=>v3(bn,{url:t,squareLogoElement:g3,size:e,fgColor:"#1F1F1F"});import{Fragment as Ft,jsx as w,jsxs as oe}from"react/jsx-runtime";var mh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=Lr(null),{unenrollWithSms:n,unenrollWithTotp:a}=_i(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=_(),{closePrivyModal:u}=W(),{promptMfa:y}=An(),[f,g]=Lr(s?.mfaEnrollmentFlow?.seenIntro||!1),[E,v]=Lr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};d.current=S;let C=e?.mfaMethods.includes("sms"),P=!!e?.phone,R=e?.mfaMethods.includes("totp"),M=C||R;uh(()=>{M&&g(!0)},[M]);function k(){o(null),v(null)}function B(){g(!1)}async function U(O){await y(),v(O)}if(!l||!e||!i)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(ah,{})}),w($r,{children:w(ht,{})}),w(Q,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function T(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return oe(Ft,{children:[w(A,{backFn:k,onClose:S},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(he,{children:"Remove SMS verification?"}),oe(ce,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(F,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),w(Q,{})]});if(r==="totp")return oe(Ft,{children:[w(A,{backFn:k,onClose:S},"header"),w(Ye,{children:w(at,{children:w(ph,{})})}),w(he,{children:"Remove Authenticator App verification?"}),oe(ce,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(F,{warn:!0,onClick:T,children:"Remove Authenticator App for MFA"})}),w(Q,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(he,{children:"Add more security"}),oe(ce,{children:[i?.name," does not have any verification methods enabled."]}),w(jr,{children:w(F,{onClick:S,children:"Close"})}),w(Q,{})]});let q=!M&&!f;if(q)return oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(he,{children:"Transaction Protection"}),w(ce,{children:"Set up transaction protection to add an extra layer of security to your account"}),oe(mu,{children:[oe(Ll,{children:[w(Wl,{children:w(E3,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),oe(Ll,{children:[w(Wl,{children:w(T3,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),oe(jr,{children:[w(F,{onClick:()=>g(!0),children:"Continue"}),w(jt,{onClick:S,children:"Not now"})]}),w(Q,{})]});switch(E){case"sms":return w(P3,{onComplete:S,onReset:k,onClose:S});case"totp":return w(S3,{onComplete:S,onClose:S,onReset:k});default:return oe(Ft,{children:[w(A,{backFn:q?B:void 0,onClose:S},"header"),w(Ye,{children:w(at,{children:w(Rc,{})})}),w(he,{children:"Choose a verification method"}),M?w(ce,{children:"To add or delete verification methods, verification is required."}):w(ce,{children:"How would you like to verify your identity? You can change this later."}),oe(Fa,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||R)&&oe(Ua,{children:[w(xe,{disabled:R,onClick:()=>U("totp"),children:oe(Ha,{children:[oe(Ba,{children:[w(w3,{}),"Authenticator App"]}),R?oe(tn,{children:[w(lh,{}),"Added"]}):w(tn,{children:"Recommended"})]})}),R&&w(Ol,{id:"remove",onClick:()=>o("totp"),children:w(ch,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||C)&&oe(Ua,{children:[w(xe,{disabled:C||P,onClick:()=>U("sms"),children:oe(Ha,{children:[oe(Ba,{children:[w(b3,{}),"SMS"]}),C&&oe(tn,{children:[w(lh,{}),"Added"]}),P&&w(tn,{children:"Disabled"})]})}),C&&w(Ol,{id:"remove",onClick:()=>o("sms"),children:w(ch,{})})]},"sms"),w(Ua,{children:w(xe,{disabled:!0,children:oe(Ha,{children:[oe(Ba,{children:[w(C3,{}),"Passkey"]}),w(tn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(Q,{})]})}},P3=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Lr(""),[a,i]=Lr(!1),[l,s]=Lr("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=_i(),{app:y,data:f,currentScreen:g,navigate:E,setModalData:v}=_();function S(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function C({qualifiedPhoneNumber:M}){try{await d({phoneNumber:M}),n(M),s("verify")}catch(k){v({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:k,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),E("ERROR_SCREEN")}}async function P(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),i(!0)}catch(k){throw Ql(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(k)?new Error("The code you entered is not valid"):mn(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Xl(k)?new Error("Verification canceled"):new Error("Unknown error")}}function R(){l==="verify"?s("enroll"):t()}return l==="enroll"?oe(Ft,{children:[w(A,{backFn:t,onClose:r},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(he,{children:"Set up SMS verification"}),w(ce,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),oe($r,{children:[w(En,{onSubmit:C}),oe(fu,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),w(Q,{})]}):a?oe(Ft,{children:[w(A,{onClose:S},"header"),w(Ye,{children:w(at,{status:"success",children:w(dh,{})})}),w(he,{children:"SMS verification added"}),w(ce,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w(jr,{children:w(F,{onClick:S,children:"Done"})}),w(Q,{})]}):oe(Ft,{children:[w(A,{backFn:R,onClose:r},"header"),w(Ye,{children:w(at,{children:w(Ic,{})})}),w(he,{children:"Enter enrollment code"}),oe($r,{children:[w(_n,{onChange:P}),oe(ce,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:xf(o)})]})]}),w(Q,{})]})},S3=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=Lr("enroll"),[a,i]=Lr(null),[l,s]=Lr(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=_i(),{data:y}=_();uh(()=>{i(null),d().then(S=>{i(S)}).catch(()=>{i(null),r()})},[]);function f(){y?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function E(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(C){throw Ql(C)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(C)?new Error("The code you entered is not valid"):mn(C)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Xl(C)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?oe(Ft,{children:[w(A,{backFn:r,onClose:t},"header"),w(he,{children:"Scan QR code"}),w(ce,{children:"Open your authenticator app and scan the QR code to continue."}),w(rn,{children:a?.authUrl?w(sh,{authUrl:a.authUrl,size:200}):w(ht,{})}),oe(jr,{children:[w(st,{children:a?.secret&&w(eo,{itemName:"secret",text:a.secret})}),w(F,{onClick:g,children:"Continue"})]}),w(Q,{})]}):l?oe(Ft,{children:[w(A,{onClose:f},"header"),w(Ye,{children:w(at,{status:"success",children:w(dh,{})})}),w(he,{children:"Authenticator app verification added"}),w(ce,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w(jr,{children:w(F,{onClick:f,children:"Done"})}),w(Q,{})]}):oe(Ft,{children:[w(A,{backFn:v,onClose:t},"header"),w(Ye,{children:w(at,{children:w(ph,{})})}),w(he,{children:"Enter enrollment code"}),w($r,{children:w(_n,{onChange:E})}),oe(ce,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(Q,{})]})};import Eb from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Tb from"@heroicons/react/24/outline/PhoneIcon";import Pb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Sb from"@heroicons/react/24/solid/PhoneIcon";import xb from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as _b,useState as Yc}from"react";import{useMemo as vb,useEffect as wb,useState as Xh}from"react";import Cb from"styled-components";import Oh from"styled-components";import hh from"styled-components";import{jsx as fh,jsxs as A3}from"react/jsx-runtime";var Os=({label:e,children:t,valueStyles:r})=>A3(x3,{children:[fh("div",{children:e}),fh(_3,{style:{...r},children:t})]}),x3=hh.div`
2002
2002
  display: flex;
2003
2003
  align-items: center;
2004
2004
  justify-content: space-between;
@@ -2219,10 +2219,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
2219
2219
  overflow: hidden;
2220
2220
  max-width: 275px;
2221
2221
  text-overflow: ellipsis;
2222
- `;import{VoidSigner as ub}from"@ethersproject/abstract-signer";import{EtherscanProvider as DF}from"@ethersproject/providers";import{BigNumber as qh}from"@ethersproject/bignumber";import{BigNumber as In}from"@ethersproject/bignumber";import{Contract as sb}from"@ethersproject/contracts";import{serialize as lb}from"@ethersproject/transactions";var Mn=e=>[va.id,wa.id,Ca.id,ba.id,Ea.id,Ta.id,Pa.id,xa.id,Sa.id].includes(e),Gh=async(e,t)=>{if(!Mn(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 a=In.from(r).mul(In.from(126)).div(In.from(100)).add(In.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Wi(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Vh(e,t){if(!e.chainId||e.chainId&&!Mn(e.chainId))return In.from(0);let r=In.from(0);try{let o=new sb(jd,Kd,t),n=zh(e),a=lb(n);r=await o.getL1Fee(a)}catch{}return r}async function $h(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var jh=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 Wn(e,t){if(!e.gasLimit)throw new Se("gasLimit was not successfully set for transaction.");let r=Xe(e.gasLimit),o=qh.from(0);if(e.type==2)if(e.maxFeePerGas)o=Xe(e.maxFeePerGas);else throw new Se("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Xe(e.gasPrice);else throw new Se("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=qh.from(0);if(e.chainId&&Mn(e.chainId))try{a=await Vh(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Bc}from"@ethersproject/bignumber";var Hc=e=>[ha.id,ya.id,ga.id].includes(e),Kh=async(e,t)=>{if(!Hc(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(Bc.from(120)).div(Bc.from(100));e.maxFeePerGas=Wi(o),e.maxPriorityFeePerGas=Wi(Bc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Gc=e=>[56,97].includes(e),Yh=async(e,t)=>{if(!Gc(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 Jh}from"@ethersproject/units";import{ofetch as cb}from"ofetch";var Vc={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 qc=e=>[Kn.id,Yn.id,Vc.id].includes(e),zc=e=>({maxPriorityFee:Jh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Jh(e.maxFee.toFixed(9),"gwei").toHexString()}),db=e=>({safeLow:zc(e.safeLow),standard:zc(e.standard),fast:zc(e.fast)}),pb=async e=>{let t="";switch(e){case Kn.id:t="https://gasstation.polygon.technology/v2";break;case Yn.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Vc.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return db(await cb(t))};async function Zh(e){if(!qc(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 pb(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 Wi(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 zh(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=Xe(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Xe(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Xe(e.gasPrice)),e.value!==void 0&&(t.value=Xe(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Xe(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Xe(e.maxPriorityFeePerGas)),t}async function Ln(e,t,r){if(t.chainId=Number(t.chainId),Qh(t),!t.nonce){let o=new ub(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await $h(t,r)),t.from||(t.from=e),qc(t.chainId)?t=await Zh(t):Hc(t.chainId)?t=await Kh(t,r):Mn(t.chainId)?t=await Gh(t,r):Gc(t.chainId)?t=await Yh(t,r):t=await jh(t,r),t}async function Bs(e,t,r,o,n){o=Object.assign({chainId:xr},o),Qh(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Hs(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Xe(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Qh(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!mb(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 mb(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&fb(e);return t||r||o}function fb(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Gs(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 $c,useEffect as hb}from"react";var Vs=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,a]=$c(!0),[i,l]=$c(void 0),[s,d]=$c(void 0);return hb(()=>{let u=e.chainId||xr,y=o.find(g=>g.id===Number(u));if(!y)throw new J(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(y);g?d(g):l(new Error(`Unable to fetch token price on chain id ${y.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as yb,useContext as gb}from"react";var jc=yb(null);function Li(){let e=gb(jc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as ey}from"react/jsx-runtime";var Kc=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Li(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=W(),[s,d]=Xh(null),[u,y]=Xh(e),{tokenPrice:f}=Vs(u),g=l(e.chainId)||"ETH",E=vb(()=>r.find(v=>v.walletClientType==="privy"),[r]);return wb(()=>{async function v(){if(!await t()||!o||!E)return u;let C=_r(u.chainId,a,n,{appId:i}),P=await Ln(E.address,u,C),{totalGasEstimate:I}=await Wn(P,C);return d(I.toHexString()),P}v().then(S=>{y(S)})},[o]),E?ey(bb,{children:ey(Rn,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},bb=Cb.div`
2222
+ `;import{VoidSigner as ub}from"@ethersproject/abstract-signer";import{EtherscanProvider as DF}from"@ethersproject/providers";import{BigNumber as qh}from"@ethersproject/bignumber";import{BigNumber as In}from"@ethersproject/bignumber";import{Contract as sb}from"@ethersproject/contracts";import{serialize as lb}from"@ethersproject/transactions";var Mn=e=>[va.id,wa.id,Ca.id,ba.id,Ea.id,Ta.id,Pa.id,xa.id,Sa.id].includes(e),Gh=async(e,t)=>{if(!Mn(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 a=In.from(r).mul(In.from(126)).div(In.from(100)).add(In.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Wi(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Vh(e,t){if(!e.chainId||e.chainId&&!Mn(e.chainId))return In.from(0);let r=In.from(0);try{let o=new sb(jd,Kd,t),n=zh(e),a=lb(n);r=await o.getL1Fee(a)}catch{}return r}async function $h(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var jh=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 Wn(e,t){if(!e.gasLimit)throw new Se("gasLimit was not successfully set for transaction.");let r=Xe(e.gasLimit),o=qh.from(0);if(e.type==2)if(e.maxFeePerGas)o=Xe(e.maxFeePerGas);else throw new Se("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Xe(e.gasPrice);else throw new Se("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=qh.from(0);if(e.chainId&&Mn(e.chainId))try{a=await Vh(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Bc}from"@ethersproject/bignumber";var Hc=e=>[ha.id,ya.id,ga.id].includes(e),Kh=async(e,t)=>{if(!Hc(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(Bc.from(120)).div(Bc.from(100));e.maxFeePerGas=Wi(o),e.maxPriorityFeePerGas=Wi(Bc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Gc=e=>[56,97].includes(e),Yh=async(e,t)=>{if(!Gc(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 Jh}from"@ethersproject/units";import{ofetch as cb}from"ofetch";var Vc={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 qc=e=>[Kn.id,Yn.id,Vc.id].includes(e),zc=e=>({maxPriorityFee:Jh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Jh(e.maxFee.toFixed(9),"gwei").toHexString()}),db=e=>({safeLow:zc(e.safeLow),standard:zc(e.standard),fast:zc(e.fast)}),pb=async e=>{let t="";switch(e){case Kn.id:t="https://gasstation.polygon.technology/v2";break;case Yn.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Vc.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return db(await cb(t))};async function Zh(e){if(!qc(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 pb(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 Wi(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 zh(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=Xe(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Xe(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Xe(e.gasPrice)),e.value!==void 0&&(t.value=Xe(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Xe(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Xe(e.maxPriorityFeePerGas)),t}async function Ln(e,t,r){if(t.chainId=Number(t.chainId),Qh(t),!t.nonce){let o=new ub(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await $h(t,r)),t.from||(t.from=e),qc(t.chainId)?t=await Zh(t):Hc(t.chainId)?t=await Kh(t,r):Mn(t.chainId)?t=await Gh(t,r):Gc(t.chainId)?t=await Yh(t,r):t=await jh(t,r),t}async function Bs(e,t,r,o,n){o=Object.assign({chainId:xr},o),Qh(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Hs(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Xe(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Qh(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!mb(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 mb(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&fb(e);return t||r||o}function fb(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Gs(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 $c,useEffect as hb}from"react";var Vs=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,a]=$c(!0),[i,l]=$c(void 0),[s,d]=$c(void 0);return hb(()=>{let u=e.chainId||xr,y=o.find(g=>g.id===Number(u));if(!y)throw new J(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(y);g?d(g):l(new Error(`Unable to fetch token price on chain id ${y.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as yb,useContext as gb}from"react";var jc=yb(null);function Li(){let e=gb(jc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as ey}from"react/jsx-runtime";var Kc=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Li(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=W(),[s,d]=Xh(null),[u,y]=Xh(e),{tokenPrice:f}=Vs(u),g=l(e.chainId)||"ETH",E=vb(()=>r.find(v=>v.walletClientType==="privy"),[r]);return wb(()=>{async function v(){if(!await t()||!o||!E)return u;let C=_r(u.chainId,a,n,{appId:i}),P=await Ln(E.address,u,C),{totalGasEstimate:R}=await Wn(P,C);return d(R.toHexString()),P}v().then(S=>{y(S)})},[o]),E?ey(bb,{children:ey(Rn,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},bb=Cb.div`
2223
2223
  width: 100%;
2224
2224
  padding: 1rem 0;
2225
- `;import{Fragment as Jc,jsx as ne,jsxs as br}from"react/jsx-runtime";var Zc=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=Yc(null),{init:a,cancel:i}=An();_b(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ne(Ab,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):br(Jc,{children:[ne(A,{onClose:s},"header"),ne(Ye,{children:ne(at,{children:ne(xb,{})})}),ne(me,{children:"Verify your identity"}),ne(se,{children:"Choose a verification method"}),br(Fa,{children:[r.mfaMethods.includes("totp")&&br(xe,{onClick:()=>l("totp"),children:[ne(Eb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&br(xe,{onClick:()=>l("sms"),children:[ne(Tb,{}),"SMS"]},"sms")]}),ne(Q,{})]})},Ab=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=W(),[a,i]=Yc(!1),[l,s]=Yc(!1),{submit:d}=An();async function u(y){try{if(!y)return;await d(e,y),s(!0),i(!1),t()}catch(f){throw Zl(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):fn(f)?(i(!1),new Error("The code you entered is not valid")):mn(f)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return br(Jc,{children:[ne(A,{onClose:t},"header"),ne(Ye,{children:ne(at,{children:ne(Sb,{})})}),ne(me,{children:"Enter verification code"}),br($r,{children:[ne(_n,{success:l,disabled:a,onChange:u}),br(se,{children:["To continue, please enter the 6-digit code sent to your ",ne("strong",{children:"mobile device"})]}),n&&ne(Kc,{pendingTransaction:n})]}),r&&ne(Nl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ne(jt,{onClick:t,children:"Not now"}),ne(Q,{})]});case"totp":return br(Jc,{children:[ne(A,{onClose:t},"header"),ne(Ye,{children:ne(at,{children:ne(Pb,{})})}),ne(me,{children:"Enter verification code"}),br($r,{children:[ne(_n,{success:l,disabled:a,onChange:u}),br(se,{children:["To continue, please enter the 6-digit code generated from your"," ",ne("strong",{children:"authenticator app"})]}),n&&ne(Kc,{pendingTransaction:n})]}),r&&ne(Nl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ne(jt,{onClick:t,children:"Not now"}),ne(Q,{})]});default:return null}};import{useEffect as ty,useState as ry}from"react";import ny from"styled-components";import{Fragment as Ib,jsx as Er,jsxs as zs}from"react/jsx-runtime";var oy={google:{name:"Google",component:Ps},discord:{name:"Discord",component:bs},github:{name:"Github",component:Es},linkedin:{name:"LinkedIn",component:xs},twitter:{name:"Twitter",component:ks},spotify:{name:"Spotify",component:_s},tiktok:{name:"Tiktok",component:As},apple:{name:"Apple",component:Cs}},iy=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:y,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),[v,S]=ry(!1),[C,P]=ry(void 0),I=s()?.provider||"google",M=oy[I].name,k=oy[I].component,U=n?.render.inDialog?Oe:0;ty(()=>{u(I).then(()=>{S(!0)}).catch(T=>{if(T?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:q,detail:O}=fp(T,I);P({retryable:q,detail:O,message:"Authentication failed"})}).finally(()=>{jn(),f()})},[M,I]),ty(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},U);return()=>clearTimeout(q)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let q=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:O=>{console.error(O),E("embedded_wallet_creation_failure_logout",{error:O,provider:I,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},U);return()=>clearTimeout(q)}else{let q=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),U);return y(),()=>clearTimeout(q)}}},[r,e,v,o]);let F=v?`Successfully connected with ${M}`:C?C.message:`Verifying connection to ${M}`,H="";return v?H="You\u2019re good to go!":C?H=C.detail:H="Just a few moments more",zs(Ib,{children:[Er(A,{}),Er(j,{}),zs(kb,{children:[Er(Rb,{children:zs("div",{children:[Er(Mt,{success:v,fail:!!C}),Er(k,{style:{width:"38px",height:"38px"}})]})}),zs(Je,{children:[Er("h3",{children:F}),Er("p",{children:H})]}),C&&C?.retryable?Er(La,{onClick:()=>{jn(),d(I),P(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),Er(re,{}),Er(Q,{})]})},kb=ny.div`
2225
+ `;import{Fragment as Jc,jsx as ie,jsxs as br}from"react/jsx-runtime";var Zc=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=Yc(null),{init:a,cancel:i}=An();_b(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ie(Ab,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):br(Jc,{children:[ie(A,{onClose:s},"header"),ie(Ye,{children:ie(at,{children:ie(xb,{})})}),ie(he,{children:"Verify your identity"}),ie(ce,{children:"Choose a verification method"}),br(Fa,{children:[r.mfaMethods.includes("totp")&&br(xe,{onClick:()=>l("totp"),children:[ie(Eb,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&br(xe,{onClick:()=>l("sms"),children:[ie(Tb,{}),"SMS"]},"sms")]}),ie(Q,{})]})},Ab=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=W(),[a,i]=Yc(!1),[l,s]=Yc(!1),{submit:d}=An();async function u(y){try{if(!y)return;await d(e,y),s(!0),i(!1),t()}catch(f){throw Zl(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):fn(f)?(i(!1),new Error("The code you entered is not valid")):mn(f)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return br(Jc,{children:[ie(A,{onClose:t},"header"),ie(Ye,{children:ie(at,{children:ie(Sb,{})})}),ie(he,{children:"Enter verification code"}),br($r,{children:[ie(_n,{success:l,disabled:a,onChange:u}),br(ce,{children:["To continue, please enter the 6-digit code sent to your ",ie("strong",{children:"mobile device"})]}),n&&ie(Kc,{pendingTransaction:n})]}),r&&ie(Nl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ie(jt,{onClick:t,children:"Not now"}),ie(Q,{})]});case"totp":return br(Jc,{children:[ie(A,{onClose:t},"header"),ie(Ye,{children:ie(at,{children:ie(Pb,{})})}),ie(he,{children:"Enter verification code"}),br($r,{children:[ie(_n,{success:l,disabled:a,onChange:u}),br(ce,{children:["To continue, please enter the 6-digit code generated from your"," ",ie("strong",{children:"authenticator app"})]}),n&&ie(Kc,{pendingTransaction:n})]}),r&&ie(Nl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ie(jt,{onClick:t,children:"Not now"}),ie(Q,{})]});default:return null}};import{useEffect as ty,useState as ry}from"react";import ny from"styled-components";import{Fragment as Ib,jsx as Er,jsxs as zs}from"react/jsx-runtime";var oy={google:{name:"Google",component:Ps},discord:{name:"Discord",component:bs},github:{name:"Github",component:Es},linkedin:{name:"LinkedIn",component:xs},twitter:{name:"Twitter",component:ks},spotify:{name:"Spotify",component:_s},tiktok:{name:"Tiktok",component:As},apple:{name:"Apple",component:Cs}},iy=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:y,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),[v,S]=ry(!1),[C,P]=ry(void 0),R=s()?.provider||"google",M=oy[R].name,k=oy[R].component,B=n?.render.inDialog?Oe:0;ty(()=>{u(R).then(()=>{S(!0)}).catch(T=>{if(T?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:q,detail:O}=fp(T,R);P({retryable:q,detail:O,message:"Authentication failed"})}).finally(()=>{jn(),f()})},[M,R]),ty(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},B);return()=>clearTimeout(q)}if(kt(o,n?.embeddedWallets?.createOnLogin)){let q=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:O=>{console.error(O),E("embedded_wallet_creation_failure_logout",{error:O,provider:R,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},B);return()=>clearTimeout(q)}else{let q=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),B);return y(),()=>clearTimeout(q)}}},[r,e,v,o]);let U=v?`Successfully connected with ${M}`:C?C.message:`Verifying connection to ${M}`,H="";return v?H="You\u2019re good to go!":C?H=C.detail:H="Just a few moments more",zs(Ib,{children:[Er(A,{}),Er(j,{}),zs(kb,{children:[Er(Rb,{children:zs("div",{children:[Er(Mt,{success:v,fail:!!C}),Er(k,{style:{width:"38px",height:"38px"}})]})}),zs(Je,{children:[Er("h3",{children:U}),Er("p",{children:H})]}),C&&C?.retryable?Er(La,{onClick:()=>{jn(),d(R),P(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),Er(re,{}),Er(Q,{})]})},kb=ny.div`
2226
2226
  display: flex;
2227
2227
  flex-direction: column;
2228
2228
  align-items: center;
@@ -2255,12 +2255,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2255
2255
  }
2256
2256
  `;import{useEffect as Wb,useState as sy}from"react";import Lb from"styled-components";import{isMobile as Mb}from"react-device-detect";var ay=(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(!Br()&&Mb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Nb,jsx as Or,jsxs as ly}from"react/jsx-runtime";var cy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=sy(""),[a,i]=sy(!1);Wb(()=>{t&&r&&e().then(n)},[t,r]);let l=ay(o,!a),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."),a&&(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."),ly(Nb,{children:[Or(A,{},"header"),Or(j,{}),Or(fr,{title:s.title,description:s.description}),ly(Nt,{children:[Or(Ob,{children:Or(cr,{style:{width:"72px",height:"72px"}})}),Or(Wa,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?Or("p",{children:s.footnote}):null]}),Or(re,{}),Or(V,{protectedByPrivy:!0})]})},Ob=Lb(st)`
2257
2257
  margin: 16px auto;
2258
- `;import{BigNumber as uy}from"@ethersproject/bignumber";import{useMemo as my,useEffect as fy,useState as Ut}from"react";import Nn from"styled-components";function dy(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as Qc}from"@ethersproject/bignumber";import Db from"styled-components";import{Fragment as Bb,jsx as Oi,jsxs as Hb}from"react/jsx-runtime";var Fb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Qc.from(e.gasUsed),o=Qc.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Qc.from(t);n=n.add(a)}return n.toString()}catch{return}else return},py=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>Hb(Bb,{children:[Oi(A,{onClose:o}),Oi(ri,{title:"Transaction complete!",description:"You're all set."}),Oi(Rn,{tokenPrice:n,from:t.from,to:t.to,gas:Fb(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Oi(Ub,{loading:!1,onClick:o,children:"All Done"}),Oi(Q,{})]}),Ub=Db(D)`
2258
+ `;import{BigNumber as uy}from"@ethersproject/bignumber";import{useMemo as my,useEffect as fy,useState as Ut}from"react";import Nn from"styled-components";function dy(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as Qc}from"@ethersproject/bignumber";import Db from"styled-components";import{Fragment as Bb,jsx as Oi,jsxs as Hb}from"react/jsx-runtime";var Fb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Qc.from(e.gasUsed),o=Qc.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Qc.from(t);n=n.add(a)}return n.toString()}catch{return}else return},py=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>Hb(Bb,{children:[Oi(A,{onClose:o}),Oi(ri,{title:"Transaction complete!",description:"You're all set."}),Oi(Rn,{tokenPrice:n,from:t.from,to:t.to,gas:Fb(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Oi(Ub,{loading:!1,onClick:o,children:"All Done"}),Oi(Q,{})]}),Ub=Db(F)`
2259
2259
  && {
2260
2260
  margin-top: 24px;
2261
2261
  }
2262
2262
  transition: color 350ms ease, background-color 350ms ease;
2263
- `;import{Fragment as Xc,jsx as et,jsxs as On}from"react/jsx-runtime";var Gb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return et(Dc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return et(Dc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return et(Xc,{children:et(Hh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},yy=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Li(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=W(),{app:u,navigate:y,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:E}=_(),{transactionRequest:v,onSuccess:S,onFailure:C,uiOptions:P,fundWalletConfig:I}=f.sendTransaction,[M,k]=Ut(null),[U,F]=Ut(null),[H,T]=Ut(""),[q,O]=Ut(),[K,ie]=Ut(!1),te=()=>{T(""),O(void 0)},ee=(wt,qe,or)=>{T(wt),O(new Se(new Rt(qe??wt,or??Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[z,Pe]=Ut(!1),[we,Pr]=Ut(!0),[gt,Ae]=Ut(null),[he,vt]=Ut(v),{tokenPrice:Bt,isTokenPriceLoading:Dr}=Vs(he),rr=s(v.chainId)||"ETH",[L,Y]=Ut(null),[Z,Bn]=Ut(null),[$,We]=Ut(!0);fy(()=>{e||(y("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ut=my(()=>r.find(wt=>wt.walletClientType==="privy"),[r]),po=async()=>{if(!ut)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:wt,externalTransactionId:qe}=await a(ut.address,{config:I?.config||{}});E({fiatOnRampPrompt:{signedUrl:wt},fiatOnRampStatus:{externalTransactionId:qe}}),y("FIAT_ON_RAMP_PROMPT_SCREEN")},Ht=my(()=>_r(he.chainId,l,i,{appId:d}),[he.chainId,i]);fy(()=>{async function wt(){let qe=he;if(!await t()||!o||!ut)return;try{qe=await Ln(ut.address,he,Ht),vt(qe)}catch(nr){console.error(nr),ee("There was an error preparing your transaction. Please try again.",nr.reason)}let Fr=uy.from(0),Di=uy.from(0);try{({totalGasEstimate:Fr,l1ExecutionFeeEstimate:Di}=await Wn(qe,Ht)),Y(Fr.toHexString()),Bn(Di.toHexString())}catch{Y(null)}try{let{balance:nr,hasSufficientFunds:Zs}=await Hs(ut.address,qe,Fr,Ht);Ae(nr.toHexString()),Zs||(Pr(!1),ee("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ie(!0))}catch(nr){console.warn(`Failed to fetch wallet balance with error: ${nr}`)}We(!1)}wt()},[o]);let uo=dy(he),Js=uo==="SEND"?`Send ${rr}`:"Review transaction",Le={modalTitle:P.header||P.modalTitle||Js,buttonText:P.buttonText||"Submit"},mo=()=>{z||(U?S(U):C(q||new Se(new Rt("The user rejected the request",Ke.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=mo,Bt===void 0&&Dr||$?On(Xc,{children:[P.transactionInfo?.contractInfo?.imgUrl&&et(fa,{src:P.transactionInfo?.contractInfo?.imgUrl}),et(A,{title:Le.modalTitle,onClose:mo}),et(hy,{children:et(pn,{})})]}):M!==null?et(py,{txn:he,onClose:mo,receipt:M,transactionInfo:P.transactionInfo,tokenPrice:Bt,tokenSymbol:rr,l1GasEstimate:Z}):On(Xc,{children:[et(A,{title:Le.modalTitle,onClose:mo}),On(hy,{children:[On($b,{children:[et(Gb,{txn:he,txnFamily:uo,uiOptions:P,tokenSymbol:rr,tokenPrice:Bt}),ut?et(Rn,{from:ut.address,to:he.to,txn:he,transactionInfo:P.transactionInfo,gas:L||void 0,tokenPrice:Bt,tokenSymbol:rr}):null]}),On(jb,{children:[et(Vb,{children:H}),et(Dh,{txn:he,address:ut?.address??"",hasFunds:we,balance:gt}),On(zb,{children:[K&&et(D,{onClick:po,children:"Add Funds"}),et(qb,{disabled:z||!we,loading:!o||z,loadingText:z?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Pe(!0);let wt=await t();if(wt&&!z&&ut)try{let qe=await Bs(wt,ut.address,o,he,Ht);F(qe);let or=await qe.wait();k(Gs(or)),te()}catch(qe){let or="There was an error processing your transaction. Please contact support.";console.warn({transaction:he,error:qe}),ee(or,qe.reason)}finally{Pe(!1)}},children:Le.buttonText})]})]})]})]})},hy=Nn.div`
2263
+ `;import{Fragment as Xc,jsx as et,jsxs as On}from"react/jsx-runtime";var Gb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return et(Dc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return et(Dc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return et(Xc,{children:et(Hh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},yy=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Li(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=W(),{app:u,navigate:y,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:E}=_(),{transactionRequest:v,onSuccess:S,onFailure:C,uiOptions:P,fundWalletConfig:R}=f.sendTransaction,[M,k]=Ut(null),[B,U]=Ut(null),[H,T]=Ut(""),[q,O]=Ut(),[K,ae]=Ut(!1),te=()=>{T(""),O(void 0)},ee=(wt,qe,or)=>{T(wt),O(new Se(new Rt(qe??wt,or??Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[z,Pe]=Ut(!1),[we,Pr]=Ut(!0),[gt,Ae]=Ut(null),[ge,vt]=Ut(v),{tokenPrice:Bt,isTokenPriceLoading:Dr}=Vs(ge),rr=s(v.chainId)||"ETH",[L,Y]=Ut(null),[Z,Bn]=Ut(null),[$,We]=Ut(!0);fy(()=>{e||(y("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ut=my(()=>r.find(wt=>wt.walletClientType==="privy"),[r]),po=async()=>{if(!ut)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:wt,externalTransactionId:qe}=await a(ut.address,{config:R?.config||{}});E({fiatOnRampPrompt:{signedUrl:wt},fiatOnRampStatus:{externalTransactionId:qe}}),y("FIAT_ON_RAMP_PROMPT_SCREEN")},Ht=my(()=>_r(ge.chainId,l,i,{appId:d}),[ge.chainId,i]);fy(()=>{async function wt(){let qe=ge;if(!await t()||!o||!ut)return;try{qe=await Ln(ut.address,ge,Ht),vt(qe)}catch(nr){console.error(nr),ee("There was an error preparing your transaction. Please try again.",nr.reason)}let Fr=uy.from(0),Di=uy.from(0);try{({totalGasEstimate:Fr,l1ExecutionFeeEstimate:Di}=await Wn(qe,Ht)),Y(Fr.toHexString()),Bn(Di.toHexString())}catch{Y(null)}try{let{balance:nr,hasSufficientFunds:Zs}=await Hs(ut.address,qe,Fr,Ht);Ae(nr.toHexString()),Zs||(Pr(!1),ee("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ae(!0))}catch(nr){console.warn(`Failed to fetch wallet balance with error: ${nr}`)}We(!1)}wt()},[o]);let uo=dy(ge),Js=uo==="SEND"?`Send ${rr}`:"Review transaction",Le={modalTitle:P.header||P.modalTitle||Js,buttonText:P.buttonText||"Submit"},mo=()=>{z||(B?S(B):C(q||new Se(new Rt("The user rejected the request",Ke.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=mo,Bt===void 0&&Dr||$?On(Xc,{children:[P.transactionInfo?.contractInfo?.imgUrl&&et(fa,{src:P.transactionInfo?.contractInfo?.imgUrl}),et(A,{title:Le.modalTitle,onClose:mo}),et(hy,{children:et(pn,{})})]}):M!==null?et(py,{txn:ge,onClose:mo,receipt:M,transactionInfo:P.transactionInfo,tokenPrice:Bt,tokenSymbol:rr,l1GasEstimate:Z}):On(Xc,{children:[et(A,{title:Le.modalTitle,onClose:mo}),On(hy,{children:[On($b,{children:[et(Gb,{txn:ge,txnFamily:uo,uiOptions:P,tokenSymbol:rr,tokenPrice:Bt}),ut?et(Rn,{from:ut.address,to:ge.to,txn:ge,transactionInfo:P.transactionInfo,gas:L||void 0,tokenPrice:Bt,tokenSymbol:rr}):null]}),On(jb,{children:[et(Vb,{children:H}),et(Dh,{txn:ge,address:ut?.address??"",hasFunds:we,balance:gt}),On(zb,{children:[K&&et(F,{onClick:po,children:"Add Funds"}),et(qb,{disabled:z||!we,loading:!o||z,loadingText:z?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Pe(!0);let wt=await t();if(wt&&!z&&ut)try{let qe=await Bs(wt,ut.address,o,ge,Ht);U(qe);let or=await qe.wait();k(Gs(or)),te()}catch(qe){let or="There was an error processing your transaction. Please contact support.";console.warn({transaction:ge,error:qe}),ee(or,qe.reason)}finally{Pe(!1)}},children:Le.buttonText})]})]})]})]})},hy=Nn.div`
2264
2264
  display: flex;
2265
2265
  flex-direction: column;
2266
2266
  justify-content: space-between;
@@ -2277,7 +2277,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2277
2277
  justify-content: space-between;
2278
2278
  align-items: center;
2279
2279
  gap: 8px;
2280
- `,qb=Nn(D)`
2280
+ `,qb=Nn(F)`
2281
2281
  transition: color 350ms ease, background-color 350ms ease;
2282
2282
  `,$b=Nn.div`
2283
2283
  height: 100%;
@@ -2289,7 +2289,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2289
2289
  display: flex;
2290
2290
  flex-direction: column;
2291
2291
  gap: 8px;
2292
- `;import{isHexString as Kb}from"@ethersproject/bytes";import{toUtf8String as Yb}from"@ethersproject/strings";import{useEffect as gy,useState as qs}from"react";import lo,{css as Jb}from"styled-components";import{Fragment as Cy,jsx as Re,jsxs as Dn}from"react/jsx-runtime";var Zb=e=>{if(!Kb(e))return e;try{return Yb(e)}catch{return e}},Qb=e=>JSON.stringify(e,null,2),Xb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Re(nE,{children:Object.entries(r).map(([o,n])=>Dn("li",{children:[Dn("strong",{children:[o,":"]})," ",t(n)]},o))}):Re("span",{children:String(r)});return Re("div",{children:t(e)})},eE=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Dn(Cy,{children:[Re(wy,{children:Re(Xb,{data:o})}),Re(eo,{text:Qb(e.typedData),itemName:"full payload to clipboard"})," "]})},vy=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=_(),[i,l]=qs(!0),[s,d]=qs(""),[u,y]=qs(),[f,g]=qs(null),E=f!==null;gy(()=>{e||o("LANDING")},[e]),gy(()=>{t(Fo).then(F=>{l(!1),F||(d("An error has occurred, please try again."),y(new Se(new Rt(s,Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:S,confirmAndSign:C,onSuccess:P,onFailure:I,uiOptions:M}=n.signMessage,k={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},U=F=>{F?P(F):I(u||new Se(new Rt("The user rejected the request.",Ke.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),d(""),y(void 0)};return a.current=()=>{U(f)},Dn(Cy,{children:[Re(A,{onClose:()=>U(f)}),Re(j,{}),Dn(tE,{children:[Re(rE,{children:k.title}),Re(oE,{children:k.description}),v==="personal_sign"&&Re(wy,{children:Zb(S)}),v==="eth_signTypedData_v4"&&Re(eE,{typedData:S}),Re(iE,{fail:!0,children:s}),Re(sE,{success:E,loading:i,disabled:E,onClick:async()=>{try{let F=await C();g(F),d(""),setTimeout(()=>{U(F)},Oe)}catch{d("An error has occurred, please try again."),y(new Se(new Rt(s,Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:E?Dn(aE,{children:[Re(ns,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Re("span",{children:"Success"})]}):k.buttonText})]}),Re(re,{}),Re(V,{protectedByPrivy:!0})]})},tE=lo.div`
2292
+ `;import{isHexString as Kb}from"@ethersproject/bytes";import{toUtf8String as Yb}from"@ethersproject/strings";import{useEffect as gy,useState as qs}from"react";import lo,{css as Jb}from"styled-components";import{Fragment as Cy,jsx as Re,jsxs as Dn}from"react/jsx-runtime";var Zb=e=>{if(!Kb(e))return e;try{return Yb(e)}catch{return e}},Qb=e=>JSON.stringify(e,null,2),Xb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Re(nE,{children:Object.entries(r).map(([o,n])=>Dn("li",{children:[Dn("strong",{children:[o,":"]})," ",t(n)]},o))}):Re("span",{children:String(r)});return Re("div",{children:t(e)})},eE=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Dn(Cy,{children:[Re(wy,{children:Re(Xb,{data:o})}),Re(eo,{text:Qb(e.typedData),itemName:"full payload to clipboard"})," "]})},vy=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=_(),[i,l]=qs(!0),[s,d]=qs(""),[u,y]=qs(),[f,g]=qs(null),E=f!==null;gy(()=>{e||o("LANDING")},[e]),gy(()=>{t(Fo).then(U=>{l(!1),U||(d("An error has occurred, please try again."),y(new Se(new Rt(s,Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:S,confirmAndSign:C,onSuccess:P,onFailure:R,uiOptions:M}=n.signMessage,k={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=U=>{U?P(U):R(u||new Se(new Rt("The user rejected the request.",Ke.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),d(""),y(void 0)};return a.current=()=>{B(f)},Dn(Cy,{children:[Re(A,{onClose:()=>B(f)}),Re(j,{}),Dn(tE,{children:[Re(rE,{children:k.title}),Re(oE,{children:k.description}),v==="personal_sign"&&Re(wy,{children:Zb(S)}),v==="eth_signTypedData_v4"&&Re(eE,{typedData:S}),Re(iE,{fail:!0,children:s}),Re(sE,{success:E,loading:i,disabled:E,onClick:async()=>{try{let U=await C();g(U),d(""),setTimeout(()=>{B(U)},Oe)}catch{d("An error has occurred, please try again."),y(new Se(new Rt(s,Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:E?Dn(aE,{children:[Re(ns,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Re("span",{children:"Success"})]}):k.buttonText})]}),Re(re,{}),Re(V,{protectedByPrivy:!0})]})},tE=lo.div`
2293
2293
  display: flex;
2294
2294
  flex-direction: column;
2295
2295
  align-items: center;
@@ -2356,7 +2356,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2356
2356
  display: flex;
2357
2357
  align-items: center;
2358
2358
  gap: 8px;
2359
- `,sE=lo(D)`
2359
+ `,sE=lo(F)`
2360
2360
  transition: color 350ms ease, background-color 350ms ease;
2361
2361
 
2362
2362
  ${e=>e.success&&Jb`
@@ -2365,7 +2365,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2365
2365
  color: #ffffff;
2366
2366
  }
2367
2367
  `}
2368
- `;import mE from"@heroicons/react/24/outline/EnvelopeIcon";import lE from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as cE,useState as by}from"react";import Ty from"styled-components";import{Fragment as uE,jsx as Ni,jsxs as Ey}from"react/jsx-runtime";var Py=cE((e,t)=>{let[r,o]=by(""),[n,a]=by(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=W(),{navigate:d,setModalData:u,currentScreen:y}=_(),{enabled:f,token:g}=ue(),E=Zi(r),v=n,S=n||!E,C=async I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,I),d("AWAITING_PASSWORDLESS_CODE")}catch(M){u({errorModalData:{error:M,previousScreen:y||"LANDING"}})}a(!1)},P=()=>{f&&!g&&!i?(u({captchaModalData:{callback:I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,I)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):C(g)};return Ey(uE,{children:[Ni(dE,{children:Ey(pE,{children:[Ni(lE,{}),Ni("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:I=>o(I.target.value),onKeyUp:I=>{I.key==="Enter"&&P()},value:r,autoComplete:"email"}),e.stacked?null:Ni(Qo,{isSubmitting:v,onClick:P,disabled:S,children:"Submit"})]})}),e.stacked?Ni(D,{loadingText:null,loading:v,disabled:S,onClick:P,children:"Submit"}):null]})}),dE=Ty.div`
2368
+ `;import mE from"@heroicons/react/24/outline/EnvelopeIcon";import lE from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as cE,useState as by}from"react";import Ty from"styled-components";import{Fragment as uE,jsx as Ni,jsxs as Ey}from"react/jsx-runtime";var Py=cE((e,t)=>{let[r,o]=by(""),[n,a]=by(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=W(),{navigate:d,setModalData:u,currentScreen:y}=_(),{enabled:f,token:g}=fe(),E=Zi(r),v=n,S=n||!E,C=async R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,R),d("AWAITING_PASSWORDLESS_CODE")}catch(M){u({errorModalData:{error:M,previousScreen:y||"LANDING"}})}a(!1)},P=()=>{f&&!g&&!i?(u({captchaModalData:{callback:R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,R)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):C(g)};return Ey(uE,{children:[Ni(dE,{children:Ey(pE,{children:[Ni(lE,{}),Ni("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&P()},value:r,autoComplete:"email"}),e.stacked?null:Ni(Qo,{isSubmitting:v,onClick:P,disabled:S,children:"Submit"})]})}),e.stacked?Ni(F,{loadingText:null,loading:v,disabled:S,onClick:P,children:"Submit"}):null]})}),dE=Ty.div`
2369
2369
  width: 100%;
2370
2370
  `,pE=Ty.label`
2371
2371
  display: block;
@@ -2749,4 +2749,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
2749
2749
  opacity: 1;
2750
2750
  }
2751
2751
  }
2752
- `;import{jsx as Ge,jsxs as Ry}from"react/jsx-runtime";var TE={["LANDING"]:$f,["CONNECT_OR_CREATE"]:zf,["AWAITING_PASSWORDLESS_CODE"]:Au,["AWAITING_CONNECTION"]:ju,["AWAITING_CONNECT_ONLY_CONNECTION"]:Zu,["AWAITING_FARCASTER_CONNECTION"]:ef,["AWAITING_FARCASTER_SIGNER"]:sf,["PHANTOM_INTERSTITIAL_SCREEN"]:cy,["LOGIN_FAILED_SCREEN"]:Xf,["AWAITING_OAUTH_SCREEN"]:iy,["ALLOWLIST_REJECTION_SCREEN"]:vu,["INSTALL_PHANTOM_SCREEN"]:bf,["LINK_EMAIL_SCREEN"]:jf,["LINK_PHONE_SCREEN"]:Kf,["LINK_WALLET_SCREEN"]:Yf,["UPDATE_EMAIL_SCREEN"]:Sy,["CONNECT_ONLY_LANDING_SCREEN"]:zu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Hu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Nm,["EMBEDDED_WALLET_CREATED_SCREEN"]:nm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:rm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Um,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:lm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:vy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:mf,["FIAT_ON_RAMP_STATUS_SCREEN"]:hf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Fm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Dm,["MFA_ENROLLMENT_FLOW_SCREEN"]:mh,["CAPTCHA_SCREEN"]:Mu,["ERROR_SCREEN"]:Bm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:yf,["AFFIRMATIVE_CONSENT_SCREEN"]:yu},PE=["LANDING","AWAITING_CONNECTION"],SE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=ue(),y=CE(null),f=ou(y),g=o&&i&&PE.includes(i)&&!n&&l==="ready";if(ky(()=>{g&&s()},[g]),ky(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ry(xn,{children:[Ge(A,{}),Ge(j,{}),Ge(rh,{children:Ge(ht,{})}),Ge(re,{}),Ge(Q,{})]});if(!i&&e)return Ge(xn,{style:{height:f},children:Ge("div",{ref:y,children:Ge(Zc,{open:e,onClose:t})})});if(!i)return null;let E=TE[i];return Ge(xn,{style:{height:f},children:Ry("div",{ref:y,children:[Ge(kr,{if:!!e,children:Ge(E,{})}),Ge(kr,{if:!e,children:Ge(Zc,{open:e,onClose:t})})]})})},xE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:wE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Iy=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=xE(),[o,n]=bE(!1);Sl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Ay,{children:Ge(SE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(th,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return EE.createPortal(l,s)}return l};import{useState as _E}from"react";import{useEffect as My,useRef as Wy}from"react";var $s=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:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Wo(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new fe("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new fe("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new fe("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as WE}from"react/jsx-runtime";var AE=function(e){return()=>`id-${e++}`}(0);function kE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new $s,ed=new Map,RE=(e,t)=>typeof t=="bigint"?t.toString():t,IE=(e,t)=>`${e}${JSON.stringify(t,RE)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=IE(e,t);if(e==="privy:wallet:create"){let l=ed.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=AE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{ed.delete(a)});return ed.set(a,i),i}function ME(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new fe(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new fe(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new fe(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new fe(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new fe(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new fe(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new fe(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new fe(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ly(e){let t=Wy(null),r=Wy(e.mfaMethods),o=au(),[n,a]=_E(!1);return My(()=>{r.current=e.mfaMethods},[e.mfaMethods]),My(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&kE(f.data)&&ME(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Qd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),WE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Qi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function js(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Ks=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set when initialzing authentication.");try{await this.api.post(Id,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ce(t)}}async authenticate(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Mfa flow has no API instance");if(!this.meta.smsCode)throw new x("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Md,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return bt(t)}catch(t){throw ce(t)}}};import{jsx as Tr,jsxs as Oy}from"react/jsx-runtime";var Un;function DE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=de.get(fo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Ny,gp=(e,t)=>Ny(e,t),Dy,vp=(e,t)=>Dy(e,t),Fy,wp=(e,t)=>Fy(e,t),Uy,Cp=()=>Uy(),FE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;de.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},UE=({config:e,...t})=>{if(!DE(t.appId))throw new x("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Xn({appId:t.appId,apiUrl:t.apiUrl||ji}));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."),Tr(jp,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Tr(BE,{...t,config:r,client:Un})})},BE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,S]=Me(null),[C,P]=Me(!1),[I,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,U]=Me(null),[F,H]=Me(null),[T,q]=Me(null),O=_a(),K=Aa(),[ie,te]=Me(!0),[ee,z]=Me({}),[Pe,we]=Me(null),[Pr,gt]=Me(null),[Ae,he]=Me(!1),[vt,Bt]=Me(!1),Dr=Fn(null),rr=Fn(null),L=Fn(nu);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let Y=Fn(null),Z=Fn(null),Bn=OE(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{S(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&te(!0),$(c)};Nr(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Nr(()=>{T&&Pr?.(T)},[T]),Nr(()=>{(async()=>{if(!O.customAuth?.enabled)return;te(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h){await Lo.logout();return}if(i)return;t.startAuthFlow(new No(h));let{user:R,isNewUser:B}=await t.authenticate();R||await Lo.logout(),d(R||null),E(B||!1),l(!0),Bt(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Nr(()=>{vt&&T&&s&&kt(s,e.config?.embeddedWallets?.createOnLogin)&&(Bt(!1),nr(s,Fo).catch(console.error))},[vt&&T&&s]),Nr(()=>{async function c(){let p=ut();FE();let m=LE();U(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Js()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ye.setReadyToTrue(),p&&(h?Z.current="link":Z.current="login")}!n&&K&&c()},[t,Pe,n,K]);let ut=()=>{let c=$n();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ar(c)),We("AWAITING_OAUTH_SCREEN"),!0)},po=async(c,p,m,h)=>{let R=await t.connectors?.createWalletConnector(c,p)||null;Ht(R,p,m,h)};async function Ht(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof dr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ht(c,p,m,h)});try{let R=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(B=>B.id===Number(R?.chainId))&&!(R?.connectorType==="wallet_connect_v2"&&R?.walletClientType==="metamask")){M(B=>({...B,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await R?.switchChain(O.defaultChain.id),R&&(R.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(B=>({...B,status:"connected",connectedWallet:R,connectError:null,connectRetry:b})),R&&!Z.current&&N(L,"connectWallet","onSuccess",R),h?.(R,m)}catch(R){return R instanceof $e?(console.warn(R.cause?R.cause:R.message),Z.current||N(L,"connectWallet","onError",R.privyErrorCode||"generic_connect_wallet_error")):(console.warn(R),Z.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(B=>({...B,status:"disconnected",connectedWallet:null,connectError:R})),h?.(null,m)}}let uo=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Js=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Br()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new x("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),po(p,m,void 0,uo)};Nr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new x("User must be authenticated before linking an account.")},mo=()=>{Le(),Y.current="siwe",Z.current="link",$("LINK_WALLET_SCREEN")},wt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new x("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>uo(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await uo(c),We("AWAITING_CONNECTION")},or=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new x("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await pf(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new x("Unsupported fund provider. Currently supported option is `moonpay`.")},Fr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:wt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new x("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:R,externalTransactionId:B}=await or(m.address,h);z({fiatOnRampPrompt:{signedUrl:R},fiatOnRampStatus:{externalTransactionId:B}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new x("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return he(Bn(p)),aa(c,p)?c:p})};Nr(()=>{Fr()},[s?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new x("Connector not initialized");Fr(),t.connectors.on("walletsUpdated",Fr)}},[n]);let Di=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let nr=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,R]=await Promise.all([ye.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!R||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((B,ge)=>{te(!0),z({createWallet:{onSuccess:mt=>{N(L,"createWallet","onSuccess",mt),B(mt)},onFailure:mt=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),ge(mt)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:R});let B=await ye.refreshUser(),ge=Ce(B);if(!ge)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",ge),ge}},Zs=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new J(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},rd=(c,p,m)=>new Promise(async(h,R)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),R(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=Ce(s);if(!B){N(L,"sendTransaction","onError","embedded_wallet_not_found"),R(new Error("Must have a Privy wallet before signing"));return}te(!0);let ge=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,tt=c.chainId?Number(c.chainId):ge.chainId;Zs(tt);let mt=Object.assign({},c,{chainId:tt}),Sr=async()=>{let rt=await ve();if(!rt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),R(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ye.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),R(new Error("Unable to connect to wallet"));return}let zt=_r(mt.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Qs=await Ln(B.address,mt,zt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:zy}=await Wn(Qs,zt),{hasSufficientFunds:qy}=await Hs(B.address,Qs,zy,zt);if(!qy)throw new Se(new Rt("Wallet has insufficient funds for this transaction.",Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let id=await Bs(rt,B.address,T,Qs,zt);N(L,"sendTransaction","onSuccess",id),h(id)}catch(Vt){N(L,"sendTransaction","onError","transaction_failure"),R(Vt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Sr();else{let rt={transactionRequest:mt,onSuccess:zt=>{N(L,"sendTransaction","onSuccess",zt),h(zt)},onFailure:zt=>{N(L,"sendTransaction","onError","transaction_failure"),R(zt)},uiOptions:p||{},fundWalletConfig:m},Vt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:zt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),R(zt)}};z({connectWallet:Vt,sendTransaction:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function od(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Gt=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Di,linkWallet:mo,linkEmail:()=>{Le(),Gt("email"),Y.current="email",Z.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Gt("phone"),Y.current="sms",Z.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Gt("google"),Z.current="link",await ye.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Gt("twitter"),Z.current="link",await ye.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Gt("discord"),Z.current="link",await ye.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Gt("github"),Z.current="link",await ye.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Gt("spotify"),Z.current="link",await ye.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Gt("tiktok"),Z.current="link",await ye.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Gt("linkedin"),Z.current="link",await ye.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Gt("apple"),Z.current="link",await ye.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Gt("farcaster"),await ye.initLoginWithFarcaster(),Z.current="link",Y.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new x("User does not have an email linked to their account.");Z.current="link",Y.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Z.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}We("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),s&&T&&await T.clearMfa({userId:s.id}),d(null),l(!1),S(null),N(L,"logout","onSuccess"),Z.current=null,Y.current=null,o(!1),de.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new td(new sr(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new td(new sr(new be)):new td(new sr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Vr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Vr(new be):new Vr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ys(h.address)===Ys(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ys(h.address)===Ys(c));if(!p||!await p.isConnected())H(c),mo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return nr(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await od()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{te(!0);let h={onSuccess:B=>{N(L,"setWalletPassword","onSuccess",B),p(B)},onFailure:B=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(B)},callAuthOnSuccessOnClose:!1},R={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:B=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(B)}};z({setWalletPassword:h,connectWallet:R}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let R=Ce(s);if(!R){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}te(!0);let B=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let ge=await ve();if(!T||!ge)throw new Error("Unable to connect to wallet");if(!await ye.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:R.address});let{response:mt}=await T.rpc({accessToken:ge,address:R.address,request:{method:"personal_sign",params:[c,R.address]}}),Sr=mt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:R.address}),Sr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ge=await B();N(L,"signMessage","onSuccess",ge),m(ge)}catch(ge){N(L,"signMessage","onError","unable_to_sign"),h(ge??new Se("Unable to sign message"))}}else{let mt={method:"personal_sign",data:c,confirmAndSign:B,onSuccess:rt=>{N(L,"signMessage","onSuccess",rt),m(rt)},onFailure:rt=>{N(L,"signMessage","onError","unable_to_sign"),h(rt)},uiOptions:p||{}},Sr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:rt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(rt)}};z({signMessage:mt,connectWallet:Sr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let R=Ce(s);if(!R){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}te(!0);let B=ea(c),ge=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let tt=await ve();if(!T||!tt)throw new Error("Unable to connect to wallet");if(!await ye.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:R.address});let{response:Sr}=await T.rpc({accessToken:tt,address:R.address,request:{method:"eth_signTypedData_v4",params:[R.address,B]}}),rt=Sr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:R.address}),rt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let tt=await ge();N(L,"signTypedData","onSuccess",tt),m(tt)}catch(tt){N(L,"signTypedData","onError","unable_to_sign"),h(tt??new Se("Unable to sign message"))}}else{let Sr={method:"eth_signTypedData_v4",data:B,confirmAndSign:ge,onSuccess:Vt=>{N(L,"signTypedData","onSuccess",Vt),m(Vt)},onFailure:Vt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Vt)},uiOptions:p||{}},rt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Vt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Vt)}};z({signMessage:Sr,connectWallet:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let R=await(await rd(c,p,m)).wait();return Gs(R)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}te(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},R=await ve();if(!R||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:R,address:m.address}),await T.verifyMfa({accessToken:R})}catch(ge){if(xo(ge))await ye.recoverEmbeddedWallet();else throw ge}}catch(ge){p(ge);return}let B={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:B,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:od,async init(c){let p;switch(c){case"sms":p=new Ks("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Dr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{rr.current={resolve:m,reject:h}});break;default:throw Dr.current?.reject(new x("Unsupported MFA method")),new x(`Unsupported MFA method: ${c}`)}},cancel(){Dr.current?.reject(new x("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ye.closePrivyModal(),p();return}O.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."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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");let m=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(m.status==="approved"){let h=await t.getAuthenticatedUser();d(h||s||null)}z({farcasterSigner:m}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(B=>B.type==="wallet"&&B.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(B=>B.type==="wallet"&&B.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ye.loginWithCode(c)},initLoginWithEmail(c){return ye.initLoginWithEmail(c)},initLoginWithSms(c){return ye.initLoginWithSms(c)},fundWallet(c,p){return ye.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ye.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ye.loginWithHeadlessOAuth(c)},isModalOpen:r};Ny=Lo.signMessage,Dy=Lo.signTypedData,Fy=async(...c)=>{let p=await rd(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let nd=!!e.config?.headless,ye=(()=>({headless:nd,isNewUserThisSession:g,linkingHint:F,pendingTransaction:null,walletConnectionStatus:I,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(R=>{gt(()=>B=>R(B))}),m=new Promise(R=>setTimeout(()=>R(null),c)),h=await Promise.race([p,m]);return gt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Z.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,Y.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Z.current==="link"&&Y.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,Y.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Z.current=null,Y.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Ht,initLoginWithWallet:async(c,p)=>{Y.current="siwe",uo(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new x("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),Y.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new zn(c);t.startAuthFlow(p);try{Y.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Z.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof zn))throw new x("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),Y.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(Y.current=c,ol()){if(c==="google"&&js(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new ar({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ar))throw new x("Must initialize OAuth flow before calling loginWithOAuth");let p=je.get(ho),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new x("Unexpected auth flow. This may be a phishing attempt.");let h,R;if(i)try{h=await t.link(),Y.current=c}catch(B){throw N(L,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:h,isNewUser:R}=await t.authenticate()),Y.current=c}catch(B){throw Z.current==="login"?N(L,"login","onError",B.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}d(h),E(R||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(ol()){if(c==="google"&&js(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new ar({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ar(c));let p=je.get(ho),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new x("Unexpected auth flow. This may be a phishing attempt.");let h,R;if(i)try{h=await t.link(),Y.current=c.provider}catch(B){throw N(L,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:h,isNewUser:R}=await t.authenticate()),Y.current=c.provider}catch(B){throw Z.current==="login"?N(L,"login","onError",B.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return d(h),E(R||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Ur(c,p);t.startAuthFlow(m);try{Y.current="email",await m.sendCodeEmail()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new zi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{Y.current="sms",await m.sendSmsCode()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Ur)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new x("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}te(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(R){xo(R)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):xo(R)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(R)}}),getFiatOnRampConfig:or,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Fr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await or(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(R=>R.type==="wallet"&&R.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let R=await t.getAuthenticatedUser();d(R||s||null)}return h}}))();Uy=ye.recoverEmbeddedWallet;let Vy=NE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Tr(ae.Provider,{value:Lo,children:Tr(Pl.Provider,{value:L,children:Tr(jc.Provider,{value:Vy,children:Oy(tu,{...O,children:[e.children,Oy(Tl.Provider,{value:ye,children:[!nd&&O.captchaEnabled&&n&&!i&&Tr(El,{delayedExecution:!1}),Tr(_y,{theme:{...O.appearance.palette||{}}}),Tr(Yp,{data:ee,setModalData:z,setInitialScreen:S,initialScreen:v,authenticated:i,open:r,children:Tr(Iy,{open:r})}),ie&&K?Tr(Ly,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Dr,mfaSubmitPromise:rr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as HE}from"react";function GE(e){let{login:t}=HE(ae);return Ee("login",e),{login:t}}import{useContext as VE}from"react";function zE(e){let{logout:t}=VE(ae);return Ee("logout",e),{logout:t}}import{useCallback as By,useEffect as qE}from"react";function $E(){let e=ue(),t=Aa(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=By(async d=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=By(async()=>{let d=$n();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{jn()}},[o]);return qE(()=>{let d=$n();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Hy}from"react";var jE=()=>{let e=ue(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Hy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Hy(async({code:a})=>{if(e.enabled&&e.status==="error")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Gy}from"react";var KE=()=>{let e=ue(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Gy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Gy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as YE}from"react";function JE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=YE(ae);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as ZE}from"react";function QE(e){let{connectWallet:t}=ZE(ae);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as XE}from"react";function e4(e){let{createWallet:t}=XE(ae);return Ee("createWallet",e),{createWallet:t}}var t4=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as r4}from"react";function o4(e){let{sendTransaction:t}=r4(ae);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as n4}from"react";function i4(e){let{setWalletPassword:t}=n4(ae);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as a4}from"react";function s4(e){let{signMessage:t}=a4(ae);return Ee("signMessage",e),{signMessage:t}}import{useContext as l4}from"react";function c4(e){let{signTypedData:t}=l4(ae);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as d4}from"react";var p4=()=>{let{isModalOpen:e}=d4(ae);return{isOpen:e}};import{useContext as u4}from"react";function m4(e){let{getAccessToken:t}=u4(ae);return Ee("accessToken",e),{getAccessToken:t}}function f4(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function h4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{sr as AsExternalProvider,El as Captcha,Qn as ConnectorManager,Xn as PrivyClient,UE as PrivyProvider,be as PrivyProxyProvider,Jn as SUPPORTED_CHAINS,sl as VERSION,ft as WalletConnector,h4 as addRpcUrlOverrideToChain,Zl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,QE as useConnectWallet,e4 as useCreateWallet,f4 as useExperimentalFarcasterSigner,t4 as useFundWallet,JE as useLinkAccount,GE as useLogin,jE as useLoginWithEmail,$E as useLoginWithOAuth,KE as useLoginWithSms,zE as useLogout,An as useMfa,_i as useMfaEnrollment,p4 as useModalStatus,G as usePrivy,Sl as useRegisterMfaListener,o4 as useSendTransaction,i4 as useSetWalletPassword,s4 as useSignMessage,c4 as useSignTypedData,m4 as useToken,Li as useWallets};
2752
+ `;import{jsx as Ge,jsxs as Ry}from"react/jsx-runtime";var TE={["LANDING"]:$f,["CONNECT_OR_CREATE"]:zf,["AWAITING_PASSWORDLESS_CODE"]:Au,["AWAITING_CONNECTION"]:ju,["AWAITING_CONNECT_ONLY_CONNECTION"]:Zu,["AWAITING_FARCASTER_CONNECTION"]:ef,["AWAITING_FARCASTER_SIGNER"]:sf,["PHANTOM_INTERSTITIAL_SCREEN"]:cy,["LOGIN_FAILED_SCREEN"]:Xf,["AWAITING_OAUTH_SCREEN"]:iy,["ALLOWLIST_REJECTION_SCREEN"]:vu,["INSTALL_PHANTOM_SCREEN"]:bf,["LINK_EMAIL_SCREEN"]:jf,["LINK_PHONE_SCREEN"]:Kf,["LINK_WALLET_SCREEN"]:Yf,["UPDATE_EMAIL_SCREEN"]:Sy,["CONNECT_ONLY_LANDING_SCREEN"]:zu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Hu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Nm,["EMBEDDED_WALLET_CREATED_SCREEN"]:nm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:rm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Um,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:lm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:vy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:mf,["FIAT_ON_RAMP_STATUS_SCREEN"]:hf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Fm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Dm,["MFA_ENROLLMENT_FLOW_SCREEN"]:mh,["CAPTCHA_SCREEN"]:Mu,["ERROR_SCREEN"]:Bm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:yf,["AFFIRMATIVE_CONSENT_SCREEN"]:yu},PE=["LANDING","AWAITING_CONNECTION"],SE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=CE(null),f=ou(y),g=o&&i&&PE.includes(i)&&!n&&l==="ready";if(ky(()=>{g&&s()},[g]),ky(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ry(xn,{children:[Ge(A,{}),Ge(j,{}),Ge(rh,{children:Ge(ht,{})}),Ge(re,{}),Ge(Q,{})]});if(!i&&e)return Ge(xn,{style:{height:f},children:Ge("div",{ref:y,children:Ge(Zc,{open:e,onClose:t})})});if(!i)return null;let E=TE[i];return Ge(xn,{style:{height:f},children:Ry("div",{ref:y,children:[Ge(kr,{if:!!e,children:Ge(E,{})}),Ge(kr,{if:!e,children:Ge(Zc,{open:e,onClose:t})})]})})},xE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:wE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Iy=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=xE(),[o,n]=bE(!1);Sl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Ay,{children:Ge(SE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(th,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return EE.createPortal(l,s)}return l};import{useState as _E}from"react";import{useEffect as My,useRef as Wy}from"react";var $s=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:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Wo(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as WE}from"react/jsx-runtime";var AE=function(e){return()=>`id-${e++}`}(0);function kE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new $s,ed=new Map,RE=(e,t)=>typeof t=="bigint"?t.toString():t,IE=(e,t)=>`${e}${JSON.stringify(t,RE)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=IE(e,t);if(e==="privy:wallet:create"){let l=ed.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=AE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{ed.delete(a)});return ed.set(a,i),i}function ME(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ly(e){let t=Wy(null),r=Wy(e.mfaMethods),o=au(),[n,a]=_E(!1);return My(()=>{r.current=e.mfaMethods},[e.mfaMethods]),My(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&kE(f.data)&&ME(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Qd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),WE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Qi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function js(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Ks=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set when initialzing authentication.");try{await this.api.post(Id,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Mfa flow has no API instance");if(!this.meta.smsCode)throw new x("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Md,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return bt(t)}catch(t){throw pe(t)}}};import{jsx as Tr,jsxs as Oy}from"react/jsx-runtime";var Un;function DE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=ue.get(fo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Ny,gp=(e,t)=>Ny(e,t),Dy,vp=(e,t)=>Dy(e,t),Fy,wp=(e,t)=>Fy(e,t),Uy,Cp=()=>Uy(),FE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ue.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},UE=({config:e,...t})=>{if(!DE(t.appId))throw new x("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Xn({appId:t.appId,apiUrl:t.apiUrl||ji}));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."),Tr(jp,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Tr(BE,{...t,config:r,client:Un})})},BE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,S]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=_a(),K=Aa(),[ae,te]=Me(!0),[ee,z]=Me({}),[Pe,we]=Me(null),[Pr,gt]=Me(null),[Ae,ge]=Me(!1),[vt,Bt]=Me(!1),Dr=Fn(null),rr=Fn(null),L=Fn(nu);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let Y=Fn(null),Z=Fn(null),Bn=OE(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{S(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&te(!0),$(c)};Nr(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Nr(()=>{T&&Pr?.(T)},[T]),Nr(()=>{(async()=>{if(!O.customAuth?.enabled)return;te(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h){await Lo.logout();return}if(i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();I||await Lo.logout(),d(I||null),E(D||!1),l(!0),Bt(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Nr(()=>{vt&&T&&s&&kt(s,e.config?.embeddedWallets?.createOnLogin)&&(Bt(!1),nr(s,Fo).catch(console.error))},[vt&&T&&s]),Nr(()=>{async function c(){let p=ut();FE();let m=LE();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Js()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ne.setReadyToTrue(),p&&(h?Z.current="link":Z.current="login")}!n&&K&&c()},[t,Pe,n,K]);let ut=()=>{let c=$n();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ar(c)),We("AWAITING_OAUTH_SCREEN"),!0)},po=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Ht(I,p,m,h)};async function Ht(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof dr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ht(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Z.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Z.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Z.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let uo=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Js=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Br()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new x("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),po(p,m,void 0,uo)};Nr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new x("User must be authenticated before linking an account.")},mo=()=>{Le(),Y.current="siwe",Z.current="link",$("LINK_WALLET_SCREEN")},wt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new x("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>uo(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await uo(c),We("AWAITING_CONNECTION")},or=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new x("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await pf(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new x("Unsupported fund provider. Currently supported option is `moonpay`.")},Fr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:wt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new x("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await or(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new x("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Bn(p)),aa(c,p)?c:p})};Nr(()=>{Fr()},[s?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new x("Connector not initialized");Fr(),t.connectors.on("walletsUpdated",Fr)}},[n]);let Di=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let nr=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ne.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,se)=>{te(!0),z({createWallet:{onSuccess:mt=>{N(L,"createWallet","onSuccess",mt),D(mt)},onFailure:mt=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),se(mt)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ne.refreshUser(),se=Ce(D);if(!se)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",se),se}},Zs=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new J(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},rd=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=Ce(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}te(!0);let se=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,tt=c.chainId?Number(c.chainId):se.chainId;Zs(tt);let mt=Object.assign({},c,{chainId:tt}),Sr=async()=>{let rt=await ve();if(!rt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ne.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let zt=_r(mt.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Qs=await Ln(D.address,mt,zt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:zy}=await Wn(Qs,zt),{hasSufficientFunds:qy}=await Hs(D.address,Qs,zy,zt);if(!qy)throw new Se(new Rt("Wallet has insufficient funds for this transaction.",Ke.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let id=await Bs(rt,D.address,T,Qs,zt);N(L,"sendTransaction","onSuccess",id),h(id)}catch(Vt){N(L,"sendTransaction","onError","transaction_failure"),I(Vt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Sr();else{let rt={transactionRequest:mt,onSuccess:zt=>{N(L,"sendTransaction","onSuccess",zt),h(zt)},onFailure:zt=>{N(L,"sendTransaction","onError","transaction_failure"),I(zt)},uiOptions:p||{},fundWalletConfig:m},Vt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:zt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(zt)}};z({connectWallet:Vt,sendTransaction:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function od(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Gt=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Di,linkWallet:mo,linkEmail:()=>{Le(),Gt("email"),Y.current="email",Z.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Gt("phone"),Y.current="sms",Z.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Gt("google"),Z.current="link",await ne.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Gt("twitter"),Z.current="link",await ne.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Gt("discord"),Z.current="link",await ne.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Gt("github"),Z.current="link",await ne.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Gt("spotify"),Z.current="link",await ne.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Gt("tiktok"),Z.current="link",await ne.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Gt("linkedin"),Z.current="link",await ne.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Gt("apple"),Z.current="link",await ne.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Gt("farcaster"),await ne.initLoginWithFarcaster(),Z.current="link",Y.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new x("User does not have an email linked to their account.");Z.current="link",Y.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Z.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}We("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),s&&T&&await T.clearMfa({userId:s.id}),d(null),l(!1),S(null),N(L,"logout","onSuccess"),Z.current=null,Y.current=null,o(!1),ue.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new td(new sr(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new td(new sr(new be)):new td(new sr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Vr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Vr(new be):new Vr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ys(h.address)===Ys(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ys(h.address)===Ys(c));if(!p||!await p.isConnected())H(c),mo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return nr(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await od()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{te(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}te(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let se=await ve();if(!T||!se)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:mt}=await T.rpc({accessToken:se,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Sr=mt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Sr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let se=await D();N(L,"signMessage","onSuccess",se),m(se)}catch(se){N(L,"signMessage","onError","unable_to_sign"),h(se??new Se("Unable to sign message"))}}else{let mt={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:rt=>{N(L,"signMessage","onSuccess",rt),m(rt)},onFailure:rt=>{N(L,"signMessage","onError","unable_to_sign"),h(rt)},uiOptions:p||{}},Sr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:rt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(rt)}};z({signMessage:mt,connectWallet:Sr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}te(!0);let D=ea(c),se=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let tt=await ve();if(!T||!tt)throw new Error("Unable to connect to wallet");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Sr}=await T.rpc({accessToken:tt,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),rt=Sr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),rt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let tt=await se();N(L,"signTypedData","onSuccess",tt),m(tt)}catch(tt){N(L,"signTypedData","onError","unable_to_sign"),h(tt??new Se("Unable to sign message"))}}else{let Sr={method:"eth_signTypedData_v4",data:D,confirmAndSign:se,onSuccess:Vt=>{N(L,"signTypedData","onSuccess",Vt),m(Vt)},onFailure:Vt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Vt)},uiOptions:p||{}},rt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Vt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Vt)}};z({signMessage:Sr,connectWallet:rt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await rd(c,p,m)).wait();return Gs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}te(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(se){if(xo(se))await ne.recoverEmbeddedWallet();else throw se}}catch(se){p(se);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:od,async init(c){let p;switch(c){case"sms":p=new Ks("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Dr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{rr.current={resolve:m,reject:h}});break;default:throw Dr.current?.reject(new x("Unsupported MFA method")),new x(`Unsupported MFA method: ${c}`)}},cancel(){Dr.current?.reject(new x("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ne.closePrivyModal(),p();return}O.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."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(se=>se.type==="wallet"&&se.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(se=>se.type==="wallet"&&se.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ne.loginWithCode(c)},initLoginWithEmail(c){return ne.initLoginWithEmail(c)},initLoginWithSms(c){return ne.initLoginWithSms(c)},fundWallet(c,p){return ne.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ne.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ne.loginWithHeadlessOAuth(c)},isModalOpen:r};Ny=Lo.signMessage,Dy=Lo.signTypedData,Fy=async(...c)=>{let p=await rd(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let nd=!!e.config?.headless,ne=(()=>({headless:nd,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{gt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return gt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Z.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,Y.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Z.current==="link"&&Y.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,Y.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Z.current=null,Y.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Ht,initLoginWithWallet:async(c,p)=>{Y.current="siwe",uo(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new x("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),Y.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new zn(c);t.startAuthFlow(p);try{Y.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Z.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof zn))throw new x("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),Y.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Y.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(Y.current=c,ol()){if(c==="google"&&js(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new ar({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ar))throw new x("Must initialize OAuth flow before calling loginWithOAuth");let p=je.get(ho),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new x("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Y.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Y.current=c}catch(D){throw Z.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(ol()){if(c==="google"&&js(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new ar({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ar(c));let p=je.get(ho),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new x("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Y.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Y.current=c.provider}catch(D){throw Z.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Ur(c,p);t.startAuthFlow(m);try{Y.current="email",await m.sendCodeEmail()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new zi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{Y.current="sms",await m.sendSmsCode()}catch(h){throw Z.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Z.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Ur)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new x("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}te(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){xo(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):xo(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:or,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Fr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await or(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();Uy=ne.recoverEmbeddedWallet;let Vy=NE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Tr(le.Provider,{value:Lo,children:Tr(Pl.Provider,{value:L,children:Tr(jc.Provider,{value:Vy,children:Oy(tu,{...O,children:[e.children,Oy(Tl.Provider,{value:ne,children:[!nd&&O.captchaEnabled&&n&&!i&&Tr(El,{delayedExecution:!1}),Tr(_y,{theme:{...O.appearance.palette||{}}}),Tr(Yp,{data:ee,setModalData:z,setInitialScreen:S,initialScreen:v,authenticated:i,open:r,children:Tr(Iy,{open:r})}),ae&&K?Tr(Ly,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Dr,mfaSubmitPromise:rr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as HE}from"react";function GE(e){let{login:t}=HE(le);return Ee("login",e),{login:t}}import{useContext as VE}from"react";function zE(e){let{logout:t}=VE(le);return Ee("logout",e),{logout:t}}import{useCallback as By,useEffect as qE}from"react";function $E(){let e=fe(),t=Aa(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=By(async d=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=By(async()=>{let d=$n();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{jn()}},[o]);return qE(()=>{let d=$n();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Hy}from"react";var jE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Hy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Hy(async({code:a})=>{if(e.enabled&&e.status==="error")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Gy}from"react";var KE=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Gy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Gy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new $t(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as YE}from"react";function JE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=YE(le);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as ZE}from"react";function QE(e){let{connectWallet:t}=ZE(le);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as XE}from"react";function e4(e){let{createWallet:t}=XE(le);return Ee("createWallet",e),{createWallet:t}}var t4=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as r4}from"react";function o4(e){let{sendTransaction:t}=r4(le);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as n4}from"react";function i4(e){let{setWalletPassword:t}=n4(le);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as a4}from"react";function s4(e){let{signMessage:t}=a4(le);return Ee("signMessage",e),{signMessage:t}}import{useContext as l4}from"react";function c4(e){let{signTypedData:t}=l4(le);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as d4}from"react";var p4=()=>{let{isModalOpen:e}=d4(le);return{isOpen:e}};import{useContext as u4}from"react";function m4(e){let{getAccessToken:t}=u4(le);return Ee("accessToken",e),{getAccessToken:t}}function f4(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function h4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{sr as AsExternalProvider,El as Captcha,Qn as ConnectorManager,Xn as PrivyClient,UE as PrivyProvider,be as PrivyProxyProvider,Jn as SUPPORTED_CHAINS,sl as VERSION,ft as WalletConnector,h4 as addRpcUrlOverrideToChain,Zl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,QE as useConnectWallet,e4 as useCreateWallet,f4 as useExperimentalFarcasterSigner,t4 as useFundWallet,JE as useLinkAccount,GE as useLogin,jE as useLoginWithEmail,$E as useLoginWithOAuth,KE as useLoginWithSms,zE as useLogout,An as useMfa,_i as useMfaEnrollment,p4 as useModalStatus,G as usePrivy,Sl as useRegisterMfaListener,o4 as useSendTransaction,i4 as useSetWalletPassword,s4 as useSignMessage,c4 as useSignTypedData,m4 as useToken,Li as useWallets};