@privy-io/react-auth 1.75.0-beta-20240715213704 → 1.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +338 -436
- package/dist/index.d.ts +14 -4
- package/dist/index.js +330 -428
- package/package.json +4 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var ld=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Su=(e,t,r)=>(ld(e,t,"read from private field"),r?r.call(e):t.get(e)),vs=(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)},cd=(e,t,r,o)=>(ld(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Pu=(e,t,r)=>(ld(e,t,"access private method"),r);import{getAddress as Mo}from"@ethersproject/address";import{Web3Provider as gu}from"@ethersproject/providers";import{createStore as yS}from"mipd";import{useEffect as jr,useMemo as gS,useRef as la,useState as st}from"react";import{isAndroid as vS}from"react-device-detect";import{ProviderErrors as CS,calculateTotalGasEstimate as wS,populateTransactionRequest as bS}from"@privy-io/js-sdk-core";import{FetchError as m3}from"ofetch";var rt=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}]`:""}`}},Wt=class extends rt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},C=class extends rt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Cs=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var le=class extends rt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},se=e=>{if(e instanceof rt)return e;if(!(e instanceof m3))return lt(e);if(!e.response)return new Wt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Wt(t||"ApiError",e.response.status,r||o,e,n)},lt=e=>e instanceof rt?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var vo=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Lt=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ws=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Tr=class extends C{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var bs="/api/v1/sessions",Es="/api/v1/sessions/logout",_u="/api/v1/sessions/fork",Ts="/api/v1/sessions/fork/recover",xu="/api/v1/siwe/init",Au="/api/v1/siwe/authenticate",ku="/api/v1/siwe/link",Ru="/api/v1/siwe/unlink",Mu="/api/v1/farcaster/init",Iu="/api/v1/farcaster/authenticate",Wu="/api/v1/farcaster/link",Lu="/api/v1/farcaster/status",Ou="/api/v1/farcaster/unlink",Nu="/api/v1/passwordless/init",Du="/api/v1/passwordless/authenticate",Uu="/api/v1/passwordless/link",Fu="/api/v1/passwordless/unlink",Bu="/api/v1/passwordless/update",Hu="/api/v1/passwordless_sms/init",Vu="/api/v1/passwordless_sms/link",Gu="/api/v1/passwordless_sms/unlink",qu="/api/v1/passwordless_sms/authenticate",Ss="/api/v1/oauth/init",zu="/api/v1/oauth/authenticate",Ps="/api/v1/oauth/link",$u="/api/v1/oauth/unlink",Ku="/api/v1/recovery/oauth/init",ju="/api/v1/recovery/oauth/init_icloud",Yu="/api/v1/recovery/oauth/authenticate",Zu="/api/v1/passkeys/link/init",Qu="/api/v1/passkeys/authenticate/init",Ju="/api/v1/passkeys/link",Xu="/api/v1/passkeys/authenticate",em="/api/v1/passkeys/unlink",tm="/api/v1/telegram/authenticate",rm="/api/v1/telegram/link",om="/api/v1/telegram/unlink";var nm="/api/v1/mfa/passwordless_sms/init",im="/api/v1/mfa/passkeys/init",am="/api/v1/users/me/accept_terms",_s="/api/v1/analytics_events",sm="/api/v1/plugins/moonpay_on_ramp/sign",lm="/api/v1/custom_jwt_account/authenticate";var ai=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(lm,{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 se(t)}}async link(){throw new Error("Unimplemented")}};var Lo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Du,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw se(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Uu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw se(t)}}async sendCodeEmail(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{return await this.api.post(Nu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw se(o)}}},xs=class extends Lo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new C("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Bu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw se(r)}}};import{isMobile as h3,isIOS as y3}from"react-device-detect";var dd=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)}},As=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function pd(){try{let e="privy:__session_storage__test",t="blobby",r=new As;return r.put(e,t),r.del(e),!0}catch{return!1}}function f3(){return typeof window<"u"&&window.localStorage?new As:new dd}var J=f3();import{StaticJsonRpcProvider as ca}from"@ethersproject/providers";function cm(){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 ks=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 ud=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ks(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!ud(r))return!1}return!0},Oo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Rs=()=>{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 dm=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ms=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,}))$/),pm=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Ve=(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}`},md=e=>new Promise(t=>setTimeout(t,e));function um(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 da=(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(s=>{i=!0,n(s)},(...s)=>{i=!0,a(...s)}),l+=1,await md(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Is=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[i,l]of Object.entries(r))l!==void 0&&n.searchParams.set(i,l);let a=Object.entries(o);if(a.length>0){let i=new URLSearchParams;for(let[l,s]of a)i.append(l,s);n.hash=i.toString()}return n.href};var mm=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),hn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function fm(e,t,r,o=3e3){let n=!1,a=window;return new Promise(i=>{a.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let u of s)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||c.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of cm()){let h=ks(u);if(!s.some(m=>m.info.name===h)){if(ud(u,!0)&&!c.find(m=>m.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:u});continue}if(h==="Phantom"&&!c.find(m=>m.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:u});continue}if(h==="Coinbase Wallet"&&!c.find(m=>m.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}c.find(m=>m.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}i(c)}})}function si(e){return`eip155:${String(Number(e))}`}var hm=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new le(`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.public?.http[0]?i=a.rpcUrls.public.http[0]:i=a.rpcUrls.default?.http[0];if(!i)throw new le(`No RPC url found for ${e}`);return i},ym=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new le(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},ar=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new le(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new ca(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new ca(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new ca({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.public?.http[0]?i=new ca(a.rpcUrls.public.http[0]):i=new ca(a.rpcUrls.default?.http[0]),!i)throw new le(`No RPC url found for ${e}`);return i},pa=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 Ws=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ls))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ls={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function gm(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function vm(e,t){let r=gm(t);if(r.deepLink)return Sm(r.deepLink,e);if(r.universalLink)return fd(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function Cm(e,t){let r=gm(t);if(r.universalLink)return fd(r.universalLink,e)}var wm="WALLETCONNECT_DEEPLINK_CHOICE";function bm(){try{localStorage.removeItem(wm)}catch{}}function Em({href:e,name:t}){try{localStorage.setItem(wm,JSON.stringify({href:e,name:t}))}catch{}}function Tm(e){return e.startsWith("http://")||e.startsWith("https://")}function Sm(e,t){if(Tm(e))return fd(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 fd(e,t){if(!Tm(e))return Sm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Os(e,t){window.open(e,t,"noreferrer noopener")}var Le=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var ua=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Le(this._startChannelOnce.bind(this)),this.pollForReady=new Le(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(Iu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw se(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Wu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw se(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(Mu,{token:this.captchaToken});h3&&!y3&&t.connect_uri&&Os(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(Lu,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var Pm="1.75.0-beta-20240715213704";var _m="34357d3c125c2bcf2ce2bc3309d98715",Ns="https://auth.privy.io",xm=2e4,Oe=1400,Ds=2500,hd=Pm;var yn="privy:token",yd="privy-token",Us="privy:refresh_token",Am="privy-refresh-token",Fs="privy-session",ma="privy:session_transfer_token",v3="privy:wallet",fa="privy:caid",ha=e=>`privy:cross-app:${e}`,gn="privy:state_code",vn="privy:code_verifier",Cn="privy:headless_oauth",Bs=e=>`${v3}:${e}`,gd="privy:connectors",vd="privy:connections";var wn=12e4,Co=1,Cd="0x1",li=3e4,km="https://api.moonpay.com/v1",Rm="https://api.moonpay.com/v1",Mm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Im="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Wm="deprecated";import{base64url as Nm}from"jose";async function Lm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Om(e){return crypto.getRandomValues(new Uint8Array(e))}var C3="S256",w3="S256";function bn(){return Nm.encode(Om(36))}function ci(){return bn()}async function di(e,t=C3){if(t==w3){let r=await Lm(e);return Nm.encode(r)}else return e}function Dm(){let e=J.get(vn);if(!e)throw new C("Authentication error.");return e}function Hs(){return!!J.get(Cn)}var Jr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Hs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Dm();try{let r=await this.api.post(zu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(vn),this.meta.headless&&J.del(Cn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=se(r);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=J.get(vn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(Ps,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(vn),r}catch(r){throw se(r)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=bn();J.put(vn,t);let r=ci();J.put(gn,r);let o=await di(t);this.meta.headless&&J.put(Cn,!0);try{return await this.api.post(Ss,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw se(n)}}};function wd(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Um,jsxs as b3}from"react/jsx-runtime";var Vs=({style:e,...t})=>b3("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:[Um("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"}),Um("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 ya,jsxs as E3}from"react/jsx-runtime";var Gs=({style:e,...t})=>E3("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:[ya("g",{clipPath:"url(#clip0)",children:ya("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"})}),ya("defs",{children:ya("clipPath",{id:"clip0",children:ya("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Fm}from"react/jsx-runtime";var qs=({style:e,...t})=>Fm("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:Fm("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as T3}from"@heroicons/react/24/outline";import{jsx as S3}from"react/jsx-runtime";var Bm=({style:e})=>S3(T3,{style:{color:"var(--privy-color-error)",...e}});import{jsx as zs,jsxs as P3}from"react/jsx-runtime";var $s=({style:e,...t})=>P3("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:[zs("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"}),zs("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"}),zs("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"}),zs("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 Sr,jsxs as Ks}from"react/jsx-runtime";function js(e){return Ks("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Ks("defs",{children:[Ks("linearGradient",{id:"b",children:[Sr("stop",{offset:"0",stopColor:"#3771c8"}),Sr("stop",{stopColor:"#3771c8",offset:".128"}),Sr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Ks("linearGradient",{id:"a",children:[Sr("stop",{offset:"0",stopColor:"#fd5"}),Sr("stop",{offset:".1",stopColor:"#fd5"}),Sr("stop",{offset:".5",stopColor:"#ff543e"}),Sr("stop",{offset:"1",stopColor:"#c837ab"})]}),Sr("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),Sr("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),Sr("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Sr("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Sr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as Ys}from"react/jsx-runtime";function Zs({style:e,...t}){return Ys("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:Ys("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ys("g",{transform:"scale(5.12,5.12)",children:Ys("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 Hm,jsxs as _3}from"react/jsx-runtime";function Qs(e){return _3("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Hm("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"}),Hm("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 bd,jsxs as x3}from"react/jsx-runtime";function Js(e){return x3("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:[bd("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"}),bd("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"}),bd("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 Vm}from"react/jsx-runtime";var Xs=({style:e,...t})=>Vm("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:Vm("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Gm={google:{name:"Google",component:$s},discord:{name:"Discord",component:Gs},github:{name:"Github",component:qs},linkedin:{name:"LinkedIn",component:Zs},twitter:{name:"Twitter",component:Xs},spotify:{name:"Spotify",component:Qs},instagram:{name:"Instagram",component:js},tiktok:{name:"Tiktok",component:Js},apple:{name:"Apple",component:Vs}},ga=e=>e in Gm?Gm[e]:{name:"Unknown",component:Bm};function qm(e,t){let r={detail:"",retryable:!1},o=wd(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=ga(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=ga(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function va(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Hs(),popupFlow:window.opener!==null&&n}}function En(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),J.del(gn),window.history.replaceState({},"",e)}var Tn=class{constructor(t){this.initAuthenticateOnce=new Le(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Le(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Xu,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):se(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Ju,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):se(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Qu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Zu,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var el=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",i=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
var Xc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var fu=(e,t,r)=>(Xc(e,t,"read from private field"),r?r.call(e):t.get(e)),cs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ed=(e,t,r,o)=>(Xc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var hu=(e,t,r)=>(Xc(e,t,"access private method"),r);import{getAddress as Io}from"@ethersproject/address";import{Web3Provider as iu}from"@ethersproject/providers";import{createStore as sS}from"mipd";import{useEffect as Kr,useMemo as lS,useRef as Ji,useState as at}from"react";import{isAndroid as cS}from"react-device-detect";import{ProviderErrors as dS,calculateTotalGasEstimate as pS,populateTransactionRequest as uS}from"@privy-io/js-sdk-core";import{FetchError as n3}from"ofetch";var et=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Rt=class extends et{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},C=class extends et{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ds=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ce=class extends et{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof et)return e;if(!(e instanceof n3))return lt(e);if(!e.response)return new Rt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Rt(t||"ApiError",e.response.status,r||o,e,n)},lt=e=>e instanceof et?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var Co=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Mt=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ps=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var wr=class extends C{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var us="/api/v1/sessions",ms="/api/v1/sessions/logout",yu="/api/v1/sessions/fork",fs="/api/v1/sessions/fork/recover",gu="/api/v1/siwe/init",vu="/api/v1/siwe/authenticate",Cu="/api/v1/siwe/link",wu="/api/v1/siwe/unlink",bu="/api/v1/farcaster/init",Eu="/api/v1/farcaster/authenticate",Tu="/api/v1/farcaster/link",Su="/api/v1/farcaster/status",_u="/api/v1/farcaster/unlink",Pu="/api/v1/passwordless/init",xu="/api/v1/passwordless/authenticate",Au="/api/v1/passwordless/link",ku="/api/v1/passwordless/unlink",Ru="/api/v1/passwordless/update",Mu="/api/v1/passwordless_sms/init",Iu="/api/v1/passwordless_sms/link",Wu="/api/v1/passwordless_sms/unlink",Lu="/api/v1/passwordless_sms/authenticate",hs="/api/v1/oauth/init",Ou="/api/v1/oauth/authenticate",ys="/api/v1/oauth/link",Nu="/api/v1/oauth/unlink",Du="/api/v1/recovery/oauth/init",Uu="/api/v1/recovery/oauth/init_icloud",Fu="/api/v1/recovery/oauth/authenticate",Bu="/api/v1/passkeys/link/init",Hu="/api/v1/passkeys/authenticate/init",Vu="/api/v1/passkeys/link",Gu="/api/v1/passkeys/authenticate",qu="/api/v1/passkeys/unlink",zu="/api/v1/telegram/authenticate",$u="/api/v1/telegram/link",Ku="/api/v1/telegram/unlink";var ju="/api/v1/mfa/passwordless_sms/init",Yu="/api/v1/mfa/passkeys/init",Zu="/api/v1/users/me/accept_terms",gs="/api/v1/analytics_events",Qu="/api/v1/plugins/moonpay_on_ramp/sign",Ju="/api/v1/custom_jwt_account/authenticate";var Jn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(Ju,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){throw new Error("Unimplemented")}};var Wo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(xu,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Au,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(t)}}async sendCodeEmail(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{return await this.api.post(Pu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},vs=class extends Wo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new C("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ru,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as a3,isIOS as s3}from"react-device-detect";var td=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Cs=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function rd(){try{let e="privy:__session_storage__test",t="blobby",r=new Cs;return r.put(e,t),r.del(e),!0}catch{return!1}}function i3(){return typeof window<"u"&&window.localStorage?new Cs:new td}var J=i3();import{StaticJsonRpcProvider as ea}from"@ethersproject/providers";function Xu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var ws=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var od=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ws(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!od(r))return!1}return!0},Lo=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),bs=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var em=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Es=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),tm=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Qe=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},nd=e=>new Promise(t=>setTimeout(t,e));function rm(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var ta=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(s=>{a=!0,n(s)},(...s)=>{a=!0,i(...s)}),l+=1,await nd(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ts=(e,t,r={},o={})=>{let n=new URL(t,e);for(let[a,l]of Object.entries(r))l!==void 0&&n.searchParams.set(a,l);let i=Object.entries(o);if(i.length>0){let a=new URLSearchParams;for(let[l,s]of i)a.append(l,s);n.hash=a.toString()}return n.href};var om=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),pn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function nm(e,t,r,o=3e3){let n=!1,i=window;return new Promise(a=>{i.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},o));function l(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",l);let s=e.getProviders(),c=[];for(let m of s)t.includes("coinbase_wallet")&&m.info.rdns==="com.coinbase.wallet"||c.push({type:m.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:m});for(let m of Xu()){let f=ws(m);if(!s.some(u=>u.info.name===f)){if(od(m,!0)&&!c.find(u=>u.type==="metamask")){c.push({type:"metamask",legacyInjectedProvider:m});continue}if(f==="Phantom"&&!c.find(u=>u.type==="phantom")){c.push({type:"phantom",legacyInjectedProvider:m});continue}if(f==="Coinbase Wallet"&&!c.find(u=>u.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){c.push({type:"coinbase_wallet",legacyInjectedProvider:m});continue}c.find(u=>u.type==="unknown_browser_extension")||c.push({type:"unknown_browser_extension",legacyInjectedProvider:m})}}a(c)}})}function Xn(e){return`eip155:${String(Number(e))}`}var im=(e,t,r,o)=>{let n=Number(e),i=t.find(a=>a.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);return id(i,r,o)},id=(e,t,r)=>{let o=e.id,n=Number(e.id),i;if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[n])i=t.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let a=new URL(e.rpcUrls.privy.http[0]);a.searchParams.append("privyAppId",r),i=a.toString()}else e.rpcUrls.public?.http[0]?i=e.rpcUrls.public.http[0]:i=e.rpcUrls.default?.http[0];if(!i)throw new ce(`No RPC url found for ${o}`);return i},am=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ce(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},rr=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new ce(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new ea(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new ea(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new ea({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new ea(i.rpcUrls.public.http[0]):a=new ea(i.rpcUrls.default?.http[0]),!a)throw new ce(`No RPC url found for ${e}`);return a},ra=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var Ss=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(_s))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var _s={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function sm(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function lm(e,t){let r=sm(t);if(r.deepLink)return fm(r.deepLink,e);if(r.universalLink)return ad(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function cm(e,t){let r=sm(t);if(r.universalLink)return ad(r.universalLink,e)}var dm="WALLETCONNECT_DEEPLINK_CHOICE";function pm(){try{localStorage.removeItem(dm)}catch{}}function um({href:e,name:t}){try{localStorage.setItem(dm,JSON.stringify({href:e,name:t}))}catch{}}function mm(e){return e.startsWith("http://")||e.startsWith("https://")}function fm(e,t){if(mm(e))return ad(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ad(e,t){if(!mm(e))return fm(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Ps(e,t){window.open(e,t,"noreferrer noopener")}var Oe=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var oa=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Oe(this._startChannelOnce.bind(this)),this.pollForReady=new Oe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(Eu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Tu,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(bu,{token:this.captchaToken});a3&&!s3&&t.connect_uri&&Ps(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(Su,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var hm="1.75.0";var ym="34357d3c125c2bcf2ce2bc3309d98715",xs="https://auth.privy.io",gm=2e4,Ne=1400,As=2500,sd=hm;var un="privy:token",ld="privy-token",ks="privy:refresh_token",vm="privy-refresh-token",Rs="privy-session",na="privy:session_transfer_token",c3="privy:wallet",ia="privy:caid",aa=e=>`privy:cross-app:${e}`,mn="privy:state_code",fn="privy:code_verifier",hn="privy:headless_oauth",Ms=e=>`${c3}:${e}`,cd="privy:connectors",dd="privy:connections";var yn=12e4,wo=1,pd="0x1",ei=3e4,Cm="https://api.moonpay.com/v1",wm="https://api.moonpay.com/v1",bm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Em="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Tm="deprecated";import{base64url as Pm}from"jose";async function Sm(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function _m(e){return crypto.getRandomValues(new Uint8Array(e))}var d3="S256",p3="S256";function gn(){return Pm.encode(_m(36))}function ti(){return gn()}async function ri(e,t=d3){if(t==p3){let r=await Sm(e);return Pm.encode(r)}else return e}function xm(){let e=J.get(fn);if(!e)throw new C("Authentication error.");return e}function Is(){return!!J.get(hn)}var Zr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Is();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=xm();try{let r=await this.api.post(Ou,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(fn),this.meta.headless&&J.del(hn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=le(r);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=J.get(fn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(ys,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return J.del(fn),r}catch(r){throw le(r)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=gn();J.put(fn,t);let r=ti();J.put(mn,r);let o=await ri(t);this.meta.headless&&J.put(hn,!0);try{return await this.api.post(hs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function ud(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as Am,jsxs as u3}from"react/jsx-runtime";var Ws=({style:e,...t})=>u3("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Am("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Am("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as sa,jsxs as m3}from"react/jsx-runtime";var Ls=({style:e,...t})=>m3("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[sa("g",{clipPath:"url(#clip0)",children:sa("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),sa("defs",{children:sa("clipPath",{id:"clip0",children:sa("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as km}from"react/jsx-runtime";var Os=({style:e,...t})=>km("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:km("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{GlobeAltIcon as f3}from"@heroicons/react/24/outline";import{jsx as h3}from"react/jsx-runtime";var Rm=({style:e})=>h3(f3,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Ns,jsxs as y3}from"react/jsx-runtime";var Ds=({style:e,...t})=>y3("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ns("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ns("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ns("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ns("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as br,jsxs as Us}from"react/jsx-runtime";function Fs(e){return Us("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Us("defs",{children:[Us("linearGradient",{id:"b",children:[br("stop",{offset:"0",stopColor:"#3771c8"}),br("stop",{stopColor:"#3771c8",offset:".128"}),br("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Us("linearGradient",{id:"a",children:[br("stop",{offset:"0",stopColor:"#fd5"}),br("stop",{offset:".1",stopColor:"#fd5"}),br("stop",{offset:".5",stopColor:"#ff543e"}),br("stop",{offset:"1",stopColor:"#c837ab"})]}),br("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),br("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),br("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),br("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),br("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as Bs}from"react/jsx-runtime";function Hs({style:e,...t}){return Bs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Bs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Bs("g",{transform:"scale(5.12,5.12)",children:Bs("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Mm,jsxs as g3}from"react/jsx-runtime";function Vs(e){return g3("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Mm("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),Mm("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as md,jsxs as v3}from"react/jsx-runtime";function Gs(e){return v3("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[md("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),md("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),md("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Im}from"react/jsx-runtime";var qs=({style:e,...t})=>Im("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:Im("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Wm={google:{name:"Google",component:Ds},discord:{name:"Discord",component:Ls},github:{name:"Github",component:Os},linkedin:{name:"LinkedIn",component:Hs},twitter:{name:"Twitter",component:qs},spotify:{name:"Spotify",component:Vs},instagram:{name:"Instagram",component:Fs},tiktok:{name:"Tiktok",component:Gs},apple:{name:"Apple",component:Ws}},la=e=>e in Wm?Wm[e]:{name:"Unknown",component:Rm};function Lm(e,t){let r={detail:"",retryable:!1},o=ud(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=la(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=la(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function ca(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Is(),popupFlow:window.opener!==null&&n}}function vn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),J.del(mn),window.history.replaceState({},"",e)}var Cn=class{constructor(t){this.initAuthenticateOnce=new Oe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Oe(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Gu,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Vu,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):le(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Hu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Bu,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var zs=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",a=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${e}
|
|
3
3
|
|
|
4
|
-
${
|
|
4
|
+
${i}
|
|
5
5
|
|
|
6
6
|
URI: ${n}
|
|
7
7
|
Version: 1
|
|
8
8
|
Chain ID: ${t}
|
|
9
9
|
Nonce: ${r}
|
|
10
|
-
Issued At: ${
|
|
10
|
+
Issued At: ${a}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`};var wo=class{constructor(t,r,o){this.getNonceOnce=new Le(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw se(t)}}async link(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw se(t)}}async sign(){if(!this.client)throw new C("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new C("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new C("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=el({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Sn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(qu,{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 se(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Vu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw se(t)}}async sendSmsCode(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Hu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw se(o)}}};var pi=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(tm,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw se(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(rm,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw se(t)}}};function Ed(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function $m(){let e;if(e=A3(),e)return zm(),{...e,flowType:"login-url"};if(e=k3(),e)return zm(),{...e,flowType:"web-app"}}function A3(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),a=e.get("last_name")||void 0,i=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:a,username:i,photo_url:l,auth_date:o,hash:r}}function k3(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash");if(!(!r||!o||!n||!a))return{query_id:r,user:o,auth_date:n,hash:a}}function zm(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),window.history.replaceState({},"",e)}import{v4 as PC}from"uuid";function X(e){return e?new Date(e*1e3):null}function R3(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let a={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"email":let i={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(u);break;case"twitter_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(h);break;case"discord_oauth":let m={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(m);break;case"github_oauth":let g={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"tiktok_oauth":let w={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(w);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let S={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(S);break;case"passkey":let R={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(R);break;case"telegram":let T={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:X(r.first_verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(T);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function $t(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var xe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,Pn=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,tl=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,M3=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Kt=(e,t)=>xe(e)||Pn(e)?!1:t==="all-users"||t==="users-without-wallets"&&!M3(e)?.length;function jt(e){if(!e)return null;let t=R3(e.linked_accounts),r=$t(t,"wallet"),o=$t(t,"email"),n=$t(t,"phone"),a=$t(t,"google_oauth"),i=$t(t,"twitter_oauth"),l=$t(t,"discord_oauth"),s=$t(t,"github_oauth"),c=$t(t,"spotify_oauth"),u=$t(t,"instagram_oauth"),h=$t(t,"tiktok_oauth"),m=$t(t,"linkedin_oauth"),g=$t(t,"apple_oauth"),w=$t(t,"farcaster"),y=$t(t,"telegram"),b=e.mfa_methods.map(({type:R,verified_at:T})=>({type:R,verifiedAt:X(T)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google: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:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:h&&{subject:h.subject,username:h.username,name:h.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email,vanityName:m.vanityName},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:b.map(R=>R.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Kf}from"@ethersproject/address";import{isHexString as CC}from"@ethersproject/bytes";import wC from"eventemitter3";import F3 from"@coinbase/wallet-sdk";import{jsx as Km,jsxs as I3}from"react/jsx-runtime";var _n=({style:e,...t})=>I3("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:[Km("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Km("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as eo}from"@ethersproject/address";import{Web3Provider as Xm}from"@ethersproject/providers";import{default as D3}from"eventemitter3";import N3 from"eventemitter3";var W3=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],jm=e=>W3.includes(e);import{ErrorCode as L3}from"@ethersproject/logger";import{ProviderErrors as xn}from"@privy-io/js-sdk-core";var ui=class extends le{constructor(){super("Wallet timeout");this.type="wallet_error"}},mi=class extends le{constructor(){super("User rejected connection");this.type="wallet_error"}},Wr=e=>{if(e instanceof le)return e;if(e?.code&&e?.reason){let t=new ft(e);return e.code===L3.ACTION_REJECTED&&(t.details=xn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new ft(e):new le("Unknown connector error",e)},sr=class extends rt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},ft=class extends sr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(xn).find(a=>a.eipCode===o.code);this.details=n||xn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=xn.E32002_CONNECTION_ALREADY_PENDING:this.details=xn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=xn.E32002_WALLET_LOCKED))}},O3={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}},bo={...O3,...xn};var $e=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new ui,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||wn,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new le(`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 Wr(r)})}},No=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Ca=class extends N3{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=ar(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=fi(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new No(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ce()||!this.address)throw new No("Disconnected",4900);return(await Qm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new No(`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 No(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=ar(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await Ym(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Zm(pa(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:hn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(a){throw console.warn(`Gas estimation failed with error: ${a} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return hn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(jm(r.method)){let o=await Ce();if(await Jm(),!o||!this.address)throw new No("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 No("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ce();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Xr=class extends $e{constructor(r){super(r,r.rpcTimeoutDuration)}},Do=class extends $e{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var U3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Yt=class extends D3{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=si(r),this.walletClientType==="privy"&&J.put(Bs(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=fi(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(l=>eo(l.address)===eo(r));return{address:eo(r),chainId:o,meta:n,imported:a,switchChain:async l=>{if(!i)throw new le("Wallet is not currently connected.");let s=this.wallets.find(g=>eo(g.address)===eo(r))?.chainId;if(!s)throw new le("Unable to determine current chainId.");let c,u;if(typeof l=="number"?(c=`0x${l.toString(16)}`,u=l):(c=l,u=Number(l)),s===si(c))return;let h=this.chains.find(g=>g.id===u);if(!h)throw new le(`Unsupported chainId: ${l}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await m()}catch(g){if(U3(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:h.name,nativeCurrency:h.nativeCurrency,rpcUrls:[h.rpcUrls.default?.http[0]??""],blockExplorerUrls:[h.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new le(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new le("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new le("Wallet is not currently connected.");return new Xm(new Xr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new le("Wallet is not currently connected.");return new Do(this.proxyProvider)},sign:async l=>{if(!await i())throw new le("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await da(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=eo(n),i=[],l;if(this.walletClientType==="privy"){let c=J.get(Bs(a));this.chains.find(u=>u.id===Number(c))||(J.del(Bs(a)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await da(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Cd}`,c),l=Cd}let s=si(l);if(!i.find(c=>eo(c.address)===a)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(eo(n),s,c,this.connectorType==="embedded_imported"))}rl(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=>eo(n)===eo(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Xm(new Xr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var B3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],H3=(e,t)=>e.makeWeb3Provider({options:t}),Td,ol=class extends Yt{constructor(r,o,n,a,i,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=a.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Td){let s=[o.id].concat(r.map(u=>u.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(u=>!B3.includes(u)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),Td=new F3({appName:i,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(H3(Td,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:_n,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 le("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Wr(r)}}};import{jsx as ef}from"react/jsx-runtime";var Uo=({...e})=>ef("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:ef("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 wa=class extends Yt{constructor(r,o,n,a,i=!1){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[hn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Uo,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as tf}from"react/jsx-runtime";var hi=({style:e,...t})=>tf("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:tf("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 lr,jsxs as V3}from"react/jsx-runtime";var yi=({style:e,...t})=>V3("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:[lr("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),lr("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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"}),lr("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 rf,jsxs as G3}from"react/jsx-runtime";var to=({style:e,...t})=>G3("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:[rf("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),rf("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 vi=class extends Yt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new le("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Wr(r)}}},gi,Ci=class extends Yt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";vs(this,gi,void 0);this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?cd(this,gi,{name:"MetaMask",icon:yi,id:"io.metamask"}):i==="phantom"&&cd(this,gi,{name:"Phantom",icon:to,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Su(this,gi)??{name:"Browser Extension",icon:hi,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 le("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Wr(r)}}};gi=new WeakMap;import{getAddress as cA}from"@ethersproject/address";import{Web3Provider as pA}from"@ethersproject/providers";import{isMobile as q3}from"react-device-detect";var nl=class extends vi{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{q3||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 le("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Wr(t)}}};var il=class extends Yt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new $e(void 0,wn);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var al=class extends il{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:to,id:"phantom"}}};import{EthereumProvider as hC,OPTIONAL_EVENTS as yC,OPTIONAL_METHODS as gC}from"@walletconnect/ethereum-provider";import{isMobile as vC}from"react-device-detect";import{createContext as sC,useContext as lC,useEffect as xd,useRef as cC,useState as dC}from"react";import{jsx as z3}from"react/jsx-runtime";function sl({src:e,...t}){return z3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Vf,useEffect as Hf,useMemo as oC,useState as nC}from"react";import{createContext as iC}from"react";var Ot={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:_m,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var of=({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 $3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),nf=e=>$3.has(e),af=(e,t,r)=>r.indexOf(e)===t,sf=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(nf).filter(af):e?e.filter(nf).filter(af):Ot.appearance.walletList;var lf={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var cf={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var df={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 pf={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 uf={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 mf={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var ff={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var hf={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 yf={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var gf={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 vf={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 Cf={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 wf={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 bf={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Ef={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Tf={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 Sf={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var Pf={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 ll={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var _f={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var xf={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Af={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 kf={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Rf={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Mf={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var If={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 Wf={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 Lf={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 Of={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 Nf={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 ba=[lf,cf,df,Ef,Wf,ll,_f,xf,Af,kf,Rf,gf,vf,Cf,wf,mf,ff,hf,yf,Sf,Pf,pf,uf,Lf,Nf,Of,Tf,Mf,bf,If],Dk=new Set(ba.map(e=>e.id));import An from"tinycolor2";var Df="#FFFFFF",K3="#040217",j3=Df,Y3="#1E1E1D";function Z3(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 Lr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return An({...e.toHsl(),l:r})}var Q3="#51BA81",J3="#FFB74D",X3="#EC6351",eC=Df,tC=K3;function Uf({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=j3;break;case"dark":r=Y3;break;default:r=e;break}let o=An(r),n=An(t),a=An(Q3),i=An(J3),l=An(X3),s=Z3(o.getLuminance()),c=Lr(o,s==="light"?-.04:.11),u=Lr(o,s==="light"?-.88:.87),h=Lr(o,s==="light"?-.7:.75),m=Lr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),g=Lr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),w=Lr(n,.15),y=Lr(n,-.06),b=Lr(l,.3),S=Lr(i,.3),R=An(n.getLuminance()>.5?tC:eC),T=Lr(a,-.16),A=Lr(a,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:u.toHslString(),foreground2:h.toHslString(),foreground3:m.toHslString(),foreground4:g.toHslString(),accent:n.toHslString(),accentLight:w.toHslString(),accentDark:y.toHslString(),foregroundAccent:R.toHslString(),success:a.toHslString(),successDark:T.toHslString(),successLight:A.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:i.toHslString(),warnLight:S.toHslString()}}function Sd(e,t,r){let o=r?console.warn:()=>{},n,a,i,l,s,c,u,h,m,g,w,y,b,S,R;t?.loginMethods?(n=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),w=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),S=t.loginMethods.includes("farcaster"),R=t.loginMethods.includes("telegram")):(n=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,u=e.discordOAuth,y=e.githubOAuth,m=e.spotifyOAuth,g=e.instagramOAuth,h=e.tiktokOAuth,w=e.linkedinOAuth,b=e.appleOAuth,S=e.farcasterAuth,R=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?i=!1:e.passkeyAuth&&(i=!0);let T=[n,a].filter(Boolean),A=[s,c,u,y,m,g,h,w,b,S,R].filter(Boolean),k=[l].filter(Boolean);if(T.length+A.length+k.length===0)throw new Error("You must enable at least one login method");let M=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;M&&k.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&A.length+T.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0);let H=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let B=sf({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),$=of({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:N}=rC({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,ve=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Ue,ne=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ve?Ue=t?.embeddedWallets?.noPromptOnSignature??!0:Ue=t?.embeddedWallets?.noPromptOnSignature??ne:Ue=ne,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Ue!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:te,...ee}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Ot.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Uf({backgroundTheme:t?.appearance?.theme??Ot.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ot.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:l,email:n,sms:a,passkey:i,google:s,twitter:c,discord:u,github:y,spotify:m,instagram:g,tiktok:h,linkedin:w,apple:b,farcaster:S,telegram:R},loginMethodsAndOrder:$,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ot.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ot.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ot.rpcConfig.rpcTimeouts},chains:W,defaultChain:N,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Ot.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Ot.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:H}},embeddedWallets:{...e.embeddedWalletConfig,...typeof te=="boolean"?{requireUserOwnedRecoveryOnCreate:te}:{},...ve?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ee,noPromptOnSignature:Ue},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ve?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Ot._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Ot.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Ot.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Ot.fundingMethodConfig.moonpay.useSandbox}}}}function Ff(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,legacyCreateEmbeddedWalletFlag:t}}function rC({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:ba.find(u=>u.id===s.id)??s)}else n=ba.concat(e??[]);let a=t?n[0]:ll,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}}var Bf=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),o=Math.imul(o^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as aC}from"react/jsx-runtime";var Gf={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Pd=Sd(Gf,void 0,!1),_d=iC({appConfig:Pd,isServerConfigLoaded:!1}),qf=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=nC(null),i=oC(()=>Sd(n??Gf,o,!!n),[n,o]);return Hf(()=>{if(!n)return;let l=Ff(o,t),s=Bf(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),Hf(()=>{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)}})()},[]),aC(_d.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Je=()=>{let{appConfig:e}=Vf(_d);return e},cl=()=>{let{isServerConfigLoaded:e}=Vf(_d);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as uC,jsxs as mC}from"react/jsx-runtime";var zf=sC({ready:!1,app:Pd,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),pC=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],$f=e=>{let t=Je(),r=e.authenticated,[o,n]=dC(e.initialScreen);xd(()=>{!r&&!pC.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=cC(null);xd(()=>{e.open||(a.current=null)},[e.open]),xd(()=>{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 mC(zf.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&uC(sl,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},P=()=>lC(zf);import{jsx as wi,jsxs as fC}from"react/jsx-runtime";var Ea=({style:e,...t})=>{let{app:r}=P();return fC("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:[wi("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),wi("g",{clipPath:"url(#clip0_1765_9946)",children:wi("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"})}),wi("defs",{children:wi("clipPath",{id:"clip0_1765_9946",children:wi("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Or=class extends Yt{constructor(r,o,n,a,i,l,s,c){super(c||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=Ls[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Ws(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:yi,id:"io.metamask"}:{name:mm(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Ea,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=Ls[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,bm(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new mi)};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 le("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ws(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=fi(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(Wr(i));return}o(new le("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=hm(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 hC.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:yC,optionalMethods:gC,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),vC&&this.walletEntry){let{redirect:l,href:s}=vm(i,this.walletEntry);Em({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=Cm(i,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Os(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=Ws(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 kd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>CC(o)).map(o=>Kf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},fi=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||wn:wn,Ta=class extends wC{constructor(r,o,n,a,i,l,s,c,u,h,m){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 $e: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=c,this.externalWalletConfig=u,this.privyAppName=h,this.privyAppLogo=m,this.storedConnections=Ad()}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;J.get(gd)&&(J.getKeys().forEach(o=>{o.startsWith("walletconnect")&&J.del(o)}),J.del(gd));let r=fm(this.store,this.walletList,this.externalWalletConfig).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"),!Oo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new Ca(r,o,this.rpcConfig,this.chains,a,n.id),s=new wa(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded_imported","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new Ca(r,o,this.rpcConfig,this.chains,a,n.id),s=!0,c=new wa(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Ad(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Ad(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof Or&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new nl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Ci(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Ci(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Ci(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new vi(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new ol(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new al(this.defaultChain):new Or(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));J.put(vd,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=Kf(r),this.emit("walletsUpdated")}};function rl(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var bC=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Ad=()=>{let e=J.get(vd);return e&&Array.isArray(e)&&e.map(o=>bC(o)).every(Boolean)?e:[]};import{ofetch as EC}from"ofetch";var TC=[bs,Ts,Es,_s],dl=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=hd,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=EC.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:a,options:i})=>{let l=new Headers(i.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=TC.includes(a.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}i.headers=l,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new Cs}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw se(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw se(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw se(o)}}};var jf=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import bi from"js-cookie";function Yf(e){return e instanceof Lo?"email":e instanceof Sn?"sms":e instanceof wo?"siwe":e instanceof ai?"custom_auth":e instanceof Jr?e.meta.provider:null}import*as Zf from"jose";var Nr=class{static parse(t){try{return new Nr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Zf.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 SC=30,pl=class{constructor(){this.authenticateOnce=new Le(async t=>this._authenticate(t)),this.linkOnce=new Le(async t=>this._link(t)),this.refreshOnce=new Le(this._refresh.bind(this)),this.destroyOnce=new Le(this._destroy.bind(this)),this.forkSessionOnce=new Le(this._forkSession.bind(this))}get token(){try{let t=J.get(yn);return typeof t=="string"?new Nr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=J.get(Us);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=J.get(ma);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=J.get(ha(t));if(typeof r=="string"){let o=new Nr(r);return o.isExpired()?(J.del(ha(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=bi.get(Fs);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Wm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Nr.parse(this.token);return t!==null&&!t.isExpired(SC)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?J.put(ha(t),r):J.del(ha(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:a}=r;this.handleTokenResponse(r);let i=a,l=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,s=Yf(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:jt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),lt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:jt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),lt(r)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(bs,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ts,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),jt(n.user)}catch(n){if(n instanceof Wt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw lt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(Es,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(_u,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw lt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=J.get(yn);if(J.put(yn,t),!this.client?.useServerCookies){let o=Nr.parse(t)?.expiration;bi.set(yd,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else J.del(yn),bi.remove(yd),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(J.put(Us,t),this.client?.useServerCookies||bi.set(Fs,"t",{sameSite:"Strict",secure:!0,expires:30})):(J.del(Us),bi.remove(Am),bi.remove(Fs))}clearForkedToken(){J.del(ma)}};var Rd,ul,Qf,Sa=class{constructor(t){vs(this,ul);this.apiUrl=t.apiUrl||Ns,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||xm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=Pu(this,ul,Qf).call(this),Rd||(Rd=new pl),this.session=Rd,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new Ta(this.appId,t,r,o,n,a,i,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new dl({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(nm,{action:"verify"})}catch(t){throw se(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(im,{});return jf(t.options)}catch(t){throw se(t)}}async unlinkEmail(t){try{let r=await this.api.post(Fu,{address:t});return jt(r)}catch(r){throw lt(r)}}async acceptTerms(){try{let t=await this.api.post(am,{});return jt(t)}catch(t){throw lt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Gu,{phoneNumber:t});return jt(r)}catch(r){throw lt(r)}}async unlinkWallet(t){try{let r=await this.api.post(Ru,{address:t});return jt(r)}catch(r){throw lt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post($u,{provider:t,subject:r});return jt(o)}catch(o){throw lt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ou,{fid:t});return jt(r)}catch(r){throw lt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(om,{telegram_user_id:t});return jt(r)}catch(r){throw lt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(em,{credential_id:t});return jt(r)}catch(r){throw lt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(_s,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(sm,t)}catch(r){throw lt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Nr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0,a=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:a}}catch(t){throw lt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(xu,{address:t,token:r})).nonce}catch(o){throw lt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Au,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(ku,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a});return jt(i)}catch(i){throw lt(i)}}};ul=new WeakSet,Qf=function(){if(typeof window>"u")return null;try{let r=J.get(fa);if(typeof r=="string"&&r.length>0)return r}catch{}let t=PC();try{return J.put(fa,t),t}catch{return t}};import{Turnstile as MC}from"@marsidev/react-turnstile";import{useEffect as IC,useMemo as WC}from"react";import{useMemo as _C,useRef as xC,useContext as AC,useState as Md,createContext as kC}from"react";import{jsx as RC}from"react/jsx-runtime";var Jf=kC({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),cr=class extends rt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Xf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=xC(null),[a,i]=Md(),[l,s]=Md(),[c,u]=Md(!1),h=_C(()=>o?!c&&!a&&!l?{status:"ready"}:c&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,c]);return RC(Jf.Provider,{value:{...h,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 um(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new cr("Captcha failed",null,"captcha_timeout")}}},children:e})},we=()=>AC(Jf);import{jsx as eh}from"react/jsx-runtime";var Id=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=we(),[,s]=WC(()=>r?.split("t:")||[],[r]);if(IC(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return eh("div",{className:"hidden h-0 w-0",children:eh(MC,{...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:c=>{e.onSuccess?.(c),a(c),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as Z9,useEffect as Nv,useRef as Q9,useState as J9}from"react";import Fv from"styled-components";import{createContext as LC,useContext as OC}from"react";var Wd=LC({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,crossAppAuthFlow:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedEthereumWallet:E,getMoonpaySignedUrl:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E}),I=()=>OC(Wd);import{createContext as NC,useContext as DC}from"react";var Ee=NC({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkCrossAppAccount:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkCrossAppAccount:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,setWalletRecovery:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,generateSiweMessage:E,linkWithSiwe:E,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),q=()=>DC(Ee);import{useEffect as UC,useState as FC}from"react";var th=e=>{let[t,r]=FC("auto");return UC(()=>{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 BC,useContext as HC,useEffect as VC}from"react";var rh={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]}},Ld=BC(void 0),oh=()=>HC(Ld);function ke(e,t){if(!t)return;let o=oh().current[e];return VC(()=>{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 U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Ei(){let e=oh();return(t,r,...o)=>U(e,t,r,...o)}function Od(e){ke("configureMfa",e)}import{QuestionMarkCircleIcon as d0}from"@heroicons/react/24/outline";import ph from"styled-components";import kn,{css as nh}from"styled-components";import Dd from"styled-components";import{Fragment as qC,jsx as Nd,jsxs as zC}from"react/jsx-runtime";var nt=({success:e,fail:t})=>zC(qC,{children:[Nd(ht,{className:e?"success":t?"fail":""}),Nd(Ud,{className:e?"success":t?"fail":""})]}),ht=Dd.span`
|
|
12
|
+
- https://privy.io`};var bo=class{constructor(t,r,o){this.getNonceOnce=new Oe(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw le(t)}}async sign(){if(!this.client)throw new C("SiweFlow has no client instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new C("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildSiweMessage(){if(!this.client)throw new C("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=zs({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var wn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Lu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Iu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(t)}}async sendSmsCode(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Mu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}};var oi=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(zu,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw le(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post($u,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw le(t)}}};function fd(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function Nm(){let e;if(e=C3(),e)return Om(),{...e,flowType:"login-url"};if(e=w3(),e)return Om(),{...e,flowType:"web-app"}}function C3(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),i=e.get("last_name")||void 0,a=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:i,username:a,photo_url:l,auth_date:o,hash:r}}function w3(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id"),o=t.get("user"),n=Number(t.get("auth_date")||""),i=t.get("hash");if(!(!r||!o||!n||!i))return{query_id:r,user:o,auth_date:n,hash:i}}function Om(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),window.history.replaceState({},"",e)}import{v4 as yC}from"uuid";function X(e){return e?new Date(e*1e3):null}function b3(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,imported:r.imported,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"cross_app":let i={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"email":let a={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let m={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(m);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(u);break;case"github_oauth":let g={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"tiktok_oauth":let w={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(w);break;case"linkedin_oauth":let y={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let P={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(P);break;case"passkey":let A={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(A);break;case"telegram":let T={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:X(r.first_verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(T);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Vt(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var he=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,bn=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,$s=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,E3=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Gt=(e,t)=>he(e)||bn(e)?!1:t==="all-users"||t==="users-without-wallets"&&!E3(e)?.length;function qt(e){if(!e)return null;let t=b3(e.linked_accounts),r=Vt(t,"wallet"),o=Vt(t,"email"),n=Vt(t,"phone"),i=Vt(t,"google_oauth"),a=Vt(t,"twitter_oauth"),l=Vt(t,"discord_oauth"),s=Vt(t,"github_oauth"),c=Vt(t,"spotify_oauth"),m=Vt(t,"instagram_oauth"),f=Vt(t,"tiktok_oauth"),u=Vt(t,"linkedin_oauth"),g=Vt(t,"apple_oauth"),w=Vt(t,"farcaster"),y=Vt(t,"telegram"),b=e.mfa_methods.map(({type:A,verified_at:T})=>({type:A,verifiedAt:X(T)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email,vanityName:u.vanityName},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},mfaMethods:b.map(A=>A.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Uf}from"@ethersproject/address";import{isHexString as dC}from"@ethersproject/bytes";import pC from"eventemitter3";import R3 from"@coinbase/wallet-sdk";import{jsx as Dm,jsxs as T3}from"react/jsx-runtime";var En=({style:e,...t})=>T3("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Dm("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Dm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as Jr}from"@ethersproject/address";import{Web3Provider as Gm}from"@ethersproject/providers";import{default as A3}from"eventemitter3";import x3 from"eventemitter3";var S3=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Um=e=>S3.includes(e);import{ErrorCode as _3}from"@ethersproject/logger";import{ProviderErrors as Tn}from"@privy-io/js-sdk-core";var ni=class extends ce{constructor(){super("Wallet timeout");this.type="wallet_error"}},ii=class extends ce{constructor(){super("User rejected connection");this.type="wallet_error"}},Ir=e=>{if(e instanceof ce)return e;if(e?.code&&e?.reason){let t=new Ct(e);return e.code===_3.ACTION_REJECTED&&(t.details=Tn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ct(e):new ce("Unknown connector error",e)},Er=class extends et{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ct=class extends Er{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Tn).find(i=>i.eipCode===o.code);this.details=n||Tn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Tn.E32002_CONNECTION_ALREADY_PENDING:this.details=Tn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Tn.E32002_WALLET_LOCKED))}},P3={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Eo={...P3,...Tn};var $e=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new ni,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||yn,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new ce(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Ir(r)})}},Oo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},da=class extends x3{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=rr(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=ai(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Oo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new Oo("Disconnected",4900);return(await Hm(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Oo(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Oo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=rr(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await Fm(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Bm(ra(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:pn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(i){throw console.warn(`Gas estimation failed with error: ${i} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return pn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(Um(r.method)){let o=await we();if(await Vm(),!o||!this.address)throw new Oo("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Oo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Qr=class extends $e{constructor(r){super(r,r.rpcTimeoutDuration)}},No=class extends $e{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var k3=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},zt=class extends A3{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Xn(r),this.walletClientType==="privy"&&J.put(Ms(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=ai(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,i){let a=async()=>!!this.wallets.find(l=>Jr(l.address)===Jr(r));return{address:Jr(r),chainId:o,meta:n,imported:i,switchChain:async l=>{if(!a)throw new ce("Wallet is not currently connected.");let s=this.wallets.find(g=>Jr(g.address)===Jr(r))?.chainId;if(!s)throw new ce("Unable to determine current chainId.");let c,m;if(typeof l=="number"?(c=`0x${l.toString(16)}`,m=l):(c=l,m=Number(l)),s===Xn(c))return;let f=this.chains.find(g=>g.id===m);if(!f)throw new ce(`Unsupported chainId: ${l}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})};try{return await u()}catch(g){if(k3(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:f.name,nativeCurrency:f.nativeCurrency,rpcUrls:[f.rpcUrls.default?.http[0]??""],blockExplorerUrls:[f.blockExplorers?.default.url??""]}]}),u();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new ce(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new Gm(new Qr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new ce("Wallet is not currently connected.");return new No(this.proxyProvider)},sign:async l=>{if(!await a())throw new ce("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await ta(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(c)&&(o=c)}}catch(c){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",c)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=Jr(n),a=[],l;if(this.walletClientType==="privy"){let c=J.get(Ms(i));this.chains.find(m=>m.id===Number(c))||(J.del(Ms(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await ta(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${pd}`,c),l=pd}let s=Xn(l);if(!a.find(c=>Jr(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(Jr(n),s,c,this.connectorType==="embedded_imported"))}Ks(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>Jr(n)===Jr(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Gm(new Qr(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var M3=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],I3=(e,t)=>e.makeWeb3Provider({options:t}),hd,js=class extends zt{constructor(r,o,n,i,a,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=i.coinbaseWallet.connectionOptions??"eoaOnly",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!hd){let s=[o.id].concat(r.map(m=>m.id)),c=this.connectionOptions!=="eoaOnly"?s.filter(m=>!M3.includes(m)):[];c.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${c.join(", ")}`),hd=new R3({appName:a,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(I3(hd,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:En,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}};import{jsx as qm}from"react/jsx-runtime";var Do=({...e})=>qm("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:qm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var pa=class extends zt{constructor(r,o,n,i,a=!1){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[pn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Do,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as zm}from"react/jsx-runtime";var si=({style:e,...t})=>zm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:zm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as or,jsxs as W3}from"react/jsx-runtime";var li=({style:e,...t})=>W3("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[or("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),or("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),or("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),or("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),or("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),or("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),or("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),or("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),or("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),or("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),or("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),or("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),or("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as $m,jsxs as L3}from"react/jsx-runtime";var Xr=({style:e,...t})=>L3("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[$m("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),$m("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var di=class extends zt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}},ci,pi=class extends zt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";cs(this,ci,void 0);this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?ed(this,ci,{name:"MetaMask",icon:li,id:"io.metamask"}):a==="phantom"&&ed(this,ci,{name:"Phantom",icon:Xr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return fu(this,ci)??{name:"Browser Extension",icon:si,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Ir(r)}}};ci=new WeakMap;import{getAddress as eA}from"@ethersproject/address";import{Web3Provider as rA}from"@ethersproject/providers";import{isMobile as O3}from"react-device-detect";var Ys=class extends di{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{O3||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ce("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Ir(t)}}};var Zs=class extends zt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new $e(void 0,yn);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Qs=class extends Zs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Xr,id:"phantom"}}};import{EthereumProvider as aC,OPTIONAL_EVENTS as sC,OPTIONAL_METHODS as lC}from"@walletconnect/ethereum-provider";import{isMobile as cC}from"react-device-detect";import{createContext as J3,useContext as X3,useEffect as Cd,useRef as eC,useState as tC}from"react";import{jsx as N3}from"react/jsx-runtime";function Km({src:e,...t}){return N3("img",{src:e,...t,style:{display:"none"}})}import{useContext as Wf,useEffect as If,useMemo as j3,useState as Y3}from"react";import{createContext as Z3}from"react";var It={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ym,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var jm=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var D3=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),Ym=e=>D3.has(e),Zm=(e,t,r)=>r.indexOf(e)===t,Qm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ym).filter(Zm):e?e.filter(Ym).filter(Zm):It.appearance.walletList;var Jm={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var Xm={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ef={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var tf={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var rf={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var of={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var nf={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var af={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var sf={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var lf={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var cf={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var df={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var pf={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var uf={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var mf={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var ff={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var hf={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var yf={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Js={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var gf={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var vf={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Cf={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var wf={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var bf={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Ef={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Tf={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Sf={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var _f={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Pf={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var xf={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var ua=[Jm,Xm,ef,mf,Sf,Js,gf,vf,Cf,wf,bf,lf,cf,df,pf,of,nf,af,sf,hf,yf,tf,rf,_f,xf,Pf,ff,Ef,uf,Tf],Ak=new Set(ua.map(e=>e.id));import Sn from"tinycolor2";var Af="#FFFFFF",U3="#040217",F3=Af,B3="#1E1E1D";function H3(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Wr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Sn({...e.toHsl(),l:r})}var V3="#51BA81",G3="#FFB74D",q3="#EC6351",z3=Af,$3=U3;function kf({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=F3;break;case"dark":r=B3;break;default:r=e;break}let o=Sn(r),n=Sn(t),i=Sn(V3),a=Sn(G3),l=Sn(q3),s=H3(o.getLuminance()),c=Wr(o,s==="light"?-.04:.11),m=Wr(o,s==="light"?-.88:.87),f=Wr(o,s==="light"?-.7:.75),u=Wr(o,s==="light"?-.43:.45).desaturate(s==="light"?60:20),g=Wr(o,s==="light"?-.08:.25).desaturate(s==="light"?60:20),w=Wr(n,.15),y=Wr(n,-.06),b=Wr(l,.3),P=Wr(a,.3),A=Sn(n.getLuminance()>.5?$3:z3),T=Wr(i,-.16),x=Wr(i,.4);return{colorScheme:s,background:o.toHslString(),background2:c.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:u.toHslString(),foreground4:g.toHslString(),accent:n.toHslString(),accentLight:w.toHslString(),accentDark:y.toHslString(),foregroundAccent:A.toHslString(),success:i.toHslString(),successDark:T.toHslString(),successLight:x.toHslString(),error:l.toHslString(),errorLight:b.toHslString(),warn:a.toHslString(),warnLight:P.toHslString()}}function yd(e,t,r){let o=r?console.warn:()=>{},n,i,a,l,s,c,m,f,u,g,w,y,b,P,A;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),m=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),g=t.loginMethods.includes("instagram"),f=t.loginMethods.includes("tiktok"),y=t.loginMethods.includes("github"),w=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),P=t.loginMethods.includes("farcaster"),A=t.loginMethods.includes("telegram")):(n=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,y=e.githubOAuth,u=e.spotifyOAuth,g=e.instagramOAuth,f=e.tiktokOAuth,w=e.linkedinOAuth,b=e.appleOAuth,P=e.farcasterAuth,A=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?a=!1:e.passkeyAuth&&(a=!0);let T=[n,i].filter(Boolean),x=[s,c,m,y,u,g,f,w,b,P,A].filter(Boolean),R=[l].filter(Boolean);if(T.length+x.length+R.length===0)throw new Error("You must enable at least one login method");let M=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;M&&R.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):!M&&x.length+T.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0);let D=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let B=Qm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),K=jm({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:L,defaultChain:N}=K3({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain,ve=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Me,Y=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?ve?Me=t?.embeddedWallets?.noPromptOnSignature??!0:Me=t?.embeddedWallets?.noPromptOnSignature??Y:Me=Y,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Me!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:te,...ee}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??It.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:kf({backgroundTheme:t?.appearance?.theme??It.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??It.appearance.accentColor}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:l,email:n,sms:i,passkey:a,google:s,twitter:c,discord:m,github:y,spotify:u,instagram:g,tiktok:f,linkedin:w,apple:b,farcaster:P,telegram:A},loginMethodsAndOrder:K,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??It.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??It.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??It.rpcConfig.rpcTimeouts},chains:L,defaultChain:N,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??It.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??It.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:D}},embeddedWallets:{...e.embeddedWalletConfig,...typeof te=="boolean"?{requireUserOwnedRecoveryOnCreate:te}:{},...ve?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ee,noPromptOnSignature:Me},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:ve?{enabled:!0,...t.customAuth}:void 0,loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??It._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??It.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??It.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??It.fundingMethodConfig.moonpay.useSandbox}}}}function Rf(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,legacyCreateEmbeddedWalletFlag:t}}function K3({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:ua.find(m=>m.id===s.id)??s)}else n=ua.concat(e??[]);let i=t?n[0]:Js,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var Mf=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as Q3}from"react/jsx-runtime";var Lf={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},gd=yd(Lf,void 0,!1),vd=Z3({appConfig:gd,isServerConfigLoaded:!1}),Of=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=Y3(null),a=j3(()=>yd(n??Lf,o,!!n),[n,o]);return If(()=>{if(!n)return;let l=Rf(o,t),s=Mf(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),If(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),Q3(vd.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ge=()=>{let{appConfig:e}=Wf(vd);return e},Xs=()=>{let{isServerConfigLoaded:e}=Wf(vd);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as oC,jsxs as nC}from"react/jsx-runtime";var Nf=J3({ready:!1,app:gd,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),rC=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Df=e=>{let t=Ge(),r=e.authenticated,[o,n]=tC(e.initialScreen);Cd(()=>{!r&&!rC.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=eC(null);Cd(()=>{e.open||(i.current=null)},[e.open]),Cd(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return nC(Nf.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&oC(Km,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},S=()=>X3(Nf);import{jsx as ui,jsxs as iC}from"react/jsx-runtime";var ma=({style:e,...t})=>{let{app:r}=S();return iC("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[ui("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),ui("g",{clipPath:"url(#clip0_1765_9946)",children:ui("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),ui("defs",{children:ui("clipPath",{id:"clip0_1765_9946",children:ui("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Lr=class extends zt{constructor(r,o,n,i,a,l,s,c){super(c||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=s,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new $e(void 0,this.rpcTimeoutDuration),c&&(this.walletEntry=_s[c],this.walletClientType=c)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Ss(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:li,id:"io.metamask"}:{name:om(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ma,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=_s[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,pm(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new ii)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new ce("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ss(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=ai(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Ir(a));return}o(new ce("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=im(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await aC.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:sC,optionalMethods:lC,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),cC&&this.walletEntry){let{redirect:l,href:s}=lm(a,this.walletEntry);um({href:s,name:this.walletEntry.displayName}),this.redirectUri=l;let c=cm(a,this.walletEntry);c?.redirect&&(this.fallbackUniversalRedirectUri=c.redirect),Ps(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Ss(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var bd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>dC(o)).map(o=>Uf(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},ai=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yn:yn,fa=class extends pC{constructor(r,o,n,i,a,l,s,c,m,f,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new $e:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.externalWalletConfig=m,this.privyAppName=f,this.privyAppLogo=u,this.storedConnections=wd()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;J.get(cd)&&(J.getKeys().forEach(o=>{o.startsWith("walletconnect")&&J.del(o)}),J.del(cd));let r=nm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Lo()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new da(r,o,this.rpcConfig,this.chains,i,n.id),s=new pa(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}addImportedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded_imported","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new da(r,o,this.rpcConfig,this.chains,i,n.id),s=!0,c=new pa(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(c)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=wd(),this.emit("walletsUpdated")}}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=wd(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof Lr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Ys(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new di(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new js(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new Qs(this.defaultChain):new Lr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));J.put(dd,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=Uf(r),this.emit("walletsUpdated")}};function Ks(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var uC=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",wd=()=>{let e=J.get(dd);return e&&Array.isArray(e)&&e.map(o=>uC(o)).every(Boolean)?e:[]};import{ofetch as mC}from"ofetch";var fC=[us,fs,ms,gs],el=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=sd,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=mC.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:i,options:a})=>{let l=new Headers(a.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let s=fC.includes(i.toString());if(!l.has("authorization")){let c=await this.client.getAccessToken({disableAutoRefresh:s});c!==null&&l.set("authorization",`Bearer ${c}`)}a.headers=l,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:i})=>{if(i instanceof DOMException&&i.name==="AbortError")throw new ds}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};var Ff=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import mi from"js-cookie";function Bf(e){return e instanceof Wo?"email":e instanceof wn?"sms":e instanceof bo?"siwe":e instanceof Jn?"custom_auth":e instanceof Zr?e.meta.provider:null}import*as Hf from"jose";var Or=class{static parse(t){try{return new Or(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Hf.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var hC=30,tl=class{constructor(){this.authenticateOnce=new Oe(async t=>this._authenticate(t)),this.linkOnce=new Oe(async t=>this._link(t)),this.refreshOnce=new Oe(this._refresh.bind(this)),this.destroyOnce=new Oe(this._destroy.bind(this)),this.forkSessionOnce=new Oe(this._forkSession.bind(this))}get token(){try{let t=J.get(un);return typeof t=="string"?new Or(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=J.get(ks);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=J.get(na);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=J.get(aa(t));if(typeof r=="string"){let o=new Or(r);return o.isExpired()?(J.del(aa(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=mi.get(Rs);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Tm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Or.parse(this.token);return t!==null&&!t.isExpired(hC)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?J.put(aa(t),r):J.del(aa(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:i}=r;this.handleTokenResponse(r);let a=i,l=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0,s=Bf(t);return s&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:s,isNewUser:n}}),s==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:qt(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),lt(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:qt(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),lt(r)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(us,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(fs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),qt(n.user)}catch(n){if(n instanceof Rt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw lt(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(ms,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(yu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw lt(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=J.get(un);if(J.put(un,t),!this.client?.useServerCookies){let o=Or.parse(t)?.expiration;mi.set(ld,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else J.del(un),mi.remove(ld),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(J.put(ks,t),this.client?.useServerCookies||mi.set(Rs,"t",{sameSite:"Strict",secure:!0,expires:30})):(J.del(ks),mi.remove(vm),mi.remove(Rs))}clearForkedToken(){J.del(na)}};var Ed,rl,Vf,ha=class{constructor(t){cs(this,rl);this.apiUrl=t.apiUrl||xs,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||gm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=hu(this,rl,Vf).call(this),Ed||(Ed=new tl),this.session=Ed,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:s,appName:c}){this.connectors||(this.connectors=new fa(this.appId,t,r,o,n,i,a,l,s,c))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new el({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(ju,{action:"verify"})}catch(t){throw le(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Yu,{});return Ff(t.options)}catch(t){throw le(t)}}async unlinkEmail(t){try{let r=await this.api.post(ku,{address:t});return qt(r)}catch(r){throw lt(r)}}async acceptTerms(){try{let t=await this.api.post(Zu,{});return qt(t)}catch(t){throw lt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Wu,{phoneNumber:t});return qt(r)}catch(r){throw lt(r)}}async unlinkWallet(t){try{let r=await this.api.post(wu,{address:t});return qt(r)}catch(r){throw lt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Nu,{provider:t,subject:r});return qt(o)}catch(o){throw lt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(_u,{fid:t});return qt(r)}catch(r){throw lt(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Ku,{telegram_user_id:t});return qt(r)}catch(r){throw lt(r)}}async unlinkPasskey(t){try{let r=await this.api.post(qu,{credential_id:t});return qt(r)}catch(r){throw lt(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(gs,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Qu,t)}catch(r){throw lt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Or.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0,i=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:i}}catch(t){throw lt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(gu,{address:t,token:r})).nonce}catch(o){throw lt(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(vu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){return await this.api.post(Cu,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:i})}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:i});return qt(a)}catch(a){throw lt(a)}}};rl=new WeakSet,Vf=function(){if(typeof window>"u")return null;try{let r=J.get(ia);if(typeof r=="string"&&r.length>0)return r}catch{}let t=yC();try{return J.put(ia,t),t}catch{return t}};import{Turnstile as EC}from"@marsidev/react-turnstile";import{useEffect as TC,useMemo as SC}from"react";import{useMemo as gC,useRef as vC,useContext as CC,useState as Td,createContext as wC}from"react";import{jsx as bC}from"react/jsx-runtime";var Gf=wC({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),nr=class extends et{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},qf=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=vC(null),[i,a]=Td(),[l,s]=Td(),[c,m]=Td(!1),f=gC(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return bC(Gf.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:m,remove(){o&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){o&&(m(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await rm(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new nr("Captcha failed",null,"captcha_timeout")}}},children:e})},be=()=>CC(Gf);import{jsx as zf}from"react/jsx-runtime";var Sd=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=be(),[,s]=SC(()=>r?.split("t:")||[],[r]);if(TC(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return zf("div",{className:"hidden h-0 w-0",children:zf(EC,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as H9,useEffect as wv,useRef as V9,useState as G9}from"react";import Tv from"styled-components";import{createContext as _C,useContext as PC}from"react";var _d=_C({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,crossAppAuthFlow:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedEthereumWallet:E,getMoonpaySignedUrl:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E,initLoginWithTelegram:E,loginWithTelegram:E,generateSiweMessage:E,linkWithSiwe:E,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:E,recoverEmbeddedSolanaWallet:E}),I=()=>PC(_d);import{createContext as xC,useContext as AC}from"react";var Se=xC({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkCrossAppAccount:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTelegram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkCrossAppAccount:E,unlinkFarcaster:E,unlinkTelegram:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,importWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,setWalletRecovery:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,generateSiweMessage:E,linkWithSiwe:E,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:E,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),q=()=>AC(Se);import{useEffect as kC,useState as RC}from"react";var $f=e=>{let[t,r]=RC("auto");return kC(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as MC,useContext as IC,useEffect as WC}from"react";var Kf={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]}},Pd=MC(void 0),jf=()=>IC(Pd);function ke(e,t){if(!t)return;let o=jf().current[e];return WC(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function fi(){let e=jf();return(t,r,...o)=>U(e,t,r,...o)}function xd(e){ke("configureMfa",e)}import{QuestionMarkCircleIcon as t0}from"@heroicons/react/24/outline";import th from"styled-components";import _n,{css as Yf}from"styled-components";import kd from"styled-components";import{Fragment as OC,jsx as Ad,jsxs as NC}from"react/jsx-runtime";var ot=({success:e,fail:t})=>NC(OC,{children:[Ad(mt,{className:e?"success":t?"fail":""}),Ad(Rd,{className:e?"success":t?"fail":""})]}),mt=kd.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,Rd=kd(mt)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,eo=e=>Ad(LC,{color:e.color||"var(--privy-color-foreground-3)"}),LC=kd(mt)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 1rem;
|
|
54
54
|
width: 1rem;
|
|
@@ -58,7 +58,7 @@ Resources:
|
|
|
58
58
|
/* Override default Loader to match button transitions */
|
|
59
59
|
transition: border-color 200ms ease;
|
|
60
60
|
}
|
|
61
|
-
`;import{jsx as
|
|
61
|
+
`;import{jsx as $t,jsxs as il}from"react/jsx-runtime";var ya=_n.button`
|
|
62
62
|
display: flex;
|
|
63
63
|
flex-direction: row;
|
|
64
64
|
align-items: center;
|
|
@@ -80,7 +80,7 @@ Resources:
|
|
|
80
80
|
&& {
|
|
81
81
|
padding: 12px 16px;
|
|
82
82
|
}
|
|
83
|
-
`,
|
|
83
|
+
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(Zf,{disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),ol=({children:e,loading:t,disabled:r,...o})=>$t(DC,{disabled:r,...o,children:t?$t(eo,{color:"var(--privy-color-foreground-accent)"}):e}),DC=_n(ya)`
|
|
84
84
|
position: relative;
|
|
85
85
|
|
|
86
86
|
&& {
|
|
@@ -106,7 +106,7 @@ Resources:
|
|
|
106
106
|
color: var(--privy-color-foreground-accent);
|
|
107
107
|
background-color: var(--privy-color-accent-dark);
|
|
108
108
|
}
|
|
109
|
-
`,
|
|
109
|
+
`,nl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(Zf,{as:"a",disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),Zf=_n(ya)`
|
|
110
110
|
position: relative;
|
|
111
111
|
|
|
112
112
|
&& {
|
|
@@ -132,7 +132,7 @@ Resources:
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
135
|
-
${e=>e.disabled?
|
|
135
|
+
${e=>e.disabled?Yf`
|
|
136
136
|
&&&,
|
|
137
137
|
&&&:hover,
|
|
138
138
|
&&&:active {
|
|
@@ -151,7 +151,7 @@ Resources:
|
|
|
151
151
|
opacity: 1;
|
|
152
152
|
animation: fadein 200ms ease;
|
|
153
153
|
}
|
|
154
|
-
`,
|
|
154
|
+
`,Nr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>$t(UC,{disabled:t||r,...n,children:t?il("span",{children:[$t(eo,{}),o?$t("span",{children:o}):null]}):e}),UC=_n(ya)`
|
|
155
155
|
&& {
|
|
156
156
|
border-width: 1px;
|
|
157
157
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -180,7 +180,7 @@ Resources:
|
|
|
180
180
|
opacity: 1;
|
|
181
181
|
animation: fadein 200ms ease;
|
|
182
182
|
}
|
|
183
|
-
`,
|
|
183
|
+
`,hi=_n.button`
|
|
184
184
|
&& {
|
|
185
185
|
padding: 12px 16px;
|
|
186
186
|
font-weight: 500;
|
|
@@ -193,7 +193,7 @@ Resources:
|
|
|
193
193
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
194
194
|
user-select: none;
|
|
195
195
|
|
|
196
|
-
${e=>e.invisible&&
|
|
196
|
+
${e=>e.invisible&&Yf`
|
|
197
197
|
pointer-events: none;
|
|
198
198
|
`}
|
|
199
199
|
|
|
@@ -211,10 +211,10 @@ Resources:
|
|
|
211
211
|
cursor: not-allowed;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
`,
|
|
214
|
+
`,VM=_n.div`
|
|
215
215
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
216
216
|
height: 44px;
|
|
217
|
-
`,
|
|
217
|
+
`,yi=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>il(FC,{isSubmitting:o,onClick:t,disabled:r,...n,children:[$t("span",{children:e}),$t("span",{children:$t(eo,{})})]}),FC=_n.button`
|
|
218
218
|
&& {
|
|
219
219
|
color: var(--privy-color-accent);
|
|
220
220
|
font-size: 16px;
|
|
@@ -256,7 +256,7 @@ Resources:
|
|
|
256
256
|
cursor: not-allowed;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
`;import
|
|
259
|
+
`;import BC from"styled-components";var Qf=BC.span`
|
|
260
260
|
&& {
|
|
261
261
|
width: 82px;
|
|
262
262
|
height: 82px;
|
|
@@ -268,7 +268,7 @@ Resources:
|
|
|
268
268
|
display: inline-block;
|
|
269
269
|
box-sizing: border-box;
|
|
270
270
|
}
|
|
271
|
-
`;import
|
|
271
|
+
`;import HC from"@heroicons/react/24/outline/ArrowLeftIcon";import VC from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import GC from"@heroicons/react/24/outline/XMarkIcon";import gi from"styled-components";import{jsx as Kt,jsxs as Jf}from"react/jsx-runtime";var qC=({backFn:e})=>Kt("div",{children:Kt(Md,{onClick:e,children:Kt(HC,{height:"16px",width:"16px",strokeWidth:2})})}),zC=({infoFn:e})=>Kt("div",{children:Kt(KC,{"aria-label":"info",onClick:e,children:Kt(VC,{height:"22px",width:"22px",strokeWidth:2})})}),$C=e=>Kt("div",{children:Kt(Md,{"aria-label":"close modal",onClick:e.onClose,children:Kt(GC,{height:"16px",width:"16px",strokeWidth:2})})});var _=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:i}=I(),a=Ge();return Jf(jC,{children:[Jf(YC,{children:[e&&Kt(qC,{backFn:e}),t&&Kt(zC,{infoFn:t})]}),o&&Kt(QC,{id:"privy-dialog-title",children:o}),Kt(ZC,{children:!a.render.standalone&&n&&Kt($C,{onClose:r||(()=>i())})})]})},Md=gi.button`
|
|
272
272
|
&& {
|
|
273
273
|
cursor: pointer;
|
|
274
274
|
display: flex;
|
|
@@ -287,11 +287,11 @@ Resources:
|
|
|
287
287
|
opacity: 1;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
`,
|
|
290
|
+
`,KC=gi(Md)`
|
|
291
291
|
&& {
|
|
292
292
|
background-color: transparent;
|
|
293
293
|
}
|
|
294
|
-
`,
|
|
294
|
+
`,jC=gi.div`
|
|
295
295
|
padding: 16px 0;
|
|
296
296
|
display: flex;
|
|
297
297
|
align-items: center;
|
|
@@ -303,23 +303,23 @@ Resources:
|
|
|
303
303
|
font-weight: 600;
|
|
304
304
|
color: var(--privy-color-foreground);
|
|
305
305
|
}
|
|
306
|
-
`,
|
|
306
|
+
`,YC=gi.div`
|
|
307
307
|
flex: 1;
|
|
308
308
|
align-items: center;
|
|
309
309
|
display: flex;
|
|
310
310
|
gap: 8px;
|
|
311
|
-
`,
|
|
311
|
+
`,ZC=gi.div`
|
|
312
312
|
flex: 1;
|
|
313
313
|
display: flex;
|
|
314
314
|
justify-content: flex-end;
|
|
315
|
-
`,
|
|
315
|
+
`,QC=gi.div`
|
|
316
316
|
overflow: hidden;
|
|
317
317
|
white-space: nowrap;
|
|
318
318
|
max-width: 100%;
|
|
319
319
|
text-overflow: ellipsis;
|
|
320
320
|
text-align: center;
|
|
321
321
|
color: var(--privy-color-foreground-2);
|
|
322
|
-
`;import
|
|
322
|
+
`;import JC from"styled-components";var XC=JC.div`
|
|
323
323
|
display: flex;
|
|
324
324
|
flex-direction: column;
|
|
325
325
|
justify-content: center;
|
|
@@ -342,15 +342,15 @@ Resources:
|
|
|
342
342
|
left: -19px;
|
|
343
343
|
top: -19px;
|
|
344
344
|
}
|
|
345
|
-
`,
|
|
345
|
+
`,Je=XC;import Uo,{css as e0}from"styled-components";var to=Uo.div`
|
|
346
346
|
text-align: left;
|
|
347
347
|
flex-grow: 1;
|
|
348
|
-
`,
|
|
348
|
+
`,al=Uo.div`
|
|
349
349
|
display: flex;
|
|
350
350
|
flex-direction: column;
|
|
351
351
|
justify-content: flex-end;
|
|
352
352
|
flex-grow: 1;
|
|
353
|
-
`,
|
|
353
|
+
`,jt=Uo.div`
|
|
354
354
|
display: flex;
|
|
355
355
|
flex-direction: column;
|
|
356
356
|
gap: 12px;
|
|
@@ -365,13 +365,13 @@ Resources:
|
|
|
365
365
|
&::-webkit-scrollbar {
|
|
366
366
|
display: none;
|
|
367
367
|
}
|
|
368
|
-
`,
|
|
368
|
+
`,Xf=Uo(jt)`
|
|
369
369
|
${e=>{if(e.colorScheme==="light")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;";if(e.colorScheme==="dark")return"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;"}}
|
|
370
370
|
|
|
371
371
|
background-repeat: no-repeat;
|
|
372
372
|
background-size: 100% 32px, 100% 16px;
|
|
373
373
|
background-attachment: local, scroll;
|
|
374
|
-
`,
|
|
374
|
+
`,eh=e0`
|
|
375
375
|
&& {
|
|
376
376
|
width: 100%;
|
|
377
377
|
font-size: 16px;
|
|
@@ -408,22 +408,22 @@ Resources:
|
|
|
408
408
|
max-width: 24px;
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
`,
|
|
411
|
+
`,sl=Uo.div`
|
|
412
412
|
text-align: center;
|
|
413
413
|
font-size: 14px;
|
|
414
414
|
margin-bottom: 24px;
|
|
415
|
-
`,
|
|
416
|
-
${
|
|
417
|
-
`,
|
|
418
|
-
${
|
|
419
|
-
`,
|
|
415
|
+
`,Ee=Uo.button`
|
|
416
|
+
${eh}
|
|
417
|
+
`,Id=Uo.a`
|
|
418
|
+
${eh}
|
|
419
|
+
`,Dr=Uo.div`
|
|
420
420
|
width: 100%;
|
|
421
421
|
height: 100%;
|
|
422
422
|
min-height: inherit;
|
|
423
423
|
display: flex;
|
|
424
424
|
flex-direction: column;
|
|
425
425
|
${e=>e.if?"display: none;":""}
|
|
426
|
-
`;import{Fragment as
|
|
426
|
+
`;import{Fragment as n0,jsx as Pn,jsxs as ga}from"react/jsx-runtime";var rh=()=>{let{navigate:e,app:t}=S();return ga(n0,{children:[Pn(_,{}),ga(r0,{children:[Pn(Je,{children:ga("div",{children:[Pn(Qf,{color:"var(--privy-color-warn-light)"}),Pn(t0,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),ga(o0,{children:[Pn("h3",{children:"Account not found"}),ga("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),Pn(to,{}),Pn(F,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},r0=th.div`
|
|
427
427
|
display: flex;
|
|
428
428
|
flex-direction: column;
|
|
429
429
|
align-items: center;
|
|
@@ -432,11 +432,11 @@ Resources:
|
|
|
432
432
|
width: 100%;
|
|
433
433
|
padding-bottom: 16px;
|
|
434
434
|
margin-top: 24px;
|
|
435
|
-
`,
|
|
435
|
+
`,o0=th.div`
|
|
436
436
|
display: flex;
|
|
437
437
|
flex-direction: column;
|
|
438
438
|
gap: 8px;
|
|
439
|
-
`;import
|
|
439
|
+
`;import ah from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import i0 from"@heroicons/react/24/solid/DocumentCheckIcon";import a0 from"styled-components";import oh from"styled-components";import{jsx as vi,jsxs as nh}from"react/jsx-runtime";var Wd=oh.div`
|
|
440
440
|
margin-top: 16px;
|
|
441
441
|
font-size: 13px;
|
|
442
442
|
text-align: center;
|
|
@@ -445,7 +445,7 @@ Resources:
|
|
|
445
445
|
&& > a {
|
|
446
446
|
color: var(--privy-color-accent);
|
|
447
447
|
}
|
|
448
|
-
`;function
|
|
448
|
+
`;function Ci(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return vi(Wd,{});if(!r&&!t)return vi(Wd,{});let n=!!(t&&r);return nh(Wd,{children:["By logging in I agree to the"," ",r&&vi("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&vi("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=()=>nh(Z,{children:[vi(Do,{}),vi("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),Z=oh.div`
|
|
449
449
|
display: flex;
|
|
450
450
|
align-items: center;
|
|
451
451
|
justify-content: center;
|
|
@@ -472,7 +472,7 @@ Resources:
|
|
|
472
472
|
@media all and (display-mode: standalone) {
|
|
473
473
|
padding-bottom: 30px;
|
|
474
474
|
}
|
|
475
|
-
`;import
|
|
475
|
+
`;import ft from"styled-components";var Ie=ft.div`
|
|
476
476
|
display: flex;
|
|
477
477
|
flex-direction: column;
|
|
478
478
|
align-items: center;
|
|
@@ -480,17 +480,17 @@ Resources:
|
|
|
480
480
|
@media (max-width: 440px) {
|
|
481
481
|
padding: 10px 10px 20px;
|
|
482
482
|
}
|
|
483
|
-
`,
|
|
483
|
+
`,de=ft.div`
|
|
484
484
|
font-size: 18px;
|
|
485
485
|
line-height: 30px;
|
|
486
486
|
text-align: center;
|
|
487
487
|
font-weight: 600;
|
|
488
488
|
margin-bottom: 10px;
|
|
489
|
-
`,
|
|
489
|
+
`,ue=ft.div`
|
|
490
490
|
font-size: 0.875rem;
|
|
491
491
|
|
|
492
492
|
text-align: center;
|
|
493
|
-
`,
|
|
493
|
+
`,Tr=ft.div`
|
|
494
494
|
display: flex;
|
|
495
495
|
flex-direction: column;
|
|
496
496
|
align-items: center;
|
|
@@ -500,7 +500,7 @@ Resources:
|
|
|
500
500
|
@media (max-width: 440px) {
|
|
501
501
|
padding: 10px 10px 20px;
|
|
502
502
|
}
|
|
503
|
-
`,
|
|
503
|
+
`,xn=ft.div`
|
|
504
504
|
display: flex;
|
|
505
505
|
flex-direction: column;
|
|
506
506
|
align-items: stretch;
|
|
@@ -508,7 +508,7 @@ Resources:
|
|
|
508
508
|
padding: 1rem 0rem 0rem;
|
|
509
509
|
flex-grow: 1;
|
|
510
510
|
width: 100%;
|
|
511
|
-
`,
|
|
511
|
+
`,Yt=ft.div`
|
|
512
512
|
width: 25px;
|
|
513
513
|
display: flex;
|
|
514
514
|
align-items: center;
|
|
@@ -520,19 +520,19 @@ Resources:
|
|
|
520
520
|
width: 25px !important;
|
|
521
521
|
color: var(--privy-color-accent);
|
|
522
522
|
}
|
|
523
|
-
`,
|
|
523
|
+
`,Zt=ft.div`
|
|
524
524
|
display: flex;
|
|
525
525
|
align-items: center;
|
|
526
526
|
gap: 10px;
|
|
527
527
|
font-size: 0.875rem;
|
|
528
528
|
line-height: 1rem;
|
|
529
529
|
text-align: left;
|
|
530
|
-
`,
|
|
530
|
+
`,Tt=ft.div`
|
|
531
531
|
display: flex;
|
|
532
532
|
flex-direction: column;
|
|
533
533
|
gap: 10px;
|
|
534
534
|
padding-top: 20px;
|
|
535
|
-
`,
|
|
535
|
+
`,ll=ft.div`
|
|
536
536
|
display: flex;
|
|
537
537
|
flex-direction: column;
|
|
538
538
|
align-items: stretch;
|
|
@@ -540,11 +540,11 @@ Resources:
|
|
|
540
540
|
padding: 1rem 0rem 0rem;
|
|
541
541
|
flex-grow: 1;
|
|
542
542
|
width: 100%;
|
|
543
|
-
`,
|
|
543
|
+
`,cl=ft.div`
|
|
544
544
|
display: flex;
|
|
545
545
|
gap: 5px;
|
|
546
546
|
width: 100%;
|
|
547
|
-
`,
|
|
547
|
+
`,dl=ft.button`
|
|
548
548
|
&& {
|
|
549
549
|
background-color: transparent;
|
|
550
550
|
color: var(--privy-color-foreground-3);
|
|
@@ -562,7 +562,7 @@ Resources:
|
|
|
562
562
|
&&:hover {
|
|
563
563
|
color: var(--privy-color-error);
|
|
564
564
|
}
|
|
565
|
-
`,
|
|
565
|
+
`,pl=ft.div`
|
|
566
566
|
display: flex;
|
|
567
567
|
align-items: center;
|
|
568
568
|
gap: 0.5rem;
|
|
@@ -572,7 +572,7 @@ Resources:
|
|
|
572
572
|
height: 20px !important;
|
|
573
573
|
width: 20px !important;
|
|
574
574
|
}
|
|
575
|
-
`,
|
|
575
|
+
`,An=ft.div`
|
|
576
576
|
display: flex;
|
|
577
577
|
align-items: center;
|
|
578
578
|
gap: 6px;
|
|
@@ -586,15 +586,15 @@ Resources:
|
|
|
586
586
|
display: flex !important;
|
|
587
587
|
align-items: flex-end;
|
|
588
588
|
}
|
|
589
|
-
`,
|
|
589
|
+
`,ul=ft.div`
|
|
590
590
|
width: 100%;
|
|
591
591
|
display: flex;
|
|
592
592
|
justify-content: space-between;
|
|
593
|
-
`,
|
|
593
|
+
`,ih=ft.p`
|
|
594
594
|
text-align: left;
|
|
595
595
|
width: 100%;
|
|
596
596
|
color: var(--privy-color-foreground-3) !important;
|
|
597
|
-
`,
|
|
597
|
+
`,va=ft.button`
|
|
598
598
|
display: flex;
|
|
599
599
|
flex-direction: row;
|
|
600
600
|
align-items: center;
|
|
@@ -624,7 +624,7 @@ Resources:
|
|
|
624
624
|
&:hover {
|
|
625
625
|
text-decoration: underline;
|
|
626
626
|
}
|
|
627
|
-
`,Ke=
|
|
627
|
+
`,Ke=ft.div`
|
|
628
628
|
display: flex;
|
|
629
629
|
align-items: center;
|
|
630
630
|
justify-content: center;
|
|
@@ -639,12 +639,12 @@ Resources:
|
|
|
639
639
|
width: auto !important;
|
|
640
640
|
color: white;
|
|
641
641
|
}
|
|
642
|
-
`,
|
|
642
|
+
`,ml=ft.div`
|
|
643
643
|
color: var(--privy-color-error);
|
|
644
|
-
`;import{Fragment as
|
|
644
|
+
`;import{Fragment as c0,jsx as ro,jsxs as Ca}from"react/jsx-runtime";var sh=()=>{let{user:e,logout:t}=q(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=S(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=I(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let m=async f=>{f.preventDefault(),await a(),e&&Gt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:u=>{console.error(u),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:u,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return ro(s0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:m,onDecline:c})},s0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Ca(c0,{children:[ro(_,{closeable:!1}),ro(i0,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),ro(de,{style:{marginTop:24},children:"One last step"}),ro(ue,{children:"By signing up, you agree to our terms and privacy policy."}),Ca(jt,{style:{marginTop:24},children:[e&&Ca(Id,{target:"_blank",href:e,children:["View Terms ",ro(ah,{style:{marginLeft:"auto"}})]}),t&&Ca(Id,{target:"_blank",href:t,children:["View Privacy Policy ",ro(ah,{style:{marginLeft:"auto"}})]})]}),Ca(l0,{style:{marginTop:24},children:[ro(Nr,{onClick:o,children:"No thanks"}),ro(F,{onClick:r,children:"Accept"})]}),ro($,{})]}),l0=a0.div`
|
|
645
645
|
display: flex;
|
|
646
646
|
gap: 10px;
|
|
647
|
-
`;import
|
|
647
|
+
`;import ch from"styled-components";import d0 from"styled-components";var fl=d0.span`
|
|
648
648
|
&& {
|
|
649
649
|
width: 82px;
|
|
650
650
|
height: 82px;
|
|
@@ -659,7 +659,7 @@ Resources:
|
|
|
659
659
|
transition: border-color 800ms;
|
|
660
660
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
661
661
|
}
|
|
662
|
-
`;import{jsx as
|
|
662
|
+
`;import{jsx as lh}from"react/jsx-runtime";var hl=({style:e,...t})=>lh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:lh("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Ld,jsx as oo,jsxs as yl}from"react/jsx-runtime";var dh=()=>{let{navigate:e,app:t}=S(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return yl(Ld,{children:[oo(_,{}),yl(p0,{children:[oo(Je,{children:yl("div",{children:[oo(fl,{}),oo(hl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),yl(u0,{children:[typeof r=="string"?oo("h3",{children:r}):oo(Ld,{children:r}),typeof o=="string"?oo("p",{children:o}):oo(Ld,{children:o})]}),t?.allowlistConfig.errorCtaLink?oo(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):oo(F,{onClick:()=>{e("LANDING")},children:n})]})]})},p0=ch.div`
|
|
663
663
|
display: flex;
|
|
664
664
|
flex-direction: column;
|
|
665
665
|
align-items: center;
|
|
@@ -667,11 +667,11 @@ Resources:
|
|
|
667
667
|
gap: 24px;
|
|
668
668
|
width: 100%;
|
|
669
669
|
padding-bottom: 16px;
|
|
670
|
-
`,
|
|
670
|
+
`,u0=ch.div`
|
|
671
671
|
display: flex;
|
|
672
672
|
flex-direction: column;
|
|
673
673
|
gap: 8px;
|
|
674
|
-
`;import
|
|
674
|
+
`;import h0 from"@heroicons/react/20/solid/CheckIcon";import y0 from"@heroicons/react/24/outline/EnvelopeIcon";import g0 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Nd,useState as ba}from"react";import{isMobile as v0}from"react-device-detect";import Rn from"styled-components";import Qt from"styled-components";var Sr=Qt.div`
|
|
675
675
|
display: flex;
|
|
676
676
|
flex-direction: column;
|
|
677
677
|
align-items: flex-start;
|
|
@@ -679,36 +679,36 @@ Resources:
|
|
|
679
679
|
margin-top: auto;
|
|
680
680
|
gap: 16px;
|
|
681
681
|
flex-grow: 100;
|
|
682
|
-
`,
|
|
682
|
+
`,wt=Qt.div`
|
|
683
683
|
display: flex;
|
|
684
684
|
flex-direction: column;
|
|
685
685
|
align-items: center;
|
|
686
686
|
justify-content: center;
|
|
687
687
|
flex-grow: 1;
|
|
688
688
|
width: 100%;
|
|
689
|
-
`,
|
|
689
|
+
`,ph=Qt.div`
|
|
690
690
|
display: flex;
|
|
691
691
|
flex-direction: column;
|
|
692
692
|
align-items: center;
|
|
693
693
|
width: 100%;
|
|
694
|
-
`,
|
|
694
|
+
`,wi=Qt(wt)`
|
|
695
695
|
padding: 20px 0;
|
|
696
|
-
`,
|
|
696
|
+
`,ir=Qt(wt)`
|
|
697
697
|
gap: 16px;
|
|
698
|
-
`,
|
|
698
|
+
`,Fo=Qt.div`
|
|
699
699
|
display: flex;
|
|
700
700
|
flex-direction: column;
|
|
701
701
|
width: 100%;
|
|
702
|
-
`,
|
|
702
|
+
`,Xe=Qt.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
flex-direction: column;
|
|
705
705
|
gap: 8px;
|
|
706
|
-
`,
|
|
706
|
+
`,YI=Qt.div`
|
|
707
707
|
display: flex;
|
|
708
708
|
flex-direction: column;
|
|
709
709
|
justify-content: space-between;
|
|
710
710
|
height: 100%;
|
|
711
|
-
`,
|
|
711
|
+
`,uh=Qt.div`
|
|
712
712
|
display: flex;
|
|
713
713
|
flex-direction: column;
|
|
714
714
|
justify-content: flex-start;
|
|
@@ -731,15 +731,15 @@ Resources:
|
|
|
731
731
|
color: var(--privy-color-foreground-3);
|
|
732
732
|
font-size: 14px;
|
|
733
733
|
}
|
|
734
|
-
`,
|
|
734
|
+
`,oe=Qt.div`
|
|
735
735
|
height: 16px;
|
|
736
|
-
`,
|
|
736
|
+
`,ne=Qt.div`
|
|
737
737
|
height: 12px;
|
|
738
|
-
`,
|
|
738
|
+
`,mh=Qt.div`
|
|
739
739
|
position: relative;
|
|
740
|
-
`,
|
|
740
|
+
`,bi=Qt.div`
|
|
741
741
|
height: ${e=>e.height??"12"}px;
|
|
742
|
-
`,
|
|
742
|
+
`,fh=Qt.div`
|
|
743
743
|
background-color: var(--privy-color-accent);
|
|
744
744
|
display: flex;
|
|
745
745
|
justify-content: center;
|
|
@@ -747,9 +747,9 @@ Resources:
|
|
|
747
747
|
border-radius: 50%;
|
|
748
748
|
border-color: white;
|
|
749
749
|
border-width: 2px !important;
|
|
750
|
-
`;import
|
|
750
|
+
`;import Od from"styled-components";import{Fragment as f0,jsx as wa,jsxs as yh}from"react/jsx-runtime";var kn=({title:e,description:t,children:r,...o})=>wa(hh,{...o,children:yh(f0,{children:[wa("h3",{children:e}),typeof t=="string"?wa("p",{children:t}):t,r]})}),no=Od(kn)`
|
|
751
751
|
margin-bottom: 24px;
|
|
752
|
-
`,ye=({title:e,description:t,icon:r,children:o,...n})=>
|
|
752
|
+
`,ye=({title:e,description:t,icon:r,children:o,...n})=>yh(m0,{...n,children:[r||null,wa("h3",{children:e}),t&&typeof t=="string"?wa("p",{children:t}):t,o]}),hh=Od.div`
|
|
753
753
|
display: flex;
|
|
754
754
|
flex-direction: column;
|
|
755
755
|
justify-content: flex-start;
|
|
@@ -769,7 +769,7 @@ Resources:
|
|
|
769
769
|
color: var(--privy-color-foreground-2);
|
|
770
770
|
font-size: 14px;
|
|
771
771
|
}
|
|
772
|
-
`,
|
|
772
|
+
`,m0=Od(hh)`
|
|
773
773
|
align-items: center;
|
|
774
774
|
text-align: center;
|
|
775
775
|
gap: 16px;
|
|
@@ -777,7 +777,7 @@ Resources:
|
|
|
777
777
|
h3 {
|
|
778
778
|
margin-bottom: 24px;
|
|
779
779
|
}
|
|
780
|
-
`;import{Fragment as
|
|
780
|
+
`;import{Fragment as x0,jsx as Wt,jsxs as To}from"react/jsx-runtime";var Dd=6,gh=new Array(Dd).fill(""),C0=1400,w0=30;var Ch=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:i}=S(),{closePrivyModal:a,resendEmailCode:l,resendSmsCode:s,getAuthMeta:c,loginWithCode:m,updateWallets:f,createAnalyticsEvent:u}=I(),{authenticated:g,logout:w,user:y}=q(),[b,P]=ba(gh),[A,T]=ba(!1),[x,R]=ba(null),[M,D]=ba(null),[B,K]=ba(0);i.current=()=>null;let j=c()?.email?0:1,L=Ne,N=L-500;Nd(()=>{if(B){let te=setTimeout(()=>{K(B-1)},1e3);return()=>clearTimeout(te)}},[B]),Nd(()=>{if(g&&A&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let ee=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},N);return()=>clearTimeout(ee)}if(Gt(y,e?.embeddedWallets?.createOnLogin)){let ee=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:_e=>{console.error(_e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:_e,screen:"AwaitingPasswordlessCodeScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},N);return()=>clearTimeout(ee)}else{f();let ee=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),L);return()=>clearTimeout(ee)}}},[g,A,y]),Nd(()=>{if(x&&M===0){let te=setTimeout(()=>{P(gh),R(null),document.querySelector("input[name=code-0]")?.focus()},C0);return()=>clearTimeout(te)}},[x]);let W=te=>{te.preventDefault();let ee=te.currentTarget.value.replace(" ","");if(ee==="")return;if(isNaN(Number(ee))){R("Code should be numeric"),D(1);return}R(null),D(null);let _e=Number(te.currentTarget.name?.charAt(5)),Te=[...ee||[""]].slice(0,Dd-_e),ze=[...b.slice(0,_e),...Te,...b.slice(_e+Te.length)];P(ze);let Ve=Te.length,pt=Math.min(Math.max(_e+Ve,0),Dd-1);isNaN(Number(te.currentTarget.value))||document.querySelector(`input[name=code-${pt}]`)?.focus(),ze.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${pt}]`)?.blur(),m(ze.join("")).then(()=>T(!0)).catch(ae=>{if(ae?.status===422)R("Invalid or expired verification code");else if(ae instanceof Rt&&ae.privyErrorCode==="cannot_link_more_of_type")R(ae.message);else if(ae instanceof Rt&&ae.privyErrorCode==="max_accounts_reached"){console.error(new wr(ae).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(ae instanceof Rt&&ae.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(ae instanceof Rt&&ae.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:ae,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else R("Issue verifying code");D(0)}))},ve=te=>{M===1&&(R(null),D(null));let ee=[...b.slice(0,te),"",...b.slice(te+1)];P(ee),te>0&&document.querySelector(`input[name=code-${te-1}]`)?.focus()},Me=j==0?Wt(y0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Wt(g0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Y=j==0?To("p",{children:["Please check ",Wt(vh,{children:c()?.email})," for an email from privy.io and enter your code below."]}):To("p",{children:["Please check ",Wt(vh,{children:c()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return To(x0,{children:[Wt(_,{backFn:()=>o()},"header"),To(b0,{children:[Wt(ye,{title:"Enter confirmation code",description:Y,icon:Me}),To(ph,{children:[To(E0,{children:[Wt(T0,{fail:!!x,success:A,children:Wt("span",{children:x||(A?"Success!":"")})}),Wt("div",{children:b.map((te,ee)=>Wt("input",{name:`code-${ee}`,type:"text",value:b[ee],onChange:W,onKeyUp:_e=>{_e.key==="Backspace"&&ve(ee)},inputMode:"numeric",autoFocus:ee===0,pattern:"[0-9]",className:`${A?"success":""} ${x?"fail":""}`,autoComplete:v0?"one-time-code":"off"},ee))})]}),To(S0,{children:[To("span",{children:["Didn't get ",j==0?"an email":"a message","?"]}),B?To(P0,{children:[Wt(h0,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),Wt("span",{children:"Code sent"})]}):Wt(_0,{children:Wt("button",{onClick:async()=>{K(w0),j==0?await l():await s()},children:"Resend code"})})]})]})]}),Wt($,{})]})},b0=Rn.div`
|
|
781
781
|
display: flex;
|
|
782
782
|
flex-direction: column;
|
|
783
783
|
align-items: flex-start;
|
|
@@ -785,7 +785,7 @@ Resources:
|
|
|
785
785
|
margin: auto;
|
|
786
786
|
gap: 16px;
|
|
787
787
|
flex-grow: 1;
|
|
788
|
-
`,
|
|
788
|
+
`,E0=Rn.div`
|
|
789
789
|
display: flex;
|
|
790
790
|
flex-direction: column;
|
|
791
791
|
width: 100%;
|
|
@@ -842,7 +842,7 @@ Resources:
|
|
|
842
842
|
transform: translate(1px, 0px);
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
`,
|
|
845
|
+
`,T0=Rn.div`
|
|
846
846
|
line-height: 20px;
|
|
847
847
|
height: 20px;
|
|
848
848
|
font-size: 13px;
|
|
@@ -850,7 +850,7 @@ Resources:
|
|
|
850
850
|
display: flex;
|
|
851
851
|
justify-content: flex-end;
|
|
852
852
|
width: 100%;
|
|
853
|
-
`,
|
|
853
|
+
`,S0=Rn.div`
|
|
854
854
|
font-size: 13px;
|
|
855
855
|
color: var(--privy-color-foreground);
|
|
856
856
|
display: flex;
|
|
@@ -861,13 +861,13 @@ Resources:
|
|
|
861
861
|
// Equal opposing size buffer to account for auto margining when the
|
|
862
862
|
// success/fail text does not show up
|
|
863
863
|
padding-bottom: 32px;
|
|
864
|
-
`,
|
|
864
|
+
`,_0=Rn.div`
|
|
865
865
|
color: var(--privy-color-accent);
|
|
866
866
|
padding: 2px 0;
|
|
867
867
|
> button {
|
|
868
868
|
text-decoration: underline;
|
|
869
869
|
}
|
|
870
|
-
`,
|
|
870
|
+
`,P0=Rn.div`
|
|
871
871
|
display: flex;
|
|
872
872
|
align-items: center;
|
|
873
873
|
justify-content: center;
|
|
@@ -876,10 +876,10 @@ Resources:
|
|
|
876
876
|
gap: 4px;
|
|
877
877
|
background: var(--privy-color-background-2);
|
|
878
878
|
color: var(--privy-color-foreground-2);
|
|
879
|
-
`,
|
|
879
|
+
`,vh=Rn.span`
|
|
880
880
|
font-weight: 500;
|
|
881
881
|
word-break: break-all;
|
|
882
|
-
`;import
|
|
882
|
+
`;import I0 from"@heroicons/react/24/solid/CheckCircleIcon";import W0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ud,useRef as L0,useState as Ti}from"react";import O0 from"styled-components";import A0 from"styled-components";import{Fragment as M0,jsx as Ei,jsxs as R0}from"react/jsx-runtime";var wh=({icon:e})=>{let t=e;return Ei(M0,{children:Ei(k0,{children:R0("div",{children:[Ei(ot,{}),typeof t=="string"?Ei("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Ei(t,{style:{width:"38px",height:"38px"}}):Ei("span",{})]})})})},k0=A0.div`
|
|
883
883
|
display: flex;
|
|
884
884
|
flex-direction: column;
|
|
885
885
|
justify-content: center;
|
|
@@ -902,14 +902,14 @@ Resources:
|
|
|
902
902
|
left: -19px;
|
|
903
903
|
top: -19px;
|
|
904
904
|
}
|
|
905
|
-
`;import{Fragment as
|
|
905
|
+
`;import{Fragment as D0,jsx as Ur,jsxs as Fd}from"react/jsx-runtime";var Eh=500,bh=Eh*2,Th=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=S(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=be(),f=L0([]),u=N=>{f.current=[N,...f.current]},[g,w]=Ti(!0);Ud(()=>{let N=setTimeout(w,bh,!1);return u(N),()=>{f.current.forEach(W=>clearTimeout(W)),f.current=[]}},[]);let[y,b]=Ti(""),[P,A]=Ti("Checking that you are a human..."),[T,x]=Ti(Ur(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,M]=Ti(!1),[D,B]=Ti(3),K=r?.captchaModalData,j=async N=>{try{await K?.callback(N),K?.onSuccessNavigateTo&&n(K?.onSuccessNavigateTo,!1)}catch(W){if(W instanceof nr)return;{let ve={error:W,previousScreen:e||"LANDING"};i({errorModalData:ve}),n(K?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Ud(()=>{if(a==="success"){let N=setTimeout(async()=>{let W=await s();!W||K?.userIntentRequired||j(W)},bh);u(N)}else if(a==="ready"){let N=setTimeout(()=>{a==="ready"&&m()},Eh);u(N)}},[a]),Ud(()=>{if(!g)switch(a){case"success":b("Success!"),A("CAPTCHA passed successfully."),x(Ur(F,{onClick:()=>{M(!0),j(l)},disabled:!K?.userIntentRequired,loading:R,children:K?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":b(""),A("Checking that you are a human..."),x(Ur(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":b("Something went wrong"),D<=0?(A("If you use an adblocker or VPN, try disabling and re-attempting."),x(null)):(A("You did not pass CAPTCHA. Please try again."),x(Ur(F,{onClick:L,children:"Retry"})));break;case"ready":default:break}},[a,g,R]);let L=async()=>{if(D<=0)return;B(W=>W-1),c(),m();let N=await s();!N||K?.userIntentRequired||j(N)};return Fd(D0,{children:[Ur(_,{backFn:!e||t===e?void 0:o}),Fd(N0,{children:[a==="success"?Ur(I0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Ur(W0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Ur(wh,{}),Fd(Xe,{children:[y?Ur("h3",{children:y}):null,Ur("p",{children:P})]}),T]}),Ur(Z,{})]})},N0=O0.div`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
align-items: center;
|
|
909
909
|
justify-content: center;
|
|
910
910
|
gap: 24px;
|
|
911
911
|
width: 100%;
|
|
912
|
-
`;import{isMobile as
|
|
912
|
+
`;import{isMobile as Bh}from"react-device-detect";import Hh from"styled-components";import U0 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Bd}from"react/jsx-runtime";var gl=({icon:e,name:t})=>typeof e=="string"?Bd("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Bd(U0,{}):e?Bd(e,{}):null;import H0 from"styled-components";import{keyframes as F0,css as Sh}from"styled-components";var B0=F0`
|
|
913
913
|
from, to {
|
|
914
914
|
background: var(--privy-color-foreground-4);
|
|
915
915
|
color: var(--privy-color-foreground-4);
|
|
@@ -919,13 +919,13 @@ Resources:
|
|
|
919
919
|
background: var(--privy-color-foreground-accent);
|
|
920
920
|
color: var(--privy-color-foreground-accent);
|
|
921
921
|
}
|
|
922
|
-
`,
|
|
923
|
-
${e=>e.$isLoading?
|
|
922
|
+
`,vl=Sh`
|
|
923
|
+
${e=>e.$isLoading?Sh`
|
|
924
924
|
width: 35%;
|
|
925
|
-
animation: ${
|
|
925
|
+
animation: ${B0} 2s linear infinite;
|
|
926
926
|
border-radius: var(--privy-border-radius-sm);
|
|
927
927
|
`:""}
|
|
928
|
-
`;import{jsx as
|
|
928
|
+
`;import{jsx as G0}from"react/jsx-runtime";var Jt=({children:e,color:t,isLoading:r,className:o})=>G0(V0,{$color:t,$isLoading:r,className:o,children:e}),V0=H0.span`
|
|
929
929
|
padding: 0.125rem 0.5rem;
|
|
930
930
|
font-size: 0.75rem;
|
|
931
931
|
font-weight: 500;
|
|
@@ -934,8 +934,8 @@ Resources:
|
|
|
934
934
|
|
|
935
935
|
${e=>e.$color==="green"?"color:var(--privy-color-success-dark);background-color:var(--privy-color-success-light);":e.$color==="red"?"color:var(--privy-color-error);background-color:var(--privy-color-error-light);":e.$color==="gray"?"color:var(--privy-color-foreground-2);background-color:var(--privy-color-background-2);":""}
|
|
936
936
|
|
|
937
|
-
${
|
|
938
|
-
`;import{GlobeAltIcon as ew}from"@heroicons/react/24/outline";import{jsx as Br,jsxs as Oh}from"react/jsx-runtime";var Nh=({...e})=>Oh("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Br("defs",{children:Oh("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Br("stop",{offset:"0",stopColor:"#f1562b"}),Br("stop",{offset:"0.3",stopColor:"#f1542b"}),Br("stop",{offset:"0.41",stopColor:"#f04d2a"}),Br("stop",{offset:"0.49",stopColor:"#ef4229"}),Br("stop",{offset:"0.5",stopColor:"#ef4029"}),Br("stop",{offset:"0.56",stopColor:"#e83e28"}),Br("stop",{offset:"0.67",stopColor:"#e13c26"}),Br("stop",{offset:"1",stopColor:"#df3c26"})]})}),Br("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Br("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as Dh,jsxs as X0}from"react/jsx-runtime";var Uh=({...e})=>X0("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Dh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),Dh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Hr,jsxs as Ma}from"react/jsx-runtime";var Fh=({style:e,...t})=>Ma("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Hr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),Ma("g",{mask:"url(#mask0_16909_31415)",children:[Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Hr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),Ma("defs",{children:[Ma("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Hr("stop",{stopColor:"#002D72"}),Hr("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),Ma("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Hr("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Hr("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as pr,jsxs as Ii}from"react/jsx-runtime";var Bh=e=>Ii("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[pr("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),pr("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),pr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),pr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),pr("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),Ii("defs",{children:[Ii("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[pr("stop",{stopColor:"white"}),pr("stop",{offset:"1",stopColor:"white"})]}),Ii("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[pr("stop",{stopColor:"#8697FF"}),pr("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Ii("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[pr("stop",{stopColor:"#8697FF"}),pr("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Ii("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[pr("stop",{stopColor:"white"}),pr("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as de,jsxs as ur}from"react/jsx-runtime";var Hh=({style:e,...t})=>ur("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[de("g",{clipPath:"url(#clip0_5_32)",children:ur("g",{clipPath:"url(#clip1_5_32)",children:[de("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:de("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),de("g",{mask:"url(#mask0_5_32)",children:de("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),de("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),de("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),de("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),de("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),de("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),de("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),de("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),de("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),de("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),ur("defs",{children:[ur("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[de("stop",{stopColor:"#174299"}),de("stop",{offset:"1",stopColor:"#001E59"})]}),ur("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[de("stop",{offset:"0.770277",stopColor:"#FF4000"}),de("stop",{offset:"1",stopColor:"#8754C9"})]}),ur("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[de("stop",{stopColor:"#FF4000"}),de("stop",{offset:"1",stopColor:"#8754C9"})]}),ur("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[de("stop",{stopColor:"#8754C9"}),de("stop",{offset:"1",stopColor:"#FF4000"})]}),ur("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[de("stop",{offset:"0.723929",stopColor:"#FFF700"}),de("stop",{offset:"1",stopColor:"#FF9901"})]}),ur("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[de("stop",{stopColor:"#FFF700"}),de("stop",{offset:"1",stopColor:"#FF9901"})]}),ur("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[de("stop",{stopColor:"#FFF700"}),de("stop",{offset:"1",stopColor:"#FF9901"})]}),ur("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[de("stop",{offset:"0.59513",stopColor:"#00AAFF"}),de("stop",{offset:"1",stopColor:"#01DA40"})]}),ur("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[de("stop",{stopColor:"#00AAFF"}),de("stop",{offset:"1",stopColor:"#01DA40"})]}),ur("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[de("stop",{stopColor:"#00AAFF"}),de("stop",{offset:"1",stopColor:"#01DA40"})]}),de("clipPath",{id:"clip0_5_32",children:de("rect",{width:"120",height:"120",fill:"white"})}),de("clipPath",{id:"clip1_5_32",children:de("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as ao,jsxs as Vh}from"react/jsx-runtime";var Gh=({style:e,...t})=>Vh("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[ao("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Vh("g",{filter:"url(#filter0_d_12393_20043)",children:[ao("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),ao("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),ao("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),ao("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),ao("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),ao("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),ao("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),ao("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),ao("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Ia,jsxs as qh}from"react/jsx-runtime";var zh=({style:e,...t})=>qh("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[qh("g",{clipPath:"url(#clip0_1704_1423)",children:[Ia("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Ia("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Ia("defs",{children:Ia("clipPath",{id:"clip0_1704_1423",children:Ia("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as $h}from"react/jsx-runtime";var xr={coinbase_wallet:{logo:_n,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:_n,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:yi,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:to,displayName:"Phantom"},rainbow:{logo:Hh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Ea,displayName:"WalletConnect"},zerion:{logo:zh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Nh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Fh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Gh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Bh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},Vo=(e,t,r)=>{if(xr[e]?.displayName)return e==="coinbase_wallet"?xr[r].displayName:xr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Al=(e,t,r)=>{if(xr[e]?.logo)return e==="coinbase_wallet"?xr[r].logo:xr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Ea},kl=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return $h(Uh,{height:r,width:o});default:return $h(ew,{height:r,width:o})}};function Wi(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as tw,useEffect as rw,useState as ow}from"react";import{createContext as nw}from"react";import{jsx as iw}from"react/jsx-runtime";var jh=nw({}),Yh=({children:e})=>{let t=Je(),[r,o]=ow({});return ke("login",{onComplete:(n,a,i,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(J.put(Kh(t.id),s.type),s.type==="wallet"?(J.put(Yd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(J.del(Yd(t.id)),o({accountType:s.type})))}}),rw(()=>{if(!t.id)return;let n=J.get(Kh(t.id)),a=J.get(Yd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:a}:{accountType:n})},[t.id]),iw(jh.Provider,{value:r,children:e})},Kh=e=>`privy:${e}:recent-login-method`,Yd=e=>`privy:${e}:recent-login-wallet-client`,Pt=()=>tw(jh);import{jsx as Rl,jsxs as lw}from"react/jsx-runtime";var On=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=P(),{connectWallet:i}=I(),l=Pt(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,u;return n.connectorType==="phantom"?u=()=>{Oo()?(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(Zh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Zh&&!c&&!Rs()?u=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:u=()=>{Wi(window.navigator.userAgent)&&!event?.isTrusted||(i(n,s),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},lw(aw,{onClick:u,children:[Rl(_l,{icon:Al(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),Rl("span",{children:Vo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?Rl(sw,{color:"gray",children:"Recent"}):Rl("span",{id:"connect-text",children:"Connect"})]})},aw=Qh(be)`
|
|
937
|
+
${vl}
|
|
938
|
+
`;import{GlobeAltIcon as z0}from"@heroicons/react/24/outline";import{jsx as Fr,jsxs as _h}from"react/jsx-runtime";var Ph=({...e})=>_h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Fr("defs",{children:_h("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Fr("stop",{offset:"0",stopColor:"#f1562b"}),Fr("stop",{offset:"0.3",stopColor:"#f1542b"}),Fr("stop",{offset:"0.41",stopColor:"#f04d2a"}),Fr("stop",{offset:"0.49",stopColor:"#ef4229"}),Fr("stop",{offset:"0.5",stopColor:"#ef4029"}),Fr("stop",{offset:"0.56",stopColor:"#e83e28"}),Fr("stop",{offset:"0.67",stopColor:"#e13c26"}),Fr("stop",{offset:"1",stopColor:"#df3c26"})]})}),Fr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Fr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as xh,jsxs as q0}from"react/jsx-runtime";var Ah=({...e})=>q0("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[xh("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),xh("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Br,jsxs as Ea}from"react/jsx-runtime";var kh=({style:e,...t})=>Ea("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),Br("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),Ea("g",{mask:"url(#mask0_16909_31415)",children:[Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),Br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),Ea("defs",{children:[Ea("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Br("stop",{stopColor:"#002D72"}),Br("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),Ea("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Br("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),Br("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as ar,jsxs as Si}from"react/jsx-runtime";var Rh=e=>Si("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[ar("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),ar("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),ar("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),ar("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),ar("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),Si("defs",{children:[Si("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"1",stopColor:"white"})]}),Si("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"#8697FF"}),ar("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),Si("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[ar("stop",{stopColor:"white"}),ar("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as pe,jsxs as sr}from"react/jsx-runtime";var Mh=({style:e,...t})=>sr("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[pe("g",{clipPath:"url(#clip0_5_32)",children:sr("g",{clipPath:"url(#clip1_5_32)",children:[pe("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:pe("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),pe("g",{mask:"url(#mask0_5_32)",children:pe("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),pe("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),pe("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),pe("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),pe("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),pe("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),pe("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),pe("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),pe("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),pe("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),sr("defs",{children:[sr("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#174299"}),pe("stop",{offset:"1",stopColor:"#001E59"})]}),sr("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[pe("stop",{offset:"0.770277",stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FF4000"}),pe("stop",{offset:"1",stopColor:"#8754C9"})]}),sr("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#8754C9"}),pe("stop",{offset:"1",stopColor:"#FF4000"})]}),sr("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[pe("stop",{offset:"0.723929",stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[pe("stop",{stopColor:"#FFF700"}),pe("stop",{offset:"1",stopColor:"#FF9901"})]}),sr("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[pe("stop",{offset:"0.59513",stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),sr("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[pe("stop",{stopColor:"#00AAFF"}),pe("stop",{offset:"1",stopColor:"#01DA40"})]}),pe("clipPath",{id:"clip0_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})}),pe("clipPath",{id:"clip1_5_32",children:pe("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as io,jsxs as Ih}from"react/jsx-runtime";var Wh=({style:e,...t})=>Ih("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[io("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Ih("g",{filter:"url(#filter0_d_12393_20043)",children:[io("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),io("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),io("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),io("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),io("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),io("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),io("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Ta,jsxs as Lh}from"react/jsx-runtime";var Oh=({style:e,...t})=>Lh("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Lh("g",{clipPath:"url(#clip0_1704_1423)",children:[Ta("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Ta("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Ta("defs",{children:Ta("clipPath",{id:"clip0_1704_1423",children:Ta("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Nh}from"react/jsx-runtime";var _r={coinbase_wallet:{logo:En,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:En,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:li,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Xr,displayName:"Phantom"},rainbow:{logo:Mh,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:ma,displayName:"WalletConnect"},zerion:{logo:Oh,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Ph,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:kh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:Wh,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:Rh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"}},Bo=(e,t,r)=>{if(_r[e]?.displayName)return e==="coinbase_wallet"?_r[r].displayName:_r[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Cl=(e,t,r)=>{if(_r[e]?.logo)return e==="coinbase_wallet"?_r[r].logo:_r[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return ma},wl=(e,t)=>{let r=t?.height||16,o=t?.width||16;switch(e){case 8453:return Nh(Ah,{height:r,width:o});default:return Nh(z0,{height:r,width:o})}};function _i(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{useContext as $0,useEffect as K0,useState as j0}from"react";import{createContext as Y0}from"react";import{jsx as Z0}from"react/jsx-runtime";var Uh=Y0({}),Fh=({children:e})=>{let t=Ge(),[r,o]=j0({});return ke("login",{onComplete:(n,i,a,l,s)=>{!s||s.type==="passkey"||s.type==="cross_app"||s.type==="wallet"&&s.walletClientType==="privy"||(J.put(Dh(t.id),s.type),s.type==="wallet"?(J.put(Hd(t.id),s.walletClientType),o({accountType:s.type,walletClientType:s.walletClientType})):(J.del(Hd(t.id)),o({accountType:s.type})))}}),K0(()=>{if(!t.id)return;let n=J.get(Dh(t.id)),i=J.get(Hd(t.id));n&&o(n==="wallet"?{accountType:n,walletClientType:i}:{accountType:n})},[t.id]),Z0(Uh.Provider,{value:r,children:e})},Dh=e=>`privy:${e}:recent-login-method`,Hd=e=>`privy:${e}:recent-login-wallet-client`,St=()=>$0(Uh);import{jsx as bl,jsxs as X0}from"react/jsx-runtime";var Mn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=S(),{connectWallet:a}=I(),l=St(),s=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,c=window.matchMedia("(display-mode: standalone)").matches,m;return n.connectorType==="phantom"?m=()=>{Lo()?(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Bh?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&Bh&&!c&&!bs()?m=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:m=()=>{_i(window.navigator.userAgent)&&!event?.isTrusted||(a(n,s),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},X0(Q0,{onClick:m,children:[bl(gl,{icon:Cl(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),bl("span",{children:Bo(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),l?.walletClientType===s?bl(J0,{color:"gray",children:"Recent"}):bl("span",{id:"connect-text",children:"Connect"})]})},Q0=Hh(Ee)`
|
|
939
939
|
/* Show "Connect" on hover */
|
|
940
940
|
> #connect-text {
|
|
941
941
|
font-weight: 500;
|
|
@@ -957,16 +957,16 @@ Resources:
|
|
|
957
957
|
display: none;
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
`,
|
|
960
|
+
`,J0=Hh(Jt)`
|
|
961
961
|
margin-left: auto;
|
|
962
|
-
`;import{Fragment as
|
|
962
|
+
`;import{Fragment as nw,jsx as Pi,jsxs as iw}from"react/jsx-runtime";var ew=["coinbase_wallet"],tw=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet","cryptocom"],rw=[],ow=["phantom"],xi=({connectOnly:e})=>{let{connectors:t}=I(),{app:r}=S(),o=Ho(r.appearance.walletList,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return iw(nw,{children:[...o]})},Ho=(e,t,r,o,n)=>{let i=[],a=[],l=[],s=t.find(c=>c.connectorType==="wallet_connect_v2");for(let c of e)if(c==="detected_wallets"){let m=t.filter(({connectorType:f,walletClientType:u})=>u==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="crypto.com_wallet_extension"?!o.includes("cryptocom"):f==="injected"&&!o.includes(u));for(let f of m){let{walletClientType:u,walletBranding:g}=f;(u==="unknown"?a:i).push(Pi(Mn,{connectOnly:r,provider:u,logo:g.icon,displayName:g.name,connector:f},`${c}-${u}`))}}else if(ow.includes(c)){let m=t.find(f=>f.connectorType==="injected"&&f.walletClientType===c||f.connectorType===c);m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else if(tw.includes(c)){let m=t.find(f=>c==="uniswap"?f.walletClientType==="uniswap_wallet_extension":c==="cryptocom"?f.walletClientType==="crypto.com_wallet_extension":f.connectorType==="injected"&&f.walletClientType===c);n&&!m&&(m=s),m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else if(ew.includes(c)){let m=t.find(({connectorType:f})=>f===c);m&&i.push(Pi(Mn,{connectOnly:r,provider:c,connector:m},c))}else rw.includes(c)?s&&l.push(Pi(Mn,{connectOnly:r,provider:c,connector:s},c)):c==="wallet_connect"&&s&&l.push(Pi(Mn,{connectOnly:r,provider:c,connector:s},c));return[...a,...i,...l]};import{Fragment as aw,jsx as Sa,jsxs as sw}from"react/jsx-runtime";var Vh=()=>{let{app:e}=S(),{linkingOrConnectingHint:t}=I(),r=t?`Connect the wallet with address ${Qe(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return sw(aw,{children:[Sa(_,{},"header"),Sa(no,{title:"Connect your wallet",description:r}),Sa(jt,{children:Sa(xi,{connectOnly:!0})}),Sa($,{})]})};import{Fragment as lw,jsx as Ai,jsxs as cw}from"react/jsx-runtime";var Gh=()=>{let{app:e}=S(),{linkingOrConnectingHint:t}=I(),r=t?`Connect the wallet with address ${Qe(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return cw(lw,{children:[Ai(_,{},"header"),Ai(kn,{title:"Connect your wallet",description:r}),Ai(jt,{children:Ai(xi,{connectOnly:!0})}),e&&Ai(Ci,{app:e,alwaysShowImplicitConsent:!0}),Ai($,{})]})};import{useEffect as Yh,useState as Zh}from"react";import{isMobile as gw}from"react-device-detect";import vw from"styled-components";import{useEffect as Vd,useState as Vo}from"react";import{isMobile as El}from"react-device-detect";import Kh from"styled-components";import{useEffect as qh,useRef as dw}from"react";var pw=(e,t)=>{let r=dw(()=>{});qh(()=>{r.current=e}),qh(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},zh=pw;import{useState as uw,useEffect as mw,useCallback as fw}from"react";function $h(){let[e,t]=uw(!1),r=fw(()=>{document.hidden&&t(!0)},[]);return mw(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as qd,jsx as ht,jsxs as ki}from"react/jsx-runtime";var Gd=2,zd=e=>e?.privyErrorCode==="linked_to_another_user"?Eo.ERROR_USER_EXISTS:e instanceof Ct&&!e.details.default?e.details:e instanceof ni?Eo.ERROR_TIMED_OUT:e instanceof ii?Eo.ERROR_USER_REJECTED_CONNECTION:Eo.ERROR_WALLET_CONNECTION,jh=()=>{let[e,t]=Vo(!1),[r,o]=Vo(!1),[n,i]=Vo(void 0),{authenticated:a,logout:l}=q(),{app:s,navigate:c,navigateBack:m,lastScreen:f,currentScreen:u,setModalData:g}=S(),{getAuthFlow:w,walletConnectionStatus:y,closePrivyModal:b,initLoginWithWallet:P,loginWithWallet:A,updateWallets:T,createAnalyticsEvent:x}=I(),{walletConnectors:R}=q(),[M,D]=Vo(0),{user:B}=q(),[K]=Vo(B?.linkedAccounts.length||0),[j,L]=Vo(""),[N,W]=Vo(""),[ve,Me]=Vo(!1),{hasTabbedAway:Y}=$h(),{enabled:te,token:ee}=be(),_e=El&&y?.connector?.connectorType==="wallet_connect_v2"||El&&y?.connector?.connectorType==="coinbase_wallet"||El&&y?.connector?.connectorType==="injected"&&y?.connector?.walletClientType==="phantom",Te=y?.status==="connected",ze=y?.status==="switching_to_supported_chain";Vd(()=>{let G=w(),ie=G instanceof bo?G:void 0;if(Te&&!ie&&(te&&!ee&&!a?(g({captchaModalData:{callback:ut=>P(y.connectedWallet,ut).then(()=>{Me(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):P(y.connectedWallet,ee).then(()=>{Me(!0)})),ie&&_e&&Te&&!ie.preparedMessage){ie.buildSiweMessage();return}!ie||_e||!Te||r||(async()=>{o(!0),i(void 0);try{y?.connector?.connectorType==="wallet_connect_v2"&&y?.connector?.walletClientType==="metamask"&&await nd(2500),await pt()}catch(ut){console.warn("Auto-prompted signature failed",ut)}finally{o(!1)}})()},[M,Te,ve]),Vd(()=>{if(B&&e){let ie=Ne-500;if(s?.legal.requireUsersAcceptTerms&&!B.hasAcceptedTerms){let Xi=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ie);return()=>clearTimeout(Xi)}if(Gt(B,s?.embeddedWallets?.createOnLogin)){let Xi=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:ns=>{console.error(ns),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ns,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ie);return()=>clearTimeout(Xi)}T();let ut=setTimeout(()=>b({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Ne);return()=>clearTimeout(ut)}},[B,e]);let Ve=G=>{if(G?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(G?.privyErrorCode==="max_accounts_reached"){console.error(new wr(G).toString()),c("USER_LIMIT_REACHED_SCREEN");return}else if(G?.privyErrorCode==="user_does_not_exist"){c("ACCOUNT_NOT_FOUND_SCREEN");return}i(zd(G))};async function pt(){try{await A(),t(!0)}catch(G){Ve(G)}finally{o(!1)}}Vd(()=>{y?.connectError&&Ve(y?.connectError)},[y]),zh(()=>{let G=Fe==="wallet_connect_v2"&&y?.connector instanceof Lr?y.connector.redirectUri:void 0;G&&L(G);let ie=Fe==="wallet_connect_v2"&&y?.connector instanceof Lr?y.connector.fallbackUniversalRedirectUri:void 0;ie&&W(ie)},y?.connector instanceof Lr&&!j?500:null);let Fe=y?.connector?.connectorType||"injected",ae=y?.connector?.walletClientType||"unknown",Ft=_r[ae]?.displayName||y?.connector?.walletBranding.name||"Browser Extension",Rr=_r[ae]?.logo||y?.connector?.walletBranding.icon||(G=>ht(si,{...G})),jr=Ft==="Browser Extension"?Ft.toLowerCase():Ft,O;e?O=`Successfully connected with ${jr}`:n?O=n.message:ze?O="Switching networks":Te?O=r&&_e?"Signing":"Sign to verify":O=`Waiting for ${jr}`;let rt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let G=B?.linkedAccounts.length||0;K===G?rt="Wallet was already linked.":rt="You\u2019re good to go!"}else M>=Gd&&n?rt="Unable to connect wallet":n?rt=n.detail:ze?rt="Switch your wallet to the requested network.":Te&&_e?rt="Sign the message in your wallet to verify it belongs to you.":ae==="metamask"&&El?rt="Click continue to open and connect MetaMask.":ae==="metamask"?rt="For the best experience, connect only one wallet at a time.":Fe==="wallet_connect"?rt="Open your mobile wallet app to continue":Fe==="coinbase_wallet"&&(bs()||(bd(B)?rt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":rt="Open the Coinbase app on your phone to continue."));let Mr=R?.walletConnectors?.find(G=>G.walletClientType==="coinbase_wallet"),V=ae==="coinbase_wallet"&&(bd(B)||n===Eo.ERROR_USER_EXISTS);return ki(qd,{children:[ht(_,{backFn:!f||u===f?void 0:m}),ki(hw,{children:[ht($d,{walletLogo:Rr,success:e,fail:!!n}),ki(Xe,{children:[ht("h3",{children:O}),ht("p",{children:rt}),!Te&&j&&!Y?ki("p",{children:["Still here?"," ",ht("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),N&&ki(qd,{children:[" ","or"," ",ht("a",{href:N,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),V?ht(F,{onClick:()=>Mr&&Mr?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Eo.ERROR_USER_EXISTS&&u!==f?ht(F,{onClick:m,children:"Use a different wallet"}):Te&&!e&&_e?ht(F,{onClick:()=>{o(!0),pt()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&M<Gd?ht(F,{onClick:()=>{D(M+1),i(void 0),Te?(o(!0),pt()):y?.connectRetry()},disabled:!e&&(!n?.retryable||M>=Gd),children:"Retry"}):!e&&!n?ht(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ht(Z,{})]})},hw=Kh.div`
|
|
963
963
|
display: flex;
|
|
964
964
|
flex-direction: column;
|
|
965
965
|
align-items: center;
|
|
966
966
|
justify-content: center;
|
|
967
967
|
gap: 24px;
|
|
968
968
|
width: 100%;
|
|
969
|
-
`,
|
|
969
|
+
`,yw=Kh.div`
|
|
970
970
|
display: flex;
|
|
971
971
|
flex-direction: column;
|
|
972
972
|
justify-content: center;
|
|
@@ -989,14 +989,14 @@ Resources:
|
|
|
989
989
|
left: -19px;
|
|
990
990
|
top: -19px;
|
|
991
991
|
}
|
|
992
|
-
|
|
992
|
+
`,$d=e=>{let t=e.walletLogo;return ht(qd,{children:ht(yw,{children:ki("div",{children:[ht(ot,{success:e.success,fail:e.fail}),typeof t=="string"?ht("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ht(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as ww,jsx as So,jsxs as Kd}from"react/jsx-runtime";var Tl=2,Qh=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=S(),{walletConnectionStatus:i,closePrivyModal:a}=I(),[l,s]=Zh(void 0),[c,m]=Zh(0),f=i?.status==="connected",u=i?.status==="switching_to_supported_chain";Yh(()=>{if(f){let R;if(n?.externalConnectWallet?.onCompleteNavigateTo){let M=n.externalConnectWallet.onCompleteNavigateTo;R=setTimeout(()=>{t(M)},Ne)}else R=setTimeout(a,Ne);return()=>clearTimeout(R)}},[f]);let g=R=>{s(zd(R))};Yh(()=>{i?.connectError&&g(i?.connectError)},[i]);let w=i?.connector?.connectorType||"injected",y=i?.connector?.walletClientType||"unknown",b=_r[y]?.displayName||i?.connector?.walletBranding.name||"Browser Extension",P=_r[y]?.logo||i?.connector?.walletBranding.icon||(R=>So(si,{...R})),A=b==="Browser Extension"?b.toLowerCase():b,T;f?T=`Successfully connected with ${A}`:l?T=l.message:u?T="Switching networks":T=`Waiting for ${A}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return f?x="You\u2019re good to go!":c>=Tl&&l?x="Unable to connect wallet":l?x=l.detail:u?x="Switch your wallet to the requested network.":y==="metamask"&&gw?x="Click to continue to open and connect MetaMask.":y==="metamask"?x="For the best experience, connect only one wallet at a time.":w==="wallet_connect_v2"?x="Open your mobile wallet app to continue":w==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),Kd(ww,{children:[So(_,{backFn:o===r?void 0:e}),Kd(Cw,{children:[So($d,{walletLogo:P,success:f,fail:!!l}),Kd(Xe,{children:[So("h3",{children:T}),So("p",{children:x})]}),l==Eo.ERROR_USER_EXISTS?So(F,{onClick:e,children:"Use a different wallet"}):!f&&l?.retryable&&c<Tl?So(F,{onClick:()=>{m(c+1),s(void 0),i?.connectRetry()},disabled:!f&&(!l?.retryable||c>=Tl),children:"Retry"}):!f&&l&&c>=Tl?So(F,{onClick:e,children:"Use a different wallet"}):null]}),So(Z,{})]})},Cw=vw.div`
|
|
993
993
|
display: flex;
|
|
994
994
|
flex-direction: column;
|
|
995
995
|
align-items: center;
|
|
996
996
|
justify-content: center;
|
|
997
997
|
gap: 24px;
|
|
998
998
|
width: 100%;
|
|
999
|
-
`;import{useEffect as
|
|
999
|
+
`;import{useEffect as ey,useMemo as bw,useState as Ew}from"react";import Tw from"styled-components";import{jsx as Jh}from"react/jsx-runtime";var Xh=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?Jh("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):Jh("span",{})};import{Fragment as _w,jsx as _o,jsxs as Sl}from"react/jsx-runtime";var ty=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=S(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=I(),[i,a]=Ew({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=Ne,c=new C(`There was an issue connecting your ${l.name} account. Please try again.`),m=new Oe(async w=>{if(!e?.crossAppAuth?.popup){a({error:c});return}try{let y=await r({appId:w,popup:e.crossAppAuth.popup});a({data:y})}catch(y){y instanceof C?a({error:y}):y instanceof Rt?(e?.crossAppAuth?.popup&&e.crossAppAuth.popup.close(),a({error:c})):a({error:c})}}),f=()=>{i.data&&(o(),e?.crossAppAuth?.onSuccess(i.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(i.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=f,ey(()=>{l.id.length&&m.execute(l.id)},[l.id]),ey(()=>{if(!i.data)return;let w=setTimeout(f,s);return()=>clearTimeout(w)},[i.data]);let{title:u,subtitle:g}=bw(()=>i.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:i.error?{title:"Authentication failed",subtitle:i.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[i,l.name]);return Sl(_w,{children:[_o(_,{onClose:f}),_o(oe,{}),Sl(Sw,{children:[_o(Je,{children:Sl("div",{children:[_o(ot,{success:!!i.data,fail:!!i.error}),_o(Xh,{name:l.name,logoUrl:l.logoUrl})]})}),Sl(Xe,{children:[_o("h3",{children:u}),_o("p",{children:g})]})]}),_o(ne,{}),_o(Z,{})]})},Sw=Tw.div`
|
|
1000
1000
|
display: flex;
|
|
1001
1001
|
flex-direction: column;
|
|
1002
1002
|
align-items: center;
|
|
@@ -1004,7 +1004,7 @@ Resources:
|
|
|
1004
1004
|
margin-left: 27px;
|
|
1005
1005
|
margin-right: 27px;
|
|
1006
1006
|
gap: 24px;
|
|
1007
|
-
`;import
|
|
1007
|
+
`;import Iw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ww,useMemo as Lw,useState as Ow}from"react";import Nw from"styled-components";import _l from"styled-components";import{jsx as jd,jsxs as Rw}from"react/jsx-runtime";var Pl=()=>jd(Pw,{children:Rw(xw,{children:[jd(Aw,{}),jd(kw,{})]})}),Pw=_l.div`
|
|
1008
1008
|
display: flex;
|
|
1009
1009
|
justify-content: center;
|
|
1010
1010
|
align-items: center;
|
|
@@ -1016,14 +1016,14 @@ Resources:
|
|
|
1016
1016
|
@media all and (display-mode: standalone) {
|
|
1017
1017
|
margin-bottom: 30px;
|
|
1018
1018
|
}
|
|
1019
|
-
`,
|
|
1019
|
+
`,xw=_l.div`
|
|
1020
1020
|
position: relative;
|
|
1021
1021
|
height: 140px;
|
|
1022
1022
|
width: 140px;
|
|
1023
1023
|
|
|
1024
1024
|
opacity: 1;
|
|
1025
1025
|
animation: fadein 200ms ease;
|
|
1026
|
-
`,
|
|
1026
|
+
`,Aw=_l.div`
|
|
1027
1027
|
position: absolute;
|
|
1028
1028
|
top: 0;
|
|
1029
1029
|
right: 0;
|
|
@@ -1036,7 +1036,7 @@ Resources:
|
|
|
1036
1036
|
border: 4px solid var(--privy-color-accent-light);
|
|
1037
1037
|
border-radius: 50%;
|
|
1038
1038
|
}
|
|
1039
|
-
`,
|
|
1039
|
+
`,kw=_l.div`
|
|
1040
1040
|
position: absolute;
|
|
1041
1041
|
top: 0;
|
|
1042
1042
|
right: 0;
|
|
@@ -1060,20 +1060,20 @@ Resources:
|
|
|
1060
1060
|
transform: rotate(360deg);
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
|
-
`;var
|
|
1063
|
+
`;var ry=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var We=class extends Error{constructor(r,o){super(o);this.type=r}};function Ri(e){let t=e.type;return typeof t=="string"&&ry.includes(t)}function Mw(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function In(e){return Ri(e)&&e.type==="wallet_not_on_device"}function oy(e){return Ri(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Wn(e){return!!(Ri(e)&&e.type==="mfa_timeout")}function Ln(e){return!!(Ri(e)&&e.type==="missing_or_invalid_mfa")}function Yd(e){return!!(Ri(e)&&e.type==="mfa_verification_max_attempts_reached")}function xl(e){return!!(Ri(e)&&e.message.includes("code 429"))}function Al(e){return!!(Mw(e)&&e.message==="MFA canceled")}function Zd({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function kl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?Zd({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Rl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function Qd({api:e,provider:t}){let r=gn(),o=ti(),n=await ri(r);try{return t==="icloud"?{url:(await e.post(Uu,{client_type:"web"})).url}:{url:(await e.post(Du,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(i){throw le(i)}}async function ny({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during OAuth flow");try{return(await e.post(Fu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=le(i);throw a.privyErrorCode?new C(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as ay,jsx as Mi,jsxs as Jd}from"react/jsx-runtime";var iy=1,sy=()=>{let{authenticated:e,user:t,getAccessToken:r}=q(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=I(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=S(),m=Lw(()=>Date.now(),[]),[f,u]=Ow(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:y,address:b}=l?.connectWallet,P=T=>{f||(u(!0),w(typeof T=="string"?new Error(T):T))};Ww(()=>{let T=b?t?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"&&M.address===b):he(t),x;return!e||!T?P("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let M=await r();if(!M)return P("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:M,address:T.address}),y&&await i.verifyMfa({accessToken:M});let D=(Date.now()-m)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<iy?x=setTimeout(()=>{a(g)},(iy-D)*1e3):a(g)}catch(D){if(In(D)&&T.recoveryMethod==="privy"){let B=await r();if(!B)return P("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:T.address}}),(await i?.recover({address:T.address,accessToken:B,recoveryMethod:T.recoveryMethod}))?.address||P(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}}),a(g)}catch{P("An error has occurred, please try again.")}}else if(In(D)&&T.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:T.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let B=Rl(T.recoveryMethod);a(B)}else P(D)}})(),()=>clearTimeout(x)):void 0},[e,t,i]);let A=()=>{P("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=A,Jd(ay,{children:[Mi(_,{onClose:A}),f?Jd(ay,{children:[Jd(ir,{children:[Mi(Iw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Mi(ye,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Mi(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Mi(Pl,{}),Mi(Dw,{})]})},Dw=Nw.div`
|
|
1064
1064
|
height: 44px;
|
|
1065
|
-
`;import
|
|
1065
|
+
`;import Uw from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Fw}from"react";import{Fragment as Bw,jsx as Ii,jsxs as ly}from"react/jsx-runtime";var cy=()=>{let{user:e}=q(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=I(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let f=he(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Fw(()=>{let f=setTimeout(m,As);return()=>clearTimeout(f)},[]),a.current=m,ly(Bw,{children:[Ii(_,{onClose:m}),Ii(oe,{}),ly(ir,{children:[Ii(Uw,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Ii(ye,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Ii(ne,{}),Ii($,{})]})};import Hw from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Vw from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as uy,useRef as Gw,useState as Xd}from"react";import Go from"styled-components";import{Fragment as Jw,jsx as ct,jsxs as Hr}from"react/jsx-runtime";var my=()=>{let[e,t]=Xd(null),{authenticated:r,user:o,getAccessToken:n}=q(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=I(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),m=he(o)?.address,{onFailure:f,onSuccess:u,origin:g,appId:w,appClientId:y}=s.keyExport,b=A=>{i({shouldCallAuthOnSuccess:!1}),f(typeof A=="string"?new Error(A):A)},P=()=>{i({shouldCallAuthOnSuccess:!1}),u(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:m}})};return uy(()=>{let A=he(o);if(!r||!A)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[r,o]),c.current=P,Hr(Jw,{children:[ct(_,{onClose:P}),Hr($w,{children:[Hr(ye,{icon:ct(Vw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Hr(Zw,{children:[ct(zw,{style:{marginRight:6}}),Qe(m)]}),ct("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Hr(Kw,{children:[Hr(dy,{children:[ct(py,{children:"1"}),Hr("span",{children:[ct("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),Hr(dy,{children:[ct(py,{children:"2"}),ct("span",{children:"Copy this key into your other wallet"})]})]}),ct("div",{style:{width:"100%"},children:e&&ct(qw,{origin:g,appId:w,appClientId:y,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),Hr(Qw,{children:[Hr("div",{children:[ct(Hw,{viewBox:"0 0 20 18"}),ct("h4",{children:"Warning"})]}),ct("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ct($,{})]})};function qw(e){let[t,r]=Xd(e.dimensions.width),[o,n]=Xd(void 0),i=Gw(null);return uy(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),ct("div",{ref:i,children:t&&Hr(jw,{children:[ct("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ts(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o},{token:e.accessToken})}),ct(Yw,{children:"Loading..."})]})})}function zw(e){return ct("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ct("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var $w=Go.div`
|
|
1066
1066
|
display: flex;
|
|
1067
1067
|
flex-direction: column;
|
|
1068
1068
|
text-align: left;
|
|
1069
|
-
`,
|
|
1069
|
+
`,Kw=Go.div`
|
|
1070
1070
|
display: flex;
|
|
1071
1071
|
flex-direction: column;
|
|
1072
1072
|
gap: 24px;
|
|
1073
1073
|
padding-bottom: 16px;
|
|
1074
1074
|
margin-left: 11px;
|
|
1075
1075
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
1076
|
-
`,
|
|
1076
|
+
`,dy=Go.div`
|
|
1077
1077
|
display: flex;
|
|
1078
1078
|
align-items: top;
|
|
1079
1079
|
gap: 8px;
|
|
@@ -1082,7 +1082,7 @@ Resources:
|
|
|
1082
1082
|
color: var(--privy-color-accent);
|
|
1083
1083
|
text-decoration: underline;
|
|
1084
1084
|
}
|
|
1085
|
-
`,
|
|
1085
|
+
`,py=Go.div`
|
|
1086
1086
|
display: flex;
|
|
1087
1087
|
align-items: center;
|
|
1088
1088
|
justify-content: center;
|
|
@@ -1096,11 +1096,11 @@ Resources:
|
|
|
1096
1096
|
border-radius: 100%;
|
|
1097
1097
|
background: var(--privy-color-background);
|
|
1098
1098
|
color: var(--privy-color-accent);
|
|
1099
|
-
`,
|
|
1099
|
+
`,jw=Go.div`
|
|
1100
1100
|
overflow: visible;
|
|
1101
1101
|
position: relative;
|
|
1102
1102
|
height: 44px;
|
|
1103
|
-
`,
|
|
1103
|
+
`,Yw=Go.div`
|
|
1104
1104
|
position: absolute;
|
|
1105
1105
|
display: flex;
|
|
1106
1106
|
align-items: center;
|
|
@@ -1112,7 +1112,7 @@ Resources:
|
|
|
1112
1112
|
border-radius: var(--privy-border-radius-md);
|
|
1113
1113
|
background-color: var(--privy-color-background-2);
|
|
1114
1114
|
color: var(--privy-color-foreground-3);
|
|
1115
|
-
`,
|
|
1115
|
+
`,Zw=Go.div`
|
|
1116
1116
|
display: flex;
|
|
1117
1117
|
align-items: center;
|
|
1118
1118
|
padding-top: 1px;
|
|
@@ -1125,7 +1125,7 @@ Resources:
|
|
|
1125
1125
|
font-size: 12px;
|
|
1126
1126
|
font-weight: 500;
|
|
1127
1127
|
margin: auto;
|
|
1128
|
-
`,
|
|
1128
|
+
`,Qw=Go.div`
|
|
1129
1129
|
border: 1px solid var(--privy-color-background-2) !important;
|
|
1130
1130
|
border-radius: var(--privy-border-radius-md);
|
|
1131
1131
|
padding: 16px;
|
|
@@ -1147,9 +1147,9 @@ Resources:
|
|
|
1147
1147
|
color: var(--privy-color-error);
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
1150
|
-
`;import
|
|
1150
|
+
`;import t4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as r4,useState as fy}from"react";import o4 from"styled-components";import{useCallback as Xw,useRef as e4}from"react";function Ml(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=I(),o=e4(!1);return{createWallet:Xw(async i=>{let a=await we();if(!a)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let l=await r(ei);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((g,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),c]))throw new Error("walletProxy.create did not send a response.");let f=await e();if(!f)throw new Error("Failed to refresh user.");let u=he(f);if(!u)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:u.address}}),o.current=!0,u}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as i4,jsx as Wi,jsxs as hy}from"react/jsx-runtime";var yy=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=S(),[i,a]=fy(""),{embeddedWallets:l}=Ge(),{authenticated:s}=q(),{closePrivyModal:c}=I(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:u}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=Ml(),[y,b]=fy(null),P=new Oe(async()=>{try{let T=await w();if(!T)return;b(T),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(T){a(T.message)}});r4(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let T=kl({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(T)}P.execute()},[g,s]);let A=()=>{y?(m(y),c({shouldCallAuthOnSuccess:u})):(f(new Mt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?hy(i4,{children:[Wi(_,{closeable:!1}),hy(ir,{children:[Wi(t4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Wi(ye,{title:"Something went wrong",description:i})]}),Wi(F,{onClick:A,children:"Close"}),Wi(n4,{})]}):Wi(Pl,{})},n4=o4.div`
|
|
1151
1151
|
height: 44px;
|
|
1152
|
-
`;import{useEffect as
|
|
1152
|
+
`;import{useEffect as J4,useState as Nl}from"react";import{useCallback as ap,useEffect as Q4}from"react";import d4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as p4,useState as rp}from"react";import a4 from"@heroicons/react/24/outline/ArrowPathIcon";import s4 from"@heroicons/react/24/outline/EyeIcon";import l4 from"@heroicons/react/24/outline/EyeSlashIcon";import _t,{css as ep}from"styled-components";var c4=ep`
|
|
1153
1153
|
font-size: 14px;
|
|
1154
1154
|
font-style: normal;
|
|
1155
1155
|
font-weight: 400;
|
|
@@ -1157,8 +1157,8 @@ Resources:
|
|
|
1157
1157
|
letter-spacing: -0.008px;
|
|
1158
1158
|
text-align: left;
|
|
1159
1159
|
transition: color 0.1s ease-in;
|
|
1160
|
-
`,
|
|
1161
|
-
${
|
|
1160
|
+
`,Il=_t.span`
|
|
1161
|
+
${c4}
|
|
1162
1162
|
transition: color 0.1s ease-in;
|
|
1163
1163
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1164
1164
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1166,18 +1166,18 @@ Resources:
|
|
|
1166
1166
|
&[aria-hidden='true'] {
|
|
1167
1167
|
visibility: hidden;
|
|
1168
1168
|
}
|
|
1169
|
-
|
|
1169
|
+
`,qo=_t.div`
|
|
1170
1170
|
display: flex;
|
|
1171
1171
|
flex-direction: column;
|
|
1172
1172
|
justify-content: center;
|
|
1173
1173
|
flex-grow: 1;
|
|
1174
|
-
`,
|
|
1175
|
-
${e=>e.hideAnimations&&
|
|
1174
|
+
`,zo=_t(F)`
|
|
1175
|
+
${e=>e.hideAnimations&&ep`
|
|
1176
1176
|
&& {
|
|
1177
1177
|
transition: none;
|
|
1178
1178
|
}
|
|
1179
1179
|
`}
|
|
1180
|
-
`,
|
|
1180
|
+
`,gy=ep`
|
|
1181
1181
|
&& {
|
|
1182
1182
|
width: 100%;
|
|
1183
1183
|
border-width: 1px;
|
|
@@ -1192,8 +1192,8 @@ Resources:
|
|
|
1192
1192
|
font-weight: 300;
|
|
1193
1193
|
line-height: 22px; /* 137.5% */
|
|
1194
1194
|
}
|
|
1195
|
-
`,
|
|
1196
|
-
${
|
|
1195
|
+
`,Li=_t.input`
|
|
1196
|
+
${gy}
|
|
1197
1197
|
|
|
1198
1198
|
&::placeholder {
|
|
1199
1199
|
color: var(--privy-color-foreground-3);
|
|
@@ -1204,15 +1204,15 @@ Resources:
|
|
|
1204
1204
|
overflow: hidden;
|
|
1205
1205
|
text-overflow: ellipsis;
|
|
1206
1206
|
white-space: nowrap;
|
|
1207
|
-
`,
|
|
1208
|
-
${
|
|
1209
|
-
|
|
1207
|
+
`,vy=_t.div`
|
|
1208
|
+
${gy}
|
|
1209
|
+
`,$o=_t.div`
|
|
1210
1210
|
position: relative;
|
|
1211
1211
|
width: 100%;
|
|
1212
1212
|
display: flex;
|
|
1213
1213
|
align-items: center;
|
|
1214
1214
|
justify-content: ${({centered:e})=>e?"center":"space-between"};
|
|
1215
|
-
`,
|
|
1215
|
+
`,Ko=_t.div`
|
|
1216
1216
|
display: flex;
|
|
1217
1217
|
flex-direction: column;
|
|
1218
1218
|
align-items: center;
|
|
@@ -1234,12 +1234,12 @@ Resources:
|
|
|
1234
1234
|
font-weight: 400;
|
|
1235
1235
|
line-height: 20px;
|
|
1236
1236
|
}
|
|
1237
|
-
`,
|
|
1237
|
+
`,_a=_t.div`
|
|
1238
1238
|
display: flex;
|
|
1239
1239
|
flex-direction: column;
|
|
1240
1240
|
gap: 10px;
|
|
1241
1241
|
padding-bottom: 1rem;
|
|
1242
|
-
`,
|
|
1242
|
+
`,Pa=_t.div`
|
|
1243
1243
|
display: flex;
|
|
1244
1244
|
text-align: left;
|
|
1245
1245
|
align-items: center;
|
|
@@ -1259,13 +1259,13 @@ Resources:
|
|
|
1259
1259
|
> :first-child {
|
|
1260
1260
|
min-width: 24px;
|
|
1261
1261
|
}
|
|
1262
|
-
`,
|
|
1262
|
+
`,ZD=_t.div`
|
|
1263
1263
|
height: var(--privy-height-modal-full);
|
|
1264
1264
|
|
|
1265
1265
|
@media (max-width: 440px) {
|
|
1266
1266
|
height: var(--privy-height-modal-compact);
|
|
1267
1267
|
}
|
|
1268
|
-
`,
|
|
1268
|
+
`,tp=_t(ya)`
|
|
1269
1269
|
display: flex;
|
|
1270
1270
|
flex: 1;
|
|
1271
1271
|
gap: 4px;
|
|
@@ -1277,7 +1277,7 @@ Resources:
|
|
|
1277
1277
|
border-color: var(--privy-color-foreground-3);
|
|
1278
1278
|
border-width: 1px;
|
|
1279
1279
|
}
|
|
1280
|
-
`,
|
|
1280
|
+
`,Oi=_t.div`
|
|
1281
1281
|
position: absolute;
|
|
1282
1282
|
right: 0.5rem;
|
|
1283
1283
|
|
|
@@ -1285,7 +1285,7 @@ Resources:
|
|
|
1285
1285
|
flex-direction: row;
|
|
1286
1286
|
justify-content: space-around;
|
|
1287
1287
|
align-items: center;
|
|
1288
|
-
`,
|
|
1288
|
+
`,Cy=_t(a4)`
|
|
1289
1289
|
height: 1.25rem;
|
|
1290
1290
|
width: 1.25rem;
|
|
1291
1291
|
stroke: var(--privy-color-accent);
|
|
@@ -1294,7 +1294,7 @@ Resources:
|
|
|
1294
1294
|
:active {
|
|
1295
1295
|
stroke: var(--privy-color-accent-light);
|
|
1296
1296
|
}
|
|
1297
|
-
`,
|
|
1297
|
+
`,Ni=_t(l4)`
|
|
1298
1298
|
height: 1.25rem;
|
|
1299
1299
|
width: 1.25rem;
|
|
1300
1300
|
stroke: var(--privy-color-accent);
|
|
@@ -1303,7 +1303,7 @@ Resources:
|
|
|
1303
1303
|
:active {
|
|
1304
1304
|
stroke: var(--privy-color-accent-light);
|
|
1305
1305
|
}
|
|
1306
|
-
|
|
1306
|
+
`,Di=_t(s4)`
|
|
1307
1307
|
height: 1.25rem;
|
|
1308
1308
|
width: 1.25rem;
|
|
1309
1309
|
stroke: var(--privy-color-accent);
|
|
@@ -1312,7 +1312,7 @@ Resources:
|
|
|
1312
1312
|
:active {
|
|
1313
1313
|
stroke: var(--privy-color-accent-light);
|
|
1314
1314
|
}
|
|
1315
|
-
`,
|
|
1315
|
+
`,wy=_t.progress`
|
|
1316
1316
|
height: 4px;
|
|
1317
1317
|
width: 100%;
|
|
1318
1318
|
margin: 8px 0;
|
|
@@ -1328,7 +1328,7 @@ Resources:
|
|
|
1328
1328
|
transition: all 0.1s ease-out;
|
|
1329
1329
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1330
1330
|
}
|
|
1331
|
-
`;import{Fragment as
|
|
1331
|
+
`;import{Fragment as u4,jsx as lr,jsxs as Wl}from"react/jsx-runtime";var by=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=rp(!0),[l,s]=rp(!1),[c,m]=rp(""),f=r===c;return p4(()=>{c&&!l&&s(!0)},[c]),Wl(u4,{children:[lr(_,{closeable:!1,backFn:n}),lr(oe,{}),Wl(qo,{children:[Wl(Ko,{children:[lr(d4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),lr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),lr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Wl($o,{children:[lr(Li,{value:c,onChange:u=>m(u.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),lr(Oi,{style:{right:"0.75rem"},children:i?lr(Ni,{onClick:()=>a(!1)}):lr(Di,{onClick:()=>a(!0)})})]}),lr(Il,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),lr(zo,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),lr(ne,{}),lr($,{})]})};import y4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as g4}from"react";import v4 from"styled-components";import Aa from"styled-components";import{jsx as xa,jsxs as h4}from"react/jsx-runtime";var Ey=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>xa("label",{children:h4(m4,{className:e,children:[xa(Sy,{checked:t,...o}),xa(f4,{color:r,checked:t,children:xa(Ty,{viewBox:"0 0 24 24",children:xa("polyline",{points:"20 6 9 17 4 12"})})})]})});var lU=Aa.label`
|
|
1332
1332
|
&& {
|
|
1333
1333
|
cursor: pointer;
|
|
1334
1334
|
display: flex;
|
|
@@ -1340,14 +1340,14 @@ Resources:
|
|
|
1340
1340
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1341
1341
|
width: 100%;
|
|
1342
1342
|
}
|
|
1343
|
-
`,
|
|
1343
|
+
`,m4=Aa.div`
|
|
1344
1344
|
display: inline-block;
|
|
1345
1345
|
vertical-align: middle;
|
|
1346
|
-
`,
|
|
1346
|
+
`,Ty=Aa.svg`
|
|
1347
1347
|
fill: none;
|
|
1348
1348
|
stroke: white;
|
|
1349
1349
|
stroke-width: 3px;
|
|
1350
|
-
`,
|
|
1350
|
+
`,Sy=Aa.input.attrs({type:"checkbox"})`
|
|
1351
1351
|
border: 0;
|
|
1352
1352
|
clip: rect(0 0 0 0);
|
|
1353
1353
|
clippath: inset(50%);
|
|
@@ -1358,7 +1358,7 @@ Resources:
|
|
|
1358
1358
|
position: absolute;
|
|
1359
1359
|
white-space: nowrap;
|
|
1360
1360
|
width: 1px;
|
|
1361
|
-
`,
|
|
1361
|
+
`,f4=Aa.div`
|
|
1362
1362
|
display: inline-block;
|
|
1363
1363
|
width: 18px;
|
|
1364
1364
|
height: 18px;
|
|
@@ -1373,28 +1373,28 @@ Resources:
|
|
|
1373
1373
|
border-width: 1px;
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
|
-
${
|
|
1376
|
+
${Sy}:focus + & {
|
|
1377
1377
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
|
-
${
|
|
1380
|
+
${Ty} {
|
|
1381
1381
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1382
1382
|
}
|
|
1383
|
-
`;import{Fragment as
|
|
1383
|
+
`;import{Fragment as _y,jsx as Pr,jsxs as ka}from"react/jsx-runtime";var Py=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=g4(!1);return ka(_y,{children:[Pr(_,{closeable:!1,backFn:o}),Pr(oe,{}),ka(qo,{children:[ka(Ko,{children:[Pr(y4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Pr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Pr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Pr(_a,{children:ka(Pa,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[Pr(Ey,{color:"var(--privy-color-error)",readOnly:!0,checked:i}),Pr(_y,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),ka(C4,{children:[n.initiatedBy==="user"&&Pr(Nr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Pr(zo,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),Pr(ne,{}),Pr($,{})]})},C4=v4.div`
|
|
1384
1384
|
display: flex;
|
|
1385
1385
|
gap: 10px;
|
|
1386
|
-
`;import
|
|
1386
|
+
`;import O4 from"@heroicons/react/24/outline/KeyIcon";import Wy from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Ly,useMemo as op,useEffect as N4}from"react";import Oy from"styled-components";import w4 from"fast-password-entropy";import*as xy from"secure-password-utilities";import{DEFAULT_WORDLIST as b4}from"secure-password-utilities/wordlists";var E4=95,T4=8,S4=3,_4=.3,P4=/[a-z]/,x4=/[A-Z]/,A4=/[0-9]/,k4="a-zA-Z0-9",Ay="!@#$%^&*()\\-_+.",ky=`${k4}${Ay}`,R4=new RegExp(`[${Ay}]`),M4=new RegExp(`[${ky}]`),Ry=new RegExp(`^[${ky}]{6,}$`),My=(e="")=>{let t=e.split("").filter(r=>!M4.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Ll=()=>xy.generatePassphrase(4,b4);function I4(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function W4(e){if(e.length<T4)return 0;let t=0;P4.test(e)&&(t+=1),x4.test(e)&&(t+=1),A4.test(e)&&(t+=1),R4.test(e)&&(t+=1);let r=t/S4;return Math.max(0,Math.min(1,r))}function L4(e=""){let t=W4(e),r=w4(e)/E4;return(t*_4+r)/2}function Iy(e=""){let t=L4(e);return{value:t,label:I4(t)}}import{Fragment as F4,jsx as Pt,jsxs as ao}from"react/jsx-runtime";var Ny=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:i,onClose:a,onBack:l,onPasswordChange:s,onPasswordGenerate:c})=>{let[m,f]=Ly(!1),[u,g]=Ly(!1);N4(()=>{r&&!u&&g(!0)},[r]);let w=op(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Ry.test(r||"")?null:`Invalid characters used ( ${My(r).join(" ")} )`:null,[r,u]),y=op(()=>w?{value:0,label:"Weak"}:Iy(r),[r,w]),b=op(()=>!!(!r?.length||w),[w,r]);return ao(F4,{children:[Pt(_,{onClose:a,closeable:o.initiatedBy==="user",backFn:l}),Pt(oe,{}),ao(qo,{children:[ao(Ko,{children:[Pt(O4,{height:48,width:48,stroke:"var(--privy-color-accent)"}),ao("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),ao($o,{children:[Pt(Li,{value:r,onChange:P=>s(P.target.value),placeholder:"enter or generate a strong password",type:m?"password":"text",style:{paddingRight:"3.8rem"}}),ao(Oi,{style:{width:"3.5rem"},children:[m?Pt(Ni,{onClick:()=>f(!1)}):Pt(Di,{onClick:()=>f(!0)}),Pt(Cy,{onClick:c})]})]}),Pt(wy,{value:y.value===0?.01:y.value,label:y.label}),Pt(Il,{error:!!w,children:w||`Password Strength: ${u?y.label:"--"}`}),ao(U4,{children:[Pt(D4,{children:ao(_a,{children:[ao(Pa,{children:[Pt(Wy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),ao(Pa,{children:[Pt(Wy,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Pt(zo,{onClick:i,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),Pt(ne,{}),Pt($,{})]})},D4=Oy(_a)`
|
|
1387
1387
|
flex: 1;
|
|
1388
1388
|
padding-top: 1rem;
|
|
1389
|
-
`,
|
|
1389
|
+
`,U4=Oy.div`
|
|
1390
1390
|
display: flex;
|
|
1391
1391
|
flex-direction: column;
|
|
1392
1392
|
height: 100%;
|
|
1393
|
-
`;import
|
|
1393
|
+
`;import B4 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import H4 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import V4 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import G4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as q4,useCallback as Dy}from"react";import{Fragment as np,jsx as Xt,jsxs as On}from"react/jsx-runtime";var Uy=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=q4(!1),s=Dy(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Dy(()=>{let m=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),u=new Blob([z4(r,o)],{type:"text/plain"}),g=URL.createObjectURL(u);m.href=g,m.target="_blank",m.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return On(np,{children:[Xt(_,{backFn:i,closeable:!1}),Xt(oe,{}),On(qo,{children:[On(Ko,{children:[Xt(G4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Xt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Xt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),Xt($o,{centered:!0,children:Xt(vy,{children:o})}),On("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Xt(tp,{onClick:s,children:a?On(np,{children:[Xt(H4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):On(np,{children:[Xt(V4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),On(tp,{onClick:c,children:[Xt(B4,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Xt(zo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Xt(ne,{}),Xt($,{})]})},z4=(e,t)=>`Your wallet recovery password for ${e} is
|
|
1394
1394
|
|
|
1395
1395
|
${t}
|
|
1396
1396
|
|
|
1397
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import
|
|
1397
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import $4 from"@heroicons/react/24/solid/CheckCircleIcon";import K4 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as j4,jsx as Po,jsxs as ip}from"react/jsx-runtime";var Fy=({error:e,onClose:t})=>ip(j4,{children:[Po(_,{closeable:!1}),Po(oe,{}),e?ip(ir,{children:[Po(K4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Po(ye,{title:"Something went wrong",description:e})]}):ip(ir,{children:[Po($4,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Po(ye,{title:"Success"})]}),Po(F,{onClick:t,children:"Close"}),Po(ne,{}),Po($,{})]});import{useReducer as Y4}from"react";var Z4=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},By=()=>{let[e,t]=Y4(Z4,"creating");return{send:t,state:e}};import{jsx as Ra}from"react/jsx-runtime";var Ol=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=S(),{send:n,state:i}=By(),a=ap(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);Q4(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),Ne)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=ap(()=>{n("back")},[n]),s=ap(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?Ra(Ny,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?Ra(Uy,{...t,onSubmit:a,onBack:l}):i==="confirming"?Ra(by,{...t,onSubmit:a,onBack:l}):i==="finalizing"?Ra(Py,{...t,onSubmit:a,onBack:l}):i==="done"?Ra(Fy,{...t,onSubmit:a}):null};import{jsx as X4}from"react/jsx-runtime";var Hy=()=>{let[e,t]=Nl(null),[r,o]=Nl(!1),[n,i]=Nl(null),[a,l]=Nl(""),{authenticated:s,getAccessToken:c,user:m}=q(),{walletProxy:f,refreshUser:u,closePrivyModal:g,createAnalyticsEvent:w}=I(),{app:y,navigate:b,data:P,onUserCloseViaDialogOrKeybindRef:A}=S(),{onSuccess:T,onFailure:x}=P.createWallet,R=he(m),M=e?.recoveryMethod==="user-passcode",D=R?.recoveryMethod==="user-passcode";J4(()=>{s||(b("LANDING"),x(new ps("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){x(n),g({shouldCallAuthOnSuccess:!1});return}if(!M){x(new Mt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}T(e),g({shouldCallAuthOnSuccess:!1})};A.current=B;let K=async()=>{let L=await c();if(L&&R?.address&&a&&f)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}}),!(await f.setRecovery({accessToken:L,address:R.address,recoveryPassword:a,recoveryMethod:"user-passcode"})).address){i(new Mt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"error setting password"}});return}let W=await u(),ve=he(W);if(!ve){i(new Mt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D,reason:"wallet disconnected"}});return}t(ve),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:R.address,recoveryMethod:"user-passcode",isResettingPassword:D}})}catch(N){console.warn(N),i(N instanceof Error?N:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:R.address,reason:N}})}},j=async()=>{M?(T(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await K(),o(!1))};return X4(Ol,{appName:y?.name||"privy",config:{initiatedBy:"user",onCancel:B},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,isResettingPassword:D,onPasswordGenerate:()=>l(Ll()),onPasswordChange:l,onSubmit:j,onClose:B})};import e5 from"@heroicons/react/24/outline/UserCircleIcon";import t5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as r5,jsx as xo,jsxs as Dl}from"react/jsx-runtime";var Vy=()=>{let{closePrivyModal:e}=I(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{onSuccess:i,onFailure:a}=t.setWalletPassword,l=()=>{a(new Mt("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,Dl(r5,{children:[xo(_,{onClose:l}),xo(oe,{}),Dl(ir,{children:[Dl(mh,{children:[xo(e5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),xo(fh,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:xo(t5,{width:"12px",height:"12px",fill:"white"})})]}),Dl(ye,{title:"Secure Your Account",children:["Please set a password to secure your account.",xo("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),xo(F,{onClick:()=>{r({createWallet:{onFailure:a,onSuccess:i,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),xo(ne,{}),xo($,{})]})};import o5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import n5 from"@heroicons/react/24/outline/PhoneIcon";import Gy from"styled-components";import{Fragment as l5,jsx as xr,jsxs as Ul}from"react/jsx-runtime";var i5=e=>{let t=xr(o5,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof C)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};case"insufficient_balance":return{title:"Insufficient balance",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof We&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:xr(n5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof et)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:xr(hl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:xr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:xr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Rt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},qy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=S(),i=r?.errorModalData?.previousScreen||(o===n?void 0:o);return xr(Nn,{error:r?.errorModalData?.error||new Error,backFn:()=>i?e(i,!1):t(),onClick:()=>e(i||"LANDING",!1)})},Nn=({error:e,backFn:t,onClick:r})=>{let{reset:o}=be(),n=i5(e),i=()=>{e instanceof et&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return Ul(l5,{children:[xr(_,{backFn:t}),Ul(a5,{children:[xr(Je,{children:Ul("div",{children:[xr(fl,{color:"var(--privy-color-error)"}),n.icon]})}),Ul(s5,{children:[xr("h3",{children:n.title}),xr("p",{children:n.detail})]}),xr(F,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},a5=Gy.div`
|
|
1398
1398
|
display: flex;
|
|
1399
1399
|
flex-direction: column;
|
|
1400
1400
|
align-items: center;
|
|
@@ -1402,11 +1402,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1402
1402
|
gap: 24px;
|
|
1403
1403
|
width: 100%;
|
|
1404
1404
|
padding-bottom: 16px;
|
|
1405
|
-
`,
|
|
1405
|
+
`,s5=Gy.div`
|
|
1406
1406
|
display: flex;
|
|
1407
1407
|
flex-direction: column;
|
|
1408
1408
|
gap: 8px;
|
|
1409
|
-
`;import{useEffect as
|
|
1409
|
+
`;import{useEffect as Qy,useRef as A5,useState as cp}from"react";import{isIOS as k5,isMobile as Jy}from"react-device-detect";import tg from"styled-components";import{useState as c5}from"react";import d5 from"styled-components";import{jsx as zy}from"react/jsx-runtime";var Ui=({style:e,color:t,...r})=>zy("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:zy("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as sp}from"react/jsx-runtime";var $y=({color:e,...t})=>sp("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:sp("g",{children:sp("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as Ky,jsxs as u5}from"react/jsx-runtime";var jo=e=>{let[t,r]=c5(!1);return u5(p5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Ky(Ui,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Ky($y,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},p5=d5.button`
|
|
1410
1410
|
display: flex;
|
|
1411
1411
|
align-items: center;
|
|
1412
1412
|
gap: 6px;
|
|
@@ -1444,7 +1444,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1444
1444
|
width: 14px;
|
|
1445
1445
|
height: 14px;
|
|
1446
1446
|
}
|
|
1447
|
-
`;import{useState as
|
|
1447
|
+
`;import{useState as m5}from"react";import f5 from"styled-components";import{jsx as y5}from"react/jsx-runtime";var Fl=e=>{let[t,r]=m5(!1);return y5(h5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},h5=f5.a`
|
|
1448
1448
|
display: flex;
|
|
1449
1449
|
align-items: center;
|
|
1450
1450
|
gap: 6px;
|
|
@@ -1482,7 +1482,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1482
1482
|
width: 14px;
|
|
1483
1483
|
height: 14px;
|
|
1484
1484
|
}
|
|
1485
|
-
`;import
|
|
1485
|
+
`;import g5 from"qrcode";import v5 from"react";import C5 from"styled-components";import{jsx as jy}from"react/jsx-runtime";var Yy=()=>jy("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:jy("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Ma,jsx as Lt,jsxs as Zy}from"react/jsx-runtime";var cr=7,lp=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},w5=e=>{let t=g5.create(e,{errorCorrectionLevel:"high"}).modules,r=tm(Array.from(t.data),t.size);return r=lp(r,0,0,cr,cr),r=lp(r,r.length-cr,0,cr,cr),r=lp(r,0,r.length-cr,cr,cr),r},b5=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>Lt(Ma,{children:[0,1,2].map(i=>Lt("circle",{r:r*(cr-i*2)/2,cx:e+r*cr/2,cy:t+r*cr/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),E5=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-cr)*e,0],[0,(t-cr)*e]];return Lt(Ma,{children:n.map(([i,a])=>Lt(b5,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},T5=({matrix:e,cellSize:t,color:r})=>Lt(Ma,{children:e.map((i,a)=>i.map((l,s)=>l?Lt("rect",{height:t-.2*2,width:t-.2*2,x:a*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${a}-${s}`):Lt(v5.Fragment,{},`circle-${a}-${s}`)))}),S5=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return Lt(Ma,{});let i=t*(o||.15),a=Math.floor(t/2-i/2),l=Math.floor(t/2+i/2);(l-a)%2!==t%2&&(l+=1);let s=(l-a)*e,c=.1,m=s-s*c*2,f=r,u=a*e;return Zy(Ma,{children:[Lt("rect",{x:a*e,y:a*e,width:s,height:s,fill:n}),Lt(f,{x:u+s*c,y:u+s*c,height:m,width:m})]})},_5=e=>{let t=e.outputSize,r=w5(e.url),o=t/r.length;return Zy("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Lt(T5,{matrix:r,cellSize:o,color:e.fgColor}),Lt(E5,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),Lt(S5,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},P5=C5.div`
|
|
1486
1486
|
display: flex;
|
|
1487
1487
|
justify-content: center;
|
|
1488
1488
|
align-items: center;
|
|
@@ -1497,7 +1497,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1497
1497
|
border-color: ${e=>e.borderColor};
|
|
1498
1498
|
border-radius: var(--privy-border-radius-md);
|
|
1499
1499
|
}
|
|
1500
|
-
`,
|
|
1500
|
+
`,Yo=e=>{let{appearance:t}=Ge(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,i=t.palette.colorScheme==="dark"?r:o;return Lt(P5,{size:n,bgColor:r,fgColor:o,borderColor:i,children:Lt(_5,{url:e.url,logo:{element:e.squareLogoElement??Yy},outputSize:n,bgColor:r,fgColor:o})})};import{jsx as Bl,jsxs as x5}from"react/jsx-runtime";var so=({style:e,...t})=>x5("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[Bl("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Bl("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),Bl("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),Bl("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as Hl,jsx as Ae,jsxs as lo}from"react/jsx-runtime";var Xy="#8a63d2",rg=1e3,R5=rg*2,M5=rg*120,og=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=S(),{getAuthFlow:c,loginWithFarcaster:m,closePrivyModal:f,createAnalyticsEvent:u}=I(),[g,w]=cp(void 0),[y,b]=cp(!1),[P,A]=cp(!1),T=A5([]),x=Ne,R=c(),M=R?.meta.connectUri;return Qy(()=>{let D=Date.now(),B=setInterval(async()=>{let K=await R.pollForReady.execute(),j=Date.now()-D;if(K){clearInterval(B),b(!0);try{await m(),A(!0)}catch(L){let N={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(L?.privyErrorCode==="max_accounts_reached"){console.error(new wr(L).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else if(L?.privyErrorCode==="user_does_not_exist"){i("ACCOUNT_NOT_FOUND_SCREEN");return}else L?.privyErrorCode==="linked_to_another_user"?N.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(N.retryable=!0,N.detail="Something went wrong. Try again."):L?.privyErrorCode==="too_many_requests"&&(N.detail="Too many requests. Please wait before trying again.");w(N)}}else j>M5&&(clearInterval(B),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},R5);return()=>{clearInterval(B),T.current.forEach(K=>clearTimeout(K))}},[]),Qy(()=>{if(r&&e&&P&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},x);return()=>clearTimeout(B)}P&&(Gt(o,s?.embeddedWallets.createOnLogin)?T.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:B=>{console.error(B),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:B,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},x)):T.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),x)))}},[P,r,e,o]),Jy||y?lo(Hl,{children:[Ae(_,{backFn:n?a:void 0,onClose:f},"header"),Ae(oe,{}),k5?Ae(Hl,{children:lo(I5,{children:[Ae(Je,{children:lo("div",{children:[Ae(ot,{success:P,fail:!!g}),Ae(so,{style:{width:"38px",height:"38px"}})]})}),lo(Xe,{children:[Ae(de,{children:g?g.message:"Sign in with Farcaster"}),Ae(ue,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&Ae(F,{onClick:D=>{D.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):Ae(Hl,{children:lo(eg,{children:[Ae(Je,{children:lo("div",{children:[Ae(ot,{success:P,fail:!!g}),Ae(so,{style:{width:"38px",height:"38px"}})]})}),lo(Xe,{children:[Ae(de,{children:g?g.message:"Signing in with Farcaster"}),Ae(ue,{children:g?g.detail:"This should only take a moment"}),Ae(wt,{children:M&&Jy&&Ae(Fl,{text:"Take me to Warpcast",url:M,color:Xy})})]})]})}),Ae(Z,{})]}):lo(Hl,{children:[Ae(_,{backFn:n?a:void 0,onClose:f},"header"),Ae(oe,{}),Ae(eg,{children:lo("div",{children:[Ae(de,{children:"Sign in with Farcaster"}),Ae(ue,{children:"Scan with your phone's camera to continue."}),Ae(wi,{children:M?Ae(Yo,{url:M,size:275,squareLogoElement:so}):Ae(mt,{})}),lo(wt,{children:[Ae(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&Ae(jo,{text:M,itemName:"link",color:Xy})]})]})}),Ae(Z,{})]})},eg=tg.div`
|
|
1501
1501
|
display: flex;
|
|
1502
1502
|
flex-direction: column;
|
|
1503
1503
|
align-items: center;
|
|
@@ -1505,14 +1505,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1505
1505
|
margin-left: 27px;
|
|
1506
1506
|
margin-right: 27px;
|
|
1507
1507
|
gap: 24px;
|
|
1508
|
-
`,
|
|
1508
|
+
`,I5=tg.div`
|
|
1509
1509
|
display: flex;
|
|
1510
1510
|
flex-direction: column;
|
|
1511
1511
|
align-items: center;
|
|
1512
1512
|
justify-content: center;
|
|
1513
1513
|
gap: 24px;
|
|
1514
1514
|
width: 100%;
|
|
1515
|
-
`;import{useEffect as
|
|
1515
|
+
`;import{useEffect as W5,useRef as L5,useState as dp}from"react";import{isIOS as O5,isMobile as ng}from"react-device-detect";import sg from"styled-components";import{Fragment as Vl,jsx as Re,jsxs as Vr}from"react/jsx-runtime";var ig="#8a63d2",lg=1e3,N5=lg*2,D5=lg*300,cg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=S(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=I(),[a,l]=dp(void 0),[s,c]=dp(!1),[m,f]=dp(!1),u=L5([]),g=Ne,w=r?.farcasterSigner;W5(()=>{let b=Date.now(),P=setInterval(async()=>{if(!w?.public_key){clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(P),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let A=await n(w?.public_key),T=Date.now()-b;A.status==="approved"?(clearInterval(P),c(!1),f(!0),u.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):T>D5?(clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):A.status==="revoked"&&(clearInterval(P),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},N5);return()=>{clearInterval(P),u.current.forEach(A=>clearTimeout(A))}},[]);let y=w?.status==="pending_approval"?w.signer_approval_url:void 0;return ng||s?Vr(Vl,{children:[Re(_,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),O5?Re(Vl,{children:Vr(U5,{children:[Re(Je,{children:Vr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(so,{style:{width:"38px",height:"38px"}})]})}),Vr(Xe,{children:[Re(de,{children:a?a.message:"Add a signer to Farcaster"}),Re(ue,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),y&&Re(F,{onClick:b=>{b.preventDefault(),window.location.href=y},children:"Open Warpcast app"})]})}):Re(Vl,{children:Vr(ag,{children:[Re(Je,{children:Vr("div",{children:[Re(ot,{success:m,fail:!!a}),Re(so,{style:{width:"38px",height:"38px"}})]})}),Vr(Xe,{children:[Re(de,{children:a?a.message:"Requesting signer from Farcaster"}),Re(ue,{children:a?a.detail:"This should only take a moment"}),Re(wt,{children:y&&ng&&Re(Fl,{text:"Take me to Warpcast",url:y,color:ig})})]})]})}),Re(Z,{})]}):Vr(Vl,{children:[Re(_,{backFn:e?t:void 0,onClose:i},"header"),Re(oe,{}),Re(ag,{children:Vr("div",{children:[Re(de,{children:"Add a signer to Farcaster"}),Vr(ue,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Re(wi,{children:w?.status==="pending_approval"?Re(Yo,{url:w.signer_approval_url,size:275,squareLogoElement:so}):Re(mt,{})}),Vr(wt,{children:[Re(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&Re(jo,{text:w.signer_approval_url,itemName:"link",color:ig})]})]})}),Re(Z,{})]})},ag=sg.div`
|
|
1516
1516
|
display: flex;
|
|
1517
1517
|
flex-direction: column;
|
|
1518
1518
|
align-items: center;
|
|
@@ -1520,14 +1520,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1520
1520
|
margin-left: 27px;
|
|
1521
1521
|
margin-right: 27px;
|
|
1522
1522
|
gap: 24px;
|
|
1523
|
-
`,
|
|
1523
|
+
`,U5=sg.div`
|
|
1524
1524
|
display: flex;
|
|
1525
1525
|
flex-direction: column;
|
|
1526
1526
|
align-items: center;
|
|
1527
1527
|
justify-content: center;
|
|
1528
1528
|
gap: 24px;
|
|
1529
1529
|
width: 100%;
|
|
1530
|
-
`;import{formatUnits as
|
|
1530
|
+
`;import{formatUnits as n6,parseUnits as i6}from"@ethersproject/units";import{CheckCircleIcon as a6}from"@heroicons/react/24/outline";import{useEffect as hp,useState as Wa}from"react";import s6 from"styled-components";import{calculateTotalGasEstimate as l6,populateTransactionRequest as c6}from"@privy-io/js-sdk-core";import{jsx as F5}from"react/jsx-runtime";function dr({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=S(),i;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?i=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?i=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):i=void 0:i=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,F5(_,{title:e,backFn:i})}import Gl from"styled-components";import{jsx as pp,jsxs as q5}from"react/jsx-runtime";var up=()=>pp(B5,{children:q5(H5,{children:[pp(V5,{}),pp(G5,{})]})}),B5=Gl.div`
|
|
1531
1531
|
display: flex;
|
|
1532
1532
|
justify-content: center;
|
|
1533
1533
|
align-items: center;
|
|
@@ -1536,14 +1536,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1536
1536
|
@media all and (display-mode: standalone) {
|
|
1537
1537
|
margin-bottom: 30px;
|
|
1538
1538
|
}
|
|
1539
|
-
`,
|
|
1539
|
+
`,H5=Gl.div`
|
|
1540
1540
|
position: relative;
|
|
1541
1541
|
height: 96px;
|
|
1542
1542
|
width: 96px;
|
|
1543
1543
|
|
|
1544
1544
|
opacity: 1;
|
|
1545
1545
|
animation: fadein 200ms ease;
|
|
1546
|
-
`,
|
|
1546
|
+
`,V5=Gl.div`
|
|
1547
1547
|
position: absolute;
|
|
1548
1548
|
top: 0;
|
|
1549
1549
|
right: 0;
|
|
@@ -1556,7 +1556,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1556
1556
|
border: 4px solid #f1f2f9;
|
|
1557
1557
|
border-radius: 50%;
|
|
1558
1558
|
}
|
|
1559
|
-
`,
|
|
1559
|
+
`,G5=Gl.div`
|
|
1560
1560
|
position: absolute;
|
|
1561
1561
|
top: 0;
|
|
1562
1562
|
right: 0;
|
|
@@ -1580,33 +1580,33 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1580
1580
|
transform: rotate(360deg);
|
|
1581
1581
|
}
|
|
1582
1582
|
}
|
|
1583
|
-
`;import
|
|
1583
|
+
`;import dg from"styled-components";var ql=dg.span`
|
|
1584
1584
|
display: flex;
|
|
1585
1585
|
flex-direction: column;
|
|
1586
1586
|
gap: 0.35rem;
|
|
1587
1587
|
width: 100%;
|
|
1588
|
-
`,
|
|
1588
|
+
`,pr=dg.span`
|
|
1589
1589
|
display: flex;
|
|
1590
1590
|
width: 100%;
|
|
1591
1591
|
justify-content: space-between;
|
|
1592
|
-
`;import
|
|
1592
|
+
`;import z5 from"styled-components";var ur=z5.span`
|
|
1593
1593
|
color: var(--privy-color-foreground-3);
|
|
1594
1594
|
font-size: 0.875rem;
|
|
1595
1595
|
font-weight: 400;
|
|
1596
1596
|
line-height: 1.375rem; /* 157.143% */
|
|
1597
|
-
`;import
|
|
1597
|
+
`;import $5 from"styled-components";var mr=$5.span`
|
|
1598
1598
|
color: var(--privy-color-foreground);
|
|
1599
1599
|
font-size: 0.875rem;
|
|
1600
1600
|
font-weight: 500;
|
|
1601
1601
|
line-height: 1.375rem; /* 157.143% */
|
|
1602
1602
|
|
|
1603
|
-
${
|
|
1604
|
-
`;import{EtherscanProvider as
|
|
1603
|
+
${vl}
|
|
1604
|
+
`;import{EtherscanProvider as PH}from"@ethersproject/providers";import{QuantityToBigNumber as K5}from"@privy-io/js-sdk-core";async function zl(e,t,r,o,n,i){o=Object.assign({chainId:wo},o),j5(o);let l=(await r.rpc({address:t,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(l)}async function Fi(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(K5(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function j5(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Y5(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function Y5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Z5(e);return t||r||o}function Z5(e){return/^-?0x[a-f0-9]+$/i.test(e)}function $l(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as mp,useEffect as Q5}from"react";var co=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=I(),[n,i]=mp(!0),[a,l]=mp(void 0),[s,c]=mp(void 0);return Q5(()=>{let m=e.chainId||wo,f=o.find(g=>g.id===Number(m));if(!f)throw new ce(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as J5,useContext as X5}from"react";var fp=J5(null);function Gr(){let e=X5(fp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}function Bi(e){let r=new RegExp(/^eip155:(?<chainId>\d+)$/gm).exec(e)?.groups?.chainId;if(r)return parseInt(r);throw new Error("Chain ID not compatible with CAIP-2 format.")}import{BigNumber as e6}from"@ethersproject/bignumber";import{formatEther as pg}from"@ethersproject/units";import{QuantityToBigNumber as t6}from"@privy-io/js-sdk-core";var r6=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),o6=e=>r6.format(e),Kl=(e,t)=>{let r=(t*parseFloat(e)).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},po=(e,t)=>{let r=o6(t*parseFloat(pg(e)));return r==="$0.00"?"<$0.01":r},fr=(e,t,r=6,o=!1)=>{let i=parseFloat(pg(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Ia=e=>e.map(t6).reduce((t,r)=>t.add(r),e6.from(0)).toHexString(),ug=(e,t)=>{let{chains:r}=I(),o=`https://etherscan.io/address/${t}`,n=`${am(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n};import{Fragment as jl,jsx as De,jsxs as uo}from"react/jsx-runtime";var mg=()=>{let{chains:e,rpcConfig:t,appId:r,closePrivyModal:o}=I(),{navigate:n,setModalData:i,app:a,data:l}=S(),[s,c]=Wa(null),[m,f]=Wa(null),[u,g]=Wa(null),[w,y]=Wa(null),[b,P]=Wa(!1),A=l?.funding&&i6(l.funding.amount,"ether").toHexString(),T=l?.funding&&l.funding.chain.id,{wallets:x}=Gr(),{tokenPrice:R,isTokenPriceLoading:M}=co({chainId:s?.chainId&&Bi(s.chainId)?Bi(s.chainId):void 0}),D=async Y=>{for(let te of Y)T&&Bi(te.chainId)!==T&&await te.switchChain(T)},B=new Oe(async()=>{let Y=x[0];if(!Y){console.error("Connected wallet wasn't found."),n("ERROR_SCREEN",!1);return}c(Y);let te=x.find(Fe=>Fe.walletClientType==="privy");if(!te){console.error("Embedded wallet wasn't found."),n("ERROR_SCREEN",!1);return}if(f(te),!T){console.error(`Chain ID not found for input ${l?.funding?.chain.id}.`),n("ERROR_SCREEN",!1);return}let ee=rr(T,e,t,{appId:r}),_e={from:Y.address,to:te.address,value:A,chainId:T},Te=await c6(Y.address,_e,ee),{totalGasEstimate:ze}=await l6(Te,ee),{balance:Ve,hasSufficientFunds:pt}=await Fi(Y.address,Te,ze,ee);if(y({gas:ze.toHexString(),balance:Ve.toHexString()}),!pt){g(new C(`Wallet ${Qe(Y.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}await D([Y,te]);try{let ae=await(await Y.getEthersProvider()).getSigner(),{wait:Ft}=await ae.sendTransaction(Te);await Ft(1),P(!0)}catch(Fe){g(Fe)}});hp(()=>{B.execute()},[]),hp(()=>{if(!u)return;let Y={error:u,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};i({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Y}),n("ERROR_SCREEN",!1)},[u]);let K=s?Bo(s.walletClientType,s.connectorType,s.walletClientType)||"wallet":null,j=!s||!w||M||!l?.funding||!A,L=j?void 0:Ia([w.gas,A]),N=L&&R?po(L,R):void 0,W=L?fr(L,"ETH"):void 0,ve=w&&R?po(w.gas,R):void 0,Me=w?fr(w.gas,"ETH"):void 0;return hp(()=>{if(!b)return;let Y=setTimeout(o,As);return()=>clearTimeout(Y)},[b]),j?uo(jl,{children:[De(dr,{}),De(up,{}),De("div",{style:{marginTop:"1rem"}}),De($,{})]}):b?uo(jl,{children:[De(dr,{}),De(oe,{}),uo(ir,{children:[De(a6,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),De(ye,{title:"Success!",description:`You\u2019ve successfully added ${n6(A,"ether")} ETH to your ${a.name} wallet. It may take a minute before the funds are available to use.`})]}),De(ne,{}),De($,{})]}):uo(jl,{children:[De(dr,{}),De(up,{}),De(wt,{style:{marginTop:"16px"},children:De(gl,{icon:Cl(s.walletClientType,s.connectorType,s.walletClientType),name:s.walletClientType})}),De(ye,{style:{marginTop:"8px",marginBottom:"12px"},title:`Confirming with ${K}`}),w&&De(jl,{children:uo(ql,{children:[uo(pr,{children:[De(ur,{children:"Total"}),De(mr,{children:N||W})]}),uo(pr,{children:[De(ur,{children:"To"}),De(mr,{children:Qe(m?.address)})]}),uo(pr,{children:[De(ur,{children:"Network"}),De(mr,{children:uo(d6,{children:[wl(l.funding.chain.id)," ",l.funding.chain.name]})})]}),uo(pr,{children:[De(ur,{children:"Estimated fee"}),De(mr,{children:ve||Me})]})]})}),De(bi,{height:24}),De($,{})]})},d6=s6.div`
|
|
1605
1605
|
display: flex;
|
|
1606
1606
|
flex-direction: row;
|
|
1607
1607
|
align-items: center;
|
|
1608
1608
|
gap: 4px;
|
|
1609
|
-
`;import{WalletIcon as U6}from"@heroicons/react/24/outline";import{jsx as Sp,jsxs as w6}from"react/jsx-runtime";var Zi=({size:e=61,...t})=>Sp("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:w6("g",{id:"moonpay_symbol_wht 2",children:[Sp("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Sp("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import xo from"styled-components";import b6 from"@heroicons/react/24/outline/ClockIcon";import E6 from"@heroicons/react/24/outline/TrashIcon";import T6 from"@heroicons/react/24/solid/CheckBadgeIcon";import S6 from"@heroicons/react/24/solid/CheckCircleIcon";import P6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as _6,useState as Ka}from"react";import Rr,{css as kg}from"styled-components";import{jsx as Pg}from"react/jsx-runtime";var Bn=({style:e,...t})=>Pg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:Pg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Be,jsxs as _g}from"react/jsx-runtime";var Hn=({style:e,...t})=>_g("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[_g("g",{clipPath:"url(#clip0_113_33841)",children:[Be("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Be("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Be("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Be("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Be("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Be("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Be("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Be("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Be("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Be("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Be("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Be("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Be("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Be("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Be("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Be("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Be("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Be("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Be("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Be("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Be("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Be("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Pp,jsx as fe,jsxs as nr}from"react/jsx-runtime";var xg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=Ka([]),i=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{a(u=>u.concat([c])),await r(c),a(u=>u.filter(h=>h!==c))};return nr("div",{children:[fe(I6,{children:"Your passkeys"}),nr(Mg,{children:[e.slice(0,i).map(c=>nr(O6,{children:[nr("div",{children:[fe(W6,{children:l(c)}),nr(L6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),fe(D6,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?fe(ro,{}):fe(E6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&fe(_p,{onClick:o,children:"View all"})]})]})},x6=()=>nr(Mg,{children:[nr(er,{children:[fe(Xt,{children:fe(T6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),nr(er,{children:[fe(Xt,{children:fe(P6,{})}),"More secure than a password."]}),nr(er,{children:[fe(Xt,{children:fe(b6,{})}),"Takes seconds to set up and use."]})]}),Rg=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=I(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[a,i]=Ka(!1),[l,s]=Ka(""),[c,u]=Ka(!1),[h,m]=Ka(!1);_6(()=>{n.length===0&&m(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(y=>{if(y instanceof rt){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{i(!1)})},w=async y=>(i(!0),await t(y).then(()=>u(!0)).catch(b=>{if(b instanceof rt&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{i(!1)}));return c?nr(Pp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Me,{children:fe(Ke,{status:"success",children:fe(S6,{})})}),fe(Ag,{children:"Passkey added"}),fe(R6,{children:"From now on, you can use your passkey to log in."}),fe(St,{children:fe(D,{onClick:()=>o(),children:"Done"})}),fe(Y,{})]}):h?nr(Pp,{children:[fe(_,{backFn:()=>m(!1),onClose:()=>o()},"header"),fe(xg,{passkeys:n,expanded:h,onUnlink:w,onExpand:()=>m(!0)}),fe(Y,{})]}):nr(Pp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Me,{children:nr(rc,{children:[fe(Bn,{}),fe(Hn,{})]})}),fe(Ag,{children:"Secure your account with a passkey"}),fe(M6,{}),n.length===0?fe(x6,{}):fe(xg,{passkeys:n,expanded:h,onUnlink:w,onExpand:()=>m(!0)}),nr(St,{style:{marginTop:"12px"},children:[l&&fe(A6,{fail:!0,children:l}),fe(D,{onClick:g,loading:a,children:"Add new passkey"})]}),fe(Y,{})]})},rc=Rr.div`
|
|
1609
|
+
`;import{WalletIcon as k6}from"@heroicons/react/24/outline";import{jsx as yp,jsxs as p6}from"react/jsx-runtime";var Hi=({size:e=61,...t})=>yp("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:p6("g",{id:"moonpay_symbol_wht 2",children:[yp("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),yp("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import Ao from"styled-components";import u6 from"@heroicons/react/24/outline/ClockIcon";import m6 from"@heroicons/react/24/outline/TrashIcon";import f6 from"@heroicons/react/24/solid/CheckBadgeIcon";import h6 from"@heroicons/react/24/solid/CheckCircleIcon";import y6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as g6,useState as La}from"react";import Ar,{css as vg}from"styled-components";import{jsx as fg}from"react/jsx-runtime";var Dn=({style:e,...t})=>fg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:fg("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Be,jsxs as hg}from"react/jsx-runtime";var Un=({style:e,...t})=>hg("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[hg("g",{clipPath:"url(#clip0_113_33841)",children:[Be("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Be("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Be("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Be("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Be("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Be("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Be("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Be("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Be("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Be("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Be("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Be("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Be("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Be("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Be("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Be("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Be("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Be("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Be("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Be("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Be("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Be("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Be("defs",{children:Be("clipPath",{id:"clip0_113_33841",children:Be("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as gp,jsx as fe,jsxs as er}from"react/jsx-runtime";var yg=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=La([]),a=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{i(m=>m.concat([c])),await r(c),i(m=>m.filter(f=>f!==c))};return er("div",{children:[fe(T6,{children:"Your passkeys"}),er(wg,{children:[e.slice(0,a).map(c=>er(P6,{children:[er("div",{children:[fe(S6,{children:l(c)}),er(_6,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),fe(A6,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?fe(eo,{}):fe(m6,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&fe(vp,{onClick:o,children:"View all"})]})]})},v6=()=>er(wg,{children:[er(Zt,{children:[fe(Yt,{children:fe(f6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),er(Zt,{children:[fe(Yt,{children:fe(y6,{})}),"More secure than a password."]}),er(Zt,{children:[fe(Yt,{children:fe(u6,{})}),"Takes seconds to set up and use."]})]}),Cg=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=I(),n=e?.linkedAccounts.filter(y=>y.type==="passkey"),[i,a]=La(!1),[l,s]=La(""),[c,m]=La(!1),[f,u]=La(!1);g6(()=>{n.length===0&&u(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>m(!0)).catch(y=>{if(y instanceof et){if(y.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(y.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},w=async y=>(a(!0),await t(y).then(()=>m(!0)).catch(b=>{if(b instanceof et&&b.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?er(gp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Ie,{children:fe(Ke,{status:"success",children:fe(h6,{})})}),fe(gg,{children:"Passkey added"}),fe(b6,{children:"From now on, you can use your passkey to log in."}),fe(Tt,{children:fe(F,{onClick:()=>o(),children:"Done"})}),fe(Z,{})]}):f?er(gp,{children:[fe(_,{backFn:()=>u(!1),onClose:()=>o()},"header"),fe(yg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>u(!0)}),fe(Z,{})]}):er(gp,{children:[fe(_,{onClose:()=>o()},"header"),fe(Ie,{children:er(Yl,{children:[fe(Dn,{}),fe(Un,{})]})}),fe(gg,{children:"Secure your account with a passkey"}),fe(E6,{}),n.length===0?fe(v6,{}):fe(yg,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>u(!0)}),er(Tt,{style:{marginTop:"12px"},children:[l&&fe(C6,{fail:!0,children:l}),fe(F,{onClick:g,loading:i,children:"Add new passkey"})]}),fe(Z,{})]})},Yl=Ar.div`
|
|
1610
1610
|
display: flex;
|
|
1611
1611
|
align-items: center;
|
|
1612
1612
|
justify-content: center;
|
|
@@ -1622,7 +1622,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1622
1622
|
stroke: var(--privy-color-accent) !important;
|
|
1623
1623
|
fill: var(--privy-color-accent) !important;
|
|
1624
1624
|
}
|
|
1625
|
-
`,
|
|
1625
|
+
`,C6=Ar.div`
|
|
1626
1626
|
line-height: 20px;
|
|
1627
1627
|
height: 20px;
|
|
1628
1628
|
font-size: 13px;
|
|
@@ -1630,7 +1630,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1630
1630
|
display: flex;
|
|
1631
1631
|
justify-content: flex-beginngin;
|
|
1632
1632
|
width: 100%;
|
|
1633
|
-
`,
|
|
1633
|
+
`,w6=vg`
|
|
1634
1634
|
&& {
|
|
1635
1635
|
width: 100%;
|
|
1636
1636
|
font-size: 0.875rem;
|
|
@@ -1655,9 +1655,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1655
1655
|
box-shadow: none;
|
|
1656
1656
|
}
|
|
1657
1657
|
}
|
|
1658
|
-
`,
|
|
1659
|
-
${
|
|
1660
|
-
`,
|
|
1658
|
+
`,vp=Ar.button`
|
|
1659
|
+
${w6}
|
|
1660
|
+
`,wg=Ar.div`
|
|
1661
1661
|
display: flex;
|
|
1662
1662
|
flex-direction: column;
|
|
1663
1663
|
align-items: stretch;
|
|
@@ -1665,18 +1665,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1665
1665
|
padding: 0.5rem 0rem 0rem;
|
|
1666
1666
|
flex-grow: 1;
|
|
1667
1667
|
width: 100%;
|
|
1668
|
-
`,
|
|
1668
|
+
`,gg=Ar.div`
|
|
1669
1669
|
font-size: 18px;
|
|
1670
1670
|
line-height: 18px;
|
|
1671
1671
|
text-align: center;
|
|
1672
1672
|
font-weight: 600;
|
|
1673
|
-
`,
|
|
1673
|
+
`,b6=Ar.div`
|
|
1674
1674
|
font-size: 0.875rem;
|
|
1675
1675
|
text-align: center;
|
|
1676
1676
|
margin-top: 10px;
|
|
1677
|
-
`,
|
|
1677
|
+
`,E6=Ar.div`
|
|
1678
1678
|
height: 32px;
|
|
1679
|
-
`,
|
|
1679
|
+
`,T6=Ar.div`
|
|
1680
1680
|
line-height: 20px;
|
|
1681
1681
|
height: 20px;
|
|
1682
1682
|
font-size: 1em;
|
|
@@ -1684,18 +1684,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1684
1684
|
display: flex;
|
|
1685
1685
|
justify-content: flex-beginning;
|
|
1686
1686
|
width: 100%;
|
|
1687
|
-
`,
|
|
1687
|
+
`,S6=Ar.div`
|
|
1688
1688
|
font-size: 1em;
|
|
1689
1689
|
line-height: 1.3em;
|
|
1690
1690
|
font-weight: 500;
|
|
1691
1691
|
color: var(--privy-color-foreground-2);
|
|
1692
1692
|
padding: 0.2em 0;
|
|
1693
|
-
`,
|
|
1693
|
+
`,_6=Ar.div`
|
|
1694
1694
|
font-size: 0.875rem;
|
|
1695
1695
|
line-height: 1rem;
|
|
1696
1696
|
color: #64668b;
|
|
1697
1697
|
padding: 0.2em 0;
|
|
1698
|
-
`,
|
|
1698
|
+
`,P6=Ar.div`
|
|
1699
1699
|
display: flex;
|
|
1700
1700
|
align-items: center;
|
|
1701
1701
|
justify-content: space-between;
|
|
@@ -1708,7 +1708,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1708
1708
|
border: 1px solid #e2e3f0 !important;
|
|
1709
1709
|
width: 100%;
|
|
1710
1710
|
height: 5em;
|
|
1711
|
-
`,
|
|
1711
|
+
`,x6=vg`
|
|
1712
1712
|
:focus,
|
|
1713
1713
|
:hover,
|
|
1714
1714
|
:active {
|
|
@@ -1725,40 +1725,40 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1725
1725
|
svg:hover {
|
|
1726
1726
|
color: var(--privy-color-foreground-3);
|
|
1727
1727
|
}
|
|
1728
|
-
`,
|
|
1729
|
-
${
|
|
1730
|
-
`;var
|
|
1728
|
+
`,A6=Ar.button`
|
|
1729
|
+
${x6}
|
|
1730
|
+
`;var bg=Ao.div`
|
|
1731
1731
|
display: flex;
|
|
1732
1732
|
flex-direction: column;
|
|
1733
1733
|
gap: 12px;
|
|
1734
1734
|
padding-top: 24px;
|
|
1735
1735
|
padding-bottom: 24px;
|
|
1736
|
-
`,
|
|
1736
|
+
`,Zl=Ao.div`
|
|
1737
1737
|
width: 24px;
|
|
1738
1738
|
height: 24px;
|
|
1739
1739
|
display: flex;
|
|
1740
1740
|
justify-content: center;
|
|
1741
1741
|
align-items: center;
|
|
1742
|
-
`,
|
|
1742
|
+
`,Ql=Ao.div`
|
|
1743
1743
|
display: flex;
|
|
1744
1744
|
flex-direction: column;
|
|
1745
1745
|
justify-content: center;
|
|
1746
1746
|
align-items: center;
|
|
1747
1747
|
gap: 8px;
|
|
1748
|
-
`,
|
|
1748
|
+
`,Jl=Ao.div`
|
|
1749
1749
|
display: flex;
|
|
1750
1750
|
align-items: baseline;
|
|
1751
1751
|
gap: 4px;
|
|
1752
|
-
`,
|
|
1752
|
+
`,Xl=Ao.div`
|
|
1753
1753
|
font-size: 42px;
|
|
1754
|
-
`,
|
|
1754
|
+
`,ec=Ao.div`
|
|
1755
1755
|
font-size: 18px;
|
|
1756
|
-
`,
|
|
1756
|
+
`,tc=Ao.div`
|
|
1757
1757
|
font-size: 12px;
|
|
1758
1758
|
color: var(--privy-color-foreground-3);
|
|
1759
1759
|
// we need this container to maintain a static height if there's no content
|
|
1760
1760
|
height: 20px;
|
|
1761
|
-
`,
|
|
1761
|
+
`,Eg=Ao.div`
|
|
1762
1762
|
display: flex;
|
|
1763
1763
|
flex-direction: row;
|
|
1764
1764
|
line-height: 22px;
|
|
@@ -1768,24 +1768,33 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1768
1768
|
margin-right: 6px;
|
|
1769
1769
|
margin: auto;
|
|
1770
1770
|
}
|
|
1771
|
-
`,
|
|
1771
|
+
`,Tg=Ao(vp)`
|
|
1772
1772
|
margin-top: 16px;
|
|
1773
|
-
`;import{Fragment as
|
|
1773
|
+
`;import{Fragment as R6,jsx as hr,jsxs as Zo}from"react/jsx-runtime";var Sg=()=>{let{wallets:e}=Gr(),{app:t,navigate:r,data:o}=S(),n=o?.funding,{tokenPrice:i}=co({chainId:n.chain.id}),a=i?Kl(n.amount,i):void 0,l=e.find(c=>Qe(c.address)===Qe(n.address)),s=l&&l.walletClientType!=="privy"?Bo(l.walletClientType,l.connectorType,l.walletClientType):t.name;return Zo(R6,{children:[hr(dr,{}),Zo("h3",{children:["Add funds to your"," ",s?.toLowerCase().endsWith("wallet")?s:s+" wallet"]}),hr(Fo,{style:{marginTop:"32px"},children:Zo(Ql,{children:[Zo(Jl,{children:[hr(Xl,{children:n.amount}),hr(ec,{children:n.chain.nativeCurrency.symbol})]}),hr(tc,{children:a?`${a} USD`:"..."})]})}),Zo(bg,{children:[t.fundingConfig?.methods.sort().map(c=>{switch(c){case"moonpay":return Zo(Ee,{onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[hr(Zl,{children:hr(Hi,{style:{width:24}})}),"Moonpay"]},c);case"coinbase-onramp":return Zo(Ee,{onClick:()=>{r("MOONPAY_PROMPT_SCREEN")},children:[hr(Zl,{children:hr(En,{style:{width:24}})}),"Coinbase OnRamp"]},c);case"external":return Zo(Ee,{onClick:()=>{r("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[hr(Zl,{children:hr(k6,{style:{width:24}})}),"Transfer from wallet"]},c)}}),hr(Tg,{onClick:()=>r("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),hr($,{})]})};import{formatUnits as H6}from"@ethersproject/units";import{DocumentDuplicateIcon as V6,InformationCircleIcon as G6,QrCodeIcon as q6}from"@heroicons/react/24/outline";import{useEffect as z6,useState as bp}from"react";import Vi from"styled-components";import U6 from"styled-components";import M6 from"styled-components";var _g=M6.div`
|
|
1774
1774
|
display: flex;
|
|
1775
1775
|
flex-direction: column;
|
|
1776
|
-
`;import
|
|
1776
|
+
`;import I6 from"styled-components";var Oa=I6.span`
|
|
1777
1777
|
text-align: left;
|
|
1778
1778
|
font-size: 0.75rem;
|
|
1779
1779
|
font-weight: 500;
|
|
1780
1780
|
line-height: 1.125rem; /* 150% */
|
|
1781
1781
|
|
|
1782
1782
|
color: var(--privy-color-error);
|
|
1783
|
-
`;import
|
|
1783
|
+
`;import W6 from"styled-components";var Pg=W6.span`
|
|
1784
1784
|
color: var(--privy-color-foreground-3);
|
|
1785
1785
|
font-size: 0.75rem;
|
|
1786
1786
|
font-weight: 500;
|
|
1787
1787
|
line-height: 1.125rem; /* 150% */
|
|
1788
|
-
`;import{jsx as
|
|
1788
|
+
`;import L6 from"@heroicons/react/24/outline/Square2StackIcon";import O6 from"styled-components";import{jsx as xg,jsxs as D6}from"react/jsx-runtime";var Na=({address:e,showCopyIcon:t,url:r,className:o})=>r?xg("a",{title:e,className:o,href:`${r}/address/${e}`,target:"_blank",children:Qe(e)}):D6("button",{title:e,className:o,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[Qe(e),t&&xg(N6,{})]}),N6=O6(L6)`
|
|
1789
|
+
&& {
|
|
1790
|
+
display: inline;
|
|
1791
|
+
}
|
|
1792
|
+
stroke-width: 2;
|
|
1793
|
+
height: 0.875rem;
|
|
1794
|
+
width: 0.875rem;
|
|
1795
|
+
margin-left: 0.125rem;
|
|
1796
|
+
color: var(--privy-color-foreground-3);
|
|
1797
|
+
`;import{Fragment as B6,jsx as rc,jsxs as Cp}from"react/jsx-runtime";var oc=({errMsg:e,balance:t,address:r,isLoading:o,className:n,title:i})=>Cp(B6,{children:[Cp(F6,{className:n,$state:e?"error":void 0,children:[Cp(_g,{children:[rc(Pg,{children:i||"Pay with"}),rc(Na,{address:r,showCopyIcon:!!e})]}),rc(Jt,{isLoading:o,color:e?"red":"green",children:t})]}),e&&rc(Oa,{style:{marginTop:"0.25rem"},children:e})]}),F6=U6.div`
|
|
1789
1798
|
&& {
|
|
1790
1799
|
border-width: 1px;
|
|
1791
1800
|
}
|
|
@@ -1799,11 +1808,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1799
1808
|
align-items: center;
|
|
1800
1809
|
|
|
1801
1810
|
${e=>e.$state==="error"?"border-color: var(--privy-color-error);":""}
|
|
1802
|
-
`;import{Fragment as
|
|
1811
|
+
`;import{Fragment as wp,jsx as je,jsxs as Ot}from"react/jsx-runtime";var Ag=()=>{let{wallets:e}=Gr(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:i}=S(),{chains:a,rpcConfig:l,appId:s}=I(),[c,m]=bp("default"),[f,u]=bp(void 0),g=r?.funding,{tokenPrice:w}=co({chainId:g.chain.id}),y=w?Kl(g.amount,w):void 0,b=e.find(T=>Qe(T.address)===Qe(g.address)),P=b&&b.walletClientType!=="privy"?Bo(b.walletClientType,b.connectorType,b.walletClientType):t.name;if(!g)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:i||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),je(wp,{});z6(()=>{rr(g.chain.id,a,l,{appId:s}).getBalance(g.address).then(x=>u(x.toString())).catch(()=>u(void 0))},[]);let A=je(oc,{title:"Your wallet",errMsg:void 0,isLoading:!g||!f,balance:`${f?parseFloat(H6(f,"ether")).toPrecision(4):""} ETH`,address:g.address});return c==="qr-code"?Ot(wp,{children:[je(_,{backFn:()=>m("default")}),Ot(Fo,{style:{gap:"24px",marginBottom:"24px"},children:[Ot("div",{children:[je(de,{children:"Scan QR code"}),Ot(ue,{children:["Scan this code using your mobile wallet to send funds to your ",P," ","wallet."]})]}),je(Yo,{url:g.address,size:200,squareLogoElement:$6}),A]}),je($,{})]}):Ot(wp,{children:[je(dr,{}),je(ye,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),Ot(Fo,{style:{gap:"16px"},children:[Ot(Y6,{children:[je(G6,{height:"20px",width:"20px",color:"#4f46e5"}),Ot(Z6,{children:["Make sure to send on ",g.chain.name,"."]})]}),Ot(Q6,{children:[je(bi,{height:16}),Ot(Ql,{children:[Ot(Jl,{children:[je(Xl,{children:g.amount}),je(ec,{children:g.chain.nativeCurrency.symbol})]}),je(tc,{children:y?`${y} USD`:"..."}),Ot(Eg,{children:[wl(g.chain.id),g.chain.name]})]}),je(bi,{height:8}),Ot(j6,{children:[je(K6,{text:g.address}),je(Rg,{onClick:()=>m("qr-code"),children:Ot(kg,{children:[je(q6,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),A]}),je(bi,{height:16}),je($,{})]})},$6=({...e})=>je(Do,{color:"black",...e}),K6=e=>{let[t,r]=bp(!1);return je(Rg,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:Ot(kg,{children:[t?je(Ui,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):je(V6,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},j6=Vi.div`
|
|
1803
1812
|
display: flex;
|
|
1804
1813
|
flex-direction: row;
|
|
1805
1814
|
gap: 8px;
|
|
1806
|
-
`,
|
|
1815
|
+
`,Y6=Vi.div`
|
|
1807
1816
|
display: flex;
|
|
1808
1817
|
flex-direction: row;
|
|
1809
1818
|
padding: 8px;
|
|
@@ -1812,11 +1821,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1812
1821
|
svg {
|
|
1813
1822
|
margin-right: 12px;
|
|
1814
1823
|
}
|
|
1815
|
-
`,
|
|
1824
|
+
`,Z6=Vi.div`
|
|
1816
1825
|
line-height: 20px;
|
|
1817
1826
|
font-size: 18px
|
|
1818
1827
|
text-align: center;
|
|
1819
|
-
`,
|
|
1828
|
+
`,Q6=Vi.div`
|
|
1820
1829
|
display: flex;
|
|
1821
1830
|
flex-direction: column;
|
|
1822
1831
|
background-color: #f1f2f9;
|
|
@@ -1826,11 +1835,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1826
1835
|
}
|
|
1827
1836
|
padding: 16px;
|
|
1828
1837
|
gap: 8px;
|
|
1829
|
-
`,
|
|
1838
|
+
`,kg=Vi.span`
|
|
1830
1839
|
display: flex;
|
|
1831
1840
|
align-items: center;
|
|
1832
1841
|
margin: auto;
|
|
1833
|
-
`,
|
|
1842
|
+
`,Rg=Vi.button`
|
|
1834
1843
|
display: flex;
|
|
1835
1844
|
align-items: center;
|
|
1836
1845
|
width: 100%;
|
|
@@ -1866,7 +1875,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1866
1875
|
width: 18px;
|
|
1867
1876
|
height: 18px;
|
|
1868
1877
|
}
|
|
1869
|
-
`;import{useEffect as
|
|
1878
|
+
`;import{useEffect as yb,useState as gb}from"react";import J6 from"@heroicons/react/24/outline/ClockIcon";import X6 from"@heroicons/react/24/outline/EyeSlashIcon";import eb from"@heroicons/react/24/outline/LinkIcon";import mo from"styled-components";import{Fragment as Mg,jsx as Nt,jsxs as Fn}from"react/jsx-runtime";var Ep=({title:e,desc:t,icon:r})=>Fn(ab,{children:[Nt(lb,{children:r}),Fn(sb,{children:[Nt(nb,{children:e}),Nt(ib,{children:t})]})]}),Ig=({app:e,signedUrl:t,onContinue:r})=>Fn(Mg,{children:[Fn(rb,{children:[Nt(Hi,{size:"3.75rem"}),Fn(ob,{children:[e?.name," uses ",Nt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Fn(cb,{children:[Nt(Ep,{icon:Nt(eb,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Fn(Mg,{children:["Connect a payment method (",Nt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Nt(Ep,{icon:Nt(J6,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Nt(Ep,{icon:Nt(X6,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Nt(db,{className:"mobile-only"})]}),Nt(tb,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Nt(nl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),tb=mo.span`
|
|
1870
1879
|
display: inline-block;
|
|
1871
1880
|
color: var(--privy-color-foreground-3);
|
|
1872
1881
|
text-align: center;
|
|
@@ -1875,13 +1884,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1875
1884
|
font-weight: 400;
|
|
1876
1885
|
line-height: 140%; /* 0.875rem */
|
|
1877
1886
|
margin-bottom: 0.25rem;
|
|
1878
|
-
`,
|
|
1887
|
+
`,rb=mo.div`
|
|
1879
1888
|
display: flex;
|
|
1880
1889
|
flex-direction: column;
|
|
1881
1890
|
align-items: center;
|
|
1882
1891
|
justify-content: center;
|
|
1883
1892
|
padding: 1.5rem 0;
|
|
1884
|
-
`,
|
|
1893
|
+
`,ob=mo.span`
|
|
1885
1894
|
color: var(--privy-color-foreground);
|
|
1886
1895
|
text-align: center;
|
|
1887
1896
|
font-size: 1.125rem;
|
|
@@ -1890,46 +1899,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1890
1899
|
margin: 1.5rem 0;
|
|
1891
1900
|
text-align: center;
|
|
1892
1901
|
max-width: 19.5rem;
|
|
1893
|
-
`,
|
|
1902
|
+
`,nb=mo.span`
|
|
1894
1903
|
color: var(--privy-color-foreground);
|
|
1895
1904
|
font-size: 0.875rem;
|
|
1896
1905
|
font-weight: 500;
|
|
1897
1906
|
line-height: 1.225rem;
|
|
1898
1907
|
width: 100%;
|
|
1899
|
-
`,
|
|
1908
|
+
`,ib=mo.span`
|
|
1900
1909
|
color: var(--privy-color-foreground-2);
|
|
1901
1910
|
font-size: 0.875rem;
|
|
1902
1911
|
font-weight: 400;
|
|
1903
1912
|
line-height: 1.225rem;
|
|
1904
|
-
`,
|
|
1913
|
+
`,ab=mo.div`
|
|
1905
1914
|
display: flex;
|
|
1906
1915
|
align-items: flex-start;
|
|
1907
1916
|
gap: 0.5rem;
|
|
1908
1917
|
align-self: stretch;
|
|
1909
|
-
`,
|
|
1918
|
+
`,sb=mo.div`
|
|
1910
1919
|
display: flex;
|
|
1911
1920
|
flex-direction: column;
|
|
1912
1921
|
gap: 0.25rem;
|
|
1913
1922
|
align-items: flex-start;
|
|
1914
1923
|
text-align: left;
|
|
1915
1924
|
flex: 1 0 0;
|
|
1916
|
-
`,
|
|
1925
|
+
`,lb=mo.div`
|
|
1917
1926
|
padding-top: 2px;
|
|
1918
|
-
`,
|
|
1927
|
+
`,cb=mo.div`
|
|
1919
1928
|
display: flex;
|
|
1920
1929
|
flex-direction: column;
|
|
1921
1930
|
gap: 1.25rem;
|
|
1922
1931
|
margin: 0 0.5rem;
|
|
1923
|
-
`,
|
|
1932
|
+
`,db=mo.div`
|
|
1924
1933
|
margin: 30px 0;
|
|
1925
|
-
`;import{ofetch as
|
|
1934
|
+
`;import{ofetch as pb}from"ofetch";import{useEffect as ub,useRef as mb,useState as fb}from"react";var nc="moonpay",Wg="sdk_fiat_on_ramp_completed_with_status";function Lg(e){switch(e){case"eip155:42161":return"ETH_ARBITRUM";case"eip155:43114":return"AVAX_CCHAIN";case"eip155:8453":return"ETH_BASE";case"eip155:42220":return"CELO_CELO";case"eip155:137":return"MATIC_POLYGON";case"eip155:1":return"ETH_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function Og(e){return parseFloat(e)}function Ng(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function ic(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function Dg(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function hb(e,t){let r=t?wm:Cm,o=t?Em:bm;return pb(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Ug(e,t=!1){let[r,o]=fb(null),{createAnalyticsEvent:n}=I(),i=mb(0);return ub(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await hb(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Wg,payload:{status:s,provider:nc,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n({eventName:Wg,payload:{status:"serviceFailure",provider:nc}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as vb,jsx as Tp,jsxs as Cb}from"react/jsx-runtime";var Fg=()=>{let{app:e,data:t,navigate:r,setModalData:o}=S(),{createAnalyticsEvent:n,getMoonpaySignedUrl:i}=I(),[a,l]=gb(null),s=t?.funding;return yb(()=>{if(a||!s)return;async function c(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:f}=await i(s.address,{...e.fundingMethodConfig.moonpay,...s.moonpayConfigOverride,currencyCode:s.moonpayConfigOverride?.currencyCode??Lg(`eip155:${s.chain.id}`),quoteCurrencyAmount:s.moonpayConfigOverride?.quoteCurrencyAmount??Og(s.amount)});l(m),o({moonpayStatus:{externalTransactionId:f},funding:t?.funding})}c()},[a,s]),Cb(vb,{children:[Tp(dr,{}),Tp(Ig,{app:e,signedUrl:a,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:nc}}),r("MOONPAY_STATUS_SCREEN")}}),Tp($,{})]})};import wb from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import bb from"@heroicons/react/24/solid/CheckCircleIcon";import Eb from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as Tb}from"react";import Bg from"styled-components";import{Fragment as Sp,jsx as Dt,jsxs as Bn}from"react/jsx-runtime";var Hg=()=>{let{app:e,data:t}=S(),{closePrivyModal:r}=I(),{externalTransactionId:o}=t?.moonpayStatus,n=Ug(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return Bn(Sp,{children:[Dt(_,{title:"Fund account"},"header"),Dt(_b,{status:n,onClickCta:r}),Dt($,{})]})},Sb=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:Bn(Sp,{children:[Bn("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Dt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Dt("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},_b=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=Tb(()=>Sb(e),[e]);return Bn(Sp,{children:[Bn(Rb,{children:[Dt(Ab,{status:e}),Bn(Xe,{children:[Dt("h3",{children:r}),Dt(kb,{children:o})]})]}),n&&Dt(F,{onClick:t,children:n})]})},Pb=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",xb=e=>{switch(e){case"serviceFailure":case"failed":return Eb;case"completed":return bb;case"waitingAuthorization":return()=>Dt(wb,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},Ab=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Bn("div",{style:{position:"relative"},children:[Dt(mt,{color:o,style:{position:"absolute"}}),Dt(Rd,{color:o}),Dt(Hi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=xb(e),r=Pb(e);return Dt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Dt(t,{width:"4rem",height:"4rem",color:r})})},kb=Bg.p`
|
|
1926
1935
|
font-size: 1rem;
|
|
1927
1936
|
color: var(--privy-color-foreground-3);
|
|
1928
1937
|
margin-bottom: 1rem;
|
|
1929
1938
|
display: flex;
|
|
1930
1939
|
flex-direction: column;
|
|
1931
1940
|
gap: 1rem;
|
|
1932
|
-
`,
|
|
1941
|
+
`,Rb=Bg.div`
|
|
1933
1942
|
display: flex;
|
|
1934
1943
|
flex-direction: column;
|
|
1935
1944
|
align-items: center;
|
|
@@ -1937,7 +1946,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1937
1946
|
margin-left: 1.75rem;
|
|
1938
1947
|
margin-right: 1.75rem;
|
|
1939
1948
|
padding: 2rem 0;
|
|
1940
|
-
`;import{useEffect as
|
|
1949
|
+
`;import{useEffect as Fb,useState as Bb}from"react";import Mb from"styled-components";var Gi=Mb.span`
|
|
1941
1950
|
margin-top: 4px;
|
|
1942
1951
|
color: var(--privy-color-foreground);
|
|
1943
1952
|
text-align: center;
|
|
@@ -1945,7 +1954,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1945
1954
|
font-size: 0.875rem;
|
|
1946
1955
|
font-weight: 400;
|
|
1947
1956
|
line-height: 1.375rem; /* 157.143% */
|
|
1948
|
-
`;import
|
|
1957
|
+
`;import Ib,{css as Wb}from"styled-components";import{jsx as Ob}from"react/jsx-runtime";var ac=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=S(),{initLoginWithPasskey:n}=I();return Ob(_p,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},Lb=Wb`
|
|
1949
1958
|
&& {
|
|
1950
1959
|
width: 100%;
|
|
1951
1960
|
font-size: 0.875rem;
|
|
@@ -1970,9 +1979,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1970
1979
|
box-shadow: none;
|
|
1971
1980
|
}
|
|
1972
1981
|
}
|
|
1973
|
-
`,
|
|
1974
|
-
${
|
|
1975
|
-
`;import
|
|
1982
|
+
`,_p=Ib.button`
|
|
1983
|
+
${Lb}
|
|
1984
|
+
`;import Nb from"@heroicons/react/24/outline/ChevronRightIcon";import Db from"@heroicons/react/24/outline/WalletIcon";import{jsx as Pp,jsxs as Ub}from"react/jsx-runtime";var sc=({onClick:e,text:t})=>Ub(Ee,{onClick:e,children:[Pp(Db,{}),Pp(to,{children:t}),Pp(Nb,{})]});import{Fragment as Vg,jsx as Qo,jsxs as lc}from"react/jsx-runtime";var Gg=()=>{let{connectors:e}=I(),{app:t,setModalData:r,data:o,navigate:n}=S(),[i,a]=Bb("default"),l=Ho(t.appearance.walletList,e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),s=Qo(sc,{text:"More wallets",onClick:()=>a("overflow")});return Fb(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),i==="overflow"?lc(Vg,{children:[Qo(_,{backFn:()=>a("default")},"header"),lc(jt,{children:[Qo(Gi,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),Qo($,{})]}):lc(Vg,{children:[Qo(dr,{}),Qo(ye,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),lc(jt,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&s,Qo(_p,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),Qo($,{})]})};import Hb from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Vb from"styled-components";import{Fragment as qb,jsx as Jo,jsxs as zb}from"react/jsx-runtime";var qg=()=>{let{closePrivyModal:e}=I();return zb(qb,{children:[Jo(_,{},"header"),Jo(Gb,{children:Jo(Hb,{style:{width:32,height:32}})}),Jo(no,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),Jo(Sr,{children:Jo(F,{onClick:()=>e(),children:"Close"})}),Jo(ne,{}),Jo($,{})]})},Gb=Vb.div`
|
|
1976
1985
|
border-radius: 50%;
|
|
1977
1986
|
height: 68px;
|
|
1978
1987
|
width: 68px;
|
|
@@ -1982,18 +1991,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1982
1991
|
background-color: var(--privy-color-accent);
|
|
1983
1992
|
color: white;
|
|
1984
1993
|
margin: 0 auto 24px auto;
|
|
1985
|
-
`;import*as
|
|
1994
|
+
`;import*as jg from"react-device-detect";import Yb from"styled-components";import xp from"styled-components";import{jsx as zg}from"react/jsx-runtime";var $g=({style:e,...t})=>zg("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:zg("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as Kb,jsxs as jb}from"react/jsx-runtime";var Kg=xp.div`
|
|
1986
1995
|
display: flex;
|
|
1987
1996
|
flex-direction: column;
|
|
1988
1997
|
justify-content: flex-start;
|
|
1989
1998
|
gap: 4px;
|
|
1990
|
-
`,
|
|
1999
|
+
`,Ap=xp.div`
|
|
1991
2000
|
&&& {
|
|
1992
2001
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1993
2002
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1994
2003
|
height: 12px;
|
|
1995
2004
|
}
|
|
1996
|
-
`,
|
|
2005
|
+
`,cc=({children:e})=>jb($b,{children:[Kb($g,{style:{width:"16px",height:"16px"}}),e]}),$b=xp.div`
|
|
1997
2006
|
display: flex;
|
|
1998
2007
|
justify-content: flex-start;
|
|
1999
2008
|
justify-items: center;
|
|
@@ -2011,22 +2020,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2011
2020
|
margin-bottom: auto;
|
|
2012
2021
|
}
|
|
2013
2022
|
}
|
|
2014
|
-
`;import{Fragment as
|
|
2023
|
+
`;import{Fragment as Jb,jsx as bt,jsxs as Da}from"react/jsx-runtime";var Zb=()=>Da(Qb,{children:[bt(kn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),bt(wt,{children:bt(Xr,{style:{width:"152px",height:"152px"}})}),Da(Kg,{children:[bt(cc,{children:Da("div",{children:[bt("span",{children:"Install the "}),bt("a",{href:jg.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),bt(Ap,{}),bt(cc,{children:"Set up your first wallet"}),bt(Ap,{}),bt(cc,{children:"Store your recovery phrase in a safe place!"})]}),bt(hi,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Yg=()=>{let{navigateBack:e}=S();return Da(Jb,{children:[bt(_,{backFn:e},"header"),bt(oe,{}),bt(Zb,{}),bt(ne,{}),Da(Z,{children:[bt("span",{children:"Still not sure? "}),bt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},Qb=Yb(wt)`
|
|
2015
2024
|
gap: 30px;
|
|
2016
2025
|
|
|
2017
2026
|
> :first-child > svg {
|
|
2018
2027
|
margin-top: 20px;
|
|
2019
2028
|
}
|
|
2020
|
-
`;import
|
|
2029
|
+
`;import V7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as G7,useState as p1}from"react";import{isMobile as q7}from"react-device-detect";import z7 from"styled-components";var Xb={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",cross_app:"privy:"},Xo=e=>{let t=Xb[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import r7 from"styled-components";import e7 from"react";import{jsx as t7}from"react/jsx-runtime";var Zg=()=>{let{app:e}=S(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?t7("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?e7.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as Qg}from"react/jsx-runtime";var dc=e=>{let{app:t}=S();return t?.appearance.logo?Qg(o7,{...e,children:Qg(Zg,{})}):null},o7=r7.div`
|
|
2021
2030
|
display: flex;
|
|
2022
2031
|
flex-direction: column;
|
|
2023
2032
|
align-items: center;
|
|
2024
2033
|
padding: 24px 0;
|
|
2025
2034
|
flex-grow: 1;
|
|
2026
2035
|
justify-content: center;
|
|
2027
|
-
`;import
|
|
2036
|
+
`;import c7 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as d7}from"react";import n7 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as i7,useState as kp}from"react";import Xg from"styled-components";import{Fragment as l7,jsx as Hn,jsxs as Jg}from"react/jsx-runtime";var pc=i7((e,t)=>{let[r,o]=kp(""),[n,i]=kp(!1),{authenticated:a}=q(),{initLoginWithEmail:l}=I(),{navigate:s,setModalData:c,currentScreen:m}=S(),{enabled:f,token:u}=be(),[g,w]=kp(!1),{accountType:y}=St(),b=Es(r),P=n,A=n||!b,T=R=>{i(!0),l(r,R).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(M=>{c({errorModalData:{error:M,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},x=()=>{f&&!u&&!a?(c({captchaModalData:{callback:R=>l(r,R),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):T(u)};return Jg(l7,{children:[Hn(a7,{children:Jg(s7,{stacked:e.stacked,children:[Hn(n7,{}),Hn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>w(!0),onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&x()},value:r,autoComplete:"email"}),y==="email"&&!g?Hn(Jt,{color:"gray",children:"Recent"}):e.stacked?Hn("span",{}):Hn(yi,{isSubmitting:P,onClick:x,disabled:A,children:"Submit"})]})}),e.stacked?Hn(F,{loadingText:null,loading:P,disabled:A,onClick:x,children:"Submit"}):null]})}),a7=Xg.div`
|
|
2028
2037
|
width: 100%;
|
|
2029
|
-
`,
|
|
2038
|
+
`,s7=Xg.label`
|
|
2030
2039
|
display: block;
|
|
2031
2040
|
position: relative;
|
|
2032
2041
|
width: 100%;
|
|
@@ -2093,11 +2102,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2093
2102
|
&& > input::placeholder {
|
|
2094
2103
|
color: var(--privy-color-foreground-3);
|
|
2095
2104
|
}
|
|
2096
|
-
`;import{Fragment as
|
|
2105
|
+
`;import{Fragment as p7,jsx as uc,jsxs as e1}from"react/jsx-runtime";var mc=({isEditable:e,setIsEditable:t})=>{let r=d7(null);return e1(p7,{children:[uc(Dr,{if:!e,children:uc(pc,{ref:r})}),uc(Dr,{if:e,children:e1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[uc(c7,{})," Continue with Email"]})})]})};import{useState as u7}from"react";import m7 from"styled-components";import{jsx as fc,jsxs as h7}from"react/jsx-runtime";var hc=()=>{let[e,t]=u7(!1),{currentScreen:r,navigate:o,setModalData:n}=S(),{enabled:i,token:a}=be(),{initLoginWithFarcaster:l}=I(),{accountType:s}=St();return h7(Ee,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:m=>l(m),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[fc(so,{})," Farcaster",e&&fc("span",{children:fc(eo,{})}),s==="farcaster"&&fc(f7,{color:"gray",children:"Recent"})]})},f7=m7(Jt)`
|
|
2097
2106
|
margin-left: auto;
|
|
2098
|
-
`;import
|
|
2107
|
+
`;import A7 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as k7}from"react";import{forwardRef as S7,useState as vc}from"react";import a1 from"styled-components";import y7 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as g7,AsYouType as v7,getCountries as C7,getCountryCallingCode as yc,getExampleNumber as w7}from"libphonenumber-js/min";import{jsx as T7,jsxs as E7}from"react/jsx-runtime";var Ua=(e,t)=>g7(String(e),t),gc=(e,t)=>`+${yc(t)} ${e}`,t1=e=>`*${e.replaceAll("-","").slice(-4)}`,r1=e=>new v7(e),b7=C7().map(e=>({code:e,callCode:yc(e)})),o1=e=>{let t=w7(e,y7)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},n1=({value:e,onChange:t})=>T7("select",{value:e,onChange:t,children:b7.map(r=>E7("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as x7,jsx as Vn,jsxs as i1}from"react/jsx-runtime";var qi=S7((e,t)=>{let{app:r}=S(),[o,n]=vc(!1),{accountType:i}=St(),[a,l]=vc(""),[s,c]=vc(r?.intl.defaultCountry??"US"),m=Ua(a,s),f=r1(s),u=o1(s),g=yc(s),w=!m,[y,b]=vc(!1),P=g.length,A=R=>{let M=R.target.value;c(M),l(""),e.onChange&&e.onChange({rawPhoneNumber:a,qualifiedPhoneNumber:gc(a,M),countryCode:M,isValid:Ua(a,s)})},T=R=>{try{let M=R.replace(/\D/g,""),D=a.replace(/\D/g,""),B=M===D?R:f.input(R);l(B),e.onChange&&e.onChange({rawPhoneNumber:B,qualifiedPhoneNumber:gc(R,s),countryCode:s,isValid:Ua(R,s)})}catch(M){console.error("Error processing phone number:",M)}},x=()=>{b(!0);let R=gc(a,s);e.onSubmit({rawPhoneNumber:a,qualifiedPhoneNumber:R,countryCode:s,isValid:Ua(a,s)}).finally(()=>b(!1))};return i1(x7,{children:[Vn(_7,{children:i1(P7,{callingCodeLength:P,stacked:e.stacked,children:[Vn(n1,{value:s,onChange:A}),Vn("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:u,onFocus:()=>n(!0),onChange:R=>{T(R.target.value)},onKeyUp:R=>{R.key==="Enter"&&x()},value:a,autoComplete:"tel"}),i==="phone"&&!o?Vn(Jt,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?Vn(yi,{isSubmitting:y,onClick:x,disabled:w,children:"Submit"}):Vn("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?Vn(F,{loading:y,loadingText:null,onClick:x,disabled:w,children:"Submit"}):null]})}),_7=a1.div`
|
|
2099
2108
|
width: 100%;
|
|
2100
|
-
`,
|
|
2109
|
+
`,P7=a1.label`
|
|
2101
2110
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
2102
2111
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
2103
2112
|
display: block;
|
|
@@ -2190,15 +2199,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2190
2199
|
&& > input::placeholder {
|
|
2191
2200
|
color: var(--privy-color-foreground-3);
|
|
2192
2201
|
}
|
|
2193
|
-
`;import{Fragment as
|
|
2202
|
+
`;import{Fragment as R7,jsx as Cc,jsxs as s1}from"react/jsx-runtime";var wc=({isEditable:e,setIsEditable:t})=>{let r=k7(null),{authenticated:o}=q(),{navigate:n,setModalData:i,currentScreen:a}=S(),{initLoginWithSms:l}=I(),{enabled:s,token:c}=be();async function m({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:u=>l(f,u),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(u){i({errorModalData:{error:u,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return s1(R7,{children:[Cc(Dr,{if:!e,children:Cc(qi,{ref:r,onSubmit:m})}),Cc(Dr,{if:e,children:s1(Ee,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Cc(A7,{})," Continue with SMS"]})})]})};import{useState as M7}from"react";import I7 from"styled-components";import{jsx as fo,jsxs as O7}from"react/jsx-runtime";var W7={apple:{logo:fo(Ws,{}),displayName:"Apple"},discord:{logo:fo(Ls,{}),displayName:"Discord"},github:{logo:fo(Os,{}),displayName:"GitHub"},google:{logo:fo(Ds,{}),displayName:"Google"},linkedin:{logo:fo(Hs,{}),displayName:"LinkedIn"},spotify:{logo:fo(Vs,{}),displayName:"Spotify"},instagram:{logo:fo(Fs,{}),displayName:"Instagram"},twitter:{logo:fo(qs,{}),displayName:"Twitter"},tiktok:{logo:fo(Gs,{}),displayName:"TikTok"}},xt=({provider:e})=>{let{enabled:t,token:r}=be(),{navigate:o,setModalData:n}=S(),[i,a]=M7(!1),{initLoginWithOAuth:l}=I(),{accountType:s}=St(),c=s?Xo(s):null,{displayName:m,logo:f}=W7[e];return O7(Ee,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:g=>l(e,g),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[f," ",m,c?.loginMethod===e&&fo(L7,{color:"gray",children:"Recent"})]})},L7=I7(Jt)`
|
|
2194
2203
|
margin-left: auto;
|
|
2195
|
-
`;import{useState as
|
|
2204
|
+
`;import{useState as N7}from"react";import D7 from"styled-components";import{jsx as en,jsxs as l1}from"react/jsx-runtime";function bc(e){return l1("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[en("defs",{children:l1("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[en("stop",{offset:"0",stopColor:"#1d93d2"}),en("stop",{offset:"1",stopColor:"#38b0e3"})]})}),en("title",{children:"Telegram_logo"}),en("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),en("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),en("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),en("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as c1,jsxs as F7}from"react/jsx-runtime";var Ec=()=>{let{enabled:e,token:t}=be(),{navigate:r,setModalData:o}=S(),[n,i]=N7(!1),{initLoginWithTelegram:a}=I(),{accountType:l}=St();async function s(m){try{await a(m),r("TELEGRAM_AUTH_SCREEN")}catch(f){console.error(f),i(!1)}}async function c(){if(i(!0),e&&!t){o({captchaModalData:{callback:s,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await s()}return F7(Ee,{onClick:c,disabled:n,children:[c1(bc,{}),l==="telegram"&&c1(U7,{color:"gray",children:"Recent"})]})},U7=D7(Jt)`
|
|
2196
2205
|
margin-left: auto;
|
|
2197
|
-
`;import
|
|
2206
|
+
`;import B7 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as d1,jsxs as H7}from"react/jsx-runtime";var Tc=({onClick:e,text:t,icon:r})=>H7(Ee,{onClick:e,children:[r,d1(to,{children:t}),d1(B7,{})]});import{Fragment as Rp,jsx as nt,jsxs as _c}from"react/jsx-runtime";var Pc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=I(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{appearance:{palette:{colorScheme:i}}}=Ge(),{accountType:a,walletClientType:l}=St(),s=a?Xo(a):null,c=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],f=[...c,...m],u=o.loginMethods.passkey,g=[];l&&f.includes(l)?g.push(l):a&&f.includes(s?.loginMethod)&&g.push(s?.loginMethod);let[w,y]=p1("default"),[b,P]=p1(a==="phone"?"sms":"email");G7(()=>{a==="phone"&&P("sms");let N=f.indexOf("sms"),W=f.indexOf("email");N>-1&&N<W&&P("sms")},[a,c,m]);let A=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{y("default")},150)};n.current=A;let T=N=>N==="email"?nt(mc,{isEditable:b==="email",setIsEditable:()=>{P("email")}},N):N==="sms"?nt(wc,{isEditable:b==="sms",setIsEditable:()=>{P("sms")}},N):N==="apple"?nt(xt,{provider:"apple"},N):N==="discord"?nt(xt,{provider:"discord"},N):N==="farcaster"?nt(hc,{},N):N==="github"?nt(xt,{provider:"github"},N):N==="google"?nt(xt,{provider:"google"},N):N==="linkedin"?nt(xt,{provider:"linkedin"},N):N==="tiktok"?nt(xt,{provider:"tiktok"},N):N==="twitter"&&(!q7||o?.loginConfig.twitterOAuthOnMobileEnabled)?nt(xt,{provider:"twitter"},N):N==="telegram"?nt(Ec,{},N):Ho([N],r,e,f,o.externalWallets.walletConnect.enabled),x=g.flatMap(T),R=c.filter(N=>N!==l&&N!==s?.loginMethod).flatMap(T),M=m.filter(N=>N!==l&&N!==s?.loginMethod).flatMap(T),D=[...x,...R,...M],B=$7({primary:R.length+x.length,overflow:M.length}),[K,j]=em(D,B),L=w==="default"?void 0:()=>{y("default")};return _c(Rp,{children:[nt(_,{title:o.appearance.landingHeader,onClose:A,backFn:L}),w==="default"&&nt(K7,{}),w==="default"&&(typeof o.appearance.loginMessage=="string"?nt(sl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),nt(al,{style:{overflow:"hidden"},children:_c(Xf,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[w==="default"&&_c(Rp,{children:[...K,j.length>0&&nt(Tc,{text:"More options",icon:nt(V7,{}),onClick:()=>y("overflow")})]}),w==="overflow"&&_c(Rp,{children:[...j]}),u&&w==="default"&&nt(ac,{})]})}),o&&nt(Ci,{app:o}),nt($,{})]})},Sc=5,$7=({primary:e,overflow:t})=>e<Sc?e:e===Sc&&t===0?Sc:Sc-1,K7=z7(dc)`
|
|
2198
2207
|
margin-bottom: 16px;
|
|
2199
|
-
`;import
|
|
2208
|
+
`;import j7 from"@heroicons/react/24/outline/EnvelopeIcon";import Y7 from"@heroicons/react/24/outline/PhoneIcon";import Z7 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as Q7,useMemo as f1,useState as h1}from"react";import{isMobile as J7}from"react-device-detect";import X7 from"styled-components";import{toObjectKeys as eE}from"@privy-io/js-sdk-core";import{jsx as Fa,jsxs as u1}from"react/jsx-runtime";var m1=({...e})=>u1("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[u1("g",{clipPath:"url(#clip0_2856_1743)",children:[Fa("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Fa("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Fa("defs",{children:Fa("clipPath",{id:"clip0_2856_1743",children:Fa("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as Ba,jsx as qe,jsxs as zi}from"react/jsx-runtime";var xc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=I(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=S(),i=Ge(),{accountType:a,walletClientType:l}=St(),s=a?Xo(a):null,c=o?.login,m=f1(()=>c?.loginMethods?eE(c.loginMethods,!0):null,[c]),{email:f,sms:u,google:g,twitter:w,discord:y,github:b,spotify:P,instagram:A,tiktok:T,linkedin:x,apple:R,wallet:M,farcaster:D,telegram:B}=m??i.loginMethods,{passkey:K}=i.loginMethods,j=[f&&"email",u&&"sms",g&&"google",w&&"twitter",y&&"discord",b&&"github",P&&"spotify",A&&"instagram",T&&"tiktok",x&&"linkedin",R&&"apple",D&&"farcaster",B&&"telegram"].filter(V=>!!V),L=j.length>0,N=f1(()=>M&&!L?"web3-first":M&&i?.appearance.loginGroupPriority||"web2-first",[M,L,i?.appearance.loginGroupPriority]),W=i?.appearance.hideDirectWeb2Inputs,[ve,Me]=h1("default"),[Y,te]=h1(y1({accountType:a,sms:u,email:f}));Q7(()=>{te(y1({accountType:a,sms:u,email:f}))},[f,u,a]);let ee=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{Me("default")},150)};n.current=ee;let _e=[];l&&M?_e.push(l):s?.loginMethod&&j.includes(s.loginMethod)&&_e.push(s.loginMethod);let Te=V=>V==="email"?qe(mc,{isEditable:Y==="email",setIsEditable:()=>{te("email")}},V):V==="sms"?qe(wc,{isEditable:Y==="sms",setIsEditable:()=>{te("sms")}},V):V==="apple"?qe(xt,{provider:"apple"},V):V==="discord"?qe(xt,{provider:"discord"},V):V==="farcaster"?qe(hc,{},V):V==="github"?qe(xt,{provider:"github"},V):V==="google"?qe(xt,{provider:"google"},V):V==="linkedin"?qe(xt,{provider:"linkedin"},V):V==="tiktok"?qe(xt,{provider:"tiktok"},V):V==="twitter"&&(!J7||i?.loginConfig.twitterOAuthOnMobileEnabled)?qe(xt,{provider:"twitter"},V):V==="telegram"?qe(Ec,{},V):Ho([V],r,e,[],i.externalWallets.walletConnect.enabled),ze=Ho(i.appearance.walletList.filter(V=>V!==l),r,e,[...i.appearance.walletList,l],i.externalWallets.walletConnect.enabled),Ve=j.filter(V=>V!==s?.loginMethod).flatMap(Te),pt=_e.flatMap(Te);N==="web3-first"&&ve==="default"?ze.unshift(...pt):N==="web2-first"&&Ve.unshift(...pt);let Fe=ve==="default"?void 0:()=>{Me("default")},ae=j.filter(V=>V!=="email"&&V!=="sms"),Ft=rE({priority:N,email:f,sms:u,social:ae}),Rr=oE({priority:N,email:f,sms:u,social:ae}),jr=nE({priority:N}),O=qe(sc,{text:jr,onClick:()=>Me("web3-overflow")}),rt=qe(Tc,{text:Ft,icon:Rr,onClick:()=>Me("web2-overflow")}),Mr=W?0:1;return zi(Ba,{children:[qe(_,{title:i.appearance.landingHeader,onClose:ee,backFn:Fe}),ve==="default"&&qe(tE,{}),ve==="default"&&(typeof i.appearance.loginMessage=="string"?qe(sl,{children:i.appearance.loginMessage}):i.appearance.loginMessage),qe(al,{style:{overflow:"hidden",padding:2},children:zi(jt,{children:[ve==="default"&&N==="web2-first"&&zi(Ba,{children:[...Ve.length>4?Ve.slice(0,3):Ve,Ve.length>4&&rt,M&&O]}),ve==="default"&&N==="web3-first"&&zi(Ba,{children:[M&&zi(Ba,{children:[...ze.length>4?ze.slice(0,3):ze,ze.length>4&&O]}),Ve.length>Mr&&rt,Ve.length===Mr&&Ve[0]]}),ve==="web2-overflow"&&zi(Ba,{children:[...N==="web3-first"?Ve:Ve.slice(3)]}),...ve==="web3-overflow"?ze:[],K&&ve==="default"&&qe(ac,{})]})}),i&&qe(Ci,{app:i}),qe($,{})]})},tE=X7(dc)`
|
|
2200
2209
|
margin-bottom: 16px;
|
|
2201
|
-
`,
|
|
2210
|
+
`,rE=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",oE=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?qe(Z7,{}):t&&r?qe(m1,{}):t?qe(j7,{}):r?qe(Y7,{}):null,nE=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",y1=({accountType:e,sms:t,email:r})=>e==="email"&&r?"email":e==="phone"&&t||t&&!r?"sms":"email";import{jsx as g1}from"react/jsx-runtime";var v1=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?g1(Pc,{connectOnly:!0}):g1(xc,{connectOnly:!0})};import{jsx as C1}from"react/jsx-runtime";var w1=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?C1(Pc,{connectOnly:!1}):C1(xc,{connectOnly:!1})};import iE from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as aE,jsx as tn,jsxs as sE}from"react/jsx-runtime";var b1=()=>{let{app:e}=S();return sE(aE,{children:[tn(_,{},"header"),tn(oe,{}),tn(ye,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:tn(iE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),tn(Sr,{children:tn(pc,{stacked:!0})}),tn(ne,{}),tn($,{})]})};import lE from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as cE,jsx as rn,jsxs as dE}from"react/jsx-runtime";var E1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=S(),{initLoginWithSms:i}=I();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return dE(cE,{children:[rn(_,{},"header"),rn(oe,{}),rn(ye,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:rn(lE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),rn(Sr,{children:rn(qi,{stacked:!0,onSubmit:a})}),rn(ne,{}),rn($,{})]})};import{Fragment as pE,jsx as Ha,jsxs as uE}from"react/jsx-runtime";var T1=()=>{let{linkingOrConnectingHint:e}=I(),{app:t}=S(),r=e?`Link the wallet with address ${Qe(e)} ${t?.name?`to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return uE(pE,{children:[Ha(_,{},"header"),Ha(no,{title:"Link your wallet",description:r}),Ha(jt,{children:Ha(xi,{connectOnly:!1})}),Ha($,{})]})};import{jsx as S1,jsxs as mE}from"react/jsx-runtime";var _1=({style:e,...t})=>mE("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[S1("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),S1("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as fE,jsx as on,jsxs as P1}from"react/jsx-runtime";var x1=()=>{let{closePrivyModal:e}=I(),{navigate:t}=S();return P1(fE,{children:[on(_,{},"header"),on(oe,{}),on(_1,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),on(no,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),P1(Sr,{children:[on(F,{onClick:()=>t("LANDING"),children:"Try again"}),on(Nr,{onClick:()=>e(),children:"Cancel"})]}),on(ne,{}),on($,{})]})};import QE from"@heroicons/react/24/solid/CheckBadgeIcon";import JE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import XE from"@heroicons/react/24/solid/IdentificationIcon";import e8 from"@heroicons/react/24/solid/PhoneIcon";import t8 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import B1 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as r8,useState as $i}from"react";import{useContext as hE}from"react";function Va(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=hE(Se);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as yE}from"react";function qr(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=yE(Se);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import gE from"styled-components";import{jsx as A1,jsxs as CE}from"react/jsx-runtime";var k1=e=>CE(vE,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[A1("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),A1("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),vE=gE.svg`
|
|
2202
2211
|
height: 90px;
|
|
2203
2212
|
width: 90px;
|
|
2204
2213
|
|
|
@@ -2209,7 +2218,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2209
2218
|
> path {
|
|
2210
2219
|
fill: white;
|
|
2211
2220
|
}
|
|
2212
|
-
`;import
|
|
2221
|
+
`;import Mp from"@heroicons/react/20/solid/CheckIcon";import wE from"@heroicons/react/24/outline/ChevronRightIcon";import bE from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import EE from"@heroicons/react/24/outline/FingerPrintIcon";import TE from"@heroicons/react/24/outline/PhoneIcon";import Ip from"@heroicons/react/24/outline/TrashIcon";import SE from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as _E,jsx as xe,jsxs as tr}from"react/jsx-runtime";var R1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:m})=>{let f=t.reduce((g,w)=>({...g,[w]:!0}),{}),u=r.reduce((g,w)=>({...g,[w]:!0}),{});return tr(_E,{children:[xe(_,{backFn:e?s:void 0,onClose:l},"header"),xe(Ie,{children:xe(Ke,{children:xe(SE,{})})}),xe(de,{children:"Choose a verification method"}),t.length>0?xe(ue,{children:"To add or delete verification methods, verification is required."}):xe(ue,{children:"How would you like to verify your identity? You can change this later."}),a&&xe(ml,{style:{marginTop:"1.25rem"},children:a.message}),tr(ll,{children:[(u.totp||f.totp)&&tr(cl,{children:[xe(Ee,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?xe(mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):tr(ul,{children:[tr(pl,{children:[xe(bE,{}),"Authenticator App"]}),f.totp?tr(An,{children:[xe(Mp,{}),"Added"]}):xe(An,{children:"Recommended"})]})}),f.totp&&xe(dl,{onClick:()=>m("totp"),children:xe(Ip,{})})]},"totp"),(u.sms||f.sms)&&tr(cl,{children:[xe(Ee,{disabled:f.sms||o,onClick:()=>c("sms"),children:tr(ul,{children:[tr(pl,{children:[xe(TE,{}),"SMS"]}),f.sms&&tr(An,{children:[xe(Mp,{}),"Added"]}),o&&xe(An,{children:"Disabled"})]})}),f.sms&&xe(dl,{onClick:()=>m("sms"),children:xe(Ip,{})})]},"sms"),(u.passkey||f.passkey)&&tr(cl,{children:[xe(Ee,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?xe(mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):tr(ul,{children:[tr(pl,{children:[xe(EE,{}),"Passkey"]}),f.passkey?tr(An,{children:[xe(Mp,{}),"Added"]}):xe(An,{isAccent:!0,children:xe(wE,{})})]})}),f.passkey&&xe(dl,{onClick:()=>m("passkey"),children:xe(Ip,{})})]},"passkey")]}),xe(Z,{})]})};import PE from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import xE from"@heroicons/react/24/outline/ClockIcon";import AE from"@heroicons/react/24/outline/ShieldCheckIcon";import kE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as RE,useState as Ga}from"react";import Ac from"styled-components";import{Fragment as Wp,jsx as me,jsxs as kr}from"react/jsx-runtime";var I1=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=q(),{data:n}=S(),{initLinkWithPasskey:i,linkWithPasskey:a}=I(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=qr(),[c,m]=Ga(!1),[f,u]=Ga(!1),[g,w]=Ga(!1),[y,b]=Ga(null),P=RE(()=>o?.linkedAccounts.filter(R=>R.type==="passkey")??[],[o]),A=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},T=async R=>{m(!0);try{await l(),await s({credentialIds:R}),w(!0)}catch(M){b(M)}finally{m(!1)}},x=async()=>{u(!0),b(null);try{await i();let M=(await a())?.linkedAccounts.filter(D=>D.type==="passkey").map(D=>D.credentialId)??[];await T(M)}catch(R){b(R)}finally{u(!1)}};return P.length===0||f?me(ME,{onReset:r,onClose:t,onClick:x,isCreating:f}):g?me(WE,{onClick:A,onClose:A}):y?me(Nn,{error:y,backFn:()=>b(null),onClick:()=>b(null)}):me(IE,{passkeys:P,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>T(P.map(R=>R.credentialId)),onAddPasskey:x})},ME=({onReset:e,onClose:t,onClick:r,isCreating:o})=>kr(Wp,{children:[me(_,{backFn:e,onClose:t},"header"),me(Ie,{children:kr(Yl,{children:[me(Dn,{}),me(Un,{})]})}),me(de,{children:"Set up passkey verification"}),kr(xn,{children:[kr(Zt,{children:[me(Yt,{children:me(AE,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),kr(Zt,{children:[me(Yt,{children:me(xE,{})}),"Takes seconds to set up and use"]}),kr(Zt,{children:[me(Yt,{children:me(PE,{})}),"Use your passkey to verify transactions and login to your account"]})]}),me(F,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),me(Z,{})]}),IE=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=Ga(!1),c=l?n.length:n.length>3?2:3;return kr(Wp,{children:[me(_,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&me(Ie,{children:kr(Yl,{children:[me(Dn,{}),me(Un,{})]})}),me(de,{children:"Enable your passkeys for verification"}),kr(xn,{children:[n.slice(0,c).map(m=>kr(LE,{children:[me(OE,{children:DE(m)}),kr(NE,{children:["Last used: ",m.latestVerifiedAt?.toLocaleString()]})]},m.credentialId)),!l&&n.length>3&&me(M1,{onClick:()=>s(!0),children:"View All"})]}),me(F,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&me(M1,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?me(mt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),me(Z,{})]})},WE=({onClick:e,onClose:t})=>kr(Wp,{children:[me(_,{onClose:t},"header"),me(Ie,{children:me(Ke,{status:"success",children:me(kE,{})})}),me(de,{children:"Passkey verification added"}),me(ue,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),me(Tt,{children:me(F,{onClick:e,children:"Done"})}),me(Z,{})]}),LE=Ac.div`
|
|
2213
2222
|
&& {
|
|
2214
2223
|
padding: 0.75rem 1rem;
|
|
2215
2224
|
text-align: left;
|
|
@@ -2217,19 +2226,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2217
2226
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2218
2227
|
width: 100%;
|
|
2219
2228
|
}
|
|
2220
|
-
`,
|
|
2229
|
+
`,OE=Ac.div`
|
|
2221
2230
|
font-size: 0.875rem;
|
|
2222
2231
|
line-height: 1.375rem;
|
|
2223
2232
|
font-weight: 500;
|
|
2224
2233
|
|
|
2225
2234
|
color: var(--privy-color-foreground-1);
|
|
2226
|
-
`,
|
|
2235
|
+
`,NE=Ac.div`
|
|
2227
2236
|
font-size: 0.75rem;
|
|
2228
2237
|
font-weight: 400;
|
|
2229
2238
|
line-height: 1.125rem;
|
|
2230
2239
|
|
|
2231
2240
|
color: var(--privy-color-foreground-2);
|
|
2232
|
-
`,
|
|
2241
|
+
`,DE=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",M1=Ac.button`
|
|
2233
2242
|
&& {
|
|
2234
2243
|
width: 100%;
|
|
2235
2244
|
font-size: 0.875rem;
|
|
@@ -2254,7 +2263,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2254
2263
|
box-shadow: none;
|
|
2255
2264
|
}
|
|
2256
2265
|
}
|
|
2257
|
-
`;import
|
|
2266
|
+
`;import $E from"@heroicons/react/24/solid/CheckCircleIcon";import O1 from"@heroicons/react/24/solid/PhoneIcon";import{useState as kc}from"react";import{useState as Lp}from"react";import{isMobile as UE}from"react-device-detect";import L1 from"styled-components";import{Fragment as zE,jsx as qa,jsxs as qE}from"react/jsx-runtime";var za=6,FE=new Array(za).fill("");function BE(e){return e.replace(/\s+/g,"")}function Op(e){return/^[0-9]{1}$/.test(e)}function W1(e){return e.length===za&&e.every(Op)}function HE(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Gn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Lp(FE),[a,l]=Lp(null),[s,c]=Lp(null),m=async w=>{w.preventDefault();let y=BE(w.currentTarget.value);if(y==="")return;let b=HE(n,Op),P=y.split(""),A=!P.every(Op),T=P.length+b>za;if(A){l("Passcode can only be numbers"),c(1);return}if(T){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let x=Number(w.currentTarget.name?.charAt(4)),R=[...y||[""]].slice(0,za-x),M=[...n.slice(0,x),...R,...n.slice(x+R.length)];i(M);let D=R.length,B=Math.min(Math.max(x+D,0),za-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),W1(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=w=>{s===1&&(l(null),c(null));let y=[...n.slice(0,w),"",...n.slice(w+1)];i(y),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),W1(y)?e(y.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return qa(zE,{children:qE(VE,{children:[qa("div",{children:n.map((w,y)=>qa("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:b=>{b.key==="Backspace"&&f(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:g,autoComplete:UE?"one-time-code":"off",disabled:t},y))}),qa("div",{children:qa(GE,{fail:!!r||!!a,children:r||a})})]})})},VE=L1.div`
|
|
2258
2267
|
display: flex;
|
|
2259
2268
|
flex-direction: column;
|
|
2260
2269
|
width: 100%;
|
|
@@ -2322,7 +2331,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2322
2331
|
transform: translate(1px, 0px);
|
|
2323
2332
|
}
|
|
2324
2333
|
}
|
|
2325
|
-
`,
|
|
2334
|
+
`,GE=L1.div`
|
|
2326
2335
|
line-height: 20px;
|
|
2327
2336
|
font-size: 13px;
|
|
2328
2337
|
display: flex;
|
|
@@ -2330,7 +2339,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2330
2339
|
width: 100%;
|
|
2331
2340
|
|
|
2332
2341
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
2333
|
-
`;import{Fragment as
|
|
2342
|
+
`;import{Fragment as Np,jsx as Ue,jsxs as qn}from"react/jsx-runtime";var N1=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=kc(""),[i,a]=kc(!1),[l,s]=kc(null),[c,m]=kc("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:u}=qr(),{app:g,data:w}=S();function y(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:T}){try{await f({phoneNumber:T}),n(T),m("verify")}catch(x){s(x)}}async function P(T){try{if(!T)return;await u({phoneNumber:o,mfaCode:T}),a(!0)}catch(x){throw xl(x)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Ln(x)?new Error("The code you entered is not valid"):Wn(x)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Al(x)?new Error("Verification canceled"):new Error("Unknown error")}}function A(){c==="verify"?m("enroll"):t()}return l?Ue(Nn,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?qn(Np,{children:[Ue(_,{backFn:t,onClose:r},"header"),Ue(Ie,{children:Ue(Ke,{children:Ue(O1,{})})}),Ue(de,{children:"Set up SMS verification"}),Ue(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),qn(Tr,{children:[Ue(qi,{onSubmit:b}),qn(ih,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),Ue(Z,{})]}):i?qn(Np,{children:[Ue(_,{onClose:y},"header"),Ue(Ie,{children:Ue(Ke,{status:"success",children:Ue($E,{})})}),Ue(de,{children:"SMS verification added"}),Ue(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),Ue(Tt,{children:Ue(F,{onClick:y,children:"Done"})}),Ue(Z,{})]}):qn(Np,{children:[Ue(_,{backFn:A,onClose:r},"header"),Ue(Ie,{children:Ue(Ke,{children:Ue(O1,{})})}),Ue(de,{children:"Enter enrollment code"}),qn(Tr,{children:[Ue(Gn,{onChange:P}),qn(ue,{children:["To continue, enter the 6-digit code sent to ",Ue("strong",{children:t1(o)})]})]}),Ue(Z,{})]})};import YE from"@heroicons/react/24/solid/CheckCircleIcon";import ZE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as U1}from"react";import KE from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as jE}from"react/jsx-runtime";var D1=({size:e,authUrl:t})=>jE(Yo,{url:t,squareLogoElement:KE,size:e,fgColor:"#1F1F1F"});import{Fragment as Dp,jsx as Le,jsxs as $a}from"react/jsx-runtime";var F1=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=U1("enroll"),[a,l]=U1(!1),{submitEnrollmentWithTotp:s}=qr(),{data:c}=S();function m(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function u(w){try{if(!w)return;await s({mfaCode:w}),l(!0)}catch(y){throw xl(y)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Ln(y)?new Error("The code you entered is not valid"):Wn(y)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Al(y)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?$a(Dp,{children:[Le(_,{backFn:r,onClose:t},"header"),Le(de,{children:"Scan QR code"}),Le(ue,{children:"Open your authenticator app and scan the QR code to continue."}),Le(wi,{children:Le(D1,{authUrl:o.authUrl,size:200})}),$a(Tt,{children:[Le(wt,{children:Le(jo,{itemName:"secret",text:o.secret})}),Le(F,{onClick:f,children:"Continue"})]}),Le(Z,{})]}):a?$a(Dp,{children:[Le(_,{onClose:m},"header"),Le(Ie,{children:Le(Ke,{status:"success",children:Le(YE,{})})}),Le(de,{children:"Authenticator app verification added"}),Le(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Le(Tt,{children:Le(F,{onClick:m,children:"Done"})}),Le(Z,{})]}):$a(Dp,{children:[Le(_,{backFn:g,onClose:t},"header"),Le(Ie,{children:Le(Ke,{children:Le(ZE,{})})}),Le(de,{children:"Enter enrollment code"}),Le(Tr,{children:Le(Gn,{onChange:u})}),$a(ue,{children:["To continue, enter the 6-digit code generated from your ",Le("strong",{children:"authenticator app"})]}),Le(Z,{})]})};import{Fragment as Ki,jsx as Q,jsxs as yr}from"react/jsx-runtime";var H1=()=>{let{user:e,enrollInMfa:t}=q(),[r,o]=$i(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=qr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:m}=S(),{closePrivyModal:f}=I(),{promptMfa:u}=Va(),{initEnrollmentWithTotp:g}=qr(),[w,y]=$i(!1),[b,P]=$i(null),[A,T]=$i(null),x=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),P(null)},500)},{initEnrollmentWithPasskey:R,submitEnrollmentWithPasskey:M}=qr(),[D,B]=$i(!1),[K,j]=$i(null);m.current=x;let L=e?.mfaMethods.includes("sms"),N=!!e?.phone,W=e?.mfaMethods.includes("totp"),ve=e?.mfaMethods.includes("passkey"),Me=L||W||ve,Y=e?.linkedAccounts.filter(ae=>ae.type==="passkey").map(ae=>ae.credentialId)??[];r8(()=>{Me&&y(!0)},[Me]);function te(){o(null),P(null)}function ee(){y(!1)}async function _e(){B(!0);try{await R(),await M({credentialIds:Y})}catch(ae){j(ae)}finally{B(!1)}}async function Te(ae){if(await u().catch(j),ae==="totp"){P(ae),T(null),g().then(Ft=>{T(Ft)}).catch(()=>{T(null),te()});return}if(ae==="passkey"&&Y.length===1)return await _e();P(ae)}if(!s||!e||!l)return yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(k1,{})}),Q(Tr,{children:Q(mt,{})}),Q(Z,{})]});async function ze(){o(null);try{await n()}catch{o(null)}}async function Ve(){o(null);try{await i()}catch{o(null)}}async function pt(){o(null);try{await u(),await a()}catch{o(null)}}if(r==="sms")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(e8,{})})}),Q(de,{children:"Remove SMS verification?"}),yr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),Q(Tt,{children:Q(F,{warn:!0,onClick:ze,children:"Remove SMS for MFA"})}),Q(Z,{})]});if(r==="totp")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(JE,{})})}),Q(de,{children:"Remove Authenticator App verification?"}),yr(ue,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),Q(Tt,{children:Q(F,{warn:!0,onClick:Ve,children:"Remove Authenticator App for MFA"})}),Q(Z,{})]});if(r==="passkey")return yr(Ki,{children:[Q(_,{backFn:te,onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(t8,{})})}),Q(de,{children:"Are you sure you want to remove passkey verification?"}),Q(ue,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),Q(Tt,{children:Q(F,{warn:!0,onClick:pt,children:"Yes, remove"})}),Q(Z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!Me)return yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(B1,{})})}),Q(de,{children:"Add more security"}),yr(ue,{children:[l?.name," does not have any verification methods enabled."]}),Q(Tt,{children:Q(F,{onClick:x,children:"Close"})}),Q(Z,{})]});let Fe=!Me&&!w;return Fe?yr(Ki,{children:[Q(_,{onClose:x},"header"),Q(Ie,{children:Q(Ke,{children:Q(B1,{})})}),Q(de,{children:"Transaction Protection"}),Q(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),yr(xn,{children:[yr(Zt,{children:[Q(Yt,{children:Q(QE,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),yr(Zt,{children:[Q(Yt,{children:Q(XE,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),yr(Tt,{children:[Q(F,{onClick:()=>y(!0),children:"Continue"}),Q(Nr,{onClick:x,children:"Not now"})]}),Q(Z,{})]}):b==="sms"?Q(N1,{onComplete:x,onReset:te,onClose:x}):b==="totp"&&A?Q(F1,{onComplete:x,onClose:x,onReset:te,totpInfo:A}):b==="passkey"?Q(I1,{onComplete:x,onReset:te,onClose:x}):Q(R1,{showIntro:Fe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:N,onBackToIntro:ee,handleSelectMethod:Te,isTotpLoading:b==="totp"&&!A,isPasskeyLoading:D,error:K,onClose:x,setRemovingMfaMethod:o})};import O8 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import N8 from"@heroicons/react/24/outline/FingerPrintIcon";import D8 from"@heroicons/react/24/outline/PhoneIcon";import U8 from"@heroicons/react/24/outline/ShieldCheckIcon";import F8 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import B8 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as H8,useState as Ya}from"react";import{useMemo as P8,useEffect as x8,useState as c2}from"react";import A8 from"styled-components";import{calculateTotalGasEstimate as k8,populateTransactionRequest as R8}from"@privy-io/js-sdk-core";import s2 from"styled-components";import G1 from"styled-components";import{jsx as V1,jsxs as i8}from"react/jsx-runtime";var Rc=({label:e,children:t,valueStyles:r})=>i8(o8,{children:[V1("div",{children:e}),V1(n8,{style:{...r},children:t})]}),o8=G1.div`
|
|
2334
2343
|
display: flex;
|
|
2335
2344
|
align-items: center;
|
|
2336
2345
|
justify-content: space-between;
|
|
@@ -2345,7 +2354,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2345
2354
|
color: var(--privy-color-foreground-2);
|
|
2346
2355
|
text-align: right;
|
|
2347
2356
|
}
|
|
2348
|
-
`,
|
|
2357
|
+
`,n8=G1.div`
|
|
2349
2358
|
font-size: 14px;
|
|
2350
2359
|
line-height: 100%;
|
|
2351
2360
|
display: flex;
|
|
@@ -2354,28 +2363,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2354
2363
|
border-radius: var(--privy-border-radius-full);
|
|
2355
2364
|
background-color: var(--privy-color-background-2);
|
|
2356
2365
|
padding: 4px 8px;
|
|
2357
|
-
`;import
|
|
2366
|
+
`;import Ic from"styled-components";import{Fragment as c8,jsx as Mc,jsxs as q1}from"react/jsx-runtime";var z1=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ia(e),n=t?po(o,t):void 0,i=fr(o,r);return Mc($1,{children:n||i})},Up=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Ia(e),n=t?po(o,t):void 0,i=fr(o,r);return Mc($1,{children:n?q1(c8,{children:[Mc(a8,{children:"USD"}),n==="<$0.01"?q1(l8,{children:[Mc(s8,{children:"<"}),"$0.01"]}):n]}):i})},$1=Ic.span`
|
|
2358
2367
|
font-size: 14px;
|
|
2359
2368
|
line-height: 140%;
|
|
2360
2369
|
display: flex;
|
|
2361
2370
|
gap: 4px;
|
|
2362
2371
|
align-items: center;
|
|
2363
|
-
`,
|
|
2372
|
+
`,a8=Ic.span`
|
|
2364
2373
|
font-size: 12px;
|
|
2365
2374
|
line-height: 12px;
|
|
2366
2375
|
color: var(--privy-color-foreground-3);
|
|
2367
|
-
`,
|
|
2376
|
+
`,s8=Ic.span`
|
|
2368
2377
|
font-size: 10px;
|
|
2369
|
-
`,
|
|
2378
|
+
`,l8=Ic.span`
|
|
2370
2379
|
display: flex;
|
|
2371
2380
|
align-items: center;
|
|
2372
|
-
`;import
|
|
2381
|
+
`;import Fp from"styled-components";import{QuantityToBigNumber as K1}from"@privy-io/js-sdk-core";import{jsx as nn,jsxs as Wc}from"react/jsx-runtime";var j1=({gas:e,tokenPrice:t,tokenSymbol:r})=>Wc(Fo,{style:{paddingBottom:"12px"},children:[Wc(Z1,{children:[nn(J1,{children:"Est. Fees"}),nn("div",{children:nn(Up,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&nn(Q1,{children:`${fr(e,r)}`})]}),Y1=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=K1(e.value||0).add(K1(t)).toHexString();return Wc(Fo,{children:[Wc(Z1,{children:[nn(J1,{children:"Total (including fees)"}),nn("div",{children:nn(Up,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&nn(Q1,{children:fr(n,o)})]})},Z1=Fp.div`
|
|
2373
2382
|
display: flex;
|
|
2374
2383
|
flex-direction: row;
|
|
2375
2384
|
justify-content: space-between;
|
|
2376
2385
|
align-items: center;
|
|
2377
2386
|
padding-top: 4px;
|
|
2378
|
-
`,
|
|
2387
|
+
`,Q1=Fp.div`
|
|
2379
2388
|
display: flex;
|
|
2380
2389
|
flex-direction: row;
|
|
2381
2390
|
height: 12px;
|
|
@@ -2384,23 +2393,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2384
2393
|
line-height: 12px;
|
|
2385
2394
|
color: var(--privy-color-foreground-3);
|
|
2386
2395
|
font-weight: 400;
|
|
2387
|
-
`,
|
|
2396
|
+
`,J1=Fp.div`
|
|
2388
2397
|
font-size: 14px;
|
|
2389
2398
|
line-height: 22.4px;
|
|
2390
2399
|
font-weight: 400;
|
|
2391
|
-
`;import
|
|
2400
|
+
`;import d8 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as zn,useState as p8}from"react";import an from"styled-components";import{createContext as X1,useContext as HQ}from"react";var ji=X1(void 0);var Ka=X1(void 0);import{Fragment as C8,jsx as zr,jsxs as e2}from"react/jsx-runtime";var t2=({defaultValue:e,children:t})=>{let[r,o]=p8(e||null),n=i=>{o(r===i?null:i)};return zr(ji.Provider,{value:{activePanel:r,togglePanel:n},children:zr(u8,{children:t})})},r2=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=zn(ji),n=r===e;return zr(Ka.Provider,{value:{onToggle:()=>o(e),value:e},children:zr(y8,{isActive:n,"data-open":n,children:t})})},o2=({children:e})=>{let{activePanel:t}=zn(ji),{onToggle:r,value:o}=zn(Ka),n=t===o;return e2(C8,{children:[e2(m8,{onClick:r,"data-open":n,children:[zr(h8,{children:e}),zr(v8,{isactive:n,children:zr(d8,{height:"16px",width:"16px",strokeWidth:"2"})})]}),zr(f8,{})]})},n2=({children:e})=>{let{activePanel:t}=zn(ji),{value:r}=zn(Ka);return zr(g8,{"data-open":t===r,children:zr(a2,{children:e})})},i2=({children:e})=>{let{activePanel:t}=zn(ji),{value:r}=zn(Ka);return zr(a2,{children:typeof e=="function"?e({isActive:t===r}):e})},u8=an.div`
|
|
2392
2401
|
display: flex;
|
|
2393
2402
|
flex-direction: column;
|
|
2394
2403
|
width: 100%;
|
|
2395
2404
|
gap: 8px;
|
|
2396
|
-
`,
|
|
2405
|
+
`,m8=an.div`
|
|
2397
2406
|
display: flex;
|
|
2398
2407
|
justify-content: space-between;
|
|
2399
2408
|
align-items: center;
|
|
2400
2409
|
width: 100%;
|
|
2401
2410
|
cursor: pointer;
|
|
2402
2411
|
padding-bottom: 8px;
|
|
2403
|
-
`,
|
|
2412
|
+
`,f8=an.div`
|
|
2404
2413
|
width: 100%;
|
|
2405
2414
|
|
|
2406
2415
|
&& {
|
|
@@ -2408,13 +2417,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2408
2417
|
border-color: var(--privy-color-foreground-4);
|
|
2409
2418
|
}
|
|
2410
2419
|
padding-bottom: 12px;
|
|
2411
|
-
`,
|
|
2420
|
+
`,h8=an.div`
|
|
2412
2421
|
font-size: 14px;
|
|
2413
2422
|
font-weight: 500;
|
|
2414
2423
|
line-height: 19.6px;
|
|
2415
2424
|
width: 100%;
|
|
2416
2425
|
padding-right: 8px;
|
|
2417
|
-
`,
|
|
2426
|
+
`,y8=an.div`
|
|
2418
2427
|
display: flex;
|
|
2419
2428
|
flex-direction: column;
|
|
2420
2429
|
width: 100%;
|
|
@@ -2426,7 +2435,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2426
2435
|
border-color: var(--privy-color-foreground-4);
|
|
2427
2436
|
border-radius: var(--privy-border-radius-md);
|
|
2428
2437
|
}
|
|
2429
|
-
`,
|
|
2438
|
+
`,g8=an.div`
|
|
2430
2439
|
position: relative;
|
|
2431
2440
|
overflow: hidden;
|
|
2432
2441
|
transition: max-height 25ms ease-out;
|
|
@@ -2438,125 +2447,36 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2438
2447
|
&[data-open='false'] {
|
|
2439
2448
|
max-height: 0;
|
|
2440
2449
|
}
|
|
2441
|
-
`,
|
|
2450
|
+
`,a2=an.div`
|
|
2442
2451
|
display: flex;
|
|
2443
2452
|
flex-direction: column;
|
|
2444
2453
|
gap: 12px;
|
|
2445
2454
|
flex: 1 1 auto;
|
|
2446
2455
|
min-height: 1px;
|
|
2447
|
-
`,
|
|
2456
|
+
`,v8=an.div`
|
|
2448
2457
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2449
|
-
`;import
|
|
2458
|
+
`;import w8 from"styled-components";import{jsx as E8}from"react/jsx-runtime";var Bp=({walletAddress:e,chainId:t=wo})=>E8(b8,{href:ug(t,e),target:"_blank",children:Qe(e)}),b8=w8.a`
|
|
2450
2459
|
&:hover {
|
|
2451
2460
|
text-decoration: underline;
|
|
2452
2461
|
}
|
|
2453
|
-
`;import{jsx as
|
|
2462
|
+
`;import{jsx as gr,jsxs as Hp}from"react/jsx-runtime";var Lc=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0,s=Ge();return gr(t2,{...s.render.standalone?{defaultValue:"details"}:{},children:Hp(r2,{value:"details",children:[gr(o2,{children:Hp(T8,{children:[gr("div",{children:o?.title||o?.actionDescription||"Details"}),gr(S8,{children:gr(z1,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Hp(n2,{children:[gr(Rc,{label:"From",children:gr(Bp,{walletAddress:e,chainId:r.chainId||wo})}),gr(Rc,{label:"To",children:gr(Bp,{walletAddress:t,chainId:r.chainId||wo})}),o&&o.action&&gr(Rc,{label:"Action",children:o.action}),i&&gr(j1,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),gr(i2,{children:({isActive:c})=>gr(Y1,{transactionData:r,displayFee:c,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},T8=s2.div`
|
|
2454
2463
|
display: flex;
|
|
2455
2464
|
flex-direction: row;
|
|
2456
2465
|
justify-content: space-between;
|
|
2457
|
-
`,
|
|
2466
|
+
`,S8=s2.div`
|
|
2458
2467
|
flex-shrink: 0;
|
|
2459
2468
|
padding-left: 8px;
|
|
2460
|
-
`;import
|
|
2469
|
+
`;import _8 from"styled-components";var l2=_8.img`
|
|
2461
2470
|
&& {
|
|
2462
2471
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2463
2472
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2464
2473
|
border-radius: 16px;
|
|
2465
2474
|
margin-bottom: 12px;
|
|
2466
2475
|
}
|
|
2467
|
-
`;import{jsx as
|
|
2468
|
-
display: flex;
|
|
2469
|
-
flex-direction: column;
|
|
2470
|
-
align-items: center;
|
|
2471
|
-
margin-bottom: 24px;
|
|
2472
|
-
`,I8=Vc.div`
|
|
2473
|
-
font-size: 12px;
|
|
2474
|
-
line-height: 12px;
|
|
2475
|
-
padding: 7px;
|
|
2476
|
-
padding-top: 0;
|
|
2477
|
-
margin-top: 8px;
|
|
2478
|
-
|
|
2479
|
-
&& a {
|
|
2480
|
-
font-weight: 400;
|
|
2481
|
-
color: var(--privy-color-foreground-3);
|
|
2482
|
-
|
|
2483
|
-
&:hover {
|
|
2484
|
-
text-decoration: underline;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
`,W8=Vc.div`
|
|
2488
|
-
margin-top: 8px;
|
|
2489
|
-
|
|
2490
|
-
font-size: 18px;
|
|
2491
|
-
line-height: 30px;
|
|
2492
|
-
font-weight: 500;
|
|
2493
|
-
overflow: hidden;
|
|
2494
|
-
white-space: nowrap;
|
|
2495
|
-
text-overflow: ellipsis;
|
|
2496
|
-
`,L8=Vc.div`
|
|
2497
|
-
margin-top: 12px;
|
|
2498
|
-
font-size: 14px;
|
|
2499
|
-
line-height: 22px;
|
|
2500
|
-
font-weight: 400;
|
|
2501
|
-
color: var(--privy-color-foreground-1);
|
|
2502
|
-
overflow: hidden;
|
|
2503
|
-
text-overflow: ellipsis;
|
|
2504
|
-
`;import N8 from"@heroicons/react/24/outline/WalletIcon";import Jp from"styled-components";import{jsx as E2,jsxs as Qp}from"react/jsx-runtime";var T2=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=I(),i=a(t.chainId)||"ETH";return Qp(D8,{children:[Qp(U8,{children:[E2(N8,{strokeWidth:"2",width:"16px",height:"16px"}),E2("div",{children:Ve(e)})]}),Qp(F8,{displayBalanceColor:n,hasFunds:o,children:[r?yr(r,i,6,!0):0," available"]})]})},D8=Jp.div`
|
|
2505
|
-
display: flex;
|
|
2506
|
-
flex-direction: row;
|
|
2507
|
-
justify-content: space-between;
|
|
2508
|
-
align-items: center;
|
|
2509
|
-
padding: 9px 12px;
|
|
2510
|
-
height: 40px;
|
|
2511
|
-
color: var(--privy-color-foreground-3);
|
|
2512
|
-
|
|
2513
|
-
&& {
|
|
2514
|
-
border: 1px solid var(--privy-color-foreground-4);
|
|
2515
|
-
border-radius: var(--privy-border-radius-md);
|
|
2516
|
-
}
|
|
2517
|
-
`,U8=Jp.div`
|
|
2518
|
-
display: flex;
|
|
2519
|
-
flex-direction: row;
|
|
2520
|
-
align-items: center;
|
|
2521
|
-
gap: 8px;
|
|
2522
|
-
`,F8=Jp.div`
|
|
2523
|
-
display: flex;
|
|
2524
|
-
align-items: center;
|
|
2525
|
-
justify-content: center;
|
|
2526
|
-
font-size: 12px;
|
|
2527
|
-
line-height: 100%;
|
|
2528
|
-
border-radius: 16px;
|
|
2529
|
-
background-color: var(--privy-color-background-2);
|
|
2530
|
-
padding: 5px 8px;
|
|
2531
|
-
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2532
|
-
`;import Gc from"styled-components";import{Fragment as P2,jsx as as,jsxs as _2}from"react/jsx-runtime";var x2=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?Jo(n,o):void 0,i=yr(n,r);return _2(B8,{children:[a?_2(P2,{children:[as(S2,{children:a}),as(H8,{children:i})]}):as(P2,{children:as(S2,{children:i})}),as(V8,{children:e})]})},B8=Gc.div`
|
|
2533
|
-
display: flex;
|
|
2534
|
-
flex-direction: column;
|
|
2535
|
-
align-items: center;
|
|
2536
|
-
margin-bottom: 20px;
|
|
2537
|
-
`,S2=Gc.h2`
|
|
2538
|
-
&& {
|
|
2539
|
-
font-size: 48px;
|
|
2540
|
-
line-height: 48px;
|
|
2541
|
-
margin: 8px auto;
|
|
2542
|
-
}
|
|
2543
|
-
`,H8=Gc.p`
|
|
2544
|
-
margin-bottom: 12px;
|
|
2545
|
-
&& {
|
|
2546
|
-
font-size: 17px;
|
|
2547
|
-
line-height: 17px;
|
|
2548
|
-
color: var(--privy-color-foreground-3);
|
|
2549
|
-
}
|
|
2550
|
-
`,V8=Gc.div`
|
|
2551
|
-
font-size: 16px;
|
|
2552
|
-
line-height: 22.4px;
|
|
2553
|
-
font-weight: 400;
|
|
2554
|
-
overflow: hidden;
|
|
2555
|
-
text-overflow: ellipsis;
|
|
2556
|
-
`;import{jsx as k2}from"react/jsx-runtime";var ss=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=qr(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=I(),[s,c]=A2(null),[u,h]=A2(e),{tokenPrice:m}=po(u),g=l(e.chainId)||"ETH",w=G8(()=>r.find(y=>y.walletClientType==="privy"),[r]);return q8(()=>{async function y(){if(!await t()||!o||!w)return u;let S=ar(u.chainId,a,n,{appId:i}),R=await K8(w.address,u,S),{totalGasEstimate:T}=await $8(R,S);return c(T.toHexString()),R}y().then(h).catch(console.error)},[o]),w?k2(j8,{children:k2(oa,{from:w.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:m,tokenSymbol:g})}):null},j8=z8.div`
|
|
2476
|
+
`;import{jsx as d2}from"react/jsx-runtime";var ja=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=Gr(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=I(),[s,c]=c2(null),[m,f]=c2(e),{tokenPrice:u}=co(m),g=l(e.chainId)||"ETH",w=P8(()=>r.find(y=>y.walletClientType==="privy"),[r]);return x8(()=>{async function y(){if(!await t()||!o||!w)return m;let P=rr(m.chainId,i,n,{appId:a}),A=await R8(w.address,m,P),{totalGasEstimate:T}=await k8(A,P);return c(T.toHexString()),A}y().then(f).catch(console.error)},[o]),w?d2(M8,{children:d2(Lc,{from:w.address,to:m.to,txn:m,gas:s??void 0,tokenPrice:u,tokenSymbol:g})}):null},M8=A8.div`
|
|
2557
2477
|
width: 100%;
|
|
2558
2478
|
padding: 1rem 0;
|
|
2559
|
-
`;import
|
|
2479
|
+
`;import I8 from"@heroicons/react/24/outline/CalendarIcon";import W8 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import L8 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as p2,jsx as At,jsxs as Yi}from"react/jsx-runtime";var u2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=I();return Yi(p2,{children:[At(_,{onClose:r},"header"),At(Je,{children:Yi("div",{children:[At(ot,{success:a,fail:!!t}),t?At(W8,{style:{width:"38px",height:"38px"}}):At(Dn,{style:{width:"38px",height:"38px"}})]})}),At(de,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Yi(xn,{children:[Yi(Zt,{children:[At(Yt,{children:At(L8,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Yi(Zt,{children:[At(Yt,{children:At(I8,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&At(Tr,{children:At(ja,{pendingTransaction:l})}),t&&Yi(p2,{children:[At(ml,{style:{marginTop:"1.25rem"},children:t.message}),At(F,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&At(va,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),At(Z,{})]})};import{Fragment as Vp,jsx as ge,jsxs as $r}from"react/jsx-runtime";var Gp=({open:e,onClose:t})=>{let{user:r}=q(),[o,n]=Ya(null),{init:i,cancel:a,submit:l}=Va(),[s,c]=Ya(!1),[m,f]=Ya(!1),[u,g]=Ya(null),[w,y]=Ya(null);H8(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?A(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let b=R=>Yd(R)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Ln(R)?(c(!1),new Error("The code you entered is not valid")):Wn(R)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(R),c(!1),new Error("Something went wrong."));async function P(R){y(null);try{if(!R||!o)return;await l(o,R),f(!0),c(!1),t()}catch(M){throw b(M)}}async function A(R){if(R==="passkey"){try{n(R);let M=await i(R);if(!M)throw new Error("something went wrong");g(M),await l(R,M),f(!0),c(!1),t()}catch(M){y(b(M))}return}try{n(R),await i(R)}catch(M){console.error(M)}}let T=()=>{n(null),y(null),a(),t()},x=()=>{n(null),y(null)};if(!e||!r)return null;if(o==="passkey"){let R=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,D)=>D.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return ge(u2,{account:R,selectedMethod:o,submitSuccess:m,hasBlockingError:s,error:w,onClose:T,onBack:x,handleSubmit:()=>P(u).catch(y)})}return o?ge(V8,{submitSuccess:m,hasBlockingError:s,handleSubmitCode:P,selectedMethod:o,onClose:T,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):$r(Vp,{children:[ge(_,{onClose:T},"header"),ge(Ie,{children:ge(Ke,{children:ge(U8,{})})}),ge(de,{children:"Verify your identity"}),ge(ue,{children:"Choose a verification method"}),$r(ll,{children:[r.mfaMethods.includes("totp")&&$r(Ee,{onClick:()=>A("totp"),children:[ge(O8,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&$r(Ee,{onClick:()=>A("sms"),children:[ge(D8,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&$r(Ee,{onClick:()=>A("passkey"),children:[ge(N8,{}),"Passkey"]},"passkey")]}),ge(Z,{})]})},V8=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=S(),{pendingTransaction:l}=I();switch(e){case"sms":return $r(Vp,{children:[ge(_,{onClose:o},"header"),ge(Ie,{children:ge(Ke,{children:ge(B8,{})})}),ge(de,{children:"Enter verification code"}),$r(Tr,{children:[ge(Gn,{success:t,disabled:r,onChange:i}),$r(ue,{children:["To continue, please enter the 6-digit code sent to your ",ge("strong",{children:"mobile device"})]}),l&&ge(ja,{pendingTransaction:l})]}),n&&ge(va,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Nr,{onClick:o,children:"Not now"}),ge(Z,{})]});case"totp":return $r(Vp,{children:[ge(_,{onClose:o},"header"),ge(Ie,{children:ge(Ke,{children:ge(F8,{})})}),ge(de,{children:"Enter verification code"}),$r(Tr,{children:[ge(Gn,{success:t,disabled:r,onChange:i}),$r(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",ge("strong",{children:"authenticator app"})]}),l&&ge(ja,{pendingTransaction:l})]}),n&&ge(va,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),ge(Nr,{onClick:o,children:"Not now"}),ge(Z,{})]});default:return null}};import{useEffect as m2,useState as f2}from"react";import G8 from"styled-components";import{Fragment as z8,jsx as ho,jsxs as Oc}from"react/jsx-runtime";var h2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:m,updateWallets:f,setReadyToTrue:u,closePrivyModal:g,createAnalyticsEvent:w}=I(),[y,b]=f2(!1),[P,A]=f2(void 0),T=s()?.provider||"google",{name:x,component:R}=la(T),M=fi(),D=Ne;m2(()=>{m(T).then(j=>{b(!0),u(!0),j&&M("login","onOAuthLoginComplete",j)}).catch(j=>{if(u(!1),j?.privyErrorCode==="allowlist_rejected"){A(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new wr(j).toString()),A(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(j?.privyErrorCode==="user_does_not_exist"){A(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:L,detail:N}=Lm(j,T);A({retryable:L,detail:N,message:"Authentication failed"})}).finally(()=>{vn()})},[x,T]),m2(()=>{if(r&&e&&y&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let L=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},D);return()=>clearTimeout(L)}if(Gt(o,n?.embeddedWallets?.createOnLogin)){let L=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:N=>{console.error(N),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:N,provider:T,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(L)}else{let L=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),D);return f(),()=>clearTimeout(L)}}},[r,e,y,o]);let B=y?`Successfully connected with ${x}`:P?P.message:`Verifying connection to ${x}`,K="";return y?K="You\u2019re good to go!":P?K=P.detail:K="Just a few moments more",Oc(z8,{children:[ho(_,{}),ho(oe,{}),Oc(q8,{children:[ho(Je,{children:Oc("div",{children:[ho(ot,{success:y,fail:!!P}),ho(R,{style:{width:"38px",height:"38px"}})]})}),Oc(Xe,{children:[ho("h3",{children:B}),ho("p",{children:K})]}),P&&P?.retryable?ho(hi,{onClick:()=>{vn(),c(T),A(void 0)},disabled:!y&&!P?.retryable,children:"Retry"}):null]}),ho(ne,{}),ho(Z,{})]})},q8=G8.div`
|
|
2560
2480
|
display: flex;
|
|
2561
2481
|
flex-direction: column;
|
|
2562
2482
|
align-items: center;
|
|
@@ -2564,17 +2484,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2564
2484
|
margin-left: 27px;
|
|
2565
2485
|
margin-right: 27px;
|
|
2566
2486
|
gap: 24px;
|
|
2567
|
-
`;import{useEffect as
|
|
2568
|
-
You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(s instanceof
|
|
2487
|
+
`;import{useEffect as qp,useRef as $8,useState as y2}from"react";import g2 from"styled-components";import{Fragment as j8,jsx as ko,jsxs as Nc}from"react/jsx-runtime";var v2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=S(),{loginWithPasskey:o,closePrivyModal:n}=I(),i=Ne,[a,l]=y2("loading"),[s,c]=y2(null),m=$8([]),f=b=>{m.current=[b,...m.current]};qp(()=>()=>{m.current.forEach(b=>clearTimeout(b)),m.current=[]},[]);let u=()=>{switch(a){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(a){case"loading":return`Please follow prompts to verify your passkey.
|
|
2488
|
+
You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(s instanceof et){if(s.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(s.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
|
|
2569
2489
|
You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
|
|
2570
|
-
You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(
|
|
2490
|
+
You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(a){case"loading":case"success":return ko(F,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return ko(F,{onClick:y,disabled:!1,children:"Retry"})}},y=async()=>{l("loading");try{await o(),l("success")}catch(b){c(b),l("error")}};return qp(()=>{a==="success"&&f(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[a]),qp(()=>{y()},[]),Nc(j8,{children:[ko(_,{backFn:!e||t===e?void 0:r}),Nc(K8,{children:[ko(Je,{children:Nc("div",{children:[ko(ot,{success:a==="success",fail:a==="error"}),ko(Un,{style:{width:"38px",height:"38px"}})]})}),Nc(Xe,{children:[ko("h3",{children:u()}),ko("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),w()]}),ko(Z,{})]})},K8=g2.div`
|
|
2571
2491
|
display: flex;
|
|
2572
2492
|
flex-direction: column;
|
|
2573
2493
|
align-items: center;
|
|
2574
2494
|
justify-content: center;
|
|
2575
2495
|
gap: 24px;
|
|
2576
2496
|
width: 100%;
|
|
2577
|
-
`,
|
|
2497
|
+
`,UX=g2.div`
|
|
2578
2498
|
display: flex;
|
|
2579
2499
|
align-items: center;
|
|
2580
2500
|
justify-content: center;
|
|
@@ -2590,9 +2510,9 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2590
2510
|
stroke: var(--privy-color-accent) !important;
|
|
2591
2511
|
fill: var(--privy-color-accent) !important;
|
|
2592
2512
|
}
|
|
2593
|
-
`;import{useEffect as
|
|
2513
|
+
`;import{useEffect as Z8,useState as w2}from"react";import Q8 from"styled-components";import{isMobile as Y8}from"react-device-detect";var C2=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!Lo()&&Y8)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as X8,jsx as Ro,jsxs as b2}from"react/jsx-runtime";var E2=()=>{let{forkSession:e,ready:t,authenticated:r}=q(),[o,n]=w2(""),[i,a]=w2(!1);Z8(()=>{t&&r&&e().then(n)},[t,r]);let l=C2(o,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),b2(X8,{children:[Ro(_,{},"header"),Ro(oe,{}),Ro(no,{title:s.title,description:s.description}),b2(Sr,{children:[Ro(J8,{children:Ro(Xr,{style:{width:"72px",height:"72px"}})}),Ro(nl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Ro("p",{children:s.footnote}):null]}),Ro(ne,{}),Ro($,{})]})},J8=Q8(wt)`
|
|
2594
2514
|
margin: 16px auto;
|
|
2595
|
-
`;import
|
|
2515
|
+
`;import eT from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as tT,useState as Dc}from"react";import Uc,{css as rT}from"styled-components";import{Fragment as sT,jsx as Ut,jsxs as $n}from"react/jsx-runtime";var T2=()=>{let[e,t]=Dc(!0),{authenticated:r,getAccessToken:o}=q(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=I(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),[m,f]=Dc(void 0),[u,g]=Dc(""),[w,y]=Dc(!1),{privyWallet:b,onCompleteNavigateTo:P,onSuccess:A,onFailure:T}=s.recoverWallet,x=(D="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),T(typeof D=="string"?new Mt(D):D)};c.current=x,tT(()=>{if(!r||!b)return x("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=D=>{D&&f(D)};return $n(sT,{children:[Ut(_,{onClose:x}),Ut(oe,{}),$n(nT,{children:[$n(oT,{children:[Ut(eT,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Ut("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),$n("div",{children:[$n($o,{children:[Ut(Li,{type:e?"password":"text",onChange:D=>R(D.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),Ut(Oi,{style:{right:"0.75rem"},children:e?Ut(Ni,{onClick:()=>t(!1)}):Ut(Di,{onClick:()=>t(!0)})})]}),!!u&&Ut(iT,{children:u})]}),$n("div",{children:[$n(uh,{children:[Ut("h4",{children:"Why is this necessary?"}),Ut("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ut(aT,{loading:w||!n,disabled:!m,onClick:async()=>{y(!0);let D=await o();if(D&&b&&m!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:b.address}}),await n?.recover({address:b.address,accessToken:D,recoveryPin:m,recoveryMethod:b.recoveryMethod}),g(""),P?l(P):i({shouldCallAuthOnSuccess:!1}),A?.(b),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}})}catch(B){oy(B)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{y(!1)}else return x("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&w,children:"Recover your account"})]})]}),Ut(ne,{}),Ut($,{})]})},oT=Uc.div`
|
|
2596
2516
|
display: flex;
|
|
2597
2517
|
flex-direction: column;
|
|
2598
2518
|
align-items: center;
|
|
@@ -2614,45 +2534,63 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2614
2534
|
font-weight: 400;
|
|
2615
2535
|
line-height: 20px;
|
|
2616
2536
|
}
|
|
2617
|
-
`,
|
|
2537
|
+
`,nT=Uc.div`
|
|
2618
2538
|
display: flex;
|
|
2619
2539
|
flex-direction: column;
|
|
2620
2540
|
justify-content: space-between;
|
|
2621
|
-
`,
|
|
2541
|
+
`,iT=Uc.div`
|
|
2622
2542
|
line-height: 20px;
|
|
2623
2543
|
height: 20px;
|
|
2624
2544
|
font-size: 13px;
|
|
2625
2545
|
color: var(--privy-color-error);
|
|
2626
2546
|
text-align: left;
|
|
2627
2547
|
margin-top: 0.5rem;
|
|
2628
|
-
`,
|
|
2629
|
-
${e=>e.hideAnimations&&
|
|
2548
|
+
`,aT=Uc(F)`
|
|
2549
|
+
${e=>e.hideAnimations&&rT`
|
|
2630
2550
|
&& {
|
|
2631
2551
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
2632
2552
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
2633
2553
|
transition: none;
|
|
2634
2554
|
}
|
|
2635
2555
|
`}
|
|
2636
|
-
`;import{useCallback as
|
|
2556
|
+
`;import{useCallback as lT,useEffect as A2,useState as zp}from"react";import{jsx as Fc,jsxs as S2}from"react/jsx-runtime";var Bc=e=>S2("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[Fc("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),Fc("defs",{children:S2("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[Fc("stop",{stopColor:"#3E82F4"}),Fc("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as Mo,jsxs as _2}from"react/jsx-runtime";var Hc=({style:e,...t})=>_2("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[_2("g",{clipPath:"url(#clip0_2115_829)",children:[Mo("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Mo("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Mo("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Mo("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Mo("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Mo("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Mo("defs",{children:Mo("clipPath",{id:"clip0_2115_829",children:Mo("rect",{width:"16",height:"14",fill:"white"})})})]});import P2 from"styled-components";var Za=P2.div`
|
|
2637
2557
|
display: flex;
|
|
2638
2558
|
flex-direction: column;
|
|
2639
2559
|
gap: 12px;
|
|
2640
2560
|
padding-top: 24px;
|
|
2641
2561
|
padding-bottom: 24px;
|
|
2642
|
-
|
|
2562
|
+
`,x2=P2.div`
|
|
2643
2563
|
padding-bottom: 24px;
|
|
2644
|
-
`;import{Fragment as
|
|
2564
|
+
`;import{Fragment as R2,jsx as sn,jsxs as Vc}from"react/jsx-runtime";var k2={"google-drive":{name:"Google Drive",component:Hc},icloud:{name:"iCloud",component:Bc}},M2=()=>{let{logout:e}=q(),{navigate:t,setModalData:r,data:o}=S(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=I(),[l,s]=zp(!1),{provider:c,action:m,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[u,g]=zp(void 0),[w,y]=zp(m==="create-wallet");if(c==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let b=k2[c].name,P=k2[c].component,A=o?.recoverWallet?.onCompleteNavigateTo,T=new Oe(async(j="create-wallet")=>(y(!0),new Promise((L,N)=>{setTimeout(async()=>{try{let W=window.open();await n(c,j,W),s(!0),L()}catch{g({message:`${j==="recover"?"Recovery":"Back up"} with ${b} unsuccessful`,detail:m==="recover"?`Please verify that you are selecting the ${b} account associated with your backup.`:"",retryable:!0}),N()}},0)})));A2(()=>{m!=="recover"&&T.execute(f?"create-wallet":"set-recovery")},[]),A2(()=>{if(!l)return;let j=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:L=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:L,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},Ne);return()=>clearTimeout(j)},[l]);let x=lT(async()=>{await T.execute("recover"),A?t(A):s(!0)},[]),R=c==="google-drive"?"Google Drive":"Apple iCloud",M=m==="recover"?"recovered":"backed up",D=m==="recover"?"Recovering":"Backing up",B=l&&`Successfully ${M} with ${R}.`||u&&u.message||`${D} with ${R}...`,K=u?u.detail:"";return Vc(R2,{children:[sn(_,{}),w?sn(R2,{children:Vc(Za,{children:[sn(ye,{title:B,icon:sn(P,{style:{width:"38px",height:"38px"}}),description:K}),u&&u?.retryable?sn(F,{onClick:()=>{vn(),g(void 0),m==="create-wallet"?T.execute("create-wallet"):x()},disabled:!l&&!u?.retryable,children:"Try again"}):null]})}):Vc(Za,{children:[sn(ye,{title:"Confirm it's really you",icon:sn(P,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${R} where your account is backed up.`}),Vc(F,{onClick:x,children:["Confirm with ",R]})]}),sn($,{})]})};import{useEffect as I2,useState as Qa}from"react";import{jsx as cT}from"react/jsx-runtime";var W2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=S(),[n,i]=Qa(""),[a,l]=Qa(!1),[s,c]=Qa(),[m,f]=Qa(null),{authenticated:u}=q(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:y}=I(),{onSuccess:b,onFailure:P,callAuthOnSuccessOnClose:A}=r.createWallet,{createWallet:T}=Ml(),[x,R]=Qa(null),M=new Oe(async()=>{try{let K=await T(s);if(!K)return;R(K),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(b(K),g({shouldCallAuthOnSuccess:A}))}catch(K){i(K.message)}});I2(()=>{m||y(3e4).then(K=>f(K))},[m]),I2(()=>{if(!u){t("LANDING"),P(new Error("User must be authenticated before creating a Privy wallet"));return}},[u]);let D=()=>{x&&x?.recoveryMethod!=="user-passcode"?(P(new Mt("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):x?(b(x),g({shouldCallAuthOnSuccess:A})):(P(new Mt("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let B=async()=>{l(!0);let K=250;return M.execute().then(()=>new Promise(j=>setTimeout(j,K))).finally(()=>l(!1))};return cT(Ol,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!m,buttonLoading:a,buttonHideAnimations:!x&&a,isResettingPassword:!1,error:n,password:s||"",onClose:D,onPasswordChange:c,onPasswordGenerate:()=>c(Ll()),onSubmit:B})};import dT from"@heroicons/react/24/outline/LockClosedIcon";import pT from"@heroicons/react/24/outline/PencilSquareIcon";import uT from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as mT}from"react";import fT from"styled-components";import{Fragment as Kp,jsx as yt,jsxs as ln}from"react/jsx-runtime";var $p=fT.div`
|
|
2645
2565
|
width: 24px;
|
|
2646
2566
|
height: 24px;
|
|
2647
2567
|
display: flex;
|
|
2648
2568
|
justify-content: center;
|
|
2649
2569
|
align-items: center;
|
|
2650
|
-
`,
|
|
2570
|
+
`,hT={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},yT=({onClose:e})=>ln(x2,{children:[yt(ye,{title:"Why do I need to secure my account?",icon:yt(uT,{width:48}),description:ln(Kp,{children:[yt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),yt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),yt(F,{onClick:e,children:"Select backup method"})]}),L2=()=>{let[e,t]=mT(!1),{navigate:r,setModalData:o,data:n}=S(),{user:i}=q(),{embeddedWallets:a}=Ge(),l=he(i),s=l===null,{isInAccountCreateFlow:c,isResettingPassword:m}=n.recoverySelection,f=l?.recoveryMethod!=="privy",u=f?"Update backup method":"Secure your account",g=f?ln("span",{children:["Your account is currently secured using"," ",yt("strong",{children:hT[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function w(y){o({recoveryOAuthStatus:{provider:y,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:c}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return ln(Kp,{children:[yt(_,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?yt(yT,{onClose:()=>t(!1)}):ln(Kp,{children:[yt(ye,{title:u,icon:yt(dT,{width:48}),description:g}),yt(Za,{children:a.userOwnedRecoveryOptions.filter(y=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?y!==l?.recoveryMethod:!0).sort().map(y=>{switch(y){case"google-drive":return ln(Ee,{onClick:()=>w("google-drive"),children:[yt($p,{children:yt(Hc,{style:{width:18}})}),"Back up to Google Drive"]},y);case"icloud":return ln(Ee,{onClick:()=>w("icloud"),children:[yt($p,{children:yt(Bc,{style:{width:24}})}),"Back up to Apple iCloud"]},y);case"user-passcode":return ln(Ee,{onClick:()=>{let b=Zd({isCreatingWallet:s,skipSplashScreen:!0});r(b)},children:[yt($p,{children:yt(pT,{style:{width:18}})}),m?"Reset your":"Set a"," password"]},y);default:return null}})})]}),yt($,{})]})};import{getAddress as Y2}from"@ethersproject/address";import{useEffect as a9,useMemo as $c,useState as Ja}from"react";import{ProviderErrors as J2,QuantityToBigNumber as Z2}from"@privy-io/js-sdk-core";var gT={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"MOONPAY_PROMPT_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Gc({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?gT[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import O2 from"styled-components";import vT from"styled-components";var qc=vT.span`
|
|
2571
|
+
color: var(--privy-color-foreground);
|
|
2572
|
+
font-size: 1.125rem;
|
|
2573
|
+
font-weight: 600;
|
|
2574
|
+
line-height: 1.875rem; /* 166.667% */
|
|
2575
|
+
text-align: center;
|
|
2576
|
+
`;import{Fragment as TT,jsx as He,jsxs as yo}from"react/jsx-runtime";var N2=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:i,title:a,subtitle:l,total:s,to:c,network:m,hasFunds:f,fee:u,from:g,cta:w,chain:y,isSubmitting:b,isPreparing:P,isTokenPriceLoading:A,isTokenContractInfoLoading:T,symbol:x,balance:R,onClick:M,spender:D})=>yo(TT,{children:[He(_,{onClose:o}),e&&He(ET,{children:e}),He(qc,{style:{marginTop:e?"1.5rem":0},children:a}),He(Gi,{children:l}),yo(ql,{style:{marginTop:"2rem"},children:[s&&yo(pr,{children:[He(ur,{children:"Total"}),He(mr,{$isLoading:P||A,children:s})]}),n&&n!=="transaction"&&yo(pr,{children:[He(ur,{children:"Action"}),He(mr,{children:n})]}),i?yo(pr,{children:[He(ur,{children:"Amount"}),yo(mr,{$isLoading:T,children:[bT(i)," ",x]})]}):null,D?yo(pr,{children:[He(ur,{children:"Spender"}),He(mr,{children:He(Na,{address:D,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,c&&yo(pr,{children:[He(ur,{children:"To"}),He(mr,{children:He(Na,{address:c,url:y?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),yo(pr,{children:[He(ur,{children:"Network"}),He(mr,{children:m})]}),yo(pr,{children:[He(ur,{children:"Estimated fee"}),He(mr,{$isLoading:P||A,children:u})]})]}),He(to,{}),t?He(Oa,{style:{marginTop:"2rem"},children:t.message}):r?He(Oa,{style:{marginTop:"2rem"},children:wT}):null,He(CT,{$useSmallMargins:!!(r||t),address:g,balance:R,isLoading:P||A,errMsg:!P&&!r&&!t&&!f?`Add funds on ${y?.name} to complete transaction.`:void 0}),He(ol,{style:{marginTop:"1rem"},loading:b,onClick:M,children:w}),He($,{})]}),CT=O2(oc)`
|
|
2577
|
+
${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
|
|
2578
|
+
`,wT="There was an error preparing your transaction. Your transaction request will likely fail.",bT=e=>e.toLocaleString(),ET=O2.div`
|
|
2579
|
+
display: flex;
|
|
2580
|
+
width: 100%;
|
|
2581
|
+
justify-content: center;
|
|
2582
|
+
max-height: 40px;
|
|
2583
|
+
|
|
2584
|
+
> img {
|
|
2585
|
+
object-fit: contain;
|
|
2586
|
+
border-radius: var(--privy-border-radius-sm);
|
|
2587
|
+
}
|
|
2588
|
+
`;import{ExclamationCircleIcon as _T,ClipboardDocumentIcon as PT,ClipboardDocumentCheckIcon as xT}from"@heroicons/react/24/outline";import{useState as AT}from"react";import vr from"styled-components";import{ErrorCode as zc}from"@ethersproject/logger";var ST=new Set([zc.CALL_EXCEPTION,zc.NONCE_EXPIRED,zc.REPLACEMENT_UNDERPRICED,zc.TRANSACTION_REPLACED]),D2=e=>{let t;return e.code&&e.code!==-32e3&&ST.has(e.code)&&(t=e.transactionHash),t},U2=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as VT,jsx as kt,jsxs as Kn}from"react/jsx-runtime";var kT=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=D2(e),o=U2(e);return{errorCode:t,transactionHash:r,errorMessage:o}},RT=()=>Kn(LT,{children:[kt(NT,{}),kt(OT,{})]}),V2=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=I(),[i,a]=AT(!1),{errorCode:l,transactionHash:s,errorMessage:c}=kT(e),m=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Kn(VT,{children:[kt(_,{onClose:r}),Kn(MT,{children:[kt(RT,{}),kt(IT,{children:l}),kt(WT,{children:"Please try again."}),Kn(B2,{children:[kt(F2,{children:"Error message"}),kt(H2,{clickable:!1,children:c})]}),s&&Kn(B2,{children:[kt(F2,{children:"Transaction hash"}),Kn(UT,{children:["Copy this hash to view details about the transaction on a"," ",kt("u",{children:kt("a",{href:m,children:"block explorer"})}),"."]}),Kn(H2,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,kt(HT,{clicked:i})]})]}),kt(DT,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),kt(Z,{})]})},MT=vr.div`
|
|
2651
2589
|
display: flex;
|
|
2652
2590
|
flex-direction: column;
|
|
2653
2591
|
align-items: center;
|
|
2654
2592
|
justify-content: center;
|
|
2655
|
-
`,
|
|
2593
|
+
`,IT=vr.span`
|
|
2656
2594
|
color: var(--privy-color-foreground);
|
|
2657
2595
|
text-align: center;
|
|
2658
2596
|
font-size: 1.125rem;
|
|
@@ -2660,7 +2598,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2660
2598
|
line-height: 1.25rem; /* 111.111% */
|
|
2661
2599
|
text-align: center;
|
|
2662
2600
|
margin: 10px;
|
|
2663
|
-
`,
|
|
2601
|
+
`,WT=vr.span`
|
|
2664
2602
|
margin-top: 4px;
|
|
2665
2603
|
margin-bottom: 10px;
|
|
2666
2604
|
color: var(--privy-color-foreground-3);
|
|
@@ -2671,7 +2609,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2671
2609
|
font-weight: 400;
|
|
2672
2610
|
line-height: 20px; /* 142.857% */
|
|
2673
2611
|
letter-spacing: -0.008px;
|
|
2674
|
-
`,
|
|
2612
|
+
`,LT=vr.div`
|
|
2675
2613
|
position: relative;
|
|
2676
2614
|
width: 60px;
|
|
2677
2615
|
height: 60px;
|
|
@@ -2679,37 +2617,37 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2679
2617
|
display: flex;
|
|
2680
2618
|
justify-content: center;
|
|
2681
2619
|
align-items: center;
|
|
2682
|
-
|
|
2620
|
+
`,OT=vr(_T)`
|
|
2683
2621
|
position: absolute;
|
|
2684
2622
|
width: 35px;
|
|
2685
2623
|
height: 35px;
|
|
2686
2624
|
color: var(--privy-color-error);
|
|
2687
|
-
`,
|
|
2625
|
+
`,NT=vr.div`
|
|
2688
2626
|
position: absolute;
|
|
2689
2627
|
width: 60px;
|
|
2690
2628
|
height: 60px;
|
|
2691
2629
|
border-radius: 50%;
|
|
2692
2630
|
background-color: var(--privy-color-error);
|
|
2693
2631
|
opacity: 0.1;
|
|
2694
|
-
`,
|
|
2632
|
+
`,DT=vr(F)`
|
|
2695
2633
|
&& {
|
|
2696
2634
|
margin-top: 24px;
|
|
2697
2635
|
}
|
|
2698
2636
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2699
|
-
`,
|
|
2637
|
+
`,F2=vr.span`
|
|
2700
2638
|
width: 100%;
|
|
2701
2639
|
text-align: left;
|
|
2702
2640
|
font-size: 0.825rem;
|
|
2703
2641
|
color: var(--privy-color-foreground);
|
|
2704
2642
|
padding: 4px;
|
|
2705
|
-
`,
|
|
2643
|
+
`,B2=vr.div`
|
|
2706
2644
|
width: 100%;
|
|
2707
2645
|
margin: 5px;
|
|
2708
2646
|
display: flex;
|
|
2709
2647
|
flex-direction: column;
|
|
2710
2648
|
justify-content: center;
|
|
2711
2649
|
align-items: center;
|
|
2712
|
-
`,
|
|
2650
|
+
`,UT=vr.text`
|
|
2713
2651
|
position: relative;
|
|
2714
2652
|
width: 100%;
|
|
2715
2653
|
padding: 5px;
|
|
@@ -2717,7 +2655,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2717
2655
|
color: var(--privy-color-foreground-3);
|
|
2718
2656
|
text-align: left;
|
|
2719
2657
|
word-wrap: break-word;
|
|
2720
|
-
`,
|
|
2658
|
+
`,H2=vr.span`
|
|
2721
2659
|
position: relative;
|
|
2722
2660
|
width: 100%;
|
|
2723
2661
|
background-color: var(--privy-color-background-2);
|
|
@@ -2735,60 +2673,24 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2735
2673
|
&:hover {
|
|
2736
2674
|
background-color: var(--privy-color-foreground-4);
|
|
2737
2675
|
}`}
|
|
2738
|
-
`,
|
|
2676
|
+
`,FT=vr(PT)`
|
|
2739
2677
|
position: absolute;
|
|
2740
2678
|
top: 13px;
|
|
2741
2679
|
right: 13px;
|
|
2742
2680
|
width: 24px;
|
|
2743
2681
|
height: 24px;
|
|
2744
|
-
`,
|
|
2682
|
+
`,BT=vr(xT)`
|
|
2745
2683
|
position: absolute;
|
|
2746
2684
|
top: 13px;
|
|
2747
2685
|
right: 13px;
|
|
2748
2686
|
width: 24px;
|
|
2749
2687
|
height: 24px;
|
|
2750
|
-
`,
|
|
2688
|
+
`,HT=({clicked:e})=>e?kt(BT,{}):kt(FT,{});import{BigNumber as jp}from"@ethersproject/bignumber";import GT from"styled-components";import{Fragment as $T,jsx as jn,jsxs as KT}from"react/jsx-runtime";var qT=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=jp.from(e.gasUsed),o=jp.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=jp.from(t);n=n.add(i)}return n.toString()}catch{return}else return},G2=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>KT($T,{children:[jn(_,{onClose:o}),jn(kn,{title:l??"Transaction complete!",description:s??"You're all set."}),jn(Lc,{tokenPrice:n,from:t.from,to:t.to,gas:qT(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),jn(to,{}),jn(zT,{loading:!1,onClick:o,children:"All Done"}),jn(ne,{}),jn($,{})]}),zT=GT(F)`
|
|
2751
2689
|
&& {
|
|
2752
2690
|
margin-top: 24px;
|
|
2753
2691
|
}
|
|
2754
2692
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2755
|
-
`;import{
|
|
2756
|
-
display: flex;
|
|
2757
|
-
flex-direction: column;
|
|
2758
|
-
justify-content: space-between;
|
|
2759
|
-
flex-grow: 1;
|
|
2760
|
-
`,c9=Jn.div`
|
|
2761
|
-
font-size: 13px;
|
|
2762
|
-
color: var(--privy-color-error);
|
|
2763
|
-
width: 100%;
|
|
2764
|
-
margin-top: 16px;
|
|
2765
|
-
`,d9=Jn.div`
|
|
2766
|
-
display: flex;
|
|
2767
|
-
direction: row;
|
|
2768
|
-
justify-content: space-between;
|
|
2769
|
-
align-items: center;
|
|
2770
|
-
gap: 8px;
|
|
2771
|
-
`,p9=Jn(D)`
|
|
2772
|
-
transition: color 350ms ease, background-color 350ms ease;
|
|
2773
|
-
`,u9=Jn.div`
|
|
2774
|
-
height: 100%;
|
|
2775
|
-
display: flex;
|
|
2776
|
-
flex-direction: column;
|
|
2777
|
-
justify-content: space-evenly;
|
|
2778
|
-
flex-grow: 1;
|
|
2779
|
-
`,m9=Jn.div`
|
|
2780
|
-
display: flex;
|
|
2781
|
-
flex-direction: column;
|
|
2782
|
-
gap: 8px;
|
|
2783
|
-
`,f9=Jn.div`
|
|
2784
|
-
flex-grow: 1;
|
|
2785
|
-
`;import{isHexString as y9}from"@ethersproject/bytes";import{toUtf8String as g9}from"@ethersproject/strings";import{useEffect as yv,useState as ps}from"react";import aa from"styled-components";import{ProviderErrors as su}from"@privy-io/js-sdk-core";import h9 from"styled-components";var hv=h9.span`
|
|
2786
|
-
color: var(--privy-color-foreground);
|
|
2787
|
-
font-size: 1.125rem;
|
|
2788
|
-
font-weight: 600;
|
|
2789
|
-
line-height: 1.875rem; /* 166.667% */
|
|
2790
|
-
text-align: center;
|
|
2791
|
-
`;import{Fragment as Cv,jsx as ot,jsxs as us}from"react/jsx-runtime";var v9=e=>{if(!y9(e))return e;try{return g9(e)}catch{return e}},C9=e=>JSON.stringify(e,null,2),w9=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?ot(E9,{children:Object.entries(r).map(([o,n])=>us("li",{children:[us("strong",{children:[o,":"]})," ",t(n)]},o))}):ot("span",{children:String(r)});return ot("div",{children:t(e)})},b9=e=>{let{types:t,primaryType:r,...o}=e.typedData;return us(Cv,{children:[ot(vv,{children:ot(w9,{data:o})}),ot(Zo,{text:C9(e.typedData),itemName:"full payload to clipboard"})," "]})},gv=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=I(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=P(),[i,l]=ps(!0),[s,c]=ps(""),[u,h]=ps(),[m,g]=ps(null),[w,y]=ps(!1),b=m!==null;yv(()=>{e||o("LANDING")},[e]),yv(()=>{t(li).then($=>{l(!1),$||(c("An error has occurred, please try again."),h(new ft(new sr(s,su.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:S,data:R,confirmAndSign:T,onSuccess:A,onFailure:k,uiOptions:M}=n.signMessage,H={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=$=>{$?A($):k(u||new ft(new sr("The user rejected the request.",su.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),c(""),h(void 0)},200)};return a.current=()=>{B(m)},us(Cv,{children:[ot(_,{onClose:()=>B(m)}),ot(re,{}),M.iconUrl&&typeof M.iconUrl=="string"?ot(P9,{children:ot(Hc,{size:"sm",src:M.iconUrl,alt:"app image"})}):null,ot(hv,{children:H.title}),ot(uc,{children:H.description}),S==="personal_sign"&&ot(vv,{children:v9(R)}),S==="eth_signTypedData_v4"&&ot(b9,{typedData:R}),ot(_9,{}),ot(T9,{fail:!0,children:s}),ot(ih,{disabled:w||b||i,loading:w,onClick:async()=>{y(!0),c("");try{let $=await T();g($),y(!1),setTimeout(()=>{B($)},Oe)}catch($){console.error($),c("An error has occurred, please try again."),h(new ft(new sr(s,su.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:w?"Signing...":b?us(S9,{children:[ot(Ki,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",ot("span",{children:"Success"})]}):H.buttonText}),ot(oe,{}),ot(z,{})]})},vv=aa.div`
|
|
2693
|
+
`;import{createPublicClient as jT,http as YT}from"viem";var ZT=(e,t)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/Math.pow(10,t)),q2=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],z2=async({address:e,chain:t,amount:r,rpcConfig:o,privyAppId:n})=>{if(!r)return{value:"",symbol:""};try{let i=jT({chain:t,transport:YT(id(t,o,n))}),[a,l]=await Promise.all([i.readContract({abi:q2,address:e,functionName:"symbol"}),i.readContract({abi:q2,address:e,functionName:"decimals"})]);return{value:ZT(parseFloat(r.toString()),l),symbol:a}}catch(i){return console.log(i),{value:r.toString(),symbol:""}}};import{decodeFunctionData as $2}from"viem";var K2=e=>{let t=JT(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=e9(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},QT=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],JT=e=>{try{return $2({abi:QT,data:e})}catch{return null}},XT=[{constant:!1,inputs:[{name:"to",type:"address"},{name:"value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],e9=e=>{try{return $2({abi:XT,data:e})}catch{return null}};import{BigNumber as t9}from"@ethersproject/bignumber";import{useEffect as r9,useState as o9}from"react";import{calculateTotalGasEstimate as n9,populateTransactionRequest as i9}from"@privy-io/js-sdk-core";var j2=(e,t)=>{let[r,o]=o9(null),{getAccessToken:n,user:i}=q(),{walletProxy:a}=I(),l=he(i),s=async()=>{if(!await n()||!a||!l)return null;let m=[],f=await i9(l.address,e,t).catch(b=>(m.push(b),e)),{totalGasEstimate:u,l1ExecutionFeeEstimate:g}=await n9(f,t).catch(b=>(m.push(b),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:w,hasSufficientFunds:y}=await Fi(l.address,f,u??t9.from(0),t).catch(b=>(m.push(b),{balance:null,hasSufficientFunds:!1}));return{tx:f,totalGasEstimate:u,l1ExecutionFeeEstimate:g,balance:w,hasFunds:y,errors:m}};return r9(()=>{r&&o(null),s().then(o)},[e]),r};import{jsx as Xa}from"react/jsx-runtime";var Q2=new Ct(new Er("There was an issue preparing your transaction",J2.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),X2=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=S(),{rpcConfig:n,chains:i,closePrivyModal:a,walletProxy:l}=I(),{getAccessToken:s,user:c}=q(),{wallets:m}=Gr(),f=Ge(),[u,g]=Ja(e?.sendTransaction?.transactionRequest),[w,y]=Ja(null),[b,P]=Ja(!1),[A,T]=Ja(null),[x,R]=Ja(null);if(!u||!e?.sendTransaction)return Xa(Nn,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(Q2),a({shouldCallAuthOnSuccess:!1})}});let M=$c(()=>u.from?m.find(G=>Y2(G.address)===Y2(u.from)):he(c),[u.from]),D=$c(()=>i.find(G=>Number(G.id)===Number(u.chainId)),[u.chainId]),B=D?.nativeCurrency.symbol??"ETH",{action:K,amount:j,spender:L,isErc20Ish:N}=$c(()=>K2(u.data),[u.data]);a9(()=>{u.to&&D&&N&&z2({amount:j,address:u.to,chain:D,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(y).catch(console.error)},[u.to,j,D]);let{tokenPrice:W,isTokenPriceLoading:ve}=co(u),Me=$c(()=>rr(Number(u.chainId),i,n,{appId:f.id}),[u.chainId,n]),Y=j2(u,Me),te=()=>{if(!b)return A?(e?.sendTransaction?.onSuccess(A.response),a({shouldCallAuthOnSuccess:!1})):!x&&!Y?.errors[0]?(e?.sendTransaction?.onFailure(new Ct(new Er("The user rejected the request",J2.E4001_USER_REJECTED_REQUEST.eipCode))),a({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(x??Y?.errors[0]??Q2),a({shouldCallAuthOnSuccess:!1}))};t.current=te;let ee=async()=>{P(!0);try{let G=await s();if(b||!G||!M||!l)return;let ie=await zl(G,M.address,l,Y?.tx??u,Me,e.sendTransaction?.requesterAppId),ut=await ie.wait();T({receipt:$l(ut),response:ie})}catch(G){console.warn({transaction:Y?.tx??u,error:G}),R(G)}finally{P(!1)}},_e=async()=>{if(!he(c))return;if(!f.fundingConfig||f.fundingConfig.methods.length===0||!e.funding)throw new Error("Funding wallet is not enabled");let ie=Gc({fundingMethods:f.fundingConfig?.methods});r({...e,funding:{...e?.funding,methodScreen:ie}}),o(ie)},Te=f.embeddedWallets.priceDisplay.primary==="fiat-currency",ze=Z2(Y?.tx.value??0).add(Z2(Y?.totalGasEstimate?.toBigInt()??0)).toHexString(),Ve=fr(ze,B),pt=Te&&W?po(ze,W):void 0,Fe=fr(Y?.totalGasEstimate?.toString()??0,B),ae=Te&&W?po(Y?.totalGasEstimate?.toString()??0,W):void 0,Ft=fr(Y?.balance?.toString()??0,B,void 0,!0),Rr=Te&&W?po(Y?.balance?.toString()??0,W):void 0,jr=e.sendTransaction?.uiOptions?.transactionInfo?.title||(K==="approve"?"Confirm address":`Approve ${K}`),O=e.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?Xa("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Mr=Y&&!Y.errors[0]&&!Y.hasFunds&&f.fundingConfig&&f.fundingConfig.methods.length>0,V=Mr?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return A?.receipt?Xa(G2,{txn:Y?.tx??u,onClose:te,receipt:A.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:B,l1GasEstimate:Y?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):x?Xa(V2,{transactionError:x,chainId:Y?.tx.chainId??u.chainId,onClose:te,onRetry:({resetNonce:G})=>{R(null);let ie={...Y?.tx??u};G&&(ie.nonce=void 0),g(ie)}}):Xa(N2,{isSubmitting:b,submitError:x,isPreparing:!Y,isTokenPriceLoading:ve,isTokenContractInfoLoading:!w,prepareError:Y?.errors[0],symbol:w?.symbol,chain:D,img:rt,title:jr,subtitle:O,spender:L,total:u.value?pt??Ve:void 0,fee:ae??Fe,to:u.to,network:f.chains.find(G=>G.id===u.chainId)?.name??"",from:M?.address??"",cta:V,hasFunds:Y?.hasFunds,action:K,balance:Rr??Ft,amount:w?.value??j,onClose:te,onClick:Mr?_e:ee})};import{isHexString as s9}from"@ethersproject/bytes";import{toUtf8String as l9}from"@ethersproject/strings";import{useEffect as ev,useState as es}from"react";import Zi from"styled-components";import{ProviderErrors as Yp}from"@privy-io/js-sdk-core";import{Fragment as ov,jsx as tt,jsxs as ts}from"react/jsx-runtime";var c9=e=>{if(!s9(e))return e;try{return l9(e)}catch{return e}},d9=e=>JSON.stringify(e,null,2),p9=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?tt(m9,{children:Object.entries(r).map(([o,n])=>ts("li",{children:[ts("strong",{children:[o,":"]})," ",t(n)]},o))}):tt("span",{children:String(r)});return tt("div",{children:t(e)})},u9=e=>{let{types:t,primaryType:r,...o}=e.typedData;return ts(ov,{children:[tt(rv,{children:tt(p9,{data:o})}),tt(jo,{text:d9(e.typedData),itemName:"full payload to clipboard"})," "]})},tv=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=I(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=S(),[a,l]=es(!0),[s,c]=es(""),[m,f]=es(),[u,g]=es(null),[w,y]=es(!1),b=u!==null;ev(()=>{e||o("LANDING")},[e]),ev(()=>{t(ei).then(K=>{l(!1),K||(c("An error has occurred, please try again."),f(new Ct(new Er(s,Yp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:P,data:A,confirmAndSign:T,onSuccess:x,onFailure:R,uiOptions:M}=n.signMessage,D={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=K=>{K?x(K):R(m||new Ct(new Er("The user rejected the request.",Yp.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),c(""),f(void 0)},200)};return i.current=()=>{B(u)},ts(ov,{children:[tt(_,{onClose:()=>B(u)}),tt(oe,{}),M.iconUrl&&typeof M.iconUrl=="string"?tt(y9,{children:tt(l2,{size:"sm",src:M.iconUrl,alt:"app image"})}):null,tt(qc,{children:D.title}),tt(Gi,{children:D.description}),P==="personal_sign"&&tt(rv,{children:c9(A)}),P==="eth_signTypedData_v4"&&tt(u9,{typedData:A}),tt(g9,{}),tt(f9,{fail:!0,children:s}),tt(ol,{disabled:w||b||a,loading:w,onClick:async()=>{y(!0),c("");try{let K=await T();g(K),y(!1),setTimeout(()=>{B(K)},Ne)}catch(K){console.error(K),c("An error has occurred, please try again."),f(new Ct(new Er(s,Yp.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),y(!1)}},children:w?"Signing...":b?ts(h9,{children:[tt(Ui,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",tt("span",{children:"Success"})]}):D.buttonText}),tt(ne,{}),tt($,{})]})},rv=Zi.div`
|
|
2792
2694
|
margin-top: 1.5rem;
|
|
2793
2695
|
background-color: var(--privy-color-background-2);
|
|
2794
2696
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2807,7 +2709,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2807
2709
|
display: none; /* Safari and Chrome */
|
|
2808
2710
|
}
|
|
2809
2711
|
}
|
|
2810
|
-
`,
|
|
2712
|
+
`,m9=Zi.ul`
|
|
2811
2713
|
margin-left: 12px !important;
|
|
2812
2714
|
white-space: nowrap;
|
|
2813
2715
|
|
|
@@ -2819,7 +2721,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2819
2721
|
font-weight: 500 !important;
|
|
2820
2722
|
}
|
|
2821
2723
|
}
|
|
2822
|
-
`,
|
|
2724
|
+
`,f9=Zi.div`
|
|
2823
2725
|
line-height: 20px;
|
|
2824
2726
|
height: 20px;
|
|
2825
2727
|
font-size: 13px;
|
|
@@ -2829,20 +2731,20 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2829
2731
|
width: 100%;
|
|
2830
2732
|
margin-top: 16px;
|
|
2831
2733
|
margin-bottom: 4px;
|
|
2832
|
-
`,
|
|
2734
|
+
`,h9=Zi.span`
|
|
2833
2735
|
display: flex;
|
|
2834
2736
|
align-items: center;
|
|
2835
2737
|
gap: 8px;
|
|
2836
|
-
`,
|
|
2738
|
+
`,y9=Zi.div`
|
|
2837
2739
|
display: flex;
|
|
2838
2740
|
flex-direction: column;
|
|
2839
2741
|
justify-content: center;
|
|
2840
2742
|
align-items: center;
|
|
2841
2743
|
width: 100%;
|
|
2842
2744
|
height: 82px;
|
|
2843
|
-
`,
|
|
2745
|
+
`,g9=Zi.div`
|
|
2844
2746
|
flex-grow: 1;
|
|
2845
|
-
`;import{useEffect as
|
|
2747
|
+
`;import{useEffect as nv,useState as iv}from"react";import v9 from"styled-components";import{Fragment as w9,jsx as go,jsxs as Kc}from"react/jsx-runtime";var av=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{initLoginWithTelegram:s,loginWithTelegram:c,updateWallets:m,setReadyToTrue:f,closePrivyModal:u,createAnalyticsEvent:g}=I(),[w,y]=iv(!1),[b,P]=iv(void 0),A=Ne;async function T(){try{await c(),y(!0),f(!0)}catch(M){if(M?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(M?.privyErrorCode==="max_accounts_reached"){console.error(new wr(M).toString()),P(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}if(M?.privyErrorCode==="user_does_not_exist"){P(void 0),l(),a("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:D,detail:B}=fd(M);P({retryable:D,detail:B,message:"Authentication failed"})}}nv(()=>{T()},[]),nv(()=>{if(!(r&&e&&w&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},A);return()=>clearTimeout(B)}if(Gt(o,n?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),g({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A);return()=>clearTimeout(B)}m();let D=setTimeout(()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0}),A);return()=>clearTimeout(D)},[r,e,w,o]);let x=w?"Successfully connected with Telegram":b?b.message:"Verifying connection to Telegram",R="";return w?R="You\u2019re good to go!":b?R=b.detail:R="Just a few moments more",Kc(w9,{children:[go(_,{}),go(oe,{}),Kc(C9,{children:[go(Je,{children:Kc("div",{children:[go(ot,{success:w,fail:!!b}),go(bc,{style:{width:"38px",height:"38px"}})]})}),Kc(Xe,{children:[go("h3",{children:x}),go("p",{children:R})]}),b&&b?.retryable?go(hi,{onClick:()=>{s().then(async()=>T()).catch(M=>{let{retryable:D,detail:B}=fd(M);P({retryable:D,detail:B,message:"Authentication failed"})}),P(void 0)},disabled:!w&&!b?.retryable,children:"Retry"}):null]}),go(ne,{}),go(Z,{})]})},C9=v9.div`
|
|
2846
2748
|
display: flex;
|
|
2847
2749
|
flex-direction: column;
|
|
2848
2750
|
align-items: center;
|
|
@@ -2850,9 +2752,9 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2850
2752
|
margin-left: 27px;
|
|
2851
2753
|
margin-right: 27px;
|
|
2852
2754
|
gap: 24px;
|
|
2853
|
-
`;import
|
|
2755
|
+
`;import P9 from"@heroicons/react/24/outline/EnvelopeIcon";import b9 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as E9,useState as sv}from"react";import cv from"styled-components";import{Fragment as _9,jsx as rs,jsxs as lv}from"react/jsx-runtime";var dv=E9((e,t)=>{let[r,o]=sv(""),[n,i]=sv(!1),{authenticated:a,user:l}=q(),{initUpdateEmail:s}=I(),{navigate:c,setModalData:m,currentScreen:f}=S(),{enabled:u,token:g}=be(),w=Es(r),y=n,b=n||!w,P=async T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,T),c("AWAITING_PASSWORDLESS_CODE")}catch(x){m({errorModalData:{error:x,previousScreen:f||"LANDING"}})}i(!1)},A=()=>{u&&!g&&!a?(m({captchaModalData:{callback:T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,T)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):P(g)};return lv(_9,{children:[rs(T9,{children:lv(S9,{children:[rs(b9,{}),rs("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&A()},value:r,autoComplete:"email"}),e.stacked?null:rs(yi,{isSubmitting:y,onClick:A,disabled:b,children:"Submit"})]})}),e.stacked?rs(F,{loadingText:null,loading:y,disabled:b,onClick:A,children:"Submit"}):null]})}),T9=cv.div`
|
|
2854
2756
|
width: 100%;
|
|
2855
|
-
`,
|
|
2757
|
+
`,S9=cv.label`
|
|
2856
2758
|
display: block;
|
|
2857
2759
|
position: relative;
|
|
2858
2760
|
width: 100%;
|
|
@@ -2910,7 +2812,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2910
2812
|
&& > input::placeholder {
|
|
2911
2813
|
color: var(--privy-color-foreground-3);
|
|
2912
2814
|
}
|
|
2913
|
-
`;import{Fragment as
|
|
2815
|
+
`;import{Fragment as x9,jsx as cn,jsxs as A9}from"react/jsx-runtime";var pv=()=>A9(x9,{children:[cn(_,{},"header"),cn(oe,{}),cn(ye,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:cn(P9,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),cn(Sr,{children:cn(dv,{stacked:!0})}),cn(ne,{}),cn($,{})]});import Qp from"styled-components";import{jsx as uv}from"react/jsx-runtime";var mv=({style:e,...t})=>uv("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:uv("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as I9,jsx as Yn,jsxs as Zp}from"react/jsx-runtime";var fv=()=>{let{navigate:e}=S();return Zp(I9,{children:[Yn(_,{}),Zp(k9,{children:[Yn(R9,{children:Yn(mv,{})}),Zp(M9,{children:[Yn("h3",{children:"Unable to sign in"}),Yn("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Yn(F,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Yn($,{})]})},k9=Qp.div`
|
|
2914
2816
|
display: flex;
|
|
2915
2817
|
flex-direction: column;
|
|
2916
2818
|
align-items: center;
|
|
@@ -2919,7 +2821,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2919
2821
|
width: 100%;
|
|
2920
2822
|
padding-top: 8px;
|
|
2921
2823
|
padding-bottom: 32px;
|
|
2922
|
-
`,
|
|
2824
|
+
`,R9=Qp.div`
|
|
2923
2825
|
display: flex;
|
|
2924
2826
|
align-items: center;
|
|
2925
2827
|
justify-content: center;
|
|
@@ -2928,11 +2830,11 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2928
2830
|
color: var(--privy-color-error);
|
|
2929
2831
|
background-color: var(--privy-color-error-light);
|
|
2930
2832
|
border-radius: 50%;
|
|
2931
|
-
`,
|
|
2833
|
+
`,M9=Qp.div`
|
|
2932
2834
|
display: flex;
|
|
2933
2835
|
flex-direction: column;
|
|
2934
2836
|
gap: 8px;
|
|
2935
|
-
`;import
|
|
2837
|
+
`;import L9,{createGlobalStyle as O9}from"styled-components";var W9=`
|
|
2936
2838
|
*,
|
|
2937
2839
|
::before,
|
|
2938
2840
|
::after {
|
|
@@ -3162,7 +3064,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3162
3064
|
[hidden] {
|
|
3163
3065
|
display: none;
|
|
3164
3066
|
}
|
|
3165
|
-
`,
|
|
3067
|
+
`,hv=W9;var yv=O9`
|
|
3166
3068
|
:root {
|
|
3167
3069
|
// Borders
|
|
3168
3070
|
--privy-border-radius-sm: 6px;
|
|
@@ -3197,10 +3099,10 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3197
3099
|
--privy-height-modal-full: 620px;
|
|
3198
3100
|
--privy-height-modal-compact: 480px;
|
|
3199
3101
|
};
|
|
3200
|
-
`,
|
|
3102
|
+
`,Jp=L9.div`
|
|
3201
3103
|
// css normalize only the privy application to avoid conflicts
|
|
3202
3104
|
// with consuming application
|
|
3203
|
-
${
|
|
3105
|
+
${hv}
|
|
3204
3106
|
|
|
3205
3107
|
// Privy styles
|
|
3206
3108
|
color: var(--privy-color-foreground-2);
|
|
@@ -3251,7 +3153,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3251
3153
|
opacity: 1;
|
|
3252
3154
|
}
|
|
3253
3155
|
}
|
|
3254
|
-
`;import{Dialog as
|
|
3156
|
+
`;import{Dialog as gv,Transition as Xp}from"@headlessui/react";import eu from"react";import os from"styled-components";import{jsx as Qi,jsxs as B9}from"react/jsx-runtime";var vv=({children:e,open:t,onClick:r,...o})=>Qi(Xp,{show:t,as:eu.Fragment,children:B9(gv,{onClose:r,...o,as:D9,children:[Qi(Xp.Child,{as:eu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Qi(N9,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Qi(U9,{children:Qi(Xp.Child,{as:eu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Qi(gv.Panel,{as:F9,children:e})})})]})}),N9=os.div`
|
|
3255
3157
|
position: fixed;
|
|
3256
3158
|
inset: 0;
|
|
3257
3159
|
|
|
@@ -3264,10 +3166,10 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3264
3166
|
backdrop-filter: unset;
|
|
3265
3167
|
-webkit-backdrop-filter: unset;
|
|
3266
3168
|
}
|
|
3267
|
-
|
|
3169
|
+
`,D9=os.div`
|
|
3268
3170
|
position: relative;
|
|
3269
3171
|
z-index: 999999;
|
|
3270
|
-
`,
|
|
3172
|
+
`,U9=os.div`
|
|
3271
3173
|
position: fixed;
|
|
3272
3174
|
inset: 0;
|
|
3273
3175
|
display: flex;
|
|
@@ -3275,7 +3177,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3275
3177
|
justify-content: center;
|
|
3276
3178
|
width: 100vw;
|
|
3277
3179
|
min-height: 100vh;
|
|
3278
|
-
`,
|
|
3180
|
+
`,F9=os.div`
|
|
3279
3181
|
// reset some default dialog styles
|
|
3280
3182
|
padding: 0;
|
|
3281
3183
|
background: transparent;
|
|
@@ -3322,13 +3224,13 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3322
3224
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
3323
3225
|
border-radius: var(--privy-border-radius-lg);
|
|
3324
3226
|
}
|
|
3325
|
-
`,
|
|
3227
|
+
`,Cv=os.div`
|
|
3326
3228
|
display: flex;
|
|
3327
3229
|
flex-direction: column;
|
|
3328
3230
|
align-items: center;
|
|
3329
3231
|
justify-content: center;
|
|
3330
3232
|
height: 100%;
|
|
3331
|
-
`;import{Fragment as
|
|
3233
|
+
`;import{Fragment as bv,jsx as it,jsxs as Ev}from"react/jsx-runtime";var q9={["LANDING"]:w1,["CONNECT_OR_CREATE"]:v1,["AWAITING_PASSWORDLESS_CODE"]:Ch,["AWAITING_CONNECTION"]:jh,["AWAITING_CONNECT_ONLY_CONNECTION"]:Qh,["AWAITING_FARCASTER_CONNECTION"]:og,["AWAITING_FARCASTER_SIGNER"]:cg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:v2,["PHANTOM_INTERSTITIAL_SCREEN"]:E2,["LOGIN_FAILED_SCREEN"]:x1,["AWAITING_OAUTH_SCREEN"]:h2,["CROSS_APP_AUTH_SCREEN"]:ty,["ALLOWLIST_REJECTION_SCREEN"]:dh,["ACCOUNT_NOT_FOUND_SCREEN"]:rh,["USER_LIMIT_REACHED_SCREEN"]:fv,["INSTALL_PHANTOM_SCREEN"]:Yg,["LINK_EMAIL_SCREEN"]:b1,["LINK_PHONE_SCREEN"]:E1,["LINK_WALLET_SCREEN"]:T1,["LINK_PASSKEY_SCREEN"]:Cg,["UPDATE_EMAIL_SCREEN"]:pv,["CONNECT_ONLY_LANDING_SCREEN"]:Gh,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Vh,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:yy,["EMBEDDED_WALLET_CREATED_SCREEN"]:cy,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:sy,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:T2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:L2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:M2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:my,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:tv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:X2,["FUNDING_METHOD_SELECTION_SCREEN"]:Sg,["MOONPAY_PROMPT_SCREEN"]:Fg,["MOONPAY_STATUS_SCREEN"]:Hg,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:Gg,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:mg,["FUNDING_MANUAL_TRANSFER_SCREEN"]:Ag,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Vy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Hy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:W2,["MFA_ENROLLMENT_FLOW_SCREEN"]:H1,["CAPTCHA_SCREEN"]:Th,["ERROR_SCREEN"]:qy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:qg,["AFFIRMATIVE_CONSENT_SCREEN"]:sh,["TELEGRAM_AUTH_SCREEN"]:av},z9=["LANDING","AWAITING_CONNECTION"],Sv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=q(),{headless:n}=Ge(),{ready:i,currentScreen:a}=S(),{status:l,execute:s,reset:c,enabled:m}=be(),f=o&&a&&z9.includes(a)&&!n&&l==="ready";if(wv(()=>{f&&s()},[f]),wv(()=>{!o&&m&&c()},[o,m]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN"&&a!=="CROSS_APP_AUTH_SCREEN"&&a!=="TELEGRAM_AUTH_SCREEN")return Ev(bv,{children:[it(_,{}),it(oe,{}),it(Cv,{children:it(mt,{})}),it(ne,{}),it(Z,{})]});if(!a&&e)return it(Gp,{open:e,onClose:t});if(!a)return null;let u=q9[a];return Ev(bv,{children:[it(Dr,{if:!!e,children:it(u,{})}),it(Dr,{if:!e,children:it(Gp,{open:e,onClose:t})})]})},$9=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=V9(null),o=$f(r);return it(j9,{style:{height:o},id:"privy-modal-content",children:it("div",{ref:r,children:it(Sv,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},K9=()=>{let{closePrivyModal:e}=I(),{onUserCloseViaDialogOrKeybindRef:t}=S();return{gracefulClosePrivyModal:H9(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},tu=({open:e})=>{let{app:t}=S(),{gracefulClosePrivyModal:r}=K9(),[o,n]=G9(!1);xd({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=e||o;return t.render.standalone?it(Jp,{children:it(_v,{id:"privy-modal-content",children:it(Sv,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):it(vv,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:it(Jp,{children:it($9,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},_v=Tv.div`
|
|
3332
3234
|
display: flex;
|
|
3333
3235
|
flex-direction: column;
|
|
3334
3236
|
text-align: center;
|
|
@@ -3337,7 +3239,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3337
3239
|
width: 100%;
|
|
3338
3240
|
background: var(--privy-color-background);
|
|
3339
3241
|
padding: 0 16px;
|
|
3340
|
-
`,
|
|
3242
|
+
`,j9=Tv(_v)`
|
|
3341
3243
|
transition: height 150ms ease-out;
|
|
3342
3244
|
overflow: hidden;
|
|
3343
3245
|
|
|
@@ -3351,4 +3253,4 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3351
3253
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
3352
3254
|
border-radius: var(--privy-border-radius-lg);
|
|
3353
3255
|
}
|
|
3354
|
-
`;import{useRef as Vv,useEffect as nS}from"react";import{jsx as aS}from"react/jsx-runtime";function iS({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function Gv(e){let t=Vv(null),r=Vv();return nS(()=>{r.current?.remove(),r.current=iS(e),t.current?.after(r.current)},[e]),aS("div",{ref:t,hidden:!0})}import{useState as sS}from"react";import{useEffect as qv,useRef as zv}from"react";var rd=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function mn(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 Ie("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((m,g)=>{r.current={resolve:m,reject:g};let w=1e3*60*5;setTimeout(()=>{let y=new Ie("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},w)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),h}if(c===null){let u=new Ie("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as mS}from"react/jsx-runtime";var lS=function(e){return()=>`id-${e++}`}(0);function cS(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ct(e){return e.error!==void 0}var dt=new rd,fu=new Map,dS=(e,t)=>typeof t=="bigint"?t.toString():t,pS=(e,t)=>`${e}${JSON.stringify(t,dS)}`;function wt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=pS(e,t);if(e==="privy:wallet:create"){let l=fu.get(a);if(l)return l}let i=new Promise((l,s)=>{let c=lS();dt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{fu.delete(a)});return fu.set(a,i),i}function uS(e){switch(e.event){case"privy:iframe:ready":let t=dt.dequeue(e.event,e.id);return Ct(e)?t.reject(new Ie(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=dt.dequeue(e.event,e.id);return Ct(e)?r.reject(new Ie(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=dt.dequeue(e.event,e.id);return Ct(e)?o.reject(new Ie(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=dt.dequeue(e.event,e.id);return Ct(e)?n.reject(new Ie(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let a=dt.dequeue(e.event,e.id);return Ct(e)?a.reject(new Ie(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:rpc":let i=dt.dequeue(e.event,e.id);return Ct(e)?i.reject(new Ie(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery":let l=dt.dequeue(e.event,e.id);return Ct(e)?l.reject(new Ie(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=dt.dequeue(e.event,e.id);return Ct(e)?s.reject(new Ie(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:submit-enrollment":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:unenroll":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:clear":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:init-signer":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:sign":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:solana-wallet:create":let c=dt.dequeue(e.event,e.id);return Ct(e)?c.reject(new Ie(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=dt.dequeue(e.event,e.id);return Ct(e)?u.reject(new Ie(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=dt.dequeue(e.event,e.id);return Ct(e)?h.reject(new Ie(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let m=dt.dequeue(e.event,e.id);return Ct(e)?m.reject(new Ie(e.error.type,e.error.message)):m.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function $v(e){let t=zv(null),r=zv(e.mfaMethods),o=Ei(),[n,a]=sS(!1);return qv(()=>{r.current=e.mfaMethods},[e.mfaMethods]),qv(()=>{if(!n)return;let i=t.current;if(!i)return;function l(m){m&&m.origin===e.origin&&cS(m.data)&&uS(m.data)}let s={create(m){return wt("privy:wallet:create",m,i,e.origin)},import(m){return wt("privy:wallet:import",m,i,e.origin)},connect(m){return wt("privy:wallet:connect",m,i,e.origin)},recover(m){return mn(g=>wt("privy:wallet:recover",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!m.recoveryMethod||m.recoveryMethod==="privy")},rpc(m){return mn(g=>wt("privy:wallet:rpc",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(m){return wt("privy:solana-wallet:create",m,i,e.origin)},connectSolana(m){return wt("privy:solana-wallet:connect",m,i,e.origin)},recoverSolana(m){return wt("privy:solana-wallet:recover",m,i,e.origin)},rpcSolana(m){return wt("privy:solana-wallet:rpc",m,i,e.origin)},setRecovery(m){return mn(g=>wt("privy:wallet:set-recovery",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return mn(g=>wt("privy:mfa:verify",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return mn(g=>wt("privy:mfa:init-enrollment",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return mn(g=>wt("privy:mfa:submit-enrollment",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(m){return mn(g=>wt("privy:mfa:unenroll",{...m,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(m){return wt("privy:mfa:clear",m,i,e.origin)},initFarcasterSigner(m){return wt("privy:farcaster:init-signer",m,i,e.origin)},signFarcasterMessage(m){return wt("privy:farcaster:sign",m,i,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},h=new AbortController;return da(()=>wt("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),mS("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Is(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var od=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t,r){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return(await this.walletProxy.rpcSolana({accessToken:r,publicKey:this.address,request:t})).response.data}async request(t){console.debug("EmbeddedSolanaProvider.request() called with args",t);let r=await Ce();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await Kv())throw new C("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t,r);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function nd({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(a=>a.provider_app_id===r);if(!n)throw new C("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function jv({api:e,appId:t}){let r=bn(),o=ci(),n=await di(r);try{let{url:a}=await e.post(Ss,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw se(a)}}async function Yv({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during cross-app auth flow");try{return(await e.post(Ps,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(a){let i=se(a);throw i.privyErrorCode?new C(i.message||"Invalid code during cross-app auth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during cross-app auth flow"?new C("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new C("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}async function Zv({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let i=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",u)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(i),n(new C("User rejected request")))},300);function u(h){h.data&&(h.data.type==="PRIVY_OAUTH_RESPONSE"&&h.data.stateCode&&h.data.authorizationCode&&(clearTimeout(i),o(h.data),l()),h.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(h.data.error)),l()),h.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=u))}window.addEventListener("message",u)})}var id=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let i=e?.linkedAccounts.find(m=>!!(m.type==="cross_app"&&m.embeddedWallets.find(g=>g.address===t)));if(!e||!i)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new C("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(i.providerApp.id),s=await nd({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await a({appId:i.providerApp.id})&&(l=r.getProviderAccessToken(i.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new C("Transactions require a valid token");let c=window.open(void 0,void 0,hu({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");let u=new URL(`${s.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",fS(o)),c.location=u.href,new Promise((m,g)=>{let y=setTimeout(()=>{R(),g(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(R(),g(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),S=T=>{T.data&&(T.data.token?.action==="set"&&T.data.token?.value!==void 0?r.storeProviderAccessToken(i.providerApp.id,T.data.token.value):T.data.token?.action==="clear"&&r.storeProviderAccessToken(i.providerApp.id,null),T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(R(),m(T.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),T.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&T.data.error&&(R(),g(T.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:T.data.error,address:t}})))};window.addEventListener("message",S);let R=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",S)}})},fS=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),hu=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=n/window.screen.availWidth,l=a/window.screen.availHeight,s=(n-e)/2/i+r,c=(a-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var hS="https://cdn.apple-cloudkit.com";async function yu({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,a)=>{function i(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),i()),s.origin===hS&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),i()),s.data.type==="PRIVY_OAUTH_ERROR"&&(a(s.data.error),i()))}window.addEventListener("message",l)})}var Qv=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as Er,jsxs as Jv}from"react/jsx-runtime";var go;function ES(e){return typeof e=="string"&&e.length===25}function Ce(){if(!go){let e=J.get(yn);return Promise.resolve(e||null)}return go.getAccessToken()}var Xv,Ym=(e,t,r)=>Xv(e,t,r),e3,Zm=(e,t)=>e3(e,t),t3,Qm=(e,t)=>t3(e,t),r3,Jm=()=>r3(),o3,Kv=()=>o3(),TS=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;J.put(ma,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},SS=({config:e,...t})=>{if(!ES(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");go||(go=new Sa({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Er(qf,{client:go,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Er(PS,{...t,client:go})})},PS=e=>{let t=e.client,[r,o]=st(!1),[n,a]=st(!1),[i,l]=st(!1),[s,c]=st(null),[u,h]=st([]),[m,g]=st(null),w=la(u),[y,b]=st(!1),[S,R]=st(null),[T,A]=st(!1),[k,M]=st({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[H,B]=st({status:"initial"}),[$,j]=st(null),[W,N]=st(null),O=Je(),ve=cl(),[Ue,ne]=st(!0),[te,ee]=st({}),[he,Te]=st(null),[qe,He]=st(null),[pt,Fe]=st(!1),[Z,Vt]=st(!1),Gt=la(null),Yr=la(null),L=la(rh),[tt,Ir]=st(!1);t.onStoreToken=d=>{d&&U(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(L,"accessToken","onAccessTokenRemoved")};let V=la(null),K=la(null),me=d=>{R(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},ut=d=>{O.embeddedWallets.createOnLogin!=="off"&&ne(!0),me(d)};jr(()=>{let d=Pn(s);if(!d||!W)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Uo,id:"io.privy.solana.wallet"},getProvider:async()=>new od(W,d.address)};g(p)},[W,s]),jr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=xe(s),p=tl(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!W){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(W,d.address,O.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(W,p.address,O.defaultChain,e.appId)},[W,s]),jr(()=>{W&&qe?.(W)},[W]),jr(()=>{(async()=>{if(!O.customAuth?.enabled)return;ne(!0);let{getCustomAccessToken:p,isLoading:f}=O.customAuth;if(!(!n||f))try{let v=await p();if(!v&&i){await ni.logout();return}if(!v||i)return;t.startAuthFlow(new ai(v));let{user:x,isNewUser:F}=await t.authenticate();if(!x){await ni.logout();return}c(x||null),b(F||!1),l(!0),Vt(!0)}catch(v){console.warn(v),i&&await ni.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),jr(()=>{Z&&W&&s&&Kt(s,O.embeddedWallets.createOnLogin)&&(Vt(!1),Zr(s,li).catch(console.error))},[Z&&W&&s]),jr(()=>{async function d(){let p=It(),f=ei();TS();let v=yS();t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:v,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,externalWalletConfig:O.externalWallets,appName:O.name??"Privy"});let x;t.connectors?.on("connectorInitialized",()=>{x&&clearTimeout(x);let Se=t.connectors.walletConnectors.length,ae=t.connectors.walletConnectors.reduce((Ze,_e)=>Ze+(_e.initialized?1:0),0);ae===Se?Ir(!0):x=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:ae,expected:Se}),Ir(!0)},1500)}),t.connectors?.initialize().then(()=>{ad()});let F=await t.getAuthenticatedUser(),G=!!F;if(O.customAuth?.enabled||(l(!!F),F&&U(L,"login","onComplete",F,!1,!0,null,null),c(F)),p){K.current=G?"link":"login";return}if(f&&!G){K.current="login",ut("TELEGRAM_AUTH_SCREEN");return}ie.setReadyToTrue(!!F)}!n&&ve&&d()},[t,he,n,ve]),jr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){Fe(!0);return}let p=!!u.find(f=>f.walletClientType==="privy");Fe(p)},[n,s,u]);let It=()=>{let d=va();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function f(v){return v.startsWith(p)}return d.inProgress&&f(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Jr(d)),ut("AWAITING_OAUTH_SCREEN"),!0)},ei=()=>{let d=$m();if(!d||!O.loginMethods.telegram||!O.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new pi;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},ti=async(d,p,f,v)=>{let x=await t.connectors?.createWalletConnector(d,p)||null;ri(x,p,f,v)};async function ri(d,p,f,v){if(d)M({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new le("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,f);d instanceof Or&&p&&await d.resetConnection(p),M({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ri(d,p,f,v)});try{let x=await d.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(F=>F.id===Number(x?.chainId.replace("eip155:","")))&&!(x?.connectorType==="wallet_connect_v2"&&x?.walletClientType==="metamask")){M(F=>({...F,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await x?.switchChain(O.defaultChain.id),x&&(x.chainId=si(hn(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(F=>({...F,status:"connected",connectedWallet:x,connectError:null,connectRetry:E})),x&&U(L,"connectWallet","onSuccess",x),v?.(x,f)}catch(x){return x instanceof rt?(console.warn(x.cause?x.cause:x.message),U(L,"connectWallet","onError",x.privyErrorCode||"generic_connect_wallet_error")):(console.warn(x),U(L,"connectWallet","onError","unknown_connect_wallet_error")),M(F=>({...F,status:"disconnected",connectedWallet:null,connectError:x})),v?.(null,f)}}let fn=async(d,p)=>{if(d===null)return;let f=new wo(d,t,p);t.startAuthFlow(f)},ad=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),f=d.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!Oo()&&ut("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");me("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),ti(p,f,void 0,fn)};jr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let ze=d=>{if(!i)throw U(L,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new C("User must be authenticated before linking an account.")},Io=()=>{ze("siwe"),V.current="siwe",K.current="link",me("LINK_WALLET_SCREEN")},Ye=d=>{if(!i||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},mt=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(M(f=>({...f,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),O.captchaEnabled&&!i){let f={callback:v=>fn(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:f}),ut("CAPTCHA_SCREEN")}else await fn(d),ut("AWAITING_CONNECTION")},oi=async(d,p)=>{let{signedUrl:f,externalTransactionId:v}=await Qg(t,d,p??{},O.appearance.palette,O.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:f,externalTransactionId:v}},Wo=()=>{h(d=>{let p=t.connectors?.wallets.map(f=>({...f,linked:Ye(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");mt(f)},fund:async v=>{await ie.fundWallet(f.address,v)},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(f.address);c(v)}}))||[];return rl(d,p)?d:p})};jr(()=>{Wo()},[s?.linkedAccounts,i,n]),jr(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");Wo(),t.connectors.on("walletsUpdated",Wo)}},[n]);let hs=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Mo(d.suggestedAddress);j(p)}me(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};jr(()=>{if(!u[0])return;let d=u[0],p=w.current.find(v=>v.address===d.address),f;if(d.walletClientType==="privy"?f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):f=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&f){let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},c(v)}w.current=u},[u]);let Zr=async(d,p)=>{if(xe(d))throw U(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,x]=await Promise.all([ie.initializeWalletProxy(p),Ce()]);if(!v&&O.customAuth?.enabled)throw U(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!x||O.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((F,G)=>{ne(!0),ee({createWallet:{onSuccess:ae=>{U(L,"createWallet","onSuccess",ae),F(ae)},onFailure:ae=>{U(L,"createWallet","onError","unknown_embedded_wallet_error"),G(ae)},callAuthOnSuccessOnClose:!1}}),me("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:x});let F=await ie.refreshUser(),G=xe(F);if(!G)throw U(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(L,"createWallet","onSuccess",G),G}},sd=d=>{if(!O.chains.map(p=>p.id).includes(d))throw new le(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},vu=(d,p,f)=>new Promise(async(v,x)=>{let{requesterAppId:F}=p||{};if(!i||!s){U(L,"sendTransaction","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=d.from,Se=G?s?.linkedAccounts.find(Qe=>Qe.type==="wallet"&&Qe.walletClientType==="privy"&&Mo(Qe.address)===Mo(G)):xe(s);if(!Se){U(L,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}ne(!0);let ae=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):ae.chainId;sd(Ze);let _e=Object.assign({},d,{chainId:Ze}),zt=async()=>{let Qe=await Ce();if(!Qe||!W){U(L,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ie.recoverEmbeddedEthereumWallet()){U(L,"sendTransaction","onError","unknown_connect_wallet_error"),x(new Error("Unable to connect to wallet"));return}let ii=ar(_e.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Qr=await bS(Se.address,_e,ii);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:p3}=await wS(Qr,ii),{hasSufficientFunds:u3}=await ji(Se.address,Qr,p3,ii);if(!u3)throw new ft(new sr("Wallet has insufficient funds for this transaction.",CS.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Tu=await Jl(Qe,Se.address,W,Qr,ii,F);U(L,"sendTransaction","onSuccess",Tu),v(Tu)}catch(gs){U(L,"sendTransaction","onError","transaction_failure"),x(gs)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),zt();else{let Qe={transactionRequest:_e,onSuccess:Qr=>{U(L,"sendTransaction","onSuccess",Qr),v(Qr)},onFailure:Qr=>{U(L,"sendTransaction","onError","transaction_failure"),x(Qr)},uiOptions:p||{},fundWalletConfig:f,requesterAppId:F},gs={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Qr=>{U(L,"sendTransaction","onError","unknown_connect_wallet_error"),x(Qr)}},ii=bu({address:Se.address,fundWalletConfig:f,comingFromSendTransactionScreen:!0});ee({connectWallet:gs,sendTransaction:Qe,funding:ii}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Cu(){return new Promise(async(d,p)=>{let f=await Ce();if(!f||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:f}),d()}catch(v){p(v)}})}let wu=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,f)=>f.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],qt=d=>{let p=s?.linkedAccounts.filter(x=>x.type===d).length??0,{displayName:f,loginMethod:v}=rn(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw U(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:v}),new C(`User already has an account of type ${f} linked.`)},c3=()=>{if(!O.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(L,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new C("User can't link an account because Telegram linking is disabled.")},bu=({address:d,fundWalletConfig:p,methodScreen:f,comingFromSendTransactionScreen:v=!1})=>{if(!O.fundingConfig||O.fundingConfig.methods.length===0)return;let x=pc(p)&&p.amount?p.amount:O.fundingConfig.defaultRecommendedAmount,F=pc(p)&&p.chain?p.chain.id:Yi(O.fundingConfig.defaultRecommendedCurrency.chain),G=pc(p)&&p.chain?p.chain:O.chains.find(Se=>Se.id===F);if(!G)throw new C("Funding chain is not in PrivyProvider chains list");return{address:d,amount:x,chain:G,methodScreen:f,comingFromSendTransactionScreen:v,...Zg(p)?{moonpayConfigOverride:p.config}:{}}};async function Eu({legacySetWalletPasswordFlow:d=!1}){R(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!i||!s)throw U(L,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let f=xe(s);if(!f||!W)throw U(L,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(Pn(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await Cu()}catch(x){throw U(L,p,"onError","missing_or_invalid_mfa"),x}return new Promise((x,F)=>{ne(!0);let G={onSuccess:_e=>{U(L,p,"onSuccess","user-passcode",_e),x(_e)},onFailure:_e=>{U(L,p,"onError","user_exited_set_password_flow"),F(_e)},callAuthOnSuccessOnClose:!1},Se=f.recoveryMethod==="user-passcode",Ze={onCompleteNavigateTo:Dl({walletAction:"update",availableRecoveryMethods:O.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:Se}),shouldForceMFA:!1,onFailure:_e=>{U(L,p,"onError","unknown_connect_wallet_error"),F(_e)}};ee({setWalletPassword:G,createWallet:G,connectWallet:Ze,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Se}}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function ys({appId:d}){ze(`privy:${d}`),V.current=`privy:${d}`,K.current="link";let p=window.open(void 0,void 0,hu({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(f,v)=>{let{name:x,logoUrl:F}=await nd({api:t.api,providerAppId:d,requesterAppId:O.id});ee({crossAppAuth:{appId:d,name:x,logoUrl:F,popup:p,onSuccess:f,onError:v}}),ut("CROSS_APP_AUTH_SCREEN")})}let ni={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:hs,importWallet:async({privateKey:d})=>{ze("siwe");let[p,f]=await Promise.all([ie.initializeWalletProxy(15e3),Ce()]);if(p&&f){await p.import({privateKey:d,accessToken:f});let v=await ie.refreshUser(),x=tl(v);if(!x)throw U(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(L,"createWallet","onSuccess",x),x}else throw new C("User is not authenticated")},linkWallet:Io,linkCrossAppAccount:ys,linkEmail:()=>{ze("email"),qt("email"),V.current="email",K.current="link",me("LINK_EMAIL_SCREEN")},linkPhone:()=>{ze("sms"),qt("phone"),V.current="sms",K.current="link",me("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ze("google"),qt("google_oauth"),K.current="link",await ie.initLoginWithOAuth("google")},linkTwitter:async()=>{ze("twitter"),qt("twitter_oauth"),K.current="link",await ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ze("discord"),qt("discord_oauth"),K.current="link",await ie.initLoginWithOAuth("discord")},linkGithub:async()=>{ze("github"),qt("github_oauth"),K.current="link",await ie.initLoginWithOAuth("github")},linkSpotify:async()=>{ze("spotify"),qt("spotify_oauth"),K.current="link",await ie.initLoginWithOAuth("spotify")},linkInstagram:async()=>{ze("instagram"),qt("instagram_oauth"),K.current="link",await ie.initLoginWithOAuth("instagram")},linkTiktok:async()=>{ze("tiktok"),qt("tiktok_oauth"),K.current="link",await ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ze("linkedin"),qt("linkedin_oauth"),K.current="link",await ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{ze("apple"),qt("apple_oauth"),K.current="link",await ie.initLoginWithOAuth("apple")},linkPasskey:async()=>{ze("passkey"),qt("passkey"),await ie.initLinkWithPasskey(),me("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{ze("telegram"),qt("telegram"),c3(),K.current="link",V.current="telegram",await ie.initLoginWithTelegram(),me("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{ze("farcaster"),qt("farcaster"),await ie.initLoginWithFarcaster(),K.current="link",V.current="farcaster",me("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ze("email"),!s?.email)throw new C("User does not have an email linked to their account.");K.current="link",V.current="email",me("UPDATE_EMAIL_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let f=await new Promise(v=>{Te(x=>v.bind(x))});if(Te(null),f){console.warn(p);return}}if(i){console.warn(p);return}K.current="login",ee({login:d}),ut("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(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}ut("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),R(null),await t.logout(),s&&W)try{await W.clearMfa({userId:s.id})}catch{}c(null),l(!1),U(L,"logout","onSuccess"),K.current=null,V.current=null,o(!1),J.del(fa)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new $e;let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new $e:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gu(new Xr(new $e));let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new gu(new Xr(new $e)):new gu(new Xr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Do(new $e);let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(v=>v.address===d?.address));return!d||!p?new Do(new $e):new Do(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===d)?.providerApp;if(!p)throw new C("Invalid subject");t.storeProviderAccessToken(p.id,null);let f=await t.unlinkOAuth(`privy:${p.id}`,d);return c(f),f},setActiveWallet:async d=>{let p=u.find(v=>Mo(v.address)===Mo(d)),f=s?.linkedAccounts.find(v=>v.type==="wallet"&&Mo(v.address)===Mo(d));if(!p||!await p.isConnected())j(d),Io();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw U(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Zr(s,15e3)},setWalletRecovery:async()=>Eu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Eu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,f)=>new Promise(async(v,x)=>{let{requesterAppId:F}=p||{};if(!i||!s){U(L,"signMessage","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=f?s?.linkedAccounts.find(ae=>ae.type==="wallet"&&ae.walletClientType==="privy"&&Mo(ae.address)===Mo(f)):xe(s);if(!G){U(L,"signMessage","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(L,"signMessage","onError","invalid_message"),x(new Error("Message must be a non-empty string"));return}ne(!0);let Se=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let ae=await Ce();if(!W||!ae)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:G.address,requesterAppId:F}});let{response:_e}=await W.rpc({accessToken:ae,address:G.address,requesterAppId:F,request:{method:"personal_sign",params:[d,G.address]}}),zt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:G.address,requesterAppId:F}}),zt};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ae=await Se();U(L,"signMessage","onSuccess",ae),v(ae)}catch(ae){U(L,"signMessage","onError","unable_to_sign"),x(ae??new ft("Unable to sign message"))}}else{let _e={method:"personal_sign",data:d,confirmAndSign:Se,onSuccess:Qe=>{U(L,"signMessage","onSuccess",Qe),v(Qe)},onFailure:Qe=>{U(L,"signMessage","onError","unable_to_sign"),x(Qe)},uiOptions:p||{}},zt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{U(L,"signMessage","onError","unknown_connect_wallet_error"),x(Qe)},address:G.address};ee({signMessage:_e,connectWallet:zt}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(f,v)=>{let{requesterAppId:x}=p||{};if(!i||!s){U(L,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=xe(s);if(!F){U(L,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}ne(!0);let G=pa(d),Se=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let ae=await Ce();if(!W||!ae)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:F.address,requesterAppId:x}});let{response:_e}=await W.rpc({accessToken:ae,address:F.address,requesterAppId:x,request:{method:"eth_signTypedData_v4",params:[F.address,G]}}),zt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:F.address,requesterAppId:x}}),zt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ae=await Se();U(L,"signTypedData","onSuccess",ae),f(ae)}catch(ae){U(L,"signTypedData","onError","unable_to_sign"),v(ae??new ft("Unable to sign message"))}}else{let _e={method:"eth_signTypedData_v4",data:G,confirmAndSign:Se,onSuccess:Qe=>{U(L,"signTypedData","onSuccess",Qe),f(Qe)},onFailure:Qe=>{U(L,"signTypedData","onError","unable_to_sign"),v(Qe)},uiOptions:p||{}},zt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Qe=>{U(L,"signMessage","onError","unknown_connect_wallet_error"),v(Qe)}};ee({signMessage:_e,connectWallet:zt}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,f)=>{let x=await(await vu(d,p,f)).wait();return Xl(x)},exportWallet:()=>new Promise(async(d,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!xe(s)){p(new Error("Must have a Privy wallet before exporting"));return}ne(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ee(te),!await Ce()||!W){p(new Error("Must have valid access token to enroll in MFA"));return}if(!W){p(new Error("Must have a Privy wallet before exporting"));return}let F={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:F,connectWallet:v}),me("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Cu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new C("Invalid MFA code");Gt.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((F,G)=>{Yr.current={resolve:F,reject:G}});break;case"passkey":if(typeof p=="string")throw new C("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),x=Qv(v);Gt.current?.resolve({mfaMethod:d,mfaCode:x,relyingParty:window.origin}),await new Promise((F,G)=>{Yr.current={resolve:F,reject:G}});break;default:throw Gt.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${d}`)}},cancel(){Gt.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ce();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,f)=>{if(!d){ie.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."),ee({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:f}}),me("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ce();if(!d||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ce();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(d){let p=await Ce();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Ce();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let f=await t.getAuthenticatedUser();c(f)},async unenroll(d){let p=await Ce();if(!p||!W)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:d,accessToken:p});let f=await t.getAuthenticatedUser();c(f)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Ce(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}ee({farcasterSigner:v}),me("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Ce(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(x=>Uint8Array.from(x.match(/.{1,2}/g).map(F=>parseInt(F,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Ce(),f=s?.linkedAccounts.find(G=>G.type==="wallet"&&G.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let x=await import("@simplewebauthn/browser"),F=await W.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:x.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(x.base64URLStringToBuffer(F.signature))},isHeadlessOAuthLoading:T,loginWithCode(d){return ie.loginWithCode(d)},initLoginWithEmail(d){return ie.initLoginWithEmail(d)},initLoginWithSms(d){return ie.initLoginWithSms(d)},otpState:H,fundWallet(d,p){return ie.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return ie.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return ie.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return ie.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:f,walletClientType:v,connectorType:x}){return ze("siwe"),ie.linkWithSiwe({message:d,signature:p,chainId:f,walletClientType:v,connectorType:x})},signMessageWithCrossAppWallet(d,{address:p}){return id({user:s,client:t,address:p,requesterAppId:O.id,request:{method:"personal_sign",params:[d,p]},reconnect:ys})},signTypedDataWithCrossAppWallet(d,{address:p}){let f=pa(d);return id({user:s,client:t,address:p,requesterAppId:O.id,request:{method:"eth_signTypedData_v4",params:[p,f]},reconnect:ys})},sendTransactionWithCrossAppWallet(d,{address:p}){return id({user:s,client:t,address:p,requesterAppId:O.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:ys})},isModalOpen:r,mfaMethods:O.mfa.methods};Xv=ni.signMessage,e3=ni.signTypedData,t3=async(...d)=>{let p=await vu(...d);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let ie=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:$,pendingTransaction:null,walletConnectionStatus: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:d=>O.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(W)return W;let p=new Promise(x=>{He(()=>F=>x(F))}),f=new Promise(x=>setTimeout(()=>x(null),d)),v=await Promise.race([p,f]);return He(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s,f;p&&V.current&&(f=wu(s)),K.current==="login"?d.shouldCallAuthOnSuccess&&p&&V.current?(U(L,"login","onComplete",s,y,!1,V.current,f??null),e.onSuccess?.(s,y)):U(L,"login","onError","exited_auth_flow"):K.current==="link"&&f&&(d.isSuccess&&p&&V.current?U(L,"linkAccount","onSuccess",s,V.current,f):V.current&&U(L,"linkAccount","onError","exited_link_flow",{linkMethod:V.current})),j(null),K.current=null,V.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:me,connectWallet:ri,initLoginWithWallet:async(d,p)=>{V.current="siwe",fn(d,p)},loginWithWallet:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof wo))throw new C("Must initialize SIWE flow first.");let d,p;if(i)try{({user:d}=await t.link()),V.current="siwe"}catch(f){throw U(L,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),f}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="siwe"}catch(f){throw U(L,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ua(d);t.startAuthFlow(p);try{V.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw K.current==="login"?U(L,"login","onError",f.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),f}},loginWithFarcaster:async()=>{if(!n)throw new vo;if(!(t.authFlow instanceof ua))throw new C("Must initialize Farcaster flow first.");let d,p;if(i)try{({user:d}=await t.link()),V.current="farcaster"}catch(f){throw U(L,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),f}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="farcaster"}catch(f){throw U(L,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let f=`privy:${d}`;V.current=f;let{url:v,stateCode:x,codeVerifier:F}=await jv({api:t.api,appId:d});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new C("No authorization URL returned for cross-app auth.");try{let G=await Zv({url:v,popup:p,provider:f}),Se=G.stateCode,ae=G.authorizationCode;if(Se!==x)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:f,storedStateCode:x??"",returnedStateCode:Se??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ze=await Yv({api:go.api,appId:d,codeVerifier:F,stateCode:Se,authorizationCode:ae});Ze&&t.storeProviderAccessToken(d,Ze);let _e=await ie.refreshUser();if(!_e)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),_e}catch(G){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:G.toString(),provider:f}}),G}},async initLoginWithOAuth(d,p){if(V.current=d,pd()){if(d==="google"&&Wi(window.navigator.userAgent)){ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),J.del(Cn);let f=new Jr({provider:d});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(d==="twitter"&&vS&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(d){if(!n)throw new vo;V.current="telegram";let p=new pi(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((f,v)=>{if(!O.loginConfig.telegramAuthConfiguration)return v(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return v(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:O.loginConfig.telegramAuthConfiguration.botId,request_access:!0},x=>x?f(x):v(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof pi))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(i)try{({user:d}=await t.link()),V.current="telegram"}catch(f){throw U(L,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),f}else try{let f=await t.authenticate();d=f.user,p=f.isNewUser,V.current="telegram"}catch(f){throw K.current==="login"?U(L,"login","onError",f.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),f}c(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,f){let v,x;function F(G){if(!G)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new C("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:G,codeVerifier:Se,stateCode:ae}=await ip({api:go.api,provider:d});F(G);let Ze,_e;try{let zt=await yu({url:G,popup:f,provider:d});if(Ze=zt.stateCode,_e=zt.authorizationCode,Ze!==ae)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:ae??"",returnedStateCode:Ze??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(zt){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:zt.toString(),provider:d}}),new C("Recovery OAuth failed")}[v,x]=await Promise.all([Ce(),fy({api:go.api,provider:d,codeVerifier:Se,stateCode:Ze,authorizationCode:_e})]);break}case"icloud":{let{url:G}=await ip({api:go.api,provider:d});F(G);let{ckWebAuthToken:Se}=await yu({url:G,popup:f,provider:d});x=Se,v=await Ce();break}}if(!W)throw new C("Cannot connect to wallet proxy");if(!v)throw new C("Unable to authorize user");switch(p){case"recover":let G=te.recoverWallet?.privyWallet?.address;if(!G)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:G,recoveryMethod:d}}),await W.recover({address:G,accessToken:v,recoveryAccessToken:x,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:G,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:v,recoveryAccessToken:x,recoveryMethod:d});let Se=await ie.refreshUser(),ae=xe(Se);if(!ae)throw U(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:ae.address}}),U(L,"createWallet","onSuccess",ae);break;case"set-recovery":let Ze=xe(s);if(!Ze)throw U(L,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await W.setRecovery({address:Ze.address,accessToken:v,recoveryAccessToken:x,recoveryMethod:d});let _e=xe(await ie.refreshUser());if(!_e)throw U(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:Ze.address,recoveryMethod:d}}),U(L,"setWalletRecovery","onSuccess",d,_e);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Jr))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=J.get(gn),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:f??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,x,F;if(i)try{let G=await t.link();v=G.user,F=G.oAuthTokens,V.current=d}catch(G){throw U(L,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account",{linkMethod:d}),G}else try{let G=await t.authenticate();v=G.user,x=G.isNewUser,F=G.oAuthTokens,V.current=d}catch(G){throw K.current==="login"?U(L,"login","onError",G.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account",{linkMethod:d}),G}return c(v),b(x||!1),l(!0),F&&v&&U(L,"oAuthAuthorization","onOAuthTokenGrant",F,{user:v}),F},async initLoginWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),K.current="login";try{V.current="passkey",await p.initAuthenticationFlow()}catch(f){throw U(L,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof Tn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d,p;try{V.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(f){throw U(L,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Tn(d);t.startAuthFlow(p),K.current="link",V.current="passkey";try{await p.initLinkFlow()}catch(f){throw U(L,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),f}},async linkWithPasskey(){if(!n)throw new vo;if(!(t.authFlow instanceof Tn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d;try{V.current="passkey",{user:d}=await t.link()}catch(p){throw U(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(pd()){if(d==="google"&&Wi(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Jr({provider:d,headless:!0});p&&f.addCaptchaToken(p);let v=await t.startAuthFlow(f).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){A(!0),t.startAuthFlow(new Jr(d));let p=J.get(gn),f=d.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:f??""}}),A(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,x;if(i)try{({user:v}=await t.link()),V.current=d.provider}catch(F){throw U(L,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),F}else try{({user:v,isNewUser:x}=await t.authenticate()),V.current=d.provider}catch(F){throw K.current==="login"?U(L,"login","onError",F.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),F}return c(v),b(x||!1),l(!0),A(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let f=new Lo(d,p);t.startAuthFlow(f);try{V.current="email",await f.sendCodeEmail()}catch(v){throw K.current==="login"?U(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),v}},initUpdateEmail:async(d,p,f)=>{let v=new xs(d,p,f);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{B({status:"sending-code"});let f=new Sn(d,p);t.startAuthFlow(f);try{V.current="sms",await f.sendSmsCode(),B({status:"awaiting-code-input"})}catch(v){throw B({status:"error",error:v}),K.current==="login"?U(L,"login","onError",v.privyErrorCode||"unknown_auth_error"):K.current==="link"&&U(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(B({status:"submitting-code"}),!n){let v=new vo;throw B({status:"error",error:v}),v}if(t.authFlow instanceof Lo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Sn)t.authFlow.meta.smsCode=d.trim();else{let v=new C("Must initialize a passwordless code flow first");throw B({status:"error",error:v}),v}await Ce();let p,f;if(K.current==="link")try{({user:p}=await t.link())}catch(v){throw B({status:"error",error:v}),U(L,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:V.current}),v}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(v){throw B({status:"error",error:v}),U(L,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),b(f||!1),l(!0),B({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:f})=>{K.current="link",V.current="siwe";let v=await t.generateSiweNonce({address:d,captchaToken:f}),x=p.replace("eip155:","");return el({address:d,chainId:x,nonce:v})},linkWithSiwe:async({message:d,signature:p,chainId:f,walletClientType:v,connectorType:x})=>{let F;try{if(K.current!=="link"||V.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");F=await t.linkWithSiwe({message:d,signature:p,chainId:f,walletClientType:v,connectorType:x});let G=wu(F);G&&U(L,"linkAccount","onSuccess",F,"siwe",G)}catch(G){throw U(L,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),K.current=null,V.current=null,G}c(F||s||null),K.current=null,V.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:W,createAnalyticsEvent:({eventName:d,payload:p,timestamp:f})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:f}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let f=xe(s)||tl(s),v=await Ce();if(!v||!W||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ne(!0);try{await W.connect({accessToken:v,address:f.address}),d(!0)}catch(x){if(Nn(x)&&f.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await W.recover({address:f.address,accessToken:v,recoveryMethod:f.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:f.address}}),d(!0);else if(Nn(x)&&f.recoveryMethod!=="privy"){ee({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:f.recoveryMethod,action:"recover"}});let F=Ul(f.recoveryMethod);me(F)}else p(x)}}),embeddedSolanaWallet:m,createEmbeddedSolanaWallet:async()=>{ne(!0);let d=await Ce(),p=Pn(s),f=xe(s);if(!s||!d)throw new C("User must be logged in to create a Solana wallet");if(p)throw new C("User already has an embedded Solana wallet.");if(f)if(f.recoveryMethod==="privy")await ie.recoverEmbeddedEthereumWallet();else throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let v=await ie.initializeWalletProxy(15e3);if(!v)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await v.createSolana({accessToken:d,ethereumAddress:f?.address});let x=await ie.refreshUser(),F=Pn(x);if(!F)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:F.address}}),F}catch(x){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",x)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let f=Pn(s),v=await Ce();if(!v||!W||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ne(!0);try{await W.connectSolana({accessToken:v,publicKey:f.address}),d(!0)}catch(x){Nn(x)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await W.recoverSolana({publicKey:f.address,accessToken:v})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:f.address}}),d(!0)):p(x)}}),getMoonpaySignedUrl:oi,setReadyToTrue:d=>{a(!0),he?.(d)},updateWallets:()=>Wo(),fundWallet:async(d,p)=>{if(!O.fundingConfig||O.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let f=Jc({fundingMethods:O.fundingConfig.methods});ee({funding:bu({address:d,fundWalletConfig:p,methodScreen:f})}),me(f)},requestFarcasterSignerStatus:async d=>{let p=await Ce(),f=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}return v}}))();r3=ie.recoverEmbeddedEthereumWallet,o3=ie.recoverEmbeddedSolanaWallet;let d3=gS(()=>({wallets:u,ready:pt&&tt}),[u,pt,tt]);return Er(Ee.Provider,{value:ni,children:Er(Ld.Provider,{value:L,children:Er(Ep.Provider,{value:d3,children:Er(Xf,{...O,children:Jv(Wd.Provider,{value:ie,children:[Er(Yh,{children:Jv($f,{data:te,setModalData:ee,setInitialScreen:R,initialScreen:S,authenticated:i,open:r,children:[e.children,!O.headless&&O.captchaEnabled&&n&&!i&&Er(Id,{delayedExecution:!1}),Er(Iv,{theme:{...O.appearance.palette||{}}}),!O.render.standalone&&Er(mu,{open:r})]})}),Ue&&ve?Er($v,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Gt,mfaSubmitPromise:Yr,onLoad:N,onLoadFailed:()=>null}):null,O.loginMethods.telegram&&O.loginConfig.telegramAuthConfiguration&&Er(Ur,{if:!0,children:Er(Gv,{scriptHost:e.apiUrl||Ns,botUsername:O.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as _S}from"react";function xS(e){let{login:t}=_S(Ee);return ke("login",e),{login:t}}import{useContext as AS}from"react";function kS(e){let{logout:t}=AS(Ee);return ke("logout",e),{logout:t}}import{useCallback as n3,useEffect as RS}from"react";function MS(){let e=we(),t=cl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=q(),l=n3(async c=>{if(e.enabled&&e.status!=="success")throw new cr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=n3(async()=>{let c=va();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(u){throw u}finally{En()}},[o]);return RS(()=>{let c=va();a&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as i3}from"react";var IS=()=>{let e=we(),{initLoginWithEmail:t,loginWithCode:r}=q(),o=i3(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=i3(async({code:a})=>{if(e.enabled&&e.status==="error")throw new cr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as a3}from"react";var WS=()=>{let e=we(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=q(),n=a3(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=a3(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new cr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};import{useCallback as s3}from"react";var LS=()=>{let e=we(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=s3(async({address:a,chainId:i})=>{if(!a||!i)throw new Error("wallet address and chainId required to generate nonce");return t({address:a,chainId:i}).then(l=>l)},[t]),n=s3(async({signature:a,message:i,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new cr(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as OS}from"react";function NS(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkTelegram:g,linkFarcaster:w}=OS(Ee);return ke("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkFarcaster:w,linkTelegram:g}}import{useContext as DS}from"react";function US(e){let{connectWallet:t}=DS(Ee);return ke("connectWallet",e),{connectWallet:t}}import{useContext as FS}from"react";function BS(e){let{createWallet:t}=FS(Ee);return ke("createWallet",e),{createWallet:t}}var HS=()=>{let{fundWallet:e}=q();return{fundWallet:e}};var VS=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=I();return{createWallet:t,wallets:e?[e]:[]}};var GS=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as qS}from"react";function zS(e){let{sendTransaction:t}=qS(Ee);return ke("sendTransaction",e),{sendTransaction:t}}import{useContext as $S}from"react";function KS(e){let{setWalletPassword:t}=$S(Ee);return ke("setWalletPassword",e),{setWalletPassword:t}}import{useContext as jS}from"react";function YS(e){let{setWalletRecovery:t}=jS(Ee);return ke("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as ZS}from"react";function QS(e){let{signMessage:t}=ZS(Ee);return ke("signMessage",e),{signMessage:t}}import{useContext as JS}from"react";function XS(e){let{signTypedData:t}=JS(Ee);return ke("signTypedData",e),{signTypedData:t}}import{useContext as eP}from"react";var tP=()=>{let{isModalOpen:e}=eP(Ee);return{isOpen:e}};import{useContext as rP}from"react";function oP(e){let{getAccessToken:t}=rP(Ee);return ke("accessToken",e),{getAccessToken:t}}function nP(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=I(),n=Ei();return ke("oAuthAuthorization",e),{reauthorize:a=>iP(t,r,o,n,a.provider)}}var iP=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new C("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(i=>i.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var aP=l3;function l3(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function sP(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function lP(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Xr as AsExternalProvider,Id as Captcha,Ta as ConnectorManager,mu as LoginModal,Sa as PrivyClient,SS as PrivyProvider,$e as PrivyProxyProvider,ba as SUPPORTED_CHAINS,hd as VERSION,Yt as WalletConnector,sP as addRpcUrlOverrideToChain,op as errorIndicatesMaxMfaRetries,Dn as errorIndicatesMfaTimeout,Un as errorIndicatesMfaVerificationFailed,Ce as getAccessToken,lP as getEmbeddedConnectedWallet,US as useConnectWallet,BS as useCreateWallet,GS as useCrossAppAccounts,aP as useExperimentalFarcasterSigner,l3 as useFarcasterSigner,HS as useFundWallet,NS as useLinkAccount,LS as useLinkWithSiwe,xS as useLogin,IS as useLoginWithEmail,MS as useLoginWithOAuth,WS as useLoginWithSms,kS as useLogout,Xa as useMfa,zr as useMfaEnrollment,tP as useModalStatus,nP as useOAuthTokens,q as usePrivy,Od as useRegisterMfaListener,zS as useSendTransaction,KS as useSetWalletPassword,YS as useSetWalletRecovery,QS as useSignMessage,XS as useSignTypedData,VS as useSolanaWallets,oP as useToken,qr as useWallets};
|
|
3256
|
+
`;import{useRef as Pv,useEffect as Y9}from"react";import{jsx as Q9}from"react/jsx-runtime";function Z9({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function xv(e){let t=Pv(null),r=Pv();return Y9(()=>{r.current?.remove(),r.current=Z9(e),t.current?.after(r.current)},[e]),Q9("div",{ref:t,hidden:!0})}import{useState as J9}from"react";import{useEffect as Av,useRef as kv}from"react";var jc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function dn(e,t,r,o,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new We("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((u,g)=>{r.current={resolve:u,reject:g};let w=1e3*60*5;setTimeout(()=>{let y=new We("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(y),g(y)},w)});return await e(f)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let m=new We("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(m),m}return c}import{jsx as nS}from"react/jsx-runtime";var X9=function(e){return()=>`id-${e++}`}(0);function eS(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function gt(e){return e.error!==void 0}var dt=new jc,ru=new Map,tS=(e,t)=>typeof t=="bigint"?t.toString():t,rS=(e,t)=>`${e}${JSON.stringify(t,tS)}`;function vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=rS(e,t);if(e==="privy:wallet:create"){let l=ru.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=X9();dt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{ru.delete(i)});return ru.set(i,a),a}function oS(e){switch(e.event){case"privy:iframe:ready":let t=dt.dequeue(e.event,e.id);return gt(e)?t.reject(new We(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=dt.dequeue(e.event,e.id);return gt(e)?r.reject(new We(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=dt.dequeue(e.event,e.id);return gt(e)?o.reject(new We(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=dt.dequeue(e.event,e.id);return gt(e)?n.reject(new We(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let i=dt.dequeue(e.event,e.id);return gt(e)?i.reject(new We(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let a=dt.dequeue(e.event,e.id);return gt(e)?a.reject(new We(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery":let l=dt.dequeue(e.event,e.id);return gt(e)?l.reject(new We(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=dt.dequeue(e.event,e.id);return gt(e)?s.reject(new We(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:submit-enrollment":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:unenroll":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:mfa:clear":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:init-signer":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:farcaster:sign":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}case"privy:solana-wallet:create":let c=dt.dequeue(e.event,e.id);return gt(e)?c.reject(new We(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let m=dt.dequeue(e.event,e.id);return gt(e)?m.reject(new We(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let f=dt.dequeue(e.event,e.id);return gt(e)?f.reject(new We(e.error.type,e.error.message)):f.resolve(e.data);case"privy:solana-wallet:rpc":{let u=dt.dequeue(e.event,e.id);return gt(e)?u.reject(new We(e.error.type,e.error.message)):u.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Rv(e){let t=kv(null),r=kv(e.mfaMethods),o=fi(),[n,i]=J9(!1);return Av(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Av(()=>{if(!n)return;let a=t.current;if(!a)return;function l(u){u&&u.origin===e.origin&&eS(u.data)&&oS(u.data)}let s={create(u){return vt("privy:wallet:create",u,a,e.origin)},import(u){return vt("privy:wallet:import",u,a,e.origin)},connect(u){return vt("privy:wallet:connect",u,a,e.origin)},recover(u){return dn(g=>vt("privy:wallet:recover",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!u.recoveryMethod||u.recoveryMethod==="privy")},rpc(u){return dn(g=>vt("privy:wallet:rpc",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(u){return vt("privy:solana-wallet:create",u,a,e.origin)},connectSolana(u){return vt("privy:solana-wallet:connect",u,a,e.origin)},recoverSolana(u){return vt("privy:solana-wallet:recover",u,a,e.origin)},rpcSolana(u){return vt("privy:solana-wallet:rpc",u,a,e.origin)},setRecovery(u){return dn(g=>vt("privy:wallet:set-recovery",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(u){return dn(g=>vt("privy:mfa:verify",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(u){return dn(g=>vt("privy:mfa:init-enrollment",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(u){return dn(g=>vt("privy:mfa:submit-enrollment",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(u){return dn(g=>vt("privy:mfa:unenroll",{...u,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(u){return vt("privy:mfa:clear",u,a,e.origin)},initFarcasterSigner(u){return vt("privy:farcaster:init-signer",u,a,e.origin)},signFarcasterMessage(u){return vt("privy:farcaster:sign",u,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),m=(...u)=>{console.warn("Privy iframe failed to load: ",...u),e.onLoadFailed()},f=new AbortController;return ta(()=>vt("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,m),()=>{window.removeEventListener("message",l),f.abort()}},[n]),nS("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Ts(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var Yc=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t,r){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return(await this.walletProxy.rpcSolana({accessToken:r,publicKey:this.address,request:t})).response.data}async request(t){console.debug("EmbeddedSolanaProvider.request() called with args",t);let r=await we();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await Mv())throw new C("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t,r);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};async function Zc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(i=>i.provider_app_id===r);if(!n)throw new C("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function Iv({api:e,appId:t}){let r=gn(),o=ti(),n=await ri(r);try{let{url:i}=await e.post(hs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:i,stateCode:o,codeVerifier:r}}catch(i){throw le(i)}}async function Wv({api:e,appId:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during cross-app auth flow");try{return(await e.post(ys,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens?.access_token}catch(i){let a=le(i);throw a.privyErrorCode?new C(a.message||"Invalid code during cross-app auth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during cross-app auth flow"?new C("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new C("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}async function Lv({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let a=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",m)}let s,c=setInterval(()=>{t?.closed&&!s&&(l(),clearInterval(c),clearTimeout(a),n(new C("User rejected request")))},300);function m(f){f.data&&(f.data.type==="PRIVY_OAUTH_RESPONSE"&&f.data.stateCode&&f.data.authorizationCode&&(clearTimeout(a),o(f.data),l()),f.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(a),n(new C(f.data.error)),l()),f.data.type==="PRIVY_OAUTH_USE_BROADCAST_CHANNEL"&&(s=new BroadcastChannel("popup-privy-oauth"),s.onmessage=m))}window.addEventListener("message",m)})}var Qc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let a=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(g=>g.address===t)));if(!e||!a)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new C("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(a.providerApp.id),s=await Zc({api:r.api,requesterAppId:n,providerAppId:a.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await i({appId:a.providerApp.id})&&(l=r.getProviderAccessToken(a.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new C("Transactions require a valid token");let c=window.open(void 0,void 0,ou({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");let m=new URL(`${s.apiUrl}/oauth/transact`);return m.searchParams.set("token",l||""),m.searchParams.set("request",iS(o)),c.location=m.href,new Promise((u,g)=>{let y=setTimeout(()=>{A(),g(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{c.closed&&(A(),g(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),P=T=>{T.data&&(T.data.token?.action==="set"&&T.data.token?.value!==void 0?r.storeProviderAccessToken(a.providerApp.id,T.data.token.value):T.data.token?.action==="clear"&&r.storeProviderAccessToken(a.providerApp.id,null),T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(A(),u(T.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),T.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&T.data.error&&(A(),g(T.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:T.data.error,address:t}})))};window.addEventListener("message",P);let A=()=>{c.close(),clearInterval(b),clearTimeout(y),window.removeEventListener("message",P)}})},iS=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),ou=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,a=n/window.screen.availWidth,l=i/window.screen.availHeight,s=(n-e)/2/a+r,c=(i-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${c}`};var aS="https://cdn.apple-cloudkit.com";async function nu({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,i)=>{function a(){t?.close(),window.removeEventListener("message",l)}function l(s){s.data&&(s.data.type==="PRIVY_OAUTH_RESPONSE"&&s.data.stateCode&&s.data.authorizationCode&&(n(s.data),a()),s.origin===aS&&s.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:s.data.ckSession}),a()),s.data.type==="PRIVY_OAUTH_ERROR"&&(i(s.data.error),a()))}window.addEventListener("message",l)})}var Ov=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as Cr,jsxs as Nv}from"react/jsx-runtime";var vo;function mS(e){return typeof e=="string"&&e.length===25}function we(){if(!vo){let e=J.get(un);return Promise.resolve(e||null)}return vo.getAccessToken()}var Dv,Fm=(e,t,r)=>Dv(e,t,r),Uv,Bm=(e,t)=>Uv(e,t),Fv,Hm=(e,t)=>Fv(e,t),Bv,Vm=()=>Bv(),Hv,Mv=()=>Hv(),fS=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;J.put(na,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},hS=({config:e,...t})=>{if(!mS(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");vo||(vo=new ha({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),Cr(Of,{client:vo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Cr(yS,{...t,client:vo})})},yS=e=>{let t=e.client,[r,o]=at(!1),[n,i]=at(!1),[a,l]=at(!1),[s,c]=at(null),[m,f]=at([]),[u,g]=at(null),w=Ji(m),[y,b]=at(!1),[P,A]=at(null),[T,x]=at(!1),[R,M]=at({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[D,B]=at({status:"initial"}),[K,j]=at(null),[L,N]=at(null),W=Ge(),ve=Xs(),[Me,Y]=at(!0),[te,ee]=at({}),[_e,Te]=at(null),[ze,Ve]=at(null),[pt,Fe]=at(!1),[ae,Ft]=at(!1),Rr=Ji(null),jr=Ji(null),O=Ji(Kf),[rt,Mr]=at(!1);t.onStoreToken=d=>{d&&U(O,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(O,"accessToken","onAccessTokenRemoved")};let V=Ji(null),G=Ji(null),ie=d=>{A(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},ut=d=>{W.embeddedWallets.createOnLogin!=="off"&&Y(!0),ie(d)};Kr(()=>{let d=bn(s);if(!d||!L)return;let p={address:d.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Do,id:"io.privy.solana.wallet"},getProvider:async()=>new Yc(L,d.address)};g(p)},[L,s]),Kr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=he(s),p=$s(s);if(d||t.connectors?.removeEmbeddedWalletConnector(),p||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!L){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}d&&t.connectors.addEmbeddedWalletConnector(L,d.address,W.defaultChain,e.appId),p&&t.connectors.addImportedWalletConnector(L,p.address,W.defaultChain,e.appId)},[L,s]),Kr(()=>{L&&ze?.(L)},[L]),Kr(()=>{(async()=>{if(!W.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:h}=W.customAuth;if(!(!n||h))try{let v=await p();if(!v&&a){await Zn.logout();return}if(!v||a)return;t.startAuthFlow(new Jn(v));let{user:k,isNewUser:H}=await t.authenticate();if(!k){await Zn.logout();return}c(k||null),b(H||!1),l(!0),Ft(!0)}catch(v){console.warn(v),a&&await Zn.logout()}})()},[W.customAuth?.enabled,W.customAuth?.getCustomAccessToken,W.customAuth?.isLoading,n,a]),Kr(()=>{ae&&L&&s&&Gt(s,W.embeddedWallets.createOnLogin)&&(Ft(!1),su(s,ei).catch(console.error))},[ae&&L&&s]),Kr(()=>{async function d(){let p=Xi(),h=ns();fS();let v=sS();t.initializeConnectorManager({walletConnectCloudProjectId:W.walletConnectCloudProjectId,rpcConfig:W.rpcConfig,chains:W.chains,defaultChain:W.defaultChain,store:v,walletList:W.appearance.walletList,shouldEnforceDefaultChainOnConnect:W.shouldEnforceDefaultChainOnConnect,externalWalletConfig:W.externalWallets,appName:W.name??"Privy"});let k;t.connectors?.on("connectorInitialized",()=>{k&&clearTimeout(k);let Ce=t.connectors.walletConnectors.length,re=t.connectors.walletConnectors.reduce((Ye,Pe)=>Ye+(Pe.initialized?1:0),0);re===Ce?Mr(!0):k=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:re,expected:Ce}),Mr(!0)},1500)}),t.connectors?.initialize().then(()=>{jv()});let H=await t.getAuthenticatedUser(),z=!!H;if(W.customAuth?.enabled||(l(!!H),H&&U(O,"login","onComplete",H,!1,!0,null,null),c(H)),p){G.current=z?"link":"login";return}if(h&&!z){G.current="login",ut("TELEGRAM_AUTH_SCREEN");return}se.setReadyToTrue(!!H)}!n&&ve&&d()},[t,_e,n,ve]),Kr(()=>{if(!n)return;if(!s){Fe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){Fe(!0);return}let p=!!m.find(h=>h.walletClientType==="privy");Fe(p)},[n,s,m]);let Xi=()=>{let d=ca();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(d.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}let p="privy:";function h(v){return v.startsWith(p)}return d.inProgress&&h(d.provider)&&!d.popupFlow&&(new BroadcastChannel("popup-privy-oauth").postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode}),window.close()),!d.inProgress||d.headless?!1:(t.startAuthFlow(new Zr(d)),ut("AWAITING_OAUTH_SCREEN"),!0)},ns=()=>{let d=Nm();if(!d||!W.loginMethods.telegram||!W.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new oi;return t.startAuthFlow(p),d.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:d.id,first_name:d.first_name,last_name:d.last_name,auth_date:d.auth_date,username:d.username,photo_url:d.photo_url,hash:d.hash}),d.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:d.query_id,user:d.user,auth_date:d.auth_date,hash:d.hash}),!0},Kv=async(d,p,h,v)=>{let k=await t.connectors?.createWalletConnector(d,p)||null;Jc(k,p,h,v)};async function Jc(d,p,h,v){if(d)M({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return M({status:"disconnected",connectedWallet:null,connectError:new ce("Unable to connect to wallet."),connector:null,connectRetry:E}),v?.(null,h);d instanceof Lr&&p&&await d.resetConnection(p),M({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Jc(d,p,h,v)});try{let k=await d.connect({showPrompt:!0});if(W.shouldEnforceDefaultChainOnConnect&&!W.chains.find(H=>H.id===Number(k?.chainId.replace("eip155:","")))&&!(k?.connectorType==="wallet_connect_v2"&&k?.walletClientType==="metamask")){M(H=>({...H,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await k?.switchChain(W.defaultChain.id),k&&(k.chainId=Xn(pn(W.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${W.defaultChain.id}`)}}return M(H=>({...H,status:"connected",connectedWallet:k,connectError:null,connectRetry:E})),k&&U(O,"connectWallet","onSuccess",k),v?.(k,h)}catch(k){return k instanceof et?(console.warn(k.cause?k.cause:k.message),U(O,"connectWallet","onError",k.privyErrorCode||"generic_connect_wallet_error")):(console.warn(k),U(O,"connectWallet","onError","unknown_connect_wallet_error")),M(H=>({...H,status:"disconnected",connectedWallet:null,connectError:k})),v?.(null,h)}}let is=async(d,p)=>{if(d===null)return;let h=new bo(d,t,p);t.startAuthFlow(h)},jv=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!Lo()&&ut("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");ie("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),Kv(p,h,void 0,is)};Kr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let st=d=>{if(!a)throw U(O,"linkAccount","onError","must_be_authenticated",{linkMethod:d}),new C("User must be authenticated before linking an account.")},au=()=>{st("siwe"),V.current="siwe",G.current="link",ie("LINK_WALLET_SCREEN")},Yv=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},Zv=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(M(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),W.captchaEnabled&&!a){let h={callback:v=>is(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:h}),ut("CAPTCHA_SCREEN")}else await is(d),ut("AWAITING_CONNECTION")},Qv=async(d,p)=>{let{signedUrl:h,externalTransactionId:v}=await Dg(t,d,p??{},W.appearance.palette,W.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:h,externalTransactionId:v}},as=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:Yv(h),loginOrLink:async()=>{if(!await h.isConnected())throw new C("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Zv(h)},fund:async v=>{await se.fundWallet(h.address,v)},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(h.address);c(v)}}))||[];return Ks(d,p)?d:p})};Kr(()=>{as()},[s?.linkedAccounts,a,n]),Kr(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");as(),t.connectors.on("walletsUpdated",as)}},[n]);let Jv=d=>{if(d&&"suggestedAddress"in d&&d.suggestedAddress){let p=Io(d.suggestedAddress);j(p)}ie(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Kr(()=>{if(!m[0])return;let d=m[0],p=w.current.find(v=>v.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):h=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&h){let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}w.current=m},[m]);let su=async(d,p)=>{if(he(d))throw U(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,k]=await Promise.all([se.initializeWalletProxy(p),we()]);if(!v&&W.customAuth?.enabled)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!k||W.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((H,z)=>{Y(!0),ee({createWallet:{onSuccess:re=>{U(O,"createWallet","onSuccess",re),H(re)},onFailure:re=>{U(O,"createWallet","onError","unknown_embedded_wallet_error"),z(re)},callAuthOnSuccessOnClose:!1}}),ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:k});let H=await se.refreshUser(),z=he(H);if(!z)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(O,"createWallet","onSuccess",z),z}},Xv=d=>{if(!W.chains.map(p=>p.id).includes(d))throw new ce(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},lu=(d,p,h)=>new Promise(async(v,k)=>{let{requesterAppId:H}=p||{};if(!a||!s){U(O,"sendTransaction","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=d.from,Ce=z?s?.linkedAccounts.find(Ze=>Ze.type==="wallet"&&Ze.walletClientType==="privy"&&Io(Ze.address)===Io(z)):he(s);if(!Ce){U(O,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}Y(!0);let re=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ye=d.chainId?Number(d.chainId):re.chainId;Xv(Ye);let Pe=Object.assign({},d,{chainId:Ye}),Ht=async()=>{let Ze=await we();if(!Ze||!L){U(O,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await se.recoverEmbeddedEthereumWallet()){U(O,"sendTransaction","onError","unknown_connect_wallet_error"),k(new Error("Unable to connect to wallet"));return}let Qn=rr(Pe.chainId,W.chains,W.rpcConfig,{appId:e.appId}),Yr=await uS(Ce.address,Pe,Qn);if(W.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:r3}=await pS(Yr,Qn),{hasSufficientFunds:o3}=await Fi(Ce.address,Yr,r3,Qn);if(!o3)throw new Ct(new Er("Wallet has insufficient funds for this transaction.",dS.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let mu=await zl(Ze,Ce.address,L,Yr,Qn,H);U(O,"sendTransaction","onSuccess",mu),v(mu)}catch(ls){U(O,"sendTransaction","onError","transaction_failure"),k(ls)}};if(W.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ht();else{let Ze={transactionRequest:Pe,onSuccess:Yr=>{U(O,"sendTransaction","onSuccess",Yr),v(Yr)},onFailure:Yr=>{U(O,"sendTransaction","onError","transaction_failure"),k(Yr)},uiOptions:p||{},fundWalletConfig:h,requesterAppId:H},ls={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Yr=>{U(O,"sendTransaction","onError","unknown_connect_wallet_error"),k(Yr)}},Qn=pu({address:Ce.address,fundWalletConfig:h,chainIdOverride:Pe.chainId,comingFromSendTransactionScreen:!0});ee({connectWallet:ls,sendTransaction:Ze,funding:Qn}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function cu(){return new Promise(async(d,p)=>{let h=await we();if(!h||!L)throw new Error("Must have valid access token to enroll in MFA");try{await L.verifyMfa({accessToken:h}),d()}catch(v){p(v)}})}let du=d=>d?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,h)=>h.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],Bt=d=>{let p=s?.linkedAccounts.filter(k=>k.type===d).length??0,{displayName:h,loginMethod:v}=Xo(d);if(d==="passkey"&&p>=5||d!=="passkey"&&p>=1)throw U(O,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:v}),new C(`User already has an account of type ${h} linked.`)},e3=()=>{if(!W.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(O,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:"telegram"}),new C("User can't link an account because Telegram linking is disabled.")},pu=({address:d,fundWalletConfig:p,methodScreen:h,chainIdOverride:v=null,comingFromSendTransactionScreen:k=!1})=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)return;let H=ic(p)&&p.amount?p.amount:W.fundingConfig.defaultRecommendedAmount,z=ic(p)&&p.chain?p.chain.id:Bi(W.fundingConfig.defaultRecommendedCurrency.chain),Ce=ic(p)&&p.chain?p.chain:W.chains.find(re=>re.id===z);if(v&&W.chains.find(re=>re.id===v)&&(Ce=W.chains.find(re=>re.id===v)),!Ce)throw new C("Funding chain is not in PrivyProvider chains list");return{address:d,amount:H,chain:Ce,methodScreen:h,comingFromSendTransactionScreen:k,...Ng(p)?{moonpayConfigOverride:p.config}:{}}};async function uu({legacySetWalletPasswordFlow:d=!1}){A(null);let p=d?"setWalletPassword":"setWalletRecovery";if(!a||!s)throw U(O,p,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let h=he(s);if(!h||!L)throw U(O,p,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(bn(s))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await cu()}catch(k){throw U(O,p,"onError","missing_or_invalid_mfa"),k}return new Promise((k,H)=>{Y(!0);let z={onSuccess:Pe=>{U(O,p,"onSuccess","user-passcode",Pe),k(Pe)},onFailure:Pe=>{U(O,p,"onError","user_exited_set_password_flow"),H(Pe)},callAuthOnSuccessOnClose:!1},Ce=h.recoveryMethod==="user-passcode",Ye={onCompleteNavigateTo:kl({walletAction:"update",availableRecoveryMethods:W.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:d,isResettingPassword:Ce}),shouldForceMFA:!1,onFailure:Pe=>{U(O,p,"onError","unknown_connect_wallet_error"),H(Pe)}};ee({setWalletPassword:z,createWallet:z,connectWallet:Ye,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:Ce}}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function ss({appId:d}){st(`privy:${d}`),V.current=`privy:${d}`,G.current="link";let p=window.open(void 0,void 0,ou({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:d}}),new Promise(async(h,v)=>{let{name:k,logoUrl:H}=await Zc({api:t.api,providerAppId:d,requesterAppId:W.id});ee({crossAppAuth:{appId:d,name:k,logoUrl:H,popup:p,onSuccess:h,onError:v}}),ut("CROSS_APP_AUTH_SCREEN")})}let Zn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Jv,importWallet:async({privateKey:d})=>{st("siwe");let[p,h]=await Promise.all([se.initializeWalletProxy(15e3),we()]);if(p&&h){await p.import({privateKey:d,accessToken:h});let v=await se.refreshUser(),k=$s(v);if(!k)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(O,"createWallet","onSuccess",k),k}else throw new C("User is not authenticated")},linkWallet:au,linkCrossAppAccount:ss,linkEmail:()=>{st("email"),Bt("email"),V.current="email",G.current="link",ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{st("sms"),Bt("phone"),V.current="sms",G.current="link",ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{st("google"),Bt("google_oauth"),G.current="link",await se.initLoginWithOAuth("google")},linkTwitter:async()=>{st("twitter"),Bt("twitter_oauth"),G.current="link",await se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{st("discord"),Bt("discord_oauth"),G.current="link",await se.initLoginWithOAuth("discord")},linkGithub:async()=>{st("github"),Bt("github_oauth"),G.current="link",await se.initLoginWithOAuth("github")},linkSpotify:async()=>{st("spotify"),Bt("spotify_oauth"),G.current="link",await se.initLoginWithOAuth("spotify")},linkInstagram:async()=>{st("instagram"),Bt("instagram_oauth"),G.current="link",await se.initLoginWithOAuth("instagram")},linkTiktok:async()=>{st("tiktok"),Bt("tiktok_oauth"),G.current="link",await se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{st("linkedin"),Bt("linkedin_oauth"),G.current="link",await se.initLoginWithOAuth("linkedin")},linkApple:async()=>{st("apple"),Bt("apple_oauth"),G.current="link",await se.initLoginWithOAuth("apple")},linkPasskey:async()=>{st("passkey"),Bt("passkey"),await se.initLinkWithPasskey(),ie("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{st("telegram"),Bt("telegram"),e3(),G.current="link",V.current="telegram",await se.initLoginWithTelegram(),ie("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{st("farcaster"),Bt("farcaster"),await se.initLoginWithFarcaster(),G.current="link",V.current="farcaster",ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(st("email"),!s?.email)throw new C("User does not have an email linked to their account.");G.current="link",V.current="email",ie("UPDATE_EMAIL_SCREEN")},login:async d=>{d&&"target"in d&&d&&(d=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let h=await new Promise(v=>{Te(k=>v.bind(k))});if(Te(null),h){console.warn(p);return}}if(a){console.warn(p);return}G.current="login",ee({login:d}),ut("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Te(()=>d)}),Te(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(m[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}ut("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),A(null),await t.logout(),s&&L)try{await L.clearMfa({userId:s.id})}catch{}c(null),l(!1),U(O,"logout","onSuccess"),G.current=null,V.current=null,o(!1),J.del(ia)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new $e;let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new $e:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new iu(new Qr(new $e));let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new iu(new Qr(new $e)):new iu(new Qr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new No(new $e);let d=m.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(v=>v.address===d?.address));return!d||!p?new No(new $e):new No(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkTelegram:async d=>{let p=await t.unlinkTelegram(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},unlinkCrossAppAccount:async({subject:d})=>{let p=s?.linkedAccounts.find(v=>v.type==="cross_app"&&v.subject===d)?.providerApp;if(!p)throw new C("Invalid subject");t.storeProviderAccessToken(p.id,null);let h=await t.unlinkOAuth(`privy:${p.id}`,d);return c(h),h},setActiveWallet:async d=>{let p=m.find(v=>Io(v.address)===Io(d)),h=s?.linkedAccounts.find(v=>v.type==="wallet"&&Io(v.address)===Io(d));if(!p||!await p.isConnected())j(d),au();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType,imported:h.imported},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return su(s,15e3)},setWalletRecovery:async()=>uu({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>uu({legacySetWalletPasswordFlow:!0}),signMessage:(d,p,h)=>new Promise(async(v,k)=>{let{requesterAppId:H}=p||{};if(!a||!s){U(O,"signMessage","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=h?s?.linkedAccounts.find(re=>re.type==="wallet"&&re.walletClientType==="privy"&&Io(re.address)===Io(h)):he(s);if(!z){U(O,"signMessage","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(O,"signMessage","onError","invalid_message"),k(new Error("Message must be a non-empty string"));return}Y(!0);let Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!L||!re)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:z.address,requesterAppId:H}});let{response:Pe}=await L.rpc({accessToken:re,address:z.address,requesterAppId:H,request:{method:"personal_sign",params:[d,z.address]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:z.address,requesterAppId:H}}),Ht};if(W.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();U(O,"signMessage","onSuccess",re),v(re)}catch(re){U(O,"signMessage","onError","unable_to_sign"),k(re??new Ct("Unable to sign message"))}}else{let Pe={method:"personal_sign",data:d,confirmAndSign:Ce,onSuccess:Ze=>{U(O,"signMessage","onSuccess",Ze),v(Ze)},onFailure:Ze=>{U(O,"signMessage","onError","unable_to_sign"),k(Ze)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ze=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),k(Ze)},address:z.address};ee({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,v)=>{let{requesterAppId:k}=p||{};if(!a||!s){U(O,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let H=he(s);if(!H){U(O,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Y(!0);let z=ra(d),Ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let re=await we();if(!L||!re)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:H.address,requesterAppId:k}});let{response:Pe}=await L.rpc({accessToken:re,address:H.address,requesterAppId:k,request:{method:"eth_signTypedData_v4",params:[H.address,z]}}),Ht=Pe.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:H.address,requesterAppId:k}}),Ht};if(W.embeddedWallets.noPromptOnSignature||(W.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let re=await Ce();U(O,"signTypedData","onSuccess",re),h(re)}catch(re){U(O,"signTypedData","onError","unable_to_sign"),v(re??new Ct("Unable to sign message"))}}else{let Pe={method:"eth_signTypedData_v4",data:z,confirmAndSign:Ce,onSuccess:Ze=>{U(O,"signTypedData","onSuccess",Ze),h(Ze)},onFailure:Ze=>{U(O,"signTypedData","onError","unable_to_sign"),v(Ze)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ze=>{U(O,"signMessage","onError","unknown_connect_wallet_error"),v(Ze)}};ee({signMessage:Pe,connectWallet:Ht}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let k=await(await lu(d,p,h)).wait();return $l(k)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!he(s)){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ee(te),!await we()||!L){p(new Error("Must have valid access token to enroll in MFA"));return}if(!L){p(new Error("Must have a Privy wallet before exporting"));return}let H={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:H,connectWallet:v}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:cu,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new C("Invalid MFA code");Rr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((H,z)=>{jr.current={resolve:H,reject:z}});break;case"passkey":if(typeof p=="string")throw new C("Invalid authenticator response");let v=await(await import("@simplewebauthn/browser")).startAuthentication(p),k=Ov(v);Rr.current?.resolve({mfaMethod:d,mfaCode:k,relyingParty:window.origin}),await new Promise((H,z)=>{jr.current={resolve:H,reject:z}});break;default:throw Rr.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${d}`)}},cancel(){Rr.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){se.closePrivyModal(),p();return}W.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ee({mfaEnrollmentFlow:{mfaMethods:W.mfa.methods,onSuccess:p,onFailure:h}}),ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await we();if(!d||!L)throw new Error("Must have valid access token to enroll in MFA");let p=await L.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await we();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await we();if(!p||!L)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await L.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await L.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await we(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let v=await L.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}ee({farcasterSigner:v}),ie("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await we(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(k=>Uint8Array.from(k.match(/.{1,2}/g).map(H=>parseInt(H,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await we(),h=s?.linkedAccounts.find(z=>z.type==="wallet"&&z.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await se.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let k=await import("@simplewebauthn/browser"),H=await L.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:k.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(k.base64URLStringToBuffer(H.signature))},isHeadlessOAuthLoading:T,loginWithCode(d){return se.loginWithCode(d)},initLoginWithEmail(d){return se.initLoginWithEmail(d)},initLoginWithSms(d){return se.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return se.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return se.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return se.loginWithHeadlessOAuth(d)},generateSiweMessage({address:d,chainId:p}){return se.generateSiweMessage({address:d,chainId:p})},linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k}){return st("siwe"),se.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k})},signMessageWithCrossAppWallet(d,{address:p}){return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"personal_sign",params:[d,p]},reconnect:ss})},signTypedDataWithCrossAppWallet(d,{address:p}){let h=ra(d);return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_signTypedData_v4",params:[p,h]},reconnect:ss})},sendTransactionWithCrossAppWallet(d,{address:p}){return Qc({user:s,client:t,address:p,requesterAppId:W.id,request:{method:"eth_sendTransaction",params:[d]},reconnect:ss})},isModalOpen:r,mfaMethods:W.mfa.methods};Dv=Zn.signMessage,Uv=Zn.signTypedData,Fv=async(...d)=>{let p=await lu(...d);return W.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let se=(()=>({isNewUserThisSession:y,linkingOrConnectingHint:K,pendingTransaction:null,walletConnectionStatus:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:W.rpcConfig,chains:W.chains,appId:e.appId,showFiatPrices:W.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>W.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(L)return L;let p=new Promise(k=>{Ve(()=>H=>k(H))}),h=new Promise(k=>setTimeout(()=>k(null),d)),v=await Promise.race([p,h]);return Ve(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;p&&V.current&&(h=du(s)),G.current==="login"?d.shouldCallAuthOnSuccess&&p&&V.current?(U(O,"login","onComplete",s,y,!1,V.current,h??null),e.onSuccess?.(s,y)):U(O,"login","onError","exited_auth_flow"):G.current==="link"&&h&&(d.isSuccess&&p&&V.current?U(O,"linkAccount","onSuccess",s,V.current,h):V.current&&U(O,"linkAccount","onError","exited_link_flow",{linkMethod:V.current})),j(null),G.current=null,V.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ie,connectWallet:Jc,initLoginWithWallet:async(d,p)=>{V.current="siwe",is(d,p)},loginWithWallet:async()=>{if(!n)throw new Co;if(!(t.authFlow instanceof bo))throw new C("Must initialize SIWE flow first.");let d,p;if(a)try{({user:d}=await t.link()),V.current="siwe"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="siwe"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new oa(d);t.startAuthFlow(p);try{V.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw G.current==="login"?U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),h}},loginWithFarcaster:async()=>{if(!n)throw new Co;if(!(t.authFlow instanceof oa))throw new C("Must initialize Farcaster flow first.");let d,p;if(a)try{({user:d}=await t.link()),V.current="farcaster"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),h}else try{({user:d,isNewUser:p}=await t.authenticate()),V.current="farcaster"}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),b(p||!1),l(!0)},async crossAppAuthFlow({appId:d,popup:p}){let h=`privy:${d}`;V.current=h;let{url:v,stateCode:k,codeVerifier:H}=await Iv({api:t.api,appId:d});if(!v)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:d}}),new C("No authorization URL returned for cross-app auth.");try{let z=await Lv({url:v,popup:p,provider:h}),Ce=z.stateCode,re=z.authorizationCode;if(Ce!==k)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:h,storedStateCode:k??"",returnedStateCode:Ce??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ye=await Wv({api:vo.api,appId:d,codeVerifier:H,stateCode:Ce,authorizationCode:re});Ye&&t.storeProviderAccessToken(d,Ye);let Pe=await se.refreshUser();if(!Pe)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:d}}),Pe}catch(z){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:z.toString(),provider:h}}),z}},async initLoginWithOAuth(d,p){if(V.current=d,rd()){if(d==="google"&&_i(window.navigator.userAgent)){ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}d==="twitter"&&window.opener&&window.opener.postMessage({type:"PRIVY_OAUTH_USE_BROADCAST_CHANNEL"},"*"),J.del(hn);let h=new Zr({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&(d==="twitter"&&cS&&(v.url=v.url.replace("x.com","twitter.com")),window.location.assign(v.url))},async initLoginWithTelegram(d){if(!n)throw new Co;V.current="telegram";let p=new oi(d);t.startAuthFlow(p),p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult=await new Promise((h,v)=>{if(!W.loginConfig.telegramAuthConfiguration)return v(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return v(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:W.loginConfig.telegramAuthConfiguration.botId,request_access:!0},k=>k?h(k):v(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof oi))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let d,p;if(a)try{({user:d}=await t.link()),V.current="telegram"}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}else try{let h=await t.authenticate();d=h.user,p=h.isNewUser,V.current="telegram"}catch(h){throw G.current==="login"?U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),h}c(d),b(p||!1),l(!0)},async recoveryOAuthFlow(d,p,h){let v,k;function H(z){if(!z)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new C("Recovery OAuth failed")}switch(d){case"google-drive":{let{url:z,codeVerifier:Ce,stateCode:re}=await Qd({api:vo.api,provider:d});H(z);let Ye,Pe;try{let Ht=await nu({url:z,popup:h,provider:d});if(Ye=Ht.stateCode,Pe=Ht.authorizationCode,Ye!==re)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:re??"",returnedStateCode:Ye??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(Ht){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ht.toString(),provider:d}}),new C("Recovery OAuth failed")}[v,k]=await Promise.all([we(),ny({api:vo.api,provider:d,codeVerifier:Ce,stateCode:Ye,authorizationCode:Pe})]);break}case"icloud":{let{url:z}=await Qd({api:vo.api,provider:d});H(z);let{ckWebAuthToken:Ce}=await nu({url:z,popup:h,provider:d});k=Ce,v=await we();break}}if(!L)throw new C("Cannot connect to wallet proxy");if(!v)throw new C("Unable to authorize user");switch(p){case"recover":let z=te.recoverWallet?.privyWallet?.address;if(!z)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:z,recoveryMethod:d}}),await L.recover({address:z,accessToken:v,recoveryAccessToken:k,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:z,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await L.create({accessToken:v,recoveryAccessToken:k,recoveryMethod:d});let Ce=await se.refreshUser(),re=he(Ce);if(!re)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:re.address}}),U(O,"createWallet","onSuccess",re);break;case"set-recovery":let Ye=he(s);if(!Ye)throw U(O,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:d}}),await L.setRecovery({address:Ye.address,accessToken:v,recoveryAccessToken:k,recoveryMethod:d});let Pe=he(await se.refreshUser());if(!Pe)throw U(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:Ye.address,recoveryMethod:d}}),U(O,"setWalletRecovery","onSuccess",d,Pe);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof Zr))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=J.get(mn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,k,H;if(a)try{let z=await t.link();v=z.user,H=z.oAuthTokens,V.current=d}catch(z){throw U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:d}),z}else try{let z=await t.authenticate();v=z.user,k=z.isNewUser,H=z.oAuthTokens,V.current=d}catch(z){throw G.current==="login"?U(O,"login","onError",z.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:d}),z}return c(v),b(k||!1),l(!0),H&&v&&U(O,"oAuthAuthorization","onOAuthTokenGrant",H,{user:v}),H},async initLoginWithPasskey(d){let p=new Cn(d);t.startAuthFlow(p),G.current="login";try{V.current="passkey",await p.initAuthenticationFlow()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new Co;if(!(t.authFlow instanceof Cn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d,p;try{V.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw U(O,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Cn(d);t.startAuthFlow(p),G.current="link",V.current="passkey";try{await p.initLinkFlow()}catch(h){throw U(O,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),h}},async linkWithPasskey(){if(!n)throw new Co;if(!(t.authFlow instanceof Cn))throw new C("Must initialize Passkey flow first.");if(V.current!=="passkey")throw new C("Must init login with Passkey flow first.");let d;try{V.current="passkey",{user:d}=await t.link()}catch(p){throw U(O,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(rd()){if(d==="google"&&_i(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new Zr({provider:d,headless:!0});p&&h.addCaptchaToken(p);let v=await t.startAuthFlow(h).getAuthorizationUrl();v?.url&&window.location.assign(v.url)},async loginWithHeadlessOAuth(d){x(!0),t.startAuthFlow(new Zr(d));let p=J.get(mn),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),x(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let v,k;if(a)try{({user:v}=await t.link()),V.current=d.provider}catch(H){throw U(O,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),H}else try{({user:v,isNewUser:k}=await t.authenticate()),V.current=d.provider}catch(H){throw G.current==="login"?U(O,"login","onError",H.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",H.privyErrorCode||"failed_to_link_account",{linkMethod:d.provider}),H}return c(v),b(k||!1),l(!0),x(!1),v??void 0},initLoginWithEmail:async(d,p)=>{let h=new Wo(d,p);t.startAuthFlow(h);try{V.current="email",await h.sendCodeEmail()}catch(v){throw G.current==="login"?U(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),v}},initUpdateEmail:async(d,p,h)=>{let v=new vs(d,p,h);t.startAuthFlow(v),await v.sendCodeEmail()},initLoginWithSms:async(d,p)=>{B({status:"sending-code"});let h=new wn(d,p);t.startAuthFlow(h);try{V.current="sms",await h.sendSmsCode(),B({status:"awaiting-code-input"})}catch(v){throw B({status:"error",error:v}),G.current==="login"?U(O,"login","onError",v.privyErrorCode||"unknown_auth_error"):G.current==="link"&&U(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(B({status:"submitting-code"}),!n){let v=new Co;throw B({status:"error",error:v}),v}if(t.authFlow instanceof Wo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof wn)t.authFlow.meta.smsCode=d.trim();else{let v=new C("Must initialize a passwordless code flow first");throw B({status:"error",error:v}),v}await we();let p,h;if(G.current==="link")try{({user:p}=await t.link())}catch(v){throw B({status:"error",error:v}),U(O,"linkAccount","onError",v.privyErrorCode||"failed_to_link_account",{linkMethod:V.current}),v}else try{({user:p,isNewUser:h}=await t.authenticate())}catch(v){throw B({status:"error",error:v}),U(O,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}c(p||s||null),b(h||!1),l(!0),B({status:"done"})},generateSiweMessage:async({address:d,chainId:p,captchaToken:h})=>{G.current="link",V.current="siwe";let v=await t.generateSiweNonce({address:d,captchaToken:h}),k=p.replace("eip155:","");return zs({address:d,chainId:k,nonce:v})},linkWithSiwe:async({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k})=>{let H;try{if(G.current!=="link"||V.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");H=await t.linkWithSiwe({message:d,signature:p,chainId:h,walletClientType:v,connectorType:k});let z=du(H);z&&U(O,"linkAccount","onSuccess",H,"siwe",z)}catch(z){throw U(O,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),G.current=null,V.current=null,z}c(H||s||null),G.current=null,V.current=null},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:L,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedEthereumWallet:async()=>new Promise(async(d,p)=>{let h=he(s)||$s(s),v=await we();if(!v||!L||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await L.connect({accessToken:v,address:h.address}),d(!0)}catch(k){if(In(k)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await L.recover({address:h.address,accessToken:v,recoveryMethod:h.recoveryMethod})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(In(k)&&h.recoveryMethod!=="privy"){ee({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:h.recoveryMethod,action:"recover"}});let H=Rl(h.recoveryMethod);ie(H)}else p(k)}}),embeddedSolanaWallet:u,createEmbeddedSolanaWallet:async()=>{Y(!0);let d=await we(),p=bn(s),h=he(s);if(!s||!d)throw new C("User must be logged in to create a Solana wallet");if(p)throw new C("User already has an embedded Solana wallet.");if(h)if(h.recoveryMethod==="privy")await se.recoverEmbeddedEthereumWallet();else throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let v=await se.initializeWalletProxy(15e3);if(!v)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await v.createSolana({accessToken:d,ethereumAddress:h?.address});let k=await se.refreshUser(),H=bn(k);if(!H)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:H.address}}),H}catch(k){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",k)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(d,p)=>{let h=bn(s),v=await we();if(!v||!L||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await L.connectSolana({accessToken:v,publicKey:h.address}),d(!0)}catch(k){In(k)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await L.recoverSolana({publicKey:h.address,accessToken:v})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0)):p(k)}}),getMoonpaySignedUrl:Qv,setReadyToTrue:d=>{i(!0),_e?.(d)},updateWallets:()=>as(),fundWallet:async(d,p)=>{if(!W.fundingConfig||W.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let h=Gc({fundingMethods:W.fundingConfig.methods});ee({funding:pu({address:d,fundWalletConfig:p,methodScreen:h})}),ie(h)},requestFarcasterSignerStatus:async d=>{let p=await we(),h=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!L||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let v=await t.requestFarcasterSignerStatus(d);if(v.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}return v}}))();Bv=se.recoverEmbeddedEthereumWallet,Hv=se.recoverEmbeddedSolanaWallet;let t3=lS(()=>({wallets:m,ready:pt&&rt}),[m,pt,rt]);return Cr(Se.Provider,{value:Zn,children:Cr(Pd.Provider,{value:O,children:Cr(fp.Provider,{value:t3,children:Cr(qf,{...W,children:Nv(_d.Provider,{value:se,children:[Cr(Fh,{children:Nv(Df,{data:te,setModalData:ee,setInitialScreen:A,initialScreen:P,authenticated:a,open:r,children:[e.children,!W.headless&&W.captchaEnabled&&n&&!a&&Cr(Sd,{delayedExecution:!1}),Cr(yv,{theme:{...W.appearance.palette||{}}}),!W.render.standalone&&Cr(tu,{open:r})]})}),Me&&ve?Cr(Rv,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Rr,mfaSubmitPromise:jr,onLoad:N,onLoadFailed:()=>null}):null,W.loginMethods.telegram&&W.loginConfig.telegramAuthConfiguration&&Cr(Dr,{if:!0,children:Cr(xv,{scriptHost:e.apiUrl||xs,botUsername:W.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useContext as gS}from"react";function vS(e){let{login:t}=gS(Se);return ke("login",e),{login:t}}import{useContext as CS}from"react";function wS(e){let{logout:t}=CS(Se);return ke("logout",e),{logout:t}}import{useCallback as Vv,useEffect as bS}from"react";function ES(){let e=be(),t=Xs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=q(),l=Vv(async c=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=Vv(async()=>{let c=ca();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(m){throw m}finally{vn()}},[o]);return bS(()=>{let c=ca();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Gv}from"react";var TS=()=>{let e=be(),{initLoginWithEmail:t,loginWithCode:r}=q(),o=Gv(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=Gv(async({code:i})=>{if(e.enabled&&e.status==="error")throw new nr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as qv}from"react";var SS=()=>{let e=be(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=q(),n=qv(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=qv(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};import{useCallback as zv}from"react";var _S=()=>{let e=be(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=zv(async({address:i,chainId:a})=>{if(!i||!a)throw new Error("wallet address and chainId required to generate nonce");return t({address:i,chainId:a}).then(l=>l)},[t]),n=zv(async({signature:i,message:a,chainId:l,walletClientType:s,connectorType:c})=>{if(e.enabled&&e.status!=="success")throw new nr(e.error,null,"captcha_failure");return r({message:a,signature:i,chainId:l,walletClientType:s,connectorType:c})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as PS}from"react";function xS(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkTelegram:g,linkFarcaster:w}=PS(Se);return ke("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:m,linkSpotify:f,linkInstagram:u,linkFarcaster:w,linkTelegram:g}}import{useContext as AS}from"react";function kS(e){let{connectWallet:t}=AS(Se);return ke("connectWallet",e),{connectWallet:t}}import{useContext as RS}from"react";function MS(e){let{createWallet:t}=RS(Se);return ke("createWallet",e),{createWallet:t}}var IS=()=>{let{fundWallet:e}=q();return{fundWallet:e}};var WS=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=I();return{createWallet:t,wallets:e?[e]:[]}};var LS=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as OS}from"react";function NS(e){let{sendTransaction:t}=OS(Se);return ke("sendTransaction",e),{sendTransaction:t}}import{useContext as DS}from"react";function US(e){let{setWalletPassword:t}=DS(Se);return ke("setWalletPassword",e),{setWalletPassword:t}}import{useContext as FS}from"react";function BS(e){let{setWalletRecovery:t}=FS(Se);return ke("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as HS}from"react";function VS(e){let{signMessage:t}=HS(Se);return ke("signMessage",e),{signMessage:t}}import{useContext as GS}from"react";function qS(e){let{signTypedData:t}=GS(Se);return ke("signTypedData",e),{signTypedData:t}}import{useContext as zS}from"react";var $S=()=>{let{isModalOpen:e}=zS(Se);return{isOpen:e}};import{useContext as KS}from"react";function jS(e){let{getAccessToken:t}=KS(Se);return ke("accessToken",e),{getAccessToken:t}}function YS(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=I(),n=fi();return ke("oAuthAuthorization",e),{reauthorize:i=>ZS(t,r,o,n,i.provider)}}var ZS=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new C("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(a=>a.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var QS=$v;function $v(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function JS(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function XS(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}export{Qr as AsExternalProvider,Sd as Captcha,fa as ConnectorManager,tu as LoginModal,ha as PrivyClient,hS as PrivyProvider,$e as PrivyProxyProvider,ua as SUPPORTED_CHAINS,sd as VERSION,zt as WalletConnector,JS as addRpcUrlOverrideToChain,Yd as errorIndicatesMaxMfaRetries,Wn as errorIndicatesMfaTimeout,Ln as errorIndicatesMfaVerificationFailed,we as getAccessToken,XS as getEmbeddedConnectedWallet,kS as useConnectWallet,MS as useCreateWallet,LS as useCrossAppAccounts,QS as useExperimentalFarcasterSigner,$v as useFarcasterSigner,IS as useFundWallet,xS as useLinkAccount,_S as useLinkWithSiwe,vS as useLogin,TS as useLoginWithEmail,ES as useLoginWithOAuth,SS as useLoginWithSms,wS as useLogout,Va as useMfa,qr as useMfaEnrollment,$S as useModalStatus,YS as useOAuthTokens,q as usePrivy,xd as useRegisterMfaListener,NS as useSendTransaction,US as useSetWalletPassword,BS as useSetWalletRecovery,VS as useSignMessage,qS as useSignTypedData,WS as useSolanaWallets,jS as useToken,Gr as useWallets};
|