@privy-io/react-auth 1.72.0 → 1.72.1-beta-20240621181936
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 +70 -70
- package/dist/index.js +50 -50
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Uv=Object.create;var Ls=Object.defineProperty;var Fv=Object.getOwnPropertyDescriptor;var Bv=Object.getOwnPropertyNames;var Hv=Object.getPrototypeOf,Vv=Object.prototype.hasOwnProperty;var Gv=(e,t)=>{for(var r in t)Ls(e,r,{get:t[r],enumerable:!0})},eu=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Bv(t))!Vv.call(e,n)&&n!==r&&Ls(e,n,{get:()=>t[n],enumerable:!(o=Fv(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?Uv(Hv(e)):{},eu(t||!e||!e.__esModule?Ls(r,"default",{value:e,enumerable:!0}):r,e)),qv=e=>eu(Ls({},"__esModule",{value:!0}),e);var ap=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var tu=(e,t,r)=>(ap(e,t,"read from private field"),r?r.call(e):t.get(e)),Ns=(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)},sp=(e,t,r,o)=>(ap(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ru=(e,t,r)=>(ap(e,t,"access private method"),r);var d6={};Gv(d6,{AsExternalProvider:()=>no,Captcha:()=>Rl,ConnectorManager:()=>Bi,LoginModal:()=>Zc,PrivyClient:()=>Hi,PrivyProvider:()=>J3,PrivyProxyProvider:()=>it,SUPPORTED_CHAINS:()=>Ui,VERSION:()=>tl,WalletConnector:()=>ar,addRpcUrlOverrideToChain:()=>Wv,errorIndicatesMaxMfaRetries:()=>Zl,errorIndicatesMfaTimeout:()=>bn,errorIndicatesMfaVerificationFailed:()=>En,getAccessToken:()=>Te,getEmbeddedConnectedWallet:()=>Mv,useConnectWallet:()=>pv,useCreateWallet:()=>uv,useCrossAppAccounts:()=>hv,useExperimentalFarcasterSigner:()=>Iv,useFundWallet:()=>mv,useLinkAccount:()=>lv,useLinkWithSiwe:()=>av,useLogin:()=>ev,useLoginWithEmail:()=>nv,useLoginWithOAuth:()=>ov,useLoginWithSms:()=>iv,useLogout:()=>rv,useMfa:()=>ga,useMfaEnrollment:()=>eo,useModalStatus:()=>xv,useOAuthTokens:()=>Rv,usePrivy:()=>G,useRegisterMfaListener:()=>Ol,useSendTransaction:()=>gv,useSetWalletPassword:()=>Cv,useSetWalletRecovery:()=>bv,useSignMessage:()=>Tv,useSignTypedData:()=>Sv,useSolanaWallets:()=>fv,useToken:()=>kv,useWallets:()=>Ea});module.exports=qv(d6);var Fn=require("@ethersproject/address"),rp=require("@ethersproject/providers"),z3=require("mipd"),ce=require("react"),$3=require("react-device-detect"),Aa=require("@privy-io/js-sdk-core");var ou=require("ofetch"),yt=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},xr=class extends yt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},C=class extends yt{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 ye=class extends yt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof yt)return e;if(!(e instanceof ou.FetchError))return St(e);if(!e.response)return new xr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new xr(t||"ApiError",e.response.status,r||o,e,n)},St=e=>e instanceof yt?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var Go=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},nr=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Us=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hr=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 Fs="/api/v1/sessions",Bs="/api/v1/sessions/logout",nu="/api/v1/sessions/fork",Hs="/api/v1/sessions/fork/recover",iu="/api/v1/siwe/init",au="/api/v1/siwe/authenticate",su="/api/v1/siwe/link",lu="/api/v1/siwe/unlink",cu="/api/v1/farcaster/init",pu="/api/v1/farcaster/authenticate",du="/api/v1/farcaster/link",uu="/api/v1/farcaster/status",mu="/api/v1/farcaster/unlink",fu="/api/v1/passwordless/init",hu="/api/v1/passwordless/authenticate",yu="/api/v1/passwordless/link",gu="/api/v1/passwordless/unlink",vu="/api/v1/passwordless/update",Cu="/api/v1/passwordless_sms/init",wu="/api/v1/passwordless_sms/link",bu="/api/v1/passwordless_sms/unlink",Eu="/api/v1/passwordless_sms/authenticate",Vs="/api/v1/oauth/init",Tu="/api/v1/oauth/authenticate",Gs="/api/v1/oauth/link",Pu="/api/v1/oauth/unlink",Su="/api/v1/recovery/oauth/init",_u="/api/v1/recovery/oauth/init_icloud",xu="/api/v1/recovery/oauth/authenticate",Au="/api/v1/passkeys/link/init",ku="/api/v1/passkeys/authenticate/init",Ru="/api/v1/passkeys/link",Iu="/api/v1/passkeys/authenticate",Wu="/api/v1/passkeys/unlink",Mu="/api/v1/telegram/authenticate",Ou="/api/v1/telegram/link",Lu="/api/v1/telegram/unlink";var Nu="/api/v1/mfa/passwordless_sms/init",Du="/api/v1/mfa/passkeys/init",Uu="/api/v1/users/me/accept_terms",qs="/api/v1/analytics_events",Fu="/api/v1/plugins/moonpay_on_ramp/sign",Bu="/api/v1/custom_jwt_account/authenticate";var wi=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(Bu,{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 ue(t)}}async link(){throw new Error("Unimplemented")}};var un=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(hu,{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 ue(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(yu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(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(fu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},zs=class extends un{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(vu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};var el=require("react-device-detect");var lp=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)}},$s=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 cp(){try{let e="privy:__session_storage__test",t="blobby",r=new $s;return r.put(e,t),r.del(e),!0}catch{return!1}}function zv(){return typeof window<"u"&&window.localStorage?new $s:new lp}var oe=zv();var bi=require("@ethersproject/providers");function Hu(){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 pp=(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(!pp(r))return!1}return!0},mn=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),js=()=>{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 Vu=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ys=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Gu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Vr=(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}`},dp=e=>new Promise(t=>setTimeout(t,e));function qu(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 Ia=(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 dp(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Zs=(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 zu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Vn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function $u(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(),p=[];for(let u of s)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||p.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of Hu()){let h=Ks(u);if(!s.some(m=>m.info.name===h)){if(pp(u,!0)&&!p.find(m=>m.type==="metamask")){p.push({type:"metamask",legacyInjectedProvider:u});continue}if(h==="Phantom"&&!p.find(m=>m.type==="phantom")){p.push({type:"phantom",legacyInjectedProvider:u});continue}if(h==="Coinbase Wallet"&&!p.find(m=>m.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){p.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}p.find(m=>m.type==="unknown_browser_extension")||p.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}i(p)}})}function Ei(e){return`eip155:${String(Number(e))}`}var Ku=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ye(`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 ye(`No RPC url found for ${e}`);return i},ju=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ye(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},qo=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ye(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new bi.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new bi.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new bi.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.public?.http[0]?i=new bi.StaticJsonRpcProvider(a.rpcUrls.public.http[0]):i=new bi.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new ye(`No RPC url found for ${e}`);return i},Wa=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 Qs=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Js))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Js={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 $v(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Yu(e,t){let r=$v(t);if(r.deepLink)return em(r.deepLink,e);if(r.universalLink)return tm(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}var Zu="WALLETCONNECT_DEEPLINK_CHOICE";function Qu(){try{localStorage.removeItem(Zu)}catch{}}function Ju({href:e,name:t}){try{localStorage.setItem(Zu,JSON.stringify({href:e,name:t}))}catch{}}function Xu(e){return e.startsWith("http://")||e.startsWith("https://")}function em(e,t){if(Xu(e))return tm(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 tm(e,t){if(!Xu(e))return em(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Xs(e,t){window.open(e,t,"noreferrer noopener")}var nt=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Ma=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new 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(pu,{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 ue(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(du,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(cu,{token:this.captchaToken});el.isMobile&&!el.isIOS&&t.connect_uri&&Xs(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(uu,{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 rm="1.72.0";var om="34357d3c125c2bcf2ce2bc3309d98715",Oa="https://auth.privy.io",nm=2e4,et=1400,im=2500,tl=rm;var Gn="privy:token",up="privy-token",rl="privy:refresh_token",am="privy-refresh-token",ol="privy-session",La="privy:session_transfer_token",jv="privy:wallet",Na="privy:caid",Da=e=>`privy:cross-app:${e}`,qn="privy:state_code",zn="privy:code_verifier",$n="privy:headless_oauth",nl=e=>`${jv}:${e}`,mp="privy:connectors",fp="privy:connections";var Kn=12e4,zo=1,hp="0x1",Ti=3e4,sm="https://api.moonpay.com/v1",lm="https://api.moonpay.com/v1",cm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",pm="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var dm="deprecated";var yp=require("jose");async function um(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function mm(e){return crypto.getRandomValues(new Uint8Array(e))}var Yv="S256",Zv="S256";function jn(){return yp.base64url.encode(mm(36))}function Pi(){return jn()}async function Si(e,t=Yv){if(t==Zv){let r=await um(e);return yp.base64url.encode(r)}else return e}function fm(){let e=oe.get(zn);if(!e)throw new C("Authentication error.");return e}function il(){return!!oe.get($n)}var bo=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:il();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=fm();try{let r=await this.api.post(Tu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(zn),this.meta.headless&&oe.del($n),{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=ue(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=oe.get(zn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(Gs,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(zn),r}catch(r){throw ue(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=jn();oe.put(zn,t);let r=Pi();oe.put(qn,r);let o=await Si(t);this.meta.headless&&oe.put($n,!0);try{return await this.api.post(Vs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function gp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ua=require("react/jsx-runtime"),al=({style:e,...t})=>(0,Ua.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,Ua.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,Ua.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var fn=require("react/jsx-runtime"),sl=({style:e,...t})=>(0,fn.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,fn.jsx)("g",{clipPath:"url(#clip0)",children:(0,fn.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,fn.jsx)("defs",{children:(0,fn.jsx)("clipPath",{id:"clip0",children:(0,fn.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var vp=require("react/jsx-runtime"),ll=({style:e,...t})=>(0,vp.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,vp.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});var Yn=require("react/jsx-runtime"),cl=({style:e,...t})=>(0,Yn.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,Yn.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,Yn.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,Yn.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,Yn.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var Rt=require("react/jsx-runtime");function pl(e){return(0,Rt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[(0,Rt.jsxs)("defs",{children:[(0,Rt.jsxs)("linearGradient",{id:"b",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,Rt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,Rt.jsxs)("linearGradient",{id:"a",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,Rt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,Rt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,Rt.jsx)("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),(0,Rt.jsx)("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),(0,Rt.jsx)("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,Rt.jsx)("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,Rt.jsx)("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}var Fa=require("react/jsx-runtime");function dl({style:e,...t}){return(0,Fa.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,Fa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Fa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Fa.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var Ba=require("react/jsx-runtime");function ul(e){return(0,Ba.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,Ba.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,Ba.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var _i=require("react/jsx-runtime");function ml(e){return(0,_i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,_i.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,_i.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,_i.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var Cp=require("react/jsx-runtime"),fl=({style:e,...t})=>(0,Cp.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,Cp.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Qv={google:{name:"Google",component:cl},discord:{name:"Discord",component:sl},github:{name:"Github",component:ll},linkedin:{name:"LinkedIn",component:dl},twitter:{name:"Twitter",component:fl},spotify:{name:"Spotify",component:ul},instagram:{name:"Instagram",component:pl},tiktok:{name:"Tiktok",component:ml},apple:{name:"Apple",component:al}},Ha=e=>Qv[e];function hm(e,t){let r={detail:"",retryable:!1},o=gp(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=Ha(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Ha(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."),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:il(),popupFlow:window.opener!==null&&n}}function Zn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),oe.del(qn),window.history.replaceState({},"",e)}var Qn=class{constructor(t){this.initAuthenticateOnce=new nt(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new nt(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(Iu,{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"):ue(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(Ru,{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"):ue(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(ku,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Au,{})}_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 hl=({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
|
+
"use strict";var U3=Object.create;var Ls=Object.defineProperty;var F3=Object.getOwnPropertyDescriptor;var B3=Object.getOwnPropertyNames;var H3=Object.getPrototypeOf,V3=Object.prototype.hasOwnProperty;var G3=(e,t)=>{for(var r in t)Ls(e,r,{get:t[r],enumerable:!0})},eu=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of B3(t))!V3.call(e,n)&&n!==r&&Ls(e,n,{get:()=>t[n],enumerable:!(o=F3(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?U3(H3(e)):{},eu(t||!e||!e.__esModule?Ls(r,"default",{value:e,enumerable:!0}):r,e)),q3=e=>eu(Ls({},"__esModule",{value:!0}),e);var ap=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var tu=(e,t,r)=>(ap(e,t,"read from private field"),r?r.call(e):t.get(e)),Ns=(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)},sp=(e,t,r,o)=>(ap(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ru=(e,t,r)=>(ap(e,t,"access private method"),r);var d6={};G3(d6,{AsExternalProvider:()=>no,Captcha:()=>Rl,ConnectorManager:()=>Bi,LoginModal:()=>Zc,PrivyClient:()=>Hi,PrivyProvider:()=>Jv,PrivyProxyProvider:()=>it,SUPPORTED_CHAINS:()=>Ui,VERSION:()=>tl,WalletConnector:()=>ar,addRpcUrlOverrideToChain:()=>W3,errorIndicatesMaxMfaRetries:()=>Zl,errorIndicatesMfaTimeout:()=>bn,errorIndicatesMfaVerificationFailed:()=>En,getAccessToken:()=>Te,getEmbeddedConnectedWallet:()=>M3,useConnectWallet:()=>p3,useCreateWallet:()=>u3,useCrossAppAccounts:()=>h3,useExperimentalFarcasterSigner:()=>I3,useFundWallet:()=>m3,useLinkAccount:()=>l3,useLinkWithSiwe:()=>a3,useLogin:()=>e3,useLoginWithEmail:()=>n3,useLoginWithOAuth:()=>o3,useLoginWithSms:()=>i3,useLogout:()=>r3,useMfa:()=>ga,useMfaEnrollment:()=>eo,useModalStatus:()=>x3,useOAuthTokens:()=>R3,usePrivy:()=>G,useRegisterMfaListener:()=>Ol,useSendTransaction:()=>g3,useSetWalletPassword:()=>C3,useSetWalletRecovery:()=>b3,useSignMessage:()=>T3,useSignTypedData:()=>S3,useSolanaWallets:()=>f3,useToken:()=>k3,useWallets:()=>Ea});module.exports=q3(d6);var Fn=require("@ethersproject/address"),rp=require("@ethersproject/providers"),zv=require("mipd"),ce=require("react"),$v=require("react-device-detect"),Aa=require("@privy-io/js-sdk-core");var ou=require("ofetch"),yt=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},xr=class extends yt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},C=class extends yt{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 ye=class extends yt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof yt)return e;if(!(e instanceof ou.FetchError))return St(e);if(!e.response)return new xr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new xr(t||"ApiError",e.response.status,r||o,e,n)},St=e=>e instanceof yt?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var Go=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},nr=class extends C{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Us=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hr=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 Fs="/api/v1/sessions",Bs="/api/v1/sessions/logout",nu="/api/v1/sessions/fork",Hs="/api/v1/sessions/fork/recover",iu="/api/v1/siwe/init",au="/api/v1/siwe/authenticate",su="/api/v1/siwe/link",lu="/api/v1/siwe/unlink",cu="/api/v1/farcaster/init",pu="/api/v1/farcaster/authenticate",du="/api/v1/farcaster/link",uu="/api/v1/farcaster/status",mu="/api/v1/farcaster/unlink",fu="/api/v1/passwordless/init",hu="/api/v1/passwordless/authenticate",yu="/api/v1/passwordless/link",gu="/api/v1/passwordless/unlink",vu="/api/v1/passwordless/update",Cu="/api/v1/passwordless_sms/init",wu="/api/v1/passwordless_sms/link",bu="/api/v1/passwordless_sms/unlink",Eu="/api/v1/passwordless_sms/authenticate",Vs="/api/v1/oauth/init",Tu="/api/v1/oauth/authenticate",Gs="/api/v1/oauth/link",Pu="/api/v1/oauth/unlink",Su="/api/v1/recovery/oauth/init",_u="/api/v1/recovery/oauth/init_icloud",xu="/api/v1/recovery/oauth/authenticate",Au="/api/v1/passkeys/link/init",ku="/api/v1/passkeys/authenticate/init",Ru="/api/v1/passkeys/link",Iu="/api/v1/passkeys/authenticate",Wu="/api/v1/passkeys/unlink",Mu="/api/v1/telegram/authenticate",Ou="/api/v1/telegram/link",Lu="/api/v1/telegram/unlink";var Nu="/api/v1/mfa/passwordless_sms/init",Du="/api/v1/mfa/passkeys/init",Uu="/api/v1/users/me/accept_terms",qs="/api/v1/analytics_events",Fu="/api/v1/plugins/moonpay_on_ramp/sign",Bu="/api/v1/custom_jwt_account/authenticate";var wi=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(Bu,{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 ue(t)}}async link(){throw new Error("Unimplemented")}};var un=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(hu,{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 ue(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(yu,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(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(fu,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},zs=class extends un{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(vu,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};var el=require("react-device-detect");var lp=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)}},$s=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 cp(){try{let e="privy:__session_storage__test",t="blobby",r=new $s;return r.put(e,t),r.del(e),!0}catch{return!1}}function z3(){return typeof window<"u"&&window.localStorage?new $s:new lp}var oe=z3();var bi=require("@ethersproject/providers");function Hu(){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 pp=(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(!pp(r))return!1}return!0},mn=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),js=()=>{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 Vu=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ys=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Gu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Vr=(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}`},dp=e=>new Promise(t=>setTimeout(t,e));function qu(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 Ia=(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 dp(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Zs=(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 zu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Vn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function $u(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(),p=[];for(let u of s)t.includes("coinbase_wallet")&&u.info.rdns==="com.coinbase.wallet"||p.push({type:u.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:u});for(let u of Hu()){let h=Ks(u);if(!s.some(f=>f.info.name===h)){if(pp(u,!0)&&!p.find(f=>f.type==="metamask")){p.push({type:"metamask",legacyInjectedProvider:u});continue}if(h==="Phantom"&&!p.find(f=>f.type==="phantom")){p.push({type:"phantom",legacyInjectedProvider:u});continue}if(h==="Coinbase Wallet"&&!p.find(f=>f.type==="coinbase_wallet"&&r?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){p.push({type:"coinbase_wallet",legacyInjectedProvider:u});continue}p.find(f=>f.type==="unknown_browser_extension")||p.push({type:"unknown_browser_extension",legacyInjectedProvider:u})}}i(p)}})}function Ei(e){return`eip155:${String(Number(e))}`}var Ku=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ye(`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 ye(`No RPC url found for ${e}`);return i},ju=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ye(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},qo=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ye(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new bi.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new bi.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new bi.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.public?.http[0]?i=new bi.StaticJsonRpcProvider(a.rpcUrls.public.http[0]):i=new bi.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new ye(`No RPC url found for ${e}`);return i},Wa=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 Qs=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Js))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Js={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 $3(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Yu(e,t){let r=$3(t);if(r.deepLink)return em(r.deepLink,e);if(r.universalLink)return tm(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}var Zu="WALLETCONNECT_DEEPLINK_CHOICE";function Qu(){try{localStorage.removeItem(Zu)}catch{}}function Ju({href:e,name:t}){try{localStorage.setItem(Zu,JSON.stringify({href:e,name:t}))}catch{}}function Xu(e){return e.startsWith("http://")||e.startsWith("https://")}function em(e,t){if(Xu(e))return tm(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 tm(e,t){if(!Xu(e))return em(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Xs(e,t){window.open(e,t,"noreferrer noopener")}var nt=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Ma=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new 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(pu,{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 ue(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(du,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(cu,{token:this.captchaToken});el.isMobile&&!el.isIOS&&t.connect_uri&&Xs(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(uu,{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 rm="1.72.1-beta-20240621181936";var om="34357d3c125c2bcf2ce2bc3309d98715",Oa="https://auth.privy.io",nm=2e4,et=1400,im=2500,tl=rm;var Gn="privy:token",up="privy-token",rl="privy:refresh_token",am="privy-refresh-token",ol="privy-session",La="privy:session_transfer_token",j3="privy:wallet",Na="privy:caid",Da=e=>`privy:cross-app:${e}`,qn="privy:state_code",zn="privy:code_verifier",$n="privy:headless_oauth",nl=e=>`${j3}:${e}`,mp="privy:connectors",fp="privy:connections";var Kn=12e4,zo=1,hp="0x1",Ti=3e4,sm="https://api.moonpay.com/v1",lm="https://api.moonpay.com/v1",cm="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",pm="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var dm="deprecated";var yp=require("jose");async function um(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function mm(e){return crypto.getRandomValues(new Uint8Array(e))}var Y3="S256",Z3="S256";function jn(){return yp.base64url.encode(mm(36))}function Pi(){return jn()}async function Si(e,t=Y3){if(t==Z3){let r=await um(e);return yp.base64url.encode(r)}else return e}function fm(){let e=oe.get(zn);if(!e)throw new C("Authentication error.");return e}function il(){return!!oe.get($n)}var bo=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:il();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=fm();try{let r=await this.api.post(Tu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(zn),this.meta.headless&&oe.del($n),{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=ue(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=oe.get(zn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(Gs,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(zn),r}catch(r){throw ue(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=jn();oe.put(zn,t);let r=Pi();oe.put(qn,r);let o=await Si(t);this.meta.headless&&oe.put($n,!0);try{return await this.api.post(Vs,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function gp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ua=require("react/jsx-runtime"),al=({style:e,...t})=>(0,Ua.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,Ua.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,Ua.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var fn=require("react/jsx-runtime"),sl=({style:e,...t})=>(0,fn.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,fn.jsx)("g",{clipPath:"url(#clip0)",children:(0,fn.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,fn.jsx)("defs",{children:(0,fn.jsx)("clipPath",{id:"clip0",children:(0,fn.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var vp=require("react/jsx-runtime"),ll=({style:e,...t})=>(0,vp.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,vp.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});var Yn=require("react/jsx-runtime"),cl=({style:e,...t})=>(0,Yn.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,Yn.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,Yn.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,Yn.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,Yn.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var Rt=require("react/jsx-runtime");function pl(e){return(0,Rt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[(0,Rt.jsxs)("defs",{children:[(0,Rt.jsxs)("linearGradient",{id:"b",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,Rt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,Rt.jsxs)("linearGradient",{id:"a",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,Rt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,Rt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,Rt.jsx)("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),(0,Rt.jsx)("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),(0,Rt.jsx)("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,Rt.jsx)("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,Rt.jsx)("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}var Fa=require("react/jsx-runtime");function dl({style:e,...t}){return(0,Fa.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,Fa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Fa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Fa.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var Ba=require("react/jsx-runtime");function ul(e){return(0,Ba.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,Ba.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,Ba.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var _i=require("react/jsx-runtime");function ml(e){return(0,_i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,_i.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,_i.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,_i.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var Cp=require("react/jsx-runtime"),fl=({style:e,...t})=>(0,Cp.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,Cp.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Q3={google:{name:"Google",component:cl},discord:{name:"Discord",component:sl},github:{name:"Github",component:ll},linkedin:{name:"LinkedIn",component:dl},twitter:{name:"Twitter",component:fl},spotify:{name:"Spotify",component:ul},instagram:{name:"Instagram",component:pl},tiktok:{name:"Tiktok",component:ml},apple:{name:"Apple",component:al}},Ha=e=>Q3[e];function hm(e,t){let r={detail:"",retryable:!1},o=gp(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=Ha(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Ha(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."),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:il(),popupFlow:window.opener!==null&&n}}function Zn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),oe.del(qn),window.history.replaceState({},"",e)}var Qn=class{constructor(t){this.initAuthenticateOnce=new nt(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new nt(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(Iu,{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"):ue(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(Ru,{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"):ue(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(ku,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(Au,{})}_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 hl=({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:
|
|
2
2
|
${e}
|
|
3
3
|
|
|
4
4
|
${a}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${r}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`};var Jn=class{constructor(t,r,o){this.getNonceOnce=new nt(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 ue(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 ue(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=hl({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Xn=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(Eu,{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 ue(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(wu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(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(Cu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};var xi=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(Mu,{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 ue(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Ou,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ue(t)}}};function bp(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 ym(){let e;if(e=Jv(),e)return wp(),{...e,flowType:"login-url"};if(e=Xv(),e)return wp(),{...e,flowType:"web-app"};wp()}function Jv(){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 Xv(){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 wp(){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)}var Sf=require("uuid");function J(e){return e?new Date(e*1e3):null}function e0(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:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(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,providerApp:{id:r.provider_app_id},verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(a);break;case"email":let i={address:r.address,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(i);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let p={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(p);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(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:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(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:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(m);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(v);break;case"tiktok_oauth":let b={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(b);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(g);break;case"apple_oauth":let S={subject:r.subject,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(S);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)});break;case"farcaster":let _={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let E={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(E);break;case"telegram":let k={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:J(r.first_verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(k);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function fr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Oe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,Ai=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,yl=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,t0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),hr=(e,t)=>Oe(e)||Ai(e)?!1:t==="all-users"||t==="users-without-wallets"&&!t0(e)?.length;function yr(e){if(!e)return null;let t=e0(e.linked_accounts),r=fr(t,"wallet"),o=fr(t,"email"),n=fr(t,"phone"),a=fr(t,"google_oauth"),i=fr(t,"twitter_oauth"),l=fr(t,"discord_oauth"),s=fr(t,"github_oauth"),p=fr(t,"spotify_oauth"),u=fr(t,"instagram_oauth"),h=fr(t,"tiktok_oauth"),m=fr(t,"linkedin_oauth"),v=fr(t,"apple_oauth"),b=fr(t,"farcaster"),g=fr(t,"telegram"),S=e.mfa_methods.map(({type:E,verified_at:k})=>({type:E,verifiedAt:J(k)}));return{id:e.id,createdAt:J(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,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:p&&{subject:p.subject,email:p.email,name:p.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},apple:v&&{subject:v.subject,email:v.email},farcaster:b&&{fid:b.fid,ownerAddress:b.ownerAddress,displayName:b.displayName,username:b.username,bio:b.bio,pfp:b.pfp,url:b.url,signerPublicKey:b.signerPublicKey},telegram:g&&{telegramUserId:g.telegramUserId,firstName:g.firstName,lastName:g.lastName,username:g.username,photoUrl:g.photoUrl},mfaMethods:S.map(E=>E.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var Rp=require("@ethersproject/address"),Cf=require("@ethersproject/bytes"),wf=y(require("eventemitter3"));var Sm=y(require("@coinbase/wallet-sdk"));var Ga=require("react/jsx-runtime"),qa=({style:e,...t})=>(0,Ga.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ga.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ga.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var io=require("@ethersproject/address"),Ep=require("@ethersproject/providers"),Pm=y(require("eventemitter3"));var Cm=y(require("eventemitter3"));var r0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],gm=e=>r0.includes(e);var vm=require("@ethersproject/logger"),hn=require("@privy-io/js-sdk-core");var ki=class extends ye{constructor(){super("Wallet timeout");this.type="wallet_error"}},Ri=class extends ye{constructor(){super("User rejected connection");this.type="wallet_error"}},oo=e=>{if(e instanceof ye)return e;if(e?.code&&e?.reason){let t=new It(e);return e.code===vm.ErrorCode.ACTION_REJECTED&&(t.details=hn.ProviderErrors.E4001_USER_REJECTED_REQUEST),t}return e?.code?new It(e):new ye("Unknown connector error",e)},Ar=class extends yt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},It=class extends Ar{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(hn.ProviderErrors).find(a=>a.eipCode===o.code);this.details=n||hn.ProviderErrors.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=hn.ProviderErrors.E32002_CONNECTION_ALREADY_PENDING:this.details=hn.ProviderErrors.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=hn.ProviderErrors.E32002_WALLET_LOCKED))}},o0={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}},$o={...o0,...hn.ProviderErrors};var it=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 ki,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||Kn,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 ye(`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 oo(r)})}},yn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},za=class extends Cm.default{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=qo(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=Ii(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new yn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Te()||!this.address)throw new yn("Disconnected",4900);return(await Em(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new yn(`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 yn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=qo(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 wm(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(Wa(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:Vn(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 Vn(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(gm(r.method)){let o=await Te();if(await Tm(),!o||!this.address)throw new yn("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 yn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Te();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}}},no=class extends it{constructor(r){super(r,r.rpcTimeoutDuration)}},gn=class extends it{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 n0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ar=class extends Pm.default{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=Ei(r),this.walletClientType==="privy"&&oe.put(nl(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=Ii(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(l=>(0,io.getAddress)(l.address)===(0,io.getAddress)(r));return{address:(0,io.getAddress)(r),chainId:o,meta:n,imported:a,switchChain:async l=>{if(!i)throw new ye("Wallet is not currently connected.");let s=this.wallets.find(v=>(0,io.getAddress)(v.address)===(0,io.getAddress)(r))?.chainId;if(!s)throw new ye("Unable to determine current chainId.");let p,u;if(typeof l=="number"?(p=`0x${l.toString(16)}`,u=l):(p=l,u=Number(l)),s===Ei(p))return;let h=this.chains.find(v=>v.id===u);if(!h)throw new ye(`Unsupported chainId: ${l}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:p}]})};try{return await m()}catch(v){if(n0(v,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:p,chainName:h.name,nativeCurrency:h.nativeCurrency,rpcUrls:[h.rpcUrls.default?.http[0]??""],blockExplorerUrls:[h.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&v.message?.includes("wallet_switchEthereumChain")?new ye(`Rainbow does not support the chainId ${o}`):v}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return new Ep.Web3Provider(new no(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return new gn(this.proxyProvider)},sign:async l=>{if(!await i())throw new ye("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 p=await Ia(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(p)&&(o=p)}}catch(p){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",p)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=(0,io.getAddress)(n),i=[],l;if(this.walletClientType==="privy"){let p=oe.get(nl(a));this.chains.find(u=>u.id===Number(p))||(oe.del(nl(a)),p=null),l=p||`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 p=await Ia(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof p=="string")l=p;else if(typeof p=="number")l=`0x${p.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(p){console.warn(`Failed to get chainId from provider, defaulting to ${hp}`,p),l=hp}let s=Ei(l);if(!i.find(p=>(0,io.getAddress)(p.address)===a)){let p={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet((0,io.getAddress)(n),s,p,this.connectorType==="embedded_imported"))}gl(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=>(0,io.getAddress)(n)===(0,io.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Ep.Web3Provider(new no(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 i0=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],a0=(e,t)=>e.makeWeb3Provider({options:t}),Tp,vl=class extends ar{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 it(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"),!Tp){let s=[o.id].concat(r.map(u=>u.id)),p=this.connectionOptions!=="eoaOnly"?s.filter(u=>!i0.includes(u)):[];p.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${p.join(", ")}`),Tp=new Sm.default({appName:i,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(a0(Tp,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:qa,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 ye("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}};var Pp=require("react/jsx-runtime"),Wi=({...e})=>(0,Pp.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Pp.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var $a=class extends ar{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:[Vn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Wi,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var Sp=require("react/jsx-runtime"),Mi=({style:e,...t})=>(0,Sp.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,Sp.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var Zt=require("react/jsx-runtime"),Oi=({style:e,...t})=>(0,Zt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[(0,Zt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,Zt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,Zt.jsx)("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),(0,Zt.jsx)("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),(0,Zt.jsx)("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),(0,Zt.jsx)("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),(0,Zt.jsx)("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),(0,Zt.jsx)("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),(0,Zt.jsx)("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),(0,Zt.jsx)("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),(0,Zt.jsx)("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),(0,Zt.jsx)("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),(0,Zt.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Ka=require("react/jsx-runtime"),Eo=({style:e,...t})=>(0,Ka.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ka.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Ka.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Ni=class extends ar{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new it(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 ye("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}},Li,Di=class extends ar{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Ns(this,Li,void 0);this.proxyProvider=new it(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?sp(this,Li,{name:"MetaMask",icon:Oi,id:"io.metamask"}):i==="phantom"&&sp(this,Li,{name:"Phantom",icon:Eo,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 tu(this,Li)??{name:"Browser Extension",icon:Mi,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 ye("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}};Li=new WeakMap;var s0=require("@ethersproject/address"),l0=require("@ethersproject/providers"),_m=require("react-device-detect");var Cl=class extends Ni{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{_m.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ye("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw oo(t)}}};var wl=class extends ar{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new it(void 0,Kn);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 bl=class extends wl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Eo,id:"phantom"}}};var Fi=require("@walletconnect/ethereum-provider"),vf=require("react-device-detect");var Gr=require("react");var xm=require("react/jsx-runtime");function El({src:e,...t}){return(0,xm.jsx)("img",{src:e,...t,style:{display:"none"}})}var Po=require("react"),uf=require("react");var kr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:om,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var Am=({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 c0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),km=e=>c0.has(e),Rm=(e,t,r)=>r.indexOf(e)===t,Im=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(km).filter(Rm):e?e.filter(km).filter(Rm):kr.appearance.walletList;var Wm={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 Mm={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 Om={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 Lm={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 Nm={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 Dm={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 Um={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 Fm={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 Bm={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 Hm={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 Vm={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 Gm={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 qm={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 zm={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 $m={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 Km={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 jm={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 Ym={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 Tl={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 Zm={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 Qm={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 Jm={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 Xm={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 ef={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 tf={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 rf={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 of={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 nf={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 af={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 sf={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Ui=[Wm,Mm,Om,$m,of,Tl,Zm,Qm,Jm,Xm,ef,Hm,Vm,Gm,qm,Dm,Um,Fm,Bm,jm,Ym,Lm,Nm,nf,sf,af,Km,tf,zm,rf],i8=new Set(Ui.map(e=>e.id));var vn=y(require("tinycolor2")),lf="#FFFFFF",p0="#000000",d0=lf,u0="#1E1E1D";function m0(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function To(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,vn.default)({...e.toHsl(),l:r})}function cf({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lf,blackHex:i=p0}){let l;switch(e){case"light":l=d0;break;case"dark":l=u0;break;default:l=e;break}let s=(0,vn.default)(l),p=(0,vn.default)(t),u=(0,vn.default)(r),h=(0,vn.default)(o),m=(0,vn.default)(n),v=m0(s.getLuminance()),b=To(s,v==="light"?-.04:.11),g=To(s,v==="light"?-.88:.87),S=To(s,v==="light"?-.77:.75),_=To(s,v==="light"?-.43:.45).desaturate(v==="light"?60:20),E=To(s,v==="light"?-.08:.25).desaturate(v==="light"?60:20),k=To(p,.15),I=To(p,-.06),D=To(m,.3),W=To(h,.3),M=(0,vn.default)(p.getLuminance()>.5?i:a),H=To(u,-.16);return{colorScheme:v,background:s.toHslString(),background2:b.toHslString(),foreground:g.toHslString(),foreground2:S.toHslString(),foreground3:_.toHslString(),foreground4:E.toHslString(),accent:p.toHslString(),accentLight:k.toHslString(),accentDark:I.toHslString(),foregroundAccent:M.toHslString(),success:u.toHslString(),successDark:H.toHslString(),error:m.toHslString(),errorLight:D.toHslString(),warn:h.toHslString(),warnLight:W.toHslString()}}function _p(e,t,r){let o=r?console.warn:()=>{},n,a,i,l,s,p,u,h,m,v,b,g,S,_,E;t?.loginMethods?(n=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),p=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),v=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("github"),b=t.loginMethods.includes("linkedin"),S=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),E=t.loginMethods.includes("telegram")):(n=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,p=e.twitterOAuth,u=e.discordOAuth,g=e.githubOAuth,m=e.spotifyOAuth,v=e.instagramOAuth,h=e.tiktokOAuth,b=e.linkedinOAuth,S=e.appleOAuth,_=e.farcasterAuth,E=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?i=!1:e.passkeyAuth&&(i=!0);let k=[n,a].filter(Boolean),I=[s,p,u,g,m,v,h,b,S,_,E].filter(Boolean),D=[l].filter(Boolean);if(k.length+I.length+D.length===0)throw new Error("You must enable at least one login method");let W=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;W&&D.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),W=!1):!W&&I.length+k.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),W=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let M=Im({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=Am({input:t?.loginMethodsAndOrder}),z=t?.intl?.defaultCountry??"US",{chains:ee,defaultChain:O}=f0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),K=!!t?.defaultChain,L=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,rt,Gt=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?L?rt=t?.embeddedWallets?.noPromptOnSignature??!0:rt=t?.embeddedWallets?.noPromptOnSignature??Gt:rt=Gt,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&rt!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Je,...pe}=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??kr.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:cf({backgroundTheme:t?.appearance?.theme??kr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??kr.appearance.accentColor}),loginGroupPriority:W?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M},loginMethods:{wallet:l,email:n,sms:a,passkey:i,google:s,twitter:p,discord:u,github:g,spotify:m,instagram:v,tiktok:h,linkedin:b,apple:S,farcaster:_,telegram:E},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??kr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??kr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??kr.rpcConfig.rpcTimeouts},chains:ee,defaultChain:O,intl:{defaultCountry:z},shouldEnforceDefaultChainOnConnect:K,captchaEnabled:e.captchaEnabled??kr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??kr.externalWallets.coinbaseWallet.connectionOptions}},embeddedWallets:{...e.embeddedWalletConfig,...typeof Je=="boolean"?{requireUserOwnedRecoveryOnCreate:Je}:{},...L?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...pe,noPromptOnSignature:rt},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:L?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??kr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??kr._render.standalone}}}function pf(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 f0({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Ui.find(u=>u.id===s.id)??s)}else n=Ui.concat(e??[]);let a=t?n[0]:Tl,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 df=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)};var hf=require("react/jsx-runtime"),mf={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:""},xp=_p(mf,void 0,!1),Ap=(0,uf.createContext)({appConfig:xp,isServerConfigLoaded:!1}),ff=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=(0,Po.useState)(null),i=(0,Po.useMemo)(()=>_p(n??mf,o,!!n),[n,o]);return(0,Po.useEffect)(()=>{if(!n)return;let l=pf(o,t),s=df(JSON.stringify(l)).toString(),p=`privy:sent:${n.id}:${s}`;localStorage.getItem(p)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(p,"t"))},[o,t,n]),(0,Po.useEffect)(()=>{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)}})()},[]),(0,hf.jsx)(Ap.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Wt=()=>{let{appConfig:e}=(0,Po.useContext)(Ap);return e},Pl=()=>{let{isServerConfigLoaded:e}=(0,Po.useContext)(Ap);return e};var T=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Sl=require("react/jsx-runtime"),yf=(0,Gr.createContext)({ready:!1,app:xp,currentScreen:null,lastScreen:null,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,onUserCloseViaDialogOrKeybindRef:void 0}),h0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],gf=e=>{let t=Wt(),r=e.authenticated,[o,n]=(0,Gr.useState)(e.initialScreen);(0,Gr.useEffect)(()=>{!r&&!h0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=(0,Gr.useRef)(null);(0,Gr.useEffect)(()=>{e.open||(a.current=null)},[e.open]),(0,Gr.useEffect)(()=>{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(0,Sl.jsxs)(yf.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Sl.jsx)(El,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,Gr.useContext)(yf);var Ko=require("react/jsx-runtime"),ja=({style:e,...t})=>{let{app:r}=A();return(0,Ko.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ko.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Ko.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Ko.jsx)("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),(0,Ko.jsx)("defs",{children:(0,Ko.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Ko.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var So=class extends ar{constructor(r,o,n,a,i,l,s,p){super(p||"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 it(void 0,this.rpcTimeoutDuration),p&&(this.walletEntry=Js[p],this.walletClientType=p)}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=Qs(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:Oi,id:"io.metamask"}:{name:zu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ja,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=Js[r],this.walletClientType=r,this.redirectUri=void 0,Qu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Ri)};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 ye("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Qs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Ii(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(oo(i));return}o(new ye("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=Ku(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 Fi.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fi.OPTIONAL_EVENTS,optionalMethods:Fi.OPTIONAL_METHODS,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(),vf.isMobile&&this.walletEntry){let{redirect:l,href:s}=Yu(i,this.walletEntry);Ju({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Xs(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=Qs(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 Ip=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,Cf.isHexString)(o)).map(o=>(0,Rp.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Ii=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Kn:Kn,Bi=class extends wf.default{constructor(r,o,n,a,i,l,s,p,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 it: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=p,this.externalWalletConfig=u,this.privyAppName=h,this.privyAppLogo=m,this.storedConnections=kp()}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;oe.get(mp)&&(oe.getKeys().forEach(o=>{o.startsWith("walletconnect")&&oe.del(o)}),oe.del(mp));let r=$u(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"),!mn()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.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 za(r,o,this.rpcConfig,this.chains,a,n.id),s=new $a(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 za(r,o,this.rpcConfig,this.chains,a,n.id),s=!0,p=new $a(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(p)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=kp(),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=kp(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof So&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Cl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ni(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new vl(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new bl(this.defaultChain):new So(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}));oe.put(fp,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,Rp.getAddress)(r),this.emit("walletsUpdated")}};function gl(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 y0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",kp=()=>{let e=oe.get(fp);return e&&Array.isArray(e)&&e.map(o=>y0(o)).every(Boolean)?e:[]};var bf=require("ofetch");var g0=[Fs,Hs,Bs,qs],_l=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=tl,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=bf.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request: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=g0.includes(a.toString());if(!l.has("authorization")){let p=await this.client.getAccessToken({disableAutoRefresh:s});p!==null&&l.set("authorization",`Bearer ${p}`)}i.headers=l,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new Ds}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};var Ef=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});var ei=y(require("js-cookie"));function Tf(e){return e instanceof un?"email":e instanceof Xn?"sms":e instanceof Jn?"siwe":e instanceof wi?"custom_auth":e instanceof bo?e.meta.provider:null}var Pf=y(require("jose")),ao=class{static parse(t){try{return new ao(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Pf.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 v0=30,xl=class{constructor(){this.authenticateOnce=new nt(async t=>this._authenticate(t)),this.linkOnce=new nt(async t=>this._link(t)),this.refreshOnce=new nt(this._refresh.bind(this)),this.destroyOnce=new nt(this._destroy.bind(this)),this.forkSessionOnce=new nt(this._forkSession.bind(this))}get token(){try{let t=oe.get(Gn);return typeof t=="string"?new ao(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=oe.get(rl);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=oe.get(La);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=oe.get(Da(t));if(typeof r=="string"){let o=new ao(r);return o.isExpired()?(oe.del(Da(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=ei.default.get(ol);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!==dm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=ao.parse(this.token);return t!==null&&!t.isExpired(v0)}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"?oe.put(Da(t),r):oe.del(Da(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=Tf(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:yr(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),St(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:yr(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),St(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;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(Fs,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Hs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),yr(n.user)}catch(n){if(n instanceof xr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw St(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(Bs,{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(nu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw St(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=oe.get(Gn);if(oe.put(Gn,t),!this.client?.useServerCookies){let o=ao.parse(t)?.expiration;ei.default.set(up,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else oe.del(Gn),ei.default.remove(up),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(oe.put(rl,t),this.client?.useServerCookies||ei.default.set(ol,"t",{sameSite:"Strict",secure:!0,expires:30})):(oe.del(rl),ei.default.remove(am),ei.default.remove(ol))}clearForkedToken(){oe.del(La)}};var Wp,Al,_f,Hi=class{constructor(t){Ns(this,Al);this.apiUrl=t.apiUrl||Oa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||nm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=ru(this,Al,_f).call(this),Wp||(Wp=new xl),this.session=Wp,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:p}){this.connectors||(this.connectors=new Bi(this.appId,t,r,o,n,a,i,l,s,p))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new _l({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(Nu,{action:"verify"})}catch(t){throw ue(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Du,{});return Ef(t.options)}catch(t){throw ue(t)}}async unlinkEmail(t){try{let r=await this.api.post(gu,{address:t});return yr(r)}catch(r){throw St(r)}}async acceptTerms(){try{let t=await this.api.post(Uu,{});return yr(t)}catch(t){throw St(t)}}async unlinkPhone(t){try{let r=await this.api.post(bu,{phoneNumber:t});return yr(r)}catch(r){throw St(r)}}async unlinkWallet(t){try{let r=await this.api.post(lu,{address:t});return yr(r)}catch(r){throw St(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Pu,{provider:t,subject:r});return yr(o)}catch(o){throw St(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(mu,{fid:t});return yr(r)}catch(r){throw St(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Lu,{telegram_user_id:t});return yr(r)}catch(r){throw St(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Wu,{credential_id:t});return yr(r)}catch(r){throw St(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(qs,{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(Fu,t)}catch(r){throw St(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ao.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;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw St(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(iu,{address:t,token:r})).nonce}catch(o){throw St(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(su,{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 yr(i)}catch(i){throw St(i)}}};Al=new WeakSet,_f=function(){if(typeof window>"u")return null;try{let r=oe.get(Na);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Sf.v4)();try{return oe.put(Na,t),t}catch{return t}};var Rf=require("@marsidev/react-turnstile"),kl=require("react");var qr=require("react");var kf=require("react/jsx-runtime"),xf=(0,qr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:T,setError:T,setExecuting:T,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:T,reset:T,execute:T}),Rr=class extends yt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Af=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,qr.useRef)(null),[a,i]=(0,qr.useState)(),[l,s]=(0,qr.useState)(),[p,u]=(0,qr.useState)(!1),h=(0,qr.useMemo)(()=>o?!p&&!a&&!l?{status:"ready"}:p&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,p]);return(0,kf.jsx)(xf.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 qu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Rr("Captcha failed",null,"captcha_timeout")}}},children:e})},Pe=()=>(0,qr.useContext)(xf);var Mp=require("react/jsx-runtime"),Rl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=Pe(),[,s]=(0,kl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,kl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Mp.jsx)("div",{className:"hidden h-0 w-0",children:(0,Mp.jsx)(Rf.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:p=>{e.onSuccess?.(p),a(p),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};var pn=require("react"),Gd=y(require("styled-components"));var Il=require("react");var Op=(0,Il.createContext)({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:T,initializeWalletProxy:T,getAuthMeta:T,getAuthFlow:T,closePrivyModal:T,openPrivyModal:T,connectWallet:T,initLoginWithWallet:T,loginWithWallet:T,initLoginWithFarcaster:T,loginWithFarcaster:T,loginWithCode:T,initLoginWithEmail:T,initLoginWithSms:T,initUpdateEmail:T,resendEmailCode:T,resendSmsCode:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,crossAppAuthFlow:T,initLoginWithOAuth:T,recoveryOAuthFlow:T,loginWithOAuth:T,initLoginWithPasskey:T,loginWithPasskey:T,initLinkWithPasskey:T,linkWithPasskey:T,refreshUser:T,walletProxy:null,createAnalyticsEvent:T,acceptTerms:T,getUsdTokenPrice:T,recoverEmbeddedEthereumWallet:T,getFiatOnRampConfig:T,updateWallets:T,fundWallet:T,setReadyToTrue:T,requestFarcasterSignerStatus:T,initLoginWithTelegram:T,loginWithTelegram:T,generateSiweMessage:T,linkWithSiwe:T,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:T,recoverEmbeddedSolanaWallet:T}),R=()=>(0,Il.useContext)(Op);var Wl=require("react");var xe=(0,Wl.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:T,login:T,connectOrCreateWallet:T,linkEmail:T,linkPhone:T,linkFarcaster:T,linkWallet:T,linkCrossAppAccount:T,linkGoogle:T,linkTwitter:T,linkDiscord:T,linkGithub:T,linkSpotify:T,linkInstagram:T,linkTelegram:T,linkTiktok:T,linkLinkedIn:T,linkApple:T,linkPasskey:T,updateEmail:T,logout:T,getAccessToken:T,getEthereumProvider:T,getEthersProvider:T,getWeb3jsProvider:T,unlinkEmail:T,unlinkPhone:T,unlinkWallet:T,unlinkGoogle:T,unlinkTwitter:T,unlinkDiscord:T,unlinkGithub:T,unlinkSpotify:T,unlinkInstagram:T,unlinkTiktok:T,unlinkLinkedIn:T,unlinkApple:T,unlinkCrossAppAccount:T,unlinkFarcaster:T,unlinkTelegram:T,unlinkPasskey:T,setActiveWallet:T,forkSession:T,createWallet:T,importWallet:T,signMessage:T,signTypedData:T,enrollInMfa:T,initEnrollmentWithSms:T,initEnrollmentWithTotp:T,initEnrollmentWithPasskey:T,promptMfa:T,init:T,submitEnrollmentWithSms:T,submitEnrollmentWithTotp:T,submitEnrollmentWithPasskey:T,unenroll:T,submit:T,cancel:T,sendTransaction:T,exportWallet:T,setWalletPassword:T,setWalletRecovery:T,requestFarcasterSignerFromWarpcast:T,getFarcasterSignerPublicKey:T,signFarcasterMessage:T,initLoginWithEmail:T,initLoginWithSms:T,otpState:{status:"initial"},loginWithCode:T,fundWallet:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,generateSiweMessage:T,linkWithSiwe:T,signMessageWithCrossAppWallet:T,signTypedDataWithCrossAppWallet:T,sendTransactionWithCrossAppWallet:T,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),G=()=>(0,Wl.useContext)(xe);var Ml=require("react"),If=e=>{let[t,r]=(0,Ml.useState)("auto");return(0,Ml.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var Vi=require("react"),Wf={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:[]}},Lp=(0,Vi.createContext)(void 0),Mf=()=>(0,Vi.useContext)(Lp);function Ye(e,t){if(!t)return;let o=Mf().current[e];return(0,Vi.useEffect)(()=>{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 Gi(){let e=Mf();return(t,r,...o)=>U(e,t,r,...o)}function Ol(e){Ye("configureMfa",e)}var Vf=require("@heroicons/react/24/outline"),Up=y(require("styled-components"));var so=y(require("styled-components"));var Ll=y(require("styled-components")),Cn=require("react/jsx-runtime"),bt=({success:e,fail:t})=>(0,Cn.jsxs)(Cn.Fragment,{children:[(0,Cn.jsx)(Mt,{className:e?"success":t?"fail":""}),(0,Cn.jsx)(Np,{className:e?"success":t?"fail":""})]}),Mt=Ll.default.span`
|
|
12
|
+
- https://privy.io`};var Jn=class{constructor(t,r,o){this.getNonceOnce=new nt(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 ue(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 ue(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=hl({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var Xn=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(Eu,{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 ue(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(wu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(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(Cu,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};var xi=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(Mu,{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 ue(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Ou,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ue(t)}}};function bp(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 ym(){let e;if(e=J3(),e)return wp(),{...e,flowType:"login-url"};if(e=X3(),e)return wp(),{...e,flowType:"web-app"};wp()}function J3(){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 X3(){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 wp(){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)}var Sf=require("uuid");function J(e){return e?new Date(e*1e3):null}function e0(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:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(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,providerApp:{id:r.provider_app_id},verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(a);break;case"email":let i={address:r.address,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(i);break;case"phone":let l={number:r.phoneNumber,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(l);break;case"google_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(s);break;case"spotify_oauth":let p={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(p);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(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:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(h);break;case"discord_oauth":let f={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(f);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(v);break;case"tiktok_oauth":let b={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(b);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(g);break;case"apple_oauth":let S={subject:r.subject,email:r.email,type:r.type,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(S);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)});break;case"farcaster":let _={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(_);break;case"passkey":let E={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:J(r.verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(E);break;case"telegram":let k={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:J(r.first_verified_at),firstVerifiedAt:J(r.first_verified_at),latestVerifiedAt:J(r.latest_verified_at)};t.push(k);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function fr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Oe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="ethereum")||null,Ai=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&!t.imported&&t.chainType==="solana")||null,yl=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy"&&t.imported&&t.chainType==="ethereum")||null,t0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),hr=(e,t)=>Oe(e)||Ai(e)?!1:t==="all-users"||t==="users-without-wallets"&&!t0(e)?.length;function yr(e){if(!e)return null;let t=e0(e.linked_accounts),r=fr(t,"wallet"),o=fr(t,"email"),n=fr(t,"phone"),a=fr(t,"google_oauth"),i=fr(t,"twitter_oauth"),l=fr(t,"discord_oauth"),s=fr(t,"github_oauth"),p=fr(t,"spotify_oauth"),u=fr(t,"instagram_oauth"),h=fr(t,"tiktok_oauth"),f=fr(t,"linkedin_oauth"),v=fr(t,"apple_oauth"),b=fr(t,"farcaster"),g=fr(t,"telegram"),S=e.mfa_methods.map(({type:E,verified_at:k})=>({type:E,verifiedAt:J(k)}));return{id:e.id,createdAt:J(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,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:p&&{subject:p.subject,email:p.email,name:p.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:h&&{subject:h.subject,username:h.username,name:h.name},linkedin:f&&{subject:f.subject,name:f.name,email:f.email},apple:v&&{subject:v.subject,email:v.email},farcaster:b&&{fid:b.fid,ownerAddress:b.ownerAddress,displayName:b.displayName,username:b.username,bio:b.bio,pfp:b.pfp,url:b.url,signerPublicKey:b.signerPublicKey},telegram:g&&{telegramUserId:g.telegramUserId,firstName:g.firstName,lastName:g.lastName,username:g.username,photoUrl:g.photoUrl},mfaMethods:S.map(E=>E.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var Rp=require("@ethersproject/address"),Cf=require("@ethersproject/bytes"),wf=y(require("eventemitter3"));var Sm=y(require("@coinbase/wallet-sdk"));var Ga=require("react/jsx-runtime"),qa=({style:e,...t})=>(0,Ga.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ga.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ga.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var io=require("@ethersproject/address"),Ep=require("@ethersproject/providers"),Pm=y(require("eventemitter3"));var Cm=y(require("eventemitter3"));var r0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],gm=e=>r0.includes(e);var vm=require("@ethersproject/logger"),hn=require("@privy-io/js-sdk-core");var ki=class extends ye{constructor(){super("Wallet timeout");this.type="wallet_error"}},Ri=class extends ye{constructor(){super("User rejected connection");this.type="wallet_error"}},oo=e=>{if(e instanceof ye)return e;if(e?.code&&e?.reason){let t=new It(e);return e.code===vm.ErrorCode.ACTION_REJECTED&&(t.details=hn.ProviderErrors.E4001_USER_REJECTED_REQUEST),t}return e?.code?new It(e):new ye("Unknown connector error",e)},Ar=class extends yt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},It=class extends Ar{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(hn.ProviderErrors).find(a=>a.eipCode===o.code);this.details=n||hn.ProviderErrors.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=hn.ProviderErrors.E32002_CONNECTION_ALREADY_PENDING:this.details=hn.ProviderErrors.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=hn.ProviderErrors.E32002_WALLET_LOCKED))}},o0={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}},$o={...o0,...hn.ProviderErrors};var it=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 ki,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||Kn,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 ye(`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 oo(r)})}},yn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},za=class extends Cm.default{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=qo(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=Ii(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new yn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Te()||!this.address)throw new yn("Disconnected",4900);return(await Em(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new yn(`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 yn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=qo(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 wm(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(Wa(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:Vn(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 Vn(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(gm(r.method)){let o=await Te();if(await Tm(),!o||!this.address)throw new yn("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 yn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Te();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}}},no=class extends it{constructor(r){super(r,r.rpcTimeoutDuration)}},gn=class extends it{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 n0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ar=class extends Pm.default{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=Ei(r),this.walletClientType==="privy"&&oe.put(nl(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=Ii(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(l=>(0,io.getAddress)(l.address)===(0,io.getAddress)(r));return{address:(0,io.getAddress)(r),chainId:o,meta:n,imported:a,switchChain:async l=>{if(!i)throw new ye("Wallet is not currently connected.");let s=this.wallets.find(v=>(0,io.getAddress)(v.address)===(0,io.getAddress)(r))?.chainId;if(!s)throw new ye("Unable to determine current chainId.");let p,u;if(typeof l=="number"?(p=`0x${l.toString(16)}`,u=l):(p=l,u=Number(l)),s===Ei(p))return;let h=this.chains.find(v=>v.id===u);if(!h)throw new ye(`Unsupported chainId: ${l}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:p}]})};try{return await f()}catch(v){if(n0(v,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:p,chainName:h.name,nativeCurrency:h.nativeCurrency,rpcUrls:[h.rpcUrls.default?.http[0]??""],blockExplorerUrls:[h.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&v.message?.includes("wallet_switchEthereumChain")?new ye(`Rainbow does not support the chainId ${o}`):v}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return new Ep.Web3Provider(new no(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new ye("Wallet is not currently connected.");return new gn(this.proxyProvider)},sign:async l=>{if(!await i())throw new ye("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 p=await Ia(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});Array.isArray(p)&&(o=p)}}catch(p){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",p)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=(0,io.getAddress)(n),i=[],l;if(this.walletClientType==="privy"){let p=oe.get(nl(a));this.chains.find(u=>u.id===Number(p))||(oe.del(nl(a)),p=null),l=p||`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 p=await Ia(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(typeof p=="string")l=p;else if(typeof p=="number")l=`0x${p.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(p){console.warn(`Failed to get chainId from provider, defaulting to ${hp}`,p),l=hp}let s=Ei(l);if(!i.find(p=>(0,io.getAddress)(p.address)===a)){let p={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet((0,io.getAddress)(n),s,p,this.connectorType==="embedded_imported"))}gl(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=>(0,io.getAddress)(n)===(0,io.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new Ep.Web3Provider(new no(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 i0=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],a0=(e,t)=>e.makeWeb3Provider({options:t}),Tp,vl=class extends ar{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 it(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"),!Tp){let s=[o.id].concat(r.map(u=>u.id)),p=this.connectionOptions!=="eoaOnly"?s.filter(u=>!i0.includes(u)):[];p.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${p.join(", ")}`),Tp=new Sm.default({appName:i,appLogoUrl:l,appChainIds:s})}this.proxyProvider.setWalletProvider(a0(Tp,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:qa,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 ye("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}};var Pp=require("react/jsx-runtime"),Wi=({...e})=>(0,Pp.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,Pp.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var $a=class extends ar{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:[Vn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Wi,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var Sp=require("react/jsx-runtime"),Mi=({style:e,...t})=>(0,Sp.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,Sp.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var Zt=require("react/jsx-runtime"),Oi=({style:e,...t})=>(0,Zt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[(0,Zt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,Zt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,Zt.jsx)("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),(0,Zt.jsx)("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),(0,Zt.jsx)("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),(0,Zt.jsx)("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),(0,Zt.jsx)("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),(0,Zt.jsx)("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),(0,Zt.jsx)("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),(0,Zt.jsx)("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),(0,Zt.jsx)("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),(0,Zt.jsx)("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),(0,Zt.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Ka=require("react/jsx-runtime"),Eo=({style:e,...t})=>(0,Ka.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ka.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Ka.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Ni=class extends ar{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new it(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 ye("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}},Li,Di=class extends ar{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Ns(this,Li,void 0);this.proxyProvider=new it(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?sp(this,Li,{name:"MetaMask",icon:Oi,id:"io.metamask"}):i==="phantom"&&sp(this,Li,{name:"Phantom",icon:Eo,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 tu(this,Li)??{name:"Browser Extension",icon:Mi,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 ye("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw oo(r)}}};Li=new WeakMap;var s0=require("@ethersproject/address"),l0=require("@ethersproject/providers"),_m=require("react-device-detect");var Cl=class extends Ni{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{_m.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new ye("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw oo(t)}}};var wl=class extends ar{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new it(void 0,Kn);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 bl=class extends wl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Eo,id:"phantom"}}};var Fi=require("@walletconnect/ethereum-provider"),vf=require("react-device-detect");var Gr=require("react");var xm=require("react/jsx-runtime");function El({src:e,...t}){return(0,xm.jsx)("img",{src:e,...t,style:{display:"none"}})}var Po=require("react"),uf=require("react");var kr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:om,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"eoaOnly"}},captchaEnabled:!1,_render:{standalone:!1},fiatOnRamp:{useSandbox:!1}};var Am=({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 c0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet"]),km=e=>c0.has(e),Rm=(e,t,r)=>r.indexOf(e)===t,Im=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(km).filter(Rm):e?e.filter(km).filter(Rm):kr.appearance.walletList;var Wm={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 Mm={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 Om={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 Lm={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 Nm={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 Dm={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 Um={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 Fm={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 Bm={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 Hm={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 Vm={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 Gm={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 qm={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 zm={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 $m={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 Km={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 jm={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 Ym={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 Tl={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 Zm={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 Qm={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 Jm={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 Xm={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 ef={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 tf={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 rf={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 of={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 nf={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 af={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 sf={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Ui=[Wm,Mm,Om,$m,of,Tl,Zm,Qm,Jm,Xm,ef,Hm,Vm,Gm,qm,Dm,Um,Fm,Bm,jm,Ym,Lm,Nm,nf,sf,af,Km,tf,zm,rf],i8=new Set(Ui.map(e=>e.id));var vn=y(require("tinycolor2")),lf="#FFFFFF",p0="#000000",d0=lf,u0="#1E1E1D";function m0(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function To(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,vn.default)({...e.toHsl(),l:r})}function cf({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lf,blackHex:i=p0}){let l;switch(e){case"light":l=d0;break;case"dark":l=u0;break;default:l=e;break}let s=(0,vn.default)(l),p=(0,vn.default)(t),u=(0,vn.default)(r),h=(0,vn.default)(o),f=(0,vn.default)(n),v=m0(s.getLuminance()),b=To(s,v==="light"?-.04:.11),g=To(s,v==="light"?-.88:.87),S=To(s,v==="light"?-.77:.75),_=To(s,v==="light"?-.43:.45).desaturate(v==="light"?60:20),E=To(s,v==="light"?-.08:.25).desaturate(v==="light"?60:20),k=To(p,.15),I=To(p,-.06),D=To(f,.3),W=To(h,.3),M=(0,vn.default)(p.getLuminance()>.5?i:a),H=To(u,-.16);return{colorScheme:v,background:s.toHslString(),background2:b.toHslString(),foreground:g.toHslString(),foreground2:S.toHslString(),foreground3:_.toHslString(),foreground4:E.toHslString(),accent:p.toHslString(),accentLight:k.toHslString(),accentDark:I.toHslString(),foregroundAccent:M.toHslString(),success:u.toHslString(),successDark:H.toHslString(),error:f.toHslString(),errorLight:D.toHslString(),warn:h.toHslString(),warnLight:W.toHslString()}}function _p(e,t,r){let o=r?console.warn:()=>{},n,a,i,l,s,p,u,h,f,v,b,g,S,_,E;t?.loginMethods?(n=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=t.loginMethods.includes("google"),p=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),f=t.loginMethods.includes("spotify"),v=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("github"),b=t.loginMethods.includes("linkedin"),S=t.loginMethods.includes("apple"),_=t.loginMethods.includes("farcaster"),E=t.loginMethods.includes("telegram")):(n=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,p=e.twitterOAuth,u=e.discordOAuth,g=e.githubOAuth,f=e.spotifyOAuth,v=e.instagramOAuth,h=e.tiktokOAuth,b=e.linkedinOAuth,S=e.appleOAuth,_=e.farcasterAuth,E=e.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?i=!1:e.passkeyAuth&&(i=!0);let k=[n,a].filter(Boolean),I=[s,p,u,g,f,v,h,b,S,_,E].filter(Boolean),D=[l].filter(Boolean);if(k.length+I.length+D.length===0)throw new Error("You must enable at least one login method");let W=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;W&&D.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),W=!1):!W&&I.length+k.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),W=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let M=Im({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),H=Am({input:t?.loginMethodsAndOrder}),z=t?.intl?.defaultCountry??"US",{chains:ee,defaultChain:O}=f0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),K=!!t?.defaultChain,L=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,rt,Gt=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?L?rt=t?.embeddedWallets?.noPromptOnSignature??!0:rt=t?.embeddedWallets?.noPromptOnSignature??Gt:rt=Gt,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&rt!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Je,...pe}=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??kr.appearance.landingHeader,loginMessage:typeof t?.appearance?.loginMessage=="string"?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:cf({backgroundTheme:t?.appearance?.theme??kr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??kr.appearance.accentColor}),loginGroupPriority:W?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M},loginMethods:{wallet:l,email:n,sms:a,passkey:i,google:s,twitter:p,discord:u,github:g,spotify:f,instagram:v,tiktok:h,linkedin:b,apple:S,farcaster:_,telegram:E},loginMethodsAndOrder:H,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??kr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??kr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??kr.rpcConfig.rpcTimeouts},chains:ee,defaultChain:O,intl:{defaultCountry:z},shouldEnforceDefaultChainOnConnect:K,captchaEnabled:e.captchaEnabled??kr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??kr.externalWallets.coinbaseWallet.connectionOptions}},embeddedWallets:{...e.embeddedWalletConfig,...typeof Je=="boolean"?{requireUserOwnedRecoveryOnCreate:Je}:{},...L?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...pe,noPromptOnSignature:rt},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:L?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??kr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1,telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??kr._render.standalone}}}function pf(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 f0({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Ui.find(u=>u.id===s.id)??s)}else n=Ui.concat(e??[]);let a=t?n[0]:Tl,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 df=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)};var hf=require("react/jsx-runtime"),mf={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:""},xp=_p(mf,void 0,!1),Ap=(0,uf.createContext)({appConfig:xp,isServerConfigLoaded:!1}),ff=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=(0,Po.useState)(null),i=(0,Po.useMemo)(()=>_p(n??mf,o,!!n),[n,o]);return(0,Po.useEffect)(()=>{if(!n)return;let l=pf(o,t),s=df(JSON.stringify(l)).toString(),p=`privy:sent:${n.id}:${s}`;localStorage.getItem(p)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(p,"t"))},[o,t,n]),(0,Po.useEffect)(()=>{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)}})()},[]),(0,hf.jsx)(Ap.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Wt=()=>{let{appConfig:e}=(0,Po.useContext)(Ap);return e},Pl=()=>{let{isServerConfigLoaded:e}=(0,Po.useContext)(Ap);return e};var T=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Sl=require("react/jsx-runtime"),yf=(0,Gr.createContext)({ready:!1,app:xp,currentScreen:null,lastScreen:null,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,onUserCloseViaDialogOrKeybindRef:void 0}),h0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],gf=e=>{let t=Wt(),r=e.authenticated,[o,n]=(0,Gr.useState)(e.initialScreen);(0,Gr.useEffect)(()=>{!r&&!h0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=(0,Gr.useRef)(null);(0,Gr.useEffect)(()=>{e.open||(a.current=null)},[e.open]),(0,Gr.useEffect)(()=>{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(0,Sl.jsxs)(yf.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Sl.jsx)(El,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,Gr.useContext)(yf);var Ko=require("react/jsx-runtime"),ja=({style:e,...t})=>{let{app:r}=A();return(0,Ko.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Ko.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Ko.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Ko.jsx)("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),(0,Ko.jsx)("defs",{children:(0,Ko.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Ko.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var So=class extends ar{constructor(r,o,n,a,i,l,s,p){super(p||"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 it(void 0,this.rpcTimeoutDuration),p&&(this.walletEntry=Js[p],this.walletClientType=p)}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=Qs(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:Oi,id:"io.metamask"}:{name:zu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ja,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=Js[r],this.walletClientType=r,this.redirectUri=void 0,Qu(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Ri)};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 ye("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Qs(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Ii(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(oo(i));return}o(new ye("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=Ku(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 Fi.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Fi.OPTIONAL_EVENTS,optionalMethods:Fi.OPTIONAL_METHODS,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(),vf.isMobile&&this.walletEntry){let{redirect:l,href:s}=Yu(i,this.walletEntry);Ju({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Xs(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=Qs(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 Ip=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,Cf.isHexString)(o)).map(o=>(0,Rp.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Ii=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Kn:Kn,Bi=class extends wf.default{constructor(r,o,n,a,i,l,s,p,u,h,f){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 it: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=p,this.externalWalletConfig=u,this.privyAppName=h,this.privyAppLogo=f,this.storedConnections=kp()}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;oe.get(mp)&&(oe.getKeys().forEach(o=>{o.startsWith("walletconnect")&&oe.del(o)}),oe.del(mp));let r=$u(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"),!mn()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)??null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)??null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.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 za(r,o,this.rpcConfig,this.chains,a,n.id),s=new $a(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 za(r,o,this.rpcConfig,this.chains,a,n.id),s=!0,p=new $a(l,this.chains,n,this.rpcConfig,s);this.addWalletConnector(p)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=kp(),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=kp(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof So&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new Cl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Di(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ni(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new vl(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new bl(this.defaultChain):new So(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}));oe.put(fp,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,Rp.getAddress)(r),this.emit("walletsUpdated")}};function gl(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 y0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",kp=()=>{let e=oe.get(fp);return e&&Array.isArray(e)&&e.map(o=>y0(o)).every(Boolean)?e:[]};var bf=require("ofetch");var g0=[Fs,Hs,Bs,qs],_l=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=tl,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=bf.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request: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=g0.includes(a.toString());if(!l.has("authorization")){let p=await this.client.getAccessToken({disableAutoRefresh:s});p!==null&&l.set("authorization",`Bearer ${p}`)}i.headers=l,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new Ds}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};var Ef=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});var ei=y(require("js-cookie"));function Tf(e){return e instanceof un?"email":e instanceof Xn?"sms":e instanceof Jn?"siwe":e instanceof wi?"custom_auth":e instanceof bo?e.meta.provider:null}var Pf=y(require("jose")),ao=class{static parse(t){try{return new ao(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Pf.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 v0=30,xl=class{constructor(){this.authenticateOnce=new nt(async t=>this._authenticate(t)),this.linkOnce=new nt(async t=>this._link(t)),this.refreshOnce=new nt(this._refresh.bind(this)),this.destroyOnce=new nt(this._destroy.bind(this)),this.forkSessionOnce=new nt(this._forkSession.bind(this))}get token(){try{let t=oe.get(Gn);return typeof t=="string"?new ao(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=oe.get(rl);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=oe.get(La);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=oe.get(Da(t));if(typeof r=="string"){let o=new ao(r);return o.isExpired()?(oe.del(Da(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=ei.default.get(ol);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!==dm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=ao.parse(this.token);return t!==null&&!t.isExpired(v0)}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"?oe.put(Da(t),r):oe.del(Da(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=Tf(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:yr(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),St(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:yr(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),St(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;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(Fs,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Hs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),yr(n.user)}catch(n){if(n instanceof xr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw St(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(Bs,{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(nu,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw St(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=oe.get(Gn);if(oe.put(Gn,t),!this.client?.useServerCookies){let o=ao.parse(t)?.expiration;ei.default.set(up,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else oe.del(Gn),ei.default.remove(up),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(oe.put(rl,t),this.client?.useServerCookies||ei.default.set(ol,"t",{sameSite:"Strict",secure:!0,expires:30})):(oe.del(rl),ei.default.remove(am),ei.default.remove(ol))}clearForkedToken(){oe.del(La)}};var Wp,Al,_f,Hi=class{constructor(t){Ns(this,Al);this.apiUrl=t.apiUrl||Oa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||nm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=ru(this,Al,_f).call(this),Wp||(Wp=new xl),this.session=Wp,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:p}){this.connectors||(this.connectors=new Bi(this.appId,t,r,o,n,a,i,l,s,p))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new _l({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(Nu,{action:"verify"})}catch(t){throw ue(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Du,{});return Ef(t.options)}catch(t){throw ue(t)}}async unlinkEmail(t){try{let r=await this.api.post(gu,{address:t});return yr(r)}catch(r){throw St(r)}}async acceptTerms(){try{let t=await this.api.post(Uu,{});return yr(t)}catch(t){throw St(t)}}async unlinkPhone(t){try{let r=await this.api.post(bu,{phoneNumber:t});return yr(r)}catch(r){throw St(r)}}async unlinkWallet(t){try{let r=await this.api.post(lu,{address:t});return yr(r)}catch(r){throw St(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Pu,{provider:t,subject:r});return yr(o)}catch(o){throw St(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(mu,{fid:t});return yr(r)}catch(r){throw St(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Lu,{telegram_user_id:t});return yr(r)}catch(r){throw St(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Wu,{credential_id:t});return yr(r)}catch(r){throw St(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(qs,{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(Fu,t)}catch(r){throw St(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ao.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;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n}}catch(t){throw St(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(iu,{address:t,token:r})).nonce}catch(o){throw St(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(su,{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 yr(i)}catch(i){throw St(i)}}};Al=new WeakSet,_f=function(){if(typeof window>"u")return null;try{let r=oe.get(Na);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Sf.v4)();try{return oe.put(Na,t),t}catch{return t}};var Rf=require("@marsidev/react-turnstile"),kl=require("react");var qr=require("react");var kf=require("react/jsx-runtime"),xf=(0,qr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:T,setError:T,setExecuting:T,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:T,reset:T,execute:T}),Rr=class extends yt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Af=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,qr.useRef)(null),[a,i]=(0,qr.useState)(),[l,s]=(0,qr.useState)(),[p,u]=(0,qr.useState)(!1),h=(0,qr.useMemo)(()=>o?!p&&!a&&!l?{status:"ready"}:p&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,p]);return(0,kf.jsx)(xf.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 qu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Rr("Captcha failed",null,"captcha_timeout")}}},children:e})},Pe=()=>(0,qr.useContext)(xf);var Mp=require("react/jsx-runtime"),Rl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=Pe(),[,s]=(0,kl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,kl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Mp.jsx)("div",{className:"hidden h-0 w-0",children:(0,Mp.jsx)(Rf.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:p=>{e.onSuccess?.(p),a(p),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};var pn=require("react"),Gd=y(require("styled-components"));var Il=require("react");var Op=(0,Il.createContext)({isNewUserThisSession:!1,linkingOrConnectingHint:null,walletConnectionStatus:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:T,initializeWalletProxy:T,getAuthMeta:T,getAuthFlow:T,closePrivyModal:T,openPrivyModal:T,connectWallet:T,initLoginWithWallet:T,loginWithWallet:T,initLoginWithFarcaster:T,loginWithFarcaster:T,loginWithCode:T,initLoginWithEmail:T,initLoginWithSms:T,initUpdateEmail:T,resendEmailCode:T,resendSmsCode:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,crossAppAuthFlow:T,initLoginWithOAuth:T,recoveryOAuthFlow:T,loginWithOAuth:T,initLoginWithPasskey:T,loginWithPasskey:T,initLinkWithPasskey:T,linkWithPasskey:T,refreshUser:T,walletProxy:null,createAnalyticsEvent:T,acceptTerms:T,getUsdTokenPrice:T,recoverEmbeddedEthereumWallet:T,getFiatOnRampConfig:T,updateWallets:T,fundWallet:T,setReadyToTrue:T,requestFarcasterSignerStatus:T,initLoginWithTelegram:T,loginWithTelegram:T,generateSiweMessage:T,linkWithSiwe:T,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:T,recoverEmbeddedSolanaWallet:T}),R=()=>(0,Il.useContext)(Op);var Wl=require("react");var xe=(0,Wl.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:T,login:T,connectOrCreateWallet:T,linkEmail:T,linkPhone:T,linkFarcaster:T,linkWallet:T,linkCrossAppAccount:T,linkGoogle:T,linkTwitter:T,linkDiscord:T,linkGithub:T,linkSpotify:T,linkInstagram:T,linkTelegram:T,linkTiktok:T,linkLinkedIn:T,linkApple:T,linkPasskey:T,updateEmail:T,logout:T,getAccessToken:T,getEthereumProvider:T,getEthersProvider:T,getWeb3jsProvider:T,unlinkEmail:T,unlinkPhone:T,unlinkWallet:T,unlinkGoogle:T,unlinkTwitter:T,unlinkDiscord:T,unlinkGithub:T,unlinkSpotify:T,unlinkInstagram:T,unlinkTiktok:T,unlinkLinkedIn:T,unlinkApple:T,unlinkCrossAppAccount:T,unlinkFarcaster:T,unlinkTelegram:T,unlinkPasskey:T,setActiveWallet:T,forkSession:T,createWallet:T,importWallet:T,signMessage:T,signTypedData:T,enrollInMfa:T,initEnrollmentWithSms:T,initEnrollmentWithTotp:T,initEnrollmentWithPasskey:T,promptMfa:T,init:T,submitEnrollmentWithSms:T,submitEnrollmentWithTotp:T,submitEnrollmentWithPasskey:T,unenroll:T,submit:T,cancel:T,sendTransaction:T,exportWallet:T,setWalletPassword:T,setWalletRecovery:T,requestFarcasterSignerFromWarpcast:T,getFarcasterSignerPublicKey:T,signFarcasterMessage:T,initLoginWithEmail:T,initLoginWithSms:T,otpState:{status:"initial"},loginWithCode:T,fundWallet:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,generateSiweMessage:T,linkWithSiwe:T,signMessageWithCrossAppWallet:T,signTypedDataWithCrossAppWallet:T,sendTransactionWithCrossAppWallet:T,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),G=()=>(0,Wl.useContext)(xe);var Ml=require("react"),If=e=>{let[t,r]=(0,Ml.useState)("auto");return(0,Ml.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var Vi=require("react"),Wf={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:[]}},Lp=(0,Vi.createContext)(void 0),Mf=()=>(0,Vi.useContext)(Lp);function Ye(e,t){if(!t)return;let o=Mf().current[e];return(0,Vi.useEffect)(()=>{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 Gi(){let e=Mf();return(t,r,...o)=>U(e,t,r,...o)}function Ol(e){Ye("configureMfa",e)}var Vf=require("@heroicons/react/24/outline"),Up=y(require("styled-components"));var so=y(require("styled-components"));var Ll=y(require("styled-components")),Cn=require("react/jsx-runtime"),bt=({success:e,fail:t})=>(0,Cn.jsxs)(Cn.Fragment,{children:[(0,Cn.jsx)(Mt,{className:e?"success":t?"fail":""}),(0,Cn.jsx)(Np,{className:e?"success":t?"fail":""})]}),Mt=Ll.default.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -640,7 +640,7 @@ Resources:
|
|
|
640
640
|
}
|
|
641
641
|
`,zl=_t.default.div`
|
|
642
642
|
color: var(--privy-color-error);
|
|
643
|
-
`;var xt=require("react/jsx-runtime"),Yf=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=A(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=R(),p=h=>{h?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=p;let u=async h=>{h.preventDefault(),await i(),e&&hr(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:
|
|
643
|
+
`;var xt=require("react/jsx-runtime"),Yf=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=A(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=R(),p=h=>{h?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=p;let u=async h=>{h.preventDefault(),await i(),e&&hr(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:f,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,xt.jsx)(O0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:p})},O0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,xt.jsxs)(xt.Fragment,{children:[(0,xt.jsx)(x,{closeable:!1}),(0,xt.jsx)(Kf.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,xt.jsx)(Ce,{style:{marginTop:24},children:"One last step"}),(0,xt.jsx)(we,{children:"By signing up, you agree to our terms and privacy policy."}),(0,xt.jsxs)(po,{style:{marginTop:24},children:[e&&(0,xt.jsxs)(Hp,{target:"_blank",href:e,children:["View Terms ",(0,xt.jsx)(Vp.default,{style:{marginLeft:"auto"}})]}),t&&(0,xt.jsxs)(Hp,{target:"_blank",href:t,children:["View Privacy Policy ",(0,xt.jsx)(Vp.default,{style:{marginLeft:"auto"}})]})]}),(0,xt.jsxs)(L0,{style:{marginTop:24},children:[(0,xt.jsx)(lo,{onClick:o,children:"No thanks"}),(0,xt.jsx)(F,{onClick:r,children:"Accept"})]}),(0,xt.jsx)(j,{protectedByPrivy:!0})]}),L0=jf.default.div`
|
|
644
644
|
display: flex;
|
|
645
645
|
gap: 10px;
|
|
646
646
|
`;var qp=y(require("styled-components"));var Zf=y(require("styled-components")),$l=Zf.default.span`
|
|
@@ -774,7 +774,7 @@ Resources:
|
|
|
774
774
|
h3 {
|
|
775
775
|
margin-bottom: 24px;
|
|
776
776
|
}
|
|
777
|
-
`;var De=require("react/jsx-runtime"),$p=6,oh=new Array($p).fill(""),F0=1400,B0=30;var ch=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:a}=A(),{closePrivyModal:i,resendEmailCode:l,resendSmsCode:s,getAuthMeta:p,loginWithCode:u,updateWallets:h,createAnalyticsEvent:
|
|
777
|
+
`;var De=require("react/jsx-runtime"),$p=6,oh=new Array($p).fill(""),F0=1400,B0=30;var ch=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:a}=A(),{closePrivyModal:i,resendEmailCode:l,resendSmsCode:s,getAuthMeta:p,loginWithCode:u,updateWallets:h,createAnalyticsEvent:f}=R(),{authenticated:v,logout:b,user:g}=G(),[S,_]=(0,Ao.useState)(oh),[E,k]=(0,Ao.useState)(!1),[I,D]=(0,Ao.useState)(null),[W,M]=(0,Ao.useState)(null),[H,z]=(0,Ao.useState)(0);a.current=()=>null;let ee=p()?.email?0:1,O=et,K=O-500;(0,Ao.useEffect)(()=>{if(H){let pe=setTimeout(()=>{z(H-1)},1e3);return()=>clearTimeout(pe)}},[H]),(0,Ao.useEffect)(()=>{if(v&&E&&g){if(e?.legal.requireUsersAcceptTerms&&!g.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},K);return()=>clearTimeout(Q)}if(hr(g,e?.embeddedWallets?.createOnLogin)){let Q=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:ot=>{console.error(ot),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ot,screen:"AwaitingPasswordlessCodeScreen"}}),b()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},K);return()=>clearTimeout(Q)}else{h();let Q=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),O);return()=>clearTimeout(Q)}}},[v,E,g]),(0,Ao.useEffect)(()=>{if(I&&W===0){let pe=setTimeout(()=>{_(oh),D(null),document.querySelector("input[name=code-0]")?.focus()},F0);return()=>clearTimeout(pe)}},[I]);let L=pe=>{pe.preventDefault();let Q=pe.currentTarget.value.replace(" ","");if(Q==="")return;if(isNaN(Number(Q))){D("Code should be numeric"),M(1);return}D(null),M(null);let ot=Number(pe.currentTarget.name?.charAt(5)),at=[...Q||[""]].slice(0,$p-ot),dr=[...S.slice(0,ot),...at,...S.slice(ot+at.length)];_(dr);let _r=at.length,rr=Math.min(Math.max(ot+_r,0),$p-1);isNaN(Number(pe.currentTarget.value))||document.querySelector(`input[name=code-${rr}]`)?.focus(),dr.every(qt=>qt&&!isNaN(+qt))&&(document.querySelector(`input[name=code-${rr}]`)?.blur(),u(dr.join("")).then(()=>k(!0)).catch(Ee=>{if(Ee?.status===422)D("Invalid or expired verification code");else if(Ee instanceof xr&&Ee.privyErrorCode==="cannot_link_more_of_type")D(Ee.message);else if(Ee instanceof xr&&Ee.privyErrorCode==="max_accounts_reached"){console.error(new Hr(Ee).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(Ee instanceof xr&&Ee.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(Ee instanceof xr&&Ee.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:Ee,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else D("Issue verifying code");M(0)}))},rt=pe=>{W===1&&(D(null),M(null));let Q=[...S.slice(0,pe),"",...S.slice(pe+1)];_(Q),pe>0&&document.querySelector(`input[name=code-${pe-1}]`)?.focus()},Gt=ee==0?(0,De.jsx)(ah.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,De.jsx)(sh.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),Je=ee==0?(0,De.jsxs)("p",{children:["Please check ",(0,De.jsx)(nh,{children:p()?.email})," for an email from privy.io and enter your code below."]}):(0,De.jsxs)("p",{children:["Please check ",(0,De.jsx)(nh,{children:p()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)(x,{backFn:()=>o()},"header"),(0,De.jsxs)(H0,{children:[(0,De.jsx)(He,{title:"Enter confirmation code",description:Je,icon:Gt}),(0,De.jsxs)(Jf,{children:[(0,De.jsxs)(V0,{children:[(0,De.jsx)(G0,{fail:!!I,success:E,children:(0,De.jsx)("span",{children:I||(E?"Success!":"")})}),(0,De.jsx)("div",{children:S.map((pe,Q)=>(0,De.jsx)("input",{name:`code-${Q}`,type:"text",value:S[Q],onChange:L,onKeyUp:ot=>{ot.key==="Backspace"&&rt(Q)},inputMode:"numeric",autoFocus:Q===0,pattern:"[0-9]",className:`${E?"success":""} ${I?"fail":""}`,autoComplete:lh.isMobile?"one-time-code":"off"},Q))})]}),(0,De.jsxs)(q0,{children:[(0,De.jsxs)("span",{children:["Didn't get ",ee==0?"an email":"a message","?"]}),H?(0,De.jsxs)($0,{children:[(0,De.jsx)(ih.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),(0,De.jsx)("span",{children:"Code sent"})]}):(0,De.jsx)(z0,{children:(0,De.jsx)("button",{onClick:async()=>{z(B0),ee==0?await l():await s()},children:"Resend code"})})]})]})]}),(0,De.jsx)(j,{protectedByPrivy:!0})]})},H0=wn.default.div`
|
|
778
778
|
display: flex;
|
|
779
779
|
flex-direction: column;
|
|
780
780
|
align-items: flex-start;
|
|
@@ -899,7 +899,7 @@ Resources:
|
|
|
899
899
|
left: -19px;
|
|
900
900
|
top: -19px;
|
|
901
901
|
}
|
|
902
|
-
`;var Lt=require("react/jsx-runtime"),yh=500,uh=yh*2,gh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=A(),{status:i,token:l,waitForResult:s,reset:p,execute:u}=Pe(),h=(0,Wr.useRef)([]),
|
|
902
|
+
`;var Lt=require("react/jsx-runtime"),yh=500,uh=yh*2,gh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=A(),{status:i,token:l,waitForResult:s,reset:p,execute:u}=Pe(),h=(0,Wr.useRef)([]),f=K=>{h.current=[K,...h.current]},[v,b]=(0,Wr.useState)(!0);(0,Wr.useEffect)(()=>{let K=setTimeout(b,uh,!1);return f(K),()=>{h.current.forEach(L=>clearTimeout(L)),h.current=[]}},[]);let[g,S]=(0,Wr.useState)(""),[_,E]=(0,Wr.useState)("Checking that you are a human..."),[k,I]=(0,Wr.useState)((0,Lt.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[D,W]=(0,Wr.useState)(!1),[M,H]=(0,Wr.useState)(3),z=r?.captchaModalData,ee=async K=>{try{await z?.callback(K),z?.onSuccessNavigateTo&&n(z?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Rr)return;{let rt={error:L,previousScreen:e||"LANDING"};a({errorModalData:rt}),n(z?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,Wr.useEffect)(()=>{if(i==="success"){let K=setTimeout(async()=>{let L=await s();!L||z?.userIntentRequired||ee(L)},uh);f(K)}else if(i==="ready"){let K=setTimeout(()=>{i==="ready"&&u()},yh);f(K)}},[i]),(0,Wr.useEffect)(()=>{if(!v)switch(i){case"success":S("Success!"),E("CAPTCHA passed successfully."),I((0,Lt.jsx)(F,{onClick:()=>{W(!0),ee(l)},disabled:!z?.userIntentRequired,loading:D,children:z?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),E("Checking that you are a human..."),I((0,Lt.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),M<=0?(E("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(E("You did not pass CAPTCHA. Please try again."),I((0,Lt.jsx)(F,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[i,v,D]);let O=async()=>{if(M<=0)return;H(L=>L-1),p(),u();let K=await s();!K||z?.userIntentRequired||ee(K)};return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(x,{backFn:!e||t===e?void 0:o}),(0,Lt.jsxs)(j0,{children:[i==="success"?(0,Lt.jsx)(mh.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?(0,Lt.jsx)(fh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Lt.jsx)(dh,{}),(0,Lt.jsxs)(dt,{children:[g?(0,Lt.jsx)("h3",{children:g}):null,(0,Lt.jsx)("p",{children:_})]}),k]}),(0,Lt.jsx)($,{})]})},j0=hh.default.div`
|
|
903
903
|
display: flex;
|
|
904
904
|
flex-direction: column;
|
|
905
905
|
align-items: center;
|
|
@@ -928,14 +928,14 @@ Resources:
|
|
|
928
928
|
display: none;
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
`;var yo=require("react/jsx-runtime"),X0=["coinbase_wallet"],eC=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],tC=["cryptocom"],rC=["phantom"],ji=({connectOnly:e})=>{let{connectors:t}=R(),{app:r}=A(),o=Qa(r.appearance.walletList,t,e,r.appearance.walletList);return(0,yo.jsxs)(yo.Fragment,{children:[...o]})},Qa=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let p=t.filter(({connectorType:u,walletClientType:h})=>h==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(h));for(let u of p){let{walletClientType:h,walletBranding:
|
|
931
|
+
`;var yo=require("react/jsx-runtime"),X0=["coinbase_wallet"],eC=["metamask","okx_wallet","rainbow","uniswap","zerion","rabby_wallet"],tC=["cryptocom"],rC=["phantom"],ji=({connectOnly:e})=>{let{connectors:t}=R(),{app:r}=A(),o=Qa(r.appearance.walletList,t,e,r.appearance.walletList);return(0,yo.jsxs)(yo.Fragment,{children:[...o]})},Qa=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let p=t.filter(({connectorType:u,walletClientType:h})=>h==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(h));for(let u of p){let{walletClientType:h,walletBranding:f}=u;(h==="unknown"?a:n).push((0,yo.jsx)(ii,{connectOnly:r,provider:h,logo:f.icon,displayName:f.name,connector:u},`${s}-${h}`))}}else if(rC.includes(s)){let p=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);p&&n.push((0,yo.jsx)(ii,{connectOnly:r,provider:s,connector:p},s))}else if(eC.includes(s)){let p=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;p&&n.push((0,yo.jsx)(ii,{connectOnly:r,provider:s,connector:p},s))}else if(X0.includes(s)){let p=t.find(({connectorType:u})=>u===s);p&&n.push((0,yo.jsx)(ii,{connectOnly:r,provider:s,connector:p},s))}else tC.includes(s)?l&&i.push((0,yo.jsx)(ii,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push((0,yo.jsx)(ii,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};var ko=require("react/jsx-runtime"),_h=()=>{let{app:e}=A(),{linkingOrConnectingHint:t}=R(),r=t?`Connect the wallet with address ${Vr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return(0,ko.jsxs)(ko.Fragment,{children:[(0,ko.jsx)(x,{},"header"),(0,ko.jsx)(xo,{title:"Connect your wallet",description:r}),(0,ko.jsx)(po,{children:(0,ko.jsx)(ji,{connectOnly:!0})}),(0,ko.jsx)(j,{protectedByPrivy:!0})]})};var Rh=y(require("styled-components"));var xh=y(require("react"));var kh=require("react/jsx-runtime"),Ah=()=>{let{app:e}=A(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,kh.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?xh.default.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};var jp=require("react/jsx-runtime"),Yi=e=>{let{app:t}=A();return t?.appearance.logo?(0,jp.jsx)(oC,{...e,children:(0,jp.jsx)(Ah,{})}):null},oC=Rh.default.div`
|
|
932
932
|
display: flex;
|
|
933
933
|
flex-direction: column;
|
|
934
934
|
align-items: center;
|
|
935
935
|
padding: 24px 0;
|
|
936
936
|
flex-grow: 1;
|
|
937
937
|
justify-content: center;
|
|
938
|
-
`;var jr=require("react/jsx-runtime"),Ih=()=>{let{app:e}=A(),{linkingOrConnectingHint:t}=R(),r=t?`Connect the wallet with address ${Vr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return(0,jr.jsxs)(jr.Fragment,{children:[(0,jr.jsx)(x,{},"header"),(0,jr.jsx)(Yi,{}),(0,jr.jsx)(ni,{title:"Connect your wallet",description:r}),(0,jr.jsx)(po,{children:(0,jr.jsx)(ji,{connectOnly:!0})}),e&&(0,jr.jsx)($i,{app:e,alwaysShowImplicitConsent:!0}),(0,jr.jsx)(j,{protectedByPrivy:!0})]})};var Qi=require("react"),Lh=require("react-device-detect"),Nh=y(require("styled-components"));var Yr=require("react"),Xa=require("react-device-detect"),Zp=y(require("styled-components"));var Ja=require("react"),nC=(e,t)=>{let r=(0,Ja.useRef)(()=>{});(0,Ja.useEffect)(()=>{r.current=e}),(0,Ja.useEffect)(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Wh=nC;var Zi=require("react");function Mh(){let[e,t]=(0,Zi.useState)(!1),r=(0,Zi.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Zi.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ve=require("react/jsx-runtime"),Yp=2,Qp=e=>e?.privyErrorCode==="linked_to_another_user"?$o.ERROR_USER_EXISTS:e instanceof It&&!e.details.default?e.details:e instanceof ki?$o.ERROR_TIMED_OUT:e instanceof Ri?$o.ERROR_USER_REJECTED_CONNECTION:$o.ERROR_WALLET_CONNECTION,Oh=()=>{let[e,t]=(0,Yr.useState)(!1),[r,o]=(0,Yr.useState)(!1),[n,a]=(0,Yr.useState)(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:p,navigateBack:u,lastScreen:h,currentScreen:
|
|
938
|
+
`;var jr=require("react/jsx-runtime"),Ih=()=>{let{app:e}=A(),{linkingOrConnectingHint:t}=R(),r=t?`Connect the wallet with address ${Vr(t)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return(0,jr.jsxs)(jr.Fragment,{children:[(0,jr.jsx)(x,{},"header"),(0,jr.jsx)(Yi,{}),(0,jr.jsx)(ni,{title:"Connect your wallet",description:r}),(0,jr.jsx)(po,{children:(0,jr.jsx)(ji,{connectOnly:!0})}),e&&(0,jr.jsx)($i,{app:e,alwaysShowImplicitConsent:!0}),(0,jr.jsx)(j,{protectedByPrivy:!0})]})};var Qi=require("react"),Lh=require("react-device-detect"),Nh=y(require("styled-components"));var Yr=require("react"),Xa=require("react-device-detect"),Zp=y(require("styled-components"));var Ja=require("react"),nC=(e,t)=>{let r=(0,Ja.useRef)(()=>{});(0,Ja.useEffect)(()=>{r.current=e}),(0,Ja.useEffect)(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},Wh=nC;var Zi=require("react");function Mh(){let[e,t]=(0,Zi.useState)(!1),r=(0,Zi.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Zi.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ve=require("react/jsx-runtime"),Yp=2,Qp=e=>e?.privyErrorCode==="linked_to_another_user"?$o.ERROR_USER_EXISTS:e instanceof It&&!e.details.default?e.details:e instanceof ki?$o.ERROR_TIMED_OUT:e instanceof Ri?$o.ERROR_USER_REJECTED_CONNECTION:$o.ERROR_WALLET_CONNECTION,Oh=()=>{let[e,t]=(0,Yr.useState)(!1),[r,o]=(0,Yr.useState)(!1),[n,a]=(0,Yr.useState)(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:p,navigateBack:u,lastScreen:h,currentScreen:f,setModalData:v}=A(),{getAuthFlow:b,walletConnectionStatus:g,closePrivyModal:S,initLoginWithWallet:_,loginWithWallet:E,updateWallets:k,createAnalyticsEvent:I}=R(),{walletConnectors:D}=G(),[W,M]=(0,Yr.useState)(0),{user:H}=G(),[z]=(0,Yr.useState)(H?.linkedAccounts.length||0),[ee,O]=(0,Yr.useState)(""),[K,L]=(0,Yr.useState)(!1),{hasTabbedAway:rt}=Mh(),{enabled:Gt,token:Je}=Pe(),pe=Xa.isMobile&&g?.connector?.connectorType==="wallet_connect_v2"||Xa.isMobile&&g?.connector?.connectorType==="coinbase_wallet"||Xa.isMobile&&g?.connector?.connectorType==="injected"&&g?.connector?.walletClientType==="phantom",Q=g?.status==="connected",ot=g?.status==="switching_to_supported_chain";(0,Yr.useEffect)(()=>{let We=b();if(Q&&!We&&(Gt&&!Je&&!i?(v({captchaModalData:{callback:te=>_(g.connectedWallet,te).then(()=>{L(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),p("CAPTCHA_SCREEN",!1)):_(g.connectedWallet,Je).then(()=>{L(!0)})),We&&pe&&Q&&!We.preparedMessage){We.buildSiweMessage();return}!We||pe||!Q||r||(async()=>{o(!0),a(void 0);try{g?.connector?.connectorType==="wallet_connect_v2"&&g?.connector?.walletClientType==="metamask"&&await dp(2500),await dr()}catch(te){console.warn("Auto-prompted signature failed",te)}finally{o(!1)}})()},[W,Q,K]),(0,Yr.useEffect)(()=>{if(H&&e){let te=et-500;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let Me=setTimeout(()=>{p("AFFIRMATIVE_CONSENT_SCREEN")},te);return()=>clearTimeout(Me)}if(hr(H,s?.embeddedWallets?.createOnLogin)){let Me=setTimeout(()=>{v({createWallet:{onSuccess:()=>{},onFailure:or=>{console.error(or),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:or,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),p("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},te);return()=>clearTimeout(Me)}k();let se=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),et);return()=>clearTimeout(se)}},[H,e]);let at=We=>{if(We?.privyErrorCode==="allowlist_rejected"){p("ALLOWLIST_REJECTION_SCREEN");return}else if(We?.privyErrorCode==="max_accounts_reached"){console.error(new Hr(We).toString()),p("USER_LIMIT_REACHED_SCREEN");return}else if(We?.privyErrorCode==="user_does_not_exist"){p("ACCOUNT_NOT_FOUND_SCREEN");return}a(Qp(We))};async function dr(){try{await E(),t(!0)}catch(We){at(We)}finally{o(!1)}}(0,Yr.useEffect)(()=>{g?.connectError&&at(g?.connectError)},[g]),Wh(()=>{let We=_r==="wallet_connect_v2"&&g?.connector instanceof So?g.connector.redirectUri:void 0;We&&O(We)},g?.connector instanceof So&&!ee?500:null);let _r=g?.connector?.connectorType||"injected",rr=g?.connector?.walletClientType||"unknown",qt=Kr[rr]?.displayName||g?.connector?.walletBranding.name||"Browser Extension",Ee=Kr[rr]?.logo||g?.connector?.walletBranding.icon||(We=>(0,Ve.jsx)(Mi,{...We})),st=qt==="Browser Extension"?qt.toLowerCase():qt,ur;e?ur=`Successfully connected with ${st}`:n?ur=n.message:ot?ur="Switching networks":Q?ur=r&&pe?"Signing":"Sign to verify":ur=`Waiting for ${st}`;let mt="Don\u2019t see your wallet? Check your other browser windows.";if(e){let We=H?.linkedAccounts.length||0;z===We?mt="Wallet was already linked.":mt="You\u2019re good to go!"}else W>=Yp&&n?mt="Unable to connect wallet":n?mt=n.detail:ot?mt="Switch your wallet to the requested network.":Q&&pe?mt="Sign the message in your wallet to verify it belongs to you.":rr==="metamask"&&Xa.isMobile?mt="Click continue to open and connect MetaMask.":rr==="metamask"?mt="For the best experience, connect only one wallet at a time.":_r==="wallet_connect"?mt="Open your mobile wallet app to continue":_r==="coinbase_wallet"&&(js()||(Ip(H)?mt="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":mt="Open the Coinbase app on your phone to continue."));let N=D?.walletConnectors?.find(We=>We.walletClientType==="coinbase_wallet"),Bo=rr==="coinbase_wallet"&&(Ip(H)||n===$o.ERROR_USER_EXISTS);return(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(x,{backFn:!h||f===h?void 0:u}),(0,Ve.jsxs)(iC,{children:[(0,Ve.jsx)(Jp,{walletLogo:Ee,success:e,fail:!!n}),(0,Ve.jsxs)(dt,{children:[(0,Ve.jsx)("h3",{children:ur}),(0,Ve.jsx)("p",{children:mt}),!Q&&ee&&!rt?(0,Ve.jsxs)("p",{children:["Still here?"," ",(0,Ve.jsx)("a",{href:ee,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Bo?(0,Ve.jsx)(F,{onClick:()=>N&&N?.disconnect(),disabled:e,children:"Use a different wallet"}):n==$o.ERROR_USER_EXISTS&&f!==h?(0,Ve.jsx)(F,{onClick:u,children:"Use a different wallet"}):Q&&!e&&pe?(0,Ve.jsx)(F,{onClick:()=>{o(!0),dr()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&W<Yp?(0,Ve.jsx)(F,{onClick:()=>{M(W+1),a(void 0),Q?(o(!0),dr()):g?.connectRetry()},disabled:!e&&(!n?.retryable||W>=Yp),children:"Retry"}):!e&&!n?(0,Ve.jsx)(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,Ve.jsx)($,{})]})},iC=Zp.default.div`
|
|
939
939
|
display: flex;
|
|
940
940
|
flex-direction: column;
|
|
941
941
|
align-items: center;
|
|
@@ -965,14 +965,14 @@ Resources:
|
|
|
965
965
|
left: -19px;
|
|
966
966
|
top: -19px;
|
|
967
967
|
}
|
|
968
|
-
`,Jp=e=>{let t=e.walletLogo;return(0,Ve.jsx)(Ve.Fragment,{children:(0,Ve.jsx)(aC,{children:(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)(bt,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ve.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ve.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var Jt=require("react/jsx-runtime"),Yl=2,Dh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=R(),[a,i]=(0,Qi.useState)(void 0),[l,s]=(0,Qi.useState)(0),p=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Qi.useEffect)(()=>{if(p){let k=setTimeout(n,et);return()=>clearTimeout(k)}},[p]);let h=k=>{i(Qp(k))};(0,Qi.useEffect)(()=>{o?.connectError&&h(o?.connectError)},[o]);let
|
|
968
|
+
`,Jp=e=>{let t=e.walletLogo;return(0,Ve.jsx)(Ve.Fragment,{children:(0,Ve.jsx)(aC,{children:(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)(bt,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ve.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ve.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var Jt=require("react/jsx-runtime"),Yl=2,Dh=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=R(),[a,i]=(0,Qi.useState)(void 0),[l,s]=(0,Qi.useState)(0),p=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Qi.useEffect)(()=>{if(p){let k=setTimeout(n,et);return()=>clearTimeout(k)}},[p]);let h=k=>{i(Qp(k))};(0,Qi.useEffect)(()=>{o?.connectError&&h(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",v=o?.connector?.walletClientType||"unknown",b=Kr[v]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",g=Kr[v]?.logo||o?.connector?.walletBranding.icon||(k=>(0,Jt.jsx)(Mi,{...k})),S=b==="Browser Extension"?b.toLowerCase():b,_;p?_=`Successfully connected with ${S}`:a?_=a.message:u?_="Switching networks":_=`Waiting for ${S}`;let E="Don\u2019t see your wallet? Check your other browser windows.";return p?E="You\u2019re good to go!":l>=Yl&&a?E="Unable to connect wallet":a?E=a.detail:u?E="Switch your wallet to the requested network.":v==="metamask"&&Lh.isMobile?E="Click to continue to open and connect MetaMask.":v==="metamask"?E="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?E="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(E="Open the Coinbase app on your phone to continue."),(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(x,{backFn:r===t?void 0:e}),(0,Jt.jsxs)(sC,{children:[(0,Jt.jsx)(Jp,{walletLogo:g,success:p,fail:!!a}),(0,Jt.jsxs)(dt,{children:[(0,Jt.jsx)("h3",{children:_}),(0,Jt.jsx)("p",{children:E})]}),a==$o.ERROR_USER_EXISTS?(0,Jt.jsx)(F,{onClick:e,children:"Use a different wallet"}):!p&&a?.retryable&&l<Yl?(0,Jt.jsx)(F,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!p&&(!a?.retryable||l>=Yl),children:"Retry"}):!p&&a&&l>=Yl?(0,Jt.jsx)(F,{onClick:e,children:"Use a different wallet"}):null]}),(0,Jt.jsx)($,{})]})},sC=Nh.default.div`
|
|
969
969
|
display: flex;
|
|
970
970
|
flex-direction: column;
|
|
971
971
|
align-items: center;
|
|
972
972
|
justify-content: center;
|
|
973
973
|
gap: 24px;
|
|
974
974
|
width: 100%;
|
|
975
|
-
`;var ai=require("react"),Fh=y(require("styled-components"));var Xp=require("react/jsx-runtime"),Uh=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?(0,Xp.jsx)("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px"}}):(0,Xp.jsx)("span",{})};var zt=require("react/jsx-runtime"),Bh=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=A(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=R(),[a,i]=(0,ai.useState)({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=et,p=new C(`There was an issue connecting your ${l.name} account. Please try again.`),u=new nt(async b=>{if(!e?.crossAppAuth?.popup){i({error:p});return}try{let g=await r({appId:b,popup:e.crossAppAuth.popup});i({data:g})}catch(g){g instanceof C?i({error:g}):i({error:p})}}),h=()=>{a.data&&(o(),e?.crossAppAuth?.onSuccess(a.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(a.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=h,(0,ai.useEffect)(()=>{l.id.length&&u.execute(l.id)},[l.id]),(0,ai.useEffect)(()=>{if(!a.data)return;let b=setTimeout(h,s);return()=>clearTimeout(b)},[a.data]);let{title:
|
|
975
|
+
`;var ai=require("react"),Fh=y(require("styled-components"));var Xp=require("react/jsx-runtime"),Uh=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?(0,Xp.jsx)("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px"}}):(0,Xp.jsx)("span",{})};var zt=require("react/jsx-runtime"),Bh=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t}=A(),{crossAppAuthFlow:r,updateWallets:o,closePrivyModal:n}=R(),[a,i]=(0,ai.useState)({}),l={id:e?.crossAppAuth?.appId??"",name:e?.crossAppAuth?.name??"app",logoUrl:e?.crossAppAuth?.logoUrl},s=et,p=new C(`There was an issue connecting your ${l.name} account. Please try again.`),u=new nt(async b=>{if(!e?.crossAppAuth?.popup){i({error:p});return}try{let g=await r({appId:b,popup:e.crossAppAuth.popup});i({data:g})}catch(g){g instanceof C?i({error:g}):i({error:p})}}),h=()=>{a.data&&(o(),e?.crossAppAuth?.onSuccess(a.data),n({shouldCallAuthOnSuccess:!0,isSuccess:!0})),e?.crossAppAuth?.onError(a.error??new C("User canceled flow")),n({shouldCallAuthOnSuccess:!1,isSuccess:!1})};t.current=h,(0,ai.useEffect)(()=>{l.id.length&&u.execute(l.id)},[l.id]),(0,ai.useEffect)(()=>{if(!a.data)return;let b=setTimeout(h,s);return()=>clearTimeout(b)},[a.data]);let{title:f,subtitle:v}=(0,ai.useMemo)(()=>a.data?{title:`Successfully connected with ${l.name}`,subtitle:"You're good to go!"}:a.error?{title:"Authentication failed",subtitle:a.error.message}:{title:`Connecting to ${l.name}`,subtitle:`Please check the pop-up from ${l.name} to continue`},[a,l.name]);return(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(x,{onClose:h}),(0,zt.jsx)(le,{}),(0,zt.jsxs)(lC,{children:[(0,zt.jsx)(pt,{children:(0,zt.jsxs)("div",{children:[(0,zt.jsx)(bt,{success:!!a.data,fail:!!a.error}),(0,zt.jsx)(Uh,{name:l.name,logoUrl:l.logoUrl})]})}),(0,zt.jsxs)(dt,{children:[(0,zt.jsx)("h3",{children:f}),(0,zt.jsx)("p",{children:v})]})]}),(0,zt.jsx)(me,{}),(0,zt.jsx)($,{})]})},lC=Fh.default.div`
|
|
976
976
|
display: flex;
|
|
977
977
|
flex-direction: column;
|
|
978
978
|
align-items: center;
|
|
@@ -1036,9 +1036,9 @@ Resources:
|
|
|
1036
1036
|
transform: rotate(360deg);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
`;var Hh=["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 Ge=class extends Error{constructor(r,o){super(o);this.type=r}};function ea(e){let t=e.type;return typeof t=="string"&&Hh.includes(t)}function mC(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function si(e){return ea(e)&&e.type==="wallet_not_on_device"}function Vh(e){return ea(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function bn(e){return!!(ea(e)&&e.type==="mfa_timeout")}function En(e){return!!(ea(e)&&e.type==="missing_or_invalid_mfa")}function Zl(e){return!!(ea(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ql(e){return!!(ea(e)&&e.message.includes("code 429"))}function Jl(e){return!!(mC(e)&&e.message==="MFA canceled")}function ed({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Xl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?ed({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function ec(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 td({api:e,provider:t}){let r=jn(),o=Pi(),n=await Si(r);try{return t==="icloud"?{url:(await e.post(_u,{client_type:"web"})).url}:{url:(await e.post(Su,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(a){throw ue(a)}}async function Gh({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(xu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(a){let i=ue(a);throw i.privyErrorCode?new C(i.message||"Invalid code during OAuth flow.",void 0,i.privyErrorCode):i.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")}}var br=require("react/jsx-runtime"),qh=1,Kh=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=R(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:p}=A(),u=(0,ta.useMemo)(()=>Date.now(),[]),[h,
|
|
1039
|
+
`;var Hh=["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 Ge=class extends Error{constructor(r,o){super(o);this.type=r}};function ea(e){let t=e.type;return typeof t=="string"&&Hh.includes(t)}function mC(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function si(e){return ea(e)&&e.type==="wallet_not_on_device"}function Vh(e){return ea(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function bn(e){return!!(ea(e)&&e.type==="mfa_timeout")}function En(e){return!!(ea(e)&&e.type==="missing_or_invalid_mfa")}function Zl(e){return!!(ea(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ql(e){return!!(ea(e)&&e.message.includes("code 429"))}function Jl(e){return!!(mC(e)&&e.message==="MFA canceled")}function ed({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Xl({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r=!1,isResettingPassword:o=!1}){return r||t.length===1?ed({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function ec(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 td({api:e,provider:t}){let r=jn(),o=Pi(),n=await Si(r);try{return t==="icloud"?{url:(await e.post(_u,{client_type:"web"})).url}:{url:(await e.post(Su,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(a){throw ue(a)}}async function Gh({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(xu,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(a){let i=ue(a);throw i.privyErrorCode?new C(i.message||"Invalid code during OAuth flow.",void 0,i.privyErrorCode):i.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")}}var br=require("react/jsx-runtime"),qh=1,Kh=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=R(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:p}=A(),u=(0,ta.useMemo)(()=>Date.now(),[]),[h,f]=(0,ta.useState)(!1),{onCompleteNavigateTo:v,onFailure:b,shouldForceMFA:g,address:S}=l?.connectWallet,_=k=>{h||(f(!0),b(typeof k=="string"?new Error(k):k))};(0,ta.useEffect)(()=>{let k=S?t?.linkedAccounts.find(W=>W.type==="wallet"&&W.walletClientType==="privy"&&W.address===S):Oe(t),I;return!e||!k?_("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let W=await r();if(!W)return _("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:W,address:k.address}),g&&await a.verifyMfa({accessToken:W});let M=(Date.now()-u)/1e3;v==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&M<qh?I=setTimeout(()=>{i(v)},(qh-M)*1e3):i(v)}catch(M){if(si(M)&&k.recoveryMethod==="privy"){let H=await r();if(!H)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:k.address}}),(await a?.recover({address:k.address,accessToken:H,recoveryMethod:k.recoveryMethod}))?.address||_(new Error("Unable to recover wallet")),v?i(v):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:k.address}}),i(v)}catch{_("An error has occurred, please try again.")}}else if(si(M)&&k.recoveryMethod!=="privy"){s({...l,recoverWallet:{privyWallet:k,onCompleteNavigateTo:v,onFailure:b},recoveryOAuthStatus:{provider:k.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=ec(k.recoveryMethod);i(H)}else _(M)}})(),()=>clearTimeout(I)):void 0},[e,t,a]);let E=()=>{_("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return p.current=E,(0,br.jsxs)(br.Fragment,{children:[(0,br.jsx)(x,{onClose:E}),h?(0,br.jsxs)(br.Fragment,{children:[(0,br.jsxs)(mo,{children:[(0,br.jsx)(zh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,br.jsx)(He,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,br.jsx)(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,br.jsx)(Xi,{}),(0,br.jsx)(fC,{})]})},fC=$h.default.div`
|
|
1040
1040
|
height: 44px;
|
|
1041
|
-
`;var jh=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Yh=require("react");var Zr=require("react/jsx-runtime"),Zh=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=R(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:p}=a.createWallet,u=()=>{let h=Oe(e);h?(o(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:p})};return(0,Yh.useEffect)(()=>{let h=setTimeout(u,im);return()=>clearTimeout(h)},[]),i.current=u,(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(x,{onClose:u}),(0,Zr.jsx)(le,{}),(0,Zr.jsxs)(mo,{children:[(0,Zr.jsx)(jh.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Zr.jsx)(He,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,Zr.jsx)(me,{}),(0,Zr.jsx)(j,{protectedByPrivy:!0})]})};var Xh=y(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),ey=y(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),Zo=require("react"),Qo=y(require("styled-components"));var be=require("react/jsx-runtime"),ty=()=>{let[e,t]=(0,Zo.useState)(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=R(),{data:s,onUserCloseViaDialogOrKeybindRef:p}=A(),u=Oe(o)?.address,{onFailure:h,onSuccess:
|
|
1041
|
+
`;var jh=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Yh=require("react");var Zr=require("react/jsx-runtime"),Zh=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=R(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:p}=a.createWallet,u=()=>{let h=Oe(e);h?(o(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:p})};return(0,Yh.useEffect)(()=>{let h=setTimeout(u,im);return()=>clearTimeout(h)},[]),i.current=u,(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(x,{onClose:u}),(0,Zr.jsx)(le,{}),(0,Zr.jsxs)(mo,{children:[(0,Zr.jsx)(jh.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Zr.jsx)(He,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,Zr.jsx)(me,{}),(0,Zr.jsx)(j,{protectedByPrivy:!0})]})};var Xh=y(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),ey=y(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),Zo=require("react"),Qo=y(require("styled-components"));var be=require("react/jsx-runtime"),ty=()=>{let[e,t]=(0,Zo.useState)(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=R(),{data:s,onUserCloseViaDialogOrKeybindRef:p}=A(),u=Oe(o)?.address,{onFailure:h,onSuccess:f,origin:v,appId:b,appClientId:g}=s.keyExport,S=E=>{a({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},_=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return(0,Zo.useEffect)(()=>{let E=Oe(o);if(!r||!E)return S("User must be authenticated before exporting their wallet");n().then(t,S)},[r,o]),p.current=_,(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(x,{onClose:_}),(0,be.jsxs)(gC,{children:[(0,be.jsxs)(He,{icon:(0,be.jsx)(ey.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,be.jsxs)(bC,{children:[(0,be.jsx)(yC,{style:{marginRight:6}}),Vr(u)]}),(0,be.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,be.jsxs)(vC,{children:[(0,be.jsxs)(Qh,{children:[(0,be.jsx)(Jh,{children:"1"}),(0,be.jsxs)("span",{children:[(0,be.jsx)("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),(0,be.jsxs)(Qh,{children:[(0,be.jsx)(Jh,{children:"2"}),(0,be.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,be.jsx)("div",{style:{width:"100%"},children:e&&(0,be.jsx)(hC,{origin:v,appId:b,appClientId:g,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,be.jsxs)(EC,{children:[(0,be.jsxs)("div",{children:[(0,be.jsx)(Xh.default,{viewBox:"0 0 20 18"}),(0,be.jsx)("h4",{children:"Warning"})]}),(0,be.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,be.jsx)(j,{protectedByPrivy:!0})]})};function hC(e){let[t,r]=(0,Zo.useState)(e.dimensions.width),[o,n]=(0,Zo.useState)(void 0),a=(0,Zo.useRef)(null);return(0,Zo.useEffect)(()=>{if(a.current&&t===void 0){let{width:l}=a.current.getBoundingClientRect();r(l)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),(0,be.jsx)("div",{ref:a,children:t&&(0,be.jsxs)(CC,{children:[(0,be.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Zs(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})}),(0,be.jsx)(wC,{children:"Loading..."})]})})}function yC(e){return(0,be.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,be.jsx)("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var gC=Qo.default.div`
|
|
1042
1042
|
display: flex;
|
|
1043
1043
|
flex-direction: column;
|
|
1044
1044
|
text-align: left;
|
|
@@ -1123,7 +1123,7 @@ Resources:
|
|
|
1123
1123
|
color: var(--privy-color-error);
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
`;var ry=y(require("@heroicons/react/24/solid/XCircleIcon")),ts=require("react"),oy=y(require("styled-components"));var tc=require("react");function rc(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=R(),o=(0,tc.useRef)(!1);return{createWallet:(0,tc.useCallback)(async a=>{let i=await Te();if(!i)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(Ti);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,p=new Promise((v,b)=>{setTimeout(()=>{b(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:i,recoveryPassword:a}),p]))throw new Error("walletProxy.create did not send a response.");let h=await e();if(!h)throw new Error("Failed to refresh user.");let
|
|
1126
|
+
`;var ry=y(require("@heroicons/react/24/solid/XCircleIcon")),ts=require("react"),oy=y(require("styled-components"));var tc=require("react");function rc(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=R(),o=(0,tc.useRef)(!1);return{createWallet:(0,tc.useCallback)(async a=>{let i=await Te();if(!i)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(Ti);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,p=new Promise((v,b)=>{setTimeout(()=>{b(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:i,recoveryPassword:a}),p]))throw new Error("walletProxy.create did not send a response.");let h=await e();if(!h)throw new Error("Failed to refresh user.");let f=Oe(h);if(!f)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:f.address}}),o.current=!0,f}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}var Qr=require("react/jsx-runtime"),ny=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=A(),[a,i]=(0,ts.useState)(""),{embeddedWallets:l}=Wt(),{authenticated:s}=G(),{closePrivyModal:p}=R(),{onSuccess:u,onFailure:h,callAuthOnSuccessOnClose:f}=o.createWallet,v=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:b}=rc(),[g,S]=(0,ts.useState)(null),_=new nt(async()=>{try{let k=await b();if(!k)return;S(k),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(k){i(k.message)}});(0,ts.useEffect)(()=>{if(!s){r("LANDING"),h(new Error("User must be authenticated before creating a Privy wallet"));return}if(v){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let k=Xl({walletAction:"create",availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(k)}_.execute()},[v,s]);let E=()=>{g?(u(g),p({shouldCallAuthOnSuccess:f})):(h(new nr("User wallet creation failed")),p({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,a?(0,Qr.jsxs)(Qr.Fragment,{children:[(0,Qr.jsx)(x,{closeable:!1}),(0,Qr.jsxs)(mo,{children:[(0,Qr.jsx)(ry.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Qr.jsx)(He,{title:"Something went wrong",description:a})]}),(0,Qr.jsx)(F,{onClick:E,children:"Close"}),(0,Qr.jsx)(TC,{})]}):(0,Qr.jsx)(Xi,{})},TC=oy.default.div`
|
|
1127
1127
|
height: 44px;
|
|
1128
1128
|
`;var li=require("react");var ca=require("react");var uy=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),aa=require("react");var iy=y(require("@heroicons/react/24/outline/ArrowPathIcon")),ay=y(require("@heroicons/react/24/outline/EyeIcon")),sy=y(require("@heroicons/react/24/outline/EyeSlashIcon")),vt=y(require("styled-components"));var PC=vt.css`
|
|
1129
1129
|
font-size: 14px;
|
|
@@ -1304,7 +1304,7 @@ Resources:
|
|
|
1304
1304
|
transition: all 0.1s ease-out;
|
|
1305
1305
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1306
1306
|
}
|
|
1307
|
-
`;var Ct=require("react/jsx-runtime"),my=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=(0,aa.useState)(!0),[l,s]=(0,aa.useState)(!1),[p,u]=(0,aa.useState)(""),h=r===p;return(0,aa.useEffect)(()=>{p&&!l&&s(!0)},[p]),(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)(x,{closeable:!1,backFn:n}),(0,Ct.jsx)(le,{}),(0,Ct.jsxs)(Tn,{children:[(0,Ct.jsxs)(_n,{children:[(0,Ct.jsx)(uy.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Ct.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,Ct.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,Ct.jsxs)(Sn,{children:[(0,Ct.jsx)(ra,{value:p,onChange:
|
|
1307
|
+
`;var Ct=require("react/jsx-runtime"),my=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=(0,aa.useState)(!0),[l,s]=(0,aa.useState)(!1),[p,u]=(0,aa.useState)(""),h=r===p;return(0,aa.useEffect)(()=>{p&&!l&&s(!0)},[p]),(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)(x,{closeable:!1,backFn:n}),(0,Ct.jsx)(le,{}),(0,Ct.jsxs)(Tn,{children:[(0,Ct.jsxs)(_n,{children:[(0,Ct.jsx)(uy.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Ct.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,Ct.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,Ct.jsxs)(Sn,{children:[(0,Ct.jsx)(ra,{value:p,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),(0,Ct.jsx)(oa,{style:{right:"0.75rem"},children:a?(0,Ct.jsx)(na,{onClick:()=>i(!1)}):(0,Ct.jsx)(ia,{onClick:()=>i(!0)})})]}),(0,Ct.jsx)(oc,{"aria-hidden":!l||h,error:!0,children:"Passwords do not match"})]}),(0,Ct.jsx)(Pn,{onClick:o,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),(0,Ct.jsx)(me,{}),(0,Ct.jsx)(j,{protectedByPrivy:!0})]})};var gy=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),vy=require("react"),Cy=y(require("styled-components"));var sa=y(require("styled-components")),xn=require("react/jsx-runtime"),fy=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,xn.jsx)("label",{children:(0,xn.jsxs)(SC,{className:e,children:[(0,xn.jsx)(yy,{checked:t,...o}),(0,xn.jsx)(_C,{color:r,checked:t,children:(0,xn.jsx)(hy,{viewBox:"0 0 24 24",children:(0,xn.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})});var rx=sa.default.label`
|
|
1308
1308
|
&& {
|
|
1309
1309
|
cursor: pointer;
|
|
1310
1310
|
display: flex;
|
|
@@ -1359,18 +1359,18 @@ Resources:
|
|
|
1359
1359
|
`;var ut=require("react/jsx-runtime"),wy=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=(0,vy.useState)(!1);return(0,ut.jsxs)(ut.Fragment,{children:[(0,ut.jsx)(x,{closeable:!1,backFn:o}),(0,ut.jsx)(le,{}),(0,ut.jsxs)(Tn,{children:[(0,ut.jsxs)(_n,{children:[(0,ut.jsx)(gy.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,ut.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,ut.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,ut.jsx)(rs,{children:(0,ut.jsxs)(os,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[(0,ut.jsx)(fy,{color:"var(--privy-color-error)",readOnly:!0,checked:a}),(0,ut.jsx)(ut.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),(0,ut.jsxs)(xC,{children:[n.initiatedBy==="user"&&(0,ut.jsx)(lo,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,ut.jsx)(Pn,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),(0,ut.jsx)(me,{}),(0,ut.jsx)(j,{protectedByPrivy:!0})]})},xC=Cy.default.div`
|
|
1360
1360
|
display: flex;
|
|
1361
1361
|
gap: 10px;
|
|
1362
|
-
`;var ky=y(require("@heroicons/react/24/outline/KeyIcon")),od=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Jo=require("react"),nd=y(require("styled-components"));var by=y(require("fast-password-entropy")),Ey=y(require("secure-password-utilities")),Ty=require("secure-password-utilities/wordlists"),AC=95,kC=8,RC=3,IC=.3,WC=/[a-z]/,MC=/[A-Z]/,OC=/[0-9]/,LC="a-zA-Z0-9",Py="!@#$%^&*()\\-_+.",Sy=`${LC}${Py}`,NC=new RegExp(`[${Py}]`),DC=new RegExp(`[${Sy}]`),_y=new RegExp(`^[${Sy}]{6,}$`),xy=(e="")=>{let t=e.split("").filter(r=>!DC.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},nc=()=>Ey.generatePassphrase(4,Ty.DEFAULT_WORDLIST);function UC(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function FC(e){if(e.length<kC)return 0;let t=0;WC.test(e)&&(t+=1),MC.test(e)&&(t+=1),OC.test(e)&&(t+=1),NC.test(e)&&(t+=1);let r=t/RC;return Math.max(0,Math.min(1,r))}function BC(e=""){let t=FC(e),r=(0,by.default)(e)/AC;return(t*IC+r)/2}function Ay(e=""){let t=BC(e);return{value:t,label:UC(t)}}var ke=require("react/jsx-runtime"),Ry=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:a,onClose:i,onBack:l,onPasswordChange:s,onPasswordGenerate:p})=>{let[u,h]=(0,Jo.useState)(!1),[
|
|
1362
|
+
`;var ky=y(require("@heroicons/react/24/outline/KeyIcon")),od=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Jo=require("react"),nd=y(require("styled-components"));var by=y(require("fast-password-entropy")),Ey=y(require("secure-password-utilities")),Ty=require("secure-password-utilities/wordlists"),AC=95,kC=8,RC=3,IC=.3,WC=/[a-z]/,MC=/[A-Z]/,OC=/[0-9]/,LC="a-zA-Z0-9",Py="!@#$%^&*()\\-_+.",Sy=`${LC}${Py}`,NC=new RegExp(`[${Py}]`),DC=new RegExp(`[${Sy}]`),_y=new RegExp(`^[${Sy}]{6,}$`),xy=(e="")=>{let t=e.split("").filter(r=>!DC.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},nc=()=>Ey.generatePassphrase(4,Ty.DEFAULT_WORDLIST);function UC(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function FC(e){if(e.length<kC)return 0;let t=0;WC.test(e)&&(t+=1),MC.test(e)&&(t+=1),OC.test(e)&&(t+=1),NC.test(e)&&(t+=1);let r=t/RC;return Math.max(0,Math.min(1,r))}function BC(e=""){let t=FC(e),r=(0,by.default)(e)/AC;return(t*IC+r)/2}function Ay(e=""){let t=BC(e);return{value:t,label:UC(t)}}var ke=require("react/jsx-runtime"),Ry=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:a,onClose:i,onBack:l,onPasswordChange:s,onPasswordGenerate:p})=>{let[u,h]=(0,Jo.useState)(!1),[f,v]=(0,Jo.useState)(!1);(0,Jo.useEffect)(()=>{r&&!f&&v(!0)},[r]);let b=(0,Jo.useMemo)(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":_y.test(r||"")?null:`Invalid characters used ( ${xy(r).join(" ")} )`:null,[r,f]),g=(0,Jo.useMemo)(()=>b?{value:0,label:"Weak"}:Ay(r),[r,b]),S=(0,Jo.useMemo)(()=>!!(!r?.length||b),[b,r]);return(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(x,{onClose:i,closeable:o.initiatedBy==="user",backFn:l}),(0,ke.jsx)(le,{}),(0,ke.jsxs)(Tn,{children:[(0,ke.jsxs)(_n,{children:[(0,ke.jsx)(ky.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,ke.jsxs)("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),(0,ke.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,ke.jsxs)(Sn,{children:[(0,ke.jsx)(ra,{value:r,onChange:_=>s(_.target.value),placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),(0,ke.jsxs)(oa,{style:{width:"3.5rem"},children:[u?(0,ke.jsx)(na,{onClick:()=>h(!1)}):(0,ke.jsx)(ia,{onClick:()=>h(!0)}),(0,ke.jsx)(py,{onClick:p})]})]}),(0,ke.jsx)(dy,{value:g.value===0?.01:g.value,label:g.label}),(0,ke.jsx)(oc,{error:!!b,children:b||`Password Strength: ${f?g.label:"--"}`}),(0,ke.jsxs)(VC,{children:[(0,ke.jsx)(HC,{children:(0,ke.jsxs)(rs,{children:[(0,ke.jsxs)(os,{children:[(0,ke.jsx)(od.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,ke.jsxs)(os,{children:[(0,ke.jsx)(od.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),(0,ke.jsx)(Pn,{onClick:a,loading:t,disabled:S,hideAnimations:e,children:"Continue"})]})]}),(0,ke.jsx)(me,{}),(0,ke.jsx)(j,{protectedByPrivy:!0})]})},HC=(0,nd.default)(rs)`
|
|
1363
1363
|
flex: 1;
|
|
1364
1364
|
padding-top: 1rem;
|
|
1365
1365
|
`,VC=nd.default.div`
|
|
1366
1366
|
display: flex;
|
|
1367
1367
|
flex-direction: column;
|
|
1368
1368
|
height: 100%;
|
|
1369
|
-
`;var Iy=y(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Wy=y(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),My=y(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Oy=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),ns=require("react");var qe=require("react/jsx-runtime"),Ly=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=(0,ns.useState)(!1),s=(0,ns.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),p=(0,ns.useCallback)(()=>{let u=document.createElement("a"),h=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),
|
|
1369
|
+
`;var Iy=y(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Wy=y(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),My=y(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Oy=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),ns=require("react");var qe=require("react/jsx-runtime"),Ly=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=(0,ns.useState)(!1),s=(0,ns.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),p=(0,ns.useCallback)(()=>{let u=document.createElement("a"),h=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([GC(r,o)],{type:"text/plain"}),v=URL.createObjectURL(f);u.href=v,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(v)},5e3)},[o]);return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(x,{backFn:a,closeable:!1}),(0,qe.jsx)(le,{}),(0,qe.jsxs)(Tn,{children:[(0,qe.jsxs)(_n,{children:[(0,qe.jsx)(Oy.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,qe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,qe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),(0,qe.jsx)(Sn,{centered:!0,children:(0,qe.jsx)(cy,{children:o})}),(0,qe.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,qe.jsx)(rd,{onClick:s,children:i?(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Wy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(My.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,qe.jsxs)(rd,{onClick:p,children:[(0,qe.jsx)(Iy.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,qe.jsx)(Pn,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,qe.jsx)(me,{}),(0,qe.jsx)(j,{protectedByPrivy:!0})]})},GC=(e,t)=>`Your wallet recovery password for ${e} is
|
|
1370
1370
|
|
|
1371
1371
|
${t}
|
|
1372
1372
|
|
|
1373
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Ny=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Dy=y(require("@heroicons/react/24/solid/XCircleIcon"));var Xt=require("react/jsx-runtime"),Uy=({error:e,onClose:t})=>(0,Xt.jsxs)(Xt.Fragment,{children:[(0,Xt.jsx)(x,{closeable:!1}),(0,Xt.jsx)(le,{}),e?(0,Xt.jsxs)(mo,{children:[(0,Xt.jsx)(Dy.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Xt.jsx)(He,{title:"Something went wrong",description:e})]}):(0,Xt.jsxs)(mo,{children:[(0,Xt.jsx)(Ny.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,Xt.jsx)(He,{title:"Success"})]}),(0,Xt.jsx)(F,{onClick:t,children:"Close"}),(0,Xt.jsx)(me,{}),(0,Xt.jsx)(j,{protectedByPrivy:!0})]});var Fy=require("react"),qC=(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]=(0,Fy.useReducer)(qC,"creating");return{send:t,state:e}};var la=require("react/jsx-runtime"),ic=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=A(),{send:n,state:a}=By(),i=(0,ca.useCallback)(async()=>{a==="finalizing"&&await e(),n("next")},[a,n,e]);(0,ca.useEffect)(()=>{let p;return a==="done"&&t.config.initiatedBy==="automatic"&&(p=setTimeout(()=>t.onClose?.(),et)),()=>{p&&clearTimeout(p)}},[a,t.config.initiatedBy,t.onClose]);let l=(0,ca.useCallback)(()=>{n("back")},[n]),s=(0,ca.useCallback)(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return a==="creating"?(0,la.jsx)(Ry,{...t,onSubmit:i,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):a==="saving"?(0,la.jsx)(Ly,{...t,onSubmit:i,onBack:l}):a==="confirming"?(0,la.jsx)(my,{...t,onSubmit:i,onBack:l}):a==="finalizing"?(0,la.jsx)(wy,{...t,onSubmit:i,onBack:l}):a==="done"?(0,la.jsx)(Uy,{...t,onSubmit:i}):null};var Vy=require("react/jsx-runtime"),Hy=()=>{let[e,t]=(0,li.useState)(null),[r,o]=(0,li.useState)(!1),[n,a]=(0,li.useState)(null),[i,l]=(0,li.useState)(""),{authenticated:s,getAccessToken:p,user:u}=G(),{walletProxy:h,refreshUser:
|
|
1373
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Ny=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Dy=y(require("@heroicons/react/24/solid/XCircleIcon"));var Xt=require("react/jsx-runtime"),Uy=({error:e,onClose:t})=>(0,Xt.jsxs)(Xt.Fragment,{children:[(0,Xt.jsx)(x,{closeable:!1}),(0,Xt.jsx)(le,{}),e?(0,Xt.jsxs)(mo,{children:[(0,Xt.jsx)(Dy.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Xt.jsx)(He,{title:"Something went wrong",description:e})]}):(0,Xt.jsxs)(mo,{children:[(0,Xt.jsx)(Ny.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,Xt.jsx)(He,{title:"Success"})]}),(0,Xt.jsx)(F,{onClick:t,children:"Close"}),(0,Xt.jsx)(me,{}),(0,Xt.jsx)(j,{protectedByPrivy:!0})]});var Fy=require("react"),qC=(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]=(0,Fy.useReducer)(qC,"creating");return{send:t,state:e}};var la=require("react/jsx-runtime"),ic=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=A(),{send:n,state:a}=By(),i=(0,ca.useCallback)(async()=>{a==="finalizing"&&await e(),n("next")},[a,n,e]);(0,ca.useEffect)(()=>{let p;return a==="done"&&t.config.initiatedBy==="automatic"&&(p=setTimeout(()=>t.onClose?.(),et)),()=>{p&&clearTimeout(p)}},[a,t.config.initiatedBy,t.onClose]);let l=(0,ca.useCallback)(()=>{n("back")},[n]),s=(0,ca.useCallback)(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return a==="creating"?(0,la.jsx)(Ry,{...t,onSubmit:i,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):a==="saving"?(0,la.jsx)(Ly,{...t,onSubmit:i,onBack:l}):a==="confirming"?(0,la.jsx)(my,{...t,onSubmit:i,onBack:l}):a==="finalizing"?(0,la.jsx)(wy,{...t,onSubmit:i,onBack:l}):a==="done"?(0,la.jsx)(Uy,{...t,onSubmit:i}):null};var Vy=require("react/jsx-runtime"),Hy=()=>{let[e,t]=(0,li.useState)(null),[r,o]=(0,li.useState)(!1),[n,a]=(0,li.useState)(null),[i,l]=(0,li.useState)(""),{authenticated:s,getAccessToken:p,user:u}=G(),{walletProxy:h,refreshUser:f,closePrivyModal:v,createAnalyticsEvent:b}=R(),{app:g,navigate:S,data:_,onUserCloseViaDialogOrKeybindRef:E}=A(),{onSuccess:k,onFailure:I}=_.createWallet,D=Oe(u),W=e?.recoveryMethod==="user-passcode",M=D?.recoveryMethod==="user-passcode";(0,li.useEffect)(()=>{s||(S("LANDING"),I(new Us("User must be authenticated before setting a password on a Privy wallet")))},[s]);let H=()=>{if(n){I(n),v({shouldCallAuthOnSuccess:!1});return}if(!W){I(new nr("Exited before password was added to wallet")),v({shouldCallAuthOnSuccess:!1});return}k(e),v({shouldCallAuthOnSuccess:!1})};E.current=H;let z=async()=>{let O=await p();if(O&&D?.address&&i&&h)try{if(b({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:M}}),!(await h.setRecovery({accessToken:O,address:D.address,recoveryPassword:i,recoveryMethod:"user-passcode"})).address){a(new nr("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:M,reason:"error setting password"}});return}let L=await f(),rt=Oe(L);if(!rt){a(new nr("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:M,reason:"wallet disconnected"}});return}t(rt),b({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:D.address,recoveryMethod:"user-passcode",isResettingPassword:M}})}catch(K){console.warn(K),a(K instanceof Error?K:new Error("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:D.address,reason:K}})}},ee=async()=>{W?(k(e),v({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await z(),o(!1))};return(0,Vy.jsx)(ic,{appName:g?.name||"privy",config:{initiatedBy:"user",onCancel:H},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,isResettingPassword:M,onPasswordGenerate:()=>l(nc()),onPasswordChange:l,onSubmit:ee,onClose:H})};var Gy=y(require("@heroicons/react/24/outline/UserCircleIcon")),qy=y(require("@heroicons/react/24/solid/LockClosedIcon"));var $t=require("react/jsx-runtime"),zy=()=>{let{closePrivyModal:e}=R(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{onSuccess:a,onFailure:i}=t.setWalletPassword,l=()=>{i(new nr("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(x,{onClose:l}),(0,$t.jsx)(le,{}),(0,$t.jsxs)(mo,{children:[(0,$t.jsxs)(eh,{children:[(0,$t.jsx)(Gy.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,$t.jsx)(th,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,$t.jsx)(qy.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,$t.jsxs)(He,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,$t.jsx)("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),(0,$t.jsx)(F,{onClick:()=>{r({createWallet:{onFailure:i,onSuccess:a,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,$t.jsx)(me,{}),(0,$t.jsx)(j,{protectedByPrivy:!0})]})};var $y=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Ky=y(require("@heroicons/react/24/outline/PhoneIcon")),id=y(require("styled-components"));var Pt=require("react/jsx-runtime"),zC=e=>{let t=(0,Pt.jsx)($y.default,{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};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Ge&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,Pt.jsx)(Ky.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof yt)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:(0,Pt.jsx)(Kl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:(0,Pt.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,Pt.jsx)("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof xr&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},jy=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=A();return(0,Pt.jsx)(is,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},is=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Pe(),n=zC(e),a=()=>{e instanceof yt&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsx)(x,{backFn:t}),(0,Pt.jsxs)($C,{children:[(0,Pt.jsx)(pt,{children:(0,Pt.jsxs)("div",{children:[(0,Pt.jsx)($l,{color:"var(--privy-color-error)"}),n.icon]})}),(0,Pt.jsxs)(KC,{children:[(0,Pt.jsx)("h3",{children:n.title}),(0,Pt.jsx)("p",{children:n.detail})]}),(0,Pt.jsx)(F,{color:"var(--privy-color-error)",onClick:a,children:n.ctaText})]})]})},$C=id.default.div`
|
|
1374
1374
|
display: flex;
|
|
1375
1375
|
flex-direction: column;
|
|
1376
1376
|
align-items: center;
|
|
@@ -1458,7 +1458,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1458
1458
|
width: 14px;
|
|
1459
1459
|
height: 14px;
|
|
1460
1460
|
}
|
|
1461
|
-
`;var rg=y(require("qrcode")),og=y(require("react")),ng=y(require("styled-components"));var sd=require("react/jsx-runtime"),tg=()=>(0,sd.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,sd.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var tt=require("react/jsx-runtime"),Mr=7,ld=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},ZC=e=>{let t=rg.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Gu(Array.from(t.data),t.size);return r=ld(r,0,0,Mr,Mr),r=ld(r,r.length-Mr,0,Mr,Mr),r=ld(r,0,r.length-Mr,Mr,Mr),r},QC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,tt.jsx)(tt.Fragment,{children:[0,1,2].map(a=>(0,tt.jsx)("circle",{r:r*(Mr-a*2)/2,cx:e+r*Mr/2,cy:t+r*Mr/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),JC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Mr)*e,0],[0,(t-Mr)*e]];return(0,tt.jsx)(tt.Fragment,{children:n.map(([a,i])=>(0,tt.jsx)(QC,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},XC=({matrix:e,cellSize:t,color:r})=>(0,tt.jsx)(tt.Fragment,{children:e.map((a,i)=>a.map((l,s)=>l?(0,tt.jsx)("rect",{height:t-.2*2,width:t-.2*2,x:i*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${i}-${s}`):(0,tt.jsx)(og.default.Fragment,{},`circle-${i}-${s}`)))}),ew=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return(0,tt.jsx)(tt.Fragment,{});let a=t*(o||.15),i=Math.floor(t/2-a/2),l=Math.floor(t/2+a/2);(l-i)%2!==t%2&&(l+=1);let s=(l-i)*e,p=.1,u=s-s*p*2,h=r,
|
|
1461
|
+
`;var rg=y(require("qrcode")),og=y(require("react")),ng=y(require("styled-components"));var sd=require("react/jsx-runtime"),tg=()=>(0,sd.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,sd.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var tt=require("react/jsx-runtime"),Mr=7,ld=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},ZC=e=>{let t=rg.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Gu(Array.from(t.data),t.size);return r=ld(r,0,0,Mr,Mr),r=ld(r,r.length-Mr,0,Mr,Mr),r=ld(r,0,r.length-Mr,Mr,Mr),r},QC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,tt.jsx)(tt.Fragment,{children:[0,1,2].map(a=>(0,tt.jsx)("circle",{r:r*(Mr-a*2)/2,cx:e+r*Mr/2,cy:t+r*Mr/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),JC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Mr)*e,0],[0,(t-Mr)*e]];return(0,tt.jsx)(tt.Fragment,{children:n.map(([a,i])=>(0,tt.jsx)(QC,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},XC=({matrix:e,cellSize:t,color:r})=>(0,tt.jsx)(tt.Fragment,{children:e.map((a,i)=>a.map((l,s)=>l?(0,tt.jsx)("rect",{height:t-.2*2,width:t-.2*2,x:i*t+t*(.2/2),y:s*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${i}-${s}`):(0,tt.jsx)(og.default.Fragment,{},`circle-${i}-${s}`)))}),ew=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return(0,tt.jsx)(tt.Fragment,{});let a=t*(o||.15),i=Math.floor(t/2-a/2),l=Math.floor(t/2+a/2);(l-i)%2!==t%2&&(l+=1);let s=(l-i)*e,p=.1,u=s-s*p*2,h=r,f=i*e;return(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)("rect",{x:i*e,y:i*e,width:s,height:s,fill:n}),(0,tt.jsx)(h,{x:f+s*p,y:f+s*p,height:u,width:u})]})},tw=e=>{let t=e.outputSize,r=ZC(e.url),o=t/r.length;return(0,tt.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,tt.jsx)(XC,{matrix:r,cellSize:o,color:e.fgColor}),(0,tt.jsx)(JC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,tt.jsx)(ew,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},rw=ng.default.div`
|
|
1462
1462
|
display: flex;
|
|
1463
1463
|
justify-content: center;
|
|
1464
1464
|
align-items: center;
|
|
@@ -1473,7 +1473,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1473
1473
|
border-color: ${e=>e.borderColor};
|
|
1474
1474
|
border-radius: var(--privy-border-radius-md);
|
|
1475
1475
|
}
|
|
1476
|
-
`,pa=e=>{let{appearance:t}=Wt(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,a=t.palette.colorScheme==="dark"?r:o;return(0,tt.jsx)(rw,{size:n,bgColor:r,fgColor:o,borderColor:a,children:(0,tt.jsx)(tw,{url:e.url,logo:{element:e.squareLogoElement??tg},outputSize:n,bgColor:r,fgColor:o})})};var ci=require("react/jsx-runtime"),Ro=({style:e,...t})=>(0,ci.jsxs)("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[(0,ci.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,ci.jsx)("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),(0,ci.jsx)("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),(0,ci.jsx)("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});var ie=require("react/jsx-runtime"),ig="#8a63d2",sg=1e3,ow=sg*2,nw=sg*120,lg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=A(),{getAuthFlow:p,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:
|
|
1476
|
+
`,pa=e=>{let{appearance:t}=Wt(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,a=t.palette.colorScheme==="dark"?r:o;return(0,tt.jsx)(rw,{size:n,bgColor:r,fgColor:o,borderColor:a,children:(0,tt.jsx)(tw,{url:e.url,logo:{element:e.squareLogoElement??tg},outputSize:n,bgColor:r,fgColor:o})})};var ci=require("react/jsx-runtime"),Ro=({style:e,...t})=>(0,ci.jsxs)("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[(0,ci.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,ci.jsx)("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),(0,ci.jsx)("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),(0,ci.jsx)("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});var ie=require("react/jsx-runtime"),ig="#8a63d2",sg=1e3,ow=sg*2,nw=sg*120,lg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=A(),{getAuthFlow:p,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:f}=R(),[v,b]=(0,Xo.useState)(void 0),[g,S]=(0,Xo.useState)(!1),[_,E]=(0,Xo.useState)(!1),k=(0,Xo.useRef)([]),I=et,D=p(),W=D?.meta.connectUri;return(0,Xo.useEffect)(()=>{let M=Date.now(),H=setInterval(async()=>{let z=await D.pollForReady.execute(),ee=Date.now()-M;if(z){clearInterval(H),S(!0);try{await u(),E(!0)}catch(O){let K={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(O?.privyErrorCode==="max_accounts_reached"){console.error(new Hr(O).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else if(O?.privyErrorCode==="user_does_not_exist"){a("ACCOUNT_NOT_FOUND_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?K.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(K.retryable=!0,K.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(K.detail="Too many requests. Please wait before trying again.");b(K)}}else ee>nw&&(clearInterval(H),b({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},ow);return()=>{clearInterval(H),k.current.forEach(z=>clearTimeout(z))}},[]),(0,Xo.useEffect)(()=>{if(r&&e&&_&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(H)}_&&(hr(o,s?.embeddedWallets.createOnLogin)?k.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):k.current.push(setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[_,r,e,o]),ss.isMobile||g?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(x,{backFn:n?i:void 0,onClose:h},"header"),(0,ie.jsx)(le,{}),ss.isIOS?(0,ie.jsx)(ie.Fragment,{children:(0,ie.jsxs)(iw,{children:[(0,ie.jsx)(pt,{children:(0,ie.jsxs)("div",{children:[(0,ie.jsx)(bt,{success:_,fail:!!v}),(0,ie.jsx)(Ro,{style:{width:"38px",height:"38px"}})]})}),(0,ie.jsxs)(dt,{children:[(0,ie.jsx)(Ce,{children:v?v.message:"Sign in with Farcaster"}),(0,ie.jsx)(we,{children:v?v.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),W&&(0,ie.jsx)(F,{onClick:M=>{M.preventDefault(),window.location.href=W},children:"Open Warpcast app"})]})}):(0,ie.jsx)(ie.Fragment,{children:(0,ie.jsxs)(ag,{children:[(0,ie.jsx)(pt,{children:(0,ie.jsxs)("div",{children:[(0,ie.jsx)(bt,{success:_,fail:!!v}),(0,ie.jsx)(Ro,{style:{width:"38px",height:"38px"}})]})}),(0,ie.jsxs)(dt,{children:[(0,ie.jsx)(Ce,{children:v?v.message:"Signing in with Farcaster"}),(0,ie.jsx)(we,{children:v?v.detail:"This should only take a moment"}),(0,ie.jsx)(lr,{children:W&&ss.isMobile&&(0,ie.jsx)(lc,{text:"Take me to Warpcast",url:W,color:ig})})]})]})}),(0,ie.jsx)($,{})]}):(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(x,{backFn:n?i:void 0,onClose:h},"header"),(0,ie.jsx)(le,{}),(0,ie.jsx)(ag,{children:(0,ie.jsxs)("div",{children:[(0,ie.jsx)(Ce,{children:"Sign in with Farcaster"}),(0,ie.jsx)(we,{children:"Scan with your phone's camera to continue."}),(0,ie.jsx)(Ki,{children:W?(0,ie.jsx)(pa,{url:W,size:275,squareLogoElement:Ro}):(0,ie.jsx)(Mt,{})}),(0,ie.jsxs)(lr,{children:[(0,ie.jsx)(we,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),W&&(0,ie.jsx)(An,{text:W,itemName:"link",color:ig})]})]})}),(0,ie.jsx)($,{})]})},ag=cd.default.div`
|
|
1477
1477
|
display: flex;
|
|
1478
1478
|
flex-direction: column;
|
|
1479
1479
|
align-items: center;
|
|
@@ -1488,7 +1488,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1488
1488
|
justify-content: center;
|
|
1489
1489
|
gap: 24px;
|
|
1490
1490
|
width: 100%;
|
|
1491
|
-
`;var kn=require("react"),ls=require("react-device-detect"),pd=y(require("styled-components"));var ae=require("react/jsx-runtime"),cg="#8a63d2",dg=1e3,aw=dg*2,sw=dg*300,ug=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=R(),[i,l]=(0,kn.useState)(void 0),[s,p]=(0,kn.useState)(!1),[u,h]=(0,kn.useState)(!1),
|
|
1491
|
+
`;var kn=require("react"),ls=require("react-device-detect"),pd=y(require("styled-components"));var ae=require("react/jsx-runtime"),cg="#8a63d2",dg=1e3,aw=dg*2,sw=dg*300,ug=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=R(),[i,l]=(0,kn.useState)(void 0),[s,p]=(0,kn.useState)(!1),[u,h]=(0,kn.useState)(!1),f=(0,kn.useRef)([]),v=et,b=r?.farcasterSigner;(0,kn.useEffect)(()=>{let S=Date.now(),_=setInterval(async()=>{if(!b?.public_key){clearInterval(_),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}b.status==="approved"&&(clearInterval(_),p(!1),h(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v)));let E=await n(b?.public_key),k=Date.now()-S;E.status==="approved"?(clearInterval(_),p(!1),h(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),v))):k>sw?(clearInterval(_),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):E.status==="revoked"&&(clearInterval(_),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},aw);return()=>{clearInterval(_),f.current.forEach(E=>clearTimeout(E))}},[]);let g=b?.status==="pending_approval"?b.signer_approval_url:void 0;return ls.isMobile||s?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(x,{backFn:e?t:void 0,onClose:a},"header"),(0,ae.jsx)(le,{}),ls.isIOS?(0,ae.jsx)(ae.Fragment,{children:(0,ae.jsxs)(lw,{children:[(0,ae.jsx)(pt,{children:(0,ae.jsxs)("div",{children:[(0,ae.jsx)(bt,{success:u,fail:!!i}),(0,ae.jsx)(Ro,{style:{width:"38px",height:"38px"}})]})}),(0,ae.jsxs)(dt,{children:[(0,ae.jsx)(Ce,{children:i?i.message:"Add a signer to Farcaster"}),(0,ae.jsx)(we,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),g&&(0,ae.jsx)(F,{onClick:S=>{S.preventDefault(),window.location.href=g},children:"Open Warpcast app"})]})}):(0,ae.jsx)(ae.Fragment,{children:(0,ae.jsxs)(pg,{children:[(0,ae.jsx)(pt,{children:(0,ae.jsxs)("div",{children:[(0,ae.jsx)(bt,{success:u,fail:!!i}),(0,ae.jsx)(Ro,{style:{width:"38px",height:"38px"}})]})}),(0,ae.jsxs)(dt,{children:[(0,ae.jsx)(Ce,{children:i?i.message:"Requesting signer from Farcaster"}),(0,ae.jsx)(we,{children:i?i.detail:"This should only take a moment"}),(0,ae.jsx)(lr,{children:g&&ls.isMobile&&(0,ae.jsx)(lc,{text:"Take me to Warpcast",url:g,color:cg})})]})]})}),(0,ae.jsx)($,{})]}):(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(x,{backFn:e?t:void 0,onClose:a},"header"),(0,ae.jsx)(le,{}),(0,ae.jsx)(pg,{children:(0,ae.jsxs)("div",{children:[(0,ae.jsx)(Ce,{children:"Add a signer to Farcaster"}),(0,ae.jsxs)(we,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,ae.jsx)(Ki,{children:b?.status==="pending_approval"?(0,ae.jsx)(pa,{url:b.signer_approval_url,size:275,squareLogoElement:Ro}):(0,ae.jsx)(Mt,{})}),(0,ae.jsxs)(lr,{children:[(0,ae.jsx)(we,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),b?.status==="pending_approval"&&(0,ae.jsx)(An,{text:b.signer_approval_url,itemName:"link",color:cg})]})]})}),(0,ae.jsx)($,{})]})},pg=pd.default.div`
|
|
1492
1492
|
display: flex;
|
|
1493
1493
|
flex-direction: column;
|
|
1494
1494
|
align-items: center;
|
|
@@ -1619,7 +1619,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1619
1619
|
> :first-child > svg {
|
|
1620
1620
|
margin-top: 20px;
|
|
1621
1621
|
}
|
|
1622
|
-
`;var Zg=y(require("@heroicons/react/24/outline/UserCircleIcon")),us=require("react"),Qg=require("react-device-detect"),Jg=y(require("styled-components"));var Ng=y(require("@heroicons/react/24/outline/EnvelopeIcon")),Dg=require("react");var Lg=y(require("@heroicons/react/24/outline/EnvelopeIcon")),cs=require("react"),hd=y(require("styled-components"));var vo=require("react/jsx-runtime"),fc=(0,cs.forwardRef)((e,t)=>{let[r,o]=(0,cs.useState)(""),[n,a]=(0,cs.useState)(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=R(),{navigate:s,setModalData:p,currentScreen:u}=A(),{enabled:h,token:
|
|
1622
|
+
`;var Zg=y(require("@heroicons/react/24/outline/UserCircleIcon")),us=require("react"),Qg=require("react-device-detect"),Jg=y(require("styled-components"));var Ng=y(require("@heroicons/react/24/outline/EnvelopeIcon")),Dg=require("react");var Lg=y(require("@heroicons/react/24/outline/EnvelopeIcon")),cs=require("react"),hd=y(require("styled-components"));var vo=require("react/jsx-runtime"),fc=(0,cs.forwardRef)((e,t)=>{let[r,o]=(0,cs.useState)(""),[n,a]=(0,cs.useState)(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=R(),{navigate:s,setModalData:p,currentScreen:u}=A(),{enabled:h,token:f}=Pe(),v=Ys(r),b=n,g=n||!v,S=E=>{a(!0),l(r,E).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(k=>{p({errorModalData:{error:k,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},_=()=>{h&&!f&&!i?(p({captchaModalData:{callback:E=>l(r,E),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(f)};return(0,vo.jsxs)(vo.Fragment,{children:[(0,vo.jsx)(Iw,{children:(0,vo.jsxs)(Ww,{stacked:e.stacked,children:[(0,vo.jsx)(Lg.default,{}),(0,vo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:E=>o(E.target.value),onKeyUp:E=>{E.key==="Enter"&&_()},value:r,autoComplete:"email"}),e.stacked?null:(0,vo.jsx)(zi,{isSubmitting:b,onClick:_,disabled:g,children:"Submit"})]})}),e.stacked?(0,vo.jsx)(F,{loadingText:null,loading:b,disabled:g,onClick:_,children:"Submit"}):null]})}),Iw=hd.default.div`
|
|
1623
1623
|
width: 100%;
|
|
1624
1624
|
`,Ww=hd.default.label`
|
|
1625
1625
|
display: block;
|
|
@@ -1709,7 +1709,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1709
1709
|
}
|
|
1710
1710
|
`,Ow=gc.default.button`
|
|
1711
1711
|
${Mw}
|
|
1712
|
-
`;var zg=y(require("@heroicons/react/24/outline/PhoneIcon")),$g=require("react");var fa=require("react"),yd=y(require("styled-components"));var Bg=y(require("libphonenumber-js/examples.mobile.json")),Lr=require("libphonenumber-js/min"),wc=require("react/jsx-runtime");var ps=(e,t)=>(0,Lr.isPossiblePhoneNumber)(String(e),t),Cc=(e,t)=>`+${(0,Lr.getCountryCallingCode)(t)} ${e}`,Hg=e=>`*${e.replaceAll("-","").slice(-4)}`,Vg=e=>new Lr.AsYouType(e),Lw=(0,Lr.getCountries)().map(e=>({code:e,callCode:(0,Lr.getCountryCallingCode)(e)})),Gg=e=>{let t=(0,Lr.getExampleNumber)(e,Bg.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},qg=({value:e,onChange:t})=>(0,wc.jsx)("select",{value:e,onChange:t,children:Lw.map(r=>(0,wc.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var Co=require("react/jsx-runtime"),ha=(0,fa.forwardRef)((e,t)=>{let{app:r}=A(),[o,n]=(0,fa.useState)(""),[a,i]=(0,fa.useState)(r?.intl.defaultCountry??"US"),l=ps(o,a),s=Vg(a),p=Gg(a),u=(0,Lr.getCountryCallingCode)(a),h=!l,[
|
|
1712
|
+
`;var zg=y(require("@heroicons/react/24/outline/PhoneIcon")),$g=require("react");var fa=require("react"),yd=y(require("styled-components"));var Bg=y(require("libphonenumber-js/examples.mobile.json")),Lr=require("libphonenumber-js/min"),wc=require("react/jsx-runtime");var ps=(e,t)=>(0,Lr.isPossiblePhoneNumber)(String(e),t),Cc=(e,t)=>`+${(0,Lr.getCountryCallingCode)(t)} ${e}`,Hg=e=>`*${e.replaceAll("-","").slice(-4)}`,Vg=e=>new Lr.AsYouType(e),Lw=(0,Lr.getCountries)().map(e=>({code:e,callCode:(0,Lr.getCountryCallingCode)(e)})),Gg=e=>{let t=(0,Lr.getExampleNumber)(e,Bg.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},qg=({value:e,onChange:t})=>(0,wc.jsx)("select",{value:e,onChange:t,children:Lw.map(r=>(0,wc.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var Co=require("react/jsx-runtime"),ha=(0,fa.forwardRef)((e,t)=>{let{app:r}=A(),[o,n]=(0,fa.useState)(""),[a,i]=(0,fa.useState)(r?.intl.defaultCountry??"US"),l=ps(o,a),s=Vg(a),p=Gg(a),u=(0,Lr.getCountryCallingCode)(a),h=!l,[f,v]=(0,fa.useState)(!1),b=u.length,g=E=>{let k=E.target.value;i(k),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Cc(o,k),countryCode:k,isValid:ps(o,a)})},S=E=>{try{let k=E.replace(/\D/g,""),I=o.replace(/\D/g,""),D=k===I?E:s.input(E);n(D),e.onChange&&e.onChange({rawPhoneNumber:D,qualifiedPhoneNumber:Cc(E,a),countryCode:a,isValid:ps(E,a)})}catch(k){console.error("Error processing phone number:",k)}},_=()=>{v(!0);let E=Cc(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:E,countryCode:a,isValid:ps(o,a)}).finally(()=>v(!1))};return(0,Co.jsxs)(Co.Fragment,{children:[(0,Co.jsx)(Nw,{children:(0,Co.jsxs)(Dw,{callingCodeLength:b,stacked:e.stacked,children:[(0,Co.jsx)(qg,{value:a,onChange:g}),(0,Co.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:p,onChange:E=>{S(E.target.value)},onKeyUp:E=>{E.key==="Enter"&&_()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,Co.jsx)(zi,{isSubmitting:f,onClick:_,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,Co.jsx)(F,{loading:f,loadingText:null,onClick:_,disabled:h,children:"Submit"}):null]})}),Nw=yd.default.div`
|
|
1713
1713
|
width: 100%;
|
|
1714
1714
|
`,Dw=yd.default.label`
|
|
1715
1715
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
@@ -1798,11 +1798,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1798
1798
|
&& > input::placeholder {
|
|
1799
1799
|
color: var(--privy-color-foreground-3);
|
|
1800
1800
|
}
|
|
1801
|
-
`;var Wo=require("react/jsx-runtime"),bc=({isEditable:e,setIsEditable:t})=>{let r=(0,$g.useRef)(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=A(),{initLoginWithSms:l}=R(),{enabled:s,token:p}=Pe();async function u({qualifiedPhoneNumber:h}){if(s&&!p&&!o)a({captchaModalData:{callback:
|
|
1801
|
+
`;var Wo=require("react/jsx-runtime"),bc=({isEditable:e,setIsEditable:t})=>{let r=(0,$g.useRef)(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=A(),{initLoginWithSms:l}=R(),{enabled:s,token:p}=Pe();async function u({qualifiedPhoneNumber:h}){if(s&&!p&&!o)a({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,p),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Wo.jsxs)(Wo.Fragment,{children:[(0,Wo.jsx)(uo,{if:!e,children:(0,Wo.jsx)(ha,{ref:r,onSubmit:u})}),(0,Wo.jsx)(uo,{if:e,children:(0,Wo.jsxs)(Ne,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Wo.jsx)(zg.default,{})," Continue with SMS"]})})]})};var Kg=require("react");var Jr=require("react/jsx-runtime"),Uw={apple:{logo:(0,Jr.jsx)(al,{}),displayName:"Apple"},discord:{logo:(0,Jr.jsx)(sl,{}),displayName:"Discord"},github:{logo:(0,Jr.jsx)(ll,{}),displayName:"GitHub"},google:{logo:(0,Jr.jsx)(cl,{}),displayName:"Google"},linkedin:{logo:(0,Jr.jsx)(dl,{}),displayName:"LinkedIn"},spotify:{logo:(0,Jr.jsx)(ul,{}),displayName:"Spotify"},instagram:{logo:(0,Jr.jsx)(pl,{}),displayName:"Instagram"},twitter:{logo:(0,Jr.jsx)(fl,{}),displayName:"Twitter"},tiktok:{logo:(0,Jr.jsx)(ml,{}),displayName:"TikTok"}},Dt=({provider:e})=>{let{enabled:t,token:r}=Pe(),{navigate:o,setModalData:n}=A(),[a,i]=(0,Kg.useState)(!1),{initLoginWithOAuth:l}=R(),{displayName:s,logo:p}=Uw[e];return(0,Jr.jsxs)(Ne,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:h=>l(e,h),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[p," ",s]})};var jg=require("react");var Xr=require("react/jsx-runtime");function Ec(e){return(0,Xr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[(0,Xr.jsx)("defs",{children:(0,Xr.jsxs)("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[(0,Xr.jsx)("stop",{offset:"0",stopColor:"#1d93d2"}),(0,Xr.jsx)("stop",{offset:"1",stopColor:"#38b0e3"})]})}),(0,Xr.jsx)("title",{children:"Telegram_logo"}),(0,Xr.jsx)("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),(0,Xr.jsx)("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),(0,Xr.jsx)("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),(0,Xr.jsx)("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}var Pc=require("react/jsx-runtime"),Tc=()=>{let{enabled:e,token:t}=Pe(),{navigate:r,setModalData:o}=A(),[n,a]=(0,jg.useState)(!1),{initLoginWithTelegram:i}=R();async function l(p){try{await i(p),r("TELEGRAM_AUTH_SCREEN")}catch(u){console.error(u),a(!1)}}async function s(){if(a(!0),e&&!t){o({captchaModalData:{callback:l,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await l()}return(0,Pc.jsxs)(Ne,{onClick:s,disabled:n,children:[(0,Pc.jsx)(Ec,{})," Telegram"]})};var Yg=y(require("@heroicons/react/24/outline/ChevronRightIcon"));var ds=require("react/jsx-runtime"),Sc=({onClick:e,text:t,icon:r})=>(0,ds.jsxs)(Ne,{onClick:e,children:[r,(0,ds.jsx)(Dl,{children:t}),(0,ds.jsx)(Yg.default,{})]});var Re=require("react/jsx-runtime"),xc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{appearance:{palette:{colorScheme:a}}}=Wt(),i=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...i,...l],p=o.loginMethods.passkey,[u,h]=(0,us.useState)("default"),[f,v]=(0,us.useState)("email");(0,us.useEffect)(()=>{let M=s.indexOf("sms"),H=s.indexOf("email");M>-1&&M<H&&v("sms")},[i,l]);let b=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{h("default")},150)};n.current=b;let g=M=>M==="email"?(0,Re.jsx)(hc,{isEditable:f==="email",setIsEditable:()=>{v("email")}},M):M==="sms"?(0,Re.jsx)(bc,{isEditable:f==="sms",setIsEditable:()=>{v("sms")}},M):M==="apple"?(0,Re.jsx)(Dt,{provider:"apple"},M):M==="discord"?(0,Re.jsx)(Dt,{provider:"discord"},M):M==="farcaster"?(0,Re.jsx)(yc,{},M):M==="github"?(0,Re.jsx)(Dt,{provider:"github"},M):M==="google"?(0,Re.jsx)(Dt,{provider:"google"},M):M==="linkedin"?(0,Re.jsx)(Dt,{provider:"linkedin"},M):M==="tiktok"?(0,Re.jsx)(Dt,{provider:"tiktok"},M):M==="twitter"&&(!Qg.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,Re.jsx)(Dt,{provider:"twitter"},M):M==="telegram"?(0,Re.jsx)(Tc,{},M):Qa([M],r,e,s),S=i.map(g).flat(),_=l.map(g).flat(),E=[...S,..._],k=Fw({primary:S.length,overflow:_.length}),[I,D]=Vu(E,k),W=u==="default"?void 0:()=>{h("default")};return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(x,{title:o.appearance.landingHeader,onClose:b,backFn:W}),u==="default"&&(0,Re.jsx)(Bw,{}),u==="default"&&(typeof o.appearance.loginMessage=="string"?(0,Re.jsx)(Fl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),(0,Re.jsx)(Ul,{style:{overflow:"hidden"},children:(0,Re.jsxs)(qf,{colorScheme:a,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&(0,Re.jsxs)(Re.Fragment,{children:[...I,D.length>0&&(0,Re.jsx)(Sc,{text:"More options",icon:(0,Re.jsx)(Zg.default,{}),onClick:()=>h("overflow")})]}),u==="overflow"&&(0,Re.jsxs)(Re.Fragment,{children:[...D]}),p&&u==="default"&&(0,Re.jsx)(vc,{})]})}),o&&(0,Re.jsx)($i,{app:o}),(0,Re.jsx)(j,{protectedByPrivy:!0})]})},_c=5,Fw=({primary:e,overflow:t})=>e<_c?e:e===_c&&t===0?_c:_c-1,Bw=(0,Jg.default)(Yi)`
|
|
1802
1802
|
margin-bottom: 16px;
|
|
1803
|
-
`;var o1=y(require("@heroicons/react/24/outline/EnvelopeIcon")),n1=y(require("@heroicons/react/24/outline/PhoneIcon")),i1=y(require("@heroicons/react/24/outline/UserCircleIcon")),ms=require("react"),a1=require("react-device-detect"),s1=y(require("styled-components"));var en=require("react/jsx-runtime"),Xg=({...e})=>(0,en.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,en.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,en.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,en.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,en.jsx)("defs",{children:(0,en.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,en.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var e1=y(require("@heroicons/react/24/outline/ChevronRightIcon")),t1=y(require("@heroicons/react/24/outline/WalletIcon"));var ya=require("react/jsx-runtime"),r1=({onClick:e,text:t})=>(0,ya.jsxs)(Ne,{onClick:e,children:[(0,ya.jsx)(t1.default,{}),(0,ya.jsx)(Dl,{children:t}),(0,ya.jsx)(e1.default,{})]});var fe=require("react/jsx-runtime"),Ac=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:a,sms:i,google:l,twitter:s,discord:p,github:u,spotify:h,instagram:
|
|
1803
|
+
`;var o1=y(require("@heroicons/react/24/outline/EnvelopeIcon")),n1=y(require("@heroicons/react/24/outline/PhoneIcon")),i1=y(require("@heroicons/react/24/outline/UserCircleIcon")),ms=require("react"),a1=require("react-device-detect"),s1=y(require("styled-components"));var en=require("react/jsx-runtime"),Xg=({...e})=>(0,en.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,en.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,en.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,en.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,en.jsx)("defs",{children:(0,en.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,en.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var e1=y(require("@heroicons/react/24/outline/ChevronRightIcon")),t1=y(require("@heroicons/react/24/outline/WalletIcon"));var ya=require("react/jsx-runtime"),r1=({onClick:e,text:t})=>(0,ya.jsxs)(Ne,{onClick:e,children:[(0,ya.jsx)(t1.default,{}),(0,ya.jsx)(Dl,{children:t}),(0,ya.jsx)(e1.default,{})]});var fe=require("react/jsx-runtime"),Ac=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:a,sms:i,google:l,twitter:s,discord:p,github:u,spotify:h,instagram:f,tiktok:v,linkedin:b,apple:g,wallet:S,farcaster:_,passkey:E,telegram:k}=o?.loginMethods??{},I=o?.appearance.loginGroupPriority||"web2-first",D=o?.appearance.hideDirectWeb2Inputs,[W,M]=(0,ms.useState)("default"),[H,z]=(0,ms.useState)(a?"email":"sms");(0,ms.useEffect)(()=>{z(a?"email":"sms")},[a]);let ee=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=ee;let O=[a&&(0,fe.jsx)(hc,{isEditable:H==="email",setIsEditable:()=>{z("email")}}),i&&(0,fe.jsx)(bc,{isEditable:H==="sms",setIsEditable:()=>{z("sms")}})].filter(Boolean),K=[l&&(0,fe.jsx)(Dt,{provider:"google"}),s&&(!a1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,fe.jsx)(Dt,{provider:"twitter"}),p&&(0,fe.jsx)(Dt,{provider:"discord"}),u&&(0,fe.jsx)(Dt,{provider:"github"}),h&&(0,fe.jsx)(Dt,{provider:"spotify"}),f&&(0,fe.jsx)(Dt,{provider:"instagram"}),v&&(0,fe.jsx)(Dt,{provider:"tiktok"}),b&&(0,fe.jsx)(Dt,{provider:"linkedin"}),g&&(0,fe.jsx)(Dt,{provider:"apple"}),_&&(0,fe.jsx)(yc,{}),k&&(0,fe.jsx)(Tc,{})].filter(Boolean),L=Qa(o.appearance.walletList,r,e,o.appearance.walletList),rt=W==="default"?void 0:()=>{M("default")},Gt=Vw({priority:I,email:a,sms:i,social:K}),Je=Gw({priority:I,email:a,sms:i,social:K}),pe=qw({priority:I,email:a,sms:i,social:K}),Q=(0,fe.jsx)(r1,{text:pe,onClick:()=>M("web3-overflow")}),ot=(0,fe.jsx)(Sc,{text:Gt,icon:Je,onClick:()=>M("web2-overflow")}),at=D?0:1;return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(x,{title:o.appearance.landingHeader,onClose:ee,backFn:rt}),W==="default"&&(0,fe.jsx)(Hw,{}),W==="default"&&(typeof o.appearance.loginMessage=="string"?(0,fe.jsx)(Fl,{children:o.appearance.loginMessage}):o.appearance.loginMessage),(0,fe.jsx)(Ul,{style:{overflow:"hidden",padding:2},children:(0,fe.jsxs)(po,{children:[W==="default"&&I==="web2-first"&&(0,fe.jsxs)(fe.Fragment,{children:[...O,...K.length+O.length>4?K.slice(0,3-O.length):K,O.length+K.length>4&&ot,S&&Q]}),W==="default"&&I==="web3-first"&&(0,fe.jsxs)(fe.Fragment,{children:[S&&(0,fe.jsxs)(fe.Fragment,{children:[...L.length>4?L.slice(0,3):L,L.length>4&&Q]}),O.length+K.length>at&&ot,O.length+K.length===at&&O.length?O[0]:null,O.length+K.length===at&&K.length?K[0]:null]}),W==="web2-overflow"&&(0,fe.jsxs)(fe.Fragment,{children:[...I==="web3-first"?O:[],...K]}),...W==="web3-overflow"?L:[],E&&W==="default"&&(0,fe.jsx)(vc,{})]})}),o&&(0,fe.jsx)($i,{app:o}),(0,fe.jsx)(j,{protectedByPrivy:!0})]})},Hw=(0,s1.default)(Yi)`
|
|
1804
1804
|
margin-bottom: 16px;
|
|
1805
|
-
`,Vw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",Gw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,fe.jsx)(i1.default,{}):t&&r?(0,fe.jsx)(Xg,{}):t?(0,fe.jsx)(o1.default,{}):r?(0,fe.jsx)(n1.default,{}):null,qw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var gd=require("react/jsx-runtime"),l1=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,gd.jsx)(xc,{connectOnly:!0}):(0,gd.jsx)(Ac,{connectOnly:!0})};var vd=require("react/jsx-runtime"),c1=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,vd.jsx)(xc,{connectOnly:!1}):(0,vd.jsx)(Ac,{connectOnly:!1})};var p1=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Nr=require("react/jsx-runtime"),d1=()=>{let{app:e}=A();return(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(x,{},"header"),(0,Nr.jsx)(le,{}),(0,Nr.jsx)(He,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Nr.jsx)(p1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Nr.jsx)($r,{children:(0,Nr.jsx)(fc,{stacked:!0})}),(0,Nr.jsx)(me,{}),(0,Nr.jsx)(j,{protectedByPrivy:!0})]})};var f1=y(require("@heroicons/react/24/outline/ClockIcon")),h1=y(require("@heroicons/react/24/outline/TrashIcon")),y1=y(require("@heroicons/react/24/solid/CheckBadgeIcon")),g1=y(require("@heroicons/react/24/solid/CheckCircleIcon")),v1=y(require("@heroicons/react/24/solid/LockClosedIcon")),In=require("react"),er=y(require("styled-components"));var Cd=require("react/jsx-runtime"),pi=({style:e,...t})=>(0,Cd.jsx)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Cd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});var Le=require("react/jsx-runtime"),di=({style:e,...t})=>(0,Le.jsxs)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,Le.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,Le.jsx)("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),(0,Le.jsx)("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),(0,Le.jsx)("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),(0,Le.jsx)("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),(0,Le.jsx)("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),(0,Le.jsx)("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),(0,Le.jsx)("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),(0,Le.jsx)("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),(0,Le.jsx)("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),(0,Le.jsx)("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),(0,Le.jsx)("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),(0,Le.jsx)("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),(0,Le.jsx)("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),(0,Le.jsx)("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),(0,Le.jsx)("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),(0,Le.jsx)("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),(0,Le.jsx)("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),(0,Le.jsx)("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),(0,Le.jsx)("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),(0,Le.jsx)("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),(0,Le.jsx)("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),(0,Le.jsx)("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),(0,Le.jsx)("defs",{children:(0,Le.jsx)("clipPath",{id:"clip0_113_33841",children:(0,Le.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var Y=require("react/jsx-runtime"),u1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=(0,In.useState)([]),i=t?e.length:2,l=p=>p.authenticatorName?p.createdWithBrowser?`${p.authenticatorName} on ${p.createdWithBrowser}`:p.authenticatorName:p.createdWithBrowser?p.createdWithOs?`${p.createdWithBrowser} on ${p.createdWithOs}`:`${p.createdWithBrowser}`:"Unknown device",s=async p=>{a(u=>u.concat([p])),await r(p),a(u=>u.filter(h=>h!==p))};return(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Qw,{children:"Your passkeys"}),(0,Y.jsxs)(w1,{children:[e.slice(0,i).map(p=>(0,Y.jsxs)(e4,{children:[(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Jw,{children:l(p)}),(0,Y.jsxs)(Xw,{children:["Last used: ",(p.latestVerifiedAt??p.verifiedAt).toLocaleString()]})]}),(0,Y.jsx)(r4,{disabled:n.includes(p.credentialId),onClick:()=>s(p.credentialId),children:n.includes(p.credentialId)?(0,Y.jsx)(_o,{}):(0,Y.jsx)(h1.default,{height:"1.6em"})})]},p.credentialId)),e.length>2&&!t&&(0,Y.jsx)(jw,{onClick:o,children:"View all"})]})]})},zw=()=>(0,Y.jsxs)(w1,{children:[(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(y1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(v1.default,{})}),"More secure than a password."]}),(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(f1.default,{})}),"Takes seconds to set up and use."]})]}),C1=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=R(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[a,i]=(0,In.useState)(!1),[l,s]=(0,In.useState)(""),[p,u]=(0,In.useState)(!1),[h,m]=(0,In.useState)(!1);(0,In.useEffect)(()=>{n.length===0&&m(!1)},[n.length]);let v=()=>{i(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof yt){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{i(!1)})},b=async g=>(i(!0),await t(g).then(()=>u(!0)).catch(S=>{if(S instanceof yt&&S.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{i(!1)}));return p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{onClose:()=>o()},"header"),(0,Y.jsx)(Be,{children:(0,Y.jsx)(lt,{status:"success",children:(0,Y.jsx)(g1.default,{})})}),(0,Y.jsx)(m1,{children:"Passkey added"}),(0,Y.jsx)(Yw,{children:"From now on, you can use your passkey to log in."}),(0,Y.jsx)(Qt,{children:(0,Y.jsx)(F,{onClick:()=>o(),children:"Done"})}),(0,Y.jsx)($,{})]}):h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{backFn:()=>m(!1),onClose:()=>o()},"header"),(0,Y.jsx)(u1,{passkeys:n,expanded:h,onUnlink:b,onExpand:()=>m(!0)}),(0,Y.jsx)($,{})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{onClose:()=>o()},"header"),(0,Y.jsx)(Be,{children:(0,Y.jsxs)(kc,{children:[(0,Y.jsx)(pi,{}),(0,Y.jsx)(di,{})]})}),(0,Y.jsx)(m1,{children:"Secure your account with a passkey"}),(0,Y.jsx)(Zw,{}),n.length===0?(0,Y.jsx)(zw,{}):(0,Y.jsx)(u1,{passkeys:n,expanded:h,onUnlink:b,onExpand:()=>m(!0)}),(0,Y.jsxs)(Qt,{style:{marginTop:"12px"},children:[l&&(0,Y.jsx)($w,{fail:!0,children:l}),(0,Y.jsx)(F,{onClick:v,loading:a,children:"Add new passkey"})]}),(0,Y.jsx)($,{})]})},kc=er.default.div`
|
|
1805
|
+
`,Vw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",Gw=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,fe.jsx)(i1.default,{}):t&&r?(0,fe.jsx)(Xg,{}):t?(0,fe.jsx)(o1.default,{}):r?(0,fe.jsx)(n1.default,{}):null,qw=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var gd=require("react/jsx-runtime"),l1=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,gd.jsx)(xc,{connectOnly:!0}):(0,gd.jsx)(Ac,{connectOnly:!0})};var vd=require("react/jsx-runtime"),c1=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,vd.jsx)(xc,{connectOnly:!1}):(0,vd.jsx)(Ac,{connectOnly:!1})};var p1=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Nr=require("react/jsx-runtime"),d1=()=>{let{app:e}=A();return(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(x,{},"header"),(0,Nr.jsx)(le,{}),(0,Nr.jsx)(He,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Nr.jsx)(p1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Nr.jsx)($r,{children:(0,Nr.jsx)(fc,{stacked:!0})}),(0,Nr.jsx)(me,{}),(0,Nr.jsx)(j,{protectedByPrivy:!0})]})};var f1=y(require("@heroicons/react/24/outline/ClockIcon")),h1=y(require("@heroicons/react/24/outline/TrashIcon")),y1=y(require("@heroicons/react/24/solid/CheckBadgeIcon")),g1=y(require("@heroicons/react/24/solid/CheckCircleIcon")),v1=y(require("@heroicons/react/24/solid/LockClosedIcon")),In=require("react"),er=y(require("styled-components"));var Cd=require("react/jsx-runtime"),pi=({style:e,...t})=>(0,Cd.jsx)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Cd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});var Le=require("react/jsx-runtime"),di=({style:e,...t})=>(0,Le.jsxs)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,Le.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,Le.jsx)("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),(0,Le.jsx)("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),(0,Le.jsx)("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),(0,Le.jsx)("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),(0,Le.jsx)("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),(0,Le.jsx)("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),(0,Le.jsx)("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),(0,Le.jsx)("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),(0,Le.jsx)("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),(0,Le.jsx)("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),(0,Le.jsx)("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),(0,Le.jsx)("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),(0,Le.jsx)("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),(0,Le.jsx)("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),(0,Le.jsx)("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),(0,Le.jsx)("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),(0,Le.jsx)("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),(0,Le.jsx)("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),(0,Le.jsx)("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),(0,Le.jsx)("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),(0,Le.jsx)("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),(0,Le.jsx)("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),(0,Le.jsx)("defs",{children:(0,Le.jsx)("clipPath",{id:"clip0_113_33841",children:(0,Le.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var Y=require("react/jsx-runtime"),u1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=(0,In.useState)([]),i=t?e.length:2,l=p=>p.authenticatorName?p.createdWithBrowser?`${p.authenticatorName} on ${p.createdWithBrowser}`:p.authenticatorName:p.createdWithBrowser?p.createdWithOs?`${p.createdWithBrowser} on ${p.createdWithOs}`:`${p.createdWithBrowser}`:"Unknown device",s=async p=>{a(u=>u.concat([p])),await r(p),a(u=>u.filter(h=>h!==p))};return(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Qw,{children:"Your passkeys"}),(0,Y.jsxs)(w1,{children:[e.slice(0,i).map(p=>(0,Y.jsxs)(e4,{children:[(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Jw,{children:l(p)}),(0,Y.jsxs)(Xw,{children:["Last used: ",(p.latestVerifiedAt??p.verifiedAt).toLocaleString()]})]}),(0,Y.jsx)(r4,{disabled:n.includes(p.credentialId),onClick:()=>s(p.credentialId),children:n.includes(p.credentialId)?(0,Y.jsx)(_o,{}):(0,Y.jsx)(h1.default,{height:"1.6em"})})]},p.credentialId)),e.length>2&&!t&&(0,Y.jsx)(jw,{onClick:o,children:"View all"})]})]})},zw=()=>(0,Y.jsxs)(w1,{children:[(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(y1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(v1.default,{})}),"More secure than a password."]}),(0,Y.jsxs)(vr,{children:[(0,Y.jsx)(gr,{children:(0,Y.jsx)(f1.default,{})}),"Takes seconds to set up and use."]})]}),C1=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=R(),n=e?.linkedAccounts.filter(g=>g.type==="passkey"),[a,i]=(0,In.useState)(!1),[l,s]=(0,In.useState)(""),[p,u]=(0,In.useState)(!1),[h,f]=(0,In.useState)(!1);(0,In.useEffect)(()=>{n.length===0&&f(!1)},[n.length]);let v=()=>{i(!0),r().then(()=>u(!0)).catch(g=>{if(g instanceof yt){if(g.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(g.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{i(!1)})},b=async g=>(i(!0),await t(g).then(()=>u(!0)).catch(S=>{if(S instanceof yt&&S.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{i(!1)}));return p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{onClose:()=>o()},"header"),(0,Y.jsx)(Be,{children:(0,Y.jsx)(lt,{status:"success",children:(0,Y.jsx)(g1.default,{})})}),(0,Y.jsx)(m1,{children:"Passkey added"}),(0,Y.jsx)(Yw,{children:"From now on, you can use your passkey to log in."}),(0,Y.jsx)(Qt,{children:(0,Y.jsx)(F,{onClick:()=>o(),children:"Done"})}),(0,Y.jsx)($,{})]}):h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{backFn:()=>f(!1),onClose:()=>o()},"header"),(0,Y.jsx)(u1,{passkeys:n,expanded:h,onUnlink:b,onExpand:()=>f(!0)}),(0,Y.jsx)($,{})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{onClose:()=>o()},"header"),(0,Y.jsx)(Be,{children:(0,Y.jsxs)(kc,{children:[(0,Y.jsx)(pi,{}),(0,Y.jsx)(di,{})]})}),(0,Y.jsx)(m1,{children:"Secure your account with a passkey"}),(0,Y.jsx)(Zw,{}),n.length===0?(0,Y.jsx)(zw,{}):(0,Y.jsx)(u1,{passkeys:n,expanded:h,onUnlink:b,onExpand:()=>f(!0)}),(0,Y.jsxs)(Qt,{style:{marginTop:"12px"},children:[l&&(0,Y.jsx)($w,{fail:!0,children:l}),(0,Y.jsx)(F,{onClick:v,loading:a,children:"Add new passkey"})]}),(0,Y.jsx)($,{})]})},kc=er.default.div`
|
|
1806
1806
|
display: flex;
|
|
1807
1807
|
align-items: center;
|
|
1808
1808
|
justify-content: center;
|
|
@@ -1934,7 +1934,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1934
1934
|
> path {
|
|
1935
1935
|
fill: white;
|
|
1936
1936
|
}
|
|
1937
|
-
`;var Rc=y(require("@heroicons/react/20/solid/CheckIcon")),R1=y(require("@heroicons/react/24/outline/ChevronRightIcon")),I1=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),W1=y(require("@heroicons/react/24/outline/FingerPrintIcon")),M1=y(require("@heroicons/react/24/outline/PhoneIcon")),Ic=y(require("@heroicons/react/24/outline/TrashIcon")),O1=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var ne=require("react/jsx-runtime"),L1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:a,error:i,onClose:l,onBackToIntro:s,handleSelectMethod:p,setRemovingMfaMethod:u})=>{let h=t.reduce((v,b)=>({...v,[b]:!0}),{}),
|
|
1937
|
+
`;var Rc=y(require("@heroicons/react/20/solid/CheckIcon")),R1=y(require("@heroicons/react/24/outline/ChevronRightIcon")),I1=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),W1=y(require("@heroicons/react/24/outline/FingerPrintIcon")),M1=y(require("@heroicons/react/24/outline/PhoneIcon")),Ic=y(require("@heroicons/react/24/outline/TrashIcon")),O1=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var ne=require("react/jsx-runtime"),L1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:a,error:i,onClose:l,onBackToIntro:s,handleSelectMethod:p,setRemovingMfaMethod:u})=>{let h=t.reduce((v,b)=>({...v,[b]:!0}),{}),f=r.reduce((v,b)=>({...v,[b]:!0}),{});return(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(x,{backFn:e?s:void 0,onClose:l},"header"),(0,ne.jsx)(Be,{children:(0,ne.jsx)(lt,{children:(0,ne.jsx)(O1.default,{})})}),(0,ne.jsx)(Ce,{children:"Choose a verification method"}),t.length>0?(0,ne.jsx)(we,{children:"To add or delete verification methods, verification is required."}):(0,ne.jsx)(we,{children:"How would you like to verify your identity? You can change this later."}),i&&(0,ne.jsx)(zl,{style:{marginTop:"1.25rem"},children:i.message}),(0,ne.jsxs)(Bl,{children:[(f.totp||h.totp)&&(0,ne.jsxs)(Hl,{children:[(0,ne.jsx)(Ne,{style:{justifyContent:"center"},disabled:h.totp||n,onClick:()=>p("totp"),children:n?(0,ne.jsx)(Mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,ne.jsxs)(ql,{children:[(0,ne.jsxs)(Gl,{children:[(0,ne.jsx)(I1.default,{}),"Authenticator App"]}),h.totp?(0,ne.jsxs)(oi,{children:[(0,ne.jsx)(Rc.default,{}),"Added"]}):(0,ne.jsx)(oi,{children:"Recommended"})]})}),h.totp&&(0,ne.jsx)(Vl,{onClick:()=>u("totp"),children:(0,ne.jsx)(Ic.default,{})})]},"totp"),(f.sms||h.sms)&&(0,ne.jsxs)(Hl,{children:[(0,ne.jsx)(Ne,{disabled:h.sms||o,onClick:()=>p("sms"),children:(0,ne.jsxs)(ql,{children:[(0,ne.jsxs)(Gl,{children:[(0,ne.jsx)(M1.default,{}),"SMS"]}),h.sms&&(0,ne.jsxs)(oi,{children:[(0,ne.jsx)(Rc.default,{}),"Added"]}),o&&(0,ne.jsx)(oi,{children:"Disabled"})]})}),h.sms&&(0,ne.jsx)(Vl,{onClick:()=>u("sms"),children:(0,ne.jsx)(Ic.default,{})})]},"sms"),(f.passkey||h.passkey)&&(0,ne.jsxs)(Hl,{children:[(0,ne.jsx)(Ne,{style:{justifyContent:"center"},onClick:()=>p("passkey"),disabled:h.passkey||a,children:a?(0,ne.jsx)(Mt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,ne.jsxs)(ql,{children:[(0,ne.jsxs)(Gl,{children:[(0,ne.jsx)(W1.default,{}),"Passkey"]}),h.passkey?(0,ne.jsxs)(oi,{children:[(0,ne.jsx)(Rc.default,{}),"Added"]}):(0,ne.jsx)(oi,{isAccent:!0,children:(0,ne.jsx)(R1.default,{})})]})}),h.passkey&&(0,ne.jsx)(Vl,{onClick:()=>u("passkey"),children:(0,ne.jsx)(Ic.default,{})})]},"passkey")]}),(0,ne.jsx)($,{})]})};var D1=y(require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon")),U1=y(require("@heroicons/react/24/outline/ClockIcon")),F1=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),B1=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Wn=require("react"),ys=y(require("styled-components"));var Z=require("react/jsx-runtime"),H1=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=G(),{data:n}=A(),{initLinkWithPasskey:a,linkWithPasskey:i}=R(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=eo(),[p,u]=(0,Wn.useState)(!1),[h,f]=(0,Wn.useState)(!1),[v,b]=(0,Wn.useState)(!1),[g,S]=(0,Wn.useState)(null),_=(0,Wn.useMemo)(()=>o?.linkedAccounts.filter(D=>D.type==="passkey")??[],[o]),E=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},k=async D=>{u(!0);try{await l(),await s({credentialIds:D}),b(!0)}catch(W){S(W)}finally{u(!1)}},I=async()=>{f(!0),S(null);try{await a();let W=(await i())?.linkedAccounts.filter(M=>M.type==="passkey").map(M=>M.credentialId)??[];await k(W)}catch(D){S(D)}finally{f(!1)}};return _.length===0||h?(0,Z.jsx)(n4,{onReset:r,onClose:t,onClick:I,isCreating:h}):v?(0,Z.jsx)(a4,{onClick:E,onClose:E}):g?(0,Z.jsx)(is,{error:g,backFn:()=>S(null),onClick:()=>S(null)}):(0,Z.jsx)(i4,{passkeys:_,isSubmitting:p,isCreating:h,onReset:r,onClose:t,onSubmitEnrollment:()=>k(_.map(D=>D.credentialId)),onAddPasskey:I})},n4=({onReset:e,onClose:t,onClick:r,isCreating:o})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{backFn:e,onClose:t},"header"),(0,Z.jsx)(Be,{children:(0,Z.jsxs)(kc,{children:[(0,Z.jsx)(pi,{}),(0,Z.jsx)(di,{})]})}),(0,Z.jsx)(Ce,{children:"Set up passkey verification"}),(0,Z.jsxs)(ri,{children:[(0,Z.jsxs)(vr,{children:[(0,Z.jsx)(gr,{children:(0,Z.jsx)(F1.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),(0,Z.jsxs)(vr,{children:[(0,Z.jsx)(gr,{children:(0,Z.jsx)(U1.default,{})}),"Takes seconds to set up and use"]}),(0,Z.jsxs)(vr,{children:[(0,Z.jsx)(gr,{children:(0,Z.jsx)(D1.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),(0,Z.jsx)(F,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),(0,Z.jsx)($,{})]}),i4=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:a,isCreating:i})=>{let[l,s]=(0,Wn.useState)(!1),p=l?n.length:n.length>3?2:3;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&(0,Z.jsx)(Be,{children:(0,Z.jsxs)(kc,{children:[(0,Z.jsx)(pi,{}),(0,Z.jsx)(di,{})]})}),(0,Z.jsx)(Ce,{children:"Enable your passkeys for verification"}),(0,Z.jsxs)(ri,{children:[n.slice(0,p).map(u=>(0,Z.jsxs)(s4,{children:[(0,Z.jsx)(l4,{children:p4(u)}),(0,Z.jsxs)(c4,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&(0,Z.jsx)(N1,{onClick:()=>s(!0),children:"View All"})]}),(0,Z.jsx)(F,{style:{marginTop:"1.5rem"},onClick:o,loading:a,children:"Enable passkeys"}),n.length<5&&(0,Z.jsx)(N1,{style:{marginTop:"0.5rem"},onClick:r,disabled:i,children:i?(0,Z.jsx)(Mt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),(0,Z.jsx)($,{})]})},a4=({onClick:e,onClose:t})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{onClose:t},"header"),(0,Z.jsx)(Be,{children:(0,Z.jsx)(lt,{status:"success",children:(0,Z.jsx)(B1.default,{})})}),(0,Z.jsx)(Ce,{children:"Passkey verification added"}),(0,Z.jsx)(we,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),(0,Z.jsx)(Qt,{children:(0,Z.jsx)(F,{onClick:e,children:"Done"})}),(0,Z.jsx)($,{})]}),s4=ys.default.div`
|
|
1938
1938
|
&& {
|
|
1939
1939
|
padding: 0.75rem 1rem;
|
|
1940
1940
|
text-align: left;
|
|
@@ -2055,7 +2055,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2055
2055
|
width: 100%;
|
|
2056
2056
|
|
|
2057
2057
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
2058
|
-
`;var ge=require("react/jsx-runtime"),z1=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,vs.useState)(""),[a,i]=(0,vs.useState)(!1),[l,s]=(0,vs.useState)(null),[p,u]=(0,vs.useState)("enroll"),{initEnrollmentWithSms:h,submitEnrollmentWithSms:m}=eo(),{app:v,data:b}=A();function g(){b?.mfaEnrollmentFlow?.onSuccess(),e()}async function S({qualifiedPhoneNumber:k}){try{await h({phoneNumber:k}),n(k),u("verify")}catch(I){s(I)}}async function _(k){try{if(!k)return;await m({phoneNumber:o,mfaCode:k}),i(!0)}catch(I){throw Ql(I)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):En(I)?new Error("The code you entered is not valid"):bn(I)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Jl(I)?new Error("Verification canceled"):new Error("Unknown error")}}function E(){p==="verify"?u("enroll"):t()}return l?(0,ge.jsx)(is,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):p==="enroll"?(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{backFn:t,onClose:r},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{children:(0,ge.jsx)(Ed.default,{})})}),(0,ge.jsx)(Ce,{children:"Set up SMS verification"}),(0,ge.jsx)(we,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,ge.jsxs)(zr,{children:[(0,ge.jsx)(ha,{onSubmit:S}),(0,ge.jsxs)($f,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),(0,ge.jsx)($,{})]}):a?(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{onClose:g},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{status:"success",children:(0,ge.jsx)(q1.default,{})})}),(0,ge.jsx)(Ce,{children:"SMS verification added"}),(0,ge.jsx)(we,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,ge.jsx)(Qt,{children:(0,ge.jsx)(F,{onClick:g,children:"Done"})}),(0,ge.jsx)($,{})]}):(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{backFn:E,onClose:r},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{children:(0,ge.jsx)(Ed.default,{})})}),(0,ge.jsx)(Ce,{children:"Enter enrollment code"}),(0,ge.jsxs)(zr,{children:[(0,ge.jsx)(ui,{onChange:_}),(0,ge.jsxs)(we,{children:["To continue, enter the 6-digit code sent to ",(0,ge.jsx)("strong",{children:Hg(o)})]})]}),(0,ge.jsx)($,{})]})};var Y1=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Z1=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Td=require("react");var $1=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var j1=require("react/jsx-runtime");var K1=({size:e,authUrl:t})=>(0,j1.jsx)(pa,{url:t,squareLogoElement:$1.default,size:e,fgColor:"#1F1F1F"});var ve=require("react/jsx-runtime"),Q1=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,a]=(0,Td.useState)("enroll"),[i,l]=(0,Td.useState)(!1),{submitEnrollmentWithTotp:s}=eo(),{data:p}=A();function u(){p?.mfaEnrollmentFlow?.onSuccess(),e()}function h(){a("verify")}async function m(b){try{if(!b)return;await s({mfaCode:b}),l(!0)}catch(g){throw Ql(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):En(g)?new Error("The code you entered is not valid"):bn(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Jl(g)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){n==="verify"?a("enroll"):r()}return n==="enroll"?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{backFn:r,onClose:t},"header"),(0,ve.jsx)(Ce,{children:"Scan QR code"}),(0,ve.jsx)(we,{children:"Open your authenticator app and scan the QR code to continue."}),(0,ve.jsx)(Ki,{children:(0,ve.jsx)(K1,{authUrl:o.authUrl,size:200})}),(0,ve.jsxs)(Qt,{children:[(0,ve.jsx)(lr,{children:(0,ve.jsx)(An,{itemName:"secret",text:o.secret})}),(0,ve.jsx)(F,{onClick:h,children:"Continue"})]}),(0,ve.jsx)($,{})]}):i?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{onClose:u},"header"),(0,ve.jsx)(Be,{children:(0,ve.jsx)(lt,{status:"success",children:(0,ve.jsx)(Y1.default,{})})}),(0,ve.jsx)(Ce,{children:"Authenticator app verification added"}),(0,ve.jsx)(we,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,ve.jsx)(Qt,{children:(0,ve.jsx)(F,{onClick:u,children:"Done"})}),(0,ve.jsx)($,{})]}):(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{backFn:v,onClose:t},"header"),(0,ve.jsx)(Be,{children:(0,ve.jsx)(lt,{children:(0,ve.jsx)(Z1.default,{})})}),(0,ve.jsx)(Ce,{children:"Enter enrollment code"}),(0,ve.jsx)(zr,{children:(0,ve.jsx)(ui,{onChange:m})}),(0,ve.jsxs)(we,{children:["To continue, enter the 6-digit code generated from your ",(0,ve.jsx)("strong",{children:"authenticator app"})]}),(0,ve.jsx)($,{})]})};var V=require("react/jsx-runtime"),o2=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=(0,tn.useState)(null),{unenrollWithSms:n,unenrollWithTotp:a,unenrollWithPasskey:i}=eo(),{app:l,ready:s,data:p,onUserCloseViaDialogOrKeybindRef:u}=A(),{closePrivyModal:h}=R(),{promptMfa:m}=ga(),{initEnrollmentWithTotp:v}=eo(),[b,g]=(0,tn.useState)(!1),[S,_]=(0,tn.useState)(null),[E,k]=(0,tn.useState)(null),I=()=>{h({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:D,submitEnrollmentWithPasskey:W}=eo(),[M,H]=(0,tn.useState)(!1),[z,ee]=(0,tn.useState)(null);u.current=I;let O=e?.mfaMethods.includes("sms"),K=!!e?.phone,L=e?.mfaMethods.includes("totp"),rt=e?.mfaMethods.includes("passkey"),Gt=O||L||rt,Je=e?.linkedAccounts.filter(Ee=>Ee.type==="passkey").map(Ee=>Ee.credentialId)??[];(0,tn.useEffect)(()=>{Gt&&g(!0)},[Gt]);function pe(){o(null),_(null)}function Q(){g(!1)}async function ot(){H(!0);try{await D(),await W({credentialIds:Je})}catch(Ee){ee(Ee)}finally{H(!1)}}async function at(Ee){if(await m().catch(ee),Ee==="totp"){_(Ee),k(null),v().then(st=>{k(st)}).catch(()=>{k(null),pe()});return}if(Ee==="passkey"&&Je.length===1)return await ot();_(Ee)}if(!s||!e||!l)return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(k1,{})}),(0,V.jsx)(zr,{children:(0,V.jsx)(Mt,{})}),(0,V.jsx)($,{})]});async function dr(){o(null);try{await n()}catch{o(null)}}async function _r(){o(null);try{await a()}catch{o(null)}}async function rr(){o(null);try{await m(),await i()}catch{o(null)}}if(r==="sms")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(t2.default,{})})}),(0,V.jsx)(Ce,{children:"Remove SMS verification?"}),(0,V.jsxs)(we,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:dr,children:"Remove SMS for MFA"})}),(0,V.jsx)($,{})]});if(r==="totp")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(X1.default,{})})}),(0,V.jsx)(Ce,{children:"Remove Authenticator App verification?"}),(0,V.jsxs)(we,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:_r,children:"Remove Authenticator App for MFA"})}),(0,V.jsx)($,{})]});if(r==="passkey")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(r2.default,{})})}),(0,V.jsx)(Ce,{children:"Are you sure you want to remove passkey verification?"}),(0,V.jsx)(we,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:rr,children:"Yes, remove"})}),(0,V.jsx)($,{})]});if(p.mfaEnrollmentFlow.mfaMethods.length===0&&!Gt)return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(Pd.default,{})})}),(0,V.jsx)(Ce,{children:"Add more security"}),(0,V.jsxs)(we,{children:[l?.name," does not have any verification methods enabled."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{onClick:I,children:"Close"})}),(0,V.jsx)($,{})]});let qt=!Gt&&!b;return qt?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(Pd.default,{})})}),(0,V.jsx)(Ce,{children:"Transaction Protection"}),(0,V.jsx)(we,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,V.jsxs)(ri,{children:[(0,V.jsxs)(vr,{children:[(0,V.jsx)(gr,{children:(0,V.jsx)(J1.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,V.jsxs)(vr,{children:[(0,V.jsx)(gr,{children:(0,V.jsx)(e2.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,V.jsxs)(Qt,{children:[(0,V.jsx)(F,{onClick:()=>g(!0),children:"Continue"}),(0,V.jsx)(lo,{onClick:I,children:"Not now"})]}),(0,V.jsx)($,{})]}):S==="sms"?(0,V.jsx)(z1,{onComplete:I,onReset:pe,onClose:I}):S==="totp"&&E?(0,V.jsx)(Q1,{onComplete:I,onClose:I,onReset:pe,totpInfo:E}):S==="passkey"?(0,V.jsx)(H1,{onComplete:I,onReset:pe,onClose:I}):(0,V.jsx)(L1,{showIntro:qt,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:K,onBackToIntro:Q,handleSelectMethod:at,isTotpLoading:S==="totp"&&!E,isPasskeyLoading:M,error:z,onClose:I,setRemovingMfaMethod:o})};var W2=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),M2=y(require("@heroicons/react/24/outline/FingerPrintIcon")),O2=y(require("@heroicons/react/24/outline/PhoneIcon")),L2=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),N2=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),D2=y(require("@heroicons/react/24/solid/PhoneIcon")),On=require("react");var fi=require("react"),x2=y(require("styled-components")),Fc=require("@privy-io/js-sdk-core");var Id=y(require("styled-components"));var Sd=y(require("styled-components")),Cs=require("react/jsx-runtime"),Mc=({label:e,children:t,valueStyles:r})=>(0,Cs.jsxs)(y4,{children:[(0,Cs.jsx)("div",{children:e}),(0,Cs.jsx)(g4,{style:{...r},children:t})]}),y4=Sd.default.div`
|
|
2058
|
+
`;var ge=require("react/jsx-runtime"),z1=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,vs.useState)(""),[a,i]=(0,vs.useState)(!1),[l,s]=(0,vs.useState)(null),[p,u]=(0,vs.useState)("enroll"),{initEnrollmentWithSms:h,submitEnrollmentWithSms:f}=eo(),{app:v,data:b}=A();function g(){b?.mfaEnrollmentFlow?.onSuccess(),e()}async function S({qualifiedPhoneNumber:k}){try{await h({phoneNumber:k}),n(k),u("verify")}catch(I){s(I)}}async function _(k){try{if(!k)return;await f({phoneNumber:o,mfaCode:k}),i(!0)}catch(I){throw Ql(I)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):En(I)?new Error("The code you entered is not valid"):bn(I)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Jl(I)?new Error("Verification canceled"):new Error("Unknown error")}}function E(){p==="verify"?u("enroll"):t()}return l?(0,ge.jsx)(is,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):p==="enroll"?(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{backFn:t,onClose:r},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{children:(0,ge.jsx)(Ed.default,{})})}),(0,ge.jsx)(Ce,{children:"Set up SMS verification"}),(0,ge.jsx)(we,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,ge.jsxs)(zr,{children:[(0,ge.jsx)(ha,{onSubmit:S}),(0,ge.jsxs)($f,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),(0,ge.jsx)($,{})]}):a?(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{onClose:g},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{status:"success",children:(0,ge.jsx)(q1.default,{})})}),(0,ge.jsx)(Ce,{children:"SMS verification added"}),(0,ge.jsx)(we,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,ge.jsx)(Qt,{children:(0,ge.jsx)(F,{onClick:g,children:"Done"})}),(0,ge.jsx)($,{})]}):(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(x,{backFn:E,onClose:r},"header"),(0,ge.jsx)(Be,{children:(0,ge.jsx)(lt,{children:(0,ge.jsx)(Ed.default,{})})}),(0,ge.jsx)(Ce,{children:"Enter enrollment code"}),(0,ge.jsxs)(zr,{children:[(0,ge.jsx)(ui,{onChange:_}),(0,ge.jsxs)(we,{children:["To continue, enter the 6-digit code sent to ",(0,ge.jsx)("strong",{children:Hg(o)})]})]}),(0,ge.jsx)($,{})]})};var Y1=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Z1=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Td=require("react");var $1=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var j1=require("react/jsx-runtime");var K1=({size:e,authUrl:t})=>(0,j1.jsx)(pa,{url:t,squareLogoElement:$1.default,size:e,fgColor:"#1F1F1F"});var ve=require("react/jsx-runtime"),Q1=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,a]=(0,Td.useState)("enroll"),[i,l]=(0,Td.useState)(!1),{submitEnrollmentWithTotp:s}=eo(),{data:p}=A();function u(){p?.mfaEnrollmentFlow?.onSuccess(),e()}function h(){a("verify")}async function f(b){try{if(!b)return;await s({mfaCode:b}),l(!0)}catch(g){throw Ql(g)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):En(g)?new Error("The code you entered is not valid"):bn(g)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Jl(g)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){n==="verify"?a("enroll"):r()}return n==="enroll"?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{backFn:r,onClose:t},"header"),(0,ve.jsx)(Ce,{children:"Scan QR code"}),(0,ve.jsx)(we,{children:"Open your authenticator app and scan the QR code to continue."}),(0,ve.jsx)(Ki,{children:(0,ve.jsx)(K1,{authUrl:o.authUrl,size:200})}),(0,ve.jsxs)(Qt,{children:[(0,ve.jsx)(lr,{children:(0,ve.jsx)(An,{itemName:"secret",text:o.secret})}),(0,ve.jsx)(F,{onClick:h,children:"Continue"})]}),(0,ve.jsx)($,{})]}):i?(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{onClose:u},"header"),(0,ve.jsx)(Be,{children:(0,ve.jsx)(lt,{status:"success",children:(0,ve.jsx)(Y1.default,{})})}),(0,ve.jsx)(Ce,{children:"Authenticator app verification added"}),(0,ve.jsx)(we,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,ve.jsx)(Qt,{children:(0,ve.jsx)(F,{onClick:u,children:"Done"})}),(0,ve.jsx)($,{})]}):(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(x,{backFn:v,onClose:t},"header"),(0,ve.jsx)(Be,{children:(0,ve.jsx)(lt,{children:(0,ve.jsx)(Z1.default,{})})}),(0,ve.jsx)(Ce,{children:"Enter enrollment code"}),(0,ve.jsx)(zr,{children:(0,ve.jsx)(ui,{onChange:f})}),(0,ve.jsxs)(we,{children:["To continue, enter the 6-digit code generated from your ",(0,ve.jsx)("strong",{children:"authenticator app"})]}),(0,ve.jsx)($,{})]})};var V=require("react/jsx-runtime"),o2=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=(0,tn.useState)(null),{unenrollWithSms:n,unenrollWithTotp:a,unenrollWithPasskey:i}=eo(),{app:l,ready:s,data:p,onUserCloseViaDialogOrKeybindRef:u}=A(),{closePrivyModal:h}=R(),{promptMfa:f}=ga(),{initEnrollmentWithTotp:v}=eo(),[b,g]=(0,tn.useState)(!1),[S,_]=(0,tn.useState)(null),[E,k]=(0,tn.useState)(null),I=()=>{h({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),_(null)},500)},{initEnrollmentWithPasskey:D,submitEnrollmentWithPasskey:W}=eo(),[M,H]=(0,tn.useState)(!1),[z,ee]=(0,tn.useState)(null);u.current=I;let O=e?.mfaMethods.includes("sms"),K=!!e?.phone,L=e?.mfaMethods.includes("totp"),rt=e?.mfaMethods.includes("passkey"),Gt=O||L||rt,Je=e?.linkedAccounts.filter(Ee=>Ee.type==="passkey").map(Ee=>Ee.credentialId)??[];(0,tn.useEffect)(()=>{Gt&&g(!0)},[Gt]);function pe(){o(null),_(null)}function Q(){g(!1)}async function ot(){H(!0);try{await D(),await W({credentialIds:Je})}catch(Ee){ee(Ee)}finally{H(!1)}}async function at(Ee){if(await f().catch(ee),Ee==="totp"){_(Ee),k(null),v().then(st=>{k(st)}).catch(()=>{k(null),pe()});return}if(Ee==="passkey"&&Je.length===1)return await ot();_(Ee)}if(!s||!e||!l)return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(k1,{})}),(0,V.jsx)(zr,{children:(0,V.jsx)(Mt,{})}),(0,V.jsx)($,{})]});async function dr(){o(null);try{await n()}catch{o(null)}}async function _r(){o(null);try{await a()}catch{o(null)}}async function rr(){o(null);try{await f(),await i()}catch{o(null)}}if(r==="sms")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(t2.default,{})})}),(0,V.jsx)(Ce,{children:"Remove SMS verification?"}),(0,V.jsxs)(we,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:dr,children:"Remove SMS for MFA"})}),(0,V.jsx)($,{})]});if(r==="totp")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(X1.default,{})})}),(0,V.jsx)(Ce,{children:"Remove Authenticator App verification?"}),(0,V.jsxs)(we,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:_r,children:"Remove Authenticator App for MFA"})}),(0,V.jsx)($,{})]});if(r==="passkey")return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{backFn:pe,onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(r2.default,{})})}),(0,V.jsx)(Ce,{children:"Are you sure you want to remove passkey verification?"}),(0,V.jsx)(we,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{warn:!0,onClick:rr,children:"Yes, remove"})}),(0,V.jsx)($,{})]});if(p.mfaEnrollmentFlow.mfaMethods.length===0&&!Gt)return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(Pd.default,{})})}),(0,V.jsx)(Ce,{children:"Add more security"}),(0,V.jsxs)(we,{children:[l?.name," does not have any verification methods enabled."]}),(0,V.jsx)(Qt,{children:(0,V.jsx)(F,{onClick:I,children:"Close"})}),(0,V.jsx)($,{})]});let qt=!Gt&&!b;return qt?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{onClose:I},"header"),(0,V.jsx)(Be,{children:(0,V.jsx)(lt,{children:(0,V.jsx)(Pd.default,{})})}),(0,V.jsx)(Ce,{children:"Transaction Protection"}),(0,V.jsx)(we,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,V.jsxs)(ri,{children:[(0,V.jsxs)(vr,{children:[(0,V.jsx)(gr,{children:(0,V.jsx)(J1.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,V.jsxs)(vr,{children:[(0,V.jsx)(gr,{children:(0,V.jsx)(e2.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,V.jsxs)(Qt,{children:[(0,V.jsx)(F,{onClick:()=>g(!0),children:"Continue"}),(0,V.jsx)(lo,{onClick:I,children:"Not now"})]}),(0,V.jsx)($,{})]}):S==="sms"?(0,V.jsx)(z1,{onComplete:I,onReset:pe,onClose:I}):S==="totp"&&E?(0,V.jsx)(Q1,{onComplete:I,onClose:I,onReset:pe,totpInfo:E}):S==="passkey"?(0,V.jsx)(H1,{onComplete:I,onReset:pe,onClose:I}):(0,V.jsx)(L1,{showIntro:qt,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:K,onBackToIntro:Q,handleSelectMethod:at,isTotpLoading:S==="totp"&&!E,isPasskeyLoading:M,error:z,onClose:I,setRemovingMfaMethod:o})};var W2=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),M2=y(require("@heroicons/react/24/outline/FingerPrintIcon")),O2=y(require("@heroicons/react/24/outline/PhoneIcon")),L2=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),N2=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),D2=y(require("@heroicons/react/24/solid/PhoneIcon")),On=require("react");var fi=require("react"),x2=y(require("styled-components")),Fc=require("@privy-io/js-sdk-core");var Id=y(require("styled-components"));var Sd=y(require("styled-components")),Cs=require("react/jsx-runtime"),Mc=({label:e,children:t,valueStyles:r})=>(0,Cs.jsxs)(y4,{children:[(0,Cs.jsx)("div",{children:e}),(0,Cs.jsx)(g4,{style:{...r},children:t})]}),y4=Sd.default.div`
|
|
2059
2059
|
display: flex;
|
|
2060
2060
|
align-items: center;
|
|
2061
2061
|
justify-content: space-between;
|
|
@@ -2276,10 +2276,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2276
2276
|
overflow: hidden;
|
|
2277
2277
|
max-width: 275px;
|
|
2278
2278
|
text-overflow: ellipsis;
|
|
2279
|
-
`;var ba=require("react");var Dc=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=R(),[n,a]=(0,ba.useState)(!0),[i,l]=(0,ba.useState)(void 0),[s,p]=(0,ba.useState)(void 0);return(0,ba.useEffect)(()=>{let u=e.chainId||zo,h=o.find(v=>v.id===Number(u));if(!h)throw new ye(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let v=await r(h);v?p(v):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(v){l(v)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};var Uc=require("react"),Md=(0,Uc.createContext)(null);function Ea(){let e=(0,Uc.useContext)(Md);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Od=require("react/jsx-runtime"),Ps=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Ea(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=R(),[s,p]=(0,fi.useState)(null),[u,h]=(0,fi.useState)(e),{tokenPrice:
|
|
2279
|
+
`;var ba=require("react");var Dc=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=R(),[n,a]=(0,ba.useState)(!0),[i,l]=(0,ba.useState)(void 0),[s,p]=(0,ba.useState)(void 0);return(0,ba.useEffect)(()=>{let u=e.chainId||zo,h=o.find(v=>v.id===Number(u));if(!h)throw new ye(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let v=await r(h);v?p(v):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(v){l(v)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};var Uc=require("react"),Md=(0,Uc.createContext)(null);function Ea(){let e=(0,Uc.useContext)(Md);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Od=require("react/jsx-runtime"),Ps=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Ea(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=R(),[s,p]=(0,fi.useState)(null),[u,h]=(0,fi.useState)(e),{tokenPrice:f}=Dc(u),v=l(e.chainId)||"ETH",b=(0,fi.useMemo)(()=>r.find(g=>g.walletClientType==="privy"),[r]);return(0,fi.useEffect)(()=>{async function g(){if(!await t()||!o||!b)return u;let _=qo(u.chainId,a,n,{appId:i}),E=await(0,Fc.populateTransactionRequest)(b.address,u,_),{totalGasEstimate:k}=await(0,Fc.calculateTotalGasEstimate)(E,_);return p(k.toHexString()),E}g().then(h).catch(console.error)},[o]),b?(0,Od.jsx)(V4,{children:(0,Od.jsx)(Ca,{from:b.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:v})}):null},V4=x2.default.div`
|
|
2280
2280
|
width: 100%;
|
|
2281
2281
|
padding: 1rem 0;
|
|
2282
|
-
`;var A2=y(require("@heroicons/react/24/outline/CalendarIcon")),k2=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),R2=y(require("@heroicons/react/24/outline/ShieldCheckIcon"));var $e=require("react/jsx-runtime"),I2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:a,submitSuccess:i})=>{let{pendingTransaction:l}=R();return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(x,{onClose:r},"header"),(0,$e.jsx)(pt,{children:(0,$e.jsxs)("div",{children:[(0,$e.jsx)(bt,{success:i,fail:!!t}),t?(0,$e.jsx)(k2.default,{style:{width:"38px",height:"38px"}}):(0,$e.jsx)(pi,{style:{width:"38px",height:"38px"}})]})}),(0,$e.jsx)(Ce,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,$e.jsxs)(ri,{children:[(0,$e.jsxs)(vr,{children:[(0,$e.jsx)(gr,{children:(0,$e.jsx)(R2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,$e.jsxs)(vr,{children:[(0,$e.jsx)(gr,{children:(0,$e.jsx)(A2.default,{})}),"You last added a passkey on"," ",a?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,$e.jsx)(zr,{children:(0,$e.jsx)(Ps,{pendingTransaction:l})}),t&&(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(zl,{style:{marginTop:"1.25rem"},children:t.message}),(0,$e.jsx)(F,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&(0,$e.jsx)(Za,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),(0,$e.jsx)($,{})]})};var re=require("react/jsx-runtime"),Ld=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=(0,On.useState)(null),{init:a,cancel:i,submit:l}=ga(),[s,p]=(0,On.useState)(!1),[u,h]=(0,On.useState)(!1),[
|
|
2282
|
+
`;var A2=y(require("@heroicons/react/24/outline/CalendarIcon")),k2=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),R2=y(require("@heroicons/react/24/outline/ShieldCheckIcon"));var $e=require("react/jsx-runtime"),I2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:a,submitSuccess:i})=>{let{pendingTransaction:l}=R();return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(x,{onClose:r},"header"),(0,$e.jsx)(pt,{children:(0,$e.jsxs)("div",{children:[(0,$e.jsx)(bt,{success:i,fail:!!t}),t?(0,$e.jsx)(k2.default,{style:{width:"38px",height:"38px"}}):(0,$e.jsx)(pi,{style:{width:"38px",height:"38px"}})]})}),(0,$e.jsx)(Ce,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,$e.jsxs)(ri,{children:[(0,$e.jsxs)(vr,{children:[(0,$e.jsx)(gr,{children:(0,$e.jsx)(R2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,$e.jsxs)(vr,{children:[(0,$e.jsx)(gr,{children:(0,$e.jsx)(A2.default,{})}),"You last added a passkey on"," ",a?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,$e.jsx)(zr,{children:(0,$e.jsx)(Ps,{pendingTransaction:l})}),t&&(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(zl,{style:{marginTop:"1.25rem"},children:t.message}),(0,$e.jsx)(F,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&(0,$e.jsx)(Za,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),(0,$e.jsx)($,{})]})};var re=require("react/jsx-runtime"),Ld=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=(0,On.useState)(null),{init:a,cancel:i,submit:l}=ga(),[s,p]=(0,On.useState)(!1),[u,h]=(0,On.useState)(!1),[f,v]=(0,On.useState)(null),[b,g]=(0,On.useState)(null);(0,On.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?E(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let S=D=>Zl(D)?(p(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):En(D)?(p(!1),new Error("The code you entered is not valid")):bn(D)?(p(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(D),p(!1),new Error("Something went wrong."));async function _(D){g(null);try{if(!D||!o)return;await l(o,D),h(!0),p(!1),t()}catch(W){throw S(W)}}async function E(D){if(D==="passkey"){try{n(D);let W=await a(D);if(!W)throw new Error("something went wrong");v(W),await l(D,W),h(!0),p(!1),t()}catch(W){g(S(W))}return}try{n(D),await a(D)}catch(W){console.error(W)}}let k=()=>{n(null),g(null),i(),t()},I=()=>{n(null),g(null)};if(!e||!r)return null;if(o==="passkey"){let D=r.linkedAccounts.filter(W=>W.type==="passkey"&&W.enrolledInMfa).sort((W,M)=>M.firstVerifiedAt.valueOf()-W.firstVerifiedAt.valueOf())[0];return(0,re.jsx)(I2,{account:D,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:b,onClose:k,onBack:I,handleSubmit:()=>_(f).catch(g)})}return o?(0,re.jsx)(G4,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:_,selectedMethod:o,onClose:k,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(x,{onClose:k},"header"),(0,re.jsx)(Be,{children:(0,re.jsx)(lt,{children:(0,re.jsx)(L2.default,{})})}),(0,re.jsx)(Ce,{children:"Verify your identity"}),(0,re.jsx)(we,{children:"Choose a verification method"}),(0,re.jsxs)(Bl,{children:[r.mfaMethods.includes("totp")&&(0,re.jsxs)(Ne,{onClick:()=>E("totp"),children:[(0,re.jsx)(W2.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,re.jsxs)(Ne,{onClick:()=>E("sms"),children:[(0,re.jsx)(O2.default,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&(0,re.jsxs)(Ne,{onClick:()=>E("passkey"),children:[(0,re.jsx)(M2.default,{}),"Passkey"]},"passkey")]}),(0,re.jsx)($,{})]})},G4=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:a})=>{let{app:i}=A(),{pendingTransaction:l}=R();switch(e){case"sms":return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(x,{onClose:o},"header"),(0,re.jsx)(Be,{children:(0,re.jsx)(lt,{children:(0,re.jsx)(D2.default,{})})}),(0,re.jsx)(Ce,{children:"Enter verification code"}),(0,re.jsxs)(zr,{children:[(0,re.jsx)(ui,{success:t,disabled:r,onChange:a}),(0,re.jsxs)(we,{children:["To continue, please enter the 6-digit code sent to your ",(0,re.jsx)("strong",{children:"mobile device"})]}),l&&(0,re.jsx)(Ps,{pendingTransaction:l})]}),n&&(0,re.jsx)(Za,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,re.jsx)(lo,{onClick:o,children:"Not now"}),(0,re.jsx)($,{})]});case"totp":return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(x,{onClose:o},"header"),(0,re.jsx)(Be,{children:(0,re.jsx)(lt,{children:(0,re.jsx)(N2.default,{})})}),(0,re.jsx)(Ce,{children:"Enter verification code"}),(0,re.jsxs)(zr,{children:[(0,re.jsx)(ui,{success:t,disabled:r,onChange:a}),(0,re.jsxs)(we,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,re.jsx)("strong",{children:"authenticator app"})]}),l&&(0,re.jsx)(Ps,{pendingTransaction:l})]}),n&&(0,re.jsx)(Za,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,re.jsx)(lo,{onClick:o,children:"Not now"}),(0,re.jsx)($,{})]});default:return null}};var Ta=require("react"),U2=y(require("styled-components"));var Ft=require("react/jsx-runtime"),F2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:p,loginWithOAuth:u,updateWallets:h,setReadyToTrue:f,closePrivyModal:v,createAnalyticsEvent:b}=R(),[g,S]=(0,Ta.useState)(!1),[_,E]=(0,Ta.useState)(void 0),k=s()?.provider||"google",{name:I,component:D}=Ha(k),W=Gi(),M=et;(0,Ta.useEffect)(()=>{u(k).then(ee=>{S(!0),f(!0),ee&&W("login","onOAuthLoginComplete",ee)}).catch(ee=>{if(f(!1),ee?.privyErrorCode==="allowlist_rejected"){E(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(ee?.privyErrorCode==="max_accounts_reached"){console.error(new Hr(ee).toString()),E(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}if(ee?.privyErrorCode==="user_does_not_exist"){E(void 0),l(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:O,detail:K}=hm(ee,k);E({retryable:O,detail:K,message:"Authentication failed"})}).finally(()=>{Zn()})},[I,k]),(0,Ta.useEffect)(()=>{if(r&&e&&g&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let O=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(O)}if(hr(o,n?.embeddedWallets?.createOnLogin)){let O=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),b({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:k,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M);return()=>clearTimeout(O)}else{let O=setTimeout(()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M);return h(),()=>clearTimeout(O)}}},[r,e,g,o]);let H=g?`Successfully connected with ${I}`:_?_.message:`Verifying connection to ${I}`,z="";return g?z="You\u2019re good to go!":_?z=_.detail:z="Just a few moments more",(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(x,{}),(0,Ft.jsx)(le,{}),(0,Ft.jsxs)(q4,{children:[(0,Ft.jsx)(pt,{children:(0,Ft.jsxs)("div",{children:[(0,Ft.jsx)(bt,{success:g,fail:!!_}),(0,Ft.jsx)(D,{style:{width:"38px",height:"38px"}})]})}),(0,Ft.jsxs)(dt,{children:[(0,Ft.jsx)("h3",{children:H}),(0,Ft.jsx)("p",{children:z})]}),_&&_?.retryable?(0,Ft.jsx)(qi,{onClick:()=>{Zn(),p(k),E(void 0)},disabled:!g&&!_?.retryable,children:"Retry"}):null]}),(0,Ft.jsx)(me,{}),(0,Ft.jsx)($,{})]})},q4=U2.default.div`
|
|
2283
2283
|
display: flex;
|
|
2284
2284
|
flex-direction: column;
|
|
2285
2285
|
align-items: center;
|
|
@@ -2287,10 +2287,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2287
2287
|
margin-left: 27px;
|
|
2288
2288
|
margin-right: 27px;
|
|
2289
2289
|
gap: 24px;
|
|
2290
|
-
`;var on=require("react"),Nd=y(require("styled-components"));var jt=require("react/jsx-runtime"),B2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=A(),{loginWithPasskey:o,closePrivyModal:n}=R(),a=et,[i,l]=(0,on.useState)("loading"),[s,p]=(0,on.useState)(null),u=(0,on.useRef)([]),h=S=>{u.current=[S,...u.current]};(0,on.useEffect)(()=>()=>{u.current.forEach(S=>clearTimeout(S)),u.current=[]},[]);let
|
|
2290
|
+
`;var on=require("react"),Nd=y(require("styled-components"));var jt=require("react/jsx-runtime"),B2=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=A(),{loginWithPasskey:o,closePrivyModal:n}=R(),a=et,[i,l]=(0,on.useState)("loading"),[s,p]=(0,on.useState)(null),u=(0,on.useRef)([]),h=S=>{u.current=[S,...u.current]};(0,on.useEffect)(()=>()=>{u.current.forEach(S=>clearTimeout(S)),u.current=[]},[]);let f=()=>{switch(i){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},v=()=>{switch(i){case"loading":return`Please follow prompts to verify your passkey.
|
|
2291
2291
|
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 yt){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.
|
|
2292
2292
|
You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
|
|
2293
|
-
You will have to sign up with another method first to register a passkey for your account.`}},b=()=>{switch(i){case"loading":case"success":return(0,jt.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return(0,jt.jsx)(F,{onClick:g,disabled:!1,children:"Retry"})}},g=async()=>{l("loading");try{await o(),l("success")}catch(S){p(S),l("error")}};return(0,on.useEffect)(()=>{i==="success"&&h(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[i]),(0,on.useEffect)(()=>{g()},[]),(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)(x,{backFn:!e||t===e?void 0:r}),(0,jt.jsxs)(z4,{children:[(0,jt.jsx)(pt,{children:(0,jt.jsxs)("div",{children:[(0,jt.jsx)(bt,{success:i==="success",fail:i==="error"}),(0,jt.jsx)(di,{style:{width:"38px",height:"38px"}})]})}),(0,jt.jsxs)(dt,{children:[(0,jt.jsx)("h3",{children:
|
|
2293
|
+
You will have to sign up with another method first to register a passkey for your account.`}},b=()=>{switch(i){case"loading":case"success":return(0,jt.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return(0,jt.jsx)(F,{onClick:g,disabled:!1,children:"Retry"})}},g=async()=>{l("loading");try{await o(),l("success")}catch(S){p(S),l("error")}};return(0,on.useEffect)(()=>{i==="success"&&h(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[i]),(0,on.useEffect)(()=>{g()},[]),(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)(x,{backFn:!e||t===e?void 0:r}),(0,jt.jsxs)(z4,{children:[(0,jt.jsx)(pt,{children:(0,jt.jsxs)("div",{children:[(0,jt.jsx)(bt,{success:i==="success",fail:i==="error"}),(0,jt.jsx)(di,{style:{width:"38px",height:"38px"}})]})}),(0,jt.jsxs)(dt,{children:[(0,jt.jsx)("h3",{children:f()}),(0,jt.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:v()})]}),b()]}),(0,jt.jsx)($,{})]})},z4=Nd.default.div`
|
|
2294
2294
|
display: flex;
|
|
2295
2295
|
flex-direction: column;
|
|
2296
2296
|
align-items: center;
|
|
@@ -2315,7 +2315,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2315
2315
|
}
|
|
2316
2316
|
`;var Ss=require("react"),G2=y(require("styled-components"));var H2=require("react-device-detect");var V2=(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(!mn()&&H2.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var pr=require("react/jsx-runtime"),q2=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=(0,Ss.useState)(""),[a,i]=(0,Ss.useState)(!1);(0,Ss.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=V2(o,!a),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,pr.jsxs)(pr.Fragment,{children:[(0,pr.jsx)(x,{},"header"),(0,pr.jsx)(le,{}),(0,pr.jsx)(xo,{title:s.title,description:s.description}),(0,pr.jsxs)($r,{children:[(0,pr.jsx)($4,{children:(0,pr.jsx)(Eo,{style:{width:"72px",height:"72px"}})}),(0,pr.jsx)(Nl,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?(0,pr.jsx)("p",{children:s.footnote}):null]}),(0,pr.jsx)(me,{}),(0,pr.jsx)(j,{protectedByPrivy:!0})]})},$4=(0,G2.default)(lr)`
|
|
2317
2317
|
margin: 16px auto;
|
|
2318
|
-
`;var z2=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),hi=require("react"),yi=y(require("styled-components"));var Qe=require("react/jsx-runtime"),$2=()=>{let[e,t]=(0,hi.useState)(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=R(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:p}=A(),[u,h]=(0,hi.useState)(void 0),[
|
|
2318
|
+
`;var z2=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),hi=require("react"),yi=y(require("styled-components"));var Qe=require("react/jsx-runtime"),$2=()=>{let[e,t]=(0,hi.useState)(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=R(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:p}=A(),[u,h]=(0,hi.useState)(void 0),[f,v]=(0,hi.useState)(""),[b,g]=(0,hi.useState)(!1),{privyWallet:S,onCompleteNavigateTo:_,onSuccess:E,onFailure:k}=s.recoverWallet,I=(M="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),k(typeof M=="string"?new nr(M):M)};p.current=I,(0,hi.useEffect)(()=>{if(!r||!S)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let D=M=>{M&&h(M)};return(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(x,{onClose:I}),(0,Qe.jsx)(le,{}),(0,Qe.jsxs)(j4,{children:[(0,Qe.jsxs)(K4,{children:[(0,Qe.jsx)(z2.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Qe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),(0,Qe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,Qe.jsxs)("div",{children:[(0,Qe.jsxs)(Sn,{children:[(0,Qe.jsx)(ra,{type:e?"password":"text",onChange:M=>D(M.target.value),disabled:b,style:{paddingRight:"2.3rem"}}),(0,Qe.jsx)(oa,{style:{right:"0.75rem"},children:e?(0,Qe.jsx)(na,{onClick:()=>t(!1)}):(0,Qe.jsx)(ia,{onClick:()=>t(!0)})})]}),!!f&&(0,Qe.jsx)(Y4,{children:f})]}),(0,Qe.jsxs)("div",{children:[(0,Qe.jsxs)(Xf,{children:[(0,Qe.jsx)("h4",{children:"Why is this necessary?"}),(0,Qe.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Qe.jsx)(Z4,{loading:b||!n,disabled:!u,onClick:async()=>{g(!0);let M=await o();if(M&&S&&u!==null)try{i({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:S.address}}),await n?.recover({address:S.address,accessToken:M,recoveryPin:u,recoveryMethod:S.recoveryMethod}),v(""),_?l(_):a({shouldCallAuthOnSuccess:!1}),E?.(S),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:S.address}})}catch(H){Vh(H)?v("Invalid recovery password, please try again."):v("An error has occurred, please try again.")}finally{g(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&b,children:"Recover your account"})]})]}),(0,Qe.jsx)(me,{}),(0,Qe.jsx)(j,{protectedByPrivy:!0})]})},K4=yi.default.div`
|
|
2319
2319
|
display: flex;
|
|
2320
2320
|
flex-direction: column;
|
|
2321
2321
|
align-items: center;
|
|
@@ -2364,13 +2364,13 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2364
2364
|
padding-bottom: 24px;
|
|
2365
2365
|
`,K2=Dd.default.div`
|
|
2366
2366
|
padding-bottom: 24px;
|
|
2367
|
-
`;var Yt=require("react/jsx-runtime"),j2={"google-drive":{name:"Google Drive",component:Hc},icloud:{name:"iCloud",component:Bc}},Y2=()=>{let{logout:e}=G(),{navigate:t,setModalData:r,data:o}=A(),{recoveryOAuthFlow:n,closePrivyModal:a,createAnalyticsEvent:i}=R(),[l,s]=(0,nn.useState)(!1),{provider:p,action:u,isInAccountCreateFlow:h}=o?.recoveryOAuthStatus,[
|
|
2367
|
+
`;var Yt=require("react/jsx-runtime"),j2={"google-drive":{name:"Google Drive",component:Hc},icloud:{name:"iCloud",component:Bc}},Y2=()=>{let{logout:e}=G(),{navigate:t,setModalData:r,data:o}=A(),{recoveryOAuthFlow:n,closePrivyModal:a,createAnalyticsEvent:i}=R(),[l,s]=(0,nn.useState)(!1),{provider:p,action:u,isInAccountCreateFlow:h}=o?.recoveryOAuthStatus,[f,v]=(0,nn.useState)(void 0),[b,g]=(0,nn.useState)(u==="create-wallet");if(p==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let S=j2[p].name,_=j2[p].component,E=o?.recoverWallet?.onCompleteNavigateTo,k=new nt(async(ee="create-wallet")=>(g(!0),new Promise((O,K)=>{setTimeout(async()=>{try{let L=window.open();await n(p,ee,L),s(!0),O()}catch{v({message:`${ee==="recover"?"Recovery":"Back up"} with ${S} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${S} account associated with your backup.`:"",retryable:!0}),K()}},0)})));(0,nn.useEffect)(()=>{u!=="recover"&&k.execute(h?"create-wallet":"set-recovery")},[]),(0,nn.useEffect)(()=>{if(!l)return;let ee=setTimeout(()=>{h?(r({createWallet:{onSuccess:()=>{},onFailure:O=>{i({eventName:"embedded_wallet_creation_failure_logout",payload:{error:O,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):a({shouldCallAuthOnSuccess:!1})},et);return()=>clearTimeout(ee)},[l]);let I=(0,nn.useCallback)(async()=>{await k.execute("recover"),E?t(E):s(!0)},[]),D=p==="google-drive"?"Google Drive":"Apple iCloud",W=u==="recover"?"recovered":"backed up",M=u==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${W} with ${D}.`||f&&f.message||`${M} with ${D}...`,z=f?f.detail:"";return(0,Yt.jsxs)(Yt.Fragment,{children:[(0,Yt.jsx)(x,{}),b?(0,Yt.jsx)(Yt.Fragment,{children:(0,Yt.jsxs)(_s,{children:[(0,Yt.jsx)(He,{title:H,icon:(0,Yt.jsx)(_,{style:{width:"38px",height:"38px"}}),description:z}),f&&f?.retryable?(0,Yt.jsx)(F,{onClick:()=>{Zn(),v(void 0),u==="create-wallet"?k.execute("create-wallet"):I()},disabled:!l&&!f?.retryable,children:"Try again"}):null]})}):(0,Yt.jsxs)(_s,{children:[(0,Yt.jsx)(He,{title:"Confirm it's really you",icon:(0,Yt.jsx)(_,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${D} where your account is backed up.`}),(0,Yt.jsxs)(F,{onClick:I,children:["Confirm with ",D]})]}),(0,Yt.jsx)(j,{protectedByPrivy:!0})]})};var an=require("react");var Q2=require("react/jsx-runtime"),Z2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=A(),[n,a]=(0,an.useState)(""),[i,l]=(0,an.useState)(!1),[s,p]=(0,an.useState)(),[u,h]=(0,an.useState)(null),{authenticated:f}=G(),{closePrivyModal:v,isNewUserThisSession:b,initializeWalletProxy:g}=R(),{onSuccess:S,onFailure:_,callAuthOnSuccessOnClose:E}=r.createWallet,{createWallet:k}=rc(),[I,D]=(0,an.useState)(null),W=new nt(async()=>{try{let z=await k(s);if(!z)return;D(z),b?t("EMBEDDED_WALLET_CREATED_SCREEN"):(S(z),v({shouldCallAuthOnSuccess:E}))}catch(z){a(z.message)}});(0,an.useEffect)(()=>{u||g(3e4).then(z=>h(z))},[u]),(0,an.useEffect)(()=>{if(!f){t("LANDING"),_(new Error("User must be authenticated before creating a Privy wallet"));return}},[f]);let M=()=>{I&&I?.recoveryMethod!=="user-passcode"?(_(new nr("User created a wallet but failed to set a password for it")),v({shouldCallAuthOnSuccess:!1})):I?(S(I),v({shouldCallAuthOnSuccess:E})):(_(new nr("User wallet creation failed")),v({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let z=250;return W.execute().then(()=>new Promise(ee=>setTimeout(ee,z))).finally(()=>l(!1))};return(0,Q2.jsx)(ic,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:i,buttonHideAnimations:!I&&i,isResettingPassword:!1,error:n,password:s||"",onClose:M,onPasswordChange:p,onPasswordGenerate:()=>p(nc()),onSubmit:H})};var J2=y(require("@heroicons/react/24/outline/LockClosedIcon")),X2=y(require("@heroicons/react/24/outline/PencilSquareIcon")),ev=y(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),tv=require("react"),rv=y(require("styled-components"));var Se=require("react/jsx-runtime"),Ud=rv.default.div`
|
|
2368
2368
|
width: 24px;
|
|
2369
2369
|
height: 24px;
|
|
2370
2370
|
display: flex;
|
|
2371
2371
|
justify-content: center;
|
|
2372
2372
|
align-items: center;
|
|
2373
|
-
`,Q4={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},J4=({onClose:e})=>(0,Se.jsxs)(K2,{children:[(0,Se.jsx)(He,{title:"Why do I need to secure my account?",icon:(0,Se.jsx)(
|
|
2373
|
+
`,Q4={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},J4=({onClose:e})=>(0,Se.jsxs)(K2,{children:[(0,Se.jsx)(He,{title:"Why do I need to secure my account?",icon:(0,Se.jsx)(ev.default,{width:48}),description:(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),(0,Se.jsx)("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),(0,Se.jsx)(F,{onClick:e,children:"Select backup method"})]}),ov=()=>{let[e,t]=(0,tv.useState)(!1),{navigate:r,setModalData:o,data:n}=A(),{user:a}=G(),{embeddedWallets:i}=Wt(),l=Oe(a),s=l===null,{isInAccountCreateFlow:p,isResettingPassword:u}=n.recoverySelection,h=l?.recoveryMethod!=="privy",f=h?"Update backup method":"Secure your account",v=h?(0,Se.jsxs)("span",{children:["Your account is currently secured using"," ",(0,Se.jsx)("strong",{children:Q4[l?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function b(g){o({recoveryOAuthStatus:{provider:g,action:s?"create-wallet":"set-recovery",isInAccountCreateFlow:p}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(x,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?(0,Se.jsx)(J4,{onClose:()=>t(!1)}):(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(He,{title:f,icon:(0,Se.jsx)(J2.default,{width:48}),description:v}),(0,Se.jsx)(_s,{children:i.userOwnedRecoveryOptions.filter(g=>["icloud","google-drive"].includes(l?.recoveryMethod||"")?g!==l?.recoveryMethod:!0).sort().map(g=>{switch(g){case"google-drive":return(0,Se.jsxs)(Ne,{onClick:()=>b("google-drive"),children:[(0,Se.jsx)(Ud,{children:(0,Se.jsx)(Hc,{style:{width:18}})}),"Back up to Google Drive"]},g);case"icloud":return(0,Se.jsxs)(Ne,{onClick:()=>b("icloud"),children:[(0,Se.jsx)(Ud,{children:(0,Se.jsx)(Bc,{style:{width:24}})}),"Back up to Apple iCloud"]},g);case"user-passcode":return(0,Se.jsxs)(Ne,{onClick:()=>{let S=ed({isCreatingWallet:s,skipSplashScreen:!0});r(S)},children:[(0,Se.jsx)(Ud,{children:(0,Se.jsx)(X2.default,{style:{width:18}})}),u?"Reset your":"Set a"," password"]},g);default:return null}})})]}),(0,Se.jsx)(j,{protectedByPrivy:!0})]})};var Fd=require("@ethersproject/bignumber"),At=require("react"),Dn=y(require("styled-components")),Nn=require("@privy-io/js-sdk-core");var X4=require("@ethersproject/providers"),nv=require("@privy-io/js-sdk-core");async function Vc(e,t,r,o,n){o=Object.assign({chainId:zo},o),e5(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Gc(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub((0,nv.QuantityToBigNumber)(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function e5(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!t5(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 t5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&r5(e);return t||r||o}function r5(e){return/^-?0x[a-f0-9]+$/i.test(e)}function qc(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}function iv(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var Pa=require("@heroicons/react/24/outline"),dv=require("react"),Pr=y(require("styled-components"));var xs=require("@ethersproject/logger"),o5=new Set([xs.ErrorCode.CALL_EXCEPTION,xs.ErrorCode.NONCE_EXPIRED,xs.ErrorCode.REPLACEMENT_UNDERPRICED,xs.ErrorCode.TRANSACTION_REPLACED]),av=e=>{let t;return e.code&&e.code!==-32e3&&o5.has(e.code)&&(t=e.transactionHash),t},sv=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";var Ke=require("react/jsx-runtime"),n5=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=av(e),o=sv(e);return{errorCode:t,transactionHash:r,errorMessage:o}},i5=()=>(0,Ke.jsxs)(c5,{children:[(0,Ke.jsx)(d5,{}),(0,Ke.jsx)(p5,{})]}),uv=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=R(),[a,i]=(0,dv.useState)(!1),{errorCode:l,transactionHash:s,errorMessage:p}=n5(e),u=n.find(h=>h.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(x,{onClose:r}),(0,Ke.jsxs)(a5,{children:[(0,Ke.jsx)(i5,{}),(0,Ke.jsx)(s5,{children:l}),(0,Ke.jsx)(l5,{children:"Please try again."}),(0,Ke.jsxs)(cv,{children:[(0,Ke.jsx)(lv,{children:"Error message"}),(0,Ke.jsx)(pv,{clickable:!1,children:p})]}),s&&(0,Ke.jsxs)(cv,{children:[(0,Ke.jsx)(lv,{children:"Transaction hash"}),(0,Ke.jsxs)(m5,{children:["Copy this hash to view details about the transaction on a"," ",(0,Ke.jsx)("u",{children:(0,Ke.jsx)("a",{href:u,children:"block explorer"})}),"."]}),(0,Ke.jsxs)(pv,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),i(!0)},children:[s,(0,Ke.jsx)(y5,{clicked:a})]})]}),(0,Ke.jsx)(u5,{onClick:()=>o({resetNonce:!!s}),children:"Retry transaction"})]}),(0,Ke.jsx)($,{})]})},a5=Pr.default.div`
|
|
2374
2374
|
display: flex;
|
|
2375
2375
|
flex-direction: column;
|
|
2376
2376
|
align-items: center;
|
|
@@ -2419,13 +2419,13 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2419
2419
|
margin-top: 24px;
|
|
2420
2420
|
}
|
|
2421
2421
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2422
|
-
`,
|
|
2422
|
+
`,lv=Pr.default.span`
|
|
2423
2423
|
width: 100%;
|
|
2424
2424
|
text-align: left;
|
|
2425
2425
|
font-size: 0.825rem;
|
|
2426
2426
|
color: var(--privy-color-foreground);
|
|
2427
2427
|
padding: 4px;
|
|
2428
|
-
`,
|
|
2428
|
+
`,cv=Pr.default.div`
|
|
2429
2429
|
width: 100%;
|
|
2430
2430
|
margin: 5px;
|
|
2431
2431
|
display: flex;
|
|
@@ -2440,7 +2440,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2440
2440
|
color: var(--privy-color-foreground-3);
|
|
2441
2441
|
text-align: left;
|
|
2442
2442
|
word-wrap: break-word;
|
|
2443
|
-
`,
|
|
2443
|
+
`,pv=Pr.default.span`
|
|
2444
2444
|
position: relative;
|
|
2445
2445
|
width: 100%;
|
|
2446
2446
|
background-color: var(--privy-color-background-2);
|
|
@@ -2470,12 +2470,12 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2470
2470
|
right: 13px;
|
|
2471
2471
|
width: 24px;
|
|
2472
2472
|
height: 24px;
|
|
2473
|
-
`,y5=({clicked:e})=>e?(0,Ke.jsx)(h5,{}):(0,Ke.jsx)(f5,{});var zc=require("@ethersproject/bignumber"),
|
|
2473
|
+
`,y5=({clicked:e})=>e?(0,Ke.jsx)(h5,{}):(0,Ke.jsx)(f5,{});var zc=require("@ethersproject/bignumber"),mv=y(require("styled-components"));var Uo=require("react/jsx-runtime"),g5=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=zc.BigNumber.from(e.gasUsed),o=zc.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=zc.BigNumber.from(t);n=n.add(a)}return n.toString()}catch{return}else return},fv=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i,receiptHeader:l,receiptDescription:s})=>(0,Uo.jsxs)(Uo.Fragment,{children:[(0,Uo.jsx)(x,{onClose:o}),(0,Uo.jsx)(ni,{title:l??"Transaction complete!",description:s??"You're all set."}),(0,Uo.jsx)(Ca,{tokenPrice:n,from:t.from,to:t.to,gas:g5(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),(0,Uo.jsx)(v5,{loading:!1,onClick:o,children:"All Done"}),(0,Uo.jsx)($,{})]}),v5=(0,mv.default)(F)`
|
|
2474
2474
|
&& {
|
|
2475
2475
|
margin-top: 24px;
|
|
2476
2476
|
}
|
|
2477
2477
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2478
|
-
`;var Ie=require("react/jsx-runtime"),C5=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,Ie.jsx)(Wd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,Ie.jsx)(Wd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,Ie.jsx)(Ie.Fragment,{children:(0,Ie.jsx)(_2,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},
|
|
2478
|
+
`;var Ie=require("react/jsx-runtime"),C5=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,Ie.jsx)(Wd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,Ie.jsx)(Wd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,Ie.jsx)(Ie.Fragment,{children:(0,Ie.jsx)(_2,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},yv=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Ea(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:p}=R(),{app:u,navigate:h,data:f,onUserCloseViaDialogOrKeybindRef:v,setModalData:b}=A(),{transactionRequest:g,onSuccess:S,onFailure:_,uiOptions:E,fundWalletConfig:k}=f.sendTransaction,[I,D]=(0,At.useState)(null),[W,M]=(0,At.useState)(null),[H,z]=(0,At.useState)(""),[ee,O]=(0,At.useState)(),[K,L]=(0,At.useState)(),[rt,Gt]=(0,At.useState)(!1),pe={INSUFFICIENT_FUNDS:`Add funds on ${l.find(ht=>ht.id===g.chainId)?.name??"this network"} to complete the transaction.`,ERROR_PREPARING:"There was an error preparing your transaction. Your transaction request will likely fail."},Q=()=>{z(""),O(void 0),L(void 0)},ot=(ht,ct,Ho)=>{z(ht),O(new It(new Ar(ct??ht,Ho??Nn.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[at,dr]=(0,At.useState)(!1),[_r,rr]=(0,At.useState)(!0),[qt,Ee]=(0,At.useState)(null),[st,ur]=(0,At.useState)(g),{tokenPrice:mt,isTokenPriceLoading:N}=Dc(st),Bo=s(g.chainId)||"ETH",[We,te]=(0,At.useState)(null),[se,Me]=(0,At.useState)(null),[or,op]=(0,At.useState)(!0);(0,At.useEffect)(()=>{e||(h("LANDING"),_(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Br=g.from?r.find(ht=>ht.address===g.from):r.find(ht=>ht.walletClientType==="privy"&&!ht.imported),np=async()=>{if(!Br)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:ht,externalTransactionId:ct}=await a(Br.address,{config:k?.config||{}});b({fiatOnRampPrompt:{signedUrl:ht},fiatOnRampStatus:{externalTransactionId:ct}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},dn=(0,At.useMemo)(()=>qo(st.chainId,l,i,{appId:p}),[st.chainId,i]);async function Bn(ht){let ct=ht;if(!await t()||!o||!Br)return;try{ct=await(0,Nn.populateTransactionRequest)(Br.address,ht,dn),ur(ct)}catch(Vo){console.error(Vo),ot(pe.ERROR_PREPARING,Vo.reason)}let ka=Fd.BigNumber.from(0),Ra=Fd.BigNumber.from(0);try{({totalGasEstimate:ka,l1ExecutionFeeEstimate:Ra}=await(0,Nn.calculateTotalGasEstimate)(ct,dn)),te(ka.toHexString()),Me(Ra.toHexString())}catch{te(null)}try{let{balance:Vo,hasSufficientFunds:Ws}=await Gc(Br.address,ct,ka,dn);Ee(Vo.toHexString()),Ws||(rr(!1),ot(pe.INSUFFICIENT_FUNDS,"Wallet has insufficient funds on this network for this transaction."),u?.fiatOnRamp.enabled&&Gt(!0))}catch(Vo){console.warn(`Failed to fetch wallet balance with error: ${Vo}`)}op(!1)}(0,At.useEffect)(()=>{Bn(st)},[o]);let Is=iv(st),ft=Is==="SEND"?`Send ${Bo}`:"Review transaction",vi={modalTitle:E.header||E.modalTitle||ft,buttonText:E.buttonText||"Submit"},Hn=()=>{at||(W?S(W):_(ee||new It(new Ar("The user rejected the request",Nn.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return v.current=Hn,mt===void 0&&N||or?(0,Ie.jsxs)(Ie.Fragment,{children:[E.transactionInfo?.contractInfo?.imgUrl&&(0,Ie.jsx)(El,{src:E.transactionInfo?.contractInfo?.imgUrl}),(0,Ie.jsx)(x,{title:vi.modalTitle,onClose:Hn}),(0,Ie.jsx)(hv,{children:(0,Ie.jsx)(Xi,{})})]}):I!==null?(0,Ie.jsx)(fv,{txn:st,onClose:Hn,receipt:I,transactionInfo:E.transactionInfo,tokenPrice:mt,tokenSymbol:Bo,l1GasEstimate:se,receiptHeader:E.successHeader,receiptDescription:E.successDescription}):K?(0,Ie.jsx)(uv,{transactionError:K,chainId:st.chainId,onClose:Hn,onRetry:({resetNonce:ht})=>{Q();let ct=st;ht&&(ct={...st,nonce:void 0}),Bn(ct)}}):(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)(x,{title:vi.modalTitle,onClose:Hn}),(0,Ie.jsxs)(hv,{children:[(0,Ie.jsxs)(T5,{children:[(0,Ie.jsx)(C5,{txn:st,txnFamily:Is,uiOptions:E,tokenSymbol:Bo,tokenPrice:mt}),Br?(0,Ie.jsx)(Ca,{from:Br.address,to:st.to,txn:st,transactionInfo:E.transactionInfo,gas:We||void 0,tokenPrice:mt,tokenSymbol:Bo}):null,(0,Ie.jsx)(S5,{})]}),(0,Ie.jsxs)(P5,{children:[(0,Ie.jsx)(w5,{children:H}),(0,Ie.jsx)(P2,{txn:st,address:Br?.address??"",hasFunds:_r,balance:qt}),(0,Ie.jsxs)(b5,{children:[rt&&(0,Ie.jsx)(F,{onClick:np,children:"Add Funds"}),(0,Ie.jsx)(E5,{disabled:at||!_r,loading:!o||at,loadingText:at?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{dr(!0);let ht=await t();if(ht&&!at&&Br)try{let ct=await Vc(ht,Br.address,o,st,dn);M(ct);let Ho=await ct.wait();D(qc(Ho)),Q()}catch(ct){console.warn({transaction:st,error:ct}),L(ct),O(new It(new Ar(ct.reason??"Error processing transaction",Nn.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{dr(!1)}},children:vi.buttonText})]})]})]})]})},hv=Dn.default.div`
|
|
2479
2479
|
display: flex;
|
|
2480
2480
|
flex-direction: column;
|
|
2481
2481
|
justify-content: space-between;
|
|
@@ -2506,7 +2506,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2506
2506
|
gap: 8px;
|
|
2507
2507
|
`,S5=Dn.default.div`
|
|
2508
2508
|
flex-grow: 1;
|
|
2509
|
-
`;var
|
|
2509
|
+
`;var gv=require("@ethersproject/bytes"),vv=require("@ethersproject/strings"),sn=require("react"),ln=y(require("styled-components")),$c=require("@privy-io/js-sdk-core");var Ae=require("react/jsx-runtime"),_5=e=>{if(!(0,gv.isHexString)(e))return e;try{return(0,vv.toUtf8String)(e)}catch{return e}},x5=e=>JSON.stringify(e,null,2),A5=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,Ae.jsx)(W5,{children:Object.entries(r).map(([o,n])=>(0,Ae.jsxs)("li",{children:[(0,Ae.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,Ae.jsx)("span",{children:String(r)});return(0,Ae.jsx)("div",{children:t(e)})},k5=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(wv,{children:(0,Ae.jsx)(A5,{data:o})}),(0,Ae.jsx)(An,{text:x5(e.typedData),itemName:"full payload to clipboard"})," "]})},Cv=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=R(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=A(),[i,l]=(0,sn.useState)(!0),[s,p]=(0,sn.useState)(""),[u,h]=(0,sn.useState)(),[f,v]=(0,sn.useState)(null),[b,g]=(0,sn.useState)(!1),S=f!==null;(0,sn.useEffect)(()=>{e||o("LANDING")},[e]),(0,sn.useEffect)(()=>{t(Ti).then(z=>{l(!1),z||(p("An error has occurred, please try again."),h(new It(new Ar(s,$c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:_,data:E,confirmAndSign:k,onSuccess:I,onFailure:D,uiOptions:W}=n.signMessage,M={title:W.title||"Sign message",description:W.description||"Signing this message will not cost you any fees.",buttonText:W.buttonText||"Sign and continue"},H=z=>{z?I(z):D(u||new It(new Ar("The user rejected the request.",$c.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{v(null),p(""),h(void 0)},200)};return a.current=()=>{H(f)},(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(x,{onClose:()=>H(f)}),(0,Ae.jsx)(le,{}),W.iconUrl&&typeof W.iconUrl=="string"?(0,Ae.jsx)(L5,{children:(0,Ae.jsx)("img",{src:W.iconUrl,alt:"icon",style:{width:"38px",height:"38px"}})}):null,(0,Ae.jsx)(R5,{children:M.title}),(0,Ae.jsx)(I5,{children:M.description}),_==="personal_sign"&&(0,Ae.jsx)(wv,{children:_5(E)}),_==="eth_signTypedData_v4"&&(0,Ae.jsx)(k5,{typedData:E}),(0,Ae.jsx)(N5,{}),(0,Ae.jsx)(M5,{fail:!0,children:s}),(0,Ae.jsx)(Of,{disabled:b||S||i,loading:b,onClick:async()=>{g(!0),p("");try{let z=await k();v(z),g(!1),setTimeout(()=>{H(z)},et)}catch(z){console.error(z),p("An error has occurred, please try again."),h(new It(new Ar(s,$c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),g(!1)}},children:b?"Signing...":S?(0,Ae.jsxs)(O5,{children:[(0,Ae.jsx)(ac,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,Ae.jsx)("span",{children:"Success"})]}):M.buttonText}),(0,Ae.jsx)(me,{}),(0,Ae.jsx)(j,{protectedByPrivy:!0})]})},R5=ln.default.span`
|
|
2510
2510
|
color: var(--privy-color-foreground);
|
|
2511
2511
|
text-align: center;
|
|
2512
2512
|
font-size: 1.125rem;
|
|
@@ -2523,7 +2523,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2523
2523
|
font-weight: 400;
|
|
2524
2524
|
line-height: 20px; /* 142.857% */
|
|
2525
2525
|
letter-spacing: -0.008px;
|
|
2526
|
-
`,
|
|
2526
|
+
`,wv=ln.default.div`
|
|
2527
2527
|
margin-top: 1.5rem;
|
|
2528
2528
|
background-color: var(--privy-color-background-2);
|
|
2529
2529
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2577,7 +2577,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2577
2577
|
height: 82px;
|
|
2578
2578
|
`,N5=ln.default.div`
|
|
2579
2579
|
flex-grow: 1;
|
|
2580
|
-
`;var Sa=require("react"),
|
|
2580
|
+
`;var Sa=require("react"),bv=y(require("styled-components"));var Bt=require("react/jsx-runtime"),Ev=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{initLoginWithTelegram:s,loginWithTelegram:p,updateWallets:u,setReadyToTrue:h,closePrivyModal:f,createAnalyticsEvent:v}=R(),[b,g]=(0,Sa.useState)(!1),[S,_]=(0,Sa.useState)(void 0),E=et;async function k(){try{await p(),g(!0),h(!0)}catch(W){if(W?.privyErrorCode==="allowlist_rejected"){_(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(W?.privyErrorCode==="max_accounts_reached"){console.error(new Hr(W).toString()),_(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}if(W?.privyErrorCode==="user_does_not_exist"){_(void 0),l(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:M,detail:H}=bp(W);_({retryable:M,detail:H,message:"Authentication failed"})}}(0,Sa.useEffect)(()=>{k()},[]),(0,Sa.useEffect)(()=>{if(!(r&&e&&b&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},E);return()=>clearTimeout(H)}if(hr(o,n?.embeddedWallets?.createOnLogin)){let H=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:z,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},E);return()=>clearTimeout(H)}u();let M=setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),E);return()=>clearTimeout(M)},[r,e,b,o]);let I=b?"Successfully connected with Telegram":S?S.message:"Verifying connection to Telegram",D="";return b?D="You\u2019re good to go!":S?D=S.detail:D="Just a few moments more",(0,Bt.jsxs)(Bt.Fragment,{children:[(0,Bt.jsx)(x,{}),(0,Bt.jsx)(le,{}),(0,Bt.jsxs)(D5,{children:[(0,Bt.jsx)(pt,{children:(0,Bt.jsxs)("div",{children:[(0,Bt.jsx)(bt,{success:b,fail:!!S}),(0,Bt.jsx)(Ec,{style:{width:"38px",height:"38px"}})]})}),(0,Bt.jsxs)(dt,{children:[(0,Bt.jsx)("h3",{children:I}),(0,Bt.jsx)("p",{children:D})]}),S&&S?.retryable?(0,Bt.jsx)(qi,{onClick:()=>{s().then(async()=>k()).catch(W=>{let{retryable:M,detail:H}=bp(W);_({retryable:M,detail:H,message:"Authentication failed"})}),_(void 0)},disabled:!b&&!S?.retryable,children:"Retry"}):null]}),(0,Bt.jsx)(me,{}),(0,Bt.jsx)($,{})]})},D5=bv.default.div`
|
|
2581
2581
|
display: flex;
|
|
2582
2582
|
flex-direction: column;
|
|
2583
2583
|
align-items: center;
|
|
@@ -2585,7 +2585,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2585
2585
|
margin-left: 27px;
|
|
2586
2586
|
margin-right: 27px;
|
|
2587
2587
|
gap: 24px;
|
|
2588
|
-
`;var
|
|
2588
|
+
`;var Sv=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Tv=y(require("@heroicons/react/24/outline/EnvelopeIcon")),As=require("react"),Bd=y(require("styled-components"));var wo=require("react/jsx-runtime"),Pv=(0,As.forwardRef)((e,t)=>{let[r,o]=(0,As.useState)(""),[n,a]=(0,As.useState)(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=R(),{navigate:p,setModalData:u,currentScreen:h}=A(),{enabled:f,token:v}=Pe(),b=Ys(r),g=n,S=n||!b,_=async k=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,k),p("AWAITING_PASSWORDLESS_CODE")}catch(I){u({errorModalData:{error:I,previousScreen:h||"LANDING"}})}a(!1)},E=()=>{f&&!v&&!i?(u({captchaModalData:{callback:k=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,k)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),p("CAPTCHA_SCREEN")):_(v)};return(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)(U5,{children:(0,wo.jsxs)(F5,{children:[(0,wo.jsx)(Tv.default,{}),(0,wo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:k=>o(k.target.value),onKeyUp:k=>{k.key==="Enter"&&E()},value:r,autoComplete:"email"}),e.stacked?null:(0,wo.jsx)(zi,{isSubmitting:g,onClick:E,disabled:S,children:"Submit"})]})}),e.stacked?(0,wo.jsx)(F,{loadingText:null,loading:g,disabled:S,onClick:E,children:"Submit"}):null]})}),U5=Bd.default.div`
|
|
2589
2589
|
width: 100%;
|
|
2590
2590
|
`,F5=Bd.default.label`
|
|
2591
2591
|
display: block;
|
|
@@ -2645,7 +2645,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2645
2645
|
&& > input::placeholder {
|
|
2646
2646
|
color: var(--privy-color-foreground-3);
|
|
2647
2647
|
}
|
|
2648
|
-
`;var Fr=require("react/jsx-runtime"),
|
|
2648
|
+
`;var Fr=require("react/jsx-runtime"),_v=()=>(0,Fr.jsxs)(Fr.Fragment,{children:[(0,Fr.jsx)(x,{},"header"),(0,Fr.jsx)(le,{}),(0,Fr.jsx)(He,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,Fr.jsx)(Sv.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Fr.jsx)($r,{children:(0,Fr.jsx)(Pv,{stacked:!0})}),(0,Fr.jsx)(me,{}),(0,Fr.jsx)(j,{protectedByPrivy:!0})]});var Kc=y(require("styled-components"));var Hd=require("react/jsx-runtime"),xv=({style:e,...t})=>(0,Hd.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:(0,Hd.jsx)("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});var Sr=require("react/jsx-runtime"),Av=()=>{let{navigate:e}=A();return(0,Sr.jsxs)(Sr.Fragment,{children:[(0,Sr.jsx)(x,{}),(0,Sr.jsxs)(B5,{children:[(0,Sr.jsx)(H5,{children:(0,Sr.jsx)(xv,{})}),(0,Sr.jsxs)(V5,{children:[(0,Sr.jsx)("h3",{children:"Unable to sign in"}),(0,Sr.jsx)("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),(0,Sr.jsx)(F,{onClick:()=>{e("LANDING")},children:"Go back"})]}),(0,Sr.jsx)(j,{protectedByPrivy:!0})]})},B5=Kc.default.div`
|
|
2649
2649
|
display: flex;
|
|
2650
2650
|
flex-direction: column;
|
|
2651
2651
|
align-items: center;
|
|
@@ -2897,7 +2897,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2897
2897
|
[hidden] {
|
|
2898
2898
|
display: none;
|
|
2899
2899
|
}
|
|
2900
|
-
`,
|
|
2900
|
+
`,kv=G5;var Rv=jc.createGlobalStyle`
|
|
2901
2901
|
:root {
|
|
2902
2902
|
// Borders
|
|
2903
2903
|
--privy-border-radius-sm: 6px;
|
|
@@ -2934,7 +2934,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2934
2934
|
`,Vd=jc.default.div`
|
|
2935
2935
|
// css normalize only the privy application to avoid conflicts
|
|
2936
2936
|
// with consuming application
|
|
2937
|
-
${
|
|
2937
|
+
${kv}
|
|
2938
2938
|
|
|
2939
2939
|
// Privy styles
|
|
2940
2940
|
color: var(--privy-color-foreground-2);
|
|
@@ -2985,7 +2985,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2985
2985
|
opacity: 1;
|
|
2986
2986
|
}
|
|
2987
2987
|
}
|
|
2988
|
-
`;var gi=require("@headlessui/react"),Yc=y(require("react")),_a=y(require("styled-components")),cn=require("react/jsx-runtime"),
|
|
2988
|
+
`;var gi=require("@headlessui/react"),Yc=y(require("react")),_a=y(require("styled-components")),cn=require("react/jsx-runtime"),Iv=({children:e,open:t,onClick:r,...o})=>(0,cn.jsx)(gi.Transition,{show:t,as:Yc.default.Fragment,children:(0,cn.jsxs)(gi.Dialog,{onClose:r,...o,as:z5,children:[(0,cn.jsx)(gi.Transition.Child,{as:Yc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,cn.jsx)(q5,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,cn.jsx)($5,{children:(0,cn.jsx)(gi.Transition.Child,{as:Yc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,cn.jsx)(gi.Dialog.Panel,{as:K5,children:e})})})]})}),q5=_a.default.div`
|
|
2989
2989
|
position: fixed;
|
|
2990
2990
|
inset: 0;
|
|
2991
2991
|
|
|
@@ -3056,13 +3056,13 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3056
3056
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
3057
3057
|
border-radius: var(--privy-border-radius-lg);
|
|
3058
3058
|
}
|
|
3059
|
-
`,
|
|
3059
|
+
`,Wv=_a.default.div`
|
|
3060
3060
|
display: flex;
|
|
3061
3061
|
flex-direction: column;
|
|
3062
3062
|
align-items: center;
|
|
3063
3063
|
justify-content: center;
|
|
3064
3064
|
height: 100%;
|
|
3065
|
-
`;var je=require("react/jsx-runtime"),j5={["LANDING"]:c1,["CONNECT_OR_CREATE"]:l1,["AWAITING_PASSWORDLESS_CODE"]:ch,["AWAITING_CONNECTION"]:Oh,["AWAITING_CONNECT_ONLY_CONNECTION"]:Dh,["AWAITING_FARCASTER_CONNECTION"]:lg,["AWAITING_FARCASTER_SIGNER"]:ug,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:B2,["PHANTOM_INTERSTITIAL_SCREEN"]:q2,["LOGIN_FAILED_SCREEN"]:S1,["AWAITING_OAUTH_SCREEN"]:F2,["CROSS_APP_AUTH_SCREEN"]:Bh,["ALLOWLIST_REJECTION_SCREEN"]:Qf,["ACCOUNT_NOT_FOUND_SCREEN"]:Gf,["USER_LIMIT_REACHED_SCREEN"]:
|
|
3065
|
+
`;var je=require("react/jsx-runtime"),j5={["LANDING"]:c1,["CONNECT_OR_CREATE"]:l1,["AWAITING_PASSWORDLESS_CODE"]:ch,["AWAITING_CONNECTION"]:Oh,["AWAITING_CONNECT_ONLY_CONNECTION"]:Dh,["AWAITING_FARCASTER_CONNECTION"]:lg,["AWAITING_FARCASTER_SIGNER"]:ug,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:B2,["PHANTOM_INTERSTITIAL_SCREEN"]:q2,["LOGIN_FAILED_SCREEN"]:S1,["AWAITING_OAUTH_SCREEN"]:F2,["CROSS_APP_AUTH_SCREEN"]:Bh,["ALLOWLIST_REJECTION_SCREEN"]:Qf,["ACCOUNT_NOT_FOUND_SCREEN"]:Gf,["USER_LIMIT_REACHED_SCREEN"]:Av,["INSTALL_PHANTOM_SCREEN"]:Og,["LINK_EMAIL_SCREEN"]:d1,["LINK_PHONE_SCREEN"]:E1,["LINK_WALLET_SCREEN"]:T1,["LINK_PASSKEY_SCREEN"]:C1,["UPDATE_EMAIL_SCREEN"]:_v,["CONNECT_ONLY_LANDING_SCREEN"]:Ih,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:_h,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:ny,["EMBEDDED_WALLET_CREATED_SCREEN"]:Zh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Kh,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:$2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:ov,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:Y2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:ty,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Cv,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yv,["FIAT_ON_RAMP_PROMPT_SCREEN"]:bg,["FIAT_ON_RAMP_STATUS_SCREEN"]:_g,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:zy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Hy,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:Z2,["MFA_ENROLLMENT_FLOW_SCREEN"]:o2,["CAPTCHA_SCREEN"]:gh,["ERROR_SCREEN"]:jy,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:kg,["AFFIRMATIVE_CONSENT_SCREEN"]:Yf,["TELEGRAM_AUTH_SCREEN"]:Ev},Y5=["LANDING","AWAITING_CONNECTION"],Mv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=Wt(),{ready:a,currentScreen:i}=A(),{status:l,execute:s,reset:p,enabled:u}=Pe(),h=o&&i&&Y5.includes(i)&&!n&&l==="ready";if((0,pn.useEffect)(()=>{h&&s()},[h]),(0,pn.useEffect)(()=>{!o&&u&&p()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN"&&i!=="CROSS_APP_AUTH_SCREEN"&&i!=="TELEGRAM_AUTH_SCREEN")return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(x,{}),(0,je.jsx)(le,{}),(0,je.jsx)(Wv,{children:(0,je.jsx)(Mt,{})}),(0,je.jsx)(me,{}),(0,je.jsx)($,{})]});if(!i&&e)return(0,je.jsx)(Ld,{open:e,onClose:t});if(!i)return null;let f=j5[i];return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(uo,{if:!!e,children:(0,je.jsx)(f,{})}),(0,je.jsx)(uo,{if:!e,children:(0,je.jsx)(Ld,{open:e,onClose:t})})]})},Z5=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=(0,pn.useRef)(null),o=If(r);return(0,je.jsx)(J5,{style:{height:o},id:"privy-modal-content",children:(0,je.jsx)("div",{ref:r,children:(0,je.jsx)(Mv,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},Q5=()=>{let{closePrivyModal:e}=R(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:(0,pn.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Zc=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:r}=Q5(),[o,n]=(0,pn.useState)(!1);Ol({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=e||o;return t.render.standalone?(0,je.jsx)(Vd,{children:(0,je.jsx)(Ov,{id:"privy-modal-content",children:(0,je.jsx)(Mv,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):(0,je.jsx)(Iv,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:(0,je.jsx)(Vd,{children:(0,je.jsx)(Z5,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},Ov=Gd.default.div`
|
|
3066
3066
|
display: flex;
|
|
3067
3067
|
flex-direction: column;
|
|
3068
3068
|
text-align: center;
|
|
@@ -3071,7 +3071,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3071
3071
|
width: 100%;
|
|
3072
3072
|
background: var(--privy-color-background);
|
|
3073
3073
|
padding: 0 16px;
|
|
3074
|
-
`,J5=(0,Gd.default)(
|
|
3074
|
+
`,J5=(0,Gd.default)(Ov)`
|
|
3075
3075
|
transition: height 150ms ease-out;
|
|
3076
3076
|
overflow: hidden;
|
|
3077
3077
|
|
|
@@ -3085,4 +3085,4 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
3085
3085
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
3086
3086
|
border-radius: var(--privy-border-radius-lg);
|
|
3087
3087
|
}
|
|
3088
|
-
`;var ks=require("react"),N3=require("react/jsx-runtime");function X5({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 L3(e){let t=(0,ks.useRef)(null),r=(0,ks.useRef)();return(0,ks.useEffect)(()=>{r.current?.remove(),r.current=X5(e),t.current?.after(r.current)},[e]),(0,N3.jsx)("div",{ref:t,hidden:!0})}var D3=require("react"),xa=require("react");var Qc=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 Un(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 Ge("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((m,v)=>{r.current={resolve:m,reject:v};let b=1e3*60*5;setTimeout(()=>{let g=new Ge("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),v(g)},b)});return await e(h)}return await e()},s=4,p=null;for(let u=0;u<s;u++)try{p=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(p===null){let u=new Ge("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return p}var F3=require("react/jsx-runtime"),e6=function(e){return()=>`id-${e++}`}(0);function t6(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ht(e){return e.error!==void 0}var kt=new Qc,qd=new Map,r6=(e,t)=>typeof t=="bigint"?t.toString():t,o6=(e,t)=>`${e}${JSON.stringify(t,r6)}`;function Vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=o6(e,t);if(e==="privy:wallet:create"){let l=qd.get(a);if(l)return l}let i=new Promise((l,s)=>{let p=e6();kt.enqueue(p,{resolve:l,reject:s}),n.postMessage({id:p,event:e,data:t},o)}).finally(()=>{qd.delete(a)});return qd.set(a,i),i}function n6(e){switch(e.event){case"privy:iframe:ready":let t=kt.dequeue(e.event,e.id);return Ht(e)?t.reject(new Ge(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=kt.dequeue(e.event,e.id);return Ht(e)?r.reject(new Ge(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=kt.dequeue(e.event,e.id);return Ht(e)?o.reject(new Ge(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=kt.dequeue(e.event,e.id);return Ht(e)?n.reject(new Ge(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let a=kt.dequeue(e.event,e.id);return Ht(e)?a.reject(new Ge(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:rpc":let i=kt.dequeue(e.event,e.id);return Ht(e)?i.reject(new Ge(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery":let l=kt.dequeue(e.event,e.id);return Ht(e)?l.reject(new Ge(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=kt.dequeue(e.event,e.id);return Ht(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:submit-enrollment":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:unenroll":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:mfa:clear":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:init-signer":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:farcaster:sign":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}case"privy:solana-wallet:create":let p=kt.dequeue(e.event,e.id);return Ht(e)?p.reject(new Ge(e.error.type,e.error.message)):p.resolve(e.data);case"privy:solana-wallet:connect":let u=kt.dequeue(e.event,e.id);return Ht(e)?u.reject(new Ge(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=kt.dequeue(e.event,e.id);return Ht(e)?h.reject(new Ge(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let m=kt.dequeue(e.event,e.id);return Ht(e)?m.reject(new Ge(e.error.type,e.error.message)):m.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function U3(e){let t=(0,xa.useRef)(null),r=(0,xa.useRef)(e.mfaMethods),o=Gi(),[n,a]=(0,D3.useState)(!1);return(0,xa.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,xa.useEffect)(()=>{if(!n)return;let i=t.current;if(!i)return;function l(m){m&&m.origin===e.origin&&t6(m.data)&&n6(m.data)}let s={create(m){return Vt("privy:wallet:create",m,i,e.origin)},import(m){return Vt("privy:wallet:import",m,i,e.origin)},connect(m){return Vt("privy:wallet:connect",m,i,e.origin)},recover(m){return Un(v=>Vt("privy:wallet:recover",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!m.recoveryMethod||m.recoveryMethod==="privy")},rpc(m){return Un(v=>Vt("privy:wallet:rpc",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(m){return Vt("privy:solana-wallet:create",m,i,e.origin)},connectSolana(m){return Vt("privy:solana-wallet:connect",m,i,e.origin)},recoverSolana(m){return Vt("privy:solana-wallet:recover",m,i,e.origin)},rpcSolana(m){return Vt("privy:solana-wallet:rpc",m,i,e.origin)},setRecovery(m){return Un(v=>Vt("privy:wallet:set-recovery",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return Un(v=>Vt("privy:mfa:verify",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return Un(v=>Vt("privy:mfa:init-enrollment",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return Un(v=>Vt("privy:mfa:submit-enrollment",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(m){return Un(v=>Vt("privy:mfa:unenroll",{...m,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(m){return Vt("privy:mfa:clear",m,i,e.origin)},initFarcasterSigner(m){return Vt("privy:farcaster:init-signer",m,i,e.origin)},signFarcasterMessage(m){return Vt("privy:farcaster:sign",m,i,e.origin)}};window.addEventListener("message",l);let p=()=>e.onLoad(s),u=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},h=new AbortController;return Ia(()=>Vt("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(p,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),(0,F3.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Zs(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var Jc=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 Te();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await B3())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 Xc({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,apiUrl:n.provider_app_custom_api_url}}async function H3({api:e,appId:t}){let r=jn(),o=Pi(),n=await Si(r);try{let{url:a}=await e.post(Vs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw ue(a)}}async function V3({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(Gs,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens.access_token}catch(a){let i=ue(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 G3({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",p)}let s=setInterval(()=>{t?.closed&&(l(),clearInterval(s),clearTimeout(i),n(new C("User rejected request")))},300);function p(u){u.data&&(u.data.type==="PRIVY_OAUTH_RESPONSE"&&u.data.stateCode&&u.data.authorizationCode&&(clearTimeout(i),o(u.data),l()),u.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(u.data.error)),l()))}window.addEventListener("message",p)})}var ep=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:a})=>{let i=e?.linkedAccounts.find(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(h=>h.address===t)));if(!e||!i)throw new C("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(i.providerApp.id);if(l||await a({appId:i.providerApp.id})&&(l=r.getProviderAccessToken(i.providerApp.id)),!l)throw new C("Transactions require a valid token");let s=window.open(void 0,void 0,zd({w:400,h:680}));if(!s)throw new C("Failed to initialize signature request");return Xc({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id}).then(({apiUrl:u})=>{let h=new URL(`${u}/oauth/transact`);h.searchParams.set("token",l||""),h.searchParams.set("request",i6(o)),s.location=h.href}),new Promise((u,h)=>{let m=()=>{s.close(),window.removeEventListener("message",S)},b=setTimeout(()=>{m(),h(new C("Request timeout"))},12e4),g=setInterval(()=>{s.closed&&(m(),clearInterval(g),clearTimeout(b),h(new C("User rejected request")))},300),S=_=>{_.data&&(_.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&_.data.result&&(m(),clearTimeout(b),u(_.data.result)),_.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&_.data.error&&(m(),clearTimeout(b),h(_.data.error)))};window.addEventListener("message",S)})},i6=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),zd=({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,p=(a-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${p}`};function tp(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}var a6="https://cdn.apple-cloudkit.com";async function $d({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===a6&&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 q3=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});var tr=require("react/jsx-runtime"),Fo;function s6(e){return typeof e=="string"&&e.length===25}function Te(){if(!Fo){let e=oe.get(Gn);return Promise.resolve(e||null)}return Fo.getAccessToken()}var K3,wm=(e,t,r)=>K3(e,t,r),j3,bm=(e,t)=>j3(e,t),Y3,Em=(e,t)=>Y3(e,t),Z3,Tm=()=>Z3(),Q3,B3=()=>Q3(),l6=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;oe.put(La,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},J3=({config:e,...t})=>{if(!s6(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");Fo||(Fo=new Hi({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl||Oa}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,tr.jsx)(ff,{client:Fo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,tr.jsx)(c6,{...t,client:Fo})})},c6=e=>{let t=e.client,[r,o]=(0,ce.useState)(!1),[n,a]=(0,ce.useState)(!1),[i,l]=(0,ce.useState)(!1),[s,p]=(0,ce.useState)(null),[u,h]=(0,ce.useState)([]),[m,v]=(0,ce.useState)(null),b=(0,ce.useRef)(u),[g,S]=(0,ce.useState)(!1),[_,E]=(0,ce.useState)(null),[k,I]=(0,ce.useState)(!1),[D,W]=(0,ce.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:T}),[M,H]=(0,ce.useState)({status:"initial"}),[z,ee]=(0,ce.useState)(null),[O,K]=(0,ce.useState)(null),L=Wt(),rt=Pl(),[Gt,Je]=(0,ce.useState)(!0),[pe,Q]=(0,ce.useState)({}),[ot,at]=(0,ce.useState)(null),[dr,_r]=(0,ce.useState)(null),[rr,qt]=(0,ce.useState)(!1),[Ee,st]=(0,ce.useState)(!1),ur=(0,ce.useRef)(null),mt=(0,ce.useRef)(null),N=(0,ce.useRef)(Wf),[Bo,We]=(0,ce.useState)(!1);t.onStoreToken=c=>{c&&U(N,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{p(null),l(!1),U(N,"accessToken","onAccessTokenRemoved")};let te=(0,ce.useRef)(null),se=(0,ce.useRef)(null),Me=c=>{E(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:c}})},or=c=>{L.embeddedWallets.createOnLogin!=="off"&&Je(!0),Me(c)};(0,ce.useEffect)(()=>{let c=Ai(s);if(!c||!O)return;let d={address:c.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Wi,id:"io.privy.solana.wallet"},getProvider:async()=>new Jc(O,c.address)};v(d)},[O,s]),(0,ce.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=Oe(s),d=yl(s);if(c||t.connectors?.removeEmbeddedWalletConnector(),d||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!O){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}c&&t.connectors.addEmbeddedWalletConnector(O,c.address,L.defaultChain,e.appId),d&&t.connectors.addImportedWalletConnector(O,d.address,L.defaultChain,e.appId)},[O,s]),(0,ce.useEffect)(()=>{O&&dr?.(O)},[O]),(0,ce.useEffect)(()=>{(async()=>{if(!L.customAuth?.enabled)return;Je(!0);let{getCustomAccessToken:d,isLoading:f}=L.customAuth;if(!(!n||f))try{let w=await d();if(!w&&i){await Ci.logout();return}if(!w||i)return;t.startAuthFlow(new wi(w));let{user:P,isNewUser:B}=await t.authenticate();if(!P){await Ci.logout();return}p(P||null),S(B||!1),l(!0),st(!0)}catch(w){console.warn(w),i&&await Ci.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,i]),(0,ce.useEffect)(()=>{Ee&&O&&s&&hr(s,L.embeddedWallets.createOnLogin)&&(st(!1),Ra(s,Ti).catch(console.error))},[Ee&&O&&s]),(0,ce.useEffect)(()=>{async function c(){let d=op(),f=Br();l6();let w=(0,z3.createStore)();t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:w,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let P;t.connectors?.on("connectorInitialized",()=>{P&&clearTimeout(P);let he=t.connectors.walletConnectors.length,Xe=t.connectors.walletConnectors.reduce((_e,wt)=>_e+(wt.initialized?1:0),0);Xe===he?We(!0):P=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:Xe,expected:he}),We(!0)},1500)}),t.connectors?.initialize().then(()=>{Is()});let B=await t.getAuthenticatedUser(),q=!!B;if(L.customAuth?.enabled||(l(!!B),B&&U(N,"login","onComplete",B,!1,!0,null,null),p(B)),d){se.current=q?"link":"login";return}if(f&&!q){se.current="login",or("TELEGRAM_AUTH_SCREEN");return}de.setReadyToTrue(!!B)}!n&&rt&&c()},[t,ot,n,rt]),(0,ce.useEffect)(()=>{if(!n)return;if(!s){qt(!0);return}if(!!!s.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){qt(!0);return}let d=!!u.find(f=>f.walletClientType==="privy");qt(d)},[n,s,u]);let op=()=>{let c=Va();if(c.inProgress&&c.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(c.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:c.stateCode,authorizationCode:c.authorizationCode});return}return!c.inProgress||c.headless?!1:(t.startAuthFlow(new bo(c)),or("AWAITING_OAUTH_SCREEN"),!0)},Br=()=>{let c=ym();if(!c||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let d=new xi;return t.startAuthFlow(d),c.flowType==="login-url"&&(d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult={id:c.id,first_name:c.first_name,last_name:c.last_name,auth_date:c.auth_date,username:c.username,photo_url:c.photo_url,hash:c.hash}),c.flowType==="web-app"&&(d.meta.telegramAuthResult=void 0,d.meta.telegramWebAppData={query_id:c.query_id,user:c.user,auth_date:c.auth_date,hash:c.hash}),!0},np=async(c,d,f,w)=>{let P=await t.connectors?.createWalletConnector(c,d)||null;dn(P,d,f,w)};async function dn(c,d,f,w){if(c)W({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:T});else return W({status:"disconnected",connectedWallet:null,connectError:new ye("Unable to connect to wallet."),connector:null,connectRetry:T}),w?.(null,f);c instanceof So&&d&&await c.resetConnection(d),W({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>dn(c,d,f,w)});try{let P=await c.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(B=>B.id===Number(P?.chainId))&&!(P?.connectorType==="wallet_connect_v2"&&P?.walletClientType==="metamask")&&!(P?.connectorType==="coinbase_wallet"&&L.externalWallets.coinbaseWallet.connectionOptions!=="eoaOnly")){W(B=>({...B,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:T}));try{await P?.switchChain(L.defaultChain.id),P&&(P.chainId=Ei(Vn(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return W(B=>({...B,status:"connected",connectedWallet:P,connectError:null,connectRetry:T})),P&&U(N,"connectWallet","onSuccess",P),w?.(P,f)}catch(P){return P instanceof yt?(console.warn(P.cause?P.cause:P.message),U(N,"connectWallet","onError",P.privyErrorCode||"generic_connect_wallet_error")):(console.warn(P),U(N,"connectWallet","onError","unknown_connect_wallet_error")),W(B=>({...B,status:"disconnected",connectedWallet:null,connectError:P})),w?.(null,f)}}let Bn=async(c,d)=>{if(c===null)return;let f=new Jn(c,t,d);t.startAuthFlow(f)},Is=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_connector"),f=c.get("privy_wallet_client");if(!d||!f)return;if(f==="phantom"&&!mn()&&or("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Me("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),np(d,f,void 0,Bn)};(0,ce.useEffect)(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(p)},[n,i,s,t]);let ft=()=>{if(!i)throw U(N,"linkAccount","onError","must_be_authenticated"),new C("User must be authenticated before linking an account.")},vi=()=>{ft(),te.current="siwe",se.current="link",Me("LINK_WALLET_SCREEN")},Hn=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===c.address&&d.walletClientType!=="privy")return!0;return!1},ht=async c=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(W(f=>({...f,connector:d,status:"connected",connectedWallet:c,connectError:null,connectRetry:T})),L.captchaEnabled&&!i){let f={callback:w=>Bn(c,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Q({captchaModalData:f}),or("CAPTCHA_SCREEN")}else await Bn(c),or("AWAITING_CONNECTION")},ct=async(c,d)=>{if(!L.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:f,externalTransactionId:w}=await Cg(t,c,d?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:w}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},Ho=()=>{h(c=>{let d=t.connectors?.wallets.map(f=>({...f,linked:Hn(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");ht(f)},fund:async w=>{let{signedUrl:P,externalTransactionId:B}=await ct(f.address,w);Q({fiatOnRampPrompt:{signedUrl:P},fiatOnRampStatus:{externalTransactionId:B}}),Me("FIAT_ON_RAMP_PROMPT_SCREEN")},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 w=await t.unlinkWallet(f.address);p(w)}}))||[];return gl(c,d)?c:d})};(0,ce.useEffect)(()=>{Ho()},[s?.linkedAccounts,i,n]),(0,ce.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");Ho(),t.connectors.on("walletsUpdated",Ho)}},[n]);let ka=c=>{if(c&&"suggestedAddress"in c&&c.suggestedAddress){let d=(0,Fn.getAddress)(c.suggestedAddress);ee(d)}Me(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ce.useEffect)(()=>{if(!u[0])return;let c=u[0],d=b.current.find(w=>w.address===c.address),f;if(c.walletClientType==="privy"?f=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===c.address&&w.walletClientType==="privy"):f=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===c.address&&w.walletClientType!=="privy"),!d&&f){let w=Object.assign({},s);w.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},p(w)}b.current=u},[u]);let Ra=async(c,d)=>{if(Oe(c))throw U(N,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,P]=await Promise.all([de.initializeWalletProxy(d),Te()]);if(!w&&L.customAuth?.enabled)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!P||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((B,q)=>{Je(!0),Q({createWallet:{onSuccess:Xe=>{U(N,"createWallet","onSuccess",Xe),B(Xe)},onFailure:Xe=>{U(N,"createWallet","onError","unknown_embedded_wallet_error"),q(Xe)},callAuthOnSuccessOnClose:!1}}),Me("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:P});let B=await de.refreshUser(),q=Oe(B);if(!q)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(N,"createWallet","onSuccess",q),q}},Vo=c=>{if(!L.chains.map(d=>d.id).includes(c))throw new ye(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Ws=(c,d,f)=>new Promise(async(w,P)=>{if(!i||!s){U(N,"sendTransaction","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=c.from,q=B?s?.linkedAccounts.find(Fe=>Fe.type==="wallet"&&Fe.walletClientType==="privy"&&Fe.address===B):Oe(s);if(!q){U(N,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}Je(!0);let he=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Xe=c.chainId?Number(c.chainId):he.chainId;Vo(Xe);let _e=Object.assign({},c,{chainId:Xe}),wt=async()=>{let Fe=await Te();if(!Fe||!O){U(N,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await de.recoverEmbeddedEthereumWallet()){U(N,"sendTransaction","onError","unknown_connect_wallet_error"),P(new Error("Unable to connect to wallet"));return}let ro=qo(_e.chainId,L.chains,L.rpcConfig,{appId:e.appId}),ip=await(0,Aa.populateTransactionRequest)(q.address,_e,ro);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Nv}=await(0,Aa.calculateTotalGasEstimate)(ip,ro),{hasSufficientFunds:Dv}=await Gc(q.address,ip,Nv,ro);if(!Dv)throw new It(new Ar("Wallet has insufficient funds for this transaction.",Aa.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Xd=await Vc(Fe,q.address,O,ip,ro);U(N,"sendTransaction","onSuccess",Xd),w(Xd)}catch(Os){U(N,"sendTransaction","onError","transaction_failure"),P(Os)}};if(L.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),wt();else{let Fe={transactionRequest:_e,onSuccess:ro=>{U(N,"sendTransaction","onSuccess",ro),w(ro)},onFailure:ro=>{U(N,"sendTransaction","onError","transaction_failure"),P(ro)},uiOptions:d||{},fundWalletConfig:f},Os={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:ro=>{U(N,"sendTransaction","onError","unknown_connect_wallet_error"),P(ro)}};Q({connectWallet:Os,sendTransaction:Fe}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Zd(){return new Promise(async(c,d)=>{let f=await Te();if(!f||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:f}),c()}catch(w){d(w)}})}let Qd=c=>c?.linkedAccounts.filter(d=>d.latestVerifiedAt!==null&&!(d.type==="wallet"&&d.walletClientType==="privy")).sort((d,f)=>f.latestVerifiedAt.getTime()-d.latestVerifiedAt.getTime())[0],mr=c=>{if(c==="passkey"){if(s&&s.linkedAccounts.filter(d=>d.type==="passkey").length>=5)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${c} linked.`)}else if(s?.[c])throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${c} linked.`)},Ov=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C("User can't link an account because Telegram linking is disabled.")};async function Jd({legacySetWalletPasswordFlow:c=!1}){E(null);let d=c?"setWalletPassword":"setWalletRecovery";if(!i||!s)throw U(N,d,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let f=Oe(s);if(!f||!O)throw U(N,d,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");try{await Zd()}catch(w){throw U(N,d,"onError","missing_or_invalid_mfa"),w}return new Promise((w,P)=>{Je(!0);let B={onSuccess:_e=>{U(N,d,"onSuccess","user-passcode",_e),w(_e)},onFailure:_e=>{U(N,d,"onError","user_exited_set_password_flow"),P(_e)},callAuthOnSuccessOnClose:!1},q=f.recoveryMethod==="user-passcode",Xe={onCompleteNavigateTo:Xl({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:c,isResettingPassword:q}),shouldForceMFA:!1,onFailure:_e=>{U(N,d,"onError","unknown_connect_wallet_error"),P(_e)}};Q({setWalletPassword:B,createWallet:B,connectWallet:Xe,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:q}}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function Ms({appId:c}){ft(),te.current=`privy:${c}`,se.current="link";let d=window.open(void 0,void 0,zd({w:440,h:680}));return new Promise(async(f,w)=>{let{name:P,logoUrl:B}=await Xc({api:t.api,providerAppId:c,requesterAppId:L.id});Q({crossAppAuth:{appId:c,name:P,logoUrl:B,popup:d,onSuccess:f,onError:w}}),or("CROSS_APP_AUTH_SCREEN")})}let Ci={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:ka,importWallet:async({privateKey:c})=>{ft();let[d,f]=await Promise.all([de.initializeWalletProxy(15e3),Te()]);if(d&&f){await d.import({privateKey:c,accessToken:f});let w=await de.refreshUser(),P=yl(w);if(!P)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(N,"createWallet","onSuccess",P),P}else throw new C("User is not authenticated")},linkWallet:vi,linkCrossAppAccount:Ms,linkEmail:()=>{ft(),mr("email"),te.current="email",se.current="link",Me("LINK_EMAIL_SCREEN")},linkPhone:()=>{ft(),mr("phone"),te.current="sms",se.current="link",Me("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ft(),mr("google"),se.current="link",await de.initLoginWithOAuth("google")},linkTwitter:async()=>{ft(),mr("twitter"),se.current="link",await de.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ft(),mr("discord"),se.current="link",await de.initLoginWithOAuth("discord")},linkGithub:async()=>{ft(),mr("github"),se.current="link",await de.initLoginWithOAuth("github")},linkSpotify:async()=>{ft(),mr("spotify"),se.current="link",await de.initLoginWithOAuth("spotify")},linkInstagram:async()=>{ft(),mr("instagram"),se.current="link",await de.initLoginWithOAuth("instagram")},linkTiktok:async()=>{ft(),mr("tiktok"),se.current="link",await de.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ft(),mr("linkedin"),se.current="link",await de.initLoginWithOAuth("linkedin")},linkApple:async()=>{ft(),mr("apple"),se.current="link",await de.initLoginWithOAuth("apple")},linkPasskey:async()=>{ft(),mr("passkey"),await de.initLinkWithPasskey(),Me("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{ft(),mr("telegram"),Ov(),se.current="link",te.current="telegram",await de.initLoginWithTelegram(),Me("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{ft(),mr("farcaster"),await de.initLoginWithFarcaster(),se.current="link",te.current="farcaster",Me("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ft(),!s?.email)throw new C("User does not have an email linked to their account.");se.current="link",te.current="email",Me("UPDATE_EMAIL_SCREEN")},login:async()=>{let c="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(f=>{at(w=>f.bind(w))});if(at(null),d){console.warn(c);return}}if(i){console.warn(c);return}se.current="login",or("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{at(()=>c)}),at(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}or("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),await t.logout(),s&&O)try{await O.clearMfa({userId:s.id})}catch{}p(null),l(!1),E(null),U(N,"logout","onSuccess"),se.current=null,te.current=null,o(!1),oe.del(Na)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new it;let c=u.find(f=>s.wallet&&f.address===s.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(w=>w.address===c?.address));return!c||!d?new it:d.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new rp.Web3Provider(new no(new it));let c=u.find(f=>s.wallet&&f.address===s.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(w=>w.address===c?.address));return!c||!d?new rp.Web3Provider(new no(new it)):new rp.Web3Provider(new no(d.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new gn(new it);let c=u.find(f=>s.wallet&&f.address===s.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(w=>w.address===c?.address));return!c||!d?new gn(new it):new gn(d.proxyProvider)},unlinkWallet:async c=>{let d=await t.unlinkWallet(c);return p(d),d},unlinkEmail:async c=>{let d=await t.unlinkEmail(c);return p(d),d},unlinkPhone:async c=>{let d=await t.unlinkPhone(c);return p(d),d},unlinkGoogle:async c=>{let d=await t.unlinkOAuth("google",c);return p(d),d},unlinkTwitter:async c=>{let d=await t.unlinkOAuth("twitter",c);return p(d),d},unlinkDiscord:async c=>{let d=await t.unlinkOAuth("discord",c);return p(d),d},unlinkGithub:async c=>{let d=await t.unlinkOAuth("github",c);return p(d),d},unlinkSpotify:async c=>{let d=await t.unlinkOAuth("spotify",c);return p(d),d},unlinkInstagram:async c=>{let d=await t.unlinkOAuth("instagram",c);return p(d),d},unlinkTiktok:async c=>{let d=await t.unlinkOAuth("tiktok",c);return p(d),d},unlinkLinkedIn:async c=>{let d=await t.unlinkOAuth("linkedin",c);return p(d),d},unlinkApple:async c=>{let d=await t.unlinkOAuth("apple",c);return p(d),d},unlinkFarcaster:async c=>{let d=await t.unlinkFarcaster(c);return p(d),d},unlinkTelegram:async c=>{let d=await t.unlinkTelegram(c);return p(d),d},unlinkPasskey:async c=>{let d=await t.unlinkPasskey(c);return p(d),d},unlinkCrossAppAccount:async({subject:c})=>{let d=s?.linkedAccounts.find(w=>w.type==="cross_app"&&w.subject===c)?.providerApp;if(!d)throw new C("Invalid subject");t.storeProviderAccessToken(d.id,null);let f=await t.unlinkOAuth(`privy:${d.id}`,c);return p(f),f},setActiveWallet:async c=>{let d=u.find(w=>(0,Fn.getAddress)(w.address)===(0,Fn.getAddress)(c)),f=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Fn.getAddress)(w.address)===(0,Fn.getAddress)(c));if(!d||!await d.isConnected())ee(c),vi();else if(!d.linked)d.loginOrLink();else{let w=Object.assign({},s);w.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported},p(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw U(N,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ra(s,15e3)},setWalletRecovery:async()=>Jd({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Jd({legacySetWalletPasswordFlow:!0}),signMessage:(c,d,f)=>new Promise(async(w,P)=>{if(!i||!s){U(N,"signMessage","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=f?s?.linkedAccounts.find(he=>he.type==="wallet"&&he.walletClientType==="privy"&&(0,Fn.getAddress)(he.address)===(0,Fn.getAddress)(f)):Oe(s);if(!B){U(N,"signMessage","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){U(N,"signMessage","onError","invalid_message"),P(new Error("Message must be a non-empty string"));return}Je(!0);let q=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let he=await Te();if(!O||!he)throw new Error("Unable to connect to wallet");if(!await de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:B.address}});let{response:_e}=await O.rpc({accessToken:he,address:B.address,request:{method:"personal_sign",params:[c,B.address]}}),wt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:B.address}}),wt};if(L.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let he=await q();U(N,"signMessage","onSuccess",he),w(he)}catch(he){U(N,"signMessage","onError","unable_to_sign"),P(he??new It("Unable to sign message"))}}else{let _e={method:"personal_sign",data:c,confirmAndSign:q,onSuccess:Fe=>{U(N,"signMessage","onSuccess",Fe),w(Fe)},onFailure:Fe=>{U(N,"signMessage","onError","unable_to_sign"),P(Fe)},uiOptions:d||{}},wt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Fe=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),P(Fe)},address:B.address};Q({signMessage:_e,connectWallet:wt}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,d)=>new Promise(async(f,w)=>{if(!i||!s){U(N,"signTypedData","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let P=Oe(s);if(!P){U(N,"signTypedData","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}Je(!0);let B=Wa(c),q=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let he=await Te();if(!O||!he)throw new Error("Unable to connect to wallet");if(!await de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:P.address}});let{response:_e}=await O.rpc({accessToken:he,address:P.address,request:{method:"eth_signTypedData_v4",params:[P.address,B]}}),wt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:P.address}}),wt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let he=await q();U(N,"signTypedData","onSuccess",he),f(he)}catch(he){U(N,"signTypedData","onError","unable_to_sign"),w(he??new It("Unable to sign message"))}}else{let _e={method:"eth_signTypedData_v4",data:B,confirmAndSign:q,onSuccess:Fe=>{U(N,"signTypedData","onSuccess",Fe),f(Fe)},onFailure:Fe=>{U(N,"signTypedData","onError","unable_to_sign"),w(Fe)},uiOptions:d||{}},wt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Fe=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),w(Fe)}};Q({signMessage:_e,connectWallet:wt}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,d,f)=>{let P=await(await Ws(c,d,f)).wait();return qc(P)},exportWallet:()=>new Promise(async(c,d)=>{if(!i||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Oe(s)){d(new Error("Must have a Privy wallet before exporting"));return}Je(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d,shouldForceMFA:!0};if(Q(pe),!await Te()||!O){d(new Error("Must have valid access token to enroll in MFA"));return}if(!O){d(new Error("Must have a Privy wallet before exporting"));return}let B={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:c,onFailure:d};Q({keyExport:B,connectWallet:w}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Zd,async init(c){switch(c){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}},async submit(c,d){switch(c){case"totp":case"sms":if(typeof d!="string")throw new C("Invalid MFA code");ur.current?.resolve({mfaMethod:c,mfaCode:d,relyingParty:window.origin}),await new Promise((B,q)=>{mt.current={resolve:B,reject:q}});break;case"passkey":if(typeof d=="string")throw new C("Invalid authenticator response");let w=await(await import("@simplewebauthn/browser")).startAuthentication(d),P=q3(w);ur.current?.resolve({mfaMethod:c,mfaCode:P,relyingParty:window.origin}),await new Promise((B,q)=>{mt.current={resolve:B,reject:q}});break;default:throw ur.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${c}`)}},cancel(){ur.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((d,f)=>{if(!c){de.closePrivyModal(),d();return}L.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Q({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:d,onFailure:f}}),Me("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await Te();if(!c||!O)throw new Error("Must have valid access token to enroll in MFA");let d=await O.initEnrollMfa({method:"totp",accessToken:c});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:c.phoneNumber,code:c.mfaCode});let f=await t.getAuthenticatedUser();p(f)},async submitEnrollmentWithTotp(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:d,code:c.mfaCode});let f=await t.getAuthenticatedUser();p(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:c}){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:c});let f=await t.getAuthenticatedUser();p(f)},async unenroll(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to remove MFA");c==="passkey"?await O.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:[]}):await O.unenrollMfa({method:c,accessToken:d});let f=await t.getAuthenticatedUser();p(f)},requestFarcasterSignerFromWarpcast:async()=>{let c=await Te(),d=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!d)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 de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let w=await O.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(w.status==="approved"){let P=await t.getAuthenticatedUser();p(P||s||null)}Q({farcasterSigner:w}),Me("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let c=await Te(),d=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!d)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 de.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(P=>Uint8Array.from(P.match(/.{1,2}/g).map(B=>parseInt(B,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async c=>{let d=await Te(),f=s?.linkedAccounts.find(q=>q.type==="wallet"&&q.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!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 de.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 P=await import("@simplewebauthn/browser"),B=await O.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{hash:P.bufferToBase64URLString(c)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(P.base64URLStringToBuffer(B.signature))},isHeadlessOAuthLoading:k,loginWithCode(c){return de.loginWithCode(c)},initLoginWithEmail(c){return de.initLoginWithEmail(c)},initLoginWithSms(c){return de.initLoginWithSms(c)},otpState:M,fundWallet(c,d){return de.fundWallet(c,d)},initLoginWithHeadlessOAuth(c,d){return de.initLoginWithHeadlessOAuth(c,d)},loginWithHeadlessOAuth(c){return de.loginWithHeadlessOAuth(c)},generateSiweMessage({address:c,chainId:d}){return de.generateSiweMessage({address:c,chainId:d})},linkWithSiwe({message:c,signature:d,chainId:f,walletClientType:w,connectorType:P}){return ft(),de.linkWithSiwe({message:c,signature:d,chainId:f,walletClientType:w,connectorType:P})},signMessageWithCrossAppWallet(c,{address:d}){return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"personal_sign",params:[c,d]},reconnect:Ms})},signTypedDataWithCrossAppWallet(c,{address:d}){let f=Wa(c);return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[d,f]},reconnect:Ms})},sendTransactionWithCrossAppWallet(c,{address:d}){return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[c]},reconnect:Ms})},isModalOpen:r,mfaMethods:L.mfa.methods};K3=Ci.signMessage,j3=Ci.signTypedData,Y3=async(...c)=>{let d=await Ws(...c);return L.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let de=(()=>({isNewUserThisSession:g,linkingOrConnectingHint:z,pendingTransaction:null,walletConnectionStatus:D,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>L.chains.find(d=>d.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(O)return O;let d=new Promise(P=>{_r(()=>B=>P(B))}),f=new Promise(P=>setTimeout(()=>P(null),c)),w=await Promise.race([d,f]);return _r(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&s,f;d&&te.current&&(f=Qd(s)),se.current==="login"?c.shouldCallAuthOnSuccess&&d&&te.current?(U(N,"login","onComplete",s,g,!1,te.current,f??null),e.onSuccess?.(s,g)):U(N,"login","onError","exited_auth_flow"):se.current==="link"&&f&&(c.isSuccess&&d&&te.current?U(N,"linkAccount","onSuccess",s,te.current,f):U(N,"linkAccount","onError","exited_link_flow")),ee(null),se.current=null,te.current=null,S(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:Me,connectWallet:dn,initLoginWithWallet:async(c,d)=>{te.current="siwe",Bn(c,d)},loginWithWallet:async()=>{if(!n)throw new Go;if(!(t.authFlow instanceof Jn))throw new C("Must initialize SIWE flow first.");let c,d;if(i)try{({user:c}=await t.link()),te.current="siwe"}catch(f){throw U(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:d}=await t.authenticate()),te.current="siwe"}catch(f){throw U(N,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}p(c||s||null),S(d||!1),l(!0)},initLoginWithFarcaster:async c=>{let d=new Ma(c);t.startAuthFlow(d);try{te.current="farcaster",await d.initializeFarcasterConnect()}catch(f){throw se.current==="login"?U(N,"login","onError",f.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new Go;if(!(t.authFlow instanceof Ma))throw new C("Must initialize Farcaster flow first.");let c,d;if(i)try{({user:c}=await t.link()),te.current="farcaster"}catch(f){throw U(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:d}=await t.authenticate()),te.current="farcaster"}catch(f){throw U(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}p(c||null),S(d||!1),l(!0)},async crossAppAuthFlow({appId:c,popup:d}){let f=`privy:${c}`;te.current=f;let{url:w,stateCode:P,codeVerifier:B}=await H3({api:t.api,appId:c});if(!w)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:c}}),new C("No authorization URL returned for cross-app auth.");try{let q=await G3({url:w,popup:d,provider:f}),he=q.stateCode,Xe=q.authorizationCode;if(he!==P)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:f,storedStateCode:P??"",returnedStateCode:he??""}}),new C("Unexpected auth flow. This may be a phishing attempt.");let _e=await V3({api:Fo.api,appId:c,codeVerifier:B,stateCode:he,authorizationCode:Xe});t.storeProviderAccessToken(c,_e);let wt=await de.refreshUser();if(!wt)throw new C("Unable to update user");return wt}catch(q){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:q.toString(),provider:f}}),q}},async initLoginWithOAuth(c,d){if(te.current=c,cp()){if(c==="google"&&tp(window.navigator.userAgent)){or("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{or("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}oe.del($n);let f=new bo({provider:c});d&&f.addCaptchaToken(d),t.startAuthFlow(f);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&(c==="twitter"&&$3.isAndroid&&(w.url=w.url.replace("x.com","twitter.com")),window.location.assign(w.url))},async initLoginWithTelegram(c){if(!n)throw new Go;te.current="telegram";let d=new xi(c);t.startAuthFlow(d),d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult=await new Promise((f,w)=>{if(!L.loginConfig.telegramAuthConfiguration)return w(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return w(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},P=>P?f(P):w(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof xi))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let c,d;if(i)try{({user:c}=await t.link()),te.current="telegram"}catch(f){throw U(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{let f=await t.authenticate();c=f.user,d=f.isNewUser,te.current="telegram"}catch(f){throw se.current==="login"?U(N,"login","onError",f.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}p(c),S(d||!1),l(!0)},async recoveryOAuthFlow(c,d,f){let w,P;function B(q){if(!q)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:c}}),new C("Recovery OAuth failed")}switch(c){case"google-drive":{let{url:q,codeVerifier:he,stateCode:Xe}=await td({api:Fo.api,provider:c});B(q);let _e,wt;try{let Fe=await $d({url:q,popup:f,provider:c});if(_e=Fe.stateCode,wt=Fe.authorizationCode,_e!==Xe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c,storedStateCode:Xe??"",returnedStateCode:_e??""}}),new C("Unexpected auth flow. This may be a phishing attempt.")}catch(Fe){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Fe.toString(),provider:c}}),new C("Recovery OAuth failed")}[w,P]=await Promise.all([Te(),Gh({api:Fo.api,provider:c,codeVerifier:he,stateCode:_e,authorizationCode:wt})]);break}case"icloud":{let{url:q}=await td({api:Fo.api,provider:c});B(q);let{ckWebAuthToken:he}=await $d({url:q,popup:f,provider:c});P=he,w=await Te();break}}if(!O)throw new C("Cannot connect to wallet proxy");if(!w)throw new C("Unable to authorize user");switch(d){case"recover":let q=pe.recoverWallet?.privyWallet?.address;if(!q)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:q,recoveryMethod:c}}),await O.recover({address:q,accessToken:w,recoveryAccessToken:P,recoveryMethod:c}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:q,recoveryMethod:c}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await O.create({accessToken:w,recoveryAccessToken:P,recoveryMethod:c});let he=await de.refreshUser(),Xe=Oe(he);if(!Xe)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Xe.address}}),U(N,"createWallet","onSuccess",Xe);break;case"set-recovery":let _e=Oe(s);if(!_e)throw U(N,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:c}}),await O.setRecovery({address:_e.address,accessToken:w,recoveryAccessToken:P,recoveryMethod:c});let wt=Oe(await de.refreshUser());if(!wt)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:_e.address,recoveryMethod:c}}),U(N,"setWalletRecovery","onSuccess",c,wt);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(c){if(!(t.authFlow instanceof bo))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=oe.get(qn),f=t.authFlow.meta.stateCode;if(d!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c,storedStateCode:d??"",returnedStateCode:f??""}}),new C("Unexpected auth flow. This may be a phishing attempt.");let w,P,B;if(i)try{let q=await t.link();w=q.user,B=q.oAuthTokens,te.current=c}catch(q){throw U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}else try{let q=await t.authenticate();w=q.user,P=q.isNewUser,B=q.oAuthTokens,te.current=c}catch(q){throw se.current==="login"?U(N,"login","onError",q.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}return p(w),S(P||!1),l(!0),B&&U(N,"oAuthAuthorization","onOAuthTokenGrant",B),B},async initLoginWithPasskey(c){let d=new Qn(c);t.startAuthFlow(d),se.current="login";try{te.current="passkey",await d.initAuthenticationFlow()}catch(f){throw U(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new Go;if(!(t.authFlow instanceof Qn))throw new C("Must initialize Passkey flow first.");if(te.current!=="passkey")throw new C("Must init login with Passkey flow first.");let c,d;try{te.current="passkey",{user:c,isNewUser:d}=await t.authenticate()}catch(f){throw U(N,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}p(c),S(d||!1),l(!0)},async initLinkWithPasskey(c){let d=new Qn(c);t.startAuthFlow(d),se.current="link",te.current="passkey";try{await d.initLinkFlow()}catch(f){throw U(N,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},async linkWithPasskey(){if(!n)throw new Go;if(!(t.authFlow instanceof Qn))throw new C("Must initialize Passkey flow first.");if(te.current!=="passkey")throw new C("Must init login with Passkey flow first.");let c;try{te.current="passkey",{user:c}=await t.link()}catch(d){throw U(N,"linkAccount","onError",d.privyErrorCode||"failed_to_link_account"),d}return p(c||s||null),c},async initLoginWithHeadlessOAuth(c,d){if(cp()){if(c==="google"&&tp(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 bo({provider:c,headless:!0});d&&f.addCaptchaToken(d);let w=await t.startAuthFlow(f).getAuthorizationUrl();w?.url&&window.location.assign(w.url)},async loginWithHeadlessOAuth(c){I(!0),t.startAuthFlow(new bo(c));let d=oe.get(qn),f=c.stateCode;if(d!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c.provider,storedStateCode:d??"",returnedStateCode:f??""}}),I(!1),new C("Unexpected auth flow. This may be a phishing attempt.");let w,P;if(i)try{({user:w}=await t.link()),te.current=c.provider}catch(B){throw U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:w,isNewUser:P}=await t.authenticate()),te.current=c.provider}catch(B){throw se.current==="login"?U(N,"login","onError",B.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return p(w),S(P||!1),l(!0),I(!1),w??void 0},initLoginWithEmail:async(c,d)=>{let f=new un(c,d);t.startAuthFlow(f);try{te.current="email",await f.sendCodeEmail()}catch(w){throw se.current==="login"?U(N,"login","onError",w.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},initUpdateEmail:async(c,d,f)=>{let w=new zs(c,d,f);t.startAuthFlow(w),await w.sendCodeEmail()},initLoginWithSms:async(c,d)=>{H({status:"sending-code"});let f=new Xn(c,d);t.startAuthFlow(f);try{te.current="sms",await f.sendSmsCode(),H({status:"awaiting-code-input"})}catch(w){throw H({status:"error",error:w}),se.current==="login"?U(N,"login","onError",w.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(H({status:"submitting-code"}),!n){let P=new Go;throw H({status:"error",error:P}),P}if(t.authFlow instanceof un)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof Xn)t.authFlow.meta.smsCode=c.trim();else{let P=new C("Must initialize a passwordless code flow first");throw H({status:"error",error:P}),P}let d=await Te(),f,w;if(d&&t.sessionHasActiveToken())try{({user:f}=await t.link())}catch(P){throw H({status:"error",error:P}),U(N,"linkAccount","onError",P.privyErrorCode||"failed_to_link_account"),P}else try{({user:f,isNewUser:w}=await t.authenticate())}catch(P){throw H({status:"error",error:P}),U(N,"login","onError",P.privyErrorCode||"unknown_auth_error"),P}p(f||s||null),S(w||!1),l(!0),H({status:"done"})},generateSiweMessage:async({address:c,chainId:d,captchaToken:f})=>{se.current="link",te.current="siwe";let w=await t.generateSiweNonce({address:c,captchaToken:f}),P=d.replace("eip155:","");return hl({address:c,chainId:P,nonce:w})},linkWithSiwe:async({message:c,signature:d,chainId:f,walletClientType:w,connectorType:P})=>{let B;try{if(se.current!=="link"||te.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");B=await t.linkWithSiwe({message:c,signature:d,chainId:f,walletClientType:w,connectorType:P});let q=Qd(B);q&&U(N,"linkAccount","onSuccess",B,"siwe",q)}catch(q){throw U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),se.current=null,te.current=null,q}p(B||s||null),se.current=null,te.current=null},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return p(c),c},walletProxy:O,createAnalyticsEvent:({eventName:c,payload:d,timestamp:f})=>t.createAnalyticsEvent({eventName:c,payload:d,timestamp:f}),acceptTerms:async()=>{let c=await t.acceptTerms();return p(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedEthereumWallet:async()=>new Promise(async(c,d)=>{let f=Oe(s)||yl(s),w=await Te();if(!w||!O||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Je(!0);try{await O.connect({accessToken:w,address:f.address}),c(!0)}catch(P){if(si(P)&&f.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await O.recover({address:f.address,accessToken:w,recoveryMethod:f.recoveryMethod})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:f.address}}),c(!0);else if(si(P)&&f.recoveryMethod!=="privy"){Q({recoverWallet:{privyWallet:f,onFailure:d,onSuccess:()=>c(!0)},recoveryOAuthStatus:{provider:f.recoveryMethod,action:"recover"}});let B=ec(f.recoveryMethod);Me(B)}else d(P)}}),embeddedSolanaWallet:m,createEmbeddedSolanaWallet:async()=>{Je(!0);let c=await Te(),d=Ai(s),f=Oe(s);if(!s||!c)throw new C("User must be logged in to create a Solana wallet");if(d)throw new C("User already has an embedded Solana wallet.");if(f)throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet.");let w=await de.initializeWalletProxy(15e3);if(!w)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await w.createSolana({accessToken:c});let P=await de.refreshUser(),B=Ai(P);if(!B)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:B.address}}),B}catch(P){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",P)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(c,d)=>{let f=Ai(s),w=await Te();if(!w||!O||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Je(!0);try{await O.connectSolana({accessToken:w,publicKey:f.address}),c(!0)}catch(P){si(P)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await O.recoverSolana({publicKey:f.address,accessToken:w})).publicKey||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:f.address}}),c(!0)):d(P)}}),getFiatOnRampConfig:ct,setReadyToTrue:c=>{a(!0),ot?.(c)},updateWallets:()=>Ho(),fundWallet:async(c,d)=>{let{signedUrl:f,externalTransactionId:w}=await ct(c,d);Q({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:w}}),Me("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let d=await Te(),f=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!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 w=await t.requestFarcasterSignerStatus(c);if(w.status==="approved"){let P=await t.getAuthenticatedUser();p(P||s||null)}return w}}))();Z3=de.recoverEmbeddedEthereumWallet,Q3=de.recoverEmbeddedSolanaWallet;let Lv=(0,ce.useMemo)(()=>({wallets:u,ready:rr&&Bo}),[u,rr,Bo]);return(0,tr.jsx)(xe.Provider,{value:Ci,children:(0,tr.jsx)(Lp.Provider,{value:N,children:(0,tr.jsx)(Md.Provider,{value:Lv,children:(0,tr.jsx)(Af,{...L,children:(0,tr.jsxs)(Op.Provider,{value:de,children:[(0,tr.jsxs)(gf,{data:pe,setModalData:Q,setInitialScreen:E,initialScreen:_,authenticated:i,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!i&&(0,tr.jsx)(Rl,{delayedExecution:!1}),(0,tr.jsx)(R3,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&(0,tr.jsx)(Zc,{open:r})]}),Gt&&rt?(0,tr.jsx)(U3,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ur,mfaSubmitPromise:mt,onLoad:K,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&(0,tr.jsx)(uo,{if:!0,children:(0,tr.jsx)(L3,{scriptHost:e.apiUrl||Oa,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};var X3=require("react");function ev(e){let{login:t}=(0,X3.useContext)(xe);return Ye("login",e),{login:t}}var tv=require("react");function rv(e){let{logout:t}=(0,tv.useContext)(xe);return Ye("logout",e),{logout:t}}var Rs=require("react");function ov(){let e=Pe(),t=Pl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=(0,Rs.useCallback)(async p=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r(p.provider,e.token)},[r,e]),s=(0,Rs.useCallback)(async()=>{let p=Va();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!p.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!p.popupFlow)try{return await o(p)}catch(u){throw u}finally{Zn()}},[o]);return(0,Rs.useEffect)(()=>{let p=Va();a&&t&&p.inProgress&&p.headless&&!p.popupFlow&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var Kd=require("react");var nv=()=>{let e=Pe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=(0,Kd.useCallback)(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=(0,Kd.useCallback)(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Rr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var jd=require("react");var iv=()=>{let e=Pe(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=(0,jd.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=(0,jd.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};var Yd=require("react");var av=()=>{let e=Pe(),{generateSiweMessage:t,linkWithSiwe:r}=G(),o=(0,Yd.useCallback)(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=(0,Yd.useCallback)(async({signature:a,message:i,chainId:l,walletClientType:s,connectorType:p})=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:l,walletClientType:s,connectorType:p})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};var sv=require("react");function lv(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:p,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkTelegram:v,linkFarcaster:b}=(0,sv.useContext)(xe);return Ye("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:p,linkTiktok:u,linkSpotify:h,linkInstagram:m,linkFarcaster:b,linkTelegram:v}}var cv=require("react");function pv(e){let{connectWallet:t}=(0,cv.useContext)(xe);return Ye("connectWallet",e),{connectWallet:t}}var dv=require("react");function uv(e){let{createWallet:t}=(0,dv.useContext)(xe);return Ye("createWallet",e),{createWallet:t}}var mv=()=>{let{fundWallet:e}=G();return{fundWallet:e}};var fv=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=R();return{createWallet:t,wallets:e?[e]:[]}};var hv=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=G();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};var yv=require("react");function gv(e){let{sendTransaction:t}=(0,yv.useContext)(xe);return Ye("sendTransaction",e),{sendTransaction:t}}var vv=require("react");function Cv(e){let{setWalletPassword:t}=(0,vv.useContext)(xe);return Ye("setWalletPassword",e),{setWalletPassword:t}}var wv=require("react");function bv(e){let{setWalletRecovery:t}=(0,wv.useContext)(xe);return Ye("setWalletRecovery",e),{setWalletRecovery:t}}var Ev=require("react");function Tv(e){let{signMessage:t}=(0,Ev.useContext)(xe);return Ye("signMessage",e),{signMessage:t}}var Pv=require("react");function Sv(e){let{signTypedData:t}=(0,Pv.useContext)(xe);return Ye("signTypedData",e),{signTypedData:t}}var _v=require("react");var xv=()=>{let{isModalOpen:e}=(0,_v.useContext)(xe);return{isOpen:e}};var Av=require("react");function kv(e){let{getAccessToken:t}=(0,Av.useContext)(xe);return Ye("accessToken",e),{getAccessToken:t}}function Rv(e){let{authenticated:t,user:r}=G(),{initLoginWithOAuth:o}=R(),n=Gi();return Ye("oAuthAuthorization",e),{reauthorize:a=>p6(t,r,o,n,a.provider)}}var p6=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated"),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)};function Iv(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=G();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function Wv(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function Mv(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,LoginModal,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,getEmbeddedConnectedWallet,useConnectWallet,useCreateWallet,useCrossAppAccounts,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLinkWithSiwe,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,useOAuthTokens,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSetWalletRecovery,useSignMessage,useSignTypedData,useSolanaWallets,useToken,useWallets});
|
|
3088
|
+
`;var ks=require("react"),Nv=require("react/jsx-runtime");function X5({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 Lv(e){let t=(0,ks.useRef)(null),r=(0,ks.useRef)();return(0,ks.useEffect)(()=>{r.current?.remove(),r.current=X5(e),t.current?.after(r.current)},[e]),(0,Nv.jsx)("div",{ref:t,hidden:!0})}var Dv=require("react"),xa=require("react");var Qc=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 Un(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 Ge("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,v)=>{r.current={resolve:f,reject:v};let b=1e3*60*5;setTimeout(()=>{let g=new Ge("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),v(g)},b)});return await e(h)}return await e()},s=4,p=null;for(let u=0;u<s;u++)try{p=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(p===null){let u=new Ge("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return p}var Fv=require("react/jsx-runtime"),e6=function(e){return()=>`id-${e++}`}(0);function t6(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ht(e){return e.error!==void 0}var kt=new Qc,qd=new Map,r6=(e,t)=>typeof t=="bigint"?t.toString():t,o6=(e,t)=>`${e}${JSON.stringify(t,r6)}`;function Vt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=o6(e,t);if(e==="privy:wallet:create"){let l=qd.get(a);if(l)return l}let i=new Promise((l,s)=>{let p=e6();kt.enqueue(p,{resolve:l,reject:s}),n.postMessage({id:p,event:e,data:t},o)}).finally(()=>{qd.delete(a)});return qd.set(a,i),i}function n6(e){switch(e.event){case"privy:iframe:ready":let t=kt.dequeue(e.event,e.id);return Ht(e)?t.reject(new Ge(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=kt.dequeue(e.event,e.id);return Ht(e)?r.reject(new Ge(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let o=kt.dequeue(e.event,e.id);return Ht(e)?o.reject(new Ge(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let n=kt.dequeue(e.event,e.id);return Ht(e)?n.reject(new Ge(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:recover":let a=kt.dequeue(e.event,e.id);return Ht(e)?a.reject(new Ge(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:rpc":let i=kt.dequeue(e.event,e.id);return Ht(e)?i.reject(new Ge(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery":let l=kt.dequeue(e.event,e.id);return Ht(e)?l.reject(new Ge(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let s=kt.dequeue(e.event,e.id);return Ht(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:mfa:submit-enrollment":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:mfa:unenroll":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:mfa:clear":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:farcaster:init-signer":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:farcaster:sign":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}case"privy:solana-wallet:create":let p=kt.dequeue(e.event,e.id);return Ht(e)?p.reject(new Ge(e.error.type,e.error.message)):p.resolve(e.data);case"privy:solana-wallet:connect":let u=kt.dequeue(e.event,e.id);return Ht(e)?u.reject(new Ge(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=kt.dequeue(e.event,e.id);return Ht(e)?h.reject(new Ge(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let f=kt.dequeue(e.event,e.id);return Ht(e)?f.reject(new Ge(e.error.type,e.error.message)):f.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Uv(e){let t=(0,xa.useRef)(null),r=(0,xa.useRef)(e.mfaMethods),o=Gi(),[n,a]=(0,Dv.useState)(!1);return(0,xa.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,xa.useEffect)(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&t6(f.data)&&n6(f.data)}let s={create(f){return Vt("privy:wallet:create",f,i,e.origin)},import(f){return Vt("privy:wallet:import",f,i,e.origin)},connect(f){return Vt("privy:wallet:connect",f,i,e.origin)},recover(f){return Un(v=>Vt("privy:wallet:recover",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!f.recoveryMethod||f.recoveryMethod==="privy")},rpc(f){return Un(v=>Vt("privy:wallet:rpc",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(f){return Vt("privy:solana-wallet:create",f,i,e.origin)},connectSolana(f){return Vt("privy:solana-wallet:connect",f,i,e.origin)},recoverSolana(f){return Vt("privy:solana-wallet:recover",f,i,e.origin)},rpcSolana(f){return Vt("privy:solana-wallet:rpc",f,i,e.origin)},setRecovery(f){return Un(v=>Vt("privy:wallet:set-recovery",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Un(v=>Vt("privy:mfa:verify",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Un(v=>Vt("privy:mfa:init-enrollment",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Un(v=>Vt("privy:mfa:submit-enrollment",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(f){return Un(v=>Vt("privy:mfa:unenroll",{...f,...v},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return Vt("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return Vt("privy:farcaster:init-signer",f,i,e.origin)},signFarcasterMessage(f){return Vt("privy:farcaster:sign",f,i,e.origin)}};window.addEventListener("message",l);let p=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},h=new AbortController;return Ia(()=>Vt("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(p,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),(0,Fv.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Zs(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var Jc=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 Te();if(!r)throw new Error("User must be authenticated to use embedded Solana wallet");if(!await Bv())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 Xc({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,apiUrl:n.provider_app_custom_api_url}}async function Hv({api:e,appId:t}){let r=jn(),o=Pi(),n=await Si(r);try{let{url:a}=await e.post(Vs,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw ue(a)}}async function Vv({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(Gs,{authorization_code:n,state_code:r,code_verifier:o,provider:`privy:${t}`})).oauth_tokens.access_token}catch(a){let i=ue(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 Gv({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",p)}let s=setInterval(()=>{t?.closed&&(l(),clearInterval(s),clearTimeout(i),n(new C("User rejected request")))},300);function p(u){u.data&&(u.data.type==="PRIVY_OAUTH_RESPONSE"&&u.data.stateCode&&u.data.authorizationCode&&(clearTimeout(i),o(u.data),l()),u.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(u.data.error)),l()))}window.addEventListener("message",p)})}var ep=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(u=>!!(u.type==="cross_app"&&u.embeddedWallets.find(h=>h.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);if(l||await a({appId:i.providerApp.id})&&(l=r.getProviderAccessToken(i.providerApp.id)),!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 s=window.open(void 0,void 0,zd({w:400,h:680}));if(!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");return Xc({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id}).then(({apiUrl:u})=>{let h=new URL(`${u}/oauth/transact`);h.searchParams.set("token",l||""),h.searchParams.set("request",i6(o)),s.location=h.href}),new Promise((u,h)=>{let v=setTimeout(()=>{S(),h(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),b=setInterval(()=>{s.closed&&(S(),h(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),g=_=>{_.data&&(_.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&_.data.result&&(S(),u(_.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),_.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&_.data.error&&(S(),h(_.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:_.data.error,address:t}})))};window.addEventListener("message",g);let S=()=>{s.close(),clearInterval(b),clearTimeout(v),window.removeEventListener("message",g)}})},i6=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),zd=({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,p=(a-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${s},top=${p}`};function tp(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}var a6="https://cdn.apple-cloudkit.com";async function $d({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===a6&&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});var tr=require("react/jsx-runtime"),Fo;function s6(e){return typeof e=="string"&&e.length===25}function Te(){if(!Fo){let e=oe.get(Gn);return Promise.resolve(e||null)}return Fo.getAccessToken()}var Kv,wm=(e,t,r)=>Kv(e,t,r),jv,bm=(e,t)=>jv(e,t),Yv,Em=(e,t)=>Yv(e,t),Zv,Tm=()=>Zv(),Qv,Bv=()=>Qv(),l6=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;oe.put(La,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},Jv=({config:e,...t})=>{if(!s6(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");Fo||(Fo=new Hi({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl||Oa}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,tr.jsx)(ff,{client:Fo,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,tr.jsx)(c6,{...t,client:Fo})})},c6=e=>{let t=e.client,[r,o]=(0,ce.useState)(!1),[n,a]=(0,ce.useState)(!1),[i,l]=(0,ce.useState)(!1),[s,p]=(0,ce.useState)(null),[u,h]=(0,ce.useState)([]),[f,v]=(0,ce.useState)(null),b=(0,ce.useRef)(u),[g,S]=(0,ce.useState)(!1),[_,E]=(0,ce.useState)(null),[k,I]=(0,ce.useState)(!1),[D,W]=(0,ce.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:T}),[M,H]=(0,ce.useState)({status:"initial"}),[z,ee]=(0,ce.useState)(null),[O,K]=(0,ce.useState)(null),L=Wt(),rt=Pl(),[Gt,Je]=(0,ce.useState)(!0),[pe,Q]=(0,ce.useState)({}),[ot,at]=(0,ce.useState)(null),[dr,_r]=(0,ce.useState)(null),[rr,qt]=(0,ce.useState)(!1),[Ee,st]=(0,ce.useState)(!1),ur=(0,ce.useRef)(null),mt=(0,ce.useRef)(null),N=(0,ce.useRef)(Wf),[Bo,We]=(0,ce.useState)(!1);t.onStoreToken=c=>{c&&U(N,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{p(null),l(!1),U(N,"accessToken","onAccessTokenRemoved")};let te=(0,ce.useRef)(null),se=(0,ce.useRef)(null),Me=c=>{E(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:c}})},or=c=>{L.embeddedWallets.createOnLogin!=="off"&&Je(!0),Me(c)};(0,ce.useEffect)(()=>{let c=Ai(s);if(!c||!O)return;let d={address:c.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:Wi,id:"io.privy.solana.wallet"},getProvider:async()=>new Jc(O,c.address)};v(d)},[O,s]),(0,ce.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=Oe(s),d=yl(s);if(c||t.connectors?.removeEmbeddedWalletConnector(),d||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!O){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}c&&t.connectors.addEmbeddedWalletConnector(O,c.address,L.defaultChain,e.appId),d&&t.connectors.addImportedWalletConnector(O,d.address,L.defaultChain,e.appId)},[O,s]),(0,ce.useEffect)(()=>{O&&dr?.(O)},[O]),(0,ce.useEffect)(()=>{(async()=>{if(!L.customAuth?.enabled)return;Je(!0);let{getCustomAccessToken:d,isLoading:m}=L.customAuth;if(!(!n||m))try{let w=await d();if(!w&&i){await Ci.logout();return}if(!w||i)return;t.startAuthFlow(new wi(w));let{user:P,isNewUser:B}=await t.authenticate();if(!P){await Ci.logout();return}p(P||null),S(B||!1),l(!0),st(!0)}catch(w){console.warn(w),i&&await Ci.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,i]),(0,ce.useEffect)(()=>{Ee&&O&&s&&hr(s,L.embeddedWallets.createOnLogin)&&(st(!1),Ra(s,Ti).catch(console.error))},[Ee&&O&&s]),(0,ce.useEffect)(()=>{async function c(){let d=op(),m=Br();l6();let w=(0,zv.createStore)();t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:w,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let P;t.connectors?.on("connectorInitialized",()=>{P&&clearTimeout(P);let he=t.connectors.walletConnectors.length,Xe=t.connectors.walletConnectors.reduce((_e,wt)=>_e+(wt.initialized?1:0),0);Xe===he?We(!0):P=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:Xe,expected:he}),We(!0)},1500)}),t.connectors?.initialize().then(()=>{Is()});let B=await t.getAuthenticatedUser(),q=!!B;if(L.customAuth?.enabled||(l(!!B),B&&U(N,"login","onComplete",B,!1,!0,null,null),p(B)),d){se.current=q?"link":"login";return}if(m&&!q){se.current="login",or("TELEGRAM_AUTH_SCREEN");return}de.setReadyToTrue(!!B)}!n&&rt&&c()},[t,ot,n,rt]),(0,ce.useEffect)(()=>{if(!n)return;if(!s){qt(!0);return}if(!!!s.linkedAccounts.find(m=>m.type==="wallet"&&m.walletClientType==="privy")){qt(!0);return}let d=!!u.find(m=>m.walletClientType==="privy");qt(d)},[n,s,u]);let op=()=>{let c=Va();if(c.inProgress&&c.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(c.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:c.stateCode,authorizationCode:c.authorizationCode});return}return!c.inProgress||c.headless?!1:(t.startAuthFlow(new bo(c)),or("AWAITING_OAUTH_SCREEN"),!0)},Br=()=>{let c=ym();if(!c||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let d=new xi;return t.startAuthFlow(d),c.flowType==="login-url"&&(d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult={id:c.id,first_name:c.first_name,last_name:c.last_name,auth_date:c.auth_date,username:c.username,photo_url:c.photo_url,hash:c.hash}),c.flowType==="web-app"&&(d.meta.telegramAuthResult=void 0,d.meta.telegramWebAppData={query_id:c.query_id,user:c.user,auth_date:c.auth_date,hash:c.hash}),!0},np=async(c,d,m,w)=>{let P=await t.connectors?.createWalletConnector(c,d)||null;dn(P,d,m,w)};async function dn(c,d,m,w){if(c)W({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:T});else return W({status:"disconnected",connectedWallet:null,connectError:new ye("Unable to connect to wallet."),connector:null,connectRetry:T}),w?.(null,m);c instanceof So&&d&&await c.resetConnection(d),W({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>dn(c,d,m,w)});try{let P=await c.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(B=>B.id===Number(P?.chainId))&&!(P?.connectorType==="wallet_connect_v2"&&P?.walletClientType==="metamask")&&!(P?.connectorType==="coinbase_wallet"&&L.externalWallets.coinbaseWallet.connectionOptions!=="eoaOnly")){W(B=>({...B,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:T}));try{await P?.switchChain(L.defaultChain.id),P&&(P.chainId=Ei(Vn(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return W(B=>({...B,status:"connected",connectedWallet:P,connectError:null,connectRetry:T})),P&&U(N,"connectWallet","onSuccess",P),w?.(P,m)}catch(P){return P instanceof yt?(console.warn(P.cause?P.cause:P.message),U(N,"connectWallet","onError",P.privyErrorCode||"generic_connect_wallet_error")):(console.warn(P),U(N,"connectWallet","onError","unknown_connect_wallet_error")),W(B=>({...B,status:"disconnected",connectedWallet:null,connectError:P})),w?.(null,m)}}let Bn=async(c,d)=>{if(c===null)return;let m=new Jn(c,t,d);t.startAuthFlow(m)},Is=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!d||!m)return;if(m==="phantom"&&!mn()&&or("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Me("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),np(d,m,void 0,Bn)};(0,ce.useEffect)(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(p)},[n,i,s,t]);let ft=()=>{if(!i)throw U(N,"linkAccount","onError","must_be_authenticated"),new C("User must be authenticated before linking an account.")},vi=()=>{ft(),te.current="siwe",se.current="link",Me("LINK_WALLET_SCREEN")},Hn=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===c.address&&d.walletClientType!=="privy")return!0;return!1},ht=async c=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(W(m=>({...m,connector:d,status:"connected",connectedWallet:c,connectError:null,connectRetry:T})),L.captchaEnabled&&!i){let m={callback:w=>Bn(c,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Q({captchaModalData:m}),or("CAPTCHA_SCREEN")}else await Bn(c),or("AWAITING_CONNECTION")},ct=async(c,d)=>{if(!L.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:m,externalTransactionId:w}=await Cg(t,c,d?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:w}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},Ho=()=>{h(c=>{let d=t.connectors?.wallets.map(m=>({...m,linked:Hn(m),loginOrLink:async()=>{if(!await m.isConnected())throw new C("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");ht(m)},fund:async w=>{let{signedUrl:P,externalTransactionId:B}=await ct(m.address,w);Q({fiatOnRampPrompt:{signedUrl:P},fiatOnRampStatus:{externalTransactionId:B}}),Me("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(m.address);p(w)}}))||[];return gl(c,d)?c:d})};(0,ce.useEffect)(()=>{Ho()},[s?.linkedAccounts,i,n]),(0,ce.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");Ho(),t.connectors.on("walletsUpdated",Ho)}},[n]);let ka=c=>{if(c&&"suggestedAddress"in c&&c.suggestedAddress){let d=(0,Fn.getAddress)(c.suggestedAddress);ee(d)}Me(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ce.useEffect)(()=>{if(!u[0])return;let c=u[0],d=b.current.find(w=>w.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===c.address&&w.walletClientType==="privy"):m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===c.address&&w.walletClientType!=="privy"),!d&&m){let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},p(w)}b.current=u},[u]);let Ra=async(c,d)=>{if(Oe(c))throw U(N,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,P]=await Promise.all([de.initializeWalletProxy(d),Te()]);if(!w&&L.customAuth?.enabled)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!P||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((B,q)=>{Je(!0),Q({createWallet:{onSuccess:Xe=>{U(N,"createWallet","onSuccess",Xe),B(Xe)},onFailure:Xe=>{U(N,"createWallet","onError","unknown_embedded_wallet_error"),q(Xe)},callAuthOnSuccessOnClose:!1}}),Me("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:P});let B=await de.refreshUser(),q=Oe(B);if(!q)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(N,"createWallet","onSuccess",q),q}},Vo=c=>{if(!L.chains.map(d=>d.id).includes(c))throw new ye(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Ws=(c,d,m)=>new Promise(async(w,P)=>{if(!i||!s){U(N,"sendTransaction","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=c.from,q=B?s?.linkedAccounts.find(Fe=>Fe.type==="wallet"&&Fe.walletClientType==="privy"&&Fe.address===B):Oe(s);if(!q){U(N,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}Je(!0);let he=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Xe=c.chainId?Number(c.chainId):he.chainId;Vo(Xe);let _e=Object.assign({},c,{chainId:Xe}),wt=async()=>{let Fe=await Te();if(!Fe||!O){U(N,"sendTransaction","onError","embedded_wallet_not_found"),P(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await de.recoverEmbeddedEthereumWallet()){U(N,"sendTransaction","onError","unknown_connect_wallet_error"),P(new Error("Unable to connect to wallet"));return}let ro=qo(_e.chainId,L.chains,L.rpcConfig,{appId:e.appId}),ip=await(0,Aa.populateTransactionRequest)(q.address,_e,ro);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:N3}=await(0,Aa.calculateTotalGasEstimate)(ip,ro),{hasSufficientFunds:D3}=await Gc(q.address,ip,N3,ro);if(!D3)throw new It(new Ar("Wallet has insufficient funds for this transaction.",Aa.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Xd=await Vc(Fe,q.address,O,ip,ro);U(N,"sendTransaction","onSuccess",Xd),w(Xd)}catch(Os){U(N,"sendTransaction","onError","transaction_failure"),P(Os)}};if(L.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),wt();else{let Fe={transactionRequest:_e,onSuccess:ro=>{U(N,"sendTransaction","onSuccess",ro),w(ro)},onFailure:ro=>{U(N,"sendTransaction","onError","transaction_failure"),P(ro)},uiOptions:d||{},fundWalletConfig:m},Os={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:ro=>{U(N,"sendTransaction","onError","unknown_connect_wallet_error"),P(ro)}};Q({connectWallet:Os,sendTransaction:Fe}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Zd(){return new Promise(async(c,d)=>{let m=await Te();if(!m||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:m}),c()}catch(w){d(w)}})}let Qd=c=>c?.linkedAccounts.filter(d=>d.latestVerifiedAt!==null&&!(d.type==="wallet"&&d.walletClientType==="privy")).sort((d,m)=>m.latestVerifiedAt.getTime()-d.latestVerifiedAt.getTime())[0],mr=c=>{if(c==="passkey"){if(s&&s.linkedAccounts.filter(d=>d.type==="passkey").length>=5)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${c} linked.`)}else if(s?.[c])throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C(`User already has an account of type ${c} linked.`)},O3=()=>{if(!L.loginConfig.telegramAuthConfiguration?.linkEnabled)throw U(N,"linkAccount","onError","cannot_link_more_of_type"),new C("User can't link an account because Telegram linking is disabled.")};async function Jd({legacySetWalletPasswordFlow:c=!1}){E(null);let d=c?"setWalletPassword":"setWalletRecovery";if(!i||!s)throw U(N,d,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let m=Oe(s);if(!m||!O)throw U(N,d,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");try{await Zd()}catch(w){throw U(N,d,"onError","missing_or_invalid_mfa"),w}return new Promise((w,P)=>{Je(!0);let B={onSuccess:_e=>{U(N,d,"onSuccess","user-passcode",_e),w(_e)},onFailure:_e=>{U(N,d,"onError","user_exited_set_password_flow"),P(_e)},callAuthOnSuccessOnClose:!1},q=m.recoveryMethod==="user-passcode",Xe={onCompleteNavigateTo:Xl({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:c,isResettingPassword:q}),shouldForceMFA:!1,onFailure:_e=>{U(N,d,"onError","unknown_connect_wallet_error"),P(_e)}};Q({setWalletPassword:B,createWallet:B,connectWallet:Xe,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:q}}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function Ms({appId:c}){ft(),te.current=`privy:${c}`,se.current="link";let d=window.open(void 0,void 0,zd({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{appId:c}}),new Promise(async(m,w)=>{let{name:P,logoUrl:B}=await Xc({api:t.api,providerAppId:c,requesterAppId:L.id});Q({crossAppAuth:{appId:c,name:P,logoUrl:B,popup:d,onSuccess:m,onError:w}}),or("CROSS_APP_AUTH_SCREEN")})}let Ci={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:ka,importWallet:async({privateKey:c})=>{ft();let[d,m]=await Promise.all([de.initializeWalletProxy(15e3),Te()]);if(d&&m){await d.import({privateKey:c,accessToken:m});let w=await de.refreshUser(),P=yl(w);if(!P)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return U(N,"createWallet","onSuccess",P),P}else throw new C("User is not authenticated")},linkWallet:vi,linkCrossAppAccount:Ms,linkEmail:()=>{ft(),mr("email"),te.current="email",se.current="link",Me("LINK_EMAIL_SCREEN")},linkPhone:()=>{ft(),mr("phone"),te.current="sms",se.current="link",Me("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ft(),mr("google"),se.current="link",await de.initLoginWithOAuth("google")},linkTwitter:async()=>{ft(),mr("twitter"),se.current="link",await de.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ft(),mr("discord"),se.current="link",await de.initLoginWithOAuth("discord")},linkGithub:async()=>{ft(),mr("github"),se.current="link",await de.initLoginWithOAuth("github")},linkSpotify:async()=>{ft(),mr("spotify"),se.current="link",await de.initLoginWithOAuth("spotify")},linkInstagram:async()=>{ft(),mr("instagram"),se.current="link",await de.initLoginWithOAuth("instagram")},linkTiktok:async()=>{ft(),mr("tiktok"),se.current="link",await de.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ft(),mr("linkedin"),se.current="link",await de.initLoginWithOAuth("linkedin")},linkApple:async()=>{ft(),mr("apple"),se.current="link",await de.initLoginWithOAuth("apple")},linkPasskey:async()=>{ft(),mr("passkey"),await de.initLinkWithPasskey(),Me("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{ft(),mr("telegram"),O3(),se.current="link",te.current="telegram",await de.initLoginWithTelegram(),Me("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{ft(),mr("farcaster"),await de.initLoginWithFarcaster(),se.current="link",te.current="farcaster",Me("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ft(),!s?.email)throw new C("User does not have an email linked to their account.");se.current="link",te.current="email",Me("UPDATE_EMAIL_SCREEN")},login:async()=>{let c="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(m=>{at(w=>m.bind(w))});if(at(null),d){console.warn(c);return}}if(i){console.warn(c);return}se.current="login",or("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{at(()=>c)}),at(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}or("CONNECT_OR_CREATE")},logout:async()=>{if(s&&t.clearProviderAcccessTokens(s),await t.logout(),s&&O)try{await O.clearMfa({userId:s.id})}catch{}p(null),l(!1),E(null),U(N,"logout","onSuccess"),se.current=null,te.current=null,o(!1),oe.del(Na)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new it;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===c?.address));return!c||!d?new it:d.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new rp.Web3Provider(new no(new it));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===c?.address));return!c||!d?new rp.Web3Provider(new no(new it)):new rp.Web3Provider(new no(d.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new gn(new it);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===c?.address));return!c||!d?new gn(new it):new gn(d.proxyProvider)},unlinkWallet:async c=>{let d=await t.unlinkWallet(c);return p(d),d},unlinkEmail:async c=>{let d=await t.unlinkEmail(c);return p(d),d},unlinkPhone:async c=>{let d=await t.unlinkPhone(c);return p(d),d},unlinkGoogle:async c=>{let d=await t.unlinkOAuth("google",c);return p(d),d},unlinkTwitter:async c=>{let d=await t.unlinkOAuth("twitter",c);return p(d),d},unlinkDiscord:async c=>{let d=await t.unlinkOAuth("discord",c);return p(d),d},unlinkGithub:async c=>{let d=await t.unlinkOAuth("github",c);return p(d),d},unlinkSpotify:async c=>{let d=await t.unlinkOAuth("spotify",c);return p(d),d},unlinkInstagram:async c=>{let d=await t.unlinkOAuth("instagram",c);return p(d),d},unlinkTiktok:async c=>{let d=await t.unlinkOAuth("tiktok",c);return p(d),d},unlinkLinkedIn:async c=>{let d=await t.unlinkOAuth("linkedin",c);return p(d),d},unlinkApple:async c=>{let d=await t.unlinkOAuth("apple",c);return p(d),d},unlinkFarcaster:async c=>{let d=await t.unlinkFarcaster(c);return p(d),d},unlinkTelegram:async c=>{let d=await t.unlinkTelegram(c);return p(d),d},unlinkPasskey:async c=>{let d=await t.unlinkPasskey(c);return p(d),d},unlinkCrossAppAccount:async({subject:c})=>{let d=s?.linkedAccounts.find(w=>w.type==="cross_app"&&w.subject===c)?.providerApp;if(!d)throw new C("Invalid subject");t.storeProviderAccessToken(d.id,null);let m=await t.unlinkOAuth(`privy:${d.id}`,c);return p(m),m},setActiveWallet:async c=>{let d=u.find(w=>(0,Fn.getAddress)(w.address)===(0,Fn.getAddress)(c)),m=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Fn.getAddress)(w.address)===(0,Fn.getAddress)(c));if(!d||!await d.isConnected())ee(c),vi();else if(!d.linked)d.loginOrLink();else{let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType,imported:m.imported},p(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw U(N,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ra(s,15e3)},setWalletRecovery:async()=>Jd({legacySetWalletPasswordFlow:!1}),setWalletPassword:async()=>Jd({legacySetWalletPasswordFlow:!0}),signMessage:(c,d,m)=>new Promise(async(w,P)=>{if(!i||!s){U(N,"signMessage","onError","must_be_authenticated"),P(new Error("User must be authenticated before signing with a Privy wallet"));return}let B=m?s?.linkedAccounts.find(he=>he.type==="wallet"&&he.walletClientType==="privy"&&(0,Fn.getAddress)(he.address)===(0,Fn.getAddress)(m)):Oe(s);if(!B){U(N,"signMessage","onError","embedded_wallet_not_found"),P(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){U(N,"signMessage","onError","invalid_message"),P(new Error("Message must be a non-empty string"));return}Je(!0);let q=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let he=await Te();if(!O||!he)throw new Error("Unable to connect to wallet");if(!await de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:B.address}});let{response:_e}=await O.rpc({accessToken:he,address:B.address,request:{method:"personal_sign",params:[c,B.address]}}),wt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:B.address}}),wt};if(L.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let he=await q();U(N,"signMessage","onSuccess",he),w(he)}catch(he){U(N,"signMessage","onError","unable_to_sign"),P(he??new It("Unable to sign message"))}}else{let _e={method:"personal_sign",data:c,confirmAndSign:q,onSuccess:Fe=>{U(N,"signMessage","onSuccess",Fe),w(Fe)},onFailure:Fe=>{U(N,"signMessage","onError","unable_to_sign"),P(Fe)},uiOptions:d||{}},wt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Fe=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),P(Fe)},address:B.address};Q({signMessage:_e,connectWallet:wt}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,d)=>new Promise(async(m,w)=>{if(!i||!s){U(N,"signTypedData","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let P=Oe(s);if(!P){U(N,"signTypedData","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}Je(!0);let B=Wa(c),q=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let he=await Te();if(!O||!he)throw new Error("Unable to connect to wallet");if(!await de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:P.address}});let{response:_e}=await O.rpc({accessToken:he,address:P.address,request:{method:"eth_signTypedData_v4",params:[P.address,B]}}),wt=_e.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:P.address}}),wt};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let he=await q();U(N,"signTypedData","onSuccess",he),m(he)}catch(he){U(N,"signTypedData","onError","unable_to_sign"),w(he??new It("Unable to sign message"))}}else{let _e={method:"eth_signTypedData_v4",data:B,confirmAndSign:q,onSuccess:Fe=>{U(N,"signTypedData","onSuccess",Fe),m(Fe)},onFailure:Fe=>{U(N,"signTypedData","onError","unable_to_sign"),w(Fe)},uiOptions:d||{}},wt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Fe=>{U(N,"signMessage","onError","unknown_connect_wallet_error"),w(Fe)}};Q({signMessage:_e,connectWallet:wt}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,d,m)=>{let P=await(await Ws(c,d,m)).wait();return qc(P)},exportWallet:()=>new Promise(async(c,d)=>{if(!i||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Oe(s)){d(new Error("Must have a Privy wallet before exporting"));return}Je(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d,shouldForceMFA:!0};if(Q(pe),!await Te()||!O){d(new Error("Must have valid access token to enroll in MFA"));return}if(!O){d(new Error("Must have a Privy wallet before exporting"));return}let B={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,onSuccess:c,onFailure:d};Q({keyExport:B,connectWallet:w}),Me("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Zd,async init(c){switch(c){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}},async submit(c,d){switch(c){case"totp":case"sms":if(typeof d!="string")throw new C("Invalid MFA code");ur.current?.resolve({mfaMethod:c,mfaCode:d,relyingParty:window.origin}),await new Promise((B,q)=>{mt.current={resolve:B,reject:q}});break;case"passkey":if(typeof d=="string")throw new C("Invalid authenticator response");let w=await(await import("@simplewebauthn/browser")).startAuthentication(d),P=qv(w);ur.current?.resolve({mfaMethod:c,mfaCode:P,relyingParty:window.origin}),await new Promise((B,q)=>{mt.current={resolve:B,reject:q}});break;default:throw ur.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${c}`)}},cancel(){ur.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((d,m)=>{if(!c){de.closePrivyModal(),d();return}L.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Q({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:d,onFailure:m}}),Me("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await Te();if(!c||!O)throw new Error("Must have valid access token to enroll in MFA");let d=await O.initEnrollMfa({method:"totp",accessToken:c});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();p(m)},async submitEnrollmentWithTotp(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:d,code:c.mfaCode});let m=await t.getAuthenticatedUser();p(m)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:c}){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:c});let m=await t.getAuthenticatedUser();p(m)},async unenroll(c){let d=await Te();if(!d||!O)throw new Error("Must have valid access token to remove MFA");c==="passkey"?await O.submitEnrollMfa({method:"passkey",accessToken:d,credentialIds:[]}):await O.unenrollMfa({method:c,accessToken:d});let m=await t.getAuthenticatedUser();p(m)},requestFarcasterSignerFromWarpcast:async()=>{let c=await Te(),d=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!d)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 de.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let w=await O.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(w.status==="approved"){let P=await t.getAuthenticatedUser();p(P||s||null)}Q({farcasterSigner:w}),Me("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let c=await Te(),d=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!d)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 de.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(P=>Uint8Array.from(P.match(/.{1,2}/g).map(B=>parseInt(B,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async c=>{let d=await Te(),m=s?.linkedAccounts.find(q=>q.type==="wallet"&&q.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await de.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 P=await import("@simplewebauthn/browser"),B=await O.signFarcasterMessage({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{hash:P.bufferToBase64URLString(c)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(P.base64URLStringToBuffer(B.signature))},isHeadlessOAuthLoading:k,loginWithCode(c){return de.loginWithCode(c)},initLoginWithEmail(c){return de.initLoginWithEmail(c)},initLoginWithSms(c){return de.initLoginWithSms(c)},otpState:M,fundWallet(c,d){return de.fundWallet(c,d)},initLoginWithHeadlessOAuth(c,d){return de.initLoginWithHeadlessOAuth(c,d)},loginWithHeadlessOAuth(c){return de.loginWithHeadlessOAuth(c)},generateSiweMessage({address:c,chainId:d}){return de.generateSiweMessage({address:c,chainId:d})},linkWithSiwe({message:c,signature:d,chainId:m,walletClientType:w,connectorType:P}){return ft(),de.linkWithSiwe({message:c,signature:d,chainId:m,walletClientType:w,connectorType:P})},signMessageWithCrossAppWallet(c,{address:d}){return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"personal_sign",params:[c,d]},reconnect:Ms})},signTypedDataWithCrossAppWallet(c,{address:d}){let m=Wa(c);return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[d,m]},reconnect:Ms})},sendTransactionWithCrossAppWallet(c,{address:d}){return ep({user:s,client:t,address:d,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[c]},reconnect:Ms})},isModalOpen:r,mfaMethods:L.mfa.methods};Kv=Ci.signMessage,jv=Ci.signTypedData,Yv=async(...c)=>{let d=await Ws(...c);return L.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let de=(()=>({isNewUserThisSession:g,linkingOrConnectingHint:z,pendingTransaction:null,walletConnectionStatus:D,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>L.chains.find(d=>d.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(O)return O;let d=new Promise(P=>{_r(()=>B=>P(B))}),m=new Promise(P=>setTimeout(()=>P(null),c)),w=await Promise.race([d,m]);return _r(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&s,m;d&&te.current&&(m=Qd(s)),se.current==="login"?c.shouldCallAuthOnSuccess&&d&&te.current?(U(N,"login","onComplete",s,g,!1,te.current,m??null),e.onSuccess?.(s,g)):U(N,"login","onError","exited_auth_flow"):se.current==="link"&&m&&(c.isSuccess&&d&&te.current?U(N,"linkAccount","onSuccess",s,te.current,m):U(N,"linkAccount","onError","exited_link_flow")),ee(null),se.current=null,te.current=null,S(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:Me,connectWallet:dn,initLoginWithWallet:async(c,d)=>{te.current="siwe",Bn(c,d)},loginWithWallet:async()=>{if(!n)throw new Go;if(!(t.authFlow instanceof Jn))throw new C("Must initialize SIWE flow first.");let c,d;if(i)try{({user:c}=await t.link()),te.current="siwe"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:d}=await t.authenticate()),te.current="siwe"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}p(c||s||null),S(d||!1),l(!0)},initLoginWithFarcaster:async c=>{let d=new Ma(c);t.startAuthFlow(d);try{te.current="farcaster",await d.initializeFarcasterConnect()}catch(m){throw se.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Go;if(!(t.authFlow instanceof Ma))throw new C("Must initialize Farcaster flow first.");let c,d;if(i)try{({user:c}=await t.link()),te.current="farcaster"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:d}=await t.authenticate()),te.current="farcaster"}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}p(c||null),S(d||!1),l(!0)},async crossAppAuthFlow({appId:c,popup:d}){let m=`privy:${c}`;te.current=m;let{url:w,stateCode:P,codeVerifier:B}=await Hv({api:t.api,appId:c});if(!w)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:c}}),new C("No authorization URL returned for cross-app auth.");try{let q=await Gv({url:w,popup:d,provider:m}),he=q.stateCode,Xe=q.authorizationCode;if(he!==P)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:m,storedStateCode:P??"",returnedStateCode:he??""}}),new C("Unexpected auth flow. This may be a phishing attempt.");let _e=await Vv({api:Fo.api,appId:c,codeVerifier:B,stateCode:he,authorizationCode:Xe});t.storeProviderAccessToken(c,_e);let wt=await de.refreshUser();if(!wt)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{appId:c}}),wt}catch(q){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:q.toString(),provider:m}}),q}},async initLoginWithOAuth(c,d){if(te.current=c,cp()){if(c==="google"&&tp(window.navigator.userAgent)){or("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{or("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}oe.del($n);let m=new bo({provider:c});d&&m.addCaptchaToken(d),t.startAuthFlow(m);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&(c==="twitter"&&$v.isAndroid&&(w.url=w.url.replace("x.com","twitter.com")),window.location.assign(w.url))},async initLoginWithTelegram(c){if(!n)throw new Go;te.current="telegram";let d=new xi(c);t.startAuthFlow(d),d.meta.telegramWebAppData=void 0,d.meta.telegramAuthResult=await new Promise((m,w)=>{if(!L.loginConfig.telegramAuthConfiguration)return w(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return w(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},P=>P?m(P):w(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof xi))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let c,d;if(i)try{({user:c}=await t.link()),te.current="telegram"}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{let m=await t.authenticate();c=m.user,d=m.isNewUser,te.current="telegram"}catch(m){throw se.current==="login"?U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}p(c),S(d||!1),l(!0)},async recoveryOAuthFlow(c,d,m){let w,P;function B(q){if(!q)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:c}}),new C("Recovery OAuth failed")}switch(c){case"google-drive":{let{url:q,codeVerifier:he,stateCode:Xe}=await td({api:Fo.api,provider:c});B(q);let _e,wt;try{let Fe=await $d({url:q,popup:m,provider:c});if(_e=Fe.stateCode,wt=Fe.authorizationCode,_e!==Xe)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c,storedStateCode:Xe??"",returnedStateCode:_e??""}}),new C("Unexpected auth flow. This may be a phishing attempt.")}catch(Fe){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Fe.toString(),provider:c}}),new C("Recovery OAuth failed")}[w,P]=await Promise.all([Te(),Gh({api:Fo.api,provider:c,codeVerifier:he,stateCode:_e,authorizationCode:wt})]);break}case"icloud":{let{url:q}=await td({api:Fo.api,provider:c});B(q);let{ckWebAuthToken:he}=await $d({url:q,popup:m,provider:c});P=he,w=await Te();break}}if(!O)throw new C("Cannot connect to wallet proxy");if(!w)throw new C("Unable to authorize user");switch(d){case"recover":let q=pe.recoverWallet?.privyWallet?.address;if(!q)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:q,recoveryMethod:c}}),await O.recover({address:q,accessToken:w,recoveryAccessToken:P,recoveryMethod:c}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:q,recoveryMethod:c}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await O.create({accessToken:w,recoveryAccessToken:P,recoveryMethod:c});let he=await de.refreshUser(),Xe=Oe(he);if(!Xe)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Xe.address}}),U(N,"createWallet","onSuccess",Xe);break;case"set-recovery":let _e=Oe(s);if(!_e)throw U(N,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{recoveryMethod:c}}),await O.setRecovery({address:_e.address,accessToken:w,recoveryAccessToken:P,recoveryMethod:c});let wt=Oe(await de.refreshUser());if(!wt)throw U(N,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:_e.address,recoveryMethod:c}}),U(N,"setWalletRecovery","onSuccess",c,wt);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(c){if(!(t.authFlow instanceof bo))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=oe.get(qn),m=t.authFlow.meta.stateCode;if(d!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c,storedStateCode:d??"",returnedStateCode:m??""}}),new C("Unexpected auth flow. This may be a phishing attempt.");let w,P,B;if(i)try{let q=await t.link();w=q.user,B=q.oAuthTokens,te.current=c}catch(q){throw U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}else try{let q=await t.authenticate();w=q.user,P=q.isNewUser,B=q.oAuthTokens,te.current=c}catch(q){throw se.current==="login"?U(N,"login","onError",q.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),q}return p(w),S(P||!1),l(!0),B&&U(N,"oAuthAuthorization","onOAuthTokenGrant",B),B},async initLoginWithPasskey(c){let d=new Qn(c);t.startAuthFlow(d),se.current="login";try{te.current="passkey",await d.initAuthenticationFlow()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new Go;if(!(t.authFlow instanceof Qn))throw new C("Must initialize Passkey flow first.");if(te.current!=="passkey")throw new C("Must init login with Passkey flow first.");let c,d;try{te.current="passkey",{user:c,isNewUser:d}=await t.authenticate()}catch(m){throw U(N,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}p(c),S(d||!1),l(!0)},async initLinkWithPasskey(c){let d=new Qn(c);t.startAuthFlow(d),se.current="link",te.current="passkey";try{await d.initLinkFlow()}catch(m){throw U(N,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new Go;if(!(t.authFlow instanceof Qn))throw new C("Must initialize Passkey flow first.");if(te.current!=="passkey")throw new C("Must init login with Passkey flow first.");let c;try{te.current="passkey",{user:c}=await t.link()}catch(d){throw U(N,"linkAccount","onError",d.privyErrorCode||"failed_to_link_account"),d}return p(c||s||null),c},async initLoginWithHeadlessOAuth(c,d){if(cp()){if(c==="google"&&tp(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let m=new bo({provider:c,headless:!0});d&&m.addCaptchaToken(d);let w=await t.startAuthFlow(m).getAuthorizationUrl();w?.url&&window.location.assign(w.url)},async loginWithHeadlessOAuth(c){I(!0),t.startAuthFlow(new bo(c));let d=oe.get(qn),m=c.stateCode;if(d!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:c.provider,storedStateCode:d??"",returnedStateCode:m??""}}),I(!1),new C("Unexpected auth flow. This may be a phishing attempt.");let w,P;if(i)try{({user:w}=await t.link()),te.current=c.provider}catch(B){throw U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}else try{({user:w,isNewUser:P}=await t.authenticate()),te.current=c.provider}catch(B){throw se.current==="login"?U(N,"login","onError",B.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",B.privyErrorCode||"failed_to_link_account"),B}return p(w),S(P||!1),l(!0),I(!1),w??void 0},initLoginWithEmail:async(c,d)=>{let m=new un(c,d);t.startAuthFlow(m);try{te.current="email",await m.sendCodeEmail()}catch(w){throw se.current==="login"?U(N,"login","onError",w.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},initUpdateEmail:async(c,d,m)=>{let w=new zs(c,d,m);t.startAuthFlow(w),await w.sendCodeEmail()},initLoginWithSms:async(c,d)=>{H({status:"sending-code"});let m=new Xn(c,d);t.startAuthFlow(m);try{te.current="sms",await m.sendSmsCode(),H({status:"awaiting-code-input"})}catch(w){throw H({status:"error",error:w}),se.current==="login"?U(N,"login","onError",w.privyErrorCode||"unknown_auth_error"):se.current==="link"&&U(N,"linkAccount","onError",w.privyErrorCode||"failed_to_link_account"),w}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(H({status:"submitting-code"}),!n){let P=new Go;throw H({status:"error",error:P}),P}if(t.authFlow instanceof un)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof Xn)t.authFlow.meta.smsCode=c.trim();else{let P=new C("Must initialize a passwordless code flow first");throw H({status:"error",error:P}),P}let d=await Te(),m,w;if(d&&t.sessionHasActiveToken())try{({user:m}=await t.link())}catch(P){throw H({status:"error",error:P}),U(N,"linkAccount","onError",P.privyErrorCode||"failed_to_link_account"),P}else try{({user:m,isNewUser:w}=await t.authenticate())}catch(P){throw H({status:"error",error:P}),U(N,"login","onError",P.privyErrorCode||"unknown_auth_error"),P}p(m||s||null),S(w||!1),l(!0),H({status:"done"})},generateSiweMessage:async({address:c,chainId:d,captchaToken:m})=>{se.current="link",te.current="siwe";let w=await t.generateSiweNonce({address:c,captchaToken:m}),P=d.replace("eip155:","");return hl({address:c,chainId:P,nonce:w})},linkWithSiwe:async({message:c,signature:d,chainId:m,walletClientType:w,connectorType:P})=>{let B;try{if(se.current!=="link"||te.current!=="siwe")throw new C("Must ensure no other auth flow is in progress other than the SIWE signature flow.");B=await t.linkWithSiwe({message:c,signature:d,chainId:m,walletClientType:w,connectorType:P});let q=Qd(B);q&&U(N,"linkAccount","onSuccess",B,"siwe",q)}catch(q){throw U(N,"linkAccount","onError",q.privyErrorCode||"failed_to_link_account"),se.current=null,te.current=null,q}p(B||s||null),se.current=null,te.current=null},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return p(c),c},walletProxy:O,createAnalyticsEvent:({eventName:c,payload:d,timestamp:m})=>t.createAnalyticsEvent({eventName:c,payload:d,timestamp:m}),acceptTerms:async()=>{let c=await t.acceptTerms();return p(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedEthereumWallet:async()=>new Promise(async(c,d)=>{let m=Oe(s)||yl(s),w=await Te();if(!w||!O||!m){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Je(!0);try{await O.connect({accessToken:w,address:m.address}),c(!0)}catch(P){if(si(P)&&m.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await O.recover({address:m.address,accessToken:w,recoveryMethod:m.recoveryMethod})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),c(!0);else if(si(P)&&m.recoveryMethod!=="privy"){Q({recoverWallet:{privyWallet:m,onFailure:d,onSuccess:()=>c(!0)},recoveryOAuthStatus:{provider:m.recoveryMethod,action:"recover"}});let B=ec(m.recoveryMethod);Me(B)}else d(P)}}),embeddedSolanaWallet:f,createEmbeddedSolanaWallet:async()=>{Je(!0);let c=await Te(),d=Ai(s),m=Oe(s);if(!s||!c)throw new C("User must be logged in to create a Solana wallet");if(d)throw new C("User already has an embedded Solana wallet.");if(m)throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet.");let w=await de.initializeWalletProxy(15e3);if(!w)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await w.createSolana({accessToken:c});let P=await de.refreshUser(),B=Ai(P);if(!B)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:B.address}}),B}catch(P){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",P)}},recoverEmbeddedSolanaWallet:async()=>new Promise(async(c,d)=>{let m=Ai(s),w=await Te();if(!w||!O||!m){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Je(!0);try{await O.connectSolana({accessToken:w,publicKey:m.address}),c(!0)}catch(P){si(P)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await O.recoverSolana({publicKey:m.address,accessToken:w})).publicKey||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:m.address}}),c(!0)):d(P)}}),getFiatOnRampConfig:ct,setReadyToTrue:c=>{a(!0),ot?.(c)},updateWallets:()=>Ho(),fundWallet:async(c,d)=>{let{signedUrl:m,externalTransactionId:w}=await ct(c,d);Q({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:w}}),Me("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let d=await Te(),m=s?.linkedAccounts.find(P=>P.type==="wallet"&&P.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!O||!m)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let w=await t.requestFarcasterSignerStatus(c);if(w.status==="approved"){let P=await t.getAuthenticatedUser();p(P||s||null)}return w}}))();Zv=de.recoverEmbeddedEthereumWallet,Qv=de.recoverEmbeddedSolanaWallet;let L3=(0,ce.useMemo)(()=>({wallets:u,ready:rr&&Bo}),[u,rr,Bo]);return(0,tr.jsx)(xe.Provider,{value:Ci,children:(0,tr.jsx)(Lp.Provider,{value:N,children:(0,tr.jsx)(Md.Provider,{value:L3,children:(0,tr.jsx)(Af,{...L,children:(0,tr.jsxs)(Op.Provider,{value:de,children:[(0,tr.jsxs)(gf,{data:pe,setModalData:Q,setInitialScreen:E,initialScreen:_,authenticated:i,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!i&&(0,tr.jsx)(Rl,{delayedExecution:!1}),(0,tr.jsx)(Rv,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&(0,tr.jsx)(Zc,{open:r})]}),Gt&&rt?(0,tr.jsx)(Uv,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ur,mfaSubmitPromise:mt,onLoad:K,onLoadFailed:()=>null}):null,L.loginMethods.telegram&&L.loginConfig.telegramAuthConfiguration&&(0,tr.jsx)(uo,{if:!0,children:(0,tr.jsx)(Lv,{scriptHost:e.apiUrl||Oa,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};var Xv=require("react");function e3(e){let{login:t}=(0,Xv.useContext)(xe);return Ye("login",e),{login:t}}var t3=require("react");function r3(e){let{logout:t}=(0,t3.useContext)(xe);return Ye("logout",e),{logout:t}}var Rs=require("react");function o3(){let e=Pe(),t=Pl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=(0,Rs.useCallback)(async p=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r(p.provider,e.token)},[r,e]),s=(0,Rs.useCallback)(async()=>{let p=Va();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!p.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!p.popupFlow)try{return await o(p)}catch(u){throw u}finally{Zn()}},[o]);return(0,Rs.useEffect)(()=>{let p=Va();a&&t&&p.inProgress&&p.headless&&!p.popupFlow&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var Kd=require("react");var n3=()=>{let e=Pe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=(0,Kd.useCallback)(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=(0,Kd.useCallback)(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Rr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var jd=require("react");var i3=()=>{let e=Pe(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=(0,jd.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=(0,jd.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};var Yd=require("react");var a3=()=>{let e=Pe(),{generateSiweMessage:t,linkWithSiwe:r}=G(),o=(0,Yd.useCallback)(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=(0,Yd.useCallback)(async({signature:a,message:i,chainId:l,walletClientType:s,connectorType:p})=>{if(e.enabled&&e.status!=="success")throw new Rr(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:l,walletClientType:s,connectorType:p})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};var s3=require("react");function l3(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:p,linkTiktok:u,linkSpotify:h,linkInstagram:f,linkTelegram:v,linkFarcaster:b}=(0,s3.useContext)(xe);return Ye("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:p,linkTiktok:u,linkSpotify:h,linkInstagram:f,linkFarcaster:b,linkTelegram:v}}var c3=require("react");function p3(e){let{connectWallet:t}=(0,c3.useContext)(xe);return Ye("connectWallet",e),{connectWallet:t}}var d3=require("react");function u3(e){let{createWallet:t}=(0,d3.useContext)(xe);return Ye("createWallet",e),{createWallet:t}}var m3=()=>{let{fundWallet:e}=G();return{fundWallet:e}};var f3=()=>{let{embeddedSolanaWallet:e,createEmbeddedSolanaWallet:t}=R();return{createWallet:t,wallets:e?[e]:[]}};var h3=()=>{let{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=G();return{linkCrossAppAccount:e,unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};var y3=require("react");function g3(e){let{sendTransaction:t}=(0,y3.useContext)(xe);return Ye("sendTransaction",e),{sendTransaction:t}}var v3=require("react");function C3(e){let{setWalletPassword:t}=(0,v3.useContext)(xe);return Ye("setWalletPassword",e),{setWalletPassword:t}}var w3=require("react");function b3(e){let{setWalletRecovery:t}=(0,w3.useContext)(xe);return Ye("setWalletRecovery",e),{setWalletRecovery:t}}var E3=require("react");function T3(e){let{signMessage:t}=(0,E3.useContext)(xe);return Ye("signMessage",e),{signMessage:t}}var P3=require("react");function S3(e){let{signTypedData:t}=(0,P3.useContext)(xe);return Ye("signTypedData",e),{signTypedData:t}}var _3=require("react");var x3=()=>{let{isModalOpen:e}=(0,_3.useContext)(xe);return{isOpen:e}};var A3=require("react");function k3(e){let{getAccessToken:t}=(0,A3.useContext)(xe);return Ye("accessToken",e),{getAccessToken:t}}function R3(e){let{authenticated:t,user:r}=G(),{initLoginWithOAuth:o}=R(),n=Gi();return Ye("oAuthAuthorization",e),{reauthorize:a=>p6(t,r,o,n,a.provider)}}var p6=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated"),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)};function I3(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=G();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function W3(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function M3(e){return e.find(r=>r.walletClientType==="privy"&&r.connectorType==="embedded"&&!r.imported)??null}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,LoginModal,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,getEmbeddedConnectedWallet,useConnectWallet,useCreateWallet,useCrossAppAccounts,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLinkWithSiwe,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,useOAuthTokens,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSetWalletRecovery,useSignMessage,useSignTypedData,useSolanaWallets,useToken,useWallets});
|